New versions (#1355)

* New versions * Check for Taproot inputs when exchanging with ThorChain * Properly handle taproot case with thorchain * fix missing import

Omar Hatem committed Apr 1, 2024 at 15:31 UTC 62ef545fce22227bdd50f0c155c91f57d126a256
11 files changed +71 -35
assets/text/Monerocom_Release_Notes.txt
+2 -4
@@ -1,4 +1,2 @@
1 -Monero enhancements
2 -In-App live status page for the app services
3 -Add Exolix exchange provider
4 -Bug fixes and enhancements
\ No newline at end of file
1 +Exchange flow enhancements and fixes
2 +Generic enhancements and bug fixes
\ No newline at end of file
assets/text/Release_Notes.txt
+6 -1
@@ -1 +1,6 @@
1 -Bug fixes and enhancements
\ No newline at end of file
1 +Exchange flow enhancements and fixes
2 +Add MoonPay to Buy options
3 +Add THORChain to Exchange providers
4 +Improve Bitcoin fee calculations
5 +Fixes and enhancements for Solana
6 +Generic enhancements and bug fixes
\ No newline at end of file
cw_bitcoin/lib/electrum_wallet.dart
+15 -9
@@ -544,6 +544,8 @@ abstract class ElectrumWalletBase
544 );
545 }
546
547 + bool hasTaprootInputs = false;
548 +
549 final transaction = txb.buildTransaction((txDigest, utxo, publicKey, sighash) {
550 final key = estimatedTx.privateKeys
551 .firstWhereOrNull((element) => element.getPublic().toHex() == publicKey);
@@ -553,21 +555,25 @@ abstract class ElectrumWalletBase
555 }
556
557 if (utxo.utxo.isP2tr()) {
558 + hasTaprootInputs = true;
559 return key.signTapRoot(txDigest, sighash: sighash);
560 } else {
561 return key.signInput(txDigest, sigHash: sighash);
562 }
563 });
564
562 - return PendingBitcoinTransaction(transaction, type,
563 - electrumClient: electrumClient,
564 - amount: estimatedTx.amount,
565 - fee: estimatedTx.fee,
566 - feeRate: feeRateInt.toString(),
567 - network: network,
568 - hasChange: estimatedTx.hasChange,
569 - isSendAll: estimatedTx.isSendAll)
570 - ..addListener((transaction) async {
565 + return PendingBitcoinTransaction(
566 + transaction,
567 + type,
568 + electrumClient: electrumClient,
569 + amount: estimatedTx.amount,
570 + fee: estimatedTx.fee,
571 + feeRate: feeRateInt.toString(),
572 + network: network,
573 + hasChange: estimatedTx.hasChange,
574 + isSendAll: estimatedTx.isSendAll,
575 + hasTaprootInputs: hasTaprootInputs,
576 + )..addListener((transaction) async {
577 transactionHistory.addOne(transaction);
578 await updateBalance();
579 });
cw_bitcoin/lib/pending_bitcoin_transaction.dart
+13 -9
@@ -8,15 +8,18 @@ import 'package:cw_core/transaction_direction.dart';
8 import 'package:cw_core/wallet_type.dart';
9
10 class PendingBitcoinTransaction with PendingTransaction {
11 - PendingBitcoinTransaction(this._tx, this.type,
12 - {required this.electrumClient,
13 - required this.amount,
14 - required this.fee,
15 - required this.feeRate,
16 - this.network,
17 - required this.hasChange,
18 - required this.isSendAll})
19 - : _listeners = <void Function(ElectrumTransactionInfo transaction)>[];
11 + PendingBitcoinTransaction(
12 + this._tx,
13 + this.type, {
14 + required this.electrumClient,
15 + required this.amount,
16 + required this.fee,
17 + required this.feeRate,
18 + this.network,
19 + required this.hasChange,
20 + required this.isSendAll,
21 + this.hasTaprootInputs = false,
22 + }) : _listeners = <void Function(ElectrumTransactionInfo transaction)>[];
23
24 final WalletType type;
25 final BtcTransaction _tx;
@@ -27,6 +30,7 @@ class PendingBitcoinTransaction with PendingTransaction {
30 final BasedUtxoNetwork? network;
31 final bool hasChange;
32 final bool isSendAll;
33 + final bool hasTaprootInputs;
34
35 @override
36 String get id => _tx.txId();
cw_polygon/lib/polygon_client.dart
+1
@@ -13,6 +13,7 @@ class PolygonClient extends EVMChainClient {
13 required EthereumAddress to,
14 required EtherAmount amount,
15 EtherAmount? maxPriorityFeePerGas,
16 + Uint8List? data,
17 }) {
18 return Transaction(
19 from: from,
lib/bitcoin/cw_bitcoin.dart
+5
@@ -239,4 +239,9 @@ class CWBitcoin extends Bitcoin {
239 return SegwitAddresType.p2wpkh;
240 }
241 }
242 +
243 + @override
244 + bool hasTaprootInput(PendingTransaction pendingTransaction) {
245 + return (pendingTransaction as PendingBitcoinTransaction).hasTaprootInputs;
246 + }
247 }
lib/view_model/send/send_view_model.dart
+15 -1
@@ -308,13 +308,19 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
308 pendingTransaction = await wallet.createTransaction(_credentials());
309 if (provider is ThorChainExchangeProvider) {
310 final outputCount = pendingTransaction?.outputCount ?? 0;
311 - if (outputCount > 10) throw Exception("ThorChain does not support more than 10 outputs");
311 + if (outputCount > 10) {
312 + throw Exception("ThorChain does not support more than 10 outputs");
313 + }
314 + if (_hasTaprootInput(pendingTransaction)) {
315 + throw Exception("ThorChain does not support Taproot addresses");
316 + }
317 }
318 state = ExecutedSuccessfullyState();
319 return pendingTransaction;
320 } catch (e) {
321 state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
322 }
323 + return null;
324 }
325
326 @action
@@ -512,4 +518,12 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
518
519 return errorMessage;
520 }
521 +
522 + bool _hasTaprootInput(PendingTransaction? pendingTransaction) {
523 + if (walletType == WalletType.bitcoin && pendingTransaction != null) {
524 + return bitcoin!.hasTaprootInput(pendingTransaction);
525 + }
526 +
527 + return false;
528 + }
529 }
scripts/android/app_env.sh
+4 -4
@@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
15 APP_ANDROID_TYPE=$1
16
17 MONERO_COM_NAME="Monero.com"
18 -MONERO_COM_VERSION="1.12.0"
19 -MONERO_COM_BUILD_NUMBER=79
18 +MONERO_COM_VERSION="1.12.1"
19 +MONERO_COM_BUILD_NUMBER=80
20 MONERO_COM_BUNDLE_ID="com.monero.app"
21 MONERO_COM_PACKAGE="com.monero.app"
22 MONERO_COM_SCHEME="monero.com"
23
24 CAKEWALLET_NAME="Cake Wallet"
25 -CAKEWALLET_VERSION="4.15.2"
26 -CAKEWALLET_BUILD_NUMBER=200
25 +CAKEWALLET_VERSION="4.15.3"
26 +CAKEWALLET_BUILD_NUMBER=202
27 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
28 CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
29 CAKEWALLET_SCHEME="cakewallet"
scripts/ios/app_env.sh
+3 -3
@@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
13 APP_IOS_TYPE=$1
14
15 MONERO_COM_NAME="Monero.com"
16 -MONERO_COM_VERSION="1.12.0"
16 +MONERO_COM_VERSION="1.12.1"
17 MONERO_COM_BUILD_NUMBER=77
18 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
19
20 CAKEWALLET_NAME="Cake Wallet"
21 -CAKEWALLET_VERSION="4.15.2"
22 -CAKEWALLET_BUILD_NUMBER=219
21 +CAKEWALLET_VERSION="4.15.3"
22 +CAKEWALLET_BUILD_NUMBER=221
23 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
24
25 HAVEN_NAME="Haven"
scripts/macos/app_env.sh
+4 -4
@@ -16,13 +16,13 @@ if [ -n "$1" ]; then
16 fi
17
18 MONERO_COM_NAME="Monero.com"
19 -MONERO_COM_VERSION="1.2.0"
20 -MONERO_COM_BUILD_NUMBER=10
19 +MONERO_COM_VERSION="1.2.1"
20 +MONERO_COM_BUILD_NUMBER=11
21 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
22
23 CAKEWALLET_NAME="Cake Wallet"
24 -CAKEWALLET_VERSION="1.8.2"
25 -CAKEWALLET_BUILD_NUMBER=59
24 +CAKEWALLET_VERSION="1.8.3"
25 +CAKEWALLET_BUILD_NUMBER=61
26 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
27
28 if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then
tool/configure.dart
+3
@@ -61,6 +61,7 @@ Future<void> main(List<String> args) async {
61 Future<void> generateBitcoin(bool hasImplementation) async {
62 final outputFile = File(bitcoinOutputPath);
63 const bitcoinCommonHeaders = """
64 +import 'package:cw_core/pending_transaction.dart';
65 import 'package:cw_core/receive_page_option.dart';
66 import 'package:cw_core/unspent_transaction_output.dart';
67 import 'package:cw_core/wallet_credentials.dart';
@@ -74,6 +75,7 @@ import 'package:cake_wallet/view_model/send/output.dart';
75 import 'package:hive/hive.dart';
76 import 'package:bitcoin_base/bitcoin_base.dart';""";
77 const bitcoinCWHeaders = """
78 +import 'package:cw_bitcoin/pending_bitcoin_transaction.dart';
79 import 'package:cw_bitcoin/bitcoin_receive_page_option.dart';
80 import 'package:cw_bitcoin/electrum_wallet.dart';
81 import 'package:cw_bitcoin/bitcoin_unspent.dart';
@@ -148,6 +150,7 @@ abstract class Bitcoin {
150 ReceivePageOption getSelectedAddressType(Object wallet);
151 List<ReceivePageOption> getBitcoinReceivePageOptions();
152 BitcoinAddressType getBitcoinAddressType(ReceivePageOption option);
153 + bool hasTaprootInput(PendingTransaction pendingTransaction);
154 }
155 """;
156