mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
pass bip32 root node is available to save generation time
This commit is contained in:
parent
703ceee86d
commit
8e73e3ecba
2 changed files with 13 additions and 10 deletions
|
@ -660,7 +660,7 @@ class BitcoinWallet extends CoinServiceAPI
|
|||
}
|
||||
|
||||
// get own payment code
|
||||
final myCode = await getPaymentCode(DerivePathType.bip44);
|
||||
final myCode = await getPaymentCode(DerivePathType.bip44, root);
|
||||
|
||||
// refresh transactions to pick up any received notification transactions
|
||||
await _refreshTransactions();
|
||||
|
|
|
@ -280,9 +280,10 @@ mixin PaynymWalletInterface {
|
|||
|
||||
/// fetch or generate this wallet's bip47 payment code
|
||||
Future<PaymentCode> getPaymentCode(
|
||||
DerivePathType derivePathType,
|
||||
) async {
|
||||
final address = await getMyNotificationAddress(derivePathType);
|
||||
DerivePathType derivePathType, [
|
||||
bip32.BIP32? bip32Root,
|
||||
]) async {
|
||||
final address = await getMyNotificationAddress(derivePathType, bip32Root);
|
||||
final pCodeString = await paymentCodeStringByKey(address.otherData!);
|
||||
final paymentCode = PaymentCode.fromPaymentCode(
|
||||
pCodeString!,
|
||||
|
@ -1305,8 +1306,9 @@ mixin PaynymWalletInterface {
|
|||
}
|
||||
|
||||
Future<Address> getMyNotificationAddress(
|
||||
DerivePathType derivePathType,
|
||||
) async {
|
||||
DerivePathType derivePathType, [
|
||||
bip32.BIP32? bip32Root,
|
||||
]) async {
|
||||
// TODO: fix when segwit is here
|
||||
derivePathType = DerivePathType.bip44;
|
||||
|
||||
|
@ -1339,10 +1341,11 @@ mixin PaynymWalletInterface {
|
|||
if (storedAddress != null) {
|
||||
return storedAddress;
|
||||
} else {
|
||||
final root = await _getRootNode(
|
||||
mnemonic: (await _getMnemonicString())!,
|
||||
mnemonicPassphrase: (await _getMnemonicPassphrase())!,
|
||||
);
|
||||
final root = bip32Root ??
|
||||
await _getRootNode(
|
||||
mnemonic: (await _getMnemonicString())!,
|
||||
mnemonicPassphrase: (await _getMnemonicPassphrase())!,
|
||||
);
|
||||
final node = root.derivePath(kPaynymDerivePath);
|
||||
final paymentCode = PaymentCode.fromBip32Node(
|
||||
node,
|
||||
|
|
Loading…
Reference in a new issue