@midnight-ntwrk/wallet-sdk-address-format 2.0.0 → 3.0.0-beta.7

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 CHANGED
@@ -1,14 +1,23 @@
1
- import { NetworkId, EncryptionSecretKey } from '@midnight-ntwrk/zswap';
1
+ import { DustPublicKey, EncryptionSecretKey, UserAddress } from '@midnight-ntwrk/ledger-v6';
2
2
  export type FormatContext = {
3
3
  networkId: string | null;
4
4
  };
5
+ export type Field = {
6
+ bytes: number;
7
+ modulus: bigint;
8
+ };
9
+ export declare const BLSScalar: Field;
10
+ export declare const ScaleBigInt: {
11
+ encode: (data: bigint) => Buffer;
12
+ decode: (repr: Uint8Array) => bigint;
13
+ };
5
14
  export declare class MidnightBech32m {
6
- readonly type: string;
7
- readonly network: string | null;
8
- readonly data: Buffer;
9
15
  static readonly prefix = "mn";
10
16
  static validateSegment(segmentName: string, segment: string): void;
11
17
  static parse(bech32string: string): MidnightBech32m;
18
+ readonly type: string;
19
+ readonly network: string | null;
20
+ readonly data: Buffer;
12
21
  constructor(type: string, network: string | null, data: Buffer);
13
22
  asString(): string;
14
23
  }
@@ -17,34 +26,54 @@ export declare class Bech32mCodec<T> {
17
26
  readonly dataToBytes: (data: T) => Buffer;
18
27
  readonly dataFromBytes: (bytes: Buffer) => T;
19
28
  constructor(type: string, dataToBytes: (data: T) => Buffer, dataFromBytes: (bytes: Buffer) => T);
20
- encode(networkId: NetworkId, data: T): MidnightBech32m;
21
- decode(networkId: NetworkId | string | null, repr: MidnightBech32m): T;
22
- static createContext(networkId: NetworkId | string | null): FormatContext;
23
- static createContextFromZswap(networkId: NetworkId): FormatContext;
29
+ encode(networkId: string | null, data: T): MidnightBech32m;
30
+ decode(networkId: string | null, repr: MidnightBech32m): T;
31
+ static createContext(networkId: string | null): FormatContext;
24
32
  }
25
33
  export declare class ShieldedAddress {
34
+ static readonly codec: Bech32mCodec<ShieldedAddress>;
26
35
  readonly coinPublicKey: ShieldedCoinPublicKey;
27
36
  readonly encryptionPublicKey: ShieldedEncryptionPublicKey;
28
- static codec: Bech32mCodec<ShieldedAddress>;
29
37
  constructor(coinPublicKey: ShieldedCoinPublicKey, encryptionPublicKey: ShieldedEncryptionPublicKey);
30
38
  coinPublicKeyString(): string;
31
39
  encryptionPublicKeyString(): string;
32
40
  }
33
41
  export declare class ShieldedEncryptionSecretKey {
42
+ static readonly codec: Bech32mCodec<ShieldedEncryptionSecretKey>;
34
43
  readonly zswap: EncryptionSecretKey;
35
- static codec: Bech32mCodec<ShieldedEncryptionSecretKey>;
36
44
  constructor(zswap: EncryptionSecretKey);
37
45
  }
38
46
  export declare class ShieldedCoinPublicKey {
47
+ static readonly keyLength = 32;
48
+ static readonly codec: Bech32mCodec<ShieldedCoinPublicKey>;
49
+ static fromHexString(hexString: string): ShieldedCoinPublicKey;
39
50
  readonly data: Buffer;
40
- static readonly key_length = 32;
41
- static codec: Bech32mCodec<ShieldedCoinPublicKey>;
42
51
  constructor(data: Buffer);
52
+ toHexString(): string;
53
+ equals(other: string): boolean;
54
+ equals(other: ShieldedCoinPublicKey): boolean;
43
55
  }
44
56
  export declare class ShieldedEncryptionPublicKey {
57
+ static readonly keyLength = 32;
58
+ static readonly codec: Bech32mCodec<ShieldedEncryptionPublicKey>;
59
+ static fromHexString(hexString: string): ShieldedEncryptionPublicKey;
60
+ readonly data: Buffer;
61
+ constructor(data: Buffer);
62
+ toHexString(): string;
63
+ equals(other: string): boolean;
64
+ equals(other: ShieldedEncryptionPublicKey): boolean;
65
+ }
66
+ export declare class UnshieldedAddress {
45
67
  readonly data: Buffer;
46
- static readonly key_length = 32;
47
- static codec: Bech32mCodec<ShieldedEncryptionPublicKey>;
68
+ static readonly keyLength = 32;
69
+ static readonly codec: Bech32mCodec<UnshieldedAddress>;
48
70
  constructor(data: Buffer);
71
+ get hexString(): UserAddress;
72
+ }
73
+ export declare class DustAddress {
74
+ readonly data: bigint;
75
+ static readonly codec: Bech32mCodec<DustAddress>;
76
+ static readonly encodePublicKey: (networkId: string, publicKey: DustPublicKey) => string;
77
+ constructor(data: bigint);
78
+ serialize(): Buffer;
49
79
  }
50
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,10 +1,24 @@
1
- import { NetworkId, EncryptionSecretKey } from '@midnight-ntwrk/zswap';
1
+ import { EncryptionSecretKey } from '@midnight-ntwrk/ledger-v6';
2
2
  import { bech32m } from '@scure/base';
3
-
4
- class MidnightBech32m {
5
- type;
6
- network;
7
- data;
3
+ import * as subsquidScale from '@subsquid/scale-codec';
4
+ export const BLSScalar = {
5
+ bytes: 32,
6
+ modulus: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001'),
7
+ };
8
+ export const ScaleBigInt = {
9
+ encode: (data) => {
10
+ const sink = new subsquidScale.ByteSink();
11
+ sink.compact(data);
12
+ return Buffer.from(sink.toBytes());
13
+ },
14
+ decode: (repr) => {
15
+ const src = new subsquidScale.Src(repr);
16
+ const res = src.compact();
17
+ src.assertEOF();
18
+ return BigInt(res);
19
+ },
20
+ };
21
+ export class MidnightBech32m {
8
22
  static prefix = 'mn';
9
23
  static validateSegment(segmentName, segment) {
10
24
  const result = /^[A-Za-z1-9-]+$/.test(segment);
@@ -24,10 +38,13 @@ class MidnightBech32m {
24
38
  }
25
39
  return new MidnightBech32m(type, network, Buffer.from(bech32parsed.bytes));
26
40
  }
41
+ type;
42
+ network;
43
+ data;
27
44
  constructor(type, network, data) {
28
- this.type = type;
29
- this.network = network;
30
45
  this.data = data;
46
+ this.network = network;
47
+ this.type = type;
31
48
  MidnightBech32m.validateSegment('type', type);
32
49
  if (network != null) {
33
50
  MidnightBech32m.validateSegment('network', network);
@@ -38,14 +55,14 @@ class MidnightBech32m {
38
55
  return bech32m.encode(`${MidnightBech32m.prefix}_${this.type}${networkSegment}`, bech32m.toWords(this.data), false);
39
56
  }
40
57
  }
41
- class Bech32mCodec {
58
+ export class Bech32mCodec {
42
59
  type;
43
60
  dataToBytes;
44
61
  dataFromBytes;
45
62
  constructor(type, dataToBytes, dataFromBytes) {
46
- this.type = type;
47
- this.dataToBytes = dataToBytes;
48
63
  this.dataFromBytes = dataFromBytes;
64
+ this.dataToBytes = dataToBytes;
65
+ this.type = type;
49
66
  }
50
67
  encode(networkId, data) {
51
68
  const context = Bech32mCodec.createContext(networkId);
@@ -65,39 +82,20 @@ class Bech32mCodec {
65
82
  if (networkId === null) {
66
83
  return { networkId: null };
67
84
  }
68
- else if (typeof networkId === 'string') {
69
- return { networkId };
70
- }
71
- else {
72
- return Bech32mCodec.createContextFromZswap(networkId);
73
- }
74
- }
75
- static createContextFromZswap(networkId) {
76
- switch (networkId) {
77
- case NetworkId.DevNet:
78
- return { networkId: 'dev' };
79
- case NetworkId.MainNet:
80
- return { networkId: null };
81
- case NetworkId.TestNet:
82
- return { networkId: 'test' };
83
- case NetworkId.Undeployed:
84
- return { networkId: 'undeployed' };
85
- default:
86
- return { networkId: null };
87
- }
85
+ return { networkId };
88
86
  }
89
87
  }
90
- class ShieldedAddress {
91
- coinPublicKey;
92
- encryptionPublicKey;
88
+ export class ShieldedAddress {
93
89
  static codec = new Bech32mCodec('shield-addr', (addr) => Buffer.concat([addr.coinPublicKey.data, addr.encryptionPublicKey.data]), (bytes) => {
94
- const coinPublicKey = new ShieldedCoinPublicKey(bytes.subarray(0, ShieldedCoinPublicKey.key_length));
95
- const encryptionPublicKey = new ShieldedEncryptionPublicKey(bytes.subarray(ShieldedCoinPublicKey.key_length));
90
+ const coinPublicKey = new ShieldedCoinPublicKey(bytes.subarray(0, ShieldedCoinPublicKey.keyLength));
91
+ const encryptionPublicKey = new ShieldedEncryptionPublicKey(bytes.subarray(ShieldedCoinPublicKey.keyLength));
96
92
  return new ShieldedAddress(coinPublicKey, encryptionPublicKey);
97
93
  });
94
+ coinPublicKey;
95
+ encryptionPublicKey;
98
96
  constructor(coinPublicKey, encryptionPublicKey) {
99
- this.coinPublicKey = coinPublicKey;
100
97
  this.encryptionPublicKey = encryptionPublicKey;
98
+ this.coinPublicKey = coinPublicKey;
101
99
  }
102
100
  coinPublicKeyString() {
103
101
  return this.coinPublicKey.data.toString('hex');
@@ -106,34 +104,81 @@ class ShieldedAddress {
106
104
  return this.encryptionPublicKey.data.toString('hex');
107
105
  }
108
106
  }
109
- class ShieldedEncryptionSecretKey {
110
- zswap;
111
- static codec = new Bech32mCodec('shield-esk', (esk) => Buffer.from(esk.zswap.yesIKnowTheSecurityImplicationsOfThis_serialize(NetworkId.Undeployed).subarray(1)), (repr) => new ShieldedEncryptionSecretKey(EncryptionSecretKey.deserialize(Buffer.concat([Buffer.of(0), repr]), NetworkId.Undeployed)));
107
+ export class ShieldedEncryptionSecretKey {
108
+ static codec = new Bech32mCodec('shield-esk', (esk) => Buffer.from(esk.zswap.yesIKnowTheSecurityImplicationsOfThis_serialize()), (repr) => new ShieldedEncryptionSecretKey(EncryptionSecretKey.deserialize(repr)));
112
109
  // There are some bits in serialization of field elements and elliptic curve points, that are hard to replicate
113
110
  // Thus using zswap implementation directly for serialization purposes
111
+ zswap;
114
112
  constructor(zswap) {
115
113
  this.zswap = zswap;
116
114
  }
117
115
  }
118
- class ShieldedCoinPublicKey {
119
- data;
120
- static key_length = 32;
116
+ export class ShieldedCoinPublicKey {
117
+ static keyLength = 32;
121
118
  static codec = new Bech32mCodec('shield-cpk', (cpk) => cpk.data, (repr) => new ShieldedCoinPublicKey(repr));
119
+ static fromHexString(hexString) {
120
+ return new ShieldedCoinPublicKey(Buffer.from(hexString, 'hex'));
121
+ }
122
+ data;
122
123
  constructor(data) {
123
124
  this.data = data;
124
- if (data.length != ShieldedCoinPublicKey.key_length) {
125
+ if (data.length != ShieldedCoinPublicKey.keyLength) {
125
126
  throw new Error('Coin public key needs to be 32 bytes long');
126
127
  }
127
128
  }
129
+ toHexString() {
130
+ return this.data.toString('hex');
131
+ }
132
+ equals(other) {
133
+ const otherKey = typeof other === 'string' ? ShieldedCoinPublicKey.fromHexString(other) : other;
134
+ return otherKey.data.equals(this.data);
135
+ }
128
136
  }
129
- class ShieldedEncryptionPublicKey {
130
- data;
131
- static key_length = 32;
137
+ export class ShieldedEncryptionPublicKey {
138
+ static keyLength = 32;
132
139
  static codec = new Bech32mCodec('shield-epk', (cpk) => cpk.data, (repr) => new ShieldedEncryptionPublicKey(repr));
140
+ static fromHexString(hexString) {
141
+ return new ShieldedEncryptionPublicKey(Buffer.from(hexString, 'hex'));
142
+ }
143
+ data;
133
144
  constructor(data) {
134
145
  this.data = data;
135
146
  }
147
+ toHexString() {
148
+ return this.data.toString('hex');
149
+ }
150
+ equals(other) {
151
+ const otherKey = typeof other === 'string' ? ShieldedEncryptionPublicKey.fromHexString(other) : other;
152
+ return otherKey.data.equals(this.data);
153
+ }
154
+ }
155
+ export class UnshieldedAddress {
156
+ data;
157
+ static keyLength = 32;
158
+ static codec = new Bech32mCodec('addr', (addr) => addr.data, (repr) => new UnshieldedAddress(repr));
159
+ constructor(data) {
160
+ if (data.length != UnshieldedAddress.keyLength) {
161
+ throw new Error('Unshielded address needs to be 32 bytes long');
162
+ }
163
+ this.data = data;
164
+ }
165
+ get hexString() {
166
+ return this.data.toString('hex');
167
+ }
168
+ }
169
+ export class DustAddress {
170
+ data;
171
+ static codec = new Bech32mCodec('dust', (daddr) => daddr.serialize(), (repr) => new DustAddress(ScaleBigInt.decode(repr)));
172
+ static encodePublicKey = (networkId, publicKey) => {
173
+ return DustAddress.codec.encode(networkId, new DustAddress(publicKey)).asString();
174
+ };
175
+ constructor(data) {
176
+ if (data >= BLSScalar.modulus) {
177
+ throw new Error('Dust address is too large');
178
+ }
179
+ this.data = data;
180
+ }
181
+ serialize() {
182
+ return ScaleBigInt.encode(this.data);
183
+ }
136
184
  }
137
-
138
- export { Bech32mCodec, MidnightBech32m, ShieldedAddress, ShieldedCoinPublicKey, ShieldedEncryptionPublicKey, ShieldedEncryptionSecretKey };
139
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,41 +1,49 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/wallet-sdk-address-format",
3
- "version": "2.0.0",
3
+ "version": "3.0.0-beta.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
7
8
  "author": "IOHK",
8
9
  "license": "Apache-2.0",
9
10
  "publishConfig": {
10
11
  "registry": "https://npm.pkg.github.com/"
11
12
  },
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/midnight-ntwrk/artifacts.git"
15
- },
16
13
  "files": [
17
14
  "dist/"
18
15
  ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/midnight-ntwrk/artifacts.git"
19
+ },
19
20
  "exports": {
20
21
  ".": {
21
- "import": "./dist/index.js",
22
- "types": "./dist/index.d.ts"
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
23
24
  }
24
25
  },
25
26
  "dependencies": {
26
- "@scure/base": "^1.1.9"
27
+ "@midnight-ntwrk/ledger-v6": "6.1.0-alpha.5",
28
+ "@scure/base": "^1.2.6",
29
+ "@subsquid/scale-codec": "^4.0.1"
27
30
  },
28
31
  "devDependencies": {
29
- "@midnight-ntwrk/zswap": "4.0.0",
30
- "@types/node": "22.10.5"
31
- },
32
- "peerDependencies": {
33
- "@midnight-ntwrk/zswap": "4.0.0"
32
+ "@types/node": "22.17.0",
33
+ "eslint": "^9.37.0",
34
+ "publint": "~0.3.14",
35
+ "rimraf": "^6.0.1",
36
+ "typescript": "^5.9.3",
37
+ "vitest": "^3.2.4"
34
38
  },
35
39
  "scripts": {
36
40
  "typecheck": "tsc -b ./tsconfig.json --noEmit",
37
- "test": "NODE_OPTIONS='--experimental-vm-modules' jest",
38
- "lint": "eslint",
39
- "dist:prebuild": "rollup -c ./rollup.config.mjs"
41
+ "test": "vitest run",
42
+ "lint": "eslint --max-warnings 0",
43
+ "format": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
44
+ "dist": "tsc -b ./tsconfig.build.json",
45
+ "dist:publish": "tsc -b ./tsconfig.publish.json",
46
+ "clean": "rimraf --glob dist 'tsconfig.*.tsbuildinfo' && date +%s > .clean-timestamp",
47
+ "publint": "publint --strict"
40
48
  }
41
- }
49
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,qBAAa,eAAe;aA2BR,IAAI,EAAE,MAAM;aACZ,OAAO,EAAE,MAAM,GAAG,IAAI;aACtB,IAAI,EAAE,MAAM;IA5B9B,gBAAuB,MAAM,QAAQ;IAErC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IASlE,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe;gBAejC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE,MAAM;IAQ9B,QAAQ,IAAI,MAAM;CAInB;AAED,qBAAa,YAAY,CAAC,CAAC;aAEP,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM;aAChC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC;gBAFnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAChC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC;IAGrD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe;IAKtD,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,G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