@xyo-network/wallet-model 4.0.3 → 4.1.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/browser/index.d.ts +77 -0
- package/dist/neutral/Mnemonic.d.ts +27 -0
- package/dist/neutral/Mnemonic.d.ts.map +1 -0
- package/dist/neutral/Wallet.d.ts +26 -0
- package/dist/neutral/Wallet.d.ts.map +1 -0
- package/dist/neutral/Wordlist.d.ts +24 -0
- package/dist/neutral/Wordlist.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +77 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/node/Mnemonic.d.ts +27 -0
- package/dist/node/Mnemonic.d.ts.map +1 -0
- package/dist/node/Wallet.d.ts +26 -0
- package/dist/node/Wallet.d.ts.map +1 -0
- package/dist/node/Wordlist.d.ts +24 -0
- package/dist/node/Wordlist.d.ts.map +1 -0
- package/dist/node/index.d.ts +77 -0
- package/dist/node/index.d.ts.map +1 -0
- package/package.json +7 -7
- package/dist/types/index.d.ts +0 -2
- /package/dist/{types → browser}/Mnemonic.d.ts +0 -0
- /package/dist/{types → browser}/Mnemonic.d.ts.map +0 -0
- /package/dist/{types → browser}/Wallet.d.ts +0 -0
- /package/dist/{types → browser}/Wallet.d.ts.map +0 -0
- /package/dist/{types → browser}/Wordlist.d.ts +0 -0
- /package/dist/{types → browser}/Wordlist.d.ts.map +0 -0
- /package/dist/{types → browser}/index.d.ts.map +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Hex } from '@xylabs/hex';
|
|
2
|
+
import { AccountInstance, AccountStatic, AccountConfig } from '@xyo-network/account-model';
|
|
3
|
+
|
|
4
|
+
interface WordlistInstance {
|
|
5
|
+
locale: string;
|
|
6
|
+
/**
|
|
7
|
+
* Maps an 11-bit value into its corresponding word in the list.
|
|
8
|
+
*
|
|
9
|
+
* Sub-classes MUST override this.
|
|
10
|
+
*/
|
|
11
|
+
getWord(index: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Maps a word to its corresponding 11-bit value.
|
|
14
|
+
*
|
|
15
|
+
* Sub-classes MUST override this.
|
|
16
|
+
*/
|
|
17
|
+
getWordIndex(word: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* Sub-classes may override this to provider a language-specific
|
|
20
|
+
* method for joining %%words%% into a phrase.
|
|
21
|
+
*
|
|
22
|
+
* By default, %%words%% are joined by a single space.
|
|
23
|
+
*/
|
|
24
|
+
join(words: Array<string>): string;
|
|
25
|
+
split(phrase: string): Array<string>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface MnemonicInstance {
|
|
29
|
+
/**
|
|
30
|
+
* The underlying entropy which the mnemonic encodes.
|
|
31
|
+
*/
|
|
32
|
+
entropy: string;
|
|
33
|
+
/**
|
|
34
|
+
* The password used for this mnemonic. If no password is used this
|
|
35
|
+
* is the empty string (i.e. ``""``) as per the specification.
|
|
36
|
+
*/
|
|
37
|
+
password: string;
|
|
38
|
+
/**
|
|
39
|
+
* The mnemonic phrase of 12, 15, 18, 21 or 24 words.
|
|
40
|
+
*
|
|
41
|
+
* Use the [[wordlist]] ``split`` method to get the individual words.
|
|
42
|
+
*/
|
|
43
|
+
phrase: string;
|
|
44
|
+
/**
|
|
45
|
+
* The wordlist for this mnemonic.
|
|
46
|
+
*/
|
|
47
|
+
wordlist: WordlistInstance;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the seed for the mnemonic.
|
|
50
|
+
*/
|
|
51
|
+
computeSeed(): string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface WalletInstance extends AccountInstance {
|
|
55
|
+
readonly chainCode: string;
|
|
56
|
+
readonly depth: number;
|
|
57
|
+
readonly derivePath: (path: string) => Promise<WalletInstance>;
|
|
58
|
+
readonly extendedKey: string;
|
|
59
|
+
readonly fingerprint: string;
|
|
60
|
+
readonly index: number;
|
|
61
|
+
readonly mnemonic?: MnemonicInstance | null;
|
|
62
|
+
readonly neuter: () => WalletInstance;
|
|
63
|
+
readonly parentFingerprint: string;
|
|
64
|
+
readonly path: string | null;
|
|
65
|
+
readonly privateKey: Hex;
|
|
66
|
+
readonly publicKey: Hex;
|
|
67
|
+
}
|
|
68
|
+
interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'create'> {
|
|
69
|
+
create(config: AccountConfig): Promise<T>;
|
|
70
|
+
fromExtendedKey(key: string): Promise<T>;
|
|
71
|
+
fromMnemonic(mnemonic: MnemonicInstance): Promise<T>;
|
|
72
|
+
fromPhrase(mnemonic: string, path?: string): Promise<T>;
|
|
73
|
+
fromSeed(seed: string | ArrayBufferLike): Promise<T>;
|
|
74
|
+
random(): any;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type { WalletInstance, WalletStatic };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WordlistInstance } from './Wordlist.ts';
|
|
2
|
+
export interface MnemonicInstance {
|
|
3
|
+
/**
|
|
4
|
+
* The underlying entropy which the mnemonic encodes.
|
|
5
|
+
*/
|
|
6
|
+
entropy: string;
|
|
7
|
+
/**
|
|
8
|
+
* The password used for this mnemonic. If no password is used this
|
|
9
|
+
* is the empty string (i.e. ``""``) as per the specification.
|
|
10
|
+
*/
|
|
11
|
+
password: string;
|
|
12
|
+
/**
|
|
13
|
+
* The mnemonic phrase of 12, 15, 18, 21 or 24 words.
|
|
14
|
+
*
|
|
15
|
+
* Use the [[wordlist]] ``split`` method to get the individual words.
|
|
16
|
+
*/
|
|
17
|
+
phrase: string;
|
|
18
|
+
/**
|
|
19
|
+
* The wordlist for this mnemonic.
|
|
20
|
+
*/
|
|
21
|
+
wordlist: WordlistInstance;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the seed for the mnemonic.
|
|
24
|
+
*/
|
|
25
|
+
computeSeed(): string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Mnemonic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mnemonic.d.ts","sourceRoot":"","sources":["../../src/Mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAE/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAA;IAE1B;;OAEG;IACH,WAAW,IAAI,MAAM,CAAA;CACtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Hex } from '@xylabs/hex';
|
|
2
|
+
import type { AccountConfig, AccountInstance, AccountStatic } from '@xyo-network/account-model';
|
|
3
|
+
import type { MnemonicInstance } from './Mnemonic.ts';
|
|
4
|
+
export interface WalletInstance extends AccountInstance {
|
|
5
|
+
readonly chainCode: string;
|
|
6
|
+
readonly depth: number;
|
|
7
|
+
readonly derivePath: (path: string) => Promise<WalletInstance>;
|
|
8
|
+
readonly extendedKey: string;
|
|
9
|
+
readonly fingerprint: string;
|
|
10
|
+
readonly index: number;
|
|
11
|
+
readonly mnemonic?: MnemonicInstance | null;
|
|
12
|
+
readonly neuter: () => WalletInstance;
|
|
13
|
+
readonly parentFingerprint: string;
|
|
14
|
+
readonly path: string | null;
|
|
15
|
+
readonly privateKey: Hex;
|
|
16
|
+
readonly publicKey: Hex;
|
|
17
|
+
}
|
|
18
|
+
export interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'create'> {
|
|
19
|
+
create(config: AccountConfig): Promise<T>;
|
|
20
|
+
fromExtendedKey(key: string): Promise<T>;
|
|
21
|
+
fromMnemonic(mnemonic: MnemonicInstance): Promise<T>;
|
|
22
|
+
fromPhrase(mnemonic: string, path?: string): Promise<T>;
|
|
23
|
+
fromSeed(seed: string | ArrayBufferLike): Promise<T>;
|
|
24
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AAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACxC,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACpD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAEpD,MAAM,IAAI,GAAG,CAAA;CACd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface WordlistInstance {
|
|
2
|
+
locale: string;
|
|
3
|
+
/**
|
|
4
|
+
* Maps an 11-bit value into its corresponding word in the list.
|
|
5
|
+
*
|
|
6
|
+
* Sub-classes MUST override this.
|
|
7
|
+
*/
|
|
8
|
+
getWord(index: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Maps a word to its corresponding 11-bit value.
|
|
11
|
+
*
|
|
12
|
+
* Sub-classes MUST override this.
|
|
13
|
+
*/
|
|
14
|
+
getWordIndex(word: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* Sub-classes may override this to provider a language-specific
|
|
17
|
+
* method for joining %%words%% into a phrase.
|
|
18
|
+
*
|
|
19
|
+
* By default, %%words%% are joined by a single space.
|
|
20
|
+
*/
|
|
21
|
+
join(words: Array<string>): string;
|
|
22
|
+
split(phrase: string): Array<string>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Wordlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wordlist.d.ts","sourceRoot":"","sources":["../../src/Wordlist.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IAEd;;;;SAIK;IACL,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IAE9B;;;;SAIK;IACL,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAElC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IAElC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;CAErC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Hex } from '@xylabs/hex';
|
|
2
|
+
import { AccountInstance, AccountStatic, AccountConfig } from '@xyo-network/account-model';
|
|
3
|
+
|
|
4
|
+
interface WordlistInstance {
|
|
5
|
+
locale: string;
|
|
6
|
+
/**
|
|
7
|
+
* Maps an 11-bit value into its corresponding word in the list.
|
|
8
|
+
*
|
|
9
|
+
* Sub-classes MUST override this.
|
|
10
|
+
*/
|
|
11
|
+
getWord(index: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Maps a word to its corresponding 11-bit value.
|
|
14
|
+
*
|
|
15
|
+
* Sub-classes MUST override this.
|
|
16
|
+
*/
|
|
17
|
+
getWordIndex(word: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* Sub-classes may override this to provider a language-specific
|
|
20
|
+
* method for joining %%words%% into a phrase.
|
|
21
|
+
*
|
|
22
|
+
* By default, %%words%% are joined by a single space.
|
|
23
|
+
*/
|
|
24
|
+
join(words: Array<string>): string;
|
|
25
|
+
split(phrase: string): Array<string>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface MnemonicInstance {
|
|
29
|
+
/**
|
|
30
|
+
* The underlying entropy which the mnemonic encodes.
|
|
31
|
+
*/
|
|
32
|
+
entropy: string;
|
|
33
|
+
/**
|
|
34
|
+
* The password used for this mnemonic. If no password is used this
|
|
35
|
+
* is the empty string (i.e. ``""``) as per the specification.
|
|
36
|
+
*/
|
|
37
|
+
password: string;
|
|
38
|
+
/**
|
|
39
|
+
* The mnemonic phrase of 12, 15, 18, 21 or 24 words.
|
|
40
|
+
*
|
|
41
|
+
* Use the [[wordlist]] ``split`` method to get the individual words.
|
|
42
|
+
*/
|
|
43
|
+
phrase: string;
|
|
44
|
+
/**
|
|
45
|
+
* The wordlist for this mnemonic.
|
|
46
|
+
*/
|
|
47
|
+
wordlist: WordlistInstance;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the seed for the mnemonic.
|
|
50
|
+
*/
|
|
51
|
+
computeSeed(): string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface WalletInstance extends AccountInstance {
|
|
55
|
+
readonly chainCode: string;
|
|
56
|
+
readonly depth: number;
|
|
57
|
+
readonly derivePath: (path: string) => Promise<WalletInstance>;
|
|
58
|
+
readonly extendedKey: string;
|
|
59
|
+
readonly fingerprint: string;
|
|
60
|
+
readonly index: number;
|
|
61
|
+
readonly mnemonic?: MnemonicInstance | null;
|
|
62
|
+
readonly neuter: () => WalletInstance;
|
|
63
|
+
readonly parentFingerprint: string;
|
|
64
|
+
readonly path: string | null;
|
|
65
|
+
readonly privateKey: Hex;
|
|
66
|
+
readonly publicKey: Hex;
|
|
67
|
+
}
|
|
68
|
+
interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'create'> {
|
|
69
|
+
create(config: AccountConfig): Promise<T>;
|
|
70
|
+
fromExtendedKey(key: string): Promise<T>;
|
|
71
|
+
fromMnemonic(mnemonic: MnemonicInstance): Promise<T>;
|
|
72
|
+
fromPhrase(mnemonic: string, path?: string): Promise<T>;
|
|
73
|
+
fromSeed(seed: string | ArrayBufferLike): Promise<T>;
|
|
74
|
+
random(): any;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type { WalletInstance, WalletStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WordlistInstance } from './Wordlist.ts';
|
|
2
|
+
export interface MnemonicInstance {
|
|
3
|
+
/**
|
|
4
|
+
* The underlying entropy which the mnemonic encodes.
|
|
5
|
+
*/
|
|
6
|
+
entropy: string;
|
|
7
|
+
/**
|
|
8
|
+
* The password used for this mnemonic. If no password is used this
|
|
9
|
+
* is the empty string (i.e. ``""``) as per the specification.
|
|
10
|
+
*/
|
|
11
|
+
password: string;
|
|
12
|
+
/**
|
|
13
|
+
* The mnemonic phrase of 12, 15, 18, 21 or 24 words.
|
|
14
|
+
*
|
|
15
|
+
* Use the [[wordlist]] ``split`` method to get the individual words.
|
|
16
|
+
*/
|
|
17
|
+
phrase: string;
|
|
18
|
+
/**
|
|
19
|
+
* The wordlist for this mnemonic.
|
|
20
|
+
*/
|
|
21
|
+
wordlist: WordlistInstance;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the seed for the mnemonic.
|
|
24
|
+
*/
|
|
25
|
+
computeSeed(): string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Mnemonic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mnemonic.d.ts","sourceRoot":"","sources":["../../src/Mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAE/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAA;IAE1B;;OAEG;IACH,WAAW,IAAI,MAAM,CAAA;CACtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Hex } from '@xylabs/hex';
|
|
2
|
+
import type { AccountConfig, AccountInstance, AccountStatic } from '@xyo-network/account-model';
|
|
3
|
+
import type { MnemonicInstance } from './Mnemonic.ts';
|
|
4
|
+
export interface WalletInstance extends AccountInstance {
|
|
5
|
+
readonly chainCode: string;
|
|
6
|
+
readonly depth: number;
|
|
7
|
+
readonly derivePath: (path: string) => Promise<WalletInstance>;
|
|
8
|
+
readonly extendedKey: string;
|
|
9
|
+
readonly fingerprint: string;
|
|
10
|
+
readonly index: number;
|
|
11
|
+
readonly mnemonic?: MnemonicInstance | null;
|
|
12
|
+
readonly neuter: () => WalletInstance;
|
|
13
|
+
readonly parentFingerprint: string;
|
|
14
|
+
readonly path: string | null;
|
|
15
|
+
readonly privateKey: Hex;
|
|
16
|
+
readonly publicKey: Hex;
|
|
17
|
+
}
|
|
18
|
+
export interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'create'> {
|
|
19
|
+
create(config: AccountConfig): Promise<T>;
|
|
20
|
+
fromExtendedKey(key: string): Promise<T>;
|
|
21
|
+
fromMnemonic(mnemonic: MnemonicInstance): Promise<T>;
|
|
22
|
+
fromPhrase(mnemonic: string, path?: string): Promise<T>;
|
|
23
|
+
fromSeed(seed: string | ArrayBufferLike): Promise<T>;
|
|
24
|
+
random(): any;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wallet.d.ts","sourceRoot":"","sources":["../../src/Wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAE,aAAa,EAC9C,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC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: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Maps a word to its corresponding 11-bit value.
|
|
11
|
+
*
|
|
12
|
+
* Sub-classes MUST override this.
|
|
13
|
+
*/
|
|
14
|
+
getWordIndex(word: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* Sub-classes may override this to provider a language-specific
|
|
17
|
+
* method for joining %%words%% into a phrase.
|
|
18
|
+
*
|
|
19
|
+
* By default, %%words%% are joined by a single space.
|
|
20
|
+
*/
|
|
21
|
+
join(words: Array<string>): string;
|
|
22
|
+
split(phrase: string): Array<string>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Wordlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wordlist.d.ts","sourceRoot":"","sources":["../../src/Wordlist.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IAEd;;;;SAIK;IACL,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IAE9B;;;;SAIK;IACL,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAElC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;IAElC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;CAErC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Hex } from '@xylabs/hex';
|
|
2
|
+
import { AccountInstance, AccountStatic, AccountConfig } from '@xyo-network/account-model';
|
|
3
|
+
|
|
4
|
+
interface WordlistInstance {
|
|
5
|
+
locale: string;
|
|
6
|
+
/**
|
|
7
|
+
* Maps an 11-bit value into its corresponding word in the list.
|
|
8
|
+
*
|
|
9
|
+
* Sub-classes MUST override this.
|
|
10
|
+
*/
|
|
11
|
+
getWord(index: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Maps a word to its corresponding 11-bit value.
|
|
14
|
+
*
|
|
15
|
+
* Sub-classes MUST override this.
|
|
16
|
+
*/
|
|
17
|
+
getWordIndex(word: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* Sub-classes may override this to provider a language-specific
|
|
20
|
+
* method for joining %%words%% into a phrase.
|
|
21
|
+
*
|
|
22
|
+
* By default, %%words%% are joined by a single space.
|
|
23
|
+
*/
|
|
24
|
+
join(words: Array<string>): string;
|
|
25
|
+
split(phrase: string): Array<string>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface MnemonicInstance {
|
|
29
|
+
/**
|
|
30
|
+
* The underlying entropy which the mnemonic encodes.
|
|
31
|
+
*/
|
|
32
|
+
entropy: string;
|
|
33
|
+
/**
|
|
34
|
+
* The password used for this mnemonic. If no password is used this
|
|
35
|
+
* is the empty string (i.e. ``""``) as per the specification.
|
|
36
|
+
*/
|
|
37
|
+
password: string;
|
|
38
|
+
/**
|
|
39
|
+
* The mnemonic phrase of 12, 15, 18, 21 or 24 words.
|
|
40
|
+
*
|
|
41
|
+
* Use the [[wordlist]] ``split`` method to get the individual words.
|
|
42
|
+
*/
|
|
43
|
+
phrase: string;
|
|
44
|
+
/**
|
|
45
|
+
* The wordlist for this mnemonic.
|
|
46
|
+
*/
|
|
47
|
+
wordlist: WordlistInstance;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the seed for the mnemonic.
|
|
50
|
+
*/
|
|
51
|
+
computeSeed(): string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface WalletInstance extends AccountInstance {
|
|
55
|
+
readonly chainCode: string;
|
|
56
|
+
readonly depth: number;
|
|
57
|
+
readonly derivePath: (path: string) => Promise<WalletInstance>;
|
|
58
|
+
readonly extendedKey: string;
|
|
59
|
+
readonly fingerprint: string;
|
|
60
|
+
readonly index: number;
|
|
61
|
+
readonly mnemonic?: MnemonicInstance | null;
|
|
62
|
+
readonly neuter: () => WalletInstance;
|
|
63
|
+
readonly parentFingerprint: string;
|
|
64
|
+
readonly path: string | null;
|
|
65
|
+
readonly privateKey: Hex;
|
|
66
|
+
readonly publicKey: Hex;
|
|
67
|
+
}
|
|
68
|
+
interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'create'> {
|
|
69
|
+
create(config: AccountConfig): Promise<T>;
|
|
70
|
+
fromExtendedKey(key: string): Promise<T>;
|
|
71
|
+
fromMnemonic(mnemonic: MnemonicInstance): Promise<T>;
|
|
72
|
+
fromPhrase(mnemonic: string, path?: string): Promise<T>;
|
|
73
|
+
fromSeed(seed: string | ArrayBufferLike): Promise<T>;
|
|
74
|
+
random(): any;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type { WalletInstance, WalletStatic };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/wallet-model",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"types": "./dist/
|
|
24
|
+
"types": "./dist/neutral/index.d.ts",
|
|
25
25
|
"default": "./dist/neutral/index.mjs"
|
|
26
26
|
},
|
|
27
27
|
"./package.json": "./package.json"
|
|
28
28
|
},
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
|
-
"types": "dist/
|
|
30
|
+
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/hex": "^4.13.
|
|
33
|
-
"@xyo-network/account-model": "^4.
|
|
32
|
+
"@xylabs/hex": "^4.13.15",
|
|
33
|
+
"@xyo-network/account-model": "^4.1.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
37
|
-
"@xylabs/tsconfig": "^
|
|
36
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.23",
|
|
37
|
+
"@xylabs/tsconfig": "^7.0.0-rc.23",
|
|
38
38
|
"typescript": "^5.8.3"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
package/dist/types/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|