diff --git a/src/wallet/tx_builder.cpp b/src/wallet/tx_builder.cpp index 46c9fcd5d..0d35abeb5 100644 --- a/src/wallet/tx_builder.cpp +++ b/src/wallet/tx_builder.cpp @@ -243,7 +243,7 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_tra const std::vector &dsts, const rct::xmr_amount fee_per_weight, const std::vector &extra, - const uint32_t subaddr_account, + const std::uint32_t subaddr_account, const std::set &subaddr_indices, const rct::xmr_amount ignore_above, const rct::xmr_amount ignore_below, @@ -321,13 +321,49 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_tra return tx_proposal; } //------------------------------------------------------------------------------------------------------------------- +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer_subtractable( + wallet2 &w, + const std::vector &dsts, + const std::uint32_t priority, + const std::vector &extra, + const std::uint32_t subaddr_account, + const std::set &subaddr_indices, + const rct::xmr_amount ignore_above, + const rct::xmr_amount ignore_below, + const wallet2::unique_index_container &subtract_fee_from_outputs) +{ + wallet2::transfer_container transfers; + w.get_transfers(transfers); + + const rct::xmr_amount fee_per_weight = w.get_base_fee(priority); + + const std::uint64_t current_chain_height = w.get_blockchain_current_height(); + CHECK_AND_ASSERT_THROW_MES(current_chain_height > 0, + "make_carrot_transaction_proposal_wallet2_transfer_subtractable: chain height is 0, there is no top block"); + const std::uint64_t top_block_index = current_chain_height - 1; + + return make_carrot_transaction_proposal_wallet2_transfer_subtractable( + transfers, + w.get_subaddress_map_ref(), + dsts, + fee_per_weight, + extra, + subaddr_account, + subaddr_indices, + ignore_above, + ignore_below, + subtract_fee_from_outputs, + top_block_index, + w.get_account().get_keys()); +} +//------------------------------------------------------------------------------------------------------------------- carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer( const wallet2::transfer_container &transfers, const std::unordered_map &subaddress_map, const std::vector &dsts, const rct::xmr_amount fee_per_weight, const std::vector &extra, - const uint32_t subaddr_account, + const std::uint32_t subaddr_account, const std::set &subaddr_indices, const rct::xmr_amount ignore_above, const rct::xmr_amount ignore_below, @@ -349,6 +385,40 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_tra acb); } //------------------------------------------------------------------------------------------------------------------- +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer( + wallet2 &w, + const std::vector &dsts, + const std::uint32_t priority, + const std::vector &extra, + const std::uint32_t subaddr_account, + const std::set &subaddr_indices, + const rct::xmr_amount ignore_above, + const rct::xmr_amount ignore_below) +{ + wallet2::transfer_container transfers; + w.get_transfers(transfers); + + const rct::xmr_amount fee_per_weight = w.get_base_fee(priority); + + const std::uint64_t current_chain_height = w.get_blockchain_current_height(); + CHECK_AND_ASSERT_THROW_MES(current_chain_height > 0, + "make_carrot_transaction_proposal_wallet2_transfer: chain height is 0, there is no top block"); + const std::uint64_t top_block_index = current_chain_height - 1; + + return make_carrot_transaction_proposal_wallet2_transfer( + transfers, + w.get_subaddress_map_ref(), + dsts, + fee_per_weight, + extra, + subaddr_account, + subaddr_indices, + ignore_above, + ignore_below, + top_block_index, + w.get_account().get_keys()); +} +//------------------------------------------------------------------------------------------------------------------- carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_sweep( const wallet2::transfer_container &transfers, const std::unordered_map &subaddress_map, @@ -424,5 +494,36 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_swe return tx_proposal; } //------------------------------------------------------------------------------------------------------------------- +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_sweep( + wallet2 &w, + const std::vector &input_key_images, + const cryptonote::account_public_address &address, + const bool is_subaddress, + const size_t n_dests, + const std::uint32_t priority, + const std::vector &extra) +{ + wallet2::transfer_container transfers; + w.get_transfers(transfers); + + const rct::xmr_amount fee_per_weight = w.get_base_fee(priority); + + const std::uint64_t current_chain_height = w.get_blockchain_current_height(); + CHECK_AND_ASSERT_THROW_MES(current_chain_height > 0, + "make_carrot_transaction_proposal_wallet2_transfer: chain height is 0, there is no top block"); + const std::uint64_t top_block_index = current_chain_height - 1; + + return make_carrot_transaction_proposal_wallet2_sweep( + transfers, + w.get_subaddress_map_ref(), + input_key_images, + address, + is_subaddress, + n_dests, + fee_per_weight, + extra, + top_block_index, + w.get_account().get_keys()); +} } //namespace wallet } //namespace tools diff --git a/src/wallet/tx_builder.h b/src/wallet/tx_builder.h index 603fd9f21..abc0d5c42 100644 --- a/src/wallet/tx_builder.h +++ b/src/wallet/tx_builder.h @@ -68,7 +68,17 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_tra const rct::xmr_amount ignore_below, const wallet2::unique_index_container& subtract_fee_from_outputs, const std::uint64_t top_block_index, - const cryptonote::account_base &acb); + const cryptonote::account_keys &acc_keys); +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer_subtractable( + wallet2 &w, + const std::vector &dsts, + const std::uint32_t priority, + const std::vector &extra, + const std::uint32_t subaddr_account, + const std::set &subaddr_indices, + const rct::xmr_amount ignore_above, + const rct::xmr_amount ignore_below, + const wallet2::unique_index_container &subtract_fee_from_outputs); carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer( const wallet2::transfer_container &transfers, @@ -81,7 +91,16 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_tra const rct::xmr_amount ignore_above, const rct::xmr_amount ignore_below, const std::uint64_t top_block_index, - const cryptonote::account_base &acb); + const cryptonote::account_keys &acc_keys); +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_transfer( + wallet2 &w, + const std::vector &dsts, + const std::uint32_t priority, + const std::vector &extra, + const std::uint32_t subaddr_account, + const std::set &subaddr_indices, + const rct::xmr_amount ignore_above, + const rct::xmr_amount ignore_below); carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_sweep( const wallet2::transfer_container &transfers, @@ -93,6 +112,14 @@ carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_swe const rct::xmr_amount fee_per_weight, const std::vector& extra, const std::uint64_t top_block_index, - const cryptonote::account_base &acb); + const cryptonote::account_keys &acc_keys); +carrot::CarrotTransactionProposalV1 make_carrot_transaction_proposal_wallet2_sweep( + wallet2 &w, + const std::vector &input_key_images, + const cryptonote::account_public_address &address, + const bool is_subaddress, + const size_t n_dests, + const std::uint32_t priority, + const std::vector &extra); } //namespace wallet } //namespace tools