From 97494434727cdb6920f769caee205507e7bf4614 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 26 Apr 2023 16:12:24 -0600 Subject: [PATCH] clean up notif node calls --- .../mixins/paynym_wallet_interface.dart | 41 ++++--------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index 0369b9a95..a6902fd2b 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -276,11 +276,7 @@ mixin PaynymWalletInterface { required bool generateSegwitAddress, bip32.BIP32? mySendBip32Node, }) async { - final node = mySendBip32Node ?? - await deriveNotificationBip32Node( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final node = mySendBip32Node ?? await deriveNotificationBip32Node(); final paymentAddress = PaymentAddress( bip32Node: node, @@ -377,10 +373,7 @@ mixin PaynymWalletInterface { bip32.BIP32? _cachedRootNode; - Future deriveNotificationBip32Node({ - required String mnemonic, - required String mnemonicPassphrase, - }) async { + Future deriveNotificationBip32Node() async { final root = await _getRootNode(); final node = root .derivePath( @@ -408,10 +401,7 @@ mixin PaynymWalletInterface { } Future signWithNotificationKey(Uint8List data) async { - final myPrivateKeyNode = await deriveNotificationBip32Node( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final myPrivateKeyNode = await deriveNotificationBip32Node(); final pair = btc_dart.ECPair.fromPrivateKey(myPrivateKeyNode.privateKey!, network: _network); final signed = pair.sign(SHA256Digest().process(data)); @@ -434,10 +424,7 @@ mixin PaynymWalletInterface { throw PaynymSendException( "No notification transaction sent to $paymentCode"); } else { - final myPrivateKeyNode = await deriveNotificationBip32Node( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - ); + final myPrivateKeyNode = await deriveNotificationBip32Node(); final sendToAddress = await nextUnusedSendAddressFrom( pCode: paymentCode, privateKeyNode: myPrivateKeyNode, @@ -968,11 +955,7 @@ mixin PaynymWalletInterface { final pubKey = _pubKeyFromInput(designatedInput)!; - final myPrivateKey = (await deriveNotificationBip32Node( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - )) - .privateKey!; + final myPrivateKey = (await deriveNotificationBip32Node()).privateKey!; final S = SecretPoint(myPrivateKey, pubKey); @@ -1023,11 +1006,7 @@ mixin PaynymWalletInterface { final pubKey = _pubKeyFromInput(designatedInput)!; - final myPrivateKey = (await deriveNotificationBip32Node( - mnemonic: (await _getMnemonicString())!, - mnemonicPassphrase: (await _getMnemonicPassphrase())!, - )) - .privateKey!; + final myPrivateKey = (await deriveNotificationBip32Node()).privateKey!; final S = SecretPoint(myPrivateKey, pubKey); @@ -1189,13 +1168,7 @@ mixin PaynymWalletInterface { const maxCount = 2147483647; assert(maxNumberOfIndexesToCheck < maxCount); - final mnemonic = (await _getMnemonicString())!; - final mnemonicPassphrase = (await _getMnemonicPassphrase())!; - - final mySendBip32Node = await deriveNotificationBip32Node( - mnemonic: mnemonic, - mnemonicPassphrase: mnemonicPassphrase, - ); + final mySendBip32Node = await deriveNotificationBip32Node(); List
addresses = []; int receivingGapCounter = 0;