@waku/rln 0.1.9 → 0.1.10-593bc45.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.
Files changed (192) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/index.js +1 -6
  4. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/_sha2.js +1 -1
  5. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/hmac.js +1 -1
  6. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/pbkdf2.js +1 -1
  7. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/scrypt.js +1 -1
  8. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha256.js +1 -1
  9. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha512.js +1 -1
  10. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/utils.js +1 -1
  11. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  12. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
  13. package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
  14. package/bundle/node_modules/@noble/hashes/esm/utils.js +1 -8
  15. package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +255 -517
  16. package/bundle/node_modules/multiformats/dist/src/bases/base10.js +1 -3
  17. package/bundle/node_modules/multiformats/dist/src/bases/base16.js +2 -4
  18. package/bundle/node_modules/multiformats/dist/src/bases/base2.js +1 -3
  19. package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +1 -3
  20. package/bundle/node_modules/multiformats/dist/src/bases/base32.js +9 -11
  21. package/bundle/node_modules/multiformats/dist/src/bases/base36.js +2 -4
  22. package/bundle/node_modules/multiformats/dist/src/bases/base58.js +2 -4
  23. package/bundle/node_modules/multiformats/dist/src/bases/base64.js +4 -6
  24. package/bundle/node_modules/multiformats/dist/src/bases/base8.js +1 -3
  25. package/bundle/node_modules/multiformats/dist/src/bases/identity.js +1 -3
  26. package/bundle/node_modules/multiformats/dist/src/bytes.js +1 -15
  27. package/bundle/packages/rln/dist/contract/constants.js +7 -14
  28. package/bundle/packages/rln/dist/contract/rln_base_contract.js +1 -2
  29. package/bundle/packages/rln/dist/credentials_manager.js +4 -45
  30. package/bundle/packages/rln/dist/identity.js +1 -2
  31. package/bundle/packages/rln/dist/keystore/keystore.js +9 -30
  32. package/bundle/packages/rln/dist/resources/witness_calculator.js +1 -1
  33. package/bundle/packages/rln/dist/rln.js +4 -36
  34. package/bundle/packages/rln/dist/utils/bytes.js +31 -70
  35. package/bundle/packages/rln/dist/utils/epoch.js +1 -23
  36. package/bundle/packages/rln/dist/zerokit.js +2 -99
  37. package/bundle/resources/rln.wasm +0 -0
  38. package/bundle/resources/rln_final.zkey +0 -0
  39. package/bundle/resources/witness_calculator.d.ts +21 -7
  40. package/bundle/resources/witness_calculator.js +1 -1
  41. package/dist/.tsbuildinfo +1 -1
  42. package/dist/contract/constants.d.ts +3 -10
  43. package/dist/contract/constants.js +6 -13
  44. package/dist/contract/constants.js.map +1 -1
  45. package/dist/contract/index.d.ts +0 -1
  46. package/dist/contract/index.js +0 -1
  47. package/dist/contract/index.js.map +1 -1
  48. package/dist/contract/rln_base_contract.js +1 -2
  49. package/dist/contract/rln_base_contract.js.map +1 -1
  50. package/dist/credentials_manager.d.ts +2 -14
  51. package/dist/credentials_manager.js +4 -45
  52. package/dist/credentials_manager.js.map +1 -1
  53. package/dist/identity.js +1 -2
  54. package/dist/identity.js.map +1 -1
  55. package/dist/index.d.ts +2 -6
  56. package/dist/index.js +2 -6
  57. package/dist/index.js.map +1 -1
  58. package/dist/keystore/keystore.js +9 -30
  59. package/dist/keystore/keystore.js.map +1 -1
  60. package/dist/resources/rln.wasm +0 -0
  61. package/dist/resources/rln_final.zkey +0 -0
  62. package/dist/resources/witness_calculator.d.ts +21 -7
  63. package/dist/resources/witness_calculator.js +1 -1
  64. package/dist/rln.d.ts +0 -9
  65. package/dist/rln.js +4 -32
  66. package/dist/rln.js.map +1 -1
  67. package/dist/utils/bytes.d.ts +9 -31
  68. package/dist/utils/bytes.js +31 -70
  69. package/dist/utils/bytes.js.map +1 -1
  70. package/dist/zerokit.d.ts +0 -11
  71. package/dist/zerokit.js +1 -97
  72. package/dist/zerokit.js.map +1 -1
  73. package/package.json +1 -93
  74. package/src/contract/constants.ts +6 -16
  75. package/src/contract/index.ts +0 -1
  76. package/src/contract/rln_base_contract.ts +1 -2
  77. package/src/credentials_manager.ts +8 -72
  78. package/src/identity.ts +1 -2
  79. package/src/index.ts +1 -11
  80. package/src/keystore/keystore.ts +9 -32
  81. package/src/resources/witness_calculator.d.ts +21 -7
  82. package/src/rln.ts +4 -65
  83. package/src/utils/bytes.ts +36 -73
  84. package/src/zerokit.ts +1 -217
  85. package/bundle/node_modules/@chainsafe/is-ip/lib/is-ip.js +0 -12
  86. package/bundle/node_modules/@chainsafe/is-ip/lib/parse.js +0 -26
  87. package/bundle/node_modules/@chainsafe/is-ip/lib/parser.js +0 -202
  88. package/bundle/node_modules/@multiformats/multiaddr/dist/src/constants.js +0 -43
  89. package/bundle/node_modules/@multiformats/multiaddr/dist/src/errors.js +0 -17
  90. package/bundle/node_modules/@multiformats/multiaddr/dist/src/registry.js +0 -245
  91. package/bundle/node_modules/@multiformats/multiaddr/dist/src/utils.js +0 -191
  92. package/bundle/node_modules/@multiformats/multiaddr/dist/src/validation.js +0 -30
  93. package/bundle/node_modules/@noble/hashes/esm/hmac.js +0 -88
  94. package/bundle/node_modules/@noble/hashes/esm/sha256.js +0 -16
  95. package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +0 -6
  96. package/bundle/node_modules/multiformats/dist/src/basics.js +0 -15
  97. package/bundle/node_modules/multiformats/dist/src/cid.js +0 -371
  98. package/bundle/node_modules/multiformats/dist/src/hashes/digest.js +0 -62
  99. package/bundle/node_modules/multiformats/dist/src/varint.js +0 -15
  100. package/bundle/node_modules/multiformats/dist/src/vendor/varint.js +0 -78
  101. package/bundle/node_modules/protons-runtime/dist/src/codec.js +0 -20
  102. package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +0 -24
  103. package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +0 -7
  104. package/bundle/node_modules/protons-runtime/dist/src/decode.js +0 -8
  105. package/bundle/node_modules/protons-runtime/dist/src/encode.js +0 -11
  106. package/bundle/node_modules/protons-runtime/dist/src/index.js +0 -30
  107. package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +0 -54
  108. package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +0 -175
  109. package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +0 -28
  110. package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +0 -367
  111. package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +0 -99
  112. package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +0 -438
  113. package/bundle/node_modules/uint8-varint/dist/src/index.js +0 -124
  114. package/bundle/node_modules/uint8arrays/dist/src/alloc.js +0 -17
  115. package/bundle/node_modules/uint8arrays/dist/src/concat.js +0 -20
  116. package/bundle/node_modules/uint8arrays/dist/src/from-string.js +0 -19
  117. package/bundle/node_modules/uint8arrays/dist/src/to-string.js +0 -19
  118. package/bundle/node_modules/uint8arrays/dist/src/util/as-uint8array.js +0 -9
  119. package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +0 -49
  120. package/bundle/packages/core/dist/lib/connection_manager/connection_limiter.js +0 -20
  121. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +0 -25
  122. package/bundle/packages/core/dist/lib/connection_manager/dialer.js +0 -14
  123. package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +0 -14
  124. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +0 -15
  125. package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +0 -14
  126. package/bundle/packages/core/dist/lib/filter/filter.js +0 -29
  127. package/bundle/packages/core/dist/lib/light_push/light_push.js +0 -21
  128. package/bundle/packages/core/dist/lib/light_push/protocol_handler.js +0 -28
  129. package/bundle/packages/core/dist/lib/message/version_0.js +0 -177
  130. package/bundle/packages/core/dist/lib/message_hash/message_hash.js +0 -58
  131. package/bundle/packages/core/dist/lib/metadata/metadata.js +0 -29
  132. package/bundle/packages/core/dist/lib/store/store.js +0 -24
  133. package/bundle/packages/interfaces/dist/connection_manager.js +0 -9
  134. package/bundle/packages/interfaces/dist/health_status.js +0 -17
  135. package/bundle/packages/interfaces/dist/light_push.js +0 -27
  136. package/bundle/packages/interfaces/dist/protocols.js +0 -76
  137. package/bundle/packages/interfaces/dist/waku.js +0 -7
  138. package/bundle/packages/proto/dist/generated/filter.js +0 -447
  139. package/bundle/packages/proto/dist/generated/filter_v2.js +0 -426
  140. package/bundle/packages/proto/dist/generated/light_push.js +0 -550
  141. package/bundle/packages/proto/dist/generated/message.js +0 -215
  142. package/bundle/packages/proto/dist/generated/metadata.js +0 -132
  143. package/bundle/packages/proto/dist/generated/peer_exchange.js +0 -211
  144. package/bundle/packages/proto/dist/generated/sds_message.js +0 -172
  145. package/bundle/packages/proto/dist/generated/store_v3.js +0 -492
  146. package/bundle/packages/proto/dist/generated/topic_only_message.js +0 -63
  147. package/bundle/packages/rln/dist/codec.js +0 -92
  148. package/bundle/packages/rln/dist/contract/rln_contract.js +0 -109
  149. package/bundle/packages/rln/dist/message.js +0 -65
  150. package/bundle/packages/rln/dist/proof.js +0 -54
  151. package/bundle/packages/rln/dist/resources/verification_key.js +0 -112
  152. package/bundle/packages/rln/dist/root_tracker.js +0 -76
  153. package/bundle/packages/rln/dist/utils/hash.js +0 -10
  154. package/bundle/packages/utils/dist/bytes/index.js +0 -49
  155. package/bundle/packages/utils/dist/common/is_defined.js +0 -5
  156. package/bundle/resources/verification_key.d.ts +0 -13
  157. package/bundle/resources/verification_key.js +0 -112
  158. package/dist/codec.d.ts +0 -40
  159. package/dist/codec.js +0 -79
  160. package/dist/codec.js.map +0 -1
  161. package/dist/codec.test-utils.d.ts +0 -37
  162. package/dist/codec.test-utils.js +0 -61
  163. package/dist/codec.test-utils.js.map +0 -1
  164. package/dist/contract/rln_contract.d.ts +0 -17
  165. package/dist/contract/rln_contract.js +0 -107
  166. package/dist/contract/rln_contract.js.map +0 -1
  167. package/dist/contract/test_setup.d.ts +0 -26
  168. package/dist/contract/test_setup.js +0 -56
  169. package/dist/contract/test_setup.js.map +0 -1
  170. package/dist/contract/test_utils.d.ts +0 -39
  171. package/dist/contract/test_utils.js +0 -118
  172. package/dist/contract/test_utils.js.map +0 -1
  173. package/dist/message.d.ts +0 -21
  174. package/dist/message.js +0 -57
  175. package/dist/message.js.map +0 -1
  176. package/dist/proof.d.ts +0 -21
  177. package/dist/proof.js +0 -50
  178. package/dist/proof.js.map +0 -1
  179. package/dist/resources/verification_key.d.ts +0 -13
  180. package/dist/resources/verification_key.js +0 -112
  181. package/dist/root_tracker.d.ts +0 -10
  182. package/dist/root_tracker.js +0 -75
  183. package/dist/root_tracker.js.map +0 -1
  184. package/src/codec.test-utils.ts +0 -88
  185. package/src/codec.ts +0 -138
  186. package/src/contract/rln_contract.ts +0 -147
  187. package/src/contract/test_setup.ts +0 -86
  188. package/src/contract/test_utils.ts +0 -179
  189. package/src/message.ts +0 -81
  190. package/src/proof.ts +0 -69
  191. package/src/resources/verification_key.d.ts +0 -13
  192. package/src/root_tracker.ts +0 -92
@@ -1,53 +1,16 @@
1
1
  let wasm;
2
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 dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
15
- }
16
-
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
20
- return ret;
21
- }
22
-
23
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
3
+ let WASM_VECTOR_LEN = 0;
24
4
 
25
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
26
- let cachedUint8Memory0 = null;
5
+ let cachedUint8ArrayMemory0 = null;
27
6
 
28
- function getUint8Memory0() {
29
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
30
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
31
10
  }
32
- return cachedUint8Memory0;
33
- }
34
-
35
- function getStringFromWasm0(ptr, len) {
36
- ptr = ptr >>> 0;
37
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
11
+ return cachedUint8ArrayMemory0;
38
12
  }
39
13
 
40
- function addHeapObject(obj) {
41
- if (heap_next === heap.length) heap.push(heap.length + 1);
42
- const idx = heap_next;
43
- heap_next = heap[idx];
44
-
45
- heap[idx] = obj;
46
- return idx;
47
- }
48
-
49
- let WASM_VECTOR_LEN = 0;
50
-
51
14
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
52
15
 
53
16
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -67,16 +30,16 @@ function passStringToWasm0(arg, malloc, realloc) {
67
30
 
68
31
  if (realloc === undefined) {
69
32
  const buf = cachedTextEncoder.encode(arg);
70
- const ptr = malloc(buf.length) >>> 0;
71
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
33
+ const ptr = malloc(buf.length, 1) >>> 0;
34
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
72
35
  WASM_VECTOR_LEN = buf.length;
73
36
  return ptr;
74
37
  }
75
38
 
76
39
  let len = arg.length;
77
- let ptr = malloc(len) >>> 0;
40
+ let ptr = malloc(len, 1) >>> 0;
78
41
 
79
- const mem = getUint8Memory0();
42
+ const mem = getUint8ArrayMemory0();
80
43
 
81
44
  let offset = 0;
82
45
 
@@ -90,28 +53,52 @@ function passStringToWasm0(arg, malloc, realloc) {
90
53
  if (offset !== 0) {
91
54
  arg = arg.slice(offset);
92
55
  }
93
- ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
94
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
56
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
95
58
  const ret = encodeString(arg, view);
96
59
 
97
60
  offset += ret.written;
61
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
98
62
  }
99
63
 
100
64
  WASM_VECTOR_LEN = offset;
101
65
  return ptr;
102
66
  }
103
67
 
104
- function isLikeNone(x) {
105
- return x === undefined || x === null;
68
+ let cachedDataViewMemory0 = null;
69
+
70
+ function getDataViewMemory0() {
71
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
+ }
74
+ return cachedDataViewMemory0;
106
75
  }
107
76
 
108
- let cachedInt32Memory0 = null;
77
+ function addToExternrefTable0(obj) {
78
+ const idx = wasm.__externref_table_alloc();
79
+ wasm.__wbindgen_export_4.set(idx, obj);
80
+ return idx;
81
+ }
109
82
 
110
- function getInt32Memory0() {
111
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
112
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
83
+ function handleError(f, args) {
84
+ try {
85
+ return f.apply(this, args);
86
+ } catch (e) {
87
+ const idx = addToExternrefTable0(e);
88
+ wasm.__wbindgen_exn_store(idx);
113
89
  }
114
- return cachedInt32Memory0;
90
+ }
91
+
92
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
93
+
94
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
95
+ function getStringFromWasm0(ptr, len) {
96
+ ptr = ptr >>> 0;
97
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
98
+ }
99
+
100
+ function isLikeNone(x) {
101
+ return x === undefined || x === null;
115
102
  }
116
103
 
117
104
  function debugString(val) {
@@ -155,7 +142,7 @@ function debugString(val) {
155
142
  // Test for built-in
156
143
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
157
144
  let className;
158
- if (builtInMatches.length > 1) {
145
+ if (builtInMatches && builtInMatches.length > 1) {
159
146
  className = builtInMatches[1];
160
147
  } else {
161
148
  // Failed to match the standard '[object ClassName]'
@@ -178,304 +165,44 @@ function debugString(val) {
178
165
  // TODO we could test for more things here, like `Set`s and `Map`s.
179
166
  return className;
180
167
  }
181
- /**
182
- */
183
- function init_panic_hook() {
184
- wasm.init_panic_hook();
185
- }
186
-
187
- /**
188
- * @param {number} tree_height
189
- * @param {Uint8Array} zkey
190
- * @param {Uint8Array} vk
191
- * @returns {number}
192
- */
193
- function newRLN(tree_height, zkey, vk) {
194
- try {
195
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
196
- wasm.newRLN(retptr, tree_height, addHeapObject(zkey), addHeapObject(vk));
197
- var r0 = getInt32Memory0()[retptr / 4 + 0];
198
- var r1 = getInt32Memory0()[retptr / 4 + 1];
199
- var r2 = getInt32Memory0()[retptr / 4 + 2];
200
- if (r2) {
201
- throw takeObject(r1);
202
- }
203
- return r0;
204
- } finally {
205
- wasm.__wbindgen_add_to_stack_pointer(16);
206
- }
207
- }
208
-
209
- /**
210
- * @param {number} ctx
211
- * @param {Uint8Array} input
212
- * @returns {Uint8Array}
213
- */
214
- function getSerializedRLNWitness(ctx, input) {
215
- try {
216
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
217
- wasm.getSerializedRLNWitness(retptr, ctx, addHeapObject(input));
218
- var r0 = getInt32Memory0()[retptr / 4 + 0];
219
- var r1 = getInt32Memory0()[retptr / 4 + 1];
220
- var r2 = getInt32Memory0()[retptr / 4 + 2];
221
- if (r2) {
222
- throw takeObject(r1);
223
- }
224
- return takeObject(r0);
225
- } finally {
226
- wasm.__wbindgen_add_to_stack_pointer(16);
227
- }
228
- }
229
-
230
- /**
231
- * @param {number} ctx
232
- * @param {Uint8Array} input
233
- */
234
- function insertMember(ctx, input) {
235
- try {
236
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
- wasm.insertMember(retptr, ctx, addHeapObject(input));
238
- var r0 = getInt32Memory0()[retptr / 4 + 0];
239
- var r1 = getInt32Memory0()[retptr / 4 + 1];
240
- if (r1) {
241
- throw takeObject(r0);
242
- }
243
- } finally {
244
- wasm.__wbindgen_add_to_stack_pointer(16);
245
- }
246
- }
247
-
248
- /**
249
- * @param {number} ctx
250
- * @param {number} index
251
- * @param {Uint8Array} input
252
- */
253
- function setLeavesFrom(ctx, index, input) {
254
- try {
255
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
256
- wasm.setLeavesFrom(retptr, ctx, index, addHeapObject(input));
257
- var r0 = getInt32Memory0()[retptr / 4 + 0];
258
- var r1 = getInt32Memory0()[retptr / 4 + 1];
259
- if (r1) {
260
- throw takeObject(r0);
261
- }
262
- } finally {
263
- wasm.__wbindgen_add_to_stack_pointer(16);
264
- }
265
- }
266
168
 
267
- /**
268
- * @param {number} ctx
269
- * @param {number} index
270
- */
271
- function deleteLeaf(ctx, index) {
272
- try {
273
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
274
- wasm.deleteLeaf(retptr, ctx, index);
275
- var r0 = getInt32Memory0()[retptr / 4 + 0];
276
- var r1 = getInt32Memory0()[retptr / 4 + 1];
277
- if (r1) {
278
- throw takeObject(r0);
279
- }
280
- } finally {
281
- wasm.__wbindgen_add_to_stack_pointer(16);
282
- }
169
+ function initPanicHook() {
170
+ wasm.initPanicHook();
283
171
  }
284
172
 
285
- /**
286
- * @param {number} ctx
287
- * @param {Uint8Array} serialized_witness
288
- * @returns {object}
289
- */
290
- function RLNWitnessToJson(ctx, serialized_witness) {
291
- try {
292
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
293
- wasm.RLNWitnessToJson(retptr, ctx, addHeapObject(serialized_witness));
294
- var r0 = getInt32Memory0()[retptr / 4 + 0];
295
- var r1 = getInt32Memory0()[retptr / 4 + 1];
296
- var r2 = getInt32Memory0()[retptr / 4 + 2];
297
- if (r2) {
298
- throw takeObject(r1);
299
- }
300
- return takeObject(r0);
301
- } finally {
302
- wasm.__wbindgen_add_to_stack_pointer(16);
303
- }
304
- }
305
-
306
- let cachedUint32Memory0 = null;
307
-
308
- function getUint32Memory0() {
309
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
310
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
311
- }
312
- return cachedUint32Memory0;
173
+ function takeFromExternrefTable0(idx) {
174
+ const value = wasm.__wbindgen_export_4.get(idx);
175
+ wasm.__externref_table_dealloc(idx);
176
+ return value;
313
177
  }
314
-
315
- function passArrayJsValueToWasm0(array, malloc) {
316
- const ptr = malloc(array.length * 4) >>> 0;
317
- const mem = getUint32Memory0();
318
- for (let i = 0; i < array.length; i++) {
319
- mem[ptr / 4 + i] = addHeapObject(array[i]);
320
- }
321
- WASM_VECTOR_LEN = array.length;
322
- return ptr;
323
- }
324
- /**
325
- * @param {number} ctx
326
- * @param {(bigint)[]} calculated_witness
327
- * @param {Uint8Array} serialized_witness
328
- * @returns {Uint8Array}
329
- */
330
- function generate_rln_proof_with_witness(ctx, calculated_witness, serialized_witness) {
331
- try {
332
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
333
- const ptr0 = passArrayJsValueToWasm0(calculated_witness, wasm.__wbindgen_malloc);
334
- const len0 = WASM_VECTOR_LEN;
335
- wasm.generate_rln_proof_with_witness(retptr, ctx, ptr0, len0, addHeapObject(serialized_witness));
336
- var r0 = getInt32Memory0()[retptr / 4 + 0];
337
- var r1 = getInt32Memory0()[retptr / 4 + 1];
338
- var r2 = getInt32Memory0()[retptr / 4 + 2];
339
- if (r2) {
340
- throw takeObject(r1);
341
- }
342
- return takeObject(r0);
343
- } finally {
344
- wasm.__wbindgen_add_to_stack_pointer(16);
345
- }
346
- }
347
-
348
178
  /**
349
- * @param {number} ctx
350
- * @returns {Uint8Array}
351
- */
352
- function generateExtendedMembershipKey(ctx) {
353
- try {
354
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
355
- wasm.generateExtendedMembershipKey(retptr, ctx);
356
- var r0 = getInt32Memory0()[retptr / 4 + 0];
357
- var r1 = getInt32Memory0()[retptr / 4 + 1];
358
- var r2 = getInt32Memory0()[retptr / 4 + 2];
359
- if (r2) {
360
- throw takeObject(r1);
361
- }
362
- return takeObject(r0);
363
- } finally {
364
- wasm.__wbindgen_add_to_stack_pointer(16);
365
- }
179
+ * @param {Uint8Array} zkey
180
+ * @returns {number}
181
+ */
182
+ function newRLN(zkey) {
183
+ const ret = wasm.newRLN(zkey);
184
+ if (ret[2]) {
185
+ throw takeFromExternrefTable0(ret[1]);
186
+ }
187
+ return ret[0] >>> 0;
366
188
  }
367
189
 
368
190
  /**
369
- * @param {number} ctx
370
- * @param {Uint8Array} seed
371
- * @returns {Uint8Array}
372
- */
191
+ * @param {number} ctx
192
+ * @param {Uint8Array} seed
193
+ * @returns {Uint8Array}
194
+ */
373
195
  function generateSeededExtendedMembershipKey(ctx, seed) {
374
- try {
375
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
376
- wasm.generateSeededExtendedMembershipKey(retptr, ctx, addHeapObject(seed));
377
- var r0 = getInt32Memory0()[retptr / 4 + 0];
378
- var r1 = getInt32Memory0()[retptr / 4 + 1];
379
- var r2 = getInt32Memory0()[retptr / 4 + 2];
380
- if (r2) {
381
- throw takeObject(r1);
382
- }
383
- return takeObject(r0);
384
- } finally {
385
- wasm.__wbindgen_add_to_stack_pointer(16);
196
+ const ret = wasm.generateSeededExtendedMembershipKey(ctx, seed);
197
+ if (ret[2]) {
198
+ throw takeFromExternrefTable0(ret[1]);
386
199
  }
200
+ return takeFromExternrefTable0(ret[0]);
387
201
  }
388
202
 
389
- /**
390
- * @param {number} ctx
391
- * @param {Uint8Array} proof
392
- * @returns {boolean}
393
- */
394
- function verifyRLNProof(ctx, proof) {
395
- try {
396
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
397
- wasm.verifyRLNProof(retptr, ctx, addHeapObject(proof));
398
- var r0 = getInt32Memory0()[retptr / 4 + 0];
399
- var r1 = getInt32Memory0()[retptr / 4 + 1];
400
- var r2 = getInt32Memory0()[retptr / 4 + 2];
401
- if (r2) {
402
- throw takeObject(r1);
403
- }
404
- return r0 !== 0;
405
- } finally {
406
- wasm.__wbindgen_add_to_stack_pointer(16);
407
- }
408
- }
409
-
410
- /**
411
- * @param {number} ctx
412
- * @param {Uint8Array} proof
413
- * @param {Uint8Array} roots
414
- * @returns {boolean}
415
- */
416
- function verifyWithRoots(ctx, proof, roots) {
417
- try {
418
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
419
- wasm.verifyWithRoots(retptr, ctx, addHeapObject(proof), addHeapObject(roots));
420
- var r0 = getInt32Memory0()[retptr / 4 + 0];
421
- var r1 = getInt32Memory0()[retptr / 4 + 1];
422
- var r2 = getInt32Memory0()[retptr / 4 + 2];
423
- if (r2) {
424
- throw takeObject(r1);
425
- }
426
- return r0 !== 0;
427
- } finally {
428
- wasm.__wbindgen_add_to_stack_pointer(16);
429
- }
430
- }
431
-
432
- /**
433
- * @param {number} ctx
434
- * @returns {Uint8Array}
435
- */
436
- function getRoot(ctx) {
437
- try {
438
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
439
- wasm.getRoot(retptr, ctx);
440
- var r0 = getInt32Memory0()[retptr / 4 + 0];
441
- var r1 = getInt32Memory0()[retptr / 4 + 1];
442
- var r2 = getInt32Memory0()[retptr / 4 + 2];
443
- if (r2) {
444
- throw takeObject(r1);
445
- }
446
- return takeObject(r0);
447
- } finally {
448
- wasm.__wbindgen_add_to_stack_pointer(16);
449
- }
450
- }
451
-
452
- /**
453
- * @param {Uint8Array} input
454
- * @returns {Uint8Array}
455
- */
456
- function poseidonHash(input) {
457
- try {
458
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
459
- wasm.poseidonHash(retptr, addHeapObject(input));
460
- var r0 = getInt32Memory0()[retptr / 4 + 0];
461
- var r1 = getInt32Memory0()[retptr / 4 + 1];
462
- var r2 = getInt32Memory0()[retptr / 4 + 2];
463
- if (r2) {
464
- throw takeObject(r1);
465
- }
466
- return takeObject(r0);
467
- } finally {
468
- wasm.__wbindgen_add_to_stack_pointer(16);
469
- }
470
- }
471
-
472
- function handleError(f, args) {
473
- try {
474
- return f.apply(this, args);
475
- } catch (e) {
476
- wasm.__wbindgen_exn_store(addHeapObject(e));
477
- }
478
- }
203
+ (typeof FinalizationRegistry === 'undefined')
204
+ ? { }
205
+ : new FinalizationRegistry(ptr => wasm.__wbg_rln_free(ptr >>> 0, 1));
479
206
 
480
207
  async function __wbg_load(module, imports) {
481
208
  if (typeof Response === 'function' && module instanceof Response) {
@@ -485,7 +212,7 @@ async function __wbg_load(module, imports) {
485
212
 
486
213
  } catch (e) {
487
214
  if (module.headers.get('Content-Type') != 'application/wasm') {
488
- 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);
215
+ 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);
489
216
 
490
217
  } else {
491
218
  throw e;
@@ -511,72 +238,30 @@ async function __wbg_load(module, imports) {
511
238
  function __wbg_get_imports() {
512
239
  const imports = {};
513
240
  imports.wbg = {};
514
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
515
- takeObject(arg0);
516
- };
517
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
518
- const ret = getStringFromWasm0(arg0, arg1);
519
- return addHeapObject(ret);
520
- };
521
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
522
- const obj = getObject(arg1);
523
- const ret = typeof(obj) === 'string' ? obj : undefined;
524
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
525
- var len1 = WASM_VECTOR_LEN;
526
- getInt32Memory0()[arg0 / 4 + 1] = len1;
527
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
528
- };
529
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
530
- const ret = new Error(getStringFromWasm0(arg0, arg1));
531
- return addHeapObject(ret);
532
- };
533
- imports.wbg.__wbindgen_is_string = function(arg0) {
534
- const ret = typeof(getObject(arg0)) === 'string';
535
- return ret;
536
- };
537
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
538
- const ret = getObject(arg0);
539
- return addHeapObject(ret);
540
- };
541
- imports.wbg.__wbindgen_is_object = function(arg0) {
542
- const val = getObject(arg0);
543
- const ret = typeof(val) === 'object' && val !== null;
544
- return ret;
545
- };
546
- imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
547
- const ret = String(getObject(arg1));
241
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
242
+ const ret = String(arg1);
548
243
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
549
244
  const len1 = WASM_VECTOR_LEN;
550
- getInt32Memory0()[arg0 / 4 + 1] = len1;
551
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
245
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
246
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
552
247
  };
553
- imports.wbg.__wbindgen_number_new = function(arg0) {
554
- const ret = arg0;
555
- return addHeapObject(ret);
556
- };
557
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
558
- const ret = arg0;
559
- return addHeapObject(ret);
560
- };
561
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
562
- const ret = BigInt.asUintN(64, arg0);
563
- return addHeapObject(ret);
564
- };
565
- imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) {
566
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
567
- };
568
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
569
- const ret = new Error();
570
- return addHeapObject(ret);
248
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
249
+ const ret = arg0.buffer;
250
+ return ret;
571
251
  };
572
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
573
- const ret = getObject(arg1).stack;
574
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
575
- const len1 = WASM_VECTOR_LEN;
576
- getInt32Memory0()[arg0 / 4 + 1] = len1;
577
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
252
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
253
+ const ret = arg0.call(arg1);
254
+ return ret;
255
+ }, arguments) };
256
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
257
+ const ret = arg0.call(arg1, arg2);
258
+ return ret;
259
+ }, arguments) };
260
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
261
+ const ret = arg0.crypto;
262
+ return ret;
578
263
  };
579
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
264
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
580
265
  let deferred0_0;
581
266
  let deferred0_1;
582
267
  try {
@@ -584,142 +269,186 @@ function __wbg_get_imports() {
584
269
  deferred0_1 = arg1;
585
270
  console.error(getStringFromWasm0(arg0, arg1));
586
271
  } finally {
587
- wasm.__wbindgen_free(deferred0_0, deferred0_1);
272
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
588
273
  }
589
274
  };
590
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
591
- const ret = getObject(arg0) === undefined;
275
+ imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
276
+ const ret = Object.fromEntries(arg0);
277
+ return ret;
278
+ }, arguments) };
279
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
280
+ arg0.getRandomValues(arg1);
281
+ }, arguments) };
282
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
283
+ const ret = arg0.length;
592
284
  return ret;
593
285
  };
594
- imports.wbg.__wbg_crypto_70a96de3b6b73dac = function(arg0) {
595
- const ret = getObject(arg0).crypto;
596
- return addHeapObject(ret);
597
- };
598
- imports.wbg.__wbg_process_dd1577445152112e = function(arg0) {
599
- const ret = getObject(arg0).process;
600
- return addHeapObject(ret);
286
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
287
+ const ret = arg0.msCrypto;
288
+ return ret;
601
289
  };
602
- imports.wbg.__wbg_versions_58036bec3add9e6f = function(arg0) {
603
- const ret = getObject(arg0).versions;
604
- return addHeapObject(ret);
290
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
291
+ const ret = new Object();
292
+ return ret;
605
293
  };
606
- imports.wbg.__wbg_node_6a9d28205ed5b0d8 = function(arg0) {
607
- const ret = getObject(arg0).node;
608
- return addHeapObject(ret);
294
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
295
+ const ret = new Map();
296
+ return ret;
609
297
  };
610
- imports.wbg.__wbg_msCrypto_adbc770ec9eca9c7 = function(arg0) {
611
- const ret = getObject(arg0).msCrypto;
612
- return addHeapObject(ret);
298
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
299
+ const ret = new Array();
300
+ return ret;
613
301
  };
614
- imports.wbg.__wbg_require_f05d779769764e82 = function() { return handleError(function () {
615
- const ret = module.require;
616
- return addHeapObject(ret);
617
- }, arguments) };
618
- imports.wbg.__wbindgen_is_function = function(arg0) {
619
- const ret = typeof(getObject(arg0)) === 'function';
302
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
303
+ const ret = new Error();
620
304
  return ret;
621
305
  };
622
- imports.wbg.__wbg_getRandomValues_3774744e221a22ad = function() { return handleError(function (arg0, arg1) {
623
- getObject(arg0).getRandomValues(getObject(arg1));
624
- }, arguments) };
625
- imports.wbg.__wbg_randomFillSync_e950366c42764a07 = function() { return handleError(function (arg0, arg1) {
626
- getObject(arg0).randomFillSync(takeObject(arg1));
627
- }, arguments) };
628
- imports.wbg.__wbg_new_18bc2084e9a3e1ff = function() {
629
- const ret = new Array();
630
- return addHeapObject(ret);
306
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
307
+ const ret = new Uint8Array(arg0);
308
+ return ret;
631
309
  };
632
- imports.wbg.__wbg_newnoargs_e643855c6572a4a8 = function(arg0, arg1) {
310
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
633
311
  const ret = new Function(getStringFromWasm0(arg0, arg1));
634
- return addHeapObject(ret);
312
+ return ret;
635
313
  };
636
- imports.wbg.__wbg_new_b6fd0149e79ffce8 = function() {
637
- const ret = new Map();
638
- return addHeapObject(ret);
314
+ imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
315
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
316
+ return ret;
639
317
  };
640
- imports.wbg.__wbg_call_f96b398515635514 = function() { return handleError(function (arg0, arg1) {
641
- const ret = getObject(arg0).call(getObject(arg1));
642
- return addHeapObject(ret);
643
- }, arguments) };
644
- imports.wbg.__wbg_new_7befa02319b36069 = function() {
645
- const ret = new Object();
646
- return addHeapObject(ret);
318
+ imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
319
+ const ret = new Uint8Array(arg0 >>> 0);
320
+ return ret;
647
321
  };
648
- imports.wbg.__wbg_self_b9aad7f1c618bfaf = function() { return handleError(function () {
649
- const ret = self.self;
650
- return addHeapObject(ret);
651
- }, arguments) };
652
- imports.wbg.__wbg_window_55e469842c98b086 = function() { return handleError(function () {
653
- const ret = window.window;
654
- return addHeapObject(ret);
655
- }, arguments) };
656
- imports.wbg.__wbg_globalThis_d0957e302752547e = function() { return handleError(function () {
657
- const ret = globalThis.globalThis;
658
- return addHeapObject(ret);
659
- }, arguments) };
660
- imports.wbg.__wbg_global_ae2f87312b8987fb = function() { return handleError(function () {
661
- const ret = global.global;
662
- return addHeapObject(ret);
663
- }, arguments) };
664
- imports.wbg.__wbg_set_aee8682c7ee9ac44 = function(arg0, arg1, arg2) {
665
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
322
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
323
+ const ret = arg0.node;
324
+ return ret;
325
+ };
326
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
327
+ const ret = arg0.process;
328
+ return ret;
666
329
  };
667
- imports.wbg.__wbg_toString_27ba0397f8cf84a6 = function() { return handleError(function (arg0, arg1) {
668
- const ret = getObject(arg0).toString(arg1);
669
- return addHeapObject(ret);
330
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
331
+ arg0.randomFillSync(arg1);
670
332
  }, arguments) };
671
- imports.wbg.__wbg_call_35782e9a1aa5e091 = function() { return handleError(function (arg0, arg1, arg2) {
672
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
673
- return addHeapObject(ret);
333
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
334
+ const ret = module.require;
335
+ return ret;
674
336
  }, arguments) };
675
- imports.wbg.__wbg_set_6c1b2b7b73337778 = function(arg0, arg1, arg2) {
676
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
677
- return addHeapObject(ret);
337
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
338
+ arg0[arg1 >>> 0] = arg2;
678
339
  };
679
- imports.wbg.__wbg_fromEntries_10a57760b5d7d9b8 = function() { return handleError(function (arg0) {
680
- const ret = Object.fromEntries(getObject(arg0));
681
- return addHeapObject(ret);
682
- }, arguments) };
683
- imports.wbg.__wbg_buffer_fcbfb6d88b2732e9 = function(arg0) {
684
- const ret = getObject(arg0).buffer;
685
- return addHeapObject(ret);
340
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
341
+ arg0[arg1] = arg2;
686
342
  };
687
- imports.wbg.__wbg_newwithbyteoffsetandlength_92c251989c485785 = function(arg0, arg1, arg2) {
688
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
689
- return addHeapObject(ret);
343
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
344
+ arg0.set(arg1, arg2 >>> 0);
690
345
  };
691
- imports.wbg.__wbg_new_bc5d9aad3f9ac80e = function(arg0) {
692
- const ret = new Uint8Array(getObject(arg0));
693
- return addHeapObject(ret);
346
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
347
+ const ret = arg0.set(arg1, arg2);
348
+ return ret;
694
349
  };
695
- imports.wbg.__wbg_set_4b3aa8445ac1e91c = function(arg0, arg1, arg2) {
696
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
350
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
351
+ const ret = arg1.stack;
352
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
353
+ const len1 = WASM_VECTOR_LEN;
354
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
355
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
697
356
  };
698
- imports.wbg.__wbg_length_d9c4ded7e708c6a1 = function(arg0) {
699
- const ret = getObject(arg0).length;
357
+ imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
358
+ const ret = typeof global === 'undefined' ? null : global;
359
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
360
+ };
361
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
362
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
363
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
364
+ };
365
+ imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
366
+ const ret = typeof self === 'undefined' ? null : self;
367
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
368
+ };
369
+ imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
370
+ const ret = typeof window === 'undefined' ? null : window;
371
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
372
+ };
373
+ imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
374
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
700
375
  return ret;
701
376
  };
702
- imports.wbg.__wbg_newwithlength_89eca18f2603a999 = function(arg0) {
703
- const ret = new Uint8Array(arg0 >>> 0);
704
- return addHeapObject(ret);
377
+ imports.wbg.__wbg_toString_b5d4438bc26b267c = function() { return handleError(function (arg0, arg1) {
378
+ const ret = arg0.toString(arg1);
379
+ return ret;
380
+ }, arguments) };
381
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
382
+ const ret = arg0.versions;
383
+ return ret;
705
384
  };
706
- imports.wbg.__wbg_subarray_7649d027b2b141b3 = function(arg0, arg1, arg2) {
707
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
708
- return addHeapObject(ret);
385
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
386
+ const ret = arg0;
387
+ return ret;
388
+ };
389
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
390
+ const ret = BigInt.asUintN(64, arg0);
391
+ return ret;
709
392
  };
710
393
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
711
- const ret = debugString(getObject(arg1));
394
+ const ret = debugString(arg1);
712
395
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
713
396
  const len1 = WASM_VECTOR_LEN;
714
- getInt32Memory0()[arg0 / 4 + 1] = len1;
715
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
397
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
398
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
716
399
  };
717
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
718
- throw new Error(getStringFromWasm0(arg0, arg1));
400
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
401
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
402
+ return ret;
403
+ };
404
+ imports.wbg.__wbindgen_init_externref_table = function() {
405
+ const table = wasm.__wbindgen_export_4;
406
+ const offset = table.grow(4);
407
+ table.set(0, undefined);
408
+ table.set(offset + 0, undefined);
409
+ table.set(offset + 1, null);
410
+ table.set(offset + 2, true);
411
+ table.set(offset + 3, false);
412
+ };
413
+ imports.wbg.__wbindgen_is_function = function(arg0) {
414
+ const ret = typeof(arg0) === 'function';
415
+ return ret;
416
+ };
417
+ imports.wbg.__wbindgen_is_object = function(arg0) {
418
+ const val = arg0;
419
+ const ret = typeof(val) === 'object' && val !== null;
420
+ return ret;
421
+ };
422
+ imports.wbg.__wbindgen_is_string = function(arg0) {
423
+ const ret = typeof(arg0) === 'string';
424
+ return ret;
425
+ };
426
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
427
+ const ret = arg0 === undefined;
428
+ return ret;
719
429
  };
720
430
  imports.wbg.__wbindgen_memory = function() {
721
431
  const ret = wasm.memory;
722
- return addHeapObject(ret);
432
+ return ret;
433
+ };
434
+ imports.wbg.__wbindgen_number_new = function(arg0) {
435
+ const ret = arg0;
436
+ return ret;
437
+ };
438
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
439
+ const obj = arg1;
440
+ const ret = typeof(obj) === 'string' ? obj : undefined;
441
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
442
+ var len1 = WASM_VECTOR_LEN;
443
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
444
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
445
+ };
446
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
447
+ const ret = getStringFromWasm0(arg0, arg1);
448
+ return ret;
449
+ };
450
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
451
+ throw new Error(getStringFromWasm0(arg0, arg1));
723
452
  };
724
453
 
725
454
  return imports;
@@ -728,29 +457,38 @@ function __wbg_get_imports() {
728
457
  function __wbg_finalize_init(instance, module) {
729
458
  wasm = instance.exports;
730
459
  __wbg_init.__wbindgen_wasm_module = module;
731
- cachedInt32Memory0 = null;
732
- cachedUint32Memory0 = null;
733
- cachedUint8Memory0 = null;
460
+ cachedDataViewMemory0 = null;
461
+ cachedUint8ArrayMemory0 = null;
734
462
 
735
463
 
464
+ wasm.__wbindgen_start();
736
465
  return wasm;
737
466
  }
738
467
 
739
- async function __wbg_init(input) {
468
+ async function __wbg_init(module_or_path) {
740
469
  if (wasm !== undefined) return wasm;
741
470
 
742
- if (typeof input === 'undefined') {
743
- input = new URL('rln_wasm_bg.wasm', import.meta.url);
471
+
472
+ if (typeof module_or_path !== 'undefined') {
473
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
474
+ ({module_or_path} = module_or_path);
475
+ } else {
476
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
477
+ }
478
+ }
479
+
480
+ if (typeof module_or_path === 'undefined') {
481
+ module_or_path = new URL('rln_wasm_bg.wasm', import.meta.url);
744
482
  }
745
483
  const imports = __wbg_get_imports();
746
484
 
747
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
748
- input = fetch(input);
485
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
486
+ module_or_path = fetch(module_or_path);
749
487
  }
750
488
 
751
- const { instance, module } = await __wbg_load(await input, imports);
489
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
752
490
 
753
491
  return __wbg_finalize_init(instance, module);
754
492
  }
755
493
 
756
- export { RLNWitnessToJson, __wbg_init as default, deleteLeaf, generateExtendedMembershipKey, generateSeededExtendedMembershipKey, generate_rln_proof_with_witness, getRoot, getSerializedRLNWitness, init_panic_hook, insertMember, newRLN, poseidonHash, setLeavesFrom, verifyRLNProof, verifyWithRoots };
494
+ export { __wbg_init as default, generateSeededExtendedMembershipKey, initPanicHook, newRLN };