@rabby-wallet/eth-hd-keyring 4.2.0-beta.1 → 4.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +114 -0
- package/dist/index.js +2674 -298
- package/index.ts +51 -4
- package/package.json +12 -3
- package/patches/slip39+0.1.9.patch +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { HDKey } from 'ethereum-cryptography/hdkey';
|
|
2
|
+
import SimpleKeyring from '@rabby-wallet/eth-simple-keyring';
|
|
3
|
+
|
|
4
|
+
declare enum HDPathType {
|
|
5
|
+
LedgerLive = "LedgerLive",
|
|
6
|
+
Legacy = "Legacy",
|
|
7
|
+
BIP44 = "BIP44"
|
|
8
|
+
}
|
|
9
|
+
interface Wallet {
|
|
10
|
+
publicKey: Uint8Array;
|
|
11
|
+
privateKey: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
interface DeserializeOption {
|
|
14
|
+
hdPath?: string;
|
|
15
|
+
mnemonic: string;
|
|
16
|
+
activeIndexes?: number[];
|
|
17
|
+
byImport?: boolean;
|
|
18
|
+
index?: number;
|
|
19
|
+
passphrase?: string;
|
|
20
|
+
needPassphrase?: boolean;
|
|
21
|
+
accounts?: string[];
|
|
22
|
+
accountDetails?: Record<string, AccountDetail>;
|
|
23
|
+
publicKey?: string;
|
|
24
|
+
isSlip39?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface AccountDetail {
|
|
27
|
+
hdPath: string;
|
|
28
|
+
hdPathType: HDPathType;
|
|
29
|
+
index: number;
|
|
30
|
+
basePublicKey?: string;
|
|
31
|
+
}
|
|
32
|
+
declare class HdKeyring extends SimpleKeyring {
|
|
33
|
+
static type: string;
|
|
34
|
+
type: string;
|
|
35
|
+
mnemonic: string | null;
|
|
36
|
+
hdPath: string;
|
|
37
|
+
hdWallet?: HDKey;
|
|
38
|
+
wallets: Wallet[];
|
|
39
|
+
activeIndexes: number[];
|
|
40
|
+
index: number;
|
|
41
|
+
page: number;
|
|
42
|
+
perPage: number;
|
|
43
|
+
byImport: boolean;
|
|
44
|
+
publicKey: string;
|
|
45
|
+
needPassphrase: boolean;
|
|
46
|
+
accounts: string[];
|
|
47
|
+
accountDetails: Record<string, AccountDetail>;
|
|
48
|
+
passphrase?: string;
|
|
49
|
+
isSlip39: boolean;
|
|
50
|
+
constructor(opts?: DeserializeOption);
|
|
51
|
+
serialize(): Promise<{
|
|
52
|
+
mnemonic: string;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated
|
|
55
|
+
*/
|
|
56
|
+
activeIndexes: number[];
|
|
57
|
+
hdPath: string;
|
|
58
|
+
byImport: boolean;
|
|
59
|
+
index: number;
|
|
60
|
+
needPassphrase: boolean;
|
|
61
|
+
accounts: string[];
|
|
62
|
+
accountDetails: Record<string, AccountDetail>;
|
|
63
|
+
publicKey: string;
|
|
64
|
+
isSlip39: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
deserialize(opts?: DeserializeOption): string[] | Promise<any[]>;
|
|
67
|
+
initFromMnemonic(mnemonic: string, passphrase?: string): void;
|
|
68
|
+
private calcBasePublicKey;
|
|
69
|
+
addAccounts(numberOfAccounts?: number): Promise<string[]>;
|
|
70
|
+
activeAccounts(indexes: number[]): string[];
|
|
71
|
+
getFirstPage(): Promise<{
|
|
72
|
+
address: string;
|
|
73
|
+
index: string;
|
|
74
|
+
}[]>;
|
|
75
|
+
getNextPage(): Promise<{
|
|
76
|
+
address: string;
|
|
77
|
+
index: string;
|
|
78
|
+
}[]>;
|
|
79
|
+
getPreviousPage(): Promise<{
|
|
80
|
+
address: string;
|
|
81
|
+
index: string;
|
|
82
|
+
}[]>;
|
|
83
|
+
getAddresses(start: number, end: number): any[];
|
|
84
|
+
removeAccount(address: any): void;
|
|
85
|
+
__getPage(increment: number): Promise<Array<{
|
|
86
|
+
address: string;
|
|
87
|
+
index: string;
|
|
88
|
+
}>>;
|
|
89
|
+
getAccounts(): Promise<string[]>;
|
|
90
|
+
getInfoByAddress(address: string): AccountDetail | null;
|
|
91
|
+
_addressFromIndex(i: number): [string, Wallet];
|
|
92
|
+
private _addressFromPublicKey;
|
|
93
|
+
generateMnemonic(): string;
|
|
94
|
+
setHdPath(hdPath?: string): void;
|
|
95
|
+
private getChildForIndex;
|
|
96
|
+
private isLedgerLiveHdPath;
|
|
97
|
+
private getPathForIndex;
|
|
98
|
+
setPassphrase(passphrase: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* if passphrase is correct, the publicKey will be the same as the stored one
|
|
101
|
+
*/
|
|
102
|
+
checkPassphrase(passphrase: string): boolean;
|
|
103
|
+
setAccountDetail: (address: string, accountDetail: AccountDetail) => void;
|
|
104
|
+
getAccountDetail: (address: string) => AccountDetail;
|
|
105
|
+
private getHDPathBase;
|
|
106
|
+
setHDPathType(hdPathType: HDPathType): Promise<void>;
|
|
107
|
+
getSeed(mnemonic: string, passphrase?: string): Uint8Array;
|
|
108
|
+
slip39MnemonicToSeedSync(mnemonic: string, passphrase?: string): Uint8Array;
|
|
109
|
+
static checkMnemonicIsSlip39(mnemonic: string): boolean;
|
|
110
|
+
static slip39DecodeMnemonics(shares: string[]): any;
|
|
111
|
+
static validateMnemonic(mnemonic: string): boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { HdKeyring as default };
|