From 4aa67e292504fea307a4e5f15a124349fc769da6 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Wed, 11 Apr 2018 14:11:16 +1000 Subject: Update JSDoc for methods in ledger and mnemonic wallet --- packages/subproviders/src/subproviders/ledger.ts | 6 +++--- packages/subproviders/src/subproviders/mnemonic_wallet.ts | 12 ++++++------ packages/subproviders/src/utils/wallet_utils.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'packages') diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts index 975893f8a..0c037b488 100644 --- a/packages/subproviders/src/subproviders/ledger.ts +++ b/packages/subproviders/src/subproviders/ledger.ts @@ -140,8 +140,8 @@ export class LedgerSubprovider extends BaseWalletSubprovider { } } /** - * Sign a personal Ethereum signed message. The signing address will be the one - * the provided address. + * Sign a personal Ethereum signed message. The signing account will be the account + * associated with the provided address. * The Ledger adds the Ethereum signed message prefix on-device. If you've added * the LedgerSubprovider to your app's provider, you can simply send an `eth_sign` * or `personal_sign` JSON RPC request, and this method will be called auto-magically. @@ -217,7 +217,7 @@ export class LedgerSubprovider extends BaseWalletSubprovider { address: ledgerResponse.address, isChildKey: true, derivationBasePath: this._derivationBasePath, - derivationPath: `${this._derivationBasePath}/${0}`, + derivationPath: `${this._derivationBasePath}/0`, derivationIndex: 0, }; } diff --git a/packages/subproviders/src/subproviders/mnemonic_wallet.ts b/packages/subproviders/src/subproviders/mnemonic_wallet.ts index 972f7e65e..855db21ad 100644 --- a/packages/subproviders/src/subproviders/mnemonic_wallet.ts +++ b/packages/subproviders/src/subproviders/mnemonic_wallet.ts @@ -85,7 +85,7 @@ export class MnemonicWalletSubprovider extends BaseWalletSubprovider { } /** - * Signs a transaction with the from account (if specificed in txParams) or the first account. + * Signs a transaction with the from account specificed in txParams. * If you've added this Subprovider to your app's provider, you can simply send * an `eth_sendTransaction` JSON RPC request, and * this method will be called auto-magically. * If you are not using this via a ProviderEngine instance, you can call it directly. @@ -93,13 +93,13 @@ export class MnemonicWalletSubprovider extends BaseWalletSubprovider { * @return Signed transaction hex string */ public async signTransactionAsync(txParams: PartialTxParams): Promise { - const privateKeyWallet = this._privateKeyWalletFromAddress(txParams.from); + const privateKeyWallet = this._privateKeyWalletForAddress(txParams.from); const signedTx = privateKeyWallet.signTransactionAsync(txParams); return signedTx; } /** - * Sign a personal Ethereum signed message. The signing address used will be - * address provided or the first address derived from the set path. + * Sign a personal Ethereum signed message. The signing account will be the account + * associated with the provided address. * If you've added the MnemonicWalletSubprovider to your app's provider, you can simply send an `eth_sign` * or `personal_sign` JSON RPC request, and this method will be called auto-magically. * If you are not using this via a ProviderEngine instance, you can call it directly. @@ -108,11 +108,11 @@ export class MnemonicWalletSubprovider extends BaseWalletSubprovider { * @return Signature hex string (order: rsv) */ public async signPersonalMessageAsync(data: string, address: string): Promise { - const privateKeyWallet = this._privateKeyWalletFromAddress(address); + const privateKeyWallet = this._privateKeyWalletForAddress(address); const sig = await privateKeyWallet.signPersonalMessageAsync(data, address); return sig; } - private _privateKeyWalletFromAddress(address: string): PrivateKeyWalletSubprovider { + private _privateKeyWalletForAddress(address: string): PrivateKeyWalletSubprovider { const derivedKey = this._findDerivedKeyByPublicAddress(address); const privateKeyHex = derivedKey.hdKey.privateKey.toString('hex'); const privateKeyWallet = new PrivateKeyWalletSubprovider(privateKeyHex); diff --git a/packages/subproviders/src/utils/wallet_utils.ts b/packages/subproviders/src/utils/wallet_utils.ts index 2d9d14e44..097d2b82f 100644 --- a/packages/subproviders/src/utils/wallet_utils.ts +++ b/packages/subproviders/src/utils/wallet_utils.ts @@ -52,9 +52,9 @@ class DerivedHDKeyIterator implements IterableIterator { export const walletUtils = { DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_NUM_ADDRESSES_TO_FETCH: 10, - calculateDerivedHDKeys(initialDerivedKey: DerivedHDKey, searchLimit: number): DerivedHDKey[] { + calculateDerivedHDKeys(initialDerivedKey: DerivedHDKey, numberOfKeys: number): DerivedHDKey[] { const derivedKeys: DerivedHDKey[] = []; - const derivedKeyIterator = new DerivedHDKeyIterator(initialDerivedKey, searchLimit); + const derivedKeyIterator = new DerivedHDKeyIterator(initialDerivedKey, numberOfKeys); for (const key of derivedKeyIterator) { derivedKeys.push(key); } -- cgit