Skip to content

add functions to Wallet API [release] #9918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-v0.18
Choose a base branch
from

Conversation

SNeedlewoods
Copy link
Contributor

@SNeedlewoods SNeedlewoods force-pushed the x_api_add_new_functions_release branch 2 times, most recently from d9d208d to 81a042e Compare April 30, 2025 17:15
@binarybaron
Copy link

Any ETA on when this is going to be merged?

We are building a FFI Rust library on top of this branch: https://github.com/UnstoppableSwap/core/tree/bbcc20eb58a98e1dd06980c7fac342e9e7064781/monero-sys

@SNeedlewoods
Copy link
Contributor Author

Unfortunately I can't give you an ETA, because #9464 needs more reviews/approvals from others, but for my part I'll try my best to resolve review comments ASAP.

I'm glad to hear you're using this, but keep in mind that things may change.

@binarybaron
Copy link

binarybaron commented Jun 24, 2025

Support for #8861 would be very useful in wallet2_api as well!

Minimal patch:

diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 96393eaaa..f2f8e7fbb 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -1777,7 +1777,7 @@ PendingTransaction* WalletImpl::restoreMultisigTransaction(const string& signDat
 //    - unconfirmed_transfer_details;
 //    - confirmed_transfer_details)
 
-PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
+PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, std::set<uint32_t> subtract_fee_from_outputs)
 
 {
     clearStatus();
@@ -1862,7 +1862,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
             if (amount) {
                 transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count,
                                                                             adjusted_priority,
-                                                                            extra, subaddr_account, subaddr_indices);
+                                                                            extra, subaddr_account, subaddr_indices, subtract_fee_from_outputs);
             } else {
                 transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, 1, fake_outs_count,
                                                                               adjusted_priority,
@@ -1949,7 +1949,7 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
                                                   PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
 
 {
-    return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices);
+    return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices, {});
 }
 
 PendingTransaction *WalletImpl::createSweepUnmixableTransaction()
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index b7f77a186..f81f13ac2 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -157,7 +157,8 @@ public:
                                         optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
                                         PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
                                         uint32_t subaddr_account = 0,
-                                        std::set<uint32_t> subaddr_indices = {}) override;
+                                        std::set<uint32_t> subaddr_indices = {},
+                                        std::set<uint32_t> subtract_fee_from_outputs = {}) override;
     PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
                                         optional<uint64_t> amount, uint32_t mixin_count,
                                         PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index ca807ac87..f5f0a8f39 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -936,7 +936,8 @@ struct Wallet
                                                    optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
                                                    PendingTransaction::Priority = PendingTransaction::Priority_Low,
                                                    uint32_t subaddr_account = 0,
-                                                   std::set<uint32_t> subaddr_indices = {}) = 0;
+                                                   std::set<uint32_t> subaddr_indices = {},
+                                                   std::set<uint32_t> subtract_fee_from_outputs = {}) = 0;
 
     /*!
      * \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored

@SNeedlewoods
Copy link
Contributor Author

I agree, will add it. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants