@ome-labs/wasm 0.0.0 → 0.1.0

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.
@@ -0,0 +1,1522 @@
1
+ /* @ts-self-types="./ome_wasm.d.ts" */
2
+
3
+ /**
4
+ * An opened signing key. It signs only proposals `ome-protocol` accepts, and is wiped when freed.
5
+ */
6
+ class UnlockedSigner {
7
+ static __wrap(ptr) {
8
+ ptr = ptr >>> 0;
9
+ const obj = Object.create(UnlockedSigner.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ UnlockedSignerFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ UnlockedSignerFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_unlockedsigner_free(ptr, 0);
23
+ }
24
+ /**
25
+ * Approves a proposal after checking it (as `checkProposal`); a rotation is refused here, see `approveRotation`.
26
+ * Returns the approval to store with the keeper.
27
+ * @param {VaultInput} vault
28
+ * @param {Chain} chain
29
+ * @param {HexBytes} proposal
30
+ * @param {HexBytes} payload
31
+ * @param {number} now
32
+ * @returns {HexBytes}
33
+ */
34
+ approve(vault, chain, proposal, payload, now) {
35
+ try {
36
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
37
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ const ptr1 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
40
+ const len1 = WASM_VECTOR_LEN;
41
+ wasm.unlockedsigner_approve(retptr, this.__wbg_ptr, addHeapObject(vault), addHeapObject(chain), ptr0, len0, ptr1, len1, now);
42
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
43
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
44
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
45
+ if (r2) {
46
+ throw takeObject(r1);
47
+ }
48
+ return takeObject(r0);
49
+ } finally {
50
+ wasm.__wbindgen_add_to_stack_pointer(16);
51
+ }
52
+ }
53
+ /**
54
+ * Approves a membership rotation the member reviewed: the payload must be the `rotate_membership` call for
55
+ * `rotation`, plus at most fee payment calls to one of `feePayers` (the fee payer contracts this member's own
56
+ * configuration trusts), and the rotation must pass the contract's rules and hold the vault's key.
57
+ * @param {VaultInput} vault
58
+ * @param {Chain} chain
59
+ * @param {HexBytes} proposal
60
+ * @param {HexBytes} payload
61
+ * @param {Rotation} rotation
62
+ * @param {Hex32[]} feePayers
63
+ * @param {number} now
64
+ * @returns {HexBytes}
65
+ */
66
+ approveRotation(vault, chain, proposal, payload, rotation, feePayers, now) {
67
+ try {
68
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
69
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
70
+ const len0 = WASM_VECTOR_LEN;
71
+ const ptr1 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
72
+ const len1 = WASM_VECTOR_LEN;
73
+ wasm.unlockedsigner_approveRotation(retptr, this.__wbg_ptr, addHeapObject(vault), addHeapObject(chain), ptr0, len0, ptr1, len1, addHeapObject(rotation), addHeapObject(feePayers), now);
74
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
75
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
76
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
77
+ if (r2) {
78
+ throw takeObject(r1);
79
+ }
80
+ return takeObject(r0);
81
+ } finally {
82
+ wasm.__wbindgen_add_to_stack_pointer(16);
83
+ }
84
+ }
85
+ /**
86
+ * Approves a signer swap: the payload must be one `rotate_membership` call that replaces one member's key and
87
+ * changes nothing else, plus at most fee payment calls to one of `feePayers`. Returns the approval to store with
88
+ * the keeper.
89
+ * @param {VaultInput} vault
90
+ * @param {Chain} chain
91
+ * @param {HexBytes} proposal
92
+ * @param {HexBytes} payload
93
+ * @param {Hex32[]} feePayers
94
+ * @param {number} now
95
+ * @returns {HexBytes}
96
+ */
97
+ approveSignerSwap(vault, chain, proposal, payload, feePayers, now) {
98
+ try {
99
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
100
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
101
+ const len0 = WASM_VECTOR_LEN;
102
+ const ptr1 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
103
+ const len1 = WASM_VECTOR_LEN;
104
+ wasm.unlockedsigner_approveSignerSwap(retptr, this.__wbg_ptr, addHeapObject(vault), addHeapObject(chain), ptr0, len0, ptr1, len1, addHeapObject(feePayers), now);
105
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
106
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
107
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
108
+ if (r2) {
109
+ throw takeObject(r1);
110
+ }
111
+ return takeObject(r0);
112
+ } finally {
113
+ wasm.__wbindgen_add_to_stack_pointer(16);
114
+ }
115
+ }
116
+ /**
117
+ * Opens a sealed signer.
118
+ * @param {string} sealed
119
+ * @param {Secret} secret
120
+ * @returns {UnlockedSigner}
121
+ */
122
+ static open(sealed, secret) {
123
+ try {
124
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
125
+ const ptr0 = passStringToWasm0(sealed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
126
+ const len0 = WASM_VECTOR_LEN;
127
+ wasm.unlockedsigner_open(retptr, ptr0, len0, addHeapObject(secret));
128
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
129
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
130
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
131
+ if (r2) {
132
+ throw takeObject(r1);
133
+ }
134
+ return UnlockedSigner.__wrap(r0);
135
+ } finally {
136
+ wasm.__wbindgen_add_to_stack_pointer(16);
137
+ }
138
+ }
139
+ /**
140
+ * The public key, as it appears in the vault's signer set.
141
+ * @returns {Point}
142
+ */
143
+ publicKey() {
144
+ try {
145
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
146
+ wasm.unlockedsigner_publicKey(retptr, this.__wbg_ptr);
147
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
148
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
149
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
150
+ if (r2) {
151
+ throw takeObject(r1);
152
+ }
153
+ return takeObject(r0);
154
+ } finally {
155
+ wasm.__wbindgen_add_to_stack_pointer(16);
156
+ }
157
+ }
158
+ /**
159
+ * Rejects a proposal with a reason shown to the other members. Returns the rejection to store with the keeper.
160
+ * @param {VaultInput} vault
161
+ * @param {HexBytes} proposal
162
+ * @param {string} reason
163
+ * @returns {HexBytes}
164
+ */
165
+ reject(vault, proposal, reason) {
166
+ try {
167
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
168
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
169
+ const len0 = WASM_VECTOR_LEN;
170
+ const ptr1 = passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
171
+ const len1 = WASM_VECTOR_LEN;
172
+ wasm.unlockedsigner_reject(retptr, this.__wbg_ptr, addHeapObject(vault), ptr0, len0, ptr1, len1);
173
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
174
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
175
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
176
+ if (r2) {
177
+ throw takeObject(r1);
178
+ }
179
+ return takeObject(r0);
180
+ } finally {
181
+ wasm.__wbindgen_add_to_stack_pointer(16);
182
+ }
183
+ }
184
+ }
185
+ if (Symbol.dispose) UnlockedSigner.prototype[Symbol.dispose] = UnlockedSigner.prototype.free;
186
+ exports.UnlockedSigner = UnlockedSigner;
187
+
188
+ /**
189
+ * The address context of a preaddress and group incoming viewing key: the vault address and the sign Aztec applies.
190
+ * @param {Hex32} preaddress
191
+ * @param {Point} ivpk
192
+ * @returns {AddressContext}
193
+ */
194
+ function addressContext(preaddress, ivpk) {
195
+ try {
196
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
197
+ const ptr0 = passStringToWasm0(preaddress, wasm.__wbindgen_export, wasm.__wbindgen_export2);
198
+ const len0 = WASM_VECTOR_LEN;
199
+ wasm.addressContext(retptr, ptr0, len0, addHeapObject(ivpk));
200
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
201
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
202
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
203
+ if (r2) {
204
+ throw takeObject(r1);
205
+ }
206
+ return takeObject(r0);
207
+ } finally {
208
+ wasm.__wbindgen_add_to_stack_pointer(16);
209
+ }
210
+ }
211
+ exports.addressContext = addressContext;
212
+
213
+ /**
214
+ * Each member's public share of the address secret, `A_i`, from its verification share, in member order.
215
+ * @param {Hex32} preaddress
216
+ * @param {Point} ivpk
217
+ * @param {Point[]} verificationShares
218
+ * @returns {Point[]}
219
+ */
220
+ function addressPublicShares(preaddress, ivpk, verificationShares) {
221
+ try {
222
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
223
+ const ptr0 = passStringToWasm0(preaddress, wasm.__wbindgen_export, wasm.__wbindgen_export2);
224
+ const len0 = WASM_VECTOR_LEN;
225
+ wasm.addressPublicShares(retptr, ptr0, len0, addHeapObject(ivpk), addHeapObject(verificationShares));
226
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
227
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
228
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
229
+ if (r2) {
230
+ throw takeObject(r1);
231
+ }
232
+ return takeObject(r0);
233
+ } finally {
234
+ wasm.__wbindgen_add_to_stack_pointer(16);
235
+ }
236
+ }
237
+ exports.addressPublicShares = addressPublicShares;
238
+
239
+ /**
240
+ * The entrypoint's app payload hash (the authwit's inner hash).
241
+ * @param {Call[]} calls
242
+ * @param {Hex32} txNonce
243
+ * @returns {Hex32}
244
+ */
245
+ function appPayloadHash(calls, txNonce) {
246
+ try {
247
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
+ const ptr0 = passStringToWasm0(txNonce, wasm.__wbindgen_export, wasm.__wbindgen_export2);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ wasm.appPayloadHash(retptr, addHeapObject(calls), ptr0, len0);
251
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
252
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
253
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
254
+ if (r2) {
255
+ throw takeObject(r1);
256
+ }
257
+ return takeObject(r0);
258
+ } finally {
259
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
+ }
261
+ }
262
+ exports.appPayloadHash = appPayloadHash;
263
+
264
+ /**
265
+ * What each signer signs to approve: `Poseidon2("ome.approval.v0", [vault, outerHash, configVersion, expiresAt])`.
266
+ * @param {Hex32} vault
267
+ * @param {Hex32} outerHash
268
+ * @param {number} configVersion
269
+ * @param {number} expiresAt
270
+ * @returns {Hex32}
271
+ */
272
+ function approvalMessage(vault, outerHash, configVersion, expiresAt) {
273
+ try {
274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
275
+ const ptr0 = passStringToWasm0(vault, wasm.__wbindgen_export, wasm.__wbindgen_export2);
276
+ const len0 = WASM_VECTOR_LEN;
277
+ const ptr1 = passStringToWasm0(outerHash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
278
+ const len1 = WASM_VECTOR_LEN;
279
+ wasm.approvalMessage(retptr, ptr0, len0, ptr1, len1, configVersion, expiresAt);
280
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
281
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
282
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
283
+ if (r2) {
284
+ throw takeObject(r1);
285
+ }
286
+ return takeObject(r0);
287
+ } finally {
288
+ wasm.__wbindgen_add_to_stack_pointer(16);
289
+ }
290
+ }
291
+ exports.approvalMessage = approvalMessage;
292
+
293
+ /**
294
+ * Builds a proposal and its payload from a draft, computing the outer hash from the calls.
295
+ * @param {VaultInput} vault
296
+ * @param {Chain} chain
297
+ * @param {Draft} draft
298
+ * @returns {BuiltProposal}
299
+ */
300
+ function buildProposal(vault, chain, draft) {
301
+ try {
302
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
303
+ wasm.buildProposal(retptr, addHeapObject(vault), addHeapObject(chain), addHeapObject(draft));
304
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
305
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
306
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
307
+ if (r2) {
308
+ throw takeObject(r1);
309
+ }
310
+ return takeObject(r0);
311
+ } finally {
312
+ wasm.__wbindgen_add_to_stack_pointer(16);
313
+ }
314
+ }
315
+ exports.buildProposal = buildProposal;
316
+
317
+ /**
318
+ * Checks a received proposal before review: the payload is the one referenced, hashes to the outer hash on this vault
319
+ * and chain, the config is current, the deadline has not passed and fees stay off the vault. Returns the calls.
320
+ * @param {VaultInput} vault
321
+ * @param {Chain} chain
322
+ * @param {HexBytes} proposal
323
+ * @param {HexBytes} payload
324
+ * @param {number} now
325
+ * @returns {ExecutionRequest}
326
+ */
327
+ function checkProposal(vault, chain, proposal, payload, now) {
328
+ try {
329
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
330
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
+ const len0 = WASM_VECTOR_LEN;
332
+ const ptr1 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
333
+ const len1 = WASM_VECTOR_LEN;
334
+ wasm.checkProposal(retptr, addHeapObject(vault), addHeapObject(chain), ptr0, len0, ptr1, len1, now);
335
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
336
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
337
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
338
+ if (r2) {
339
+ throw takeObject(r1);
340
+ }
341
+ return takeObject(r0);
342
+ } finally {
343
+ wasm.__wbindgen_add_to_stack_pointer(16);
344
+ }
345
+ }
346
+ exports.checkProposal = checkProposal;
347
+
348
+ /**
349
+ * Checks a rotation against the vault as the contract would, and returns the config it would store.
350
+ * @param {VaultInput} vault
351
+ * @param {Rotation} rotation
352
+ * @returns {VaultConfig}
353
+ */
354
+ function checkRotation(vault, rotation) {
355
+ try {
356
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
357
+ wasm.checkRotation(retptr, addHeapObject(vault), addHeapObject(rotation));
358
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
359
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
360
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
361
+ if (r2) {
362
+ throw takeObject(r1);
363
+ }
364
+ return takeObject(r0);
365
+ } finally {
366
+ wasm.__wbindgen_add_to_stack_pointer(16);
367
+ }
368
+ }
369
+ exports.checkRotation = checkRotation;
370
+
371
+ /**
372
+ * The commitment to the viewing committee: `t_v` and the verification shares in member order.
373
+ * @param {number} viewingThreshold
374
+ * @param {Point[]} shares
375
+ * @returns {Hex32}
376
+ */
377
+ function committeeCommitment(viewingThreshold, shares) {
378
+ try {
379
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
380
+ wasm.committeeCommitment(retptr, viewingThreshold, addHeapObject(shares));
381
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
382
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
383
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
384
+ if (r2) {
385
+ throw takeObject(r1);
386
+ }
387
+ return takeObject(r0);
388
+ } finally {
389
+ wasm.__wbindgen_add_to_stack_pointer(16);
390
+ }
391
+ }
392
+ exports.committeeCommitment = committeeCommitment;
393
+
394
+ /**
395
+ * The Feldman commitments of a committee's polynomial, `C_0 … C_{t_v - 1}`: the `committee_polynomial` argument of
396
+ * `rotate_membership`, which the contract checks every share against and `C_0` against the vault's `Ivpk`.
397
+ * @param {number} viewingThreshold
398
+ * @param {Point[]} verificationShares
399
+ * @returns {Point[]}
400
+ */
401
+ function committeePolynomial(viewingThreshold, verificationShares) {
402
+ try {
403
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
404
+ wasm.committeePolynomial(retptr, viewingThreshold, addHeapObject(verificationShares));
405
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
406
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
407
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
408
+ if (r2) {
409
+ throw takeObject(r1);
410
+ }
411
+ return takeObject(r0);
412
+ } finally {
413
+ wasm.__wbindgen_add_to_stack_pointer(16);
414
+ }
415
+ }
416
+ exports.committeePolynomial = committeePolynomial;
417
+
418
+ /**
419
+ * Splits `secret` into `members` viewing shares with threshold `threshold`.
420
+ * @param {Hex32} secret
421
+ * @param {number} threshold
422
+ * @param {number} members
423
+ * @returns {DealtCommittee}
424
+ */
425
+ function dealShares(secret, threshold, members) {
426
+ try {
427
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
428
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
429
+ const len0 = WASM_VECTOR_LEN;
430
+ wasm.dealShares(retptr, ptr0, len0, threshold, members);
431
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
432
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
433
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
434
+ if (r2) {
435
+ throw takeObject(r1);
436
+ }
437
+ return takeObject(r0);
438
+ } finally {
439
+ wasm.__wbindgen_add_to_stack_pointer(16);
440
+ }
441
+ }
442
+ exports.dealShares = dealShares;
443
+
444
+ /**
445
+ * An approval's fields. The signature is not checked; see [`verify_approval`].
446
+ * @param {HexBytes} approval
447
+ * @returns {ApprovalInfo}
448
+ */
449
+ function decodeApproval(approval) {
450
+ try {
451
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
452
+ const ptr0 = passStringToWasm0(approval, wasm.__wbindgen_export, wasm.__wbindgen_export2);
453
+ const len0 = WASM_VECTOR_LEN;
454
+ wasm.decodeApproval(retptr, ptr0, len0);
455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
457
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
458
+ if (r2) {
459
+ throw takeObject(r1);
460
+ }
461
+ return takeObject(r0);
462
+ } finally {
463
+ wasm.__wbindgen_add_to_stack_pointer(16);
464
+ }
465
+ }
466
+ exports.decodeApproval = decodeApproval;
467
+
468
+ /**
469
+ * The newcomer a join request names, after checking that its keeper signed it. The member planning the rotation
470
+ * still confirms out of band that it came from the person they mean to add.
471
+ * @param {string} request
472
+ * @returns {Joiner}
473
+ */
474
+ function decodeJoinRequest(request) {
475
+ try {
476
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
477
+ const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ wasm.decodeJoinRequest(retptr, ptr0, len0);
480
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
481
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
482
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
483
+ if (r2) {
484
+ throw takeObject(r1);
485
+ }
486
+ return takeObject(r0);
487
+ } finally {
488
+ wasm.__wbindgen_add_to_stack_pointer(16);
489
+ }
490
+ }
491
+ exports.decodeJoinRequest = decodeJoinRequest;
492
+
493
+ /**
494
+ * A proposal's fields.
495
+ * @param {HexBytes} proposal
496
+ * @returns {ProposalInfo}
497
+ */
498
+ function decodeProposal(proposal) {
499
+ try {
500
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
501
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
502
+ const len0 = WASM_VECTOR_LEN;
503
+ wasm.decodeProposal(retptr, ptr0, len0);
504
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
505
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
506
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
507
+ if (r2) {
508
+ throw takeObject(r1);
509
+ }
510
+ return takeObject(r0);
511
+ } finally {
512
+ wasm.__wbindgen_add_to_stack_pointer(16);
513
+ }
514
+ }
515
+ exports.decodeProposal = decodeProposal;
516
+
517
+ /**
518
+ * A rejection's fields. The signature is not checked; see [`verify_rejection`].
519
+ * @param {HexBytes} rejection
520
+ * @returns {RejectionInfo}
521
+ */
522
+ function decodeRejection(rejection) {
523
+ try {
524
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
525
+ const ptr0 = passStringToWasm0(rejection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
526
+ const len0 = WASM_VECTOR_LEN;
527
+ wasm.decodeRejection(retptr, ptr0, len0);
528
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
529
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
530
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
531
+ if (r2) {
532
+ throw takeObject(r1);
533
+ }
534
+ return takeObject(r0);
535
+ } finally {
536
+ wasm.__wbindgen_add_to_stack_pointer(16);
537
+ }
538
+ }
539
+ exports.decodeRejection = decodeRejection;
540
+
541
+ /**
542
+ * The 49-field auth witness: signer keys, one signature per slot (`null` where the signer did not approve) and the
543
+ * deadline.
544
+ * @param {Point[]} signerKeys
545
+ * @param {(Hex64 | null)[]} signatures
546
+ * @param {number} expiresAt
547
+ * @returns {Hex32[]}
548
+ */
549
+ function encodeWitness(signerKeys, signatures, expiresAt) {
550
+ try {
551
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
552
+ wasm.encodeWitness(retptr, addHeapObject(signerKeys), addHeapObject(signatures), expiresAt);
553
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
554
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
555
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
556
+ if (r2) {
557
+ throw takeObject(r1);
558
+ }
559
+ return takeObject(r0);
560
+ } finally {
561
+ wasm.__wbindgen_add_to_stack_pointer(16);
562
+ }
563
+ }
564
+ exports.encodeWitness = encodeWitness;
565
+
566
+ /**
567
+ * The tagging secret for the vault's own unconstrained notes in committee epoch `epoch`, derived from that epoch's
568
+ * ceremony transcript (the founding DKG, then each reshare), so a member removed earlier cannot derive it.
569
+ * @param {Hex32} vault
570
+ * @param {number} epoch
571
+ * @param {Hex64} transcript
572
+ * @returns {Point}
573
+ */
574
+ function epochTaggingSecret(vault, epoch, transcript) {
575
+ try {
576
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
577
+ const ptr0 = passStringToWasm0(vault, wasm.__wbindgen_export, wasm.__wbindgen_export2);
578
+ const len0 = WASM_VECTOR_LEN;
579
+ const ptr1 = passStringToWasm0(transcript, wasm.__wbindgen_export, wasm.__wbindgen_export2);
580
+ const len1 = WASM_VECTOR_LEN;
581
+ wasm.epochTaggingSecret(retptr, ptr0, len0, epoch, ptr1, len1);
582
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
583
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
584
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
585
+ if (r2) {
586
+ throw takeObject(r1);
587
+ }
588
+ return takeObject(r0);
589
+ } finally {
590
+ wasm.__wbindgen_add_to_stack_pointer(16);
591
+ }
592
+ }
593
+ exports.epochTaggingSecret = epochTaggingSecret;
594
+
595
+ /**
596
+ * Generates a signing key and returns it sealed (the JSON document to store). A passphrase seals with Argon2id.
597
+ * @param {Secret} secret
598
+ * @returns {string}
599
+ */
600
+ function generateSigner(secret) {
601
+ let deferred2_0;
602
+ let deferred2_1;
603
+ try {
604
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
605
+ wasm.generateSigner(retptr, addHeapObject(secret));
606
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
607
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
608
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
609
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
610
+ var ptr1 = r0;
611
+ var len1 = r1;
612
+ if (r3) {
613
+ ptr1 = 0; len1 = 0;
614
+ throw takeObject(r2);
615
+ }
616
+ deferred2_0 = ptr1;
617
+ deferred2_1 = len1;
618
+ return getStringFromWasm0(ptr1, len1);
619
+ } finally {
620
+ wasm.__wbindgen_add_to_stack_pointer(16);
621
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
622
+ }
623
+ }
624
+ exports.generateSigner = generateSigner;
625
+
626
+ /**
627
+ * The outer hash the vault authorizes for `calls` with `txNonce` on `vault` and `chain`.
628
+ * @param {Hex32} vault
629
+ * @param {Chain} chain
630
+ * @param {Hex32} txNonce
631
+ * @param {Call[]} calls
632
+ * @returns {Hex32}
633
+ */
634
+ function outerHash(vault, chain, txNonce, calls) {
635
+ try {
636
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
637
+ const ptr0 = passStringToWasm0(vault, wasm.__wbindgen_export, wasm.__wbindgen_export2);
638
+ const len0 = WASM_VECTOR_LEN;
639
+ const ptr1 = passStringToWasm0(txNonce, wasm.__wbindgen_export, wasm.__wbindgen_export2);
640
+ const len1 = WASM_VECTOR_LEN;
641
+ wasm.outerHash(retptr, ptr0, len0, addHeapObject(chain), ptr1, len1, addHeapObject(calls));
642
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
643
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
644
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
645
+ if (r2) {
646
+ throw takeObject(r1);
647
+ }
648
+ return takeObject(r0);
649
+ } finally {
650
+ wasm.__wbindgen_add_to_stack_pointer(16);
651
+ }
652
+ }
653
+ exports.outerHash = outerHash;
654
+
655
+ /**
656
+ * Member `index`'s partials for `inputs`, as its keeper would answer `ecdh.batch`.
657
+ * @param {number} index
658
+ * @param {Hex32} share
659
+ * @param {Hex32} preaddress
660
+ * @param {Point} ivpk
661
+ * @param {number} epoch
662
+ * @param {Point[]} inputs
663
+ * @returns {MemberPartials}
664
+ */
665
+ function partials(index, share, preaddress, ivpk, epoch, inputs) {
666
+ try {
667
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
668
+ const ptr0 = passStringToWasm0(share, wasm.__wbindgen_export, wasm.__wbindgen_export2);
669
+ const len0 = WASM_VECTOR_LEN;
670
+ const ptr1 = passStringToWasm0(preaddress, wasm.__wbindgen_export, wasm.__wbindgen_export2);
671
+ const len1 = WASM_VECTOR_LEN;
672
+ wasm.partials(retptr, index, ptr0, len0, ptr1, len1, addHeapObject(ivpk), epoch, addHeapObject(inputs));
673
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
674
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
675
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
676
+ if (r2) {
677
+ throw takeObject(r1);
678
+ }
679
+ return takeObject(r0);
680
+ } finally {
681
+ wasm.__wbindgen_add_to_stack_pointer(16);
682
+ }
683
+ }
684
+ exports.partials = partials;
685
+
686
+ /**
687
+ * The risks of spending threshold `k`, viewing threshold `t_v` and `n` members. None blocks a vault.
688
+ * @param {number} threshold
689
+ * @param {number} viewingThreshold
690
+ * @param {number} members
691
+ * @returns {Warning[]}
692
+ */
693
+ function policyWarnings(threshold, viewingThreshold, members) {
694
+ try {
695
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
696
+ wasm.policyWarnings(retptr, threshold, viewingThreshold, members);
697
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
698
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
699
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
700
+ if (r2) {
701
+ throw takeObject(r1);
702
+ }
703
+ return takeObject(r0);
704
+ } finally {
705
+ wasm.__wbindgen_add_to_stack_pointer(16);
706
+ }
707
+ }
708
+ exports.policyWarnings = policyWarnings;
709
+
710
+ /**
711
+ * Aztec's preaddress `Poseidon2([publicKeysHash, partialAddress], 993442748)`.
712
+ * @param {Hex32} publicKeysHash
713
+ * @param {Hex32} partialAddress
714
+ * @returns {Hex32}
715
+ */
716
+ function preaddress(publicKeysHash, partialAddress) {
717
+ try {
718
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
719
+ const ptr0 = passStringToWasm0(publicKeysHash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
720
+ const len0 = WASM_VECTOR_LEN;
721
+ const ptr1 = passStringToWasm0(partialAddress, wasm.__wbindgen_export, wasm.__wbindgen_export2);
722
+ const len1 = WASM_VECTOR_LEN;
723
+ wasm.preaddress(retptr, ptr0, len0, ptr1, len1);
724
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
725
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
726
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
727
+ if (r2) {
728
+ throw takeObject(r1);
729
+ }
730
+ return takeObject(r0);
731
+ } finally {
732
+ wasm.__wbindgen_add_to_stack_pointer(16);
733
+ }
734
+ }
735
+ exports.preaddress = preaddress;
736
+
737
+ /**
738
+ * The public key of a raw secret key.
739
+ * @param {Hex32} secretKey
740
+ * @returns {Point}
741
+ */
742
+ function publicKey(secretKey) {
743
+ try {
744
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
745
+ const ptr0 = passStringToWasm0(secretKey, wasm.__wbindgen_export, wasm.__wbindgen_export2);
746
+ const len0 = WASM_VECTOR_LEN;
747
+ wasm.publicKey(retptr, ptr0, len0);
748
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
749
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
750
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
751
+ if (r2) {
752
+ throw takeObject(r1);
753
+ }
754
+ return takeObject(r0);
755
+ } finally {
756
+ wasm.__wbindgen_add_to_stack_pointer(16);
757
+ }
758
+ }
759
+ exports.publicKey = publicKey;
760
+
761
+ /**
762
+ * What a member signs to reject proposal `proposalId`.
763
+ * @param {Hex32} vault
764
+ * @param {Hex32} proposalId
765
+ * @returns {Hex32}
766
+ */
767
+ function rejectionMessage(vault, proposalId) {
768
+ try {
769
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
770
+ const ptr0 = passStringToWasm0(vault, wasm.__wbindgen_export, wasm.__wbindgen_export2);
771
+ const len0 = WASM_VECTOR_LEN;
772
+ const ptr1 = passStringToWasm0(proposalId, wasm.__wbindgen_export, wasm.__wbindgen_export2);
773
+ const len1 = WASM_VECTOR_LEN;
774
+ wasm.rejectionMessage(retptr, ptr0, len0, ptr1, len1);
775
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
776
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
777
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
778
+ if (r2) {
779
+ throw takeObject(r1);
780
+ }
781
+ return takeObject(r0);
782
+ } finally {
783
+ wasm.__wbindgen_add_to_stack_pointer(16);
784
+ }
785
+ }
786
+ exports.rejectionMessage = rejectionMessage;
787
+
788
+ /**
789
+ * The `rotate_membership` call that performs a rotation, to propose.
790
+ * @param {VaultInput} vault
791
+ * @param {Rotation} rotation
792
+ * @returns {Call}
793
+ */
794
+ function rotationCall(vault, rotation) {
795
+ try {
796
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
797
+ wasm.rotationCall(retptr, addHeapObject(vault), addHeapObject(rotation));
798
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
799
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
800
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
801
+ if (r2) {
802
+ throw takeObject(r1);
803
+ }
804
+ return takeObject(r0);
805
+ } finally {
806
+ wasm.__wbindgen_add_to_stack_pointer(16);
807
+ }
808
+ }
809
+ exports.rotationCall = rotationCall;
810
+
811
+ /**
812
+ * The public key of a sealed signer, readable without the secret.
813
+ * @param {string} sealed
814
+ * @returns {Point}
815
+ */
816
+ function sealedPublicKey(sealed) {
817
+ try {
818
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
819
+ const ptr0 = passStringToWasm0(sealed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
820
+ const len0 = WASM_VECTOR_LEN;
821
+ wasm.sealedPublicKey(retptr, ptr0, len0);
822
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
823
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
824
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
825
+ if (r2) {
826
+ throw takeObject(r1);
827
+ }
828
+ return takeObject(r0);
829
+ } finally {
830
+ wasm.__wbindgen_add_to_stack_pointer(16);
831
+ }
832
+ }
833
+ exports.sealedPublicKey = sealedPublicKey;
834
+
835
+ /**
836
+ * The key a passphrase derives for this sealed signer, checked by opening it. Keep it behind the platform's
837
+ * keychain or biometrics and unlock with `{ key }` without running Argon2id again.
838
+ * @param {string} sealed
839
+ * @param {string} passphrase
840
+ * @returns {Hex32}
841
+ */
842
+ function sealingKey(sealed, passphrase) {
843
+ try {
844
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
845
+ const ptr0 = passStringToWasm0(sealed, wasm.__wbindgen_export, wasm.__wbindgen_export2);
846
+ const len0 = WASM_VECTOR_LEN;
847
+ const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
848
+ const len1 = WASM_VECTOR_LEN;
849
+ wasm.sealingKey(retptr, ptr0, len0, ptr1, len1);
850
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
851
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
852
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
853
+ if (r2) {
854
+ throw takeObject(r1);
855
+ }
856
+ return takeObject(r0);
857
+ } finally {
858
+ wasm.__wbindgen_add_to_stack_pointer(16);
859
+ }
860
+ }
861
+ exports.sealingKey = sealingKey;
862
+
863
+ /**
864
+ * A function's selector from its signature, e.g. `transfer_private_to_private((Field),(Field),u128,Field)`.
865
+ * @param {string} signature
866
+ * @returns {number}
867
+ */
868
+ function selector(signature) {
869
+ try {
870
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
871
+ const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_export, wasm.__wbindgen_export2);
872
+ const len0 = WASM_VECTOR_LEN;
873
+ wasm.selector(retptr, ptr0, len0);
874
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
875
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
876
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
877
+ if (r2) {
878
+ throw takeObject(r1);
879
+ }
880
+ return r0 >>> 0;
881
+ } finally {
882
+ wasm.__wbindgen_add_to_stack_pointer(16);
883
+ }
884
+ }
885
+ exports.selector = selector;
886
+
887
+ /**
888
+ * A Schnorr signature over any field element with a raw key.
889
+ * @param {Hex32} secretKey
890
+ * @param {Hex32} message
891
+ * @returns {Hex64}
892
+ */
893
+ function sign(secretKey, message) {
894
+ try {
895
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
896
+ const ptr0 = passStringToWasm0(secretKey, wasm.__wbindgen_export, wasm.__wbindgen_export2);
897
+ const len0 = WASM_VECTOR_LEN;
898
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
899
+ const len1 = WASM_VECTOR_LEN;
900
+ wasm.sign(retptr, ptr0, len0, ptr1, len1);
901
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
902
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
903
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
904
+ if (r2) {
905
+ throw takeObject(r1);
906
+ }
907
+ return takeObject(r0);
908
+ } finally {
909
+ wasm.__wbindgen_add_to_stack_pointer(16);
910
+ }
911
+ }
912
+ exports.sign = sign;
913
+
914
+ /**
915
+ * The commitment to the ordered signer keys stored in the config note.
916
+ * @param {Point[]} keys
917
+ * @returns {Hex32}
918
+ */
919
+ function signerSetCommitment(keys) {
920
+ try {
921
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
922
+ wasm.signerSetCommitment(retptr, addHeapObject(keys));
923
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
924
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
925
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
926
+ if (r2) {
927
+ throw takeObject(r1);
928
+ }
929
+ return takeObject(r0);
930
+ } finally {
931
+ wasm.__wbindgen_add_to_stack_pointer(16);
932
+ }
933
+ }
934
+ exports.signerSetCommitment = signerSetCommitment;
935
+
936
+ /**
937
+ * The signer slot a payload's `rotate_membership` call swaps, if it is a signer swap of the vault (one key replaced,
938
+ * the committee and thresholds unchanged); `null` for a payload that rotates nothing or reshares.
939
+ * @param {VaultInput} vault
940
+ * @param {HexBytes} payload
941
+ * @returns {number | null}
942
+ */
943
+ function signerSwapSlot(vault, payload) {
944
+ try {
945
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
946
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
947
+ const len0 = WASM_VECTOR_LEN;
948
+ wasm.signerSwapSlot(retptr, addHeapObject(vault), ptr0, len0);
949
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
950
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
951
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
952
+ if (r2) {
953
+ throw takeObject(r1);
954
+ }
955
+ return takeObject(r0);
956
+ } finally {
957
+ wasm.__wbindgen_add_to_stack_pointer(16);
958
+ }
959
+ }
960
+ exports.signerSwapSlot = signerSwapSlot;
961
+
962
+ /**
963
+ * Counts the votes on a proposal at `now`: each slot's first valid vote counts, invalid ones are listed, and the
964
+ * witness is built once `k` members approved.
965
+ * @param {VaultInput} vault
966
+ * @param {HexBytes} proposal
967
+ * @param {HexBytes[]} approvals
968
+ * @param {HexBytes[]} rejections
969
+ * @param {number} now
970
+ * @returns {TallyResult}
971
+ */
972
+ function tally(vault, proposal, approvals, rejections, now) {
973
+ try {
974
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
975
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
976
+ const len0 = WASM_VECTOR_LEN;
977
+ wasm.tally(retptr, addHeapObject(vault), ptr0, len0, addHeapObject(approvals), addHeapObject(rejections), now);
978
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
979
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
980
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
981
+ if (r2) {
982
+ throw takeObject(r1);
983
+ }
984
+ return takeObject(r0);
985
+ } finally {
986
+ wasm.__wbindgen_add_to_stack_pointer(16);
987
+ }
988
+ }
989
+ exports.tally = tally;
990
+
991
+ /**
992
+ * Verifies every partial and combines `t_v` valid ones per input. Fails if an input lacks `t_v` valid partials.
993
+ * @param {CombineRequest} request
994
+ * @returns {CombineResult}
995
+ */
996
+ function verifyAndCombine(request) {
997
+ try {
998
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
999
+ wasm.verifyAndCombine(retptr, addHeapObject(request));
1000
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1001
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1002
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1003
+ if (r2) {
1004
+ throw takeObject(r1);
1005
+ }
1006
+ return takeObject(r0);
1007
+ } finally {
1008
+ wasm.__wbindgen_add_to_stack_pointer(16);
1009
+ }
1010
+ }
1011
+ exports.verifyAndCombine = verifyAndCombine;
1012
+
1013
+ /**
1014
+ * Throws unless `approval` is for `proposal` and signed by the key in its slot.
1015
+ * @param {VaultInput} vault
1016
+ * @param {HexBytes} proposal
1017
+ * @param {HexBytes} approval
1018
+ */
1019
+ function verifyApproval(vault, proposal, approval) {
1020
+ try {
1021
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1022
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1023
+ const len0 = WASM_VECTOR_LEN;
1024
+ const ptr1 = passStringToWasm0(approval, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1025
+ const len1 = WASM_VECTOR_LEN;
1026
+ wasm.verifyApproval(retptr, addHeapObject(vault), ptr0, len0, ptr1, len1);
1027
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1028
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1029
+ if (r1) {
1030
+ throw takeObject(r0);
1031
+ }
1032
+ } finally {
1033
+ wasm.__wbindgen_add_to_stack_pointer(16);
1034
+ }
1035
+ }
1036
+ exports.verifyApproval = verifyApproval;
1037
+
1038
+ /**
1039
+ * Throws unless `rejection` is for `proposal` and signed by the key in its slot.
1040
+ * @param {VaultInput} vault
1041
+ * @param {HexBytes} proposal
1042
+ * @param {HexBytes} rejection
1043
+ */
1044
+ function verifyRejection(vault, proposal, rejection) {
1045
+ try {
1046
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1047
+ const ptr0 = passStringToWasm0(proposal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1048
+ const len0 = WASM_VECTOR_LEN;
1049
+ const ptr1 = passStringToWasm0(rejection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1050
+ const len1 = WASM_VECTOR_LEN;
1051
+ wasm.verifyRejection(retptr, addHeapObject(vault), ptr0, len0, ptr1, len1);
1052
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1053
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1054
+ if (r1) {
1055
+ throw takeObject(r0);
1056
+ }
1057
+ } finally {
1058
+ wasm.__wbindgen_add_to_stack_pointer(16);
1059
+ }
1060
+ }
1061
+ exports.verifyRejection = verifyRejection;
1062
+
1063
+ /**
1064
+ * Throws unless the verification shares interpolate to `groupKey`: the reshared committee still holds the vault's
1065
+ * viewing key.
1066
+ * @param {Point} groupKey
1067
+ * @param {number} viewingThreshold
1068
+ * @param {Point[]} verificationShares
1069
+ */
1070
+ function verifyRotationShares(groupKey, viewingThreshold, verificationShares) {
1071
+ try {
1072
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1073
+ wasm.verifyRotationShares(retptr, addHeapObject(groupKey), viewingThreshold, addHeapObject(verificationShares));
1074
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1075
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1076
+ if (r1) {
1077
+ throw takeObject(r0);
1078
+ }
1079
+ } finally {
1080
+ wasm.__wbindgen_add_to_stack_pointer(16);
1081
+ }
1082
+ }
1083
+ exports.verifyRotationShares = verifyRotationShares;
1084
+
1085
+ function __wbg_get_imports() {
1086
+ const import0 = {
1087
+ __proto__: null,
1088
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
1089
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1090
+ return addHeapObject(ret);
1091
+ },
1092
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
1093
+ const ret = Number(getObject(arg0));
1094
+ return ret;
1095
+ },
1096
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
1097
+ const ret = String(getObject(arg1));
1098
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1099
+ const len1 = WASM_VECTOR_LEN;
1100
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1101
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1102
+ },
1103
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
1104
+ const v = getObject(arg1);
1105
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1106
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1107
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1108
+ },
1109
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
1110
+ const v = getObject(arg0);
1111
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1112
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1113
+ },
1114
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
1115
+ const ret = debugString(getObject(arg1));
1116
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1117
+ const len1 = WASM_VECTOR_LEN;
1118
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1119
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1120
+ },
1121
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
1122
+ const ret = getObject(arg0) in getObject(arg1);
1123
+ return ret;
1124
+ },
1125
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
1126
+ const ret = typeof(getObject(arg0)) === 'bigint';
1127
+ return ret;
1128
+ },
1129
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
1130
+ const ret = typeof(getObject(arg0)) === 'function';
1131
+ return ret;
1132
+ },
1133
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
1134
+ const val = getObject(arg0);
1135
+ const ret = typeof(val) === 'object' && val !== null;
1136
+ return ret;
1137
+ },
1138
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
1139
+ const ret = typeof(getObject(arg0)) === 'string';
1140
+ return ret;
1141
+ },
1142
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
1143
+ const ret = getObject(arg0) === undefined;
1144
+ return ret;
1145
+ },
1146
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
1147
+ const ret = getObject(arg0) === getObject(arg1);
1148
+ return ret;
1149
+ },
1150
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
1151
+ const ret = getObject(arg0) == getObject(arg1);
1152
+ return ret;
1153
+ },
1154
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
1155
+ const obj = getObject(arg1);
1156
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1157
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1158
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1159
+ },
1160
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
1161
+ const obj = getObject(arg1);
1162
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1163
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1164
+ var len1 = WASM_VECTOR_LEN;
1165
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1166
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1167
+ },
1168
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
1169
+ throw new Error(getStringFromWasm0(arg0, arg1));
1170
+ },
1171
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
1172
+ const ret = getObject(arg0).call(getObject(arg1));
1173
+ return addHeapObject(ret);
1174
+ }, arguments); },
1175
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
1176
+ const ret = getObject(arg0).done;
1177
+ return ret;
1178
+ },
1179
+ __wbg_entries_58c7934c745daac7: function(arg0) {
1180
+ const ret = Object.entries(getObject(arg0));
1181
+ return addHeapObject(ret);
1182
+ },
1183
+ __wbg_getRandomValues_a8ddca022803a145: function() { return handleError(function (arg0, arg1) {
1184
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1185
+ }, arguments); },
1186
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
1187
+ const ret = getObject(arg0)[arg1 >>> 0];
1188
+ return addHeapObject(ret);
1189
+ },
1190
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
1191
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1192
+ return addHeapObject(ret);
1193
+ }, arguments); },
1194
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
1195
+ const ret = getObject(arg0)[getObject(arg1)];
1196
+ return addHeapObject(ret);
1197
+ },
1198
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
1199
+ let result;
1200
+ try {
1201
+ result = getObject(arg0) instanceof ArrayBuffer;
1202
+ } catch (_) {
1203
+ result = false;
1204
+ }
1205
+ const ret = result;
1206
+ return ret;
1207
+ },
1208
+ __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
1209
+ let result;
1210
+ try {
1211
+ result = getObject(arg0) instanceof Map;
1212
+ } catch (_) {
1213
+ result = false;
1214
+ }
1215
+ const ret = result;
1216
+ return ret;
1217
+ },
1218
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
1219
+ let result;
1220
+ try {
1221
+ result = getObject(arg0) instanceof Uint8Array;
1222
+ } catch (_) {
1223
+ result = false;
1224
+ }
1225
+ const ret = result;
1226
+ return ret;
1227
+ },
1228
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
1229
+ const ret = Array.isArray(getObject(arg0));
1230
+ return ret;
1231
+ },
1232
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
1233
+ const ret = Number.isSafeInteger(getObject(arg0));
1234
+ return ret;
1235
+ },
1236
+ __wbg_iterator_6ff6560ca1568e55: function() {
1237
+ const ret = Symbol.iterator;
1238
+ return addHeapObject(ret);
1239
+ },
1240
+ __wbg_length_32ed9a279acd054c: function(arg0) {
1241
+ const ret = getObject(arg0).length;
1242
+ return ret;
1243
+ },
1244
+ __wbg_length_35a7bace40f36eac: function(arg0) {
1245
+ const ret = getObject(arg0).length;
1246
+ return ret;
1247
+ },
1248
+ __wbg_new_361308b2356cecd0: function() {
1249
+ const ret = new Object();
1250
+ return addHeapObject(ret);
1251
+ },
1252
+ __wbg_new_3eb36ae241fe6f44: function() {
1253
+ const ret = new Array();
1254
+ return addHeapObject(ret);
1255
+ },
1256
+ __wbg_new_72b49615380db768: function(arg0, arg1) {
1257
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1258
+ return addHeapObject(ret);
1259
+ },
1260
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
1261
+ const ret = new Uint8Array(getObject(arg0));
1262
+ return addHeapObject(ret);
1263
+ },
1264
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
1265
+ const ret = getObject(arg0).next();
1266
+ return addHeapObject(ret);
1267
+ }, arguments); },
1268
+ __wbg_next_418f80d8f5303233: function(arg0) {
1269
+ const ret = getObject(arg0).next;
1270
+ return addHeapObject(ret);
1271
+ },
1272
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
1273
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1274
+ },
1275
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
1276
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1277
+ },
1278
+ __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
1279
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1280
+ return ret;
1281
+ }, arguments); },
1282
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
1283
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1284
+ },
1285
+ __wbg_set_name_2aca19de8d382675: function(arg0, arg1, arg2) {
1286
+ getObject(arg0).name = getStringFromWasm0(arg1, arg2);
1287
+ },
1288
+ __wbg_value_0546255b415e96c1: function(arg0) {
1289
+ const ret = getObject(arg0).value;
1290
+ return addHeapObject(ret);
1291
+ },
1292
+ __wbindgen_cast_0000000000000001: function(arg0) {
1293
+ // Cast intrinsic for `F64 -> Externref`.
1294
+ const ret = arg0;
1295
+ return addHeapObject(ret);
1296
+ },
1297
+ __wbindgen_cast_0000000000000002: function(arg0) {
1298
+ // Cast intrinsic for `I64 -> Externref`.
1299
+ const ret = arg0;
1300
+ return addHeapObject(ret);
1301
+ },
1302
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1303
+ // Cast intrinsic for `Ref(String) -> Externref`.
1304
+ const ret = getStringFromWasm0(arg0, arg1);
1305
+ return addHeapObject(ret);
1306
+ },
1307
+ __wbindgen_cast_0000000000000004: function(arg0) {
1308
+ // Cast intrinsic for `U64 -> Externref`.
1309
+ const ret = BigInt.asUintN(64, arg0);
1310
+ return addHeapObject(ret);
1311
+ },
1312
+ __wbindgen_object_clone_ref: function(arg0) {
1313
+ const ret = getObject(arg0);
1314
+ return addHeapObject(ret);
1315
+ },
1316
+ __wbindgen_object_drop_ref: function(arg0) {
1317
+ takeObject(arg0);
1318
+ },
1319
+ };
1320
+ return {
1321
+ __proto__: null,
1322
+ "./ome_wasm_bg.js": import0,
1323
+ };
1324
+ }
1325
+
1326
+ const UnlockedSignerFinalization = (typeof FinalizationRegistry === 'undefined')
1327
+ ? { register: () => {}, unregister: () => {} }
1328
+ : new FinalizationRegistry(ptr => wasm.__wbg_unlockedsigner_free(ptr >>> 0, 1));
1329
+
1330
+ function addHeapObject(obj) {
1331
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1332
+ const idx = heap_next;
1333
+ heap_next = heap[idx];
1334
+
1335
+ heap[idx] = obj;
1336
+ return idx;
1337
+ }
1338
+
1339
+ function debugString(val) {
1340
+ // primitive types
1341
+ const type = typeof val;
1342
+ if (type == 'number' || type == 'boolean' || val == null) {
1343
+ return `${val}`;
1344
+ }
1345
+ if (type == 'string') {
1346
+ return `"${val}"`;
1347
+ }
1348
+ if (type == 'symbol') {
1349
+ const description = val.description;
1350
+ if (description == null) {
1351
+ return 'Symbol';
1352
+ } else {
1353
+ return `Symbol(${description})`;
1354
+ }
1355
+ }
1356
+ if (type == 'function') {
1357
+ const name = val.name;
1358
+ if (typeof name == 'string' && name.length > 0) {
1359
+ return `Function(${name})`;
1360
+ } else {
1361
+ return 'Function';
1362
+ }
1363
+ }
1364
+ // objects
1365
+ if (Array.isArray(val)) {
1366
+ const length = val.length;
1367
+ let debug = '[';
1368
+ if (length > 0) {
1369
+ debug += debugString(val[0]);
1370
+ }
1371
+ for(let i = 1; i < length; i++) {
1372
+ debug += ', ' + debugString(val[i]);
1373
+ }
1374
+ debug += ']';
1375
+ return debug;
1376
+ }
1377
+ // Test for built-in
1378
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1379
+ let className;
1380
+ if (builtInMatches && builtInMatches.length > 1) {
1381
+ className = builtInMatches[1];
1382
+ } else {
1383
+ // Failed to match the standard '[object ClassName]'
1384
+ return toString.call(val);
1385
+ }
1386
+ if (className == 'Object') {
1387
+ // we're a user defined class or Object
1388
+ // JSON.stringify avoids problems with cycles, and is generally much
1389
+ // easier than looping through ownProperties of `val`.
1390
+ try {
1391
+ return 'Object(' + JSON.stringify(val) + ')';
1392
+ } catch (_) {
1393
+ return 'Object';
1394
+ }
1395
+ }
1396
+ // errors
1397
+ if (val instanceof Error) {
1398
+ return `${val.name}: ${val.message}\n${val.stack}`;
1399
+ }
1400
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1401
+ return className;
1402
+ }
1403
+
1404
+ function dropObject(idx) {
1405
+ if (idx < 132) return;
1406
+ heap[idx] = heap_next;
1407
+ heap_next = idx;
1408
+ }
1409
+
1410
+ function getArrayU8FromWasm0(ptr, len) {
1411
+ ptr = ptr >>> 0;
1412
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1413
+ }
1414
+
1415
+ let cachedDataViewMemory0 = null;
1416
+ function getDataViewMemory0() {
1417
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1418
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1419
+ }
1420
+ return cachedDataViewMemory0;
1421
+ }
1422
+
1423
+ function getStringFromWasm0(ptr, len) {
1424
+ ptr = ptr >>> 0;
1425
+ return decodeText(ptr, len);
1426
+ }
1427
+
1428
+ let cachedUint8ArrayMemory0 = null;
1429
+ function getUint8ArrayMemory0() {
1430
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1431
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1432
+ }
1433
+ return cachedUint8ArrayMemory0;
1434
+ }
1435
+
1436
+ function getObject(idx) { return heap[idx]; }
1437
+
1438
+ function handleError(f, args) {
1439
+ try {
1440
+ return f.apply(this, args);
1441
+ } catch (e) {
1442
+ wasm.__wbindgen_export3(addHeapObject(e));
1443
+ }
1444
+ }
1445
+
1446
+ let heap = new Array(128).fill(undefined);
1447
+ heap.push(undefined, null, true, false);
1448
+
1449
+ let heap_next = heap.length;
1450
+
1451
+ function isLikeNone(x) {
1452
+ return x === undefined || x === null;
1453
+ }
1454
+
1455
+ function passStringToWasm0(arg, malloc, realloc) {
1456
+ if (realloc === undefined) {
1457
+ const buf = cachedTextEncoder.encode(arg);
1458
+ const ptr = malloc(buf.length, 1) >>> 0;
1459
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1460
+ WASM_VECTOR_LEN = buf.length;
1461
+ return ptr;
1462
+ }
1463
+
1464
+ let len = arg.length;
1465
+ let ptr = malloc(len, 1) >>> 0;
1466
+
1467
+ const mem = getUint8ArrayMemory0();
1468
+
1469
+ let offset = 0;
1470
+
1471
+ for (; offset < len; offset++) {
1472
+ const code = arg.charCodeAt(offset);
1473
+ if (code > 0x7F) break;
1474
+ mem[ptr + offset] = code;
1475
+ }
1476
+ if (offset !== len) {
1477
+ if (offset !== 0) {
1478
+ arg = arg.slice(offset);
1479
+ }
1480
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1481
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1482
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1483
+
1484
+ offset += ret.written;
1485
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1486
+ }
1487
+
1488
+ WASM_VECTOR_LEN = offset;
1489
+ return ptr;
1490
+ }
1491
+
1492
+ function takeObject(idx) {
1493
+ const ret = getObject(idx);
1494
+ dropObject(idx);
1495
+ return ret;
1496
+ }
1497
+
1498
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1499
+ cachedTextDecoder.decode();
1500
+ function decodeText(ptr, len) {
1501
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1502
+ }
1503
+
1504
+ const cachedTextEncoder = new TextEncoder();
1505
+
1506
+ if (!('encodeInto' in cachedTextEncoder)) {
1507
+ cachedTextEncoder.encodeInto = function (arg, view) {
1508
+ const buf = cachedTextEncoder.encode(arg);
1509
+ view.set(buf);
1510
+ return {
1511
+ read: arg.length,
1512
+ written: buf.length
1513
+ };
1514
+ };
1515
+ }
1516
+
1517
+ let WASM_VECTOR_LEN = 0;
1518
+
1519
+ const wasmPath = `${__dirname}/ome_wasm_bg.wasm`;
1520
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1521
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1522
+ const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;