@waku/rln 0.1.8-e224c05.0 → 0.1.8-e800af3.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 (187) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/index.js +6 -1
  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/@chainsafe/is-ip/lib/is-ip.js +12 -0
  14. package/bundle/node_modules/@chainsafe/is-ip/lib/parse.js +26 -0
  15. package/bundle/node_modules/@chainsafe/is-ip/lib/parser.js +202 -0
  16. package/bundle/node_modules/@multiformats/multiaddr/dist/src/constants.js +43 -0
  17. package/bundle/node_modules/@multiformats/multiaddr/dist/src/errors.js +17 -0
  18. package/bundle/node_modules/@multiformats/multiaddr/dist/src/registry.js +245 -0
  19. package/bundle/node_modules/@multiformats/multiaddr/dist/src/utils.js +191 -0
  20. package/bundle/node_modules/@multiformats/multiaddr/dist/src/validation.js +30 -0
  21. package/bundle/node_modules/@noble/hashes/esm/hmac.js +88 -0
  22. package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
  23. package/bundle/node_modules/@noble/hashes/esm/utils.js +8 -1
  24. package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +517 -255
  25. package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
  26. package/bundle/node_modules/multiformats/dist/src/bases/base10.js +3 -1
  27. package/bundle/node_modules/multiformats/dist/src/bases/base16.js +4 -2
  28. package/bundle/node_modules/multiformats/dist/src/bases/base2.js +3 -1
  29. package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +3 -1
  30. package/bundle/node_modules/multiformats/dist/src/bases/base32.js +11 -9
  31. package/bundle/node_modules/multiformats/dist/src/bases/base36.js +4 -2
  32. package/bundle/node_modules/multiformats/dist/src/bases/base58.js +4 -2
  33. package/bundle/node_modules/multiformats/dist/src/bases/base64.js +6 -4
  34. package/bundle/node_modules/multiformats/dist/src/bases/base8.js +3 -1
  35. package/bundle/node_modules/multiformats/dist/src/bases/identity.js +3 -1
  36. package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
  37. package/bundle/node_modules/multiformats/dist/src/bytes.js +15 -1
  38. package/bundle/node_modules/multiformats/dist/src/cid.js +371 -0
  39. package/bundle/node_modules/multiformats/dist/src/hashes/digest.js +62 -0
  40. package/bundle/node_modules/multiformats/dist/src/varint.js +15 -0
  41. package/bundle/node_modules/multiformats/dist/src/vendor/varint.js +78 -0
  42. package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
  43. package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
  44. package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
  45. package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
  46. package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
  47. package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
  48. package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
  49. package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
  50. package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
  51. package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
  52. package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
  53. package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
  54. package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
  55. package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
  56. package/bundle/node_modules/uint8arrays/dist/src/concat.js +20 -0
  57. package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
  58. package/bundle/node_modules/uint8arrays/dist/src/to-string.js +19 -0
  59. package/bundle/node_modules/uint8arrays/dist/src/util/as-uint8array.js +9 -0
  60. package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
  61. package/bundle/packages/core/dist/lib/connection_manager/connection_limiter.js +18 -0
  62. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +24 -0
  63. package/bundle/packages/core/dist/lib/connection_manager/dialer.js +14 -0
  64. package/bundle/packages/core/dist/lib/connection_manager/discovery_dialer.js +14 -0
  65. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +15 -0
  66. package/bundle/packages/core/dist/lib/connection_manager/shard_reader.js +14 -0
  67. package/bundle/packages/core/dist/lib/filter/filter.js +28 -0
  68. package/bundle/packages/core/dist/lib/light_push/light_push.js +28 -0
  69. package/bundle/packages/core/dist/lib/message/version_0.js +172 -0
  70. package/bundle/packages/core/dist/lib/metadata/metadata.js +28 -0
  71. package/bundle/packages/core/dist/lib/store/store.js +24 -0
  72. package/bundle/packages/interfaces/dist/connection_manager.js +9 -0
  73. package/bundle/packages/interfaces/dist/health_status.js +17 -0
  74. package/bundle/packages/interfaces/dist/protocols.js +92 -0
  75. package/bundle/packages/interfaces/dist/waku.js +7 -0
  76. package/bundle/packages/proto/dist/generated/filter.js +447 -0
  77. package/bundle/packages/proto/dist/generated/filter_v2.js +426 -0
  78. package/bundle/packages/proto/dist/generated/light_push.js +550 -0
  79. package/bundle/packages/proto/dist/generated/message.js +215 -0
  80. package/bundle/packages/proto/dist/generated/metadata.js +132 -0
  81. package/bundle/packages/proto/dist/generated/peer_exchange.js +211 -0
  82. package/bundle/packages/proto/dist/generated/sds_message.js +172 -0
  83. package/bundle/packages/proto/dist/generated/store_v3.js +492 -0
  84. package/bundle/packages/proto/dist/generated/topic_only_message.js +63 -0
  85. package/bundle/packages/rln/dist/codec.js +92 -0
  86. package/bundle/packages/rln/dist/contract/constants.js +14 -7
  87. package/bundle/packages/rln/dist/contract/rln_base_contract.js +2 -1
  88. package/bundle/packages/rln/dist/contract/rln_contract.js +109 -0
  89. package/bundle/packages/rln/dist/credentials_manager.js +45 -4
  90. package/bundle/packages/rln/dist/identity.js +2 -1
  91. package/bundle/packages/rln/dist/keystore/keystore.js +30 -9
  92. package/bundle/packages/rln/dist/message.js +59 -0
  93. package/bundle/packages/rln/dist/proof.js +54 -0
  94. package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
  95. package/bundle/packages/rln/dist/resources/witness_calculator.js +1 -1
  96. package/bundle/packages/rln/dist/rln.js +36 -4
  97. package/bundle/packages/rln/dist/root_tracker.js +76 -0
  98. package/bundle/packages/rln/dist/utils/bytes.js +70 -31
  99. package/bundle/packages/rln/dist/utils/epoch.js +23 -1
  100. package/bundle/packages/rln/dist/utils/hash.js +10 -0
  101. package/bundle/packages/rln/dist/zerokit.js +99 -2
  102. package/bundle/packages/utils/dist/bytes/index.js +31 -0
  103. package/bundle/resources/rln.wasm +0 -0
  104. package/bundle/resources/rln_final.zkey +0 -0
  105. package/bundle/resources/verification_key.d.ts +13 -0
  106. package/bundle/resources/verification_key.js +112 -0
  107. package/bundle/resources/witness_calculator.d.ts +7 -21
  108. package/bundle/resources/witness_calculator.js +1 -1
  109. package/dist/.tsbuildinfo +1 -1
  110. package/dist/codec.d.ts +40 -0
  111. package/dist/codec.js +79 -0
  112. package/dist/codec.js.map +1 -0
  113. package/dist/codec.test-utils.d.ts +37 -0
  114. package/dist/codec.test-utils.js +61 -0
  115. package/dist/codec.test-utils.js.map +1 -0
  116. package/dist/contract/constants.d.ts +10 -3
  117. package/dist/contract/constants.js +13 -6
  118. package/dist/contract/constants.js.map +1 -1
  119. package/dist/contract/index.d.ts +1 -0
  120. package/dist/contract/index.js +1 -0
  121. package/dist/contract/index.js.map +1 -1
  122. package/dist/contract/rln_base_contract.js +2 -1
  123. package/dist/contract/rln_base_contract.js.map +1 -1
  124. package/dist/contract/rln_contract.d.ts +17 -0
  125. package/dist/contract/rln_contract.js +107 -0
  126. package/dist/contract/rln_contract.js.map +1 -0
  127. package/dist/contract/test_setup.d.ts +26 -0
  128. package/dist/contract/test_setup.js +56 -0
  129. package/dist/contract/test_setup.js.map +1 -0
  130. package/dist/contract/test_utils.d.ts +39 -0
  131. package/dist/contract/test_utils.js +118 -0
  132. package/dist/contract/test_utils.js.map +1 -0
  133. package/dist/credentials_manager.d.ts +14 -2
  134. package/dist/credentials_manager.js +45 -4
  135. package/dist/credentials_manager.js.map +1 -1
  136. package/dist/identity.js +2 -1
  137. package/dist/identity.js.map +1 -1
  138. package/dist/index.d.ts +6 -2
  139. package/dist/index.js +6 -2
  140. package/dist/index.js.map +1 -1
  141. package/dist/keystore/keystore.js +30 -9
  142. package/dist/keystore/keystore.js.map +1 -1
  143. package/dist/message.d.ts +19 -0
  144. package/dist/message.js +51 -0
  145. package/dist/message.js.map +1 -0
  146. package/dist/proof.d.ts +21 -0
  147. package/dist/proof.js +50 -0
  148. package/dist/proof.js.map +1 -0
  149. package/dist/resources/rln.wasm +0 -0
  150. package/dist/resources/rln_final.zkey +0 -0
  151. package/dist/resources/verification_key.d.ts +13 -0
  152. package/dist/resources/verification_key.js +112 -0
  153. package/dist/resources/witness_calculator.d.ts +7 -21
  154. package/dist/resources/witness_calculator.js +1 -1
  155. package/dist/rln.d.ts +9 -0
  156. package/dist/rln.js +32 -4
  157. package/dist/rln.js.map +1 -1
  158. package/dist/root_tracker.d.ts +10 -0
  159. package/dist/root_tracker.js +75 -0
  160. package/dist/root_tracker.js.map +1 -0
  161. package/dist/utils/bytes.d.ts +31 -9
  162. package/dist/utils/bytes.js +70 -31
  163. package/dist/utils/bytes.js.map +1 -1
  164. package/dist/zerokit.d.ts +11 -0
  165. package/dist/zerokit.js +97 -1
  166. package/dist/zerokit.js.map +1 -1
  167. package/package.json +1 -1
  168. package/src/codec.test-utils.ts +88 -0
  169. package/src/codec.ts +138 -0
  170. package/src/contract/constants.ts +16 -6
  171. package/src/contract/index.ts +1 -0
  172. package/src/contract/rln_base_contract.ts +2 -1
  173. package/src/contract/rln_contract.ts +147 -0
  174. package/src/contract/test_setup.ts +86 -0
  175. package/src/contract/test_utils.ts +179 -0
  176. package/src/credentials_manager.ts +72 -8
  177. package/src/identity.ts +2 -1
  178. package/src/index.ts +11 -1
  179. package/src/keystore/keystore.ts +32 -9
  180. package/src/message.ts +73 -0
  181. package/src/proof.ts +69 -0
  182. package/src/resources/verification_key.d.ts +13 -0
  183. package/src/resources/witness_calculator.d.ts +7 -21
  184. package/src/rln.ts +65 -5
  185. package/src/root_tracker.ts +92 -0
  186. package/src/utils/bytes.ts +73 -36
  187. package/src/zerokit.ts +217 -1
@@ -1,16 +1,53 @@
1
1
  let wasm;
2
2
 
3
- let WASM_VECTOR_LEN = 0;
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
4
8
 
5
- let cachedUint8ArrayMemory0 = null;
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') } } );
6
24
 
7
- function getUint8ArrayMemory0() {
8
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
25
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
26
+ let cachedUint8Memory0 = null;
27
+
28
+ function getUint8Memory0() {
29
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
30
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
10
31
  }
11
- return cachedUint8ArrayMemory0;
32
+ return cachedUint8Memory0;
33
+ }
34
+
35
+ function getStringFromWasm0(ptr, len) {
36
+ ptr = ptr >>> 0;
37
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
12
38
  }
13
39
 
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
+
14
51
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
52
 
16
53
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -30,16 +67,16 @@ function passStringToWasm0(arg, malloc, realloc) {
30
67
 
31
68
  if (realloc === undefined) {
32
69
  const buf = cachedTextEncoder.encode(arg);
33
- const ptr = malloc(buf.length, 1) >>> 0;
34
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
70
+ const ptr = malloc(buf.length) >>> 0;
71
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
35
72
  WASM_VECTOR_LEN = buf.length;
36
73
  return ptr;
37
74
  }
38
75
 
39
76
  let len = arg.length;
40
- let ptr = malloc(len, 1) >>> 0;
77
+ let ptr = malloc(len) >>> 0;
41
78
 
42
- const mem = getUint8ArrayMemory0();
79
+ const mem = getUint8Memory0();
43
80
 
44
81
  let offset = 0;
45
82
 
@@ -53,52 +90,28 @@ function passStringToWasm0(arg, malloc, realloc) {
53
90
  if (offset !== 0) {
54
91
  arg = arg.slice(offset);
55
92
  }
56
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
93
+ ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
94
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
58
95
  const ret = encodeString(arg, view);
59
96
 
60
97
  offset += ret.written;
61
- ptr = realloc(ptr, len, offset, 1) >>> 0;
62
98
  }
63
99
 
64
100
  WASM_VECTOR_LEN = offset;
65
101
  return ptr;
66
102
  }
67
103
 
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;
104
+ function isLikeNone(x) {
105
+ return x === undefined || x === null;
75
106
  }
76
107
 
77
- function addToExternrefTable0(obj) {
78
- const idx = wasm.__externref_table_alloc();
79
- wasm.__wbindgen_export_4.set(idx, obj);
80
- return idx;
81
- }
108
+ let cachedInt32Memory0 = null;
82
109
 
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);
110
+ function getInt32Memory0() {
111
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
112
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
89
113
  }
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;
114
+ return cachedInt32Memory0;
102
115
  }
103
116
 
104
117
  function debugString(val) {
@@ -142,7 +155,7 @@ function debugString(val) {
142
155
  // Test for built-in
143
156
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
144
157
  let className;
145
- if (builtInMatches && builtInMatches.length > 1) {
158
+ if (builtInMatches.length > 1) {
146
159
  className = builtInMatches[1];
147
160
  } else {
148
161
  // Failed to match the standard '[object ClassName]'
@@ -165,44 +178,304 @@ function debugString(val) {
165
178
  // TODO we could test for more things here, like `Set`s and `Map`s.
166
179
  return className;
167
180
  }
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
+ }
168
266
 
169
- function initPanicHook() {
170
- wasm.initPanicHook();
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
+ }
171
283
  }
172
284
 
173
- function takeFromExternrefTable0(idx) {
174
- const value = wasm.__wbindgen_export_4.get(idx);
175
- wasm.__externref_table_dealloc(idx);
176
- return value;
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;
177
313
  }
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
+
178
348
  /**
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;
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
+ }
188
366
  }
189
367
 
190
368
  /**
191
- * @param {number} ctx
192
- * @param {Uint8Array} seed
193
- * @returns {Uint8Array}
194
- */
369
+ * @param {number} ctx
370
+ * @param {Uint8Array} seed
371
+ * @returns {Uint8Array}
372
+ */
195
373
  function generateSeededExtendedMembershipKey(ctx, seed) {
196
- const ret = wasm.generateSeededExtendedMembershipKey(ctx, seed);
197
- if (ret[2]) {
198
- throw takeFromExternrefTable0(ret[1]);
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);
199
386
  }
200
- return takeFromExternrefTable0(ret[0]);
201
387
  }
202
388
 
203
- (typeof FinalizationRegistry === 'undefined')
204
- ? { }
205
- : new FinalizationRegistry(ptr => wasm.__wbg_rln_free(ptr >>> 0, 1));
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
+ }
206
479
 
207
480
  async function __wbg_load(module, imports) {
208
481
  if (typeof Response === 'function' && module instanceof Response) {
@@ -212,7 +485,7 @@ async function __wbg_load(module, imports) {
212
485
 
213
486
  } catch (e) {
214
487
  if (module.headers.get('Content-Type') != 'application/wasm') {
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);
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);
216
489
 
217
490
  } else {
218
491
  throw e;
@@ -238,30 +511,72 @@ async function __wbg_load(module, imports) {
238
511
  function __wbg_get_imports() {
239
512
  const imports = {};
240
513
  imports.wbg = {};
241
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
242
- const ret = String(arg1);
243
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
244
- const len1 = WASM_VECTOR_LEN;
245
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
246
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
514
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
515
+ takeObject(arg0);
247
516
  };
248
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
249
- const ret = arg0.buffer;
250
- return ret;
517
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
518
+ const ret = getStringFromWasm0(arg0, arg1);
519
+ return addHeapObject(ret);
251
520
  };
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);
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';
258
535
  return ret;
259
- }, arguments) };
260
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
261
- const ret = arg0.crypto;
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;
262
544
  return ret;
263
545
  };
264
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
546
+ imports.wbg.__wbg_String_91fba7ded13ba54c = function(arg0, arg1) {
547
+ const ret = String(getObject(arg1));
548
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
549
+ const len1 = WASM_VECTOR_LEN;
550
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
551
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
552
+ };
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);
571
+ };
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;
578
+ };
579
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
265
580
  let deferred0_0;
266
581
  let deferred0_1;
267
582
  try {
@@ -269,186 +584,142 @@ function __wbg_get_imports() {
269
584
  deferred0_1 = arg1;
270
585
  console.error(getStringFromWasm0(arg0, arg1));
271
586
  } finally {
272
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
587
+ wasm.__wbindgen_free(deferred0_0, deferred0_1);
273
588
  }
274
589
  };
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;
284
- return ret;
285
- };
286
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
287
- const ret = arg0.msCrypto;
288
- return ret;
289
- };
290
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
291
- const ret = new Object();
292
- return ret;
293
- };
294
- imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
295
- const ret = new Map();
296
- return ret;
297
- };
298
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
299
- const ret = new Array();
300
- return ret;
301
- };
302
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
303
- const ret = new Error();
590
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
591
+ const ret = getObject(arg0) === undefined;
304
592
  return ret;
305
593
  };
306
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
307
- const ret = new Uint8Array(arg0);
308
- return ret;
594
+ imports.wbg.__wbg_crypto_70a96de3b6b73dac = function(arg0) {
595
+ const ret = getObject(arg0).crypto;
596
+ return addHeapObject(ret);
309
597
  };
310
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
311
- const ret = new Function(getStringFromWasm0(arg0, arg1));
312
- return ret;
598
+ imports.wbg.__wbg_process_dd1577445152112e = function(arg0) {
599
+ const ret = getObject(arg0).process;
600
+ return addHeapObject(ret);
313
601
  };
314
- imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
315
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
316
- return ret;
602
+ imports.wbg.__wbg_versions_58036bec3add9e6f = function(arg0) {
603
+ const ret = getObject(arg0).versions;
604
+ return addHeapObject(ret);
317
605
  };
318
- imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
319
- const ret = new Uint8Array(arg0 >>> 0);
320
- return ret;
606
+ imports.wbg.__wbg_node_6a9d28205ed5b0d8 = function(arg0) {
607
+ const ret = getObject(arg0).node;
608
+ return addHeapObject(ret);
321
609
  };
322
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
323
- const ret = arg0.node;
324
- return ret;
610
+ imports.wbg.__wbg_msCrypto_adbc770ec9eca9c7 = function(arg0) {
611
+ const ret = getObject(arg0).msCrypto;
612
+ return addHeapObject(ret);
325
613
  };
326
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
327
- const ret = arg0.process;
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';
328
620
  return ret;
329
621
  };
330
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
331
- arg0.randomFillSync(arg1);
622
+ imports.wbg.__wbg_getRandomValues_3774744e221a22ad = function() { return handleError(function (arg0, arg1) {
623
+ getObject(arg0).getRandomValues(getObject(arg1));
332
624
  }, arguments) };
333
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
334
- const ret = module.require;
335
- return ret;
625
+ imports.wbg.__wbg_randomFillSync_e950366c42764a07 = function() { return handleError(function (arg0, arg1) {
626
+ getObject(arg0).randomFillSync(takeObject(arg1));
336
627
  }, arguments) };
337
- imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
338
- arg0[arg1 >>> 0] = arg2;
628
+ imports.wbg.__wbg_new_18bc2084e9a3e1ff = function() {
629
+ const ret = new Array();
630
+ return addHeapObject(ret);
339
631
  };
340
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
341
- arg0[arg1] = arg2;
632
+ imports.wbg.__wbg_newnoargs_e643855c6572a4a8 = function(arg0, arg1) {
633
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
634
+ return addHeapObject(ret);
342
635
  };
343
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
344
- arg0.set(arg1, arg2 >>> 0);
636
+ imports.wbg.__wbg_new_b6fd0149e79ffce8 = function() {
637
+ const ret = new Map();
638
+ return addHeapObject(ret);
345
639
  };
346
- imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
347
- const ret = arg0.set(arg1, arg2);
348
- return ret;
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);
349
647
  };
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);
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);
356
666
  };
357
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
358
- const ret = typeof global === 'undefined' ? null : global;
359
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
667
+ imports.wbg.__wbg_toString_27ba0397f8cf84a6 = function() { return handleError(function (arg0, arg1) {
668
+ const ret = getObject(arg0).toString(arg1);
669
+ return addHeapObject(ret);
670
+ }, 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);
674
+ }, 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);
360
678
  };
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);
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);
364
686
  };
365
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
366
- const ret = typeof self === 'undefined' ? null : self;
367
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
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);
368
690
  };
369
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
370
- const ret = typeof window === 'undefined' ? null : window;
371
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
691
+ imports.wbg.__wbg_new_bc5d9aad3f9ac80e = function(arg0) {
692
+ const ret = new Uint8Array(getObject(arg0));
693
+ return addHeapObject(ret);
372
694
  };
373
- imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
374
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
375
- return ret;
695
+ imports.wbg.__wbg_set_4b3aa8445ac1e91c = function(arg0, arg1, arg2) {
696
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
376
697
  };
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;
698
+ imports.wbg.__wbg_length_d9c4ded7e708c6a1 = function(arg0) {
699
+ const ret = getObject(arg0).length;
383
700
  return ret;
384
701
  };
385
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
386
- const ret = arg0;
387
- return ret;
702
+ imports.wbg.__wbg_newwithlength_89eca18f2603a999 = function(arg0) {
703
+ const ret = new Uint8Array(arg0 >>> 0);
704
+ return addHeapObject(ret);
388
705
  };
389
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
390
- const ret = BigInt.asUintN(64, arg0);
391
- return ret;
706
+ imports.wbg.__wbg_subarray_7649d027b2b141b3 = function(arg0, arg1, arg2) {
707
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
708
+ return addHeapObject(ret);
392
709
  };
393
710
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
394
- const ret = debugString(arg1);
711
+ const ret = debugString(getObject(arg1));
395
712
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
396
713
  const len1 = WASM_VECTOR_LEN;
397
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
398
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
399
- };
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);
714
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
715
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
412
716
  };
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;
717
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
718
+ throw new Error(getStringFromWasm0(arg0, arg1));
429
719
  };
430
720
  imports.wbg.__wbindgen_memory = function() {
431
721
  const ret = wasm.memory;
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));
722
+ return addHeapObject(ret);
452
723
  };
453
724
 
454
725
  return imports;
@@ -457,38 +728,29 @@ function __wbg_get_imports() {
457
728
  function __wbg_finalize_init(instance, module) {
458
729
  wasm = instance.exports;
459
730
  __wbg_init.__wbindgen_wasm_module = module;
460
- cachedDataViewMemory0 = null;
461
- cachedUint8ArrayMemory0 = null;
731
+ cachedInt32Memory0 = null;
732
+ cachedUint32Memory0 = null;
733
+ cachedUint8Memory0 = null;
462
734
 
463
735
 
464
- wasm.__wbindgen_start();
465
736
  return wasm;
466
737
  }
467
738
 
468
- async function __wbg_init(module_or_path) {
739
+ async function __wbg_init(input) {
469
740
  if (wasm !== undefined) return wasm;
470
741
 
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);
742
+ if (typeof input === 'undefined') {
743
+ input = new URL('rln_wasm_bg.wasm', import.meta.url);
482
744
  }
483
745
  const imports = __wbg_get_imports();
484
746
 
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);
747
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
748
+ input = fetch(input);
487
749
  }
488
750
 
489
- const { instance, module } = await __wbg_load(await module_or_path, imports);
751
+ const { instance, module } = await __wbg_load(await input, imports);
490
752
 
491
753
  return __wbg_finalize_init(instance, module);
492
754
  }
493
755
 
494
- export { __wbg_init as default, generateSeededExtendedMembershipKey, initPanicHook, newRLN };
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 };