aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/src/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders/src/types.ts')
-rw-r--r--packages/subproviders/src/types.ts33
1 files changed, 24 insertions, 9 deletions
diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts
index bacb7091b..74ecec23b 100644
--- a/packages/subproviders/src/types.ts
+++ b/packages/subproviders/src/types.ts
@@ -1,4 +1,5 @@
import { ECSignature, JSONRPCRequestPayload } from '@0xproject/types';
+import HDNode = require('hdkey');
import * as _ from 'lodash';
export interface LedgerCommunicationClient {
@@ -40,20 +41,33 @@ export type LedgerEthereumClientFactoryAsync = () => Promise<LedgerEthereumClien
export interface LedgerSubproviderConfigs {
networkId: number;
ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
- derivationPath?: string;
+ baseDerivationPath?: string;
accountFetchingConfigs?: AccountFetchingConfigs;
}
/*
+ * addressSearchLimit: The maximum number of addresses to search through, defaults to 1000
* numAddressesToReturn: Number of addresses to return from 'eth_accounts' call
* shouldAskForOnDeviceConfirmation: Whether you wish to prompt the user on their Ledger
* before fetching their addresses
*/
export interface AccountFetchingConfigs {
+ addressSearchLimit?: number;
numAddressesToReturn?: number;
shouldAskForOnDeviceConfirmation?: boolean;
}
+/*
+ * mnemonic: The string mnemonic seed
+ * addressSearchLimit: The maximum number of addresses to search through, defaults to 1000
+ * baseDerivationPath: The base derivation path (e.g 44'/60'/0'/0)
+ */
+export interface MnemonicWalletSubproviderConfigs {
+ mnemonic: string;
+ addressSearchLimit?: number;
+ baseDerivationPath?: string;
+}
+
export interface SignatureData {
hash: string;
r: string;
@@ -67,18 +81,12 @@ export interface LedgerGetAddressResult {
chainCode: string;
}
-export interface LedgerWalletSubprovider {
- getPath: () => string;
- setPath: (path: string) => void;
- setPathIndex: (pathIndex: number) => void;
-}
-
export interface PartialTxParams {
nonce: string;
gasPrice?: string;
gas: string;
to: string;
- from?: string;
+ from: string;
value?: string;
data?: string;
chainId: number; // EIP 155 chainId - mainnet: 1, ropsten: 3
@@ -96,12 +104,13 @@ export interface ResponseWithTxParams {
}
export enum WalletSubproviderErrors {
+ AddressNotFound = 'ADDRESS_NOT_FOUND',
DataMissingForSignPersonalMessage = 'DATA_MISSING_FOR_SIGN_PERSONAL_MESSAGE',
SenderInvalidOrNotSupplied = 'SENDER_INVALID_OR_NOT_SUPPLIED',
+ FromAddressMissingOrInvalid = 'FROM_ADDRESS_MISSING_OR_INVALID',
}
export enum LedgerSubproviderErrors {
TooOldLedgerFirmware = 'TOO_OLD_LEDGER_FIRMWARE',
- FromAddressMissingOrInvalid = 'FROM_ADDRESS_MISSING_OR_INVALID',
MultipleOpenConnectionsDisallowed = 'MULTIPLE_OPEN_CONNECTIONS_DISALLOWED',
}
@@ -109,6 +118,12 @@ export enum NonceSubproviderErrors {
EmptyParametersFound = 'EMPTY_PARAMETERS_FOUND',
CannotDetermineAddressFromPayload = 'CANNOT_DETERMINE_ADDRESS_FROM_PAYLOAD',
}
+export interface DerivedHDKeyInfo {
+ address: string;
+ baseDerivationPath: string;
+ derivationPath: string;
+ hdKey: HDNode;
+}
export type ErrorCallback = (err: Error | null, data?: any) => void;
export type Callback = () => void;