fix backward compatibility issue with existing electrum wallets (#1424)

Omar Hatem committed May 1, 2024 at 19:21 UTC e87353c012a12ea82e9841228b67b46c1f76a63d
6 files changed +23 -33
assets/text/Release_Notes.txt
+1 -3
@@ -1,3 +1 @@
1 -Support restoring Non-Electrum Bitcoin Wallets (check supported derivation paths https://github.com/cake-tech/cake_wallet/blob/main/cw_bitcoin/lib/bitcoin_derivations.dart)
2 -Bitcoin enhancements and bug fixes
3 -Generic bug fixes and enhancements
\ No newline at end of file
1 +Bitcoin Bug fixes and enhancements
\ No newline at end of file
cw_bitcoin/lib/bitcoin_wallet.dart
+4 -4
@@ -51,15 +51,14 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
51 // the sideHd derivation path = m/84'/0'/0'/1 (account 1, index unspecified here)
52 String derivationPath = walletInfo.derivationInfo!.derivationPath!;
53 String sideDerivationPath = derivationPath.substring(0, derivationPath.length - 1) + "1";
54 - final hd = bitcoin.HDWallet.fromSeed(seedBytes, network: networkType);
54 walletAddresses = BitcoinWalletAddresses(
55 walletInfo,
56 electrumClient: electrumClient,
57 initialAddresses: initialAddresses,
58 initialRegularAddressIndex: initialRegularAddressIndex,
59 initialChangeAddressIndex: initialChangeAddressIndex,
61 - mainHd: hd.derivePath(derivationPath),
62 - sideHd: hd.derivePath(sideDerivationPath),
60 + mainHd: hd,
61 + sideHd: bitcoin.HDWallet.fromSeed(seedBytes, network: networkType).derivePath(sideDerivationPath),
62 network: networkParam ?? network,
63 );
64 autorun((_) {
@@ -127,7 +126,8 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
126 );
127
128 // set the default if not present:
130 - walletInfo.derivationInfo!.derivationPath = snp.derivationPath ?? "m/0'/1";
129 + walletInfo.derivationInfo!.derivationPath = snp.derivationPath ?? "m/0'/0";
130 + walletInfo.derivationInfo!.derivationType = snp.derivationType ?? DerivationType.electrum;
131
132 late Uint8List seedBytes;
133
cw_nano/pubspec.lock
+12 -20
@@ -173,10 +173,10 @@ packages:
173 dependency: transitive
174 description:
175 name: collection
176 - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
176 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
177 url: "https://pub.dev"
178 source: hosted
179 - version: "1.17.2"
179 + version: "1.17.1"
180 convert:
181 dependency: transitive
182 description:
@@ -419,18 +419,18 @@ packages:
419 dependency: transitive
420 description:
421 name: matcher
422 - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
422 + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
423 url: "https://pub.dev"
424 source: hosted
425 - version: "0.12.16"
425 + version: "0.12.15"
426 material_color_utilities:
427 dependency: transitive
428 description:
429 name: material_color_utilities
430 - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
430 + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
431 url: "https://pub.dev"
432 source: hosted
433 - version: "0.5.0"
433 + version: "0.2.0"
434 meta:
435 dependency: transitive
436 description:
@@ -713,10 +713,10 @@ packages:
713 dependency: transitive
714 description:
715 name: source_span
716 - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
716 + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
717 url: "https://pub.dev"
718 source: hosted
719 - version: "1.10.0"
719 + version: "1.9.1"
720 stack_trace:
721 dependency: transitive
722 description:
@@ -761,10 +761,10 @@ packages:
761 dependency: transitive
762 description:
763 name: test_api
764 - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
764 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
765 url: "https://pub.dev"
766 source: hosted
767 - version: "0.6.0"
767 + version: "0.5.1"
768 timing:
769 dependency: transitive
770 description:
@@ -790,21 +790,13 @@ packages:
790 source: hosted
791 version: "2.1.4"
792 watcher:
793 - dependency: "direct overridden"
793 + dependency: transitive
794 description:
795 name: watcher
796 sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
797 url: "https://pub.dev"
798 source: hosted
799 version: "1.1.0"
800 - web:
801 - dependency: transitive
802 - description:
803 - name: web
804 - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
805 - url: "https://pub.dev"
806 - source: hosted
807 - version: "0.1.4-beta"
800 web_socket_channel:
801 dependency: transitive
802 description:
@@ -838,5 +830,5 @@ packages:
830 source: hosted
831 version: "3.1.2"
832 sdks:
841 - dart: ">=3.1.0-185.0.dev <4.0.0"
833 + dart: ">=3.0.0 <4.0.0"
834 flutter: ">=3.7.0"
scripts/android/app_env.sh
+2 -2
@@ -22,8 +22,8 @@ MONERO_COM_PACKAGE="com.monero.app"
22 MONERO_COM_SCHEME="monero.com"
23
24 CAKEWALLET_NAME="Cake Wallet"
25 -CAKEWALLET_VERSION="4.15.5"
26 -CAKEWALLET_BUILD_NUMBER=206
25 +CAKEWALLET_VERSION="4.15.6"
26 +CAKEWALLET_BUILD_NUMBER=207
27 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
28 CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
29 CAKEWALLET_SCHEME="cakewallet"
scripts/ios/app_env.sh
+2 -2
@@ -18,8 +18,8 @@ MONERO_COM_BUILD_NUMBER=82
18 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
19
20 CAKEWALLET_NAME="Cake Wallet"
21 -CAKEWALLET_VERSION="4.15.5"
22 -CAKEWALLET_BUILD_NUMBER=231
21 +CAKEWALLET_VERSION="4.15.6"
22 +CAKEWALLET_BUILD_NUMBER=232
23 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
24
25 HAVEN_NAME="Haven"
scripts/macos/app_env.sh
+2 -2
@@ -21,8 +21,8 @@ MONERO_COM_BUILD_NUMBER=16
21 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
22
23 CAKEWALLET_NAME="Cake Wallet"
24 -CAKEWALLET_VERSION="1.8.5"
25 -CAKEWALLET_BUILD_NUMBER=66
24 +CAKEWALLET_VERSION="1.8.6"
25 +CAKEWALLET_BUILD_NUMBER=67
26 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
27
28 if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then