rename to monero_tx_config, monero_tx_priority

This commit is contained in:
woodser
2020-05-09 23:43:39 -04:00
parent 2c1c86f87d
commit 5fda176a5c
8 changed files with 219 additions and 434 deletions
+8 -8
View File
@@ -116,19 +116,19 @@ int main(int argc, const char* argv[]) {
wallet_restored->stop_mining();
// create a request to send funds to multiple destinations in the random wallet
monero_send_request send_request = monero_send_request();
send_request.m_account_index = 1; // withdraw funds from this account
send_request.m_subaddress_indices = vector<uint32_t>();
send_request.m_subaddress_indices.push_back(0);
send_request.m_subaddress_indices.push_back(1); // withdraw funds from these subaddresses within the account
send_request.m_priority = monero_send_priority::UNIMPORTANT; // no rush
monero_tx_config config = monero_tx_config();
config.m_account_index = 1; // withdraw funds from this account
config.m_subaddress_indices = vector<uint32_t>();
config.m_subaddress_indices.push_back(0);
config.m_subaddress_indices.push_back(1); // withdraw funds from these subaddresses within the account
config.m_priority = monero_tx_priority::UNIMPORTANT; // no rush
vector<shared_ptr<monero_destination>> destinations; // specify the recipients and their amounts
destinations.push_back(make_shared<monero_destination>(wallet_random->get_address(1, 0), 50000));
destinations.push_back(make_shared<monero_destination>(wallet_random->get_address(2, 0), 50000));
send_request.m_destinations = destinations;
config.m_destinations = destinations;
// create the transaction, confirm with the user, and relay to the network
shared_ptr<monero_tx_wallet> created_tx = wallet_restored->create_tx(send_request).m_txs[0];
shared_ptr<monero_tx_wallet> created_tx = wallet_restored->create_tx(config).m_txs[0];
uint64_t fee = created_tx->m_fee.get(); // "Are you sure you want to send ...?"
wallet_restored->relay_tx(*created_tx); // submit the transaction to the Monero network which will notify the recipient wallet
-21
View File
@@ -38,25 +38,4 @@ int main(int argc, const char* argv[]) {
for (int i = 0; i < txs.size() && i < 10; i++) {
MINFO(txs[i]->serialize());
}
// shared_ptr<monero_transfer_request> transfer_request = shared_ptr<monero_transfer_request>(new monero_transfer_request());
// transfer_request->account_index = 0;
// shared_ptr<monero_tx_request> tx_request = shared_ptr<monero_tx_request>(new monero_tx_request());
// tx_request->is_confirmed = true;
// transfer_request->tx_request = tx_request;
// //tx_request->transfer_request = transfer_request;
// vector<shared_ptr<monero_transfer>> transfers = wallet->get_transfers(*transfer_request);
// if (transfers.empty()) throw runtime_error("Transfers should not be empty");
// for (const shared_ptr<monero_transfer>& transfer : transfers) {
// if (*transfer->account_index != 0) throw runtime_error("Account should be 0");
// if (!*transfer->tx->is_confirmed) throw runtime_error("Transfer should be confirmed");
// }
// shared_ptr<monero_tx_request> tx_request = shared_ptr<monero_tx_request>(new monero_tx_request());
// tx_request->is_confirmed = true;
// vector<shared_ptr<monero_tx_wallet>> txs = wallet->get_txs(*tx_request);
// if (txs.empty()) throw runtime_error("Txs should not be empty");
// for (const shared_ptr<monero_tx_wallet>& tx : txs) {
// if (!*tx->is_confirmed) throw runtime_error("Tx should be confirmed");
// }
}