aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/src/utils
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-04-12 14:49:42 +0800
committerJacob Evans <jacob@dekz.net>2018-04-12 14:59:57 +0800
commitb669508c34e541416b157babe3fc57d74216ee50 (patch)
treea938f3d370ec31b781bb31fccdc4273d84701e05 /packages/subproviders/src/utils
parentbe73084e04264d44cfbd7cf6b8ba3a993368133d (diff)
downloaddexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar.gz
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar.bz2
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar.lz
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar.xz
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.tar.zst
dexon-sol-tools-b669508c34e541416b157babe3fc57d74216ee50.zip
Pluck key off of base path branch for Mnemonic
This reduces the tree walk complexity in wallet utils as it is assumed that we always walk relative. It also removes a HACK :)
Diffstat (limited to 'packages/subproviders/src/utils')
-rw-r--r--packages/subproviders/src/utils/wallet_utils.ts9
1 files changed, 2 insertions, 7 deletions
diff --git a/packages/subproviders/src/utils/wallet_utils.ts b/packages/subproviders/src/utils/wallet_utils.ts
index a37597dff..4db876748 100644
--- a/packages/subproviders/src/utils/wallet_utils.ts
+++ b/packages/subproviders/src/utils/wallet_utils.ts
@@ -20,20 +20,15 @@ class DerivedHDKeyInfoIterator implements IterableIterator<DerivedHDKeyInfo> {
public next(): IteratorResult<DerivedHDKeyInfo> {
const baseDerivationPath = this._initialDerivedKey.baseDerivationPath;
const derivationIndex = this._index;
- const isChildKey = this._initialDerivedKey.isChildKey;
- // If the DerivedHDKey is a child then we walk relative, if not we walk the full derivation path
const fullDerivationPath = `m/${baseDerivationPath}/${derivationIndex}`;
- const relativeDerivationPath = `m/${derivationIndex}`;
- const path = isChildKey ? relativeDerivationPath : fullDerivationPath;
+ const path = `m/${derivationIndex}`;
const hdKey = this._initialDerivedKey.hdKey.derive(path);
const address = walletUtils.addressOfHDKey(hdKey);
const derivedKey: DerivedHDKeyInfo = {
address,
hdKey,
baseDerivationPath,
- derivationIndex,
derivationPath: fullDerivationPath,
- isChildKey,
};
const done = this._index === this._searchLimit;
this._index++;
@@ -78,7 +73,7 @@ export const walletUtils = {
const ethereumAddressUnprefixed = ethUtil
.publicToAddress(derivedPublicKey, shouldSanitizePublicKey)
.toString('hex');
- const address = ethUtil.addHexPrefix(ethereumAddressUnprefixed);
+ const address = ethUtil.addHexPrefix(ethereumAddressUnprefixed).toLowerCase();
return address;
},
};