@sig-net/midnight 0.0.6 → 0.0.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.
Files changed (57) hide show
  1. package/README.md +23 -20
  2. package/dist/constants.d.ts +4 -16
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +4 -16
  5. package/dist/constants.js.map +1 -1
  6. package/dist/ecdsa-attestation.d.ts +79 -0
  7. package/dist/ecdsa-attestation.d.ts.map +1 -0
  8. package/dist/ecdsa-attestation.js +140 -0
  9. package/dist/ecdsa-attestation.js.map +1 -0
  10. package/dist/epsilon-derivation.d.ts +60 -0
  11. package/dist/epsilon-derivation.d.ts.map +1 -1
  12. package/dist/epsilon-derivation.js +106 -5
  13. package/dist/epsilon-derivation.js.map +1 -1
  14. package/dist/index.d.ts +9 -7
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +9 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/managed/compiler/contract-info.json +74 -52
  19. package/dist/managed/compiler/contract-manifest.json +8 -8
  20. package/dist/managed/contract/index.d.ts +38 -31
  21. package/dist/managed/contract/index.js +232 -382
  22. package/dist/managed/contract/index.js.map +1 -1
  23. package/dist/signature-requests-state-reader.d.ts +14 -13
  24. package/dist/signature-requests-state-reader.d.ts.map +1 -1
  25. package/dist/signature-requests-state-reader.js +31 -20
  26. package/dist/signature-requests-state-reader.js.map +1 -1
  27. package/dist/signature-response-verification.d.ts +5 -5
  28. package/dist/signature-response-verification.d.ts.map +1 -1
  29. package/dist/signature-response-verification.js +4 -4
  30. package/dist/signature-response-verification.js.map +1 -1
  31. package/dist/signet-contract-state-reader.d.ts +101 -112
  32. package/dist/signet-contract-state-reader.d.ts.map +1 -1
  33. package/dist/signet-contract-state-reader.js +123 -115
  34. package/dist/signet-contract-state-reader.js.map +1 -1
  35. package/dist/signet-request-feed.d.ts +4 -3
  36. package/dist/signet-request-feed.d.ts.map +1 -1
  37. package/dist/signet-request-feed.js +9 -8
  38. package/dist/signet-request-feed.js.map +1 -1
  39. package/dist/signet-request-resolver.d.ts +6 -4
  40. package/dist/signet-request-resolver.d.ts.map +1 -1
  41. package/dist/signet-request-resolver.js +8 -6
  42. package/dist/signet-request-resolver.js.map +1 -1
  43. package/dist/signet-request-response-reader.d.ts +21 -20
  44. package/dist/signet-request-response-reader.d.ts.map +1 -1
  45. package/dist/signet-request-response-reader.js +35 -23
  46. package/dist/signet-request-response-reader.js.map +1 -1
  47. package/dist/signet-requests.d.ts +93 -59
  48. package/dist/signet-requests.d.ts.map +1 -1
  49. package/dist/signet-requests.js +84 -67
  50. package/dist/signet-requests.js.map +1 -1
  51. package/package.json +2 -2
  52. package/src/Signet.compact +277 -425
  53. package/src/circuits.compact +22 -21
  54. package/dist/ecdsa.d.ts +0 -114
  55. package/dist/ecdsa.d.ts.map +0 -1
  56. package/dist/ecdsa.js +0 -145
  57. package/dist/ecdsa.js.map +0 -1
@@ -1,84 +1,115 @@
1
1
  import * as __compactRuntime from '@midnight-ntwrk/compact-runtime';
2
2
  __compactRuntime.checkRuntimeVersion('0.18.0-rc.1');
3
3
 
4
- const _descriptor_0 = new __compactRuntime.CompactTypeBytes(32);
4
+ const _descriptor_0 = __compactRuntime.CompactTypeSecp256k1Point;
5
5
 
6
- const _descriptor_1 = new __compactRuntime.CompactTypeBytes(256);
6
+ const _descriptor_1 = new __compactRuntime.CompactTypeBytes(32);
7
7
 
8
- const _descriptor_2 = new __compactRuntime.CompactTypeUnsignedInteger(255n, 1);
8
+ const _descriptor_2 = new __compactRuntime.CompactTypeBytes(128);
9
9
 
10
- const _descriptor_3 = new __compactRuntime.CompactTypeBytes(64);
10
+ const _descriptor_3 = new __compactRuntime.CompactTypeUnsignedInteger(255n, 1);
11
11
 
12
- const _descriptor_4 = new __compactRuntime.CompactTypeBytes(20);
12
+ class _RespondBidirectionalEvent_0 {
13
+ alignment() {
14
+ return _descriptor_2.alignment().concat(_descriptor_3.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_3.alignment()))));
15
+ }
16
+ fromValue(value_0) {
17
+ return {
18
+ serializedOutput: _descriptor_2.fromValue(value_0),
19
+ outputLen: _descriptor_3.fromValue(value_0),
20
+ r: _descriptor_1.fromValue(value_0),
21
+ s: _descriptor_1.fromValue(value_0),
22
+ recoveryId: _descriptor_3.fromValue(value_0)
23
+ }
24
+ }
25
+ toValue(value_0) {
26
+ return _descriptor_2.toValue(value_0.serializedOutput).concat(_descriptor_3.toValue(value_0.outputLen).concat(_descriptor_1.toValue(value_0.r).concat(_descriptor_1.toValue(value_0.s).concat(_descriptor_3.toValue(value_0.recoveryId)))));
27
+ }
28
+ }
13
29
 
14
- const _descriptor_5 = __compactRuntime.CompactTypeField;
30
+ const _descriptor_4 = new _RespondBidirectionalEvent_0();
15
31
 
16
- const _descriptor_6 = new __compactRuntime.CompactTypeBytes(128);
32
+ const _descriptor_5 = __compactRuntime.CompactTypeBoolean;
17
33
 
18
- const _descriptor_7 = new __compactRuntime.CompactTypeVector(3, _descriptor_0);
34
+ const _descriptor_6 = __compactRuntime.CompactTypeSecp256k1Scalar;
19
35
 
20
36
  class _ContractAddress_0 {
21
37
  alignment() {
22
- return _descriptor_0.alignment();
38
+ return _descriptor_1.alignment();
23
39
  }
24
40
  fromValue(value_0) {
25
41
  return {
26
- bytes: _descriptor_0.fromValue(value_0)
42
+ bytes: _descriptor_1.fromValue(value_0)
27
43
  }
28
44
  }
29
45
  toValue(value_0) {
30
- return _descriptor_0.toValue(value_0.bytes);
46
+ return _descriptor_1.toValue(value_0.bytes);
31
47
  }
32
48
  }
33
49
 
34
- const _descriptor_8 = new _ContractAddress_0();
50
+ const _descriptor_7 = new _ContractAddress_0();
35
51
 
36
- const _descriptor_9 = new __compactRuntime.CompactTypeBytes(65);
37
-
38
- class _SignBidirectionalNotification_0 {
52
+ class _SignBidirectionalEventNotification_0 {
39
53
  alignment() {
40
- return _descriptor_2.alignment().concat(_descriptor_9.alignment());
54
+ return _descriptor_3.alignment().concat(_descriptor_2.alignment());
41
55
  }
42
56
  fromValue(value_0) {
43
57
  return {
44
- version: _descriptor_2.fromValue(value_0),
45
- payload: _descriptor_9.fromValue(value_0)
58
+ version: _descriptor_3.fromValue(value_0),
59
+ payload: _descriptor_2.fromValue(value_0)
46
60
  }
47
61
  }
48
62
  toValue(value_0) {
49
- return _descriptor_2.toValue(value_0.version).concat(_descriptor_9.toValue(value_0.payload));
63
+ return _descriptor_3.toValue(value_0.version).concat(_descriptor_2.toValue(value_0.payload));
50
64
  }
51
65
  }
52
66
 
53
- const _descriptor_10 = new _SignBidirectionalNotification_0();
67
+ const _descriptor_8 = new _SignBidirectionalEventNotification_0();
54
68
 
55
- const _descriptor_11 = new __compactRuntime.CompactTypeVector(2, _descriptor_0);
69
+ const _descriptor_9 = __compactRuntime.CompactTypeSecp256k1Base;
56
70
 
57
- const _descriptor_12 = new __compactRuntime.CompactTypeUnsignedInteger(18446744073709551615n, 8);
71
+ const _descriptor_10 = new __compactRuntime.CompactTypeVector(2, _descriptor_1);
58
72
 
59
- const _descriptor_13 = __compactRuntime.CompactTypeBoolean;
73
+ class _Secp256k1EcdsaSignature_0 {
74
+ alignment() {
75
+ return _descriptor_6.alignment().concat(_descriptor_6.alignment());
76
+ }
77
+ fromValue(value_0) {
78
+ return {
79
+ r: _descriptor_6.fromValue(value_0),
80
+ s: _descriptor_6.fromValue(value_0)
81
+ }
82
+ }
83
+ toValue(value_0) {
84
+ return _descriptor_6.toValue(value_0.r).concat(_descriptor_6.toValue(value_0.s));
85
+ }
86
+ }
87
+
88
+ const _descriptor_11 = new _Secp256k1EcdsaSignature_0();
89
+
90
+ const _descriptor_12 = new __compactRuntime.CompactTypeUnsignedInteger(18446744073709551615n, 8);
60
91
 
61
92
  class _Either_0 {
62
93
  alignment() {
63
- return _descriptor_13.alignment().concat(_descriptor_0.alignment().concat(_descriptor_0.alignment()));
94
+ return _descriptor_5.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment()));
64
95
  }
65
96
  fromValue(value_0) {
66
97
  return {
67
- is_left: _descriptor_13.fromValue(value_0),
68
- left: _descriptor_0.fromValue(value_0),
69
- right: _descriptor_0.fromValue(value_0)
98
+ is_left: _descriptor_5.fromValue(value_0),
99
+ left: _descriptor_1.fromValue(value_0),
100
+ right: _descriptor_1.fromValue(value_0)
70
101
  }
71
102
  }
72
103
  toValue(value_0) {
73
- return _descriptor_13.toValue(value_0.is_left).concat(_descriptor_0.toValue(value_0.left).concat(_descriptor_0.toValue(value_0.right)));
104
+ return _descriptor_5.toValue(value_0.is_left).concat(_descriptor_1.toValue(value_0.left).concat(_descriptor_1.toValue(value_0.right)));
74
105
  }
75
106
  }
76
107
 
77
- const _descriptor_14 = new _Either_0();
108
+ const _descriptor_13 = new _Either_0();
78
109
 
79
- const _descriptor_15 = new __compactRuntime.CompactTypeUnsignedInteger(340282366920938463463374607431768211455n, 16);
110
+ const _descriptor_14 = new __compactRuntime.CompactTypeUnsignedInteger(340282366920938463463374607431768211455n, 16);
80
111
 
81
- const _descriptor_16 = new __compactRuntime.CompactTypeUnsignedInteger(4294967295n, 4);
112
+ const _descriptor_15 = new __compactRuntime.CompactTypeUnsignedInteger(4294967295n, 4);
82
113
 
83
114
  export class Contract {
84
115
  witnesses;
@@ -92,20 +123,17 @@ export class Contract {
92
123
  }
93
124
  this.witnesses = witnesses_0;
94
125
  this.circuits = {
95
- async constructSignBidirectionalNotificationV1(context, ...args_1) {
96
- return { result: pureCircuits.constructSignBidirectionalNotificationV1(...args_1), context };
126
+ async constructSignBidirectionalEventNotificationV1(context, ...args_1) {
127
+ return { result: pureCircuits.constructSignBidirectionalEventNotificationV1(...args_1), context };
97
128
  },
98
- async evmAddressAbiValue(context, ...args_1) {
99
- return { result: pureCircuits.evmAddressAbiValue(...args_1), context };
129
+ async signetAttestationDigest(context, ...args_1) {
130
+ return { result: pureCircuits.signetAttestationDigest(...args_1), context };
100
131
  },
101
- async signetAttestationMessage(context, ...args_1) {
102
- return { result: pureCircuits.signetAttestationMessage(...args_1), context };
132
+ async verifyRespondBidirectionalEvent(context, ...args_1) {
133
+ return { result: pureCircuits.verifyRespondBidirectionalEvent(...args_1), context };
103
134
  },
104
- async assertHexOf(context, ...args_1) {
105
- return { result: pureCircuits.assertHexOf(...args_1), context };
106
- },
107
- async assertPathCommitment(context, ...args_1) {
108
- return { result: pureCircuits.assertPathCommitment(...args_1), context };
135
+ async signetKeyHash(context, ...args_1) {
136
+ return { result: pureCircuits.signetKeyHash(...args_1), context };
109
137
  }
110
138
  };
111
139
  this.impureCircuits = {};
@@ -142,285 +170,142 @@ export class Contract {
142
170
  currentZswapLocalState: context.callContext.currentZswapLocalState
143
171
  }
144
172
  }
173
+ _hashToSecp256k1Scalar_0(digest_0) {
174
+ const v_0 = Array.from(digest_0, BigInt);
175
+ const beReversed_0 = Uint8Array.from([v_0[31],
176
+ v_0[30],
177
+ v_0[29],
178
+ v_0[28],
179
+ v_0[27],
180
+ v_0[26],
181
+ v_0[25],
182
+ v_0[24],
183
+ v_0[23],
184
+ v_0[22],
185
+ v_0[21],
186
+ v_0[20],
187
+ v_0[19],
188
+ v_0[18],
189
+ v_0[17],
190
+ v_0[16],
191
+ v_0[15],
192
+ v_0[14],
193
+ v_0[13],
194
+ v_0[12],
195
+ v_0[11],
196
+ v_0[10],
197
+ v_0[9],
198
+ v_0[8],
199
+ v_0[7],
200
+ v_0[6],
201
+ v_0[5],
202
+ v_0[4],
203
+ v_0[3],
204
+ v_0[2],
205
+ v_0[1],
206
+ v_0[0]],
207
+ Number);
208
+ return __compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
209
+ 32,
210
+ beReversed_0,
211
+ 'Secp256k1Scalar',
212
+ '<standard library>');
213
+ }
214
+ _secp256k1EcdsaVerify_0(msgHash_0, sig_0, pk_0) {
215
+ const z_0 = this._hashToSecp256k1Scalar_0(msgHash_0);
216
+ const __compact_pattern_tmp1_0 = sig_0;
217
+ const r_0 = __compact_pattern_tmp1_0.r;
218
+ const s_0 = __compact_pattern_tmp1_0.s;
219
+ const w_0 = this._inv_0(s_0);
220
+ const u1_0 = this._mul_0(z_0, w_0);
221
+ const u2_0 = this._mul_0(r_0, w_0);
222
+ const point_0 = this._ecAdd_0(this._ecMulGenerator_0(u1_0),
223
+ this._ecMul_0(pk_0, u2_0));
224
+ return __compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
225
+ 32,
226
+ __compactRuntime.convertBigintToBytes(32,
227
+ this._secp256k1PointX_0(point_0),
228
+ '<standard library>'),
229
+ 'Secp256k1Scalar',
230
+ '<standard library>')
231
+ ===
232
+ r_0;
233
+ }
145
234
  _persistentHash_0(value_0) {
146
- const result_0 = __compactRuntime.persistentHash(_descriptor_11, value_0);
235
+ const result_0 = __compactRuntime.persistentHash(_descriptor_10, value_0);
147
236
  return result_0;
148
237
  }
149
238
  _persistentHash_1(value_0) {
150
- const result_0 = __compactRuntime.persistentHash(_descriptor_6, value_0);
239
+ const result_0 = __compactRuntime.persistentHash(_descriptor_2, value_0);
151
240
  return result_0;
152
241
  }
153
242
  _persistentHash_2(value_0) {
154
- const result_0 = __compactRuntime.persistentHash(_descriptor_7, value_0);
243
+ const result_0 = __compactRuntime.persistentHash(_descriptor_0, value_0);
244
+ return result_0;
245
+ }
246
+ _mul_0(x_0, y_0) {
247
+ const result_0 = __compactRuntime.secp256k1ScalarMul(x_0, y_0);
248
+ return result_0;
249
+ }
250
+ _inv_0(s_0) {
251
+ const result_0 = __compactRuntime.secp256k1ScalarInv(s_0);
252
+ return result_0;
253
+ }
254
+ _secp256k1PointX_0(pt_0) {
255
+ const result_0 = __compactRuntime.secp256k1PointX(pt_0);
256
+ return result_0;
257
+ }
258
+ _ecAdd_0(a_0, b_0) {
259
+ const result_0 = __compactRuntime.secp256k1Add(a_0, b_0);
260
+ return result_0;
261
+ }
262
+ _ecMul_0(a_0, b_0) {
263
+ const result_0 = __compactRuntime.secp256k1Mul(a_0, b_0);
264
+ return result_0;
265
+ }
266
+ _ecMulGenerator_0(b_0) {
267
+ const result_0 = __compactRuntime.secp256k1MulGenerator(b_0);
155
268
  return result_0;
156
269
  }
157
- _constructSignBidirectionalNotificationV1_0(callerAddress_0,
158
- requestId_0,
159
- requestsIndexField_0)
270
+ _constructSignBidirectionalEventNotificationV1_0(callerAddress_0,
271
+ requestsIndexField_0)
160
272
  {
161
273
  return { version: 1n,
162
274
  payload:
163
275
  Uint8Array.from([...Array.from(callerAddress_0.bytes, BigInt),
164
- ...Array.from(requestId_0, BigInt),
165
- requestsIndexField_0],
276
+ requestsIndexField_0,
277
+ ...Array.from(new Uint8Array(95), BigInt)],
166
278
  Number) };
167
279
  }
168
- _evmAddressAbiValue_0(addr_0) {
169
- const a0_0 = __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
170
- 1,
171
- ((e, i) => e.slice(i, i+1))(addr_0,
172
- Number(0n)),
173
- 'Field',
174
- 'Signet.compact line 235 char 17');
175
- const a1_0 = __compactRuntime.addField(__compactRuntime.mulField(a0_0, 256n),
176
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
177
- 1,
178
- ((e, i) => e.slice(i, i+1))(addr_0,
179
- Number(1n)),
180
- 'Field',
181
- 'Signet.compact line 236 char 30'));
182
- const a2_0 = __compactRuntime.addField(__compactRuntime.mulField(a1_0, 256n),
183
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
184
- 1,
185
- ((e, i) => e.slice(i, i+1))(addr_0,
186
- Number(2n)),
187
- 'Field',
188
- 'Signet.compact line 237 char 30'));
189
- const a3_0 = __compactRuntime.addField(__compactRuntime.mulField(a2_0, 256n),
190
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
191
- 1,
192
- ((e, i) => e.slice(i, i+1))(addr_0,
193
- Number(3n)),
194
- 'Field',
195
- 'Signet.compact line 238 char 30'));
196
- const a4_0 = __compactRuntime.addField(__compactRuntime.mulField(a3_0, 256n),
197
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
198
- 1,
199
- ((e, i) => e.slice(i, i+1))(addr_0,
200
- Number(4n)),
201
- 'Field',
202
- 'Signet.compact line 239 char 30'));
203
- const a5_0 = __compactRuntime.addField(__compactRuntime.mulField(a4_0, 256n),
204
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
205
- 1,
206
- ((e, i) => e.slice(i, i+1))(addr_0,
207
- Number(5n)),
208
- 'Field',
209
- 'Signet.compact line 240 char 30'));
210
- const a6_0 = __compactRuntime.addField(__compactRuntime.mulField(a5_0, 256n),
211
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
212
- 1,
213
- ((e, i) => e.slice(i, i+1))(addr_0,
214
- Number(6n)),
215
- 'Field',
216
- 'Signet.compact line 241 char 30'));
217
- const a7_0 = __compactRuntime.addField(__compactRuntime.mulField(a6_0, 256n),
218
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
219
- 1,
220
- ((e, i) => e.slice(i, i+1))(addr_0,
221
- Number(7n)),
222
- 'Field',
223
- 'Signet.compact line 242 char 30'));
224
- const a8_0 = __compactRuntime.addField(__compactRuntime.mulField(a7_0, 256n),
225
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
226
- 1,
227
- ((e, i) => e.slice(i, i+1))(addr_0,
228
- Number(8n)),
229
- 'Field',
230
- 'Signet.compact line 243 char 30'));
231
- const a9_0 = __compactRuntime.addField(__compactRuntime.mulField(a8_0, 256n),
232
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
233
- 1,
234
- ((e, i) => e.slice(i, i+1))(addr_0,
235
- Number(9n)),
236
- 'Field',
237
- 'Signet.compact line 244 char 30'));
238
- const a10_0 = __compactRuntime.addField(__compactRuntime.mulField(a9_0, 256n),
239
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
240
- 1,
241
- ((e, i) => e.slice(i, i+1))(addr_0,
242
- Number(10n)),
243
- 'Field',
244
- 'Signet.compact line 245 char 30'));
245
- const a11_0 = __compactRuntime.addField(__compactRuntime.mulField(a10_0,
246
- 256n),
247
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
248
- 1,
249
- ((e, i) => e.slice(i, i+1))(addr_0,
250
- Number(11n)),
251
- 'Field',
252
- 'Signet.compact line 246 char 30'));
253
- const a12_0 = __compactRuntime.addField(__compactRuntime.mulField(a11_0,
254
- 256n),
255
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
256
- 1,
257
- ((e, i) => e.slice(i, i+1))(addr_0,
258
- Number(12n)),
259
- 'Field',
260
- 'Signet.compact line 247 char 30'));
261
- const a13_0 = __compactRuntime.addField(__compactRuntime.mulField(a12_0,
262
- 256n),
263
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
264
- 1,
265
- ((e, i) => e.slice(i, i+1))(addr_0,
266
- Number(13n)),
267
- 'Field',
268
- 'Signet.compact line 248 char 30'));
269
- const a14_0 = __compactRuntime.addField(__compactRuntime.mulField(a13_0,
270
- 256n),
271
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
272
- 1,
273
- ((e, i) => e.slice(i, i+1))(addr_0,
274
- Number(14n)),
275
- 'Field',
276
- 'Signet.compact line 249 char 30'));
277
- const a15_0 = __compactRuntime.addField(__compactRuntime.mulField(a14_0,
278
- 256n),
279
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
280
- 1,
281
- ((e, i) => e.slice(i, i+1))(addr_0,
282
- Number(15n)),
283
- 'Field',
284
- 'Signet.compact line 250 char 30'));
285
- const a16_0 = __compactRuntime.addField(__compactRuntime.mulField(a15_0,
286
- 256n),
287
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
288
- 1,
289
- ((e, i) => e.slice(i, i+1))(addr_0,
290
- Number(16n)),
291
- 'Field',
292
- 'Signet.compact line 251 char 30'));
293
- const a17_0 = __compactRuntime.addField(__compactRuntime.mulField(a16_0,
294
- 256n),
295
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
296
- 1,
297
- ((e, i) => e.slice(i, i+1))(addr_0,
298
- Number(17n)),
299
- 'Field',
300
- 'Signet.compact line 252 char 30'));
301
- const a18_0 = __compactRuntime.addField(__compactRuntime.mulField(a17_0,
302
- 256n),
303
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
304
- 1,
305
- ((e, i) => e.slice(i, i+1))(addr_0,
306
- Number(18n)),
307
- 'Field',
308
- 'Signet.compact line 253 char 30'));
309
- return __compactRuntime.addField(__compactRuntime.mulField(a18_0, 256n),
310
- __compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
311
- 1,
312
- ((e, i) => e.slice(i, i+1))(addr_0,
313
- Number(19n)),
314
- 'Field',
315
- 'Signet.compact line 254 char 30'));
316
- }
317
- _signetAttestationMessage_0(requestId_0, serializedOutput_0, outputLen_0) {
280
+ _signetAttestationDigest_0(requestId_0, serializedOutput_0, outputLen_0) {
318
281
  const outHash_0 = this._persistentHash_0([this._persistentHash_1(serializedOutput_0),
319
282
  __compactRuntime.convertBigintToBytes(32,
320
283
  outputLen_0,
321
- 'Signet.compact line 380 char 7')]);
322
- return this._persistentHash_2([new Uint8Array([115, 105, 103, 110, 101, 116, 58, 109, 105, 100, 110, 105, 103, 104, 116, 58, 97, 116, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
323
- requestId_0,
324
- outHash_0]);
325
- }
326
- _charToNibble_0(c_0) {
327
- const isDigit_0 = c_0 >= 48n && c_0 <= 57n;
328
- const isLower_0 = c_0 >= 97n && c_0 <= 102n;
329
- __compactRuntime.assert(isDigit_0 || isLower_0, 'non-canonical hex char');
330
- const base_0 = (__compactRuntime.assert(c_0 >= 48n,
331
- 'result of subtraction would be negative'),
332
- c_0 - 48n);
333
- const adjust_0 = isLower_0 ? 39n : 0n;
334
- __compactRuntime.assert(base_0 >= adjust_0,
335
- 'result of subtraction would be negative');
336
- return base_0 - adjust_0;
337
- }
338
- _assertHexOf_0(commitment_0, hexStr_0) {
339
- this._folder_0(((t_0, i_0) =>
340
- {
341
- const hi_0 = this._charToNibble_0(__compactRuntime.convertBytesToUint(255n,
342
- 1,
343
- ((e, i) => e.slice(i, i+1))(hexStr_0,
344
- Number(2n
345
- *
346
- i_0)),
347
- 'Uint<0..256>',
348
- 'Signet.compact line 412 char 31'));
349
- const lo_0 = this._charToNibble_0(__compactRuntime.convertBytesToUint(255n,
350
- 1,
351
- ((e, i) => e.slice(i, i+1))(hexStr_0,
352
- Number(2n
353
- *
354
- i_0
355
- +
356
- 1n)),
357
- 'Uint<0..256>',
358
- 'Signet.compact line 413 char 31'));
359
- __compactRuntime.assert(__compactRuntime.convertBytesToUint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
360
- 1,
361
- ((e, i) => e.slice(i, i+1))(commitment_0,
362
- Number(i_0)),
363
- 'Field',
364
- 'Signet.compact line 414 char 15')
365
- ===
366
- __compactRuntime.addField(__compactRuntime.mulField(hi_0,
367
- 16n),
368
- lo_0),
369
- 'path hex does not match commitment');
370
- return t_0;
371
- }),
372
- [],
373
- [0n,
374
- 1n,
375
- 2n,
376
- 3n,
377
- 4n,
378
- 5n,
379
- 6n,
380
- 7n,
381
- 8n,
382
- 9n,
383
- 10n,
384
- 11n,
385
- 12n,
386
- 13n,
387
- 14n,
388
- 15n,
389
- 16n,
390
- 17n,
391
- 18n,
392
- 19n,
393
- 20n,
394
- 21n,
395
- 22n,
396
- 23n,
397
- 24n,
398
- 25n,
399
- 26n,
400
- 27n,
401
- 28n,
402
- 29n,
403
- 30n,
404
- 31n]);
405
- return [];
406
- }
407
- _assertPathCommitment_0(commitment_0, path_0) {
408
- this._assertHexOf_0(commitment_0,
409
- ((e, i) => e.slice(i, i+64))(path_0, Number(0n)));
410
- __compactRuntime.assert(this._equal_0(((e, i) => e.slice(i, i+192))(path_0,
411
- Number(64n)),
412
- new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])),
413
- 'Path must be zero-padded after hex');
414
- return [];
415
- }
416
- _folder_0(f, x, a0) {
417
- for (let i = 0; i < 32; i++) { x = f(x, a0[i]); }
418
- return x;
419
- }
420
- _equal_0(x0, y0) {
421
- if (!x0.every((x, i) => y0[i] === x)) { return false; }
422
- return true;
284
+ 'Signet.compact line 285 char 7')]);
285
+ return this._persistentHash_0([requestId_0, outHash_0]);
423
286
  }
287
+ _verifyRespondBidirectionalEvent_0(requestId_0,
288
+ respondBidirectionalEvent_0,
289
+ mpcResponseKey_0)
290
+ {
291
+ return this._secp256k1EcdsaVerify_0(this._signetAttestationDigest_0(requestId_0,
292
+ respondBidirectionalEvent_0.serializedOutput,
293
+ respondBidirectionalEvent_0.outputLen),
294
+ { r:
295
+ __compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
296
+ 32,
297
+ respondBidirectionalEvent_0.r,
298
+ 'Secp256k1Scalar',
299
+ 'Signet.compact line 308 char 12'),
300
+ s:
301
+ __compactRuntime.convertBytesToField(115792089237316195423570985008687907852837564279074904382605163141518161494336n,
302
+ 32,
303
+ respondBidirectionalEvent_0.s,
304
+ 'Secp256k1Scalar',
305
+ 'Signet.compact line 309 char 12') },
306
+ mpcResponseKey_0);
307
+ }
308
+ _signetKeyHash_0(pk_0) { return this._persistentHash_2(pk_0); }
424
309
  }
425
310
  export function ledger(stateOrChargedState) {
426
311
  const state = stateOrChargedState instanceof __compactRuntime.StateValue ? stateOrChargedState : stateOrChargedState.state;
@@ -443,127 +328,92 @@ const _emptyContext = {
443
328
  };
444
329
  const _dummyContract = new Contract({ });
445
330
  export const pureCircuits = {
446
- constructSignBidirectionalNotificationV1: (...args_0) => {
447
- if (args_0.length !== 3) {
448
- throw new __compactRuntime.CompactError(`constructSignBidirectionalNotificationV1: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
331
+ constructSignBidirectionalEventNotificationV1: (...args_0) => {
332
+ if (args_0.length !== 2) {
333
+ throw new __compactRuntime.CompactError(`constructSignBidirectionalEventNotificationV1: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
449
334
  }
450
335
  const callerAddress_0 = args_0[0];
451
- const requestId_0 = args_0[1];
452
- const requestsIndexField_0 = args_0[2];
336
+ const requestsIndexField_0 = args_0[1];
453
337
  if (!(typeof(callerAddress_0) === 'object' && callerAddress_0.bytes.buffer instanceof ArrayBuffer && callerAddress_0.bytes.BYTES_PER_ELEMENT === 1 && callerAddress_0.bytes.length === 32)) {
454
- __compactRuntime.typeError('constructSignBidirectionalNotificationV1',
338
+ __compactRuntime.typeError('constructSignBidirectionalEventNotificationV1',
455
339
  'argument 1',
456
- 'Signet.compact line 132 char 3',
340
+ 'Signet.compact line 209 char 3',
457
341
  'struct ContractAddress<bytes: Bytes<32>>',
458
342
  callerAddress_0)
459
343
  }
460
- if (!(requestId_0.buffer instanceof ArrayBuffer && requestId_0.BYTES_PER_ELEMENT === 1 && requestId_0.length === 32)) {
461
- __compactRuntime.typeError('constructSignBidirectionalNotificationV1',
462
- 'argument 2',
463
- 'Signet.compact line 132 char 3',
464
- 'Bytes<32>',
465
- requestId_0)
466
- }
467
344
  if (!(typeof(requestsIndexField_0) === 'bigint' && requestsIndexField_0 >= 0n && requestsIndexField_0 <= 255n)) {
468
- __compactRuntime.typeError('constructSignBidirectionalNotificationV1',
469
- 'argument 3',
470
- 'Signet.compact line 132 char 3',
345
+ __compactRuntime.typeError('constructSignBidirectionalEventNotificationV1',
346
+ 'argument 2',
347
+ 'Signet.compact line 209 char 3',
471
348
  'Uint<0..256>',
472
349
  requestsIndexField_0)
473
350
  }
474
- return _dummyContract._constructSignBidirectionalNotificationV1_0(callerAddress_0,
475
- requestId_0,
476
- requestsIndexField_0);
351
+ return _dummyContract._constructSignBidirectionalEventNotificationV1_0(callerAddress_0,
352
+ requestsIndexField_0);
477
353
  },
478
- evmAddressAbiValue: (...args_0) => {
479
- if (args_0.length !== 1) {
480
- throw new __compactRuntime.CompactError(`evmAddressAbiValue: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
481
- }
482
- const addr_0 = args_0[0];
483
- if (!(addr_0.buffer instanceof ArrayBuffer && addr_0.BYTES_PER_ELEMENT === 1 && addr_0.length === 20)) {
484
- __compactRuntime.typeError('evmAddressAbiValue',
485
- 'argument 1',
486
- 'Signet.compact line 234 char 3',
487
- 'Bytes<20>',
488
- addr_0)
489
- }
490
- return _dummyContract._evmAddressAbiValue_0(addr_0);
491
- },
492
- signetAttestationMessage: (...args_0) => {
354
+ signetAttestationDigest: (...args_0) => {
493
355
  if (args_0.length !== 3) {
494
- throw new __compactRuntime.CompactError(`signetAttestationMessage: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
356
+ throw new __compactRuntime.CompactError(`signetAttestationDigest: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
495
357
  }
496
358
  const requestId_0 = args_0[0];
497
359
  const serializedOutput_0 = args_0[1];
498
360
  const outputLen_0 = args_0[2];
499
361
  if (!(requestId_0.buffer instanceof ArrayBuffer && requestId_0.BYTES_PER_ELEMENT === 1 && requestId_0.length === 32)) {
500
- __compactRuntime.typeError('signetAttestationMessage',
362
+ __compactRuntime.typeError('signetAttestationDigest',
501
363
  'argument 1',
502
- 'Signet.compact line 373 char 3',
364
+ 'Signet.compact line 278 char 3',
503
365
  'Bytes<32>',
504
366
  requestId_0)
505
367
  }
506
368
  if (!(serializedOutput_0.buffer instanceof ArrayBuffer && serializedOutput_0.BYTES_PER_ELEMENT === 1 && serializedOutput_0.length === 128)) {
507
- __compactRuntime.typeError('signetAttestationMessage',
369
+ __compactRuntime.typeError('signetAttestationDigest',
508
370
  'argument 2',
509
- 'Signet.compact line 373 char 3',
371
+ 'Signet.compact line 278 char 3',
510
372
  'Bytes<128>',
511
373
  serializedOutput_0)
512
374
  }
513
375
  if (!(typeof(outputLen_0) === 'bigint' && outputLen_0 >= 0n && outputLen_0 <= 255n)) {
514
- __compactRuntime.typeError('signetAttestationMessage',
376
+ __compactRuntime.typeError('signetAttestationDigest',
515
377
  'argument 3',
516
- 'Signet.compact line 373 char 3',
378
+ 'Signet.compact line 278 char 3',
517
379
  'Uint<0..256>',
518
380
  outputLen_0)
519
381
  }
520
- return _dummyContract._signetAttestationMessage_0(requestId_0,
521
- serializedOutput_0,
522
- outputLen_0);
382
+ return _dummyContract._signetAttestationDigest_0(requestId_0,
383
+ serializedOutput_0,
384
+ outputLen_0);
523
385
  },
524
- assertHexOf: (...args_0) => {
525
- if (args_0.length !== 2) {
526
- throw new __compactRuntime.CompactError(`assertHexOf: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
386
+ verifyRespondBidirectionalEvent: (...args_0) => {
387
+ if (args_0.length !== 3) {
388
+ throw new __compactRuntime.CompactError(`verifyRespondBidirectionalEvent: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
527
389
  }
528
- const commitment_0 = args_0[0];
529
- const hexStr_0 = args_0[1];
530
- if (!(commitment_0.buffer instanceof ArrayBuffer && commitment_0.BYTES_PER_ELEMENT === 1 && commitment_0.length === 32)) {
531
- __compactRuntime.typeError('assertHexOf',
390
+ const requestId_0 = args_0[0];
391
+ const respondBidirectionalEvent_0 = args_0[1];
392
+ const mpcResponseKey_0 = args_0[2];
393
+ if (!(requestId_0.buffer instanceof ArrayBuffer && requestId_0.BYTES_PER_ELEMENT === 1 && requestId_0.length === 32)) {
394
+ __compactRuntime.typeError('verifyRespondBidirectionalEvent',
532
395
  'argument 1',
533
- 'Signet.compact line 410 char 3',
396
+ 'Signet.compact line 296 char 3',
534
397
  'Bytes<32>',
535
- commitment_0)
398
+ requestId_0)
536
399
  }
537
- if (!(hexStr_0.buffer instanceof ArrayBuffer && hexStr_0.BYTES_PER_ELEMENT === 1 && hexStr_0.length === 64)) {
538
- __compactRuntime.typeError('assertHexOf',
400
+ if (!(typeof(respondBidirectionalEvent_0) === 'object' && respondBidirectionalEvent_0.serializedOutput.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.serializedOutput.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.serializedOutput.length === 128 && typeof(respondBidirectionalEvent_0.outputLen) === 'bigint' && respondBidirectionalEvent_0.outputLen >= 0n && respondBidirectionalEvent_0.outputLen <= 255n && respondBidirectionalEvent_0.r.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.r.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.r.length === 32 && respondBidirectionalEvent_0.s.buffer instanceof ArrayBuffer && respondBidirectionalEvent_0.s.BYTES_PER_ELEMENT === 1 && respondBidirectionalEvent_0.s.length === 32 && typeof(respondBidirectionalEvent_0.recoveryId) === 'bigint' && respondBidirectionalEvent_0.recoveryId >= 0n && respondBidirectionalEvent_0.recoveryId <= 255n)) {
401
+ __compactRuntime.typeError('verifyRespondBidirectionalEvent',
539
402
  'argument 2',
540
- 'Signet.compact line 410 char 3',
541
- 'Bytes<64>',
542
- hexStr_0)
403
+ 'Signet.compact line 296 char 3',
404
+ 'struct RespondBidirectionalEvent<serializedOutput: Bytes<128>, outputLen: Uint<0..256>, r: Bytes<32>, s: Bytes<32>, recoveryId: Uint<0..256>>',
405
+ respondBidirectionalEvent_0)
543
406
  }
544
- return _dummyContract._assertHexOf_0(commitment_0, hexStr_0);
407
+ return _dummyContract._verifyRespondBidirectionalEvent_0(requestId_0,
408
+ respondBidirectionalEvent_0,
409
+ mpcResponseKey_0);
545
410
  },
546
- assertPathCommitment: (...args_0) => {
547
- if (args_0.length !== 2) {
548
- throw new __compactRuntime.CompactError(`assertPathCommitment: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
549
- }
550
- const commitment_0 = args_0[0];
551
- const path_0 = args_0[1];
552
- if (!(commitment_0.buffer instanceof ArrayBuffer && commitment_0.BYTES_PER_ELEMENT === 1 && commitment_0.length === 32)) {
553
- __compactRuntime.typeError('assertPathCommitment',
554
- 'argument 1',
555
- 'Signet.compact line 425 char 3',
556
- 'Bytes<32>',
557
- commitment_0)
558
- }
559
- if (!(path_0.buffer instanceof ArrayBuffer && path_0.BYTES_PER_ELEMENT === 1 && path_0.length === 256)) {
560
- __compactRuntime.typeError('assertPathCommitment',
561
- 'argument 2',
562
- 'Signet.compact line 425 char 3',
563
- 'Bytes<256>',
564
- path_0)
411
+ signetKeyHash: (...args_0) => {
412
+ if (args_0.length !== 1) {
413
+ throw new __compactRuntime.CompactError(`signetKeyHash: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
565
414
  }
566
- return _dummyContract._assertPathCommitment_0(commitment_0, path_0);
415
+ const pk_0 = args_0[0];
416
+ return _dummyContract._signetKeyHash_0(pk_0);
567
417
  }
568
418
  };
569
419
  export const contractReferenceLocations =