From 5c463595980c8fbfbdd774f76c5b236b0b2276ca Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 20 Jun 2019 12:40:50 -0400 Subject: [PATCH] scratchpad fetches transfers --- test/Scratchpad.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/test/Scratchpad.cpp b/test/Scratchpad.cpp index 7851f8e..bac5a0b 100644 --- a/test/Scratchpad.cpp +++ b/test/Scratchpad.cpp @@ -1,7 +1,7 @@ #include #include #include "wallet2.h" -#include "wallet/MoneroWallet.cpp" +#include "wallet/MoneroWallet.h" //#include using namespace std; @@ -54,11 +54,30 @@ int main(int argc, const char* argv[]) { // openWallet(path, password, networkType); // createWalletRandom(language, networkType); - // create wallet - MoneroWallet* wallet = new MoneroWallet(); +// // create wallet +// MoneroWallet* wallet = new MoneroWallet(); +// +// // get the mnemonic +// epee::wipeable_string mnemonic; +// wallet->getMnemonic(mnemonic); +// cout << "Mnemonic: " << string(mnemonic.data(), mnemonic.size()) << endl; - // get the mnemonic - epee::wipeable_string mnemonic; - wallet->getMnemonic(mnemonic); - cout << "Mnemonic: " << string(mnemonic.data(), mnemonic.size()) << endl; + + // load wallet + MoneroWallet* wallet = new MoneroWallet("../../test_wallets/test_wallet_1", "supersecretpassword123", MoneroNetworkType::STAGENET); + //MoneroRpcConnection daemonConnection = MoneroRpcConnection("http://localhost:38083", "", ""); + wallet->setDaemonConnection("http://localhost:38081", "", ""); + + MoneroTransferRequest transferRequest; + transferRequest.accountIndex = 0; + MoneroTxRequest txRequest; + txRequest.isConfirmed = true; + transferRequest.txRequest = shared_ptr(&txRequest); + txRequest.transferRequest = shared_ptr(&transferRequest); + vector> transfers = wallet->getTransfers(transferRequest); + if (transfers.empty()) throw runtime_error("Transfers should not be empty"); + for (const shared_ptr& transfer : transfers) { + if (*transfer->accountIndex != 0) throw runtime_error("Account should be 0"); + if (!*transfer->tx->isConfirmed) throw runtime_error("Transfer should be confirmed"); + } }