From 28d540d5f12dc4a758cd8fb7775f3591aaa406f0 Mon Sep 17 00:00:00 2001 From: cyan Date: Wed, 23 Sep 2026 19:10:52 +0200 Subject: [PATCH] feat: warn when txCount != 1 (#3644) --- cw_monero/lib/api/structs/pending_transaction.dart | 4 +++- cw_monero/lib/api/transaction_history.dart | 2 ++ cw_monero/lib/monero_wallet.dart | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cw_monero/lib/api/structs/pending_transaction.dart b/cw_monero/lib/api/structs/pending_transaction.dart index db11c4f78..0934d0d19 100644 --- a/cw_monero/lib/api/structs/pending_transaction.dart +++ b/cw_monero/lib/api/structs/pending_transaction.dart @@ -4,11 +4,13 @@ class PendingTransactionDescription { required this.fee, required this.hash, required this.hex, - required this.pointerAddress}); + required this.pointerAddress, + required this.txCount}); final int amount; final int fee; final String hash; final String hex; final int pointerAddress; + final int txCount; } diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index 7c4ffc36e..dc8bc5273 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -219,6 +219,7 @@ Future createTransactionSync( fee: rFee, hash: rHash, hex: rHex, + txCount: pendingTx.txCount(), pointerAddress: pendingTx.ffiAddress(), ); } @@ -263,6 +264,7 @@ Future createTransactionMultDest( hash: tx.txid(''), hex: tx.hex(''), pointerAddress: tx.ffiAddress(), + txCount: tx.txCount(), ); } diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 2d932524a..fd86e82b2 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -491,7 +491,10 @@ abstract class MoneroWalletBase paymentId: ''); } - // final status = monero.PendingTransaction_status(pendingTransactionDescription); + if (pendingTransactionDescription.txCount != 1) { + throw MoneroTransactionCreationException( + "This payment would be split into ${pendingTransactionDescription.txCount} transactions. Send smaller transaction to yourself first.",); + } return PendingMoneroTransaction(pendingTransactionDescription, this); }