From 7957542fc93a699108743a0c44ba6844d447fa32 Mon Sep 17 00:00:00 2001 From: anatol Date: Tue, 11 Jun 2024 08:31:27 +0300 Subject: [PATCH] fixed build --- android/jni.cpp | 66 ++++++++++++++--------------- android/node_model.cpp | 4 +- android/wallet_model.cpp | 58 ++++++++++++------------- wallet/unittests/ethereum_test.cpp | 68 +++++++++++++++--------------- wallet/unittests/offline.cpp | 2 +- wallet/unittests/wallet_test.cpp | 2 +- wasmclient/wasmclient.cpp | 8 ++-- 7 files changed, 104 insertions(+), 104 deletions(-) diff --git a/android/jni.cpp b/android/jni.cpp index 715e148f0..518f00a20 100644 --- a/android/jni.cpp +++ b/android/jni.cpp @@ -111,14 +111,14 @@ extern "C" { JNIEXPORT jboolean JNICALL BEAM_JAVA_WALLET_INTERFACE(isAddress)(JNIEnv *env, jobject thiz, jstring address) { - LOG_DEBUG() << "isAddress()"; + BEAM_LOG_DEBUG() << "isAddress()"; return beam::wallet::CheckReceiverAddress(JString(env, address).value()); } JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(selectCoins)(JNIEnv *env, jobject thiz, jlong amount, jlong fee, jboolean isShielded, jint assetId) { - LOG_DEBUG() << "selectCoins()"; + BEAM_LOG_DEBUG() << "selectCoins()"; Amount bAmount = Amount(amount); Amount bFee = Amount(fee); @@ -129,7 +129,7 @@ extern "C" { JNIEXPORT jboolean JNICALL BEAM_JAVA_WALLET_INTERFACE(isToken)(JNIEnv *env, jobject thiz, jstring token) { - LOG_DEBUG() << "isToken()"; + BEAM_LOG_DEBUG() << "isToken()"; auto params = beam::wallet::ParseParameters(JString(env, token).value()); return params && params->GetParameter(beam::wallet::TxParameterID::TransactionType); @@ -138,7 +138,7 @@ JNIEXPORT jboolean JNICALL BEAM_JAVA_WALLET_INTERFACE(isToken)(JNIEnv *env, jobj JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(JNIEnv *env, jobject thiz, jstring token, jboolean requestInfo) { - LOG_DEBUG() << "getTransactionParameters()"; + BEAM_LOG_DEBUG() << "getTransactionParameters()"; auto address = JString(env, token).value(); auto params = beam::wallet::ParseParameters(address); @@ -162,13 +162,13 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(J if(amount) { - LOG_DEBUG() << "amount(" << *amount << ")"; + BEAM_LOG_DEBUG() << "amount(" << *amount << ")"; setLongField(env, TransactionParametersClass, jParameters, "amount", *amount); } else { - LOG_DEBUG() << "amount not found"; + BEAM_LOG_DEBUG() << "amount not found"; setLongField(env, TransactionParametersClass, jParameters, "amount", 0L); } @@ -275,7 +275,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(J { auto trusted = walletModel->isConnectionTrusted(); - LOG_DEBUG() << "isConnectionTrusted() " << trusted; + BEAM_LOG_DEBUG() << "isConnectionTrusted() " << trusted; return trusted; } @@ -292,7 +292,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(J JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(generateOfflineAddress)(JNIEnv *env, jobject thiz, jlong amount, jint assetId) { - LOG_DEBUG() << "generateOfflineAddress()"; + BEAM_LOG_DEBUG() << "generateOfflineAddress()"; uint64_t bAmount = amount; uint32_t bAsset = assetId; @@ -308,7 +308,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(J JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(generateRegularAddress)(JNIEnv *env, jobject thiz, jlong amount, jint assetId) { - LOG_DEBUG() << "generateRegularAddress()"; + BEAM_LOG_DEBUG() << "generateRegularAddress()"; uint64_t bAmount = amount; uint32_t bAsset = assetId; @@ -325,7 +325,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactionParameters)(J JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(generateMaxPrivacyAddress)(JNIEnv *env, jobject thiz, jlong amount, jint assetId) { - LOG_DEBUG() << "generateMaxPrivacyAddress()"; + BEAM_LOG_DEBUG() << "generateMaxPrivacyAddress()"; uint64_t bAmount = amount; uint32_t bAsset = assetId; @@ -346,7 +346,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(createWallet)(JNIEnv *env, job initLogger(appData, JString(env, appVersion).value()); - LOG_DEBUG() << "creating wallet..."; + BEAM_LOG_DEBUG() << "creating wallet..."; auto pass = JString(env, passStr).value(); @@ -382,7 +382,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(createWallet)(JNIEnv *env, job if(walletDB) { - LOG_DEBUG() << "wallet successfully created."; + BEAM_LOG_DEBUG() << "wallet successfully created."; passwordHash.V = SecString(pass).hash().V; // generate default address @@ -431,14 +431,14 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(createWallet)(JNIEnv *env, job JNIEXPORT jboolean JNICALL BEAM_JAVA_API_INTERFACE(isWalletInitialized)(JNIEnv *env, jobject thiz, jstring appData) { - LOG_DEBUG() << "checking if wallet exists..."; + BEAM_LOG_DEBUG() << "checking if wallet exists..."; return WalletDB::isInitialized(JString(env, appData).value() + "/" WALLET_FILENAME) ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL BEAM_JAVA_API_INTERFACE(closeWallet)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "close wallet if it exists"; + BEAM_LOG_DEBUG() << "close wallet if it exists"; if (nodeModel) { @@ -463,7 +463,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(openWallet)(JNIEnv *env, jobje initLogger(appData, JString(env, appVersion).value()); - LOG_DEBUG() << "opening wallet..."; + BEAM_LOG_DEBUG() << "opening wallet..."; string pass = JString(env, passStr).value(); @@ -474,7 +474,7 @@ JNIEXPORT jobject JNICALL BEAM_JAVA_API_INTERFACE(openWallet)(JNIEnv *env, jobje if(walletDB) { - LOG_DEBUG() << "wallet successfully opened."; + BEAM_LOG_DEBUG() << "wallet successfully opened."; passwordHash.V = SecString(pass).hash().V; @@ -569,27 +569,27 @@ JNIEXPORT jboolean JNICALL BEAM_JAVA_API_INTERFACE(checkReceiverAddress)(JNIEnv JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(getWalletStatus)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "getWalletStatus()"; + BEAM_LOG_DEBUG() << "getWalletStatus()"; walletModel->getAsync()->getWalletStatus(); } JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(getTransactions)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "getTransactions()"; + BEAM_LOG_DEBUG() << "getTransactions()"; walletModel->getAsync()->getTransactions(); } JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(getAllUtxosStatus)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "getAllUtxosStatus()"; + BEAM_LOG_DEBUG() << "getAllUtxosStatus()"; walletModel->getAsync()->getAllUtxosStatus(); } JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(syncWithNode)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "syncWithNode()"; + BEAM_LOG_DEBUG() << "syncWithNode()"; walletModel->getAsync()->syncWithNode(); } @@ -606,8 +606,8 @@ void CopyParameter(beam::wallet::TxParameterID paramID, const beam::wallet::TxPa JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(sendTransaction)(JNIEnv *env, jobject thiz, jstring receiverAddr, jstring comment, jlong amount, jlong fee, jint assetId, jboolean isOffline) { - LOG_DEBUG() << "sendTransaction(" << JString(env, receiverAddr).value() << ", " << JString(env, comment).value() << ", " << amount << ", " << fee << ")"; - LOG_DEBUG() << "asset id" << assetId; + BEAM_LOG_DEBUG() << "sendTransaction(" << JString(env, receiverAddr).value() << ", " << JString(env, comment).value() << ", " << amount << ", " << fee << ")"; + BEAM_LOG_DEBUG() << "asset id" << assetId; auto address = JString(env, receiverAddr).value(); auto txParameters = beam::wallet::ParseParameters(address); @@ -660,7 +660,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(sendTransaction)(JNIEnv *env, JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(calcChange)(JNIEnv *env, jobject thiz, jlong amount, jint assetId) { - LOG_DEBUG() << "calcChange(" << amount << ")"; + BEAM_LOG_DEBUG() << "calcChange(" << amount << ")"; uint32_t asset = assetId; walletModel->getAsync()->calcChange(Amount(amount), 0, beam::Asset::ID(asset)); @@ -669,14 +669,14 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(calcChange)(JNIEnv *env, jobje JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(getAddresses)(JNIEnv *env, jobject thiz, jboolean own) { - LOG_DEBUG() << "getAddresses(" << own << ")"; + BEAM_LOG_DEBUG() << "getAddresses(" << own << ")"; walletModel->getAsync()->getAddresses(own); } JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(generateNewAddress)(JNIEnv *env, jobject thiz) { - LOG_DEBUG() << "generateNewAddress()"; + BEAM_LOG_DEBUG() << "generateNewAddress()"; walletModel->getAsync()->generateNewAddress(); } @@ -684,7 +684,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(generateNewAddress)(JNIEnv *en JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddress)(JNIEnv *env, jobject thiz, jobject walletAddrObj, jboolean own) { - LOG_DEBUG() << "saveAddress()"; + BEAM_LOG_DEBUG() << "saveAddress()"; WalletID bbsAddr(Zero); if (bbsAddr.FromHex(getStringField(env, WalletAddressClass, walletAddrObj, "walletID"))) @@ -692,7 +692,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddress)(JNIEnv *env, jobj auto address = walletDB->getAddress(bbsAddr); if (address) { - LOG_DEBUG() << "address found in database"; + BEAM_LOG_DEBUG() << "address found in database"; address->m_label = getStringField(env, WalletAddressClass, walletAddrObj, "label"); address->m_category = getStringField(env, WalletAddressClass, walletAddrObj, "category"); @@ -701,7 +701,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddress)(JNIEnv *env, jobj walletDB->saveAddress(*address); } else { - LOG_DEBUG() << "address not found in database"; + BEAM_LOG_DEBUG() << "address not found in database"; WalletAddress addr; addr.m_BbsAddr.FromHex(getStringField(env, WalletAddressClass, walletAddrObj, "walletID")); @@ -749,7 +749,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(importRecovery)(JNIEnv *env, j { auto path = JString(env, jpath).value(); - LOG_DEBUG() << "importRecovery path = " << path; + BEAM_LOG_DEBUG() << "importRecovery path = " << path; walletModel->getAsync()->importRecovery(path); } @@ -819,7 +819,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(saveAddressChanges)(JNIEnv *en JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(cancelTx)(JNIEnv *env, jobject thiz, jstring txId) { - LOG_DEBUG() << "cancelTx()"; + BEAM_LOG_DEBUG() << "cancelTx()"; auto buffer = from_hex(JString(env, txId).value()); TxID id; @@ -832,7 +832,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(cancelTx)(JNIEnv *env, jobject JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(deleteTx)(JNIEnv *env, jobject thiz, jstring txId) { - LOG_DEBUG() << "deleteTx()"; + BEAM_LOG_DEBUG() << "deleteTx()"; auto buffer = from_hex(JString(env, txId).value()); TxID id; @@ -1097,7 +1097,7 @@ JNIEXPORT jboolean JNICALL BEAM_JAVA_WALLET_INTERFACE(isSynced)(JNIEnv *env, job { auto isSynced = walletModel->isSynced(); - LOG_DEBUG() << "isSynced() " << isSynced; + BEAM_LOG_DEBUG() << "isSynced() " << isSynced; return isSynced; } @@ -1152,7 +1152,7 @@ JNIEXPORT void JNICALL BEAM_JAVA_WALLET_INTERFACE(launchApp)(JNIEnv *env, jobjec } catch (...) { - LOG_DEBUG() << "launchApp error "; + BEAM_LOG_DEBUG() << "launchApp error "; } } diff --git a/android/node_model.cpp b/android/node_model.cpp index bea78b1f1..f6f3ea065 100644 --- a/android/node_model.cpp +++ b/android/node_model.cpp @@ -62,12 +62,12 @@ bool NodeModel::isNodeRunning() const void NodeModel::onInitProgressUpdated(uint64_t done, uint64_t total) { - LOG_DEBUG() << "onInitProgressUpdated(" << done << ", " << total << ")"; + BEAM_LOG_DEBUG() << "onInitProgressUpdated(" << done << ", " << total << ")"; } void NodeModel::onSyncProgressUpdated(int done, int total) { - LOG_DEBUG() << "onNodeSyncProgressUpdated(" << done << ", " << total << ")"; + BEAM_LOG_DEBUG() << "onNodeSyncProgressUpdated(" << done << ", " << total << ")"; JNIEnv* env = Android_JNI_getEnv(); diff --git a/android/wallet_model.cpp b/android/wallet_model.cpp index 87a0a1aa1..1b8df0561 100644 --- a/android/wallet_model.cpp +++ b/android/wallet_model.cpp @@ -506,7 +506,7 @@ namespace for (const auto& [key, value] : assets) { auto assetId = key; - LOG_DEBUG() << "convertWalletStatusToJObject(" << assetId << ")"; + BEAM_LOG_DEBUG() << "convertWalletStatusToJObject(" << assetId << ")"; jobject walletStatus = env->AllocObject(WalletStatusClass); setLongField(env, WalletStatusClass, walletStatus, "available", AmountBig::get_Lo(value.available)); @@ -549,7 +549,7 @@ WalletModel::~WalletModel() void WalletModel::onStatus(const WalletStatus& status) { - LOG_DEBUG() << "onStatus()"; + BEAM_LOG_DEBUG() << "onStatus()"; JNIEnv* env = Android_JNI_getEnv(); jobjectArray jStatus = convertWalletStatusToJObject(env, status); @@ -563,7 +563,7 @@ void WalletModel::onStatus(const WalletStatus& status) void WalletModel::onTxStatus(ChangeAction action, const std::vector& items) { - LOG_DEBUG() << "onTxStatus()"; + BEAM_LOG_DEBUG() << "onTxStatus()"; JNIEnv* env = Android_JNI_getEnv(); @@ -600,7 +600,7 @@ void WalletModel::onTxStatus(ChangeAction action, const std::vector& utxosVec) { - LOG_DEBUG() << "onNormalCoinsChanged()"; + BEAM_LOG_DEBUG() << "onNormalCoinsChanged()"; JNIEnv* env = Android_JNI_getEnv(); @@ -651,7 +651,7 @@ void WalletModel::onNormalCoinsChanged(ChangeAction action, const std::vector& addresses) { - LOG_DEBUG() << "onAddressesChanged()"; + BEAM_LOG_DEBUG() << "onAddressesChanged()"; JNIEnv* env = Android_JNI_getEnv(); @@ -666,7 +666,7 @@ void WalletModel::onAddressesChanged(ChangeAction action, const std::vector& addresses) { - LOG_DEBUG() << "onAddresses(" << own << ")"; + BEAM_LOG_DEBUG() << "onAddresses(" << own << ")"; JNIEnv* env = Android_JNI_getEnv(); @@ -681,7 +681,7 @@ void WalletModel::onAddresses(bool own, const std::vector& addres #ifdef BEAM_ATOMIC_SWAP_SUPPORT void WalletModel::onSwapOffersChanged(ChangeAction action, const std::vector& offers) { - LOG_DEBUG() << "onSwapOffersChanged()"; + BEAM_LOG_DEBUG() << "onSwapOffersChanged()"; // TODO } @@ -689,7 +689,7 @@ void WalletModel::onSwapOffersChanged(ChangeAction action, const std::vectorisConnectionTrusted(); - LOG_DEBUG() << "isConnectionTrustedCheck()" << trusted; + BEAM_LOG_DEBUG() << "isConnectionTrustedCheck()" << trusted; } JNIEnv* env = Android_JNI_getEnv(); @@ -737,7 +737,7 @@ void WalletModel::onNodeConnectionChanged(bool isNodeConnected) void WalletModel::onWalletError(ErrorType error) { - LOG_DEBUG() << "onWalletError: error = " << underlying_cast(error); + BEAM_LOG_DEBUG() << "onWalletError: error = " << underlying_cast(error); JNIEnv* env = Android_JNI_getEnv(); @@ -849,7 +849,7 @@ void WalletModel::onAddressChecked(const std::string& addr, bool isValid) void WalletModel::onImportRecoveryProgress(uint64_t done, uint64_t total) { - LOG_DEBUG() << "onImportRecoveryProgress(" << done << ", " << total << ")"; + BEAM_LOG_DEBUG() << "onImportRecoveryProgress(" << done << ", " << total << ")"; JNIEnv* env = Android_JNI_getEnv(); @@ -860,7 +860,7 @@ void WalletModel::onImportRecoveryProgress(uint64_t done, uint64_t total) void WalletModel::onImportDataFromJson(bool isOk) { - LOG_DEBUG() << "onImportDataFromJson(" << isOk << ")"; + BEAM_LOG_DEBUG() << "onImportDataFromJson(" << isOk << ")"; JNIEnv* env = Android_JNI_getEnv(); @@ -871,7 +871,7 @@ void WalletModel::onImportDataFromJson(bool isOk) void WalletModel::onExportDataToJson(const std::string& data) { - LOG_DEBUG() << "onExportDataToJson"; + BEAM_LOG_DEBUG() << "onExportDataToJson"; JNIEnv* env = Android_JNI_getEnv(); @@ -885,7 +885,7 @@ void WalletModel::onExportDataToJson(const std::string& data) void WalletModel::onNotificationsChanged(ChangeAction action, const std::vector& notifications) { - LOG_DEBUG() << "onNotificationsChanged"; + BEAM_LOG_DEBUG() << "onNotificationsChanged"; JNIEnv* env = Android_JNI_getEnv(); @@ -918,7 +918,7 @@ void WalletModel::onNotificationsChanged(ChangeAction action, const std::vector< void WalletModel::onExchangeRates(const std::vector& rates) { - LOG_DEBUG() << "onExchangeRates(" << rates.size() << ")"; + BEAM_LOG_DEBUG() << "onExchangeRates(" << rates.size() << ")"; JNIEnv* env = Android_JNI_getEnv(); jobjectArray jRates = convertExchangeRatesToJObject(env, rates); @@ -934,7 +934,7 @@ void WalletModel::onGetAddress(const beam::wallet::WalletID& addr, const boost:: { int convertdata = static_cast(offlinePayments); - LOG_DEBUG() << "onGetAddress(" << convertdata << ")"; + BEAM_LOG_DEBUG() << "onGetAddress(" << convertdata << ")"; JNIEnv* env = Android_JNI_getEnv(); @@ -946,7 +946,7 @@ void WalletModel::onGetAddress(const beam::wallet::WalletID& addr, const boost:: void WalletModel::onShieldedCoinChanged(beam::wallet::ChangeAction action, const std::vector& items) { - LOG_DEBUG() << "onShieldedCoinChanged()"; + BEAM_LOG_DEBUG() << "onShieldedCoinChanged()"; for (const auto& coin : items) { @@ -964,7 +964,7 @@ void WalletModel::onShieldedCoinChanged(beam::wallet::ChangeAction action, const } void WalletModel::onPostFunctionToClientContext(MessageFunction&& func) { - LOG_DEBUG() << "onPostFunctionToClientContext()"; + BEAM_LOG_DEBUG() << "onPostFunctionToClientContext()"; doFunction(func); } @@ -1006,7 +1006,7 @@ std::string WalletModel::getConfirmationProgress(beam::wallet::TxDescription tra void WalletModel::onExportTxHistoryToCsv(const std::string& data) { - LOG_DEBUG() << "onExportTxHistoryToCsv()"; + BEAM_LOG_DEBUG() << "onExportTxHistoryToCsv()"; JNIEnv* env = Android_JNI_getEnv(); @@ -1021,7 +1021,7 @@ void WalletModel::onExportTxHistoryToCsv(const std::string& data) #ifdef BEAM_ATOMIC_SWAP_SUPPORT void WalletModel::onExportAtomicSwapTxHistoryToCsv(const std::string& data) { - LOG_DEBUG() << "onExportAtomicSwapTxHistoryToCsv()"; + BEAM_LOG_DEBUG() << "onExportAtomicSwapTxHistoryToCsv()"; JNIEnv* env = Android_JNI_getEnv(); @@ -1037,7 +1037,7 @@ void WalletModel::onExportAtomicSwapTxHistoryToCsv(const std::string& data) #ifdef BEAM_ASSET_SWAP_SUPPORT void WalletModel::onExportAssetsSwapTxHistoryToCsv(const std::string& data) { - LOG_DEBUG() << "onExportAssetsSwapTxHistoryToCsv()"; + BEAM_LOG_DEBUG() << "onExportAssetsSwapTxHistoryToCsv()"; JNIEnv* env = Android_JNI_getEnv(); @@ -1052,7 +1052,7 @@ void WalletModel::onExportAssetsSwapTxHistoryToCsv(const std::string& data) void WalletModel::onExportContractTxHistoryToCsv(const std::string& data) { - LOG_DEBUG() << "onExportContractTxHistoryToCsv()"; + BEAM_LOG_DEBUG() << "onExportContractTxHistoryToCsv()"; JNIEnv* env = Android_JNI_getEnv(); @@ -1066,7 +1066,7 @@ void WalletModel::onExportContractTxHistoryToCsv(const std::string& data) void WalletModel::onPublicAddress(const std::string& publicAddr) { - LOG_DEBUG() << "onPublicAddress()"; + BEAM_LOG_DEBUG() << "onPublicAddress()"; JNIEnv* env = Android_JNI_getEnv(); diff --git a/wallet/unittests/ethereum_test.cpp b/wallet/unittests/ethereum_test.cpp index 03234e545..ffb3696df 100644 --- a/wallet/unittests/ethereum_test.cpp +++ b/wallet/unittests/ethereum_test.cpp @@ -253,8 +253,8 @@ void testSwap() libbitcoin::hash_digest secretHash = libbitcoin::sha256_hash(secretDataChunk); libbitcoin::short_hash participant = bridgeBob->generateEthAddress(); - LOG_DEBUG() << "secret: " << secret.str(); - LOG_DEBUG() << "secretHash: " << libbitcoin::encode_base16(secretHash); + BEAM_LOG_DEBUG() << "secret: " << secret.str(); + BEAM_LOG_DEBUG() << "secretHash: " << libbitcoin::encode_base16(secretHash); bridgeAlice->getBlockNumber([&](const ethereum::IBridge::Error& error, uint64_t blockCount) { @@ -271,7 +271,7 @@ void testSwap() bridgeAlice->send(kContractAddress, lockData, swapAmount, gas, gasPrice, [&](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "LOCK_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "LOCK_TX hash: " << txHash; // redeem // kRedeemMethodHash + secret + secretHash @@ -283,7 +283,7 @@ void testSwap() bridgeBob->send(kContractAddress, redeemData, ECC::Zero, gas, gasPrice, [mainReactor](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "REDEEM_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "REDEEM_TX hash: " << txHash; mainReactor->stop(); }); }); @@ -322,14 +322,14 @@ void testSwapWithAggregateSignature() std::move(std::begin(secret.m_pData), std::end(secret.m_pData), std::begin(secretEC)); auto rawPk = libbitcoin::wallet::ec_private(secretEC, libbitcoin::wallet::ec_private::mainnet, false).to_public().encoded(); - LOG_DEBUG() << "PUBLIC: " << rawPk; + BEAM_LOG_DEBUG() << "PUBLIC: " << rawPk; libbitcoin::short_hash addressFromSecret = ethereum::GetEthAddressFromPubkeyStr(rawPk); auto participant = bridgeBob->generateEthAddress(); auto initiator = bridgeAlice->generateEthAddress(); - LOG_DEBUG() << "participant: " << libbitcoin::encode_base16(participant); - LOG_DEBUG() << "initiator: " << libbitcoin::encode_base16(initiator); - LOG_DEBUG() << "addressFromSecret: " << libbitcoin::encode_base16(addressFromSecret); + BEAM_LOG_DEBUG() << "participant: " << libbitcoin::encode_base16(participant); + BEAM_LOG_DEBUG() << "initiator: " << libbitcoin::encode_base16(initiator); + BEAM_LOG_DEBUG() << "addressFromSecret: " << libbitcoin::encode_base16(addressFromSecret); ECC::uintBig gas = 200000u; ECC::uintBig gasPrice = 3000000u; @@ -348,7 +348,7 @@ void testSwapWithAggregateSignature() bridgeAlice->send(kContractAddress, lockData, swapAmount, gas, gasPrice, [&, refundTimeInBlocks](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "LOCK_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "LOCK_TX hash: " << txHash; libbitcoin::data_chunk hashData; hashData.reserve(60); @@ -358,7 +358,7 @@ void testSwapWithAggregateSignature() hashData.insert(hashData.end(), std::cbegin(refundTimeInBlocks.m_pData), std::cend(refundTimeInBlocks.m_pData)); auto hash = ethash::keccak256(&hashData[0], hashData.size()); - LOG_DEBUG() << "RedeemTx, hash of data: " << libbitcoin::encode_base16({ std::cbegin(hash.bytes), std::cend(hash.bytes) }); + BEAM_LOG_DEBUG() << "RedeemTx, hash of data: " << libbitcoin::encode_base16({ std::cbegin(hash.bytes), std::cend(hash.bytes) }); libbitcoin::hash_digest hashDigest; std::move(std::begin(hash.bytes), std::end(hash.bytes), hashDigest.begin()); @@ -368,7 +368,7 @@ void testSwapWithAggregateSignature() { libbitcoin::data_chunk resultSign(std::begin(signature.signature), std::end(signature.signature)); resultSign.push_back(signature.recovery_id); - LOG_DEBUG() << "RedeemTx, signature: " << libbitcoin::encode_base16(resultSign); + BEAM_LOG_DEBUG() << "RedeemTx, signature: " << libbitcoin::encode_base16(resultSign); } // redeem @@ -383,7 +383,7 @@ void testSwapWithAggregateSignature() bridgeBob->send(kContractAddress, redeemData, ECC::Zero, gas, gasPrice, [mainReactor](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "REDEEM_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "REDEEM_TX hash: " << txHash; mainReactor->stop(); }); }); @@ -427,8 +427,8 @@ void testERC20Swap() libbitcoin::hash_digest secretHash = libbitcoin::sha256_hash(secretDataChunk); libbitcoin::short_hash participant = bridgeBob->generateEthAddress(); - LOG_DEBUG() << "secret: " << secret.str(); - LOG_DEBUG() << "secretHash: " << libbitcoin::encode_base16(secretHash); + BEAM_LOG_DEBUG() << "secret: " << secret.str(); + BEAM_LOG_DEBUG() << "secretHash: " << libbitcoin::encode_base16(secretHash); bridgeAlice->getBlockNumber([&](const ethereum::IBridge::Error& error, uint64_t blockCount) { @@ -445,7 +445,7 @@ void testERC20Swap() bridgeAlice->send(kERC20HashLockContractAddress, lockData, ECC::Zero, gas, gasPrice, [&](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "LOCK_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "LOCK_TX hash: " << txHash; // redeem // kRedeemMethodHash + secret + secretHash @@ -457,7 +457,7 @@ void testERC20Swap() bridgeBob->send(kERC20HashLockContractAddress, redeemData, ECC::Zero, gas, gasPrice, [mainReactor](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "REDEEM_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "REDEEM_TX hash: " << txHash; mainReactor->stop(); }); }); @@ -497,14 +497,14 @@ void testERC20SwapWithAggregateSignature() std::move(std::begin(secret.m_pData), std::end(secret.m_pData), std::begin(secretEC)); auto rawPk = libbitcoin::wallet::ec_private(secretEC, libbitcoin::wallet::ec_private::mainnet, false).to_public().encoded(); - LOG_DEBUG() << "PUBLIC: " << rawPk; + BEAM_LOG_DEBUG() << "PUBLIC: " << rawPk; libbitcoin::short_hash addressFromSecret = ethereum::GetEthAddressFromPubkeyStr(rawPk); auto participant = bridgeBob->generateEthAddress(); auto initiator = bridgeAlice->generateEthAddress(); - LOG_DEBUG() << "participant: " << libbitcoin::encode_base16(participant); - LOG_DEBUG() << "initiator: " << libbitcoin::encode_base16(initiator); - LOG_DEBUG() << "addressFromSecret: " << libbitcoin::encode_base16(addressFromSecret); + BEAM_LOG_DEBUG() << "participant: " << libbitcoin::encode_base16(participant); + BEAM_LOG_DEBUG() << "initiator: " << libbitcoin::encode_base16(initiator); + BEAM_LOG_DEBUG() << "addressFromSecret: " << libbitcoin::encode_base16(addressFromSecret); ECC::uintBig gas = 500000u; ECC::uintBig gasPrice = 3000000u; @@ -527,7 +527,7 @@ void testERC20SwapWithAggregateSignature() bridgeAlice->send(kERC20ContractAddress, lockData, ECC::Zero, gas, gasPrice, [&, refundTimeInBlocks](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "LOCK_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "LOCK_TX hash: " << txHash; libbitcoin::data_chunk hashData; hashData.reserve(60); @@ -538,7 +538,7 @@ void testERC20SwapWithAggregateSignature() hashData.insert(hashData.end(), kTokenContractAddress.cbegin(), kTokenContractAddress.cend()); auto hash = ethash::keccak256(&hashData[0], hashData.size()); - LOG_DEBUG() << "RedeemTx, hash of data: " << libbitcoin::encode_base16({ std::cbegin(hash.bytes), std::cend(hash.bytes) }); + BEAM_LOG_DEBUG() << "RedeemTx, hash of data: " << libbitcoin::encode_base16({ std::cbegin(hash.bytes), std::cend(hash.bytes) }); libbitcoin::hash_digest hashDigest; std::move(std::begin(hash.bytes), std::end(hash.bytes), hashDigest.begin()); @@ -548,7 +548,7 @@ void testERC20SwapWithAggregateSignature() { libbitcoin::data_chunk resultSign(std::begin(signature.signature), std::end(signature.signature)); resultSign.push_back(signature.recovery_id); - LOG_DEBUG() << "RedeemTx, signature: " << libbitcoin::encode_base16(resultSign); + BEAM_LOG_DEBUG() << "RedeemTx, signature: " << libbitcoin::encode_base16(resultSign); } // redeem @@ -563,7 +563,7 @@ void testERC20SwapWithAggregateSignature() bridgeBob->send(kERC20ContractAddress, redeemData, ECC::Zero, gas, gasPrice, [mainReactor](const ethereum::IBridge::Error&, std::string txHash, uint64_t) { - LOG_DEBUG() << "REDEEM_TX hash: " << txHash; + BEAM_LOG_DEBUG() << "REDEEM_TX hash: " << txHash; mainReactor->stop(); }); }); @@ -595,12 +595,12 @@ void testERC20GetBalance() bridge.call(kTokenContractAddress, libbitcoin::encode_base16(data), [mainReactor](const ethereum::IBridge::Error&, const nlohmann::json& result) { - LOG_DEBUG() << result.dump(4); + BEAM_LOG_DEBUG() << result.dump(4); boost::multiprecision::uint256_t tmp(result.get()); tmp /= ethereum::GetCoinUnitsMultiplier(beam::wallet::AtomicSwapCoin::Dai); - LOG_DEBUG() << "Balance: " << tmp.convert_to(); + BEAM_LOG_DEBUG() << "Balance: " << tmp.convert_to(); mainReactor->stop(); }); @@ -627,17 +627,17 @@ void testMultipleSend() bridgeAlice->send(initiator, {}, ECC::Zero, gas, gasPrice, [](const ethereum::IBridge::Error&, std::string txHash, uint64_t nonce) { - LOG_DEBUG() << "First Tx hash: " << txHash << " nonce: " << nonce; + BEAM_LOG_DEBUG() << "First Tx hash: " << txHash << " nonce: " << nonce; }); bridgeAlice->send(initiator, {}, ECC::Zero, gas, gasPrice, [](const ethereum::IBridge::Error&, std::string txHash, uint64_t nonce) { - LOG_DEBUG() << "Second Tx hash: " << txHash << " nonce: " << nonce; + BEAM_LOG_DEBUG() << "Second Tx hash: " << txHash << " nonce: " << nonce; }); bridgeAlice->send(initiator, {}, ECC::Zero, gas, gasPrice, [](const ethereum::IBridge::Error&, std::string txHash, uint64_t nonce) { - LOG_DEBUG() << "Third Tx hash: " << txHash << " nonce: " << nonce; + BEAM_LOG_DEBUG() << "Third Tx hash: " << txHash << " nonce: " << nonce; }); mainReactor->run(); @@ -679,7 +679,7 @@ void testERC20MultipleApprove() boost::multiprecision::uint256_t tmp(result.get()); tmp /= ethereum::GetCoinUnitsMultiplier(token); startAllowance = tmp.convert_to(); - LOG_DEBUG() << "allowance: " << startAllowance; + BEAM_LOG_DEBUG() << "allowance: " << startAllowance; mainReactor->stop(); }); @@ -691,17 +691,17 @@ void testERC20MultipleApprove() { bridgeAlice->erc20Approve(kTokenContractAddress, kERC20ContractAddress, value, gas, gasPrice, [](const ethereum::IBridge::Error&, std::string txHash) { - LOG_DEBUG() << "First ApproveTx hash: " << txHash; + BEAM_LOG_DEBUG() << "First ApproveTx hash: " << txHash; }); bridgeAlice->erc20Approve(kTokenContractAddress, kERC20ContractAddress, value, gas, gasPrice, [](const ethereum::IBridge::Error&, std::string txHash) { - LOG_DEBUG() << "Second ApproveTx hash: " << txHash; + BEAM_LOG_DEBUG() << "Second ApproveTx hash: " << txHash; }); bridgeAlice->erc20Approve(kTokenContractAddress, kERC20ContractAddress, value, gas, gasPrice, [mainReactor](const ethereum::IBridge::Error&, std::string txHash) { - LOG_DEBUG() << "Third ApproveTx hash: " << txHash; + BEAM_LOG_DEBUG() << "Third ApproveTx hash: " << txHash; mainReactor->stop(); }); @@ -722,7 +722,7 @@ void testERC20MultipleApprove() boost::multiprecision::uint256_t tmp(result.get()); tmp /= ethereum::GetCoinUnitsMultiplier(token); endAllowance = tmp.convert_to(); - LOG_DEBUG() << "end allowance: " << tmp.convert_to(); + BEAM_LOG_DEBUG() << "end allowance: " << tmp.convert_to(); mainReactor->stop(); }); diff --git a/wallet/unittests/offline.cpp b/wallet/unittests/offline.cpp index 6b3a250a9..abff875c0 100644 --- a/wallet/unittests/offline.cpp +++ b/wallet/unittests/offline.cpp @@ -26,7 +26,7 @@ namespace beam { using namespace wallet; struct WalletDBObserver : IWalletDbObserver { void onCoinsChanged(ChangeAction, const std::vector&) { - LOG_DEBUG() << _who << " " << __FUNCTION__; + BEAM_LOG_DEBUG() << _who << " " << __FUNCTION__; } void onTransactionChanged(ChangeAction, const std::vector& ) { BEAM_LOG_INFO() << _who << " QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ " << __FUNCTION__; diff --git a/wallet/unittests/wallet_test.cpp b/wallet/unittests/wallet_test.cpp index a86a60438..ca14ad209 100644 --- a/wallet/unittests/wallet_test.cpp +++ b/wallet/unittests/wallet_test.cpp @@ -4679,7 +4679,7 @@ void TestAddressVersions() // // if (signature.IsValid(message, totalPublicExcess)) // { -// LOG_DEBUG() << "Ok, signature is valid :)"; +// BEAM_LOG_DEBUG() << "Ok, signature is valid :)"; // } // else // { diff --git a/wasmclient/wasmclient.cpp b/wasmclient/wasmclient.cpp index 4207b1376..9b4a56866 100644 --- a/wasmclient/wasmclient.cpp +++ b/wasmclient/wasmclient.cpp @@ -548,7 +548,7 @@ class WasmWalletClient void StopWallet(val handler = val::null()) { - LOG_DEBUG() << "Stopping wallet..."; + BEAM_LOG_DEBUG() << "Stopping wallet..."; AssertMainThread(); if (!m_Client) { @@ -635,7 +635,7 @@ class WasmWalletClient (*m_RecoveryCallback)(error, static_cast(done), static_cast(total)); if (done == total || !error.isNull()) { - LOG_DEBUG() << "Recovery done"; + BEAM_LOG_DEBUG() << "Recovery done"; m_RecoveryCallback.reset(); } } @@ -881,7 +881,7 @@ class WasmWalletClient static void DeleteWallet(const std::string& dbName) { - LOG_DEBUG() << "Delete wallet..."; + BEAM_LOG_DEBUG() << "Delete wallet..."; AssertMainThread(); EnsureFSMounted(); try @@ -920,7 +920,7 @@ class WasmWalletClient { WalletDB::isValidPassword(dbName, SecString(pass)); auto res = WalletDB::isValidPassword(dbName, SecString(pass)); - LOG_DEBUG() << __FUNCTION__ << TRACE(dbName) << TRACE(pass) << TRACE(res); + BEAM_LOG_DEBUG() << __FUNCTION__ << TRACE(dbName) << TRACE(pass) << TRACE(res); auto cbPtr = std::make_unique(std::move(cb), res); emscripten_async_run_in_main_runtime_thread( EM_FUNC_SIG_VI,