diff --git a/assets/text/Release_Notes.txt b/assets/text/Release_Notes.txt index 87d1e1747e..515a0333e2 100644 --- a/assets/text/Release_Notes.txt +++ b/assets/text/Release_Notes.txt @@ -1,6 +1,2 @@ -Add Polygon (Matic) wallet -Polyseed enhancements -New on-ramp provider DFX -Usability enhancements -Bitcoin enhancements +Support multiple address types for Bitcoin Cash Bug fixes \ No newline at end of file diff --git a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart index fa41de7678..c232204233 100644 --- a/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart +++ b/cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:bitbox/bitbox.dart' as bitbox; +import 'package:bitcoin_base/bitcoin_base.dart'; import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin; import 'package:cw_bitcoin/bitcoin_address_record.dart'; import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; @@ -210,9 +211,28 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store { txb.addInput(input.hash, input.vout); }); + final String bchPrefix = "bitcoincash:"; + outputs.forEach((item) { final outputAmount = hasMultiDestination ? item.formattedCryptoAmount : amount; - final outputAddress = item.isParsedAddress ? item.extractedAddress! : item.address; + String outputAddress = item.isParsedAddress ? item.extractedAddress! : item.address; + + if (!outputAddress.startsWith(bchPrefix)) { + outputAddress = "$bchPrefix$outputAddress"; + } + + bool isP2sh = outputAddress.startsWith("p", bchPrefix.length); + + if (isP2sh) { + final p2sh = P2shAddress.fromAddress( + address: outputAddress, + network: BitcoinCashNetwork.mainnet, + ); + + txb.addOutput(Uint8List.fromList(p2sh.toScriptPubKey().toBytes()), outputAmount!); + return; + } + txb.addOutput(outputAddress, outputAmount!); }); diff --git a/cw_bitcoin_cash/pubspec.yaml b/cw_bitcoin_cash/pubspec.yaml index eb1f057d88..49a5efb15c 100644 --- a/cw_bitcoin_cash/pubspec.yaml +++ b/cw_bitcoin_cash/pubspec.yaml @@ -29,6 +29,7 @@ dependencies: git: url: https://github.com/cake-tech/bitbox-flutter.git ref: master + bitcoin_base: ^3.0.1 diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index 35d42f6d2b..0f7f25d9be 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -245,7 +245,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen } static CryptoCurrency fromFullName(String name) { - if (CryptoCurrency._fullNameCurrencyMap[name.toLowerCase()] == null) { + if (CryptoCurrency._fullNameCurrencyMap[name.split("(").first.trim().toLowerCase()] == null) { final s = 'Unexpected token: $name for CryptoCurrency fromFullName'; throw ArgumentError.value(name, 'Fullname', s); } diff --git a/lib/core/address_validator.dart b/lib/core/address_validator.dart index 558d14f6d1..2ae9e3297e 100644 --- a/lib/core/address_validator.dart +++ b/lib/core/address_validator.dart @@ -92,7 +92,7 @@ class AddressValidator extends TextValidator { case CryptoCurrency.eos: return '[0-9a-zA-Z]'; case CryptoCurrency.bch: - return '^(?!bitcoincash:)[0-9a-zA-Z]*\$|^(?!bitcoincash:)q[0-9a-zA-Z]{41}\$|^(?!bitcoincash:)q[0-9a-zA-Z]{42}\$|^bitcoincash:q[0-9a-zA-Z]{41}\$|^bitcoincash:q[0-9a-zA-Z]{42}\$'; + return '^(?!bitcoincash:)[0-9a-zA-Z]*\$|^(?!bitcoincash:)q|p[0-9a-zA-Z]{41}\$|^(?!bitcoincash:)q|p[0-9a-zA-Z]{42}\$|^bitcoincash:q|p[0-9a-zA-Z]{41}\$|^bitcoincash:q|p[0-9a-zA-Z]{42}\$'; case CryptoCurrency.bnb: return '[0-9a-zA-Z]'; case CryptoCurrency.ltc: diff --git a/macos/Podfile.lock b/macos/Podfile.lock index c1659f4cc2..3297320755 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -41,7 +41,6 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - tor (0.0.1) - url_launcher_macos (0.0.1): - FlutterMacOS - wakelock_plus (0.0.1): @@ -60,7 +59,6 @@ DEPENDENCIES: - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - - tor (from `Flutter/ephemeral/.symlinks/plugins/tor/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) @@ -93,8 +91,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin - tor: - :path: Flutter/ephemeral/.symlinks/plugins/tor/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos wakelock_plus: @@ -102,7 +98,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: connectivity_plus_macos: f6e86fd000e971d361e54b5afcadc8c8fa773308 - cw_monero: f8b7f104508efba2591548e76b5c058d05cba3f0 + cw_monero: ec03de55a19c4a2b174ea687e0f4202edc716fa4 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f devicelocale: 9f0f36ac651cabae2c33f32dcff4f32b61c38225 flutter_secure_storage_macos: d56e2d218c1130b262bef8b4a7d64f88d7f9c9ea @@ -114,7 +110,6 @@ SPEC CHECKSUMS: ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 - tor: 2138c48428e696b83eacdda404de6d5574932e26 url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index a078078640..5feae289ed 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -22,8 +22,8 @@ MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_SCHEME="monero.com" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.12.0" -CAKEWALLET_BUILD_NUMBER=187 +CAKEWALLET_VERSION="4.12.1" +CAKEWALLET_BUILD_NUMBER=188 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_SCHEME="cakewallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 4f3707ac29..ee59e837c7 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -18,8 +18,8 @@ MONERO_COM_BUILD_NUMBER=69 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.12.0" -CAKEWALLET_BUILD_NUMBER=205 +CAKEWALLET_VERSION="4.12.1" +CAKEWALLET_BUILD_NUMBER=206 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" diff --git a/scripts/macos/app_env.sh b/scripts/macos/app_env.sh index 6901249de8..a37d67a827 100755 --- a/scripts/macos/app_env.sh +++ b/scripts/macos/app_env.sh @@ -15,8 +15,8 @@ if [ -n "$1" ]; then fi CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.5.0" -CAKEWALLET_BUILD_NUMBER=47 +CAKEWALLET_VERSION="1.5.1" +CAKEWALLET_BUILD_NUMBER=48 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then