@sig-net/midnight 0.0.2 → 0.0.4
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 +137 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +1 -1
- package/dist/managed/compiler/contract-manifest.json +5 -5
- package/dist/managed/contract/index.js +169 -169
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +21 -22
- package/dist/signature-requests-state-reader.d.ts.map +1 -1
- package/dist/signature-requests-state-reader.js +24 -20
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-state-reading.d.ts +21 -6
- package/dist/signature-state-reading.d.ts.map +1 -1
- package/dist/signature-state-reading.js +42 -10
- package/dist/signature-state-reading.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +9 -2
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +6 -6
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +2 -1
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +4 -4
- package/dist/signet-requests.js.map +1 -1
- package/package.json +10 -5
- package/src/Schnorr.compact +1 -1
- package/src/Signet.compact +11 -11
- package/src/circuits.compact +1 -1
- package/src/constants.ts +0 -97
- package/src/epsilon-derivation.ts +0 -62
- package/src/index.ts +0 -29
- package/src/managed/compiler/contract-info.json +0 -222
- package/src/managed/compiler/contract-manifest.json +0 -32
- package/src/managed/contract/index.d.ts +0 -78
- package/src/managed/contract/index.js +0 -676
- package/src/managed/contract/index.js.map +0 -8
- package/src/schnorr.ts +0 -210
- package/src/signature-requests-state-reader.ts +0 -223
- package/src/signature-response-verification.ts +0 -64
- package/src/signature-state-reading.ts +0 -87
- package/src/signet-contract-state-reader.ts +0 -587
- package/src/signet-request-feed.ts +0 -208
- package/src/signet-request-resolver.ts +0 -116
- package/src/signet-request-response-reader.ts +0 -324
- package/src/signet-requests.ts +0 -762
|
@@ -1,676 +0,0 @@
|
|
|
1
|
-
import * as __compactRuntime from '@midnight-ntwrk/compact-runtime';
|
|
2
|
-
__compactRuntime.checkRuntimeVersion('0.18.0-rc.0');
|
|
3
|
-
|
|
4
|
-
const _descriptor_0 = new __compactRuntime.CompactTypeBytes(32);
|
|
5
|
-
|
|
6
|
-
const _descriptor_1 = new __compactRuntime.CompactTypeBytes(256);
|
|
7
|
-
|
|
8
|
-
const _descriptor_2 = __compactRuntime.CompactTypeField;
|
|
9
|
-
|
|
10
|
-
const _descriptor_3 = new __compactRuntime.CompactTypeVector(4, _descriptor_2);
|
|
11
|
-
|
|
12
|
-
const _descriptor_4 = new __compactRuntime.CompactTypeUnsignedInteger(255n, 1);
|
|
13
|
-
|
|
14
|
-
const _descriptor_5 = new __compactRuntime.CompactTypeBytes(64);
|
|
15
|
-
|
|
16
|
-
const _descriptor_6 = new __compactRuntime.CompactTypeBytes(20);
|
|
17
|
-
|
|
18
|
-
const _descriptor_7 = new __compactRuntime.CompactTypeBytes(128);
|
|
19
|
-
|
|
20
|
-
class _ContractAddress_0 {
|
|
21
|
-
alignment() {
|
|
22
|
-
return _descriptor_0.alignment();
|
|
23
|
-
}
|
|
24
|
-
fromValue(value_0) {
|
|
25
|
-
return {
|
|
26
|
-
bytes: _descriptor_0.fromValue(value_0)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
toValue(value_0) {
|
|
30
|
-
return _descriptor_0.toValue(value_0.bytes);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const _descriptor_8 = new _ContractAddress_0();
|
|
35
|
-
|
|
36
|
-
const _descriptor_9 = new __compactRuntime.CompactTypeBytes(65);
|
|
37
|
-
|
|
38
|
-
class _SignBidirectionalNotification_0 {
|
|
39
|
-
alignment() {
|
|
40
|
-
return _descriptor_4.alignment().concat(_descriptor_9.alignment());
|
|
41
|
-
}
|
|
42
|
-
fromValue(value_0) {
|
|
43
|
-
return {
|
|
44
|
-
version: _descriptor_4.fromValue(value_0),
|
|
45
|
-
payload: _descriptor_9.fromValue(value_0)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
toValue(value_0) {
|
|
49
|
-
return _descriptor_4.toValue(value_0.version).concat(_descriptor_9.toValue(value_0.payload));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const _descriptor_10 = new _SignBidirectionalNotification_0();
|
|
54
|
-
|
|
55
|
-
class _SchnorrHashInput_0 {
|
|
56
|
-
alignment() {
|
|
57
|
-
return _descriptor_2.alignment().concat(_descriptor_2.alignment().concat(_descriptor_2.alignment().concat(_descriptor_2.alignment().concat(_descriptor_3.alignment()))));
|
|
58
|
-
}
|
|
59
|
-
fromValue(value_0) {
|
|
60
|
-
return {
|
|
61
|
-
ann_x: _descriptor_2.fromValue(value_0),
|
|
62
|
-
ann_y: _descriptor_2.fromValue(value_0),
|
|
63
|
-
pk_x: _descriptor_2.fromValue(value_0),
|
|
64
|
-
pk_y: _descriptor_2.fromValue(value_0),
|
|
65
|
-
msg: _descriptor_3.fromValue(value_0)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
toValue(value_0) {
|
|
69
|
-
return _descriptor_2.toValue(value_0.ann_x).concat(_descriptor_2.toValue(value_0.ann_y).concat(_descriptor_2.toValue(value_0.pk_x).concat(_descriptor_2.toValue(value_0.pk_y).concat(_descriptor_3.toValue(value_0.msg)))));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const _descriptor_11 = new _SchnorrHashInput_0();
|
|
74
|
-
|
|
75
|
-
const _descriptor_12 = new __compactRuntime.CompactTypeVector(2, _descriptor_0);
|
|
76
|
-
|
|
77
|
-
const _descriptor_13 = new __compactRuntime.CompactTypeUnsignedInteger(18446744073709551615n, 8);
|
|
78
|
-
|
|
79
|
-
const _descriptor_14 = __compactRuntime.CompactTypeBoolean;
|
|
80
|
-
|
|
81
|
-
class _Either_0 {
|
|
82
|
-
alignment() {
|
|
83
|
-
return _descriptor_14.alignment().concat(_descriptor_0.alignment().concat(_descriptor_0.alignment()));
|
|
84
|
-
}
|
|
85
|
-
fromValue(value_0) {
|
|
86
|
-
return {
|
|
87
|
-
is_left: _descriptor_14.fromValue(value_0),
|
|
88
|
-
left: _descriptor_0.fromValue(value_0),
|
|
89
|
-
right: _descriptor_0.fromValue(value_0)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
toValue(value_0) {
|
|
93
|
-
return _descriptor_14.toValue(value_0.is_left).concat(_descriptor_0.toValue(value_0.left).concat(_descriptor_0.toValue(value_0.right)));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const _descriptor_15 = new _Either_0();
|
|
98
|
-
|
|
99
|
-
const _descriptor_16 = new __compactRuntime.CompactTypeUnsignedInteger(340282366920938463463374607431768211455n, 16);
|
|
100
|
-
|
|
101
|
-
const _descriptor_17 = new __compactRuntime.CompactTypeUnsignedInteger(4294967295n, 4);
|
|
102
|
-
|
|
103
|
-
export class Contract {
|
|
104
|
-
witnesses;
|
|
105
|
-
constructor(...args_0) {
|
|
106
|
-
if (args_0.length !== 1) {
|
|
107
|
-
throw new __compactRuntime.CompactError(`Contract constructor: expected 1 argument, received ${args_0.length}`);
|
|
108
|
-
}
|
|
109
|
-
const witnesses_0 = args_0[0];
|
|
110
|
-
if (typeof(witnesses_0) !== 'object') {
|
|
111
|
-
throw new __compactRuntime.CompactError('first (witnesses) argument to Contract constructor is not an object');
|
|
112
|
-
}
|
|
113
|
-
this.witnesses = witnesses_0;
|
|
114
|
-
this.circuits = {
|
|
115
|
-
async constructSignBidirectionalNotificationV1(context, ...args_1) {
|
|
116
|
-
return { result: pureCircuits.constructSignBidirectionalNotificationV1(...args_1), context };
|
|
117
|
-
},
|
|
118
|
-
async evmAddressAbiValue(context, ...args_1) {
|
|
119
|
-
return { result: pureCircuits.evmAddressAbiValue(...args_1), context };
|
|
120
|
-
},
|
|
121
|
-
async signetAttestationMessage(context, ...args_1) {
|
|
122
|
-
return { result: pureCircuits.signetAttestationMessage(...args_1), context };
|
|
123
|
-
},
|
|
124
|
-
async assertHexOf(context, ...args_1) {
|
|
125
|
-
return { result: pureCircuits.assertHexOf(...args_1), context };
|
|
126
|
-
},
|
|
127
|
-
async assertPathCommitment(context, ...args_1) {
|
|
128
|
-
return { result: pureCircuits.assertPathCommitment(...args_1), context };
|
|
129
|
-
},
|
|
130
|
-
async schnorrChallenge(context, ...args_1) {
|
|
131
|
-
return { result: pureCircuits.schnorrChallenge(...args_1), context };
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
this.impureCircuits = {};
|
|
135
|
-
this.provableCircuits = {};
|
|
136
|
-
}
|
|
137
|
-
async initialState(...args_0) {
|
|
138
|
-
if (args_0.length !== 1) {
|
|
139
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
|
|
140
|
-
}
|
|
141
|
-
const constructorContext_0 = args_0[0];
|
|
142
|
-
if (typeof(constructorContext_0) !== 'object') {
|
|
143
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'constructorContext' in argument 1 (as invoked from Typescript) to be an object`);
|
|
144
|
-
}
|
|
145
|
-
if (!('initialZswapLocalState' in constructorContext_0)) {
|
|
146
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript)`);
|
|
147
|
-
}
|
|
148
|
-
if (typeof(constructorContext_0.initialZswapLocalState) !== 'object') {
|
|
149
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript) to be an object`);
|
|
150
|
-
}
|
|
151
|
-
const state_0 = new __compactRuntime.ContractState();
|
|
152
|
-
let stateValue_0 = __compactRuntime.StateValue.newArray();
|
|
153
|
-
state_0.data = new __compactRuntime.ChargedState(stateValue_0);
|
|
154
|
-
const context = __compactRuntime.createCircuitContext('constructor', __compactRuntime.dummyContractAddress(), constructorContext_0.initialZswapLocalState.coinPublicKey, state_0.data, constructorContext_0.initialPrivateState);
|
|
155
|
-
const partialProofData = {
|
|
156
|
-
input: { value: [], alignment: [] },
|
|
157
|
-
output: undefined,
|
|
158
|
-
publicTranscript: [],
|
|
159
|
-
privateTranscriptOutputs: []
|
|
160
|
-
};
|
|
161
|
-
state_0.data = new __compactRuntime.ChargedState(context.callContext.currentQueryContext.state.state);
|
|
162
|
-
return {
|
|
163
|
-
currentContractState: state_0,
|
|
164
|
-
currentPrivateState: context.callContext.currentPrivateState,
|
|
165
|
-
currentZswapLocalState: context.callContext.currentZswapLocalState
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
_transientHash_0(value_0) {
|
|
169
|
-
const result_0 = __compactRuntime.transientHash(_descriptor_11, value_0);
|
|
170
|
-
return result_0;
|
|
171
|
-
}
|
|
172
|
-
_persistentHash_0(value_0) {
|
|
173
|
-
const result_0 = __compactRuntime.persistentHash(_descriptor_12, value_0);
|
|
174
|
-
return result_0;
|
|
175
|
-
}
|
|
176
|
-
_persistentHash_1(value_0) {
|
|
177
|
-
const result_0 = __compactRuntime.persistentHash(_descriptor_7, value_0);
|
|
178
|
-
return result_0;
|
|
179
|
-
}
|
|
180
|
-
_constructSignBidirectionalNotificationV1_0(callerAddress_0,
|
|
181
|
-
requestId_0,
|
|
182
|
-
requestsIndexField_0)
|
|
183
|
-
{
|
|
184
|
-
return { version: 1n,
|
|
185
|
-
payload:
|
|
186
|
-
Uint8Array.from([...Array.from(callerAddress_0.bytes, BigInt),
|
|
187
|
-
...Array.from(requestId_0, BigInt),
|
|
188
|
-
requestsIndexField_0],
|
|
189
|
-
Number) };
|
|
190
|
-
}
|
|
191
|
-
_evmAddressAbiValue_0(addr_0) {
|
|
192
|
-
const a0_0 = __compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
193
|
-
1,
|
|
194
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
195
|
-
Number(0n)),
|
|
196
|
-
'Field',
|
|
197
|
-
'Signet.compact line 234 char 17');
|
|
198
|
-
const a1_0 = __compactRuntime.addField(__compactRuntime.mulField(a0_0, 256n),
|
|
199
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
200
|
-
1,
|
|
201
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
202
|
-
Number(1n)),
|
|
203
|
-
'Field',
|
|
204
|
-
'Signet.compact line 235 char 30'));
|
|
205
|
-
const a2_0 = __compactRuntime.addField(__compactRuntime.mulField(a1_0, 256n),
|
|
206
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
207
|
-
1,
|
|
208
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
209
|
-
Number(2n)),
|
|
210
|
-
'Field',
|
|
211
|
-
'Signet.compact line 236 char 30'));
|
|
212
|
-
const a3_0 = __compactRuntime.addField(__compactRuntime.mulField(a2_0, 256n),
|
|
213
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
214
|
-
1,
|
|
215
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
216
|
-
Number(3n)),
|
|
217
|
-
'Field',
|
|
218
|
-
'Signet.compact line 237 char 30'));
|
|
219
|
-
const a4_0 = __compactRuntime.addField(__compactRuntime.mulField(a3_0, 256n),
|
|
220
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
221
|
-
1,
|
|
222
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
223
|
-
Number(4n)),
|
|
224
|
-
'Field',
|
|
225
|
-
'Signet.compact line 238 char 30'));
|
|
226
|
-
const a5_0 = __compactRuntime.addField(__compactRuntime.mulField(a4_0, 256n),
|
|
227
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
228
|
-
1,
|
|
229
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
230
|
-
Number(5n)),
|
|
231
|
-
'Field',
|
|
232
|
-
'Signet.compact line 239 char 30'));
|
|
233
|
-
const a6_0 = __compactRuntime.addField(__compactRuntime.mulField(a5_0, 256n),
|
|
234
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
235
|
-
1,
|
|
236
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
237
|
-
Number(6n)),
|
|
238
|
-
'Field',
|
|
239
|
-
'Signet.compact line 240 char 30'));
|
|
240
|
-
const a7_0 = __compactRuntime.addField(__compactRuntime.mulField(a6_0, 256n),
|
|
241
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
242
|
-
1,
|
|
243
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
244
|
-
Number(7n)),
|
|
245
|
-
'Field',
|
|
246
|
-
'Signet.compact line 241 char 30'));
|
|
247
|
-
const a8_0 = __compactRuntime.addField(__compactRuntime.mulField(a7_0, 256n),
|
|
248
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
249
|
-
1,
|
|
250
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
251
|
-
Number(8n)),
|
|
252
|
-
'Field',
|
|
253
|
-
'Signet.compact line 242 char 30'));
|
|
254
|
-
const a9_0 = __compactRuntime.addField(__compactRuntime.mulField(a8_0, 256n),
|
|
255
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
256
|
-
1,
|
|
257
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
258
|
-
Number(9n)),
|
|
259
|
-
'Field',
|
|
260
|
-
'Signet.compact line 243 char 30'));
|
|
261
|
-
const a10_0 = __compactRuntime.addField(__compactRuntime.mulField(a9_0, 256n),
|
|
262
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
263
|
-
1,
|
|
264
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
265
|
-
Number(10n)),
|
|
266
|
-
'Field',
|
|
267
|
-
'Signet.compact line 244 char 30'));
|
|
268
|
-
const a11_0 = __compactRuntime.addField(__compactRuntime.mulField(a10_0,
|
|
269
|
-
256n),
|
|
270
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
271
|
-
1,
|
|
272
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
273
|
-
Number(11n)),
|
|
274
|
-
'Field',
|
|
275
|
-
'Signet.compact line 245 char 30'));
|
|
276
|
-
const a12_0 = __compactRuntime.addField(__compactRuntime.mulField(a11_0,
|
|
277
|
-
256n),
|
|
278
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
279
|
-
1,
|
|
280
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
281
|
-
Number(12n)),
|
|
282
|
-
'Field',
|
|
283
|
-
'Signet.compact line 246 char 30'));
|
|
284
|
-
const a13_0 = __compactRuntime.addField(__compactRuntime.mulField(a12_0,
|
|
285
|
-
256n),
|
|
286
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
287
|
-
1,
|
|
288
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
289
|
-
Number(13n)),
|
|
290
|
-
'Field',
|
|
291
|
-
'Signet.compact line 247 char 30'));
|
|
292
|
-
const a14_0 = __compactRuntime.addField(__compactRuntime.mulField(a13_0,
|
|
293
|
-
256n),
|
|
294
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
295
|
-
1,
|
|
296
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
297
|
-
Number(14n)),
|
|
298
|
-
'Field',
|
|
299
|
-
'Signet.compact line 248 char 30'));
|
|
300
|
-
const a15_0 = __compactRuntime.addField(__compactRuntime.mulField(a14_0,
|
|
301
|
-
256n),
|
|
302
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
303
|
-
1,
|
|
304
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
305
|
-
Number(15n)),
|
|
306
|
-
'Field',
|
|
307
|
-
'Signet.compact line 249 char 30'));
|
|
308
|
-
const a16_0 = __compactRuntime.addField(__compactRuntime.mulField(a15_0,
|
|
309
|
-
256n),
|
|
310
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
311
|
-
1,
|
|
312
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
313
|
-
Number(16n)),
|
|
314
|
-
'Field',
|
|
315
|
-
'Signet.compact line 250 char 30'));
|
|
316
|
-
const a17_0 = __compactRuntime.addField(__compactRuntime.mulField(a16_0,
|
|
317
|
-
256n),
|
|
318
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
319
|
-
1,
|
|
320
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
321
|
-
Number(17n)),
|
|
322
|
-
'Field',
|
|
323
|
-
'Signet.compact line 251 char 30'));
|
|
324
|
-
const a18_0 = __compactRuntime.addField(__compactRuntime.mulField(a17_0,
|
|
325
|
-
256n),
|
|
326
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
327
|
-
1,
|
|
328
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
329
|
-
Number(18n)),
|
|
330
|
-
'Field',
|
|
331
|
-
'Signet.compact line 252 char 30'));
|
|
332
|
-
return __compactRuntime.addField(__compactRuntime.mulField(a18_0, 256n),
|
|
333
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
334
|
-
1,
|
|
335
|
-
((e, i) => e.slice(i, i+1))(addr_0,
|
|
336
|
-
Number(19n)),
|
|
337
|
-
'Field',
|
|
338
|
-
'Signet.compact line 253 char 30'));
|
|
339
|
-
}
|
|
340
|
-
_signetAttestationMessage_0(requestId_0, serializedOutput_0, outputLen_0) {
|
|
341
|
-
const rid_0 = requestId_0;
|
|
342
|
-
const outHash_0 = this._persistentHash_0([this._persistentHash_1(serializedOutput_0),
|
|
343
|
-
__compactRuntime.convertBigintToBytes(32,
|
|
344
|
-
outputLen_0,
|
|
345
|
-
'Signet.compact line 369 char 7')]);
|
|
346
|
-
return [__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
347
|
-
16,
|
|
348
|
-
((e, i) => e.slice(i, i+16))(rid_0,
|
|
349
|
-
Number(0n)),
|
|
350
|
-
'Field',
|
|
351
|
-
'Signet.compact line 372 char 7'),
|
|
352
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
353
|
-
16,
|
|
354
|
-
((e, i) => e.slice(i, i+16))(rid_0,
|
|
355
|
-
Number(16n)),
|
|
356
|
-
'Field',
|
|
357
|
-
'Signet.compact line 373 char 7'),
|
|
358
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
359
|
-
16,
|
|
360
|
-
((e, i) => e.slice(i, i+16))(outHash_0,
|
|
361
|
-
Number(0n)),
|
|
362
|
-
'Field',
|
|
363
|
-
'Signet.compact line 374 char 7'),
|
|
364
|
-
__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
365
|
-
16,
|
|
366
|
-
((e, i) => e.slice(i, i+16))(outHash_0,
|
|
367
|
-
Number(16n)),
|
|
368
|
-
'Field',
|
|
369
|
-
'Signet.compact line 375 char 7')];
|
|
370
|
-
}
|
|
371
|
-
_charToNibble_0(c_0) {
|
|
372
|
-
const isDigit_0 = c_0 >= 48n && c_0 <= 57n;
|
|
373
|
-
const isLower_0 = c_0 >= 97n && c_0 <= 102n;
|
|
374
|
-
__compactRuntime.assert(isDigit_0 || isLower_0, 'non-canonical hex char');
|
|
375
|
-
const base_0 = (__compactRuntime.assert(c_0 >= 48n,
|
|
376
|
-
'result of subtraction would be negative'),
|
|
377
|
-
c_0 - 48n);
|
|
378
|
-
const adjust_0 = isLower_0 ? 39n : 0n;
|
|
379
|
-
__compactRuntime.assert(base_0 >= adjust_0,
|
|
380
|
-
'result of subtraction would be negative');
|
|
381
|
-
return base_0 - adjust_0;
|
|
382
|
-
}
|
|
383
|
-
_assertHexOf_0(commitment_0, hexStr_0) {
|
|
384
|
-
this._folder_0(((t_0, i_0) =>
|
|
385
|
-
{
|
|
386
|
-
const hi_0 = this._charToNibble_0(__compactRuntime.convertBytesToBigint(255n,
|
|
387
|
-
1,
|
|
388
|
-
((e, i) => e.slice(i, i+1))(hexStr_0,
|
|
389
|
-
Number(2n
|
|
390
|
-
*
|
|
391
|
-
i_0)),
|
|
392
|
-
'Uint<0..256>',
|
|
393
|
-
'Signet.compact line 402 char 31'));
|
|
394
|
-
const lo_0 = this._charToNibble_0(__compactRuntime.convertBytesToBigint(255n,
|
|
395
|
-
1,
|
|
396
|
-
((e, i) => e.slice(i, i+1))(hexStr_0,
|
|
397
|
-
Number(2n
|
|
398
|
-
*
|
|
399
|
-
i_0
|
|
400
|
-
+
|
|
401
|
-
1n)),
|
|
402
|
-
'Uint<0..256>',
|
|
403
|
-
'Signet.compact line 403 char 31'));
|
|
404
|
-
__compactRuntime.assert(__compactRuntime.convertBytesToBigint(52435875175126190479447740508185965837690552500527637822603658699938581184512n,
|
|
405
|
-
1,
|
|
406
|
-
((e, i) => e.slice(i, i+1))(commitment_0,
|
|
407
|
-
Number(i_0)),
|
|
408
|
-
'Field',
|
|
409
|
-
'Signet.compact line 404 char 15')
|
|
410
|
-
===
|
|
411
|
-
__compactRuntime.addField(__compactRuntime.mulField(hi_0,
|
|
412
|
-
16n),
|
|
413
|
-
lo_0),
|
|
414
|
-
'path hex does not match commitment');
|
|
415
|
-
return t_0;
|
|
416
|
-
}),
|
|
417
|
-
[],
|
|
418
|
-
[0n,
|
|
419
|
-
1n,
|
|
420
|
-
2n,
|
|
421
|
-
3n,
|
|
422
|
-
4n,
|
|
423
|
-
5n,
|
|
424
|
-
6n,
|
|
425
|
-
7n,
|
|
426
|
-
8n,
|
|
427
|
-
9n,
|
|
428
|
-
10n,
|
|
429
|
-
11n,
|
|
430
|
-
12n,
|
|
431
|
-
13n,
|
|
432
|
-
14n,
|
|
433
|
-
15n,
|
|
434
|
-
16n,
|
|
435
|
-
17n,
|
|
436
|
-
18n,
|
|
437
|
-
19n,
|
|
438
|
-
20n,
|
|
439
|
-
21n,
|
|
440
|
-
22n,
|
|
441
|
-
23n,
|
|
442
|
-
24n,
|
|
443
|
-
25n,
|
|
444
|
-
26n,
|
|
445
|
-
27n,
|
|
446
|
-
28n,
|
|
447
|
-
29n,
|
|
448
|
-
30n,
|
|
449
|
-
31n]);
|
|
450
|
-
return [];
|
|
451
|
-
}
|
|
452
|
-
_assertPathCommitment_0(commitment_0, path_0) {
|
|
453
|
-
this._assertHexOf_0(commitment_0,
|
|
454
|
-
((e, i) => e.slice(i, i+64))(path_0, Number(0n)));
|
|
455
|
-
__compactRuntime.assert(this._equal_0(((e, i) => e.slice(i, i+192))(path_0,
|
|
456
|
-
Number(64n)),
|
|
457
|
-
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])),
|
|
458
|
-
'Path must be zero-padded after hex');
|
|
459
|
-
return [];
|
|
460
|
-
}
|
|
461
|
-
_schnorrChallenge_0(ann_x_0, ann_y_0, pk_x_0, pk_y_0, msg_0) {
|
|
462
|
-
const cFull_0 = this._transientHash_0({ ann_x: ann_x_0,
|
|
463
|
-
ann_y: ann_y_0,
|
|
464
|
-
pk_x: pk_x_0,
|
|
465
|
-
pk_y: pk_y_0,
|
|
466
|
-
msg: msg_0 });
|
|
467
|
-
return cFull_0;
|
|
468
|
-
}
|
|
469
|
-
_folder_0(f, x, a0) {
|
|
470
|
-
for (let i = 0; i < 32; i++) { x = f(x, a0[i]); }
|
|
471
|
-
return x;
|
|
472
|
-
}
|
|
473
|
-
_equal_0(x0, y0) {
|
|
474
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
export function ledger(stateOrChargedState) {
|
|
479
|
-
const state = stateOrChargedState instanceof __compactRuntime.StateValue ? stateOrChargedState : stateOrChargedState.state;
|
|
480
|
-
const chargedState = stateOrChargedState instanceof __compactRuntime.StateValue ? new __compactRuntime.ChargedState(stateOrChargedState) : stateOrChargedState;
|
|
481
|
-
const context = {
|
|
482
|
-
callContext: { currentQueryContext: new __compactRuntime.QueryContext(chargedState, __compactRuntime.dummyContractAddress()), currentGasCost: __compactRuntime.emptyRunningCost() },
|
|
483
|
-
costModel: __compactRuntime.CostModel.initialCostModel()
|
|
484
|
-
};
|
|
485
|
-
const partialProofData = {
|
|
486
|
-
input: { value: [], alignment: [] },
|
|
487
|
-
output: undefined,
|
|
488
|
-
publicTranscript: [],
|
|
489
|
-
privateTranscriptOutputs: []
|
|
490
|
-
};
|
|
491
|
-
return {
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
const _emptyContext = {
|
|
495
|
-
callContext: { currentQueryContext: new __compactRuntime.QueryContext(new __compactRuntime.ContractState().data, __compactRuntime.dummyContractAddress()), currentGasCost: __compactRuntime.emptyRunningCost() }
|
|
496
|
-
};
|
|
497
|
-
const _dummyContract = new Contract({ });
|
|
498
|
-
export const pureCircuits = {
|
|
499
|
-
constructSignBidirectionalNotificationV1: (...args_0) => {
|
|
500
|
-
if (args_0.length !== 3) {
|
|
501
|
-
throw new __compactRuntime.CompactError(`constructSignBidirectionalNotificationV1: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
|
|
502
|
-
}
|
|
503
|
-
const callerAddress_0 = args_0[0];
|
|
504
|
-
const requestId_0 = args_0[1];
|
|
505
|
-
const requestsIndexField_0 = args_0[2];
|
|
506
|
-
if (!(typeof(callerAddress_0) === 'object' && callerAddress_0.bytes.buffer instanceof ArrayBuffer && callerAddress_0.bytes.BYTES_PER_ELEMENT === 1 && callerAddress_0.bytes.length === 32)) {
|
|
507
|
-
__compactRuntime.typeError('constructSignBidirectionalNotificationV1',
|
|
508
|
-
'argument 1',
|
|
509
|
-
'Signet.compact line 132 char 3',
|
|
510
|
-
'struct ContractAddress<bytes: Bytes<32>>',
|
|
511
|
-
callerAddress_0)
|
|
512
|
-
}
|
|
513
|
-
if (!(requestId_0.buffer instanceof ArrayBuffer && requestId_0.BYTES_PER_ELEMENT === 1 && requestId_0.length === 32)) {
|
|
514
|
-
__compactRuntime.typeError('constructSignBidirectionalNotificationV1',
|
|
515
|
-
'argument 2',
|
|
516
|
-
'Signet.compact line 132 char 3',
|
|
517
|
-
'Bytes<32>',
|
|
518
|
-
requestId_0)
|
|
519
|
-
}
|
|
520
|
-
if (!(typeof(requestsIndexField_0) === 'bigint' && requestsIndexField_0 >= 0n && requestsIndexField_0 <= 255n)) {
|
|
521
|
-
__compactRuntime.typeError('constructSignBidirectionalNotificationV1',
|
|
522
|
-
'argument 3',
|
|
523
|
-
'Signet.compact line 132 char 3',
|
|
524
|
-
'Uint<0..256>',
|
|
525
|
-
requestsIndexField_0)
|
|
526
|
-
}
|
|
527
|
-
return _dummyContract._constructSignBidirectionalNotificationV1_0(callerAddress_0,
|
|
528
|
-
requestId_0,
|
|
529
|
-
requestsIndexField_0);
|
|
530
|
-
},
|
|
531
|
-
evmAddressAbiValue: (...args_0) => {
|
|
532
|
-
if (args_0.length !== 1) {
|
|
533
|
-
throw new __compactRuntime.CompactError(`evmAddressAbiValue: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
|
|
534
|
-
}
|
|
535
|
-
const addr_0 = args_0[0];
|
|
536
|
-
if (!(addr_0.buffer instanceof ArrayBuffer && addr_0.BYTES_PER_ELEMENT === 1 && addr_0.length === 20)) {
|
|
537
|
-
__compactRuntime.typeError('evmAddressAbiValue',
|
|
538
|
-
'argument 1',
|
|
539
|
-
'Signet.compact line 233 char 3',
|
|
540
|
-
'Bytes<20>',
|
|
541
|
-
addr_0)
|
|
542
|
-
}
|
|
543
|
-
return _dummyContract._evmAddressAbiValue_0(addr_0);
|
|
544
|
-
},
|
|
545
|
-
signetAttestationMessage: (...args_0) => {
|
|
546
|
-
if (args_0.length !== 3) {
|
|
547
|
-
throw new __compactRuntime.CompactError(`signetAttestationMessage: expected 3 arguments (as invoked from Typescript), received ${args_0.length}`);
|
|
548
|
-
}
|
|
549
|
-
const requestId_0 = args_0[0];
|
|
550
|
-
const serializedOutput_0 = args_0[1];
|
|
551
|
-
const outputLen_0 = args_0[2];
|
|
552
|
-
if (!(requestId_0.buffer instanceof ArrayBuffer && requestId_0.BYTES_PER_ELEMENT === 1 && requestId_0.length === 32)) {
|
|
553
|
-
__compactRuntime.typeError('signetAttestationMessage',
|
|
554
|
-
'argument 1',
|
|
555
|
-
'Signet.compact line 361 char 3',
|
|
556
|
-
'Bytes<32>',
|
|
557
|
-
requestId_0)
|
|
558
|
-
}
|
|
559
|
-
if (!(serializedOutput_0.buffer instanceof ArrayBuffer && serializedOutput_0.BYTES_PER_ELEMENT === 1 && serializedOutput_0.length === 128)) {
|
|
560
|
-
__compactRuntime.typeError('signetAttestationMessage',
|
|
561
|
-
'argument 2',
|
|
562
|
-
'Signet.compact line 361 char 3',
|
|
563
|
-
'Bytes<128>',
|
|
564
|
-
serializedOutput_0)
|
|
565
|
-
}
|
|
566
|
-
if (!(typeof(outputLen_0) === 'bigint' && outputLen_0 >= 0n && outputLen_0 <= 255n)) {
|
|
567
|
-
__compactRuntime.typeError('signetAttestationMessage',
|
|
568
|
-
'argument 3',
|
|
569
|
-
'Signet.compact line 361 char 3',
|
|
570
|
-
'Uint<0..256>',
|
|
571
|
-
outputLen_0)
|
|
572
|
-
}
|
|
573
|
-
return _dummyContract._signetAttestationMessage_0(requestId_0,
|
|
574
|
-
serializedOutput_0,
|
|
575
|
-
outputLen_0);
|
|
576
|
-
},
|
|
577
|
-
assertHexOf: (...args_0) => {
|
|
578
|
-
if (args_0.length !== 2) {
|
|
579
|
-
throw new __compactRuntime.CompactError(`assertHexOf: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
|
|
580
|
-
}
|
|
581
|
-
const commitment_0 = args_0[0];
|
|
582
|
-
const hexStr_0 = args_0[1];
|
|
583
|
-
if (!(commitment_0.buffer instanceof ArrayBuffer && commitment_0.BYTES_PER_ELEMENT === 1 && commitment_0.length === 32)) {
|
|
584
|
-
__compactRuntime.typeError('assertHexOf',
|
|
585
|
-
'argument 1',
|
|
586
|
-
'Signet.compact line 400 char 3',
|
|
587
|
-
'Bytes<32>',
|
|
588
|
-
commitment_0)
|
|
589
|
-
}
|
|
590
|
-
if (!(hexStr_0.buffer instanceof ArrayBuffer && hexStr_0.BYTES_PER_ELEMENT === 1 && hexStr_0.length === 64)) {
|
|
591
|
-
__compactRuntime.typeError('assertHexOf',
|
|
592
|
-
'argument 2',
|
|
593
|
-
'Signet.compact line 400 char 3',
|
|
594
|
-
'Bytes<64>',
|
|
595
|
-
hexStr_0)
|
|
596
|
-
}
|
|
597
|
-
return _dummyContract._assertHexOf_0(commitment_0, hexStr_0);
|
|
598
|
-
},
|
|
599
|
-
assertPathCommitment: (...args_0) => {
|
|
600
|
-
if (args_0.length !== 2) {
|
|
601
|
-
throw new __compactRuntime.CompactError(`assertPathCommitment: expected 2 arguments (as invoked from Typescript), received ${args_0.length}`);
|
|
602
|
-
}
|
|
603
|
-
const commitment_0 = args_0[0];
|
|
604
|
-
const path_0 = args_0[1];
|
|
605
|
-
if (!(commitment_0.buffer instanceof ArrayBuffer && commitment_0.BYTES_PER_ELEMENT === 1 && commitment_0.length === 32)) {
|
|
606
|
-
__compactRuntime.typeError('assertPathCommitment',
|
|
607
|
-
'argument 1',
|
|
608
|
-
'Signet.compact line 415 char 3',
|
|
609
|
-
'Bytes<32>',
|
|
610
|
-
commitment_0)
|
|
611
|
-
}
|
|
612
|
-
if (!(path_0.buffer instanceof ArrayBuffer && path_0.BYTES_PER_ELEMENT === 1 && path_0.length === 256)) {
|
|
613
|
-
__compactRuntime.typeError('assertPathCommitment',
|
|
614
|
-
'argument 2',
|
|
615
|
-
'Signet.compact line 415 char 3',
|
|
616
|
-
'Bytes<256>',
|
|
617
|
-
path_0)
|
|
618
|
-
}
|
|
619
|
-
return _dummyContract._assertPathCommitment_0(commitment_0, path_0);
|
|
620
|
-
},
|
|
621
|
-
schnorrChallenge: (...args_0) => {
|
|
622
|
-
if (args_0.length !== 5) {
|
|
623
|
-
throw new __compactRuntime.CompactError(`schnorrChallenge: expected 5 arguments (as invoked from Typescript), received ${args_0.length}`);
|
|
624
|
-
}
|
|
625
|
-
const ann_x_0 = args_0[0];
|
|
626
|
-
const ann_y_0 = args_0[1];
|
|
627
|
-
const pk_x_0 = args_0[2];
|
|
628
|
-
const pk_y_0 = args_0[3];
|
|
629
|
-
const msg_0 = args_0[4];
|
|
630
|
-
if (!(typeof(ann_x_0) === 'bigint' && ann_x_0 >= 0 && ann_x_0 <= __compactRuntime.MAX_FIELD)) {
|
|
631
|
-
__compactRuntime.typeError('schnorrChallenge',
|
|
632
|
-
'argument 1',
|
|
633
|
-
'Schnorr.compact line 50 char 3',
|
|
634
|
-
'Field',
|
|
635
|
-
ann_x_0)
|
|
636
|
-
}
|
|
637
|
-
if (!(typeof(ann_y_0) === 'bigint' && ann_y_0 >= 0 && ann_y_0 <= __compactRuntime.MAX_FIELD)) {
|
|
638
|
-
__compactRuntime.typeError('schnorrChallenge',
|
|
639
|
-
'argument 2',
|
|
640
|
-
'Schnorr.compact line 50 char 3',
|
|
641
|
-
'Field',
|
|
642
|
-
ann_y_0)
|
|
643
|
-
}
|
|
644
|
-
if (!(typeof(pk_x_0) === 'bigint' && pk_x_0 >= 0 && pk_x_0 <= __compactRuntime.MAX_FIELD)) {
|
|
645
|
-
__compactRuntime.typeError('schnorrChallenge',
|
|
646
|
-
'argument 3',
|
|
647
|
-
'Schnorr.compact line 50 char 3',
|
|
648
|
-
'Field',
|
|
649
|
-
pk_x_0)
|
|
650
|
-
}
|
|
651
|
-
if (!(typeof(pk_y_0) === 'bigint' && pk_y_0 >= 0 && pk_y_0 <= __compactRuntime.MAX_FIELD)) {
|
|
652
|
-
__compactRuntime.typeError('schnorrChallenge',
|
|
653
|
-
'argument 4',
|
|
654
|
-
'Schnorr.compact line 50 char 3',
|
|
655
|
-
'Field',
|
|
656
|
-
pk_y_0)
|
|
657
|
-
}
|
|
658
|
-
if (!(Array.isArray(msg_0) && msg_0.length === 4 && msg_0.every((t) => typeof(t) === 'bigint' && t >= 0 && t <= __compactRuntime.MAX_FIELD))) {
|
|
659
|
-
__compactRuntime.typeError('schnorrChallenge',
|
|
660
|
-
'argument 5',
|
|
661
|
-
'Schnorr.compact line 50 char 3',
|
|
662
|
-
'Vector<4, Field>',
|
|
663
|
-
msg_0)
|
|
664
|
-
}
|
|
665
|
-
return _dummyContract._schnorrChallenge_0(ann_x_0,
|
|
666
|
-
ann_y_0,
|
|
667
|
-
pk_x_0,
|
|
668
|
-
pk_y_0,
|
|
669
|
-
msg_0);
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
export const contractReferenceLocations =
|
|
673
|
-
{ tag: 'publicLedgerArray', indices: { } };
|
|
674
|
-
export const expectedVk = {};
|
|
675
|
-
|
|
676
|
-
//# sourceMappingURL=index.js.map
|