diff --git a/cw_monero/lib/api/transaction_history.dart b/cw_monero/lib/api/transaction_history.dart index b416e1b4e..7723b6051 100644 --- a/cw_monero/lib/api/transaction_history.dart +++ b/cw_monero/lib/api/transaction_history.dart @@ -138,11 +138,17 @@ PendingTransactionDescription createTransactionMultDestSync( int accountIndex = 0, List preferredInputs = const []}) { + final dstAddrs = outputs.map((e) => e.address).toList(); + final amounts = outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList(); + + // print("multDest: dstAddrs: $dstAddrs"); + // print("multDest: amounts: $amounts"); + final txptr = monero.Wallet_createTransactionMultDest( wptr!, - dstAddr: outputs.map((e) => e.address).toList(), + dstAddr: dstAddrs, isSweepAll: false, - amounts: outputs.map((e) => monero.Wallet_amountFromString(e.amount)).toList(), + amounts: amounts, mixinCount: 0, pendingTransactionPriority: priorityRaw, subaddr_account: accountIndex, @@ -307,7 +313,34 @@ class Transaction { confirmations = monero.TransactionInfo_confirmations(txInfo), fee = monero.TransactionInfo_fee(txInfo), description = monero.TransactionInfo_description(txInfo), - key = monero.Wallet_getTxKey(wptr!, txid: monero.TransactionInfo_hash(txInfo)); + key = getTxKey(txInfo); + + static String getTxKey(monero.TransactionInfo txInfo) { + final txKey = monero.Wallet_getTxKey(wptr!, txid: monero.TransactionInfo_hash(txInfo)); + final status = monero.Wallet_status(wptr!); + if (status != 0) { + return monero.Wallet_errorString(wptr!); + } + return breakTxKey(txKey); + } + + static String breakTxKey(String input) { + final x = 64; + StringBuffer buffer = StringBuffer(); + + for (int i = 0; i < input.length; i += x) { + int endIndex = i + x; + if (endIndex > input.length) { + endIndex = input.length; + } + buffer.write(input.substring(i, endIndex)); + if (endIndex != input.length) { + buffer.write('\n\n'); + } + } + + return buffer.toString().trim(); + } Transaction.dummy({ required this.displayLabel, diff --git a/cw_monero/pubspec.lock b/cw_monero/pubspec.lock index 13c70cfad..cf9da9455 100644 --- a/cw_monero/pubspec.lock +++ b/cw_monero/pubspec.lock @@ -463,8 +463,8 @@ packages: dependency: "direct main" description: path: "impls/monero.dart" - ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b - resolved-ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b + ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 + resolved-ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 url: "https://github.com/mrcyjanek/monero_c" source: git version: "0.0.0" diff --git a/cw_monero/pubspec.yaml b/cw_monero/pubspec.yaml index 3053977de..75d8b1ccc 100644 --- a/cw_monero/pubspec.yaml +++ b/cw_monero/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: monero: git: url: https://github.com/mrcyjanek/monero_c - ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b # monero_c hash + ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 # monero_c hash path: impls/monero.dart mutex: ^3.1.0 diff --git a/cw_wownero/pubspec.lock b/cw_wownero/pubspec.lock index 58831085f..b68e9ce74 100644 --- a/cw_wownero/pubspec.lock +++ b/cw_wownero/pubspec.lock @@ -463,8 +463,8 @@ packages: dependency: "direct main" description: path: "impls/monero.dart" - ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b - resolved-ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b + ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 + resolved-ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 url: "https://github.com/mrcyjanek/monero_c" source: git version: "0.0.0" diff --git a/cw_wownero/pubspec.yaml b/cw_wownero/pubspec.yaml index b9306711d..39a2cc9c0 100644 --- a/cw_wownero/pubspec.yaml +++ b/cw_wownero/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: monero: git: url: https://github.com/mrcyjanek/monero_c - ref: bcb328a4956105dc182afd0ce2e48fe263f5f20b # monero_c hash + ref: 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 # monero_c hash path: impls/monero.dart mutex: ^3.1.0 diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 97a7ad88d..be2e6cb02 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -273,6 +273,7 @@ class SendPage extends BasePage { ? template.cryptoCurrency : template.fiatCurrency, onTap: () async { + sendViewModel.state = IsExecutingState(); if (template.additionalRecipients?.isNotEmpty ?? false) { sendViewModel.clearOutputs(); @@ -301,6 +302,7 @@ class SendPage extends BasePage { template: template, ); } + sendViewModel.state = InitialExecutionState(); }, onRemove: () { showPopUp( @@ -368,6 +370,7 @@ class SendPage extends BasePage { builder: (_) { return LoadingPrimaryButton( onPressed: () async { + if (sendViewModel.state is IsExecutingState) return; if (_formKey.currentState != null && !_formKey.currentState!.validate()) { if (sendViewModel.outputs.length > 1) { showErrorValidationAlert(context); diff --git a/scripts/prepare_moneroc.sh b/scripts/prepare_moneroc.sh index 94754c935..1315a5825 100755 --- a/scripts/prepare_moneroc.sh +++ b/scripts/prepare_moneroc.sh @@ -8,7 +8,7 @@ if [[ ! -d "monero_c" ]]; then git clone https://github.com/mrcyjanek/monero_c --branch rewrite-wip cd monero_c - git checkout 5de323b1ba7387cf73973042f06383d4dbe619f5 + git checkout 3cb38bee9385faf46b03fd73aab85f3ac4115bf7 git reset --hard git submodule update --init --force --recursive ./apply_patches.sh monero