@xyo-network/wallet-model 2.63.0 → 2.63.2

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.
@@ -1,4 +1,5 @@
1
- import { AccountInstance } from '@xyo-network/account-model';
1
+ import type { HDNode } from '@ethersproject/hdnode';
2
+ import { AccountInstance, AccountStatic } from '@xyo-network/account-model';
2
3
  export interface Mnemonic {
3
4
  readonly locale: string;
4
5
  readonly path: string;
@@ -8,6 +9,7 @@ export interface WalletInstance extends AccountInstance {
8
9
  readonly address: string;
9
10
  readonly chainCode: string;
10
11
  readonly depth: number;
12
+ readonly derivePath: (path: string) => Promise<WalletInstance>;
11
13
  readonly extendedKey: string;
12
14
  readonly fingerprint: string;
13
15
  readonly index: number;
@@ -18,7 +20,8 @@ export interface WalletInstance extends AccountInstance {
18
20
  readonly privateKey: string;
19
21
  readonly publicKey: string;
20
22
  }
21
- export interface WalletStatic<T> {
23
+ export interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'new'> {
24
+ new (key: unknown, node: HDNode): T;
22
25
  fromExtendedKey(key: string): Promise<T>;
23
26
  fromMnemonic(mnemonic: string): Promise<T>;
24
27
  fromSeed(seed: string | Uint8Array): Promise<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"Wallet.d.ts","sourceRoot":"","sources":["../../src/Wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,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E,MAAM,CAAA;IACtB,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,cAAc,CAAA;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CAAE,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;IAC5G,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAA;IACnC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACxC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAChD"}
package/package.json CHANGED
@@ -11,9 +11,10 @@
11
11
  },
12
12
  "description": "Primary SDK for using XYO Protocol 2.0",
13
13
  "dependencies": {
14
- "@xyo-network/account-model": "^2.63.0"
14
+ "@xyo-network/account-model": "^2.63.2"
15
15
  },
16
16
  "devDependencies": {
17
+ "@ethersproject/hdnode": "^5.7.0",
17
18
  "@xylabs/ts-scripts-yarn3": "^2.17.17",
18
19
  "@xylabs/tsconfig": "^2.17.17",
19
20
  "typescript": "^5.1.3"
@@ -50,5 +51,5 @@
50
51
  },
51
52
  "sideEffects": false,
52
53
  "types": "dist/types/index.d.ts",
53
- "version": "2.63.0"
54
+ "version": "2.63.2"
54
55
  }
package/src/Wallet.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AccountInstance } from '@xyo-network/account-model'
1
+ import type { HDNode } from '@ethersproject/hdnode'
2
+ import { AccountInstance, AccountStatic } from '@xyo-network/account-model'
2
3
  export interface Mnemonic {
3
4
  readonly locale: string
4
5
  readonly path: string
@@ -9,6 +10,7 @@ export interface WalletInstance extends AccountInstance {
9
10
  readonly address: string
10
11
  readonly chainCode: string
11
12
  readonly depth: number
13
+ readonly derivePath: (path: string) => Promise<WalletInstance>
12
14
  readonly extendedKey: string
13
15
  readonly fingerprint: string
14
16
  readonly index: number
@@ -20,7 +22,8 @@ export interface WalletInstance extends AccountInstance {
20
22
  readonly publicKey: string
21
23
  }
22
24
 
23
- export interface WalletStatic<T> {
25
+ export interface WalletStatic<T extends WalletInstance = WalletInstance> extends Omit<AccountStatic<T>, 'new'> {
26
+ new (key: unknown, node: HDNode): T
24
27
  fromExtendedKey(key: string): Promise<T>
25
28
  fromMnemonic(mnemonic: string): Promise<T>
26
29
  fromSeed(seed: string | Uint8Array): Promise<T>