diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index e72c6846b..0369b9a95 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -143,10 +143,7 @@ mixin PaynymWalletInterface { btc_dart.NetworkType get networkType => _network; Future getBip47BaseNode() async { - final root = await _getRootNode( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final root = await _getRootNode(); final node = root.derivePath( _basePaynymDerivePath( testnet: _coin.isTestNet, @@ -237,10 +234,7 @@ mixin PaynymWalletInterface { required int index, required bool generateSegwitAddress, }) async { - final root = await _getRootNode( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final root = await _getRootNode(); final node = root.derivePath( _basePaynymDerivePath( testnet: _coin.isTestNet, @@ -373,13 +367,10 @@ mixin PaynymWalletInterface { } // generate bip32 payment code root - Future _getRootNode({ - required String mnemonic, - required String mnemonicPassphrase, - }) async { + Future _getRootNode() async { return _cachedRootNode ??= await Bip32Utils.getBip32Root( - mnemonic, - mnemonicPassphrase, + (await _getMnemonicString())!, + (await _getMnemonicPassphrase())!, _network, ); } @@ -390,10 +381,7 @@ mixin PaynymWalletInterface { required String mnemonic, required String mnemonicPassphrase, }) async { - final root = await _getRootNode( - mnemonic: mnemonic, - mnemonicPassphrase: mnemonicPassphrase, - ); + final root = await _getRootNode(); final node = root .derivePath( _basePaynymDerivePath( @@ -408,10 +396,7 @@ mixin PaynymWalletInterface { Future getPaymentCode({ required bool isSegwit, }) async { - final node = await _getRootNode( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final node = await _getRootNode(); final paymentCode = PaymentCode.fromBip32Node( node.derivePath(_basePaynymDerivePath(testnet: _coin.isTestNet)), @@ -1335,10 +1320,7 @@ mixin PaynymWalletInterface { if (storedAddress != null) { return storedAddress; } else { - final root = await _getRootNode( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final root = await _getRootNode(); final node = root.derivePath( _basePaynymDerivePath( testnet: _coin.isTestNet,