diff options
author | Jacob Evans <jacob@dekz.net> | 2018-04-11 12:04:27 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-04-11 12:04:27 +0800 |
commit | 260ab2d4134e24a3a2f3fab845fa72c1e1766a3e (patch) | |
tree | 885cb3b7091a29e7b53d856a6e5993a944e2f804 /packages/subproviders/src/utils | |
parent | a824957de7e692d9932a591bb5730ba798bcd8ed (diff) | |
download | dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar.gz dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar.bz2 dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar.lz dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar.xz dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.tar.zst dexon-sol-tools-260ab2d4134e24a3a2f3fab845fa72c1e1766a3e.zip |
Update changelog and add derivationBasePath
Diffstat (limited to 'packages/subproviders/src/utils')
-rw-r--r-- | packages/subproviders/src/utils/wallet_utils.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/subproviders/src/utils/wallet_utils.ts b/packages/subproviders/src/utils/wallet_utils.ts index bd1851d9a..2d9d14e44 100644 --- a/packages/subproviders/src/utils/wallet_utils.ts +++ b/packages/subproviders/src/utils/wallet_utils.ts @@ -20,18 +20,19 @@ class DerivedHDKeyIterator implements IterableIterator<DerivedHDKey> { } public next(): IteratorResult<DerivedHDKey> { - const derivationPath = this._initialDerivedKey.derivationPath; + const derivationBasePath = this._initialDerivedKey.derivationBasePath; const derivationIndex = this._index; // If the DerivedHDKey is a child then we walk relative, if not we walk the full derivation path - const path = this._initialDerivedKey.isChildKey - ? `m/${derivationIndex}` - : `m/${derivationPath}/${derivationIndex}`; + const fullDerivationPath = `m/${derivationBasePath}/${derivationIndex}`; + const relativeDerivationPath = `m/${derivationIndex}`; + const path = this._initialDerivedKey.isChildKey ? relativeDerivationPath : fullDerivationPath; const hdKey = this._initialDerivedKey.hdKey.derive(path); const address = walletUtils.addressOfHDKey(hdKey); const derivedKey: DerivedHDKey = { address, hdKey, - derivationPath, + derivationPath: fullDerivationPath, + derivationBasePath: this._initialDerivedKey.derivationBasePath, derivationIndex, isChildKey: this._initialDerivedKey.isChildKey, }; |