@midnight-ntwrk/wallet-sdk-hd 3.0.0-beta.7 → 3.0.0-beta.8
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/README.md +8 -4
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -2,30 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides support for Hierarchical Deterministic (HD) Wallet.
|
|
4
4
|
|
|
5
|
-
To allow deterministic derivation of keys for different features, Midnight follows algorithms and structure being a mix
|
|
5
|
+
To allow deterministic derivation of keys for different features, Midnight follows algorithms and structure being a mix
|
|
6
|
+
of [BIP-32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki),
|
|
7
|
+
[BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) and
|
|
8
|
+
[CIP-1852](https://github.com/cardano-foundation/CIPs/blob/master/CIP-1852/README.md). Specifically, derivation follows
|
|
9
|
+
BIP-32, and following path for a key pair is used:
|
|
6
10
|
|
|
7
11
|
```
|
|
8
12
|
m / purpose' / coin_type' / account' / role / index
|
|
9
13
|
```
|
|
10
14
|
|
|
11
15
|
Where:
|
|
16
|
+
|
|
12
17
|
- `purpose` is integer `44` (`0x8000002c`) - despite extensions, Night part of the hierarchy follows BIP-44
|
|
13
18
|
- `coin_type` is integer `2400` (`0x80000960`)
|
|
14
19
|
- `account` follows BIP-44 recommendations
|
|
15
20
|
- `role` follows table below
|
|
16
21
|
- `index` follows BIP-44 recommendations
|
|
17
22
|
|
|
18
|
-
|
|
19
23
|
| Role name | Value | Description |
|
|
20
|
-
|
|
24
|
+
| -------------------- | ----- | ------------------------------------------------------- |
|
|
21
25
|
| Night External chain | 0 | Night is Midnight's main token of value, Follows BIP-44 |
|
|
22
26
|
| Night Internal chain | 1 | as above |
|
|
23
27
|
| Dust | 2 | Dust is needed to pay fees on Midnight |
|
|
24
28
|
| Zswap | 3 | Zswap is a sub-protocol for shielded native tokens |
|
|
25
29
|
| Metadata | 4 | Keys for signing metadata |
|
|
26
30
|
|
|
27
|
-
|
|
28
31
|
## How to derive the keys?
|
|
32
|
+
|
|
29
33
|
Below you can find an example on how to derive keys from a random seed:
|
|
30
34
|
|
|
31
35
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/wallet-sdk-hd",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
"@ethereumjs/wallet": "^3.0.0-alpha.1",
|
|
33
33
|
"eslint": "^9.37.0",
|
|
34
34
|
"fast-check": "^4.2.0",
|
|
35
|
+
"prettier": "^3.7.0",
|
|
35
36
|
"publint": "~0.3.14",
|
|
36
37
|
"rimraf": "^6.0.1",
|
|
37
38
|
"typescript": "^5.9.3",
|
|
38
|
-
"vitest": "^
|
|
39
|
+
"vitest": "^4.0.16"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"typecheck": "tsc -b ./tsconfig.json --noEmit",
|
|
42
43
|
"test": "vitest run",
|
|
43
44
|
"lint": "eslint --max-warnings 0",
|
|
44
|
-
"format": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
|
|
45
|
-
"format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml}\"",
|
|
45
|
+
"format": "prettier --write \"**/*.{ts,js,json,yaml,yml,md}\"",
|
|
46
|
+
"format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml,md}\"",
|
|
46
47
|
"dist": "tsc -b ./tsconfig.build.json",
|
|
47
48
|
"dist:publish": "tsc -b ./tsconfig.publish.json",
|
|
48
49
|
"clean": "rimraf --glob dist 'tsconfig.*.tsbuildinfo' && date +%s > .clean-timestamp",
|