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