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
|
// 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
|
// refresh transactions to pick up any received notification transactions
|
||||||
await _refreshTransactions();
|
await _refreshTransactions();
|
||||||
|
|
|
@ -280,9 +280,10 @@ mixin PaynymWalletInterface {
|
||||||
|
|
||||||
/// fetch or generate this wallet's bip47 payment code
|
/// fetch or generate this wallet's bip47 payment code
|
||||||
Future<PaymentCode> getPaymentCode(
|
Future<PaymentCode> getPaymentCode(
|
||||||
DerivePathType derivePathType,
|
DerivePathType derivePathType, [
|
||||||
) async {
|
bip32.BIP32? bip32Root,
|
||||||
final address = await getMyNotificationAddress(derivePathType);
|
]) async {
|
||||||
|
final address = await getMyNotificationAddress(derivePathType, bip32Root);
|
||||||
final pCodeString = await paymentCodeStringByKey(address.otherData!);
|
final pCodeString = await paymentCodeStringByKey(address.otherData!);
|
||||||
final paymentCode = PaymentCode.fromPaymentCode(
|
final paymentCode = PaymentCode.fromPaymentCode(
|
||||||
pCodeString!,
|
pCodeString!,
|
||||||
|
@ -1305,8 +1306,9 @@ mixin PaynymWalletInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Address> getMyNotificationAddress(
|
Future<Address> getMyNotificationAddress(
|
||||||
DerivePathType derivePathType,
|
DerivePathType derivePathType, [
|
||||||
) async {
|
bip32.BIP32? bip32Root,
|
||||||
|
]) async {
|
||||||
// TODO: fix when segwit is here
|
// TODO: fix when segwit is here
|
||||||
derivePathType = DerivePathType.bip44;
|
derivePathType = DerivePathType.bip44;
|
||||||
|
|
||||||
|
@ -1339,7 +1341,8 @@ mixin PaynymWalletInterface {
|
||||||
if (storedAddress != null) {
|
if (storedAddress != null) {
|
||||||
return storedAddress;
|
return storedAddress;
|
||||||
} else {
|
} else {
|
||||||
final root = await _getRootNode(
|
final root = bip32Root ??
|
||||||
|
await _getRootNode(
|
||||||
mnemonic: (await _getMnemonicString())!,
|
mnemonic: (await _getMnemonicString())!,
|
||||||
mnemonicPassphrase: (await _getMnemonicPassphrase())!,
|
mnemonicPassphrase: (await _getMnemonicPassphrase())!,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue