scratchpad fetches transfers

This commit is contained in:
woodser
2019-06-20 12:40:50 -04:00
parent 6f5d7cd7d6
commit 5c46359598
+26 -7
View File
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <iostream>
#include "wallet2.h"
#include "wallet/MoneroWallet.cpp"
#include "wallet/MoneroWallet.h"
//#include <boost/stacktrace.hpp>
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<MoneroTxRequest>(&txRequest);
txRequest.transferRequest = shared_ptr<MoneroTransferRequest>(&transferRequest);
vector<shared_ptr<MoneroTransfer>> transfers = wallet->getTransfers(transferRequest);
if (transfers.empty()) throw runtime_error("Transfers should not be empty");
for (const shared_ptr<MoneroTransfer>& transfer : transfers) {
if (*transfer->accountIndex != 0) throw runtime_error("Account should be 0");
if (!*transfer->tx->isConfirmed) throw runtime_error("Transfer should be confirmed");
}
}