@auditable/privacy-pool-zk-sdk 0.0.2-rc.7 → 0.0.2-rc.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auditable/privacy-pool-zk-sdk",
3
- "version": "0.0.2-rc.7",
3
+ "version": "0.0.2-rc.9",
4
4
  "description": "Client SDK for Soroban Privacy Pools - coin generation, withdrawal proofs, and proof serialization",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -10,6 +10,9 @@
10
10
  "import": "./dist/index.mjs",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
+ "./main.zkey": "./assets/main_final.zkey",
14
+ "./witness.wasm": "./assets/main.wasm",
15
+ "./sdk.wasm": "./pkg/client_sdk_wasm_bg.wasm",
13
16
  "./assets/witness_calculator.js": "./assets/witness_calculator.js",
14
17
  "./pkg/client_sdk_wasm.js": "./pkg/client_sdk_wasm.js"
15
18
  },
@@ -0,0 +1,62 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Convert snarkjs public signals JSON to hex bytes for Soroban contract.
5
+ */
6
+ export function publicToHex(public_json: string): string;
7
+ /**
8
+ * Calculate nullifier hash from nullifier decimal string.
9
+ * Returns hex string (0x...)
10
+ */
11
+ export function calculateNullifierHash(nullifier_decimal: string): string;
12
+ /**
13
+ * Generate withdrawal SNARK input from coin and state JSON strings.
14
+ * Returns JSON string of SnarkInput.
15
+ */
16
+ export function generateWithdrawalInput(coin_json: string, state_json: string): string;
17
+ /**
18
+ * Generate a new coin with random nullifier and secret.
19
+ * Returns JSON: { coin: { value, nullifier, secret, commitment }, commitment_hex }
20
+ */
21
+ export function generateCoin(): any;
22
+ /**
23
+ * Convert snarkjs proof JSON to hex bytes for Soroban contract.
24
+ */
25
+ export function proofToHex(proof_json: string): string;
26
+
27
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
28
+
29
+ export interface InitOutput {
30
+ readonly memory: WebAssembly.Memory;
31
+ readonly calculateNullifierHash: (a: number, b: number, c: number) => void;
32
+ readonly generateCoin: () => number;
33
+ readonly generateWithdrawalInput: (a: number, b: number, c: number, d: number, e: number) => void;
34
+ readonly proofToHex: (a: number, b: number, c: number) => void;
35
+ readonly publicToHex: (a: number, b: number, c: number) => void;
36
+ readonly __wbindgen_export_0: (a: number) => void;
37
+ readonly __wbindgen_export_1: (a: number, b: number) => number;
38
+ readonly __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
39
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
40
+ readonly __wbindgen_export_3: (a: number, b: number, c: number) => void;
41
+ }
42
+
43
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
44
+ /**
45
+ * Instantiates the given `module`, which can either be bytes or
46
+ * a precompiled `WebAssembly.Module`.
47
+ *
48
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
49
+ *
50
+ * @returns {InitOutput}
51
+ */
52
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
53
+
54
+ /**
55
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
56
+ * for everything else, calls `WebAssembly.instantiate` directly.
57
+ *
58
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
59
+ *
60
+ * @returns {Promise<InitOutput>}
61
+ */
62
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,571 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let heap_next = heap.length;
10
+
11
+ function addHeapObject(obj) {
12
+ if (heap_next === heap.length) heap.push(heap.length + 1);
13
+ const idx = heap_next;
14
+ heap_next = heap[idx];
15
+
16
+ heap[idx] = obj;
17
+ return idx;
18
+ }
19
+
20
+ function handleError(f, args) {
21
+ try {
22
+ return f.apply(this, args);
23
+ } catch (e) {
24
+ wasm.__wbindgen_export_0(addHeapObject(e));
25
+ }
26
+ }
27
+
28
+ let cachedUint8ArrayMemory0 = null;
29
+
30
+ function getUint8ArrayMemory0() {
31
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
32
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
33
+ }
34
+ return cachedUint8ArrayMemory0;
35
+ }
36
+
37
+ let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
38
+
39
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
40
+
41
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
42
+ let numBytesDecoded = 0;
43
+ function decodeText(ptr, len) {
44
+ numBytesDecoded += len;
45
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
46
+ cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
47
+ cachedTextDecoder.decode();
48
+ numBytesDecoded = len;
49
+ }
50
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
51
+ }
52
+
53
+ function getStringFromWasm0(ptr, len) {
54
+ ptr = ptr >>> 0;
55
+ return decodeText(ptr, len);
56
+ }
57
+
58
+ function dropObject(idx) {
59
+ if (idx < 132) return;
60
+ heap[idx] = heap_next;
61
+ heap_next = idx;
62
+ }
63
+
64
+ function takeObject(idx) {
65
+ const ret = getObject(idx);
66
+ dropObject(idx);
67
+ return ret;
68
+ }
69
+
70
+ function isLikeNone(x) {
71
+ return x === undefined || x === null;
72
+ }
73
+
74
+ function debugString(val) {
75
+ // primitive types
76
+ const type = typeof val;
77
+ if (type == 'number' || type == 'boolean' || val == null) {
78
+ return `${val}`;
79
+ }
80
+ if (type == 'string') {
81
+ return `"${val}"`;
82
+ }
83
+ if (type == 'symbol') {
84
+ const description = val.description;
85
+ if (description == null) {
86
+ return 'Symbol';
87
+ } else {
88
+ return `Symbol(${description})`;
89
+ }
90
+ }
91
+ if (type == 'function') {
92
+ const name = val.name;
93
+ if (typeof name == 'string' && name.length > 0) {
94
+ return `Function(${name})`;
95
+ } else {
96
+ return 'Function';
97
+ }
98
+ }
99
+ // objects
100
+ if (Array.isArray(val)) {
101
+ const length = val.length;
102
+ let debug = '[';
103
+ if (length > 0) {
104
+ debug += debugString(val[0]);
105
+ }
106
+ for(let i = 1; i < length; i++) {
107
+ debug += ', ' + debugString(val[i]);
108
+ }
109
+ debug += ']';
110
+ return debug;
111
+ }
112
+ // Test for built-in
113
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
114
+ let className;
115
+ if (builtInMatches && builtInMatches.length > 1) {
116
+ className = builtInMatches[1];
117
+ } else {
118
+ // Failed to match the standard '[object ClassName]'
119
+ return toString.call(val);
120
+ }
121
+ if (className == 'Object') {
122
+ // we're a user defined class or Object
123
+ // JSON.stringify avoids problems with cycles, and is generally much
124
+ // easier than looping through ownProperties of `val`.
125
+ try {
126
+ return 'Object(' + JSON.stringify(val) + ')';
127
+ } catch (_) {
128
+ return 'Object';
129
+ }
130
+ }
131
+ // errors
132
+ if (val instanceof Error) {
133
+ return `${val.name}: ${val.message}\n${val.stack}`;
134
+ }
135
+ // TODO we could test for more things here, like `Set`s and `Map`s.
136
+ return className;
137
+ }
138
+
139
+ let WASM_VECTOR_LEN = 0;
140
+
141
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
142
+
143
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
144
+ ? function (arg, view) {
145
+ return cachedTextEncoder.encodeInto(arg, view);
146
+ }
147
+ : function (arg, view) {
148
+ const buf = cachedTextEncoder.encode(arg);
149
+ view.set(buf);
150
+ return {
151
+ read: arg.length,
152
+ written: buf.length
153
+ };
154
+ });
155
+
156
+ function passStringToWasm0(arg, malloc, realloc) {
157
+
158
+ if (realloc === undefined) {
159
+ const buf = cachedTextEncoder.encode(arg);
160
+ const ptr = malloc(buf.length, 1) >>> 0;
161
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
162
+ WASM_VECTOR_LEN = buf.length;
163
+ return ptr;
164
+ }
165
+
166
+ let len = arg.length;
167
+ let ptr = malloc(len, 1) >>> 0;
168
+
169
+ const mem = getUint8ArrayMemory0();
170
+
171
+ let offset = 0;
172
+
173
+ for (; offset < len; offset++) {
174
+ const code = arg.charCodeAt(offset);
175
+ if (code > 0x7F) break;
176
+ mem[ptr + offset] = code;
177
+ }
178
+
179
+ if (offset !== len) {
180
+ if (offset !== 0) {
181
+ arg = arg.slice(offset);
182
+ }
183
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
184
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
185
+ const ret = encodeString(arg, view);
186
+
187
+ offset += ret.written;
188
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
189
+ }
190
+
191
+ WASM_VECTOR_LEN = offset;
192
+ return ptr;
193
+ }
194
+
195
+ let cachedDataViewMemory0 = null;
196
+
197
+ function getDataViewMemory0() {
198
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
199
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
200
+ }
201
+ return cachedDataViewMemory0;
202
+ }
203
+ /**
204
+ * Convert snarkjs public signals JSON to hex bytes for Soroban contract.
205
+ * @param {string} public_json
206
+ * @returns {string}
207
+ */
208
+ export function publicToHex(public_json) {
209
+ let deferred2_0;
210
+ let deferred2_1;
211
+ try {
212
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
+ const ptr0 = passStringToWasm0(public_json, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
214
+ const len0 = WASM_VECTOR_LEN;
215
+ wasm.publicToHex(retptr, ptr0, len0);
216
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
217
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
218
+ deferred2_0 = r0;
219
+ deferred2_1 = r1;
220
+ return getStringFromWasm0(r0, r1);
221
+ } finally {
222
+ wasm.__wbindgen_add_to_stack_pointer(16);
223
+ wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
224
+ }
225
+ }
226
+
227
+ /**
228
+ * Calculate nullifier hash from nullifier decimal string.
229
+ * Returns hex string (0x...)
230
+ * @param {string} nullifier_decimal
231
+ * @returns {string}
232
+ */
233
+ export function calculateNullifierHash(nullifier_decimal) {
234
+ let deferred3_0;
235
+ let deferred3_1;
236
+ try {
237
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
238
+ const ptr0 = passStringToWasm0(nullifier_decimal, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ wasm.calculateNullifierHash(retptr, ptr0, len0);
241
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
242
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
243
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
244
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
245
+ var ptr2 = r0;
246
+ var len2 = r1;
247
+ if (r3) {
248
+ ptr2 = 0; len2 = 0;
249
+ throw takeObject(r2);
250
+ }
251
+ deferred3_0 = ptr2;
252
+ deferred3_1 = len2;
253
+ return getStringFromWasm0(ptr2, len2);
254
+ } finally {
255
+ wasm.__wbindgen_add_to_stack_pointer(16);
256
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
257
+ }
258
+ }
259
+
260
+ /**
261
+ * Generate withdrawal SNARK input from coin and state JSON strings.
262
+ * Returns JSON string of SnarkInput.
263
+ * @param {string} coin_json
264
+ * @param {string} state_json
265
+ * @returns {string}
266
+ */
267
+ export function generateWithdrawalInput(coin_json, state_json) {
268
+ let deferred4_0;
269
+ let deferred4_1;
270
+ try {
271
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
272
+ const ptr0 = passStringToWasm0(coin_json, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
273
+ const len0 = WASM_VECTOR_LEN;
274
+ const ptr1 = passStringToWasm0(state_json, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
275
+ const len1 = WASM_VECTOR_LEN;
276
+ wasm.generateWithdrawalInput(retptr, ptr0, len0, ptr1, len1);
277
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
278
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
279
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
280
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
281
+ var ptr3 = r0;
282
+ var len3 = r1;
283
+ if (r3) {
284
+ ptr3 = 0; len3 = 0;
285
+ throw takeObject(r2);
286
+ }
287
+ deferred4_0 = ptr3;
288
+ deferred4_1 = len3;
289
+ return getStringFromWasm0(ptr3, len3);
290
+ } finally {
291
+ wasm.__wbindgen_add_to_stack_pointer(16);
292
+ wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Generate a new coin with random nullifier and secret.
298
+ * Returns JSON: { coin: { value, nullifier, secret, commitment }, commitment_hex }
299
+ * @returns {any}
300
+ */
301
+ export function generateCoin() {
302
+ const ret = wasm.generateCoin();
303
+ return takeObject(ret);
304
+ }
305
+
306
+ /**
307
+ * Convert snarkjs proof JSON to hex bytes for Soroban contract.
308
+ * @param {string} proof_json
309
+ * @returns {string}
310
+ */
311
+ export function proofToHex(proof_json) {
312
+ let deferred2_0;
313
+ let deferred2_1;
314
+ try {
315
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
316
+ const ptr0 = passStringToWasm0(proof_json, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
317
+ const len0 = WASM_VECTOR_LEN;
318
+ wasm.proofToHex(retptr, ptr0, len0);
319
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
320
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
321
+ deferred2_0 = r0;
322
+ deferred2_1 = r1;
323
+ return getStringFromWasm0(r0, r1);
324
+ } finally {
325
+ wasm.__wbindgen_add_to_stack_pointer(16);
326
+ wasm.__wbindgen_export_3(deferred2_0, deferred2_1, 1);
327
+ }
328
+ }
329
+
330
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
331
+
332
+ async function __wbg_load(module, imports) {
333
+ if (typeof Response === 'function' && module instanceof Response) {
334
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
335
+ try {
336
+ return await WebAssembly.instantiateStreaming(module, imports);
337
+
338
+ } catch (e) {
339
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
340
+
341
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
342
+ 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);
343
+
344
+ } else {
345
+ throw e;
346
+ }
347
+ }
348
+ }
349
+
350
+ const bytes = await module.arrayBuffer();
351
+ return await WebAssembly.instantiate(bytes, imports);
352
+
353
+ } else {
354
+ const instance = await WebAssembly.instantiate(module, imports);
355
+
356
+ if (instance instanceof WebAssembly.Instance) {
357
+ return { instance, module };
358
+
359
+ } else {
360
+ return instance;
361
+ }
362
+ }
363
+ }
364
+
365
+ function __wbg_get_imports() {
366
+ const imports = {};
367
+ imports.wbg = {};
368
+ imports.wbg.__wbg_buffer_a1a27a0dfa70165d = function(arg0) {
369
+ const ret = getObject(arg0).buffer;
370
+ return addHeapObject(ret);
371
+ };
372
+ imports.wbg.__wbg_call_f2db6205e5c51dc8 = function() { return handleError(function (arg0, arg1, arg2) {
373
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
374
+ return addHeapObject(ret);
375
+ }, arguments) };
376
+ imports.wbg.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
377
+ const ret = getObject(arg0).call(getObject(arg1));
378
+ return addHeapObject(ret);
379
+ }, arguments) };
380
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
381
+ const ret = getObject(arg0).crypto;
382
+ return addHeapObject(ret);
383
+ };
384
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
385
+ getObject(arg0).getRandomValues(getObject(arg1));
386
+ }, arguments) };
387
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
388
+ const ret = getObject(arg0).msCrypto;
389
+ return addHeapObject(ret);
390
+ };
391
+ imports.wbg.__wbg_new_07b483f72211fd66 = function() {
392
+ const ret = new Object();
393
+ return addHeapObject(ret);
394
+ };
395
+ imports.wbg.__wbg_new_e52b3efaaa774f96 = function(arg0) {
396
+ const ret = new Uint8Array(getObject(arg0));
397
+ return addHeapObject(ret);
398
+ };
399
+ imports.wbg.__wbg_newnoargs_ff528e72d35de39a = function(arg0, arg1) {
400
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
401
+ return addHeapObject(ret);
402
+ };
403
+ imports.wbg.__wbg_newwithbyteoffsetandlength_3b01ecda099177e8 = function(arg0, arg1, arg2) {
404
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
405
+ return addHeapObject(ret);
406
+ };
407
+ imports.wbg.__wbg_newwithlength_08f872dc1e3ada2e = function(arg0) {
408
+ const ret = new Uint8Array(arg0 >>> 0);
409
+ return addHeapObject(ret);
410
+ };
411
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
412
+ const ret = getObject(arg0).node;
413
+ return addHeapObject(ret);
414
+ };
415
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
416
+ const ret = getObject(arg0).process;
417
+ return addHeapObject(ret);
418
+ };
419
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
420
+ getObject(arg0).randomFillSync(takeObject(arg1));
421
+ }, arguments) };
422
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
423
+ const ret = module.require;
424
+ return addHeapObject(ret);
425
+ }, arguments) };
426
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
427
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
428
+ };
429
+ imports.wbg.__wbg_set_fe4e79d1ed3b0e9b = function(arg0, arg1, arg2) {
430
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
431
+ };
432
+ imports.wbg.__wbg_static_accessor_GLOBAL_487c52c58d65314d = function() {
433
+ const ret = typeof global === 'undefined' ? null : global;
434
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
435
+ };
436
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291 = function() {
437
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
438
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
439
+ };
440
+ imports.wbg.__wbg_static_accessor_SELF_78c9e3071b912620 = function() {
441
+ const ret = typeof self === 'undefined' ? null : self;
442
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
443
+ };
444
+ imports.wbg.__wbg_static_accessor_WINDOW_a093d21393777366 = function() {
445
+ const ret = typeof window === 'undefined' ? null : window;
446
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
447
+ };
448
+ imports.wbg.__wbg_subarray_dd4ade7d53bd8e26 = function(arg0, arg1, arg2) {
449
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
450
+ return addHeapObject(ret);
451
+ };
452
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
453
+ const ret = getObject(arg0).versions;
454
+ return addHeapObject(ret);
455
+ };
456
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
457
+ const ret = debugString(getObject(arg1));
458
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
459
+ const len1 = WASM_VECTOR_LEN;
460
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
461
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
462
+ };
463
+ imports.wbg.__wbindgen_is_function = function(arg0) {
464
+ const ret = typeof(getObject(arg0)) === 'function';
465
+ return ret;
466
+ };
467
+ imports.wbg.__wbindgen_is_object = function(arg0) {
468
+ const val = getObject(arg0);
469
+ const ret = typeof(val) === 'object' && val !== null;
470
+ return ret;
471
+ };
472
+ imports.wbg.__wbindgen_is_string = function(arg0) {
473
+ const ret = typeof(getObject(arg0)) === 'string';
474
+ return ret;
475
+ };
476
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
477
+ const ret = getObject(arg0) === undefined;
478
+ return ret;
479
+ };
480
+ imports.wbg.__wbindgen_memory = function() {
481
+ const ret = wasm.memory;
482
+ return addHeapObject(ret);
483
+ };
484
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
485
+ const ret = getObject(arg0);
486
+ return addHeapObject(ret);
487
+ };
488
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
489
+ takeObject(arg0);
490
+ };
491
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
492
+ const ret = getStringFromWasm0(arg0, arg1);
493
+ return addHeapObject(ret);
494
+ };
495
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
496
+ throw new Error(getStringFromWasm0(arg0, arg1));
497
+ };
498
+
499
+ return imports;
500
+ }
501
+
502
+ function __wbg_init_memory(imports, memory) {
503
+
504
+ }
505
+
506
+ function __wbg_finalize_init(instance, module) {
507
+ wasm = instance.exports;
508
+ __wbg_init.__wbindgen_wasm_module = module;
509
+ cachedDataViewMemory0 = null;
510
+ cachedUint8ArrayMemory0 = null;
511
+
512
+
513
+
514
+ return wasm;
515
+ }
516
+
517
+ function initSync(module) {
518
+ if (wasm !== undefined) return wasm;
519
+
520
+
521
+ if (typeof module !== 'undefined') {
522
+ if (Object.getPrototypeOf(module) === Object.prototype) {
523
+ ({module} = module)
524
+ } else {
525
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
526
+ }
527
+ }
528
+
529
+ const imports = __wbg_get_imports();
530
+
531
+ __wbg_init_memory(imports);
532
+
533
+ if (!(module instanceof WebAssembly.Module)) {
534
+ module = new WebAssembly.Module(module);
535
+ }
536
+
537
+ const instance = new WebAssembly.Instance(module, imports);
538
+
539
+ return __wbg_finalize_init(instance, module);
540
+ }
541
+
542
+ async function __wbg_init(module_or_path) {
543
+ if (wasm !== undefined) return wasm;
544
+
545
+
546
+ if (typeof module_or_path !== 'undefined') {
547
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
548
+ ({module_or_path} = module_or_path)
549
+ } else {
550
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
551
+ }
552
+ }
553
+
554
+ if (typeof module_or_path === 'undefined') {
555
+ module_or_path = new URL('client_sdk_wasm_bg.wasm', import.meta.url);
556
+ }
557
+ const imports = __wbg_get_imports();
558
+
559
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
560
+ module_or_path = fetch(module_or_path);
561
+ }
562
+
563
+ __wbg_init_memory(imports);
564
+
565
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
566
+
567
+ return __wbg_finalize_init(instance, module);
568
+ }
569
+
570
+ export { initSync };
571
+ export default __wbg_init;
Binary file
@@ -0,0 +1,13 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const calculateNullifierHash: (a: number, b: number, c: number) => void;
5
+ export const generateCoin: () => number;
6
+ export const generateWithdrawalInput: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const proofToHex: (a: number, b: number, c: number) => void;
8
+ export const publicToHex: (a: number, b: number, c: number) => void;
9
+ export const __wbindgen_export_0: (a: number) => void;
10
+ export const __wbindgen_export_1: (a: number, b: number) => number;
11
+ export const __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number;
12
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
13
+ export const __wbindgen_export_3: (a: number, b: number, c: number) => void;