@waku/rln 0.0.2-ce9a6ae.0 → 0.0.2-ebd7523.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/packages/interfaces/dist/protocols.js +40 -45
- package/bundle/packages/rln/dist/contract/abi.js +648 -0
- package/bundle/packages/rln/dist/contract/constants.js +8 -13
- package/bundle/packages/rln/dist/contract/rln_contract.js +14 -3
- package/bundle/packages/rln/dist/identity.js +0 -46
- package/bundle/packages/rln/dist/rln.js +31 -15
- package/bundle/packages/rln/dist/zerokit.js +22 -16
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +2 -2
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/contract/{abi/rlnv2.d.ts → abi.d.ts} +22 -18
- package/dist/contract/abi.js +647 -0
- package/dist/contract/abi.js.map +1 -0
- package/dist/contract/constants.d.ts +22 -23
- package/dist/contract/constants.js +7 -12
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +8 -0
- package/dist/contract/rln_contract.js +14 -3
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/identity.d.ts +0 -7
- package/dist/identity.js +0 -46
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/rln.js +31 -14
- package/dist/rln.js.map +1 -1
- package/dist/zerokit.d.ts +5 -1
- package/dist/zerokit.js +22 -16
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -1
- package/src/contract/abi.ts +646 -0
- package/src/contract/constants.ts +8 -14
- package/src/contract/rln_contract.ts +16 -3
- package/src/identity.ts +0 -70
- package/src/index.ts +2 -2
- package/src/rln.ts +45 -14
- package/src/zerokit.ts +45 -16
- package/bundle/node_modules/@iden3/js-crypto/dist/browser/esm/index.js +0 -7
- package/bundle/node_modules/@stablelib/binary/lib/binary.js +0 -22
- package/bundle/node_modules/@stablelib/chacha/lib/chacha.js +0 -245
- package/bundle/node_modules/@stablelib/wipe/lib/wipe.js +0 -26
- package/bundle/packages/rln/dist/contract/abi/rlnv2.js +0 -394
- package/dist/__tests__/identity.test.d.ts +0 -1
- package/dist/__tests__/identity.test.js +0 -40
- package/dist/__tests__/identity.test.js.map +0 -1
- package/dist/contract/abi/rlnv2.js +0 -393
- package/dist/contract/abi/rlnv2.js.map +0 -1
- package/src/__tests__/identity.test.ts +0 -50
- package/src/contract/abi/rlnv2.ts +0 -392
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@waku/rln","version":"0.0.2-
|
1
|
+
{"name":"@waku/rln","version":"0.0.2-ebd7523.0","description":"RLN (Rate Limiting Nullifier) implementation for Waku","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"type":"module","homepage":"https://github.com/waku-org/js-waku/tree/master/packages/rln#readme","repository":{"type":"git","url":"https://github.com/waku-org/js-waku.git"},"bugs":{"url":"https://github.com/waku-org/js-waku/issues"},"license":"MIT OR Apache-2.0","keywords":["waku","rln","rate-limiting","privacy","web3"],"scripts":{"build":"run-s build:**","build:copy":"mkdir -p dist/resources && cp -r src/resources/* dist/resources/","build:esm":"tsc","build:bundle":"rollup --config rollup.config.js","fix":"run-s fix:*","fix:lint":"eslint src *.js --fix","check":"run-s check:*","check:tsc":"tsc -p tsconfig.dev.json","check:lint":"eslint \"src/!(resources)/**/*.{ts,js}\" *.js","check:spelling":"cspell \"{README.md,src/**/*.ts}\"","test":"NODE_ENV=test run-s test:*","test:browser":"karma start karma.conf.cjs","watch:build":"tsc -p tsconfig.json -w","watch:test":"mocha --watch","prepublish":"npm run build","reset-hard":"git clean -dfx -e .idea && git reset --hard && npm i && npm run build"},"engines":{"node":">=20"},"devDependencies":{"@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.2.3","@types/chai":"^5.0.1","@types/chai-spies":"^1.0.6","@types/deep-equal-in-any-order":"^1.0.4","@types/lodash":"^4.17.15","@types/sinon":"^17.0.3","@waku/build-utils":"^1.0.0","@waku/message-encryption":"0.0.32-ebd7523.0","chai":"^5.1.2","chai-as-promised":"^8.0.1","chai-spies":"^1.1.0","chai-subset":"^1.6.0","deep-equal-in-any-order":"^2.0.6","fast-check":"^3.23.2","rollup-plugin-copy":"^3.5.0","sinon":"^19.0.2"},"files":["dist","bundle","src/**/*.ts","!**/*.spec.*","!**/*.json","CHANGELOG.md","LICENSE","README.md"],"dependencies":{"@chainsafe/bls-keystore":"3.0.0","@waku/core":"0.0.34-ebd7523.0","@waku/utils":"0.0.22-ebd7523.0","@waku/zerokit-rln-wasm":"^0.0.13","ethereum-cryptography":"^3.1.0","ethers":"^5.7.2","lodash":"^4.17.21","uuid":"^11.0.5"}}
|
@@ -0,0 +1,646 @@
|
|
1
|
+
export const RLN_ABI = [
|
2
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
3
|
+
{
|
4
|
+
inputs: [
|
5
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
6
|
+
],
|
7
|
+
name: "CannotEraseActiveMembership",
|
8
|
+
type: "error"
|
9
|
+
},
|
10
|
+
{ inputs: [], name: "CannotExceedMaxTotalRateLimit", type: "error" },
|
11
|
+
{
|
12
|
+
inputs: [
|
13
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
14
|
+
],
|
15
|
+
name: "CannotExtendNonGracePeriodMembership",
|
16
|
+
type: "error"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
inputs: [
|
20
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
21
|
+
],
|
22
|
+
name: "InvalidIdCommitment",
|
23
|
+
type: "error"
|
24
|
+
},
|
25
|
+
{ inputs: [], name: "InvalidMembershipRateLimit", type: "error" },
|
26
|
+
{
|
27
|
+
inputs: [
|
28
|
+
{ internalType: "uint256", name: "startIndex", type: "uint256" },
|
29
|
+
{ internalType: "uint256", name: "endIndex", type: "uint256" }
|
30
|
+
],
|
31
|
+
name: "InvalidPaginationQuery",
|
32
|
+
type: "error"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
inputs: [
|
36
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
37
|
+
],
|
38
|
+
name: "MembershipDoesNotExist",
|
39
|
+
type: "error"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
inputs: [
|
43
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
44
|
+
],
|
45
|
+
name: "NonHolderCannotEraseGracePeriodMembership",
|
46
|
+
type: "error"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
inputs: [
|
50
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
51
|
+
],
|
52
|
+
name: "NonHolderCannotExtend",
|
53
|
+
type: "error"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
anonymous: false,
|
57
|
+
inputs: [
|
58
|
+
{
|
59
|
+
indexed: false,
|
60
|
+
internalType: "address",
|
61
|
+
name: "previousAdmin",
|
62
|
+
type: "address"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
indexed: false,
|
66
|
+
internalType: "address",
|
67
|
+
name: "newAdmin",
|
68
|
+
type: "address"
|
69
|
+
}
|
70
|
+
],
|
71
|
+
name: "AdminChanged",
|
72
|
+
type: "event"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
anonymous: false,
|
76
|
+
inputs: [
|
77
|
+
{
|
78
|
+
indexed: true,
|
79
|
+
internalType: "address",
|
80
|
+
name: "beacon",
|
81
|
+
type: "address"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
name: "BeaconUpgraded",
|
85
|
+
type: "event"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
anonymous: false,
|
89
|
+
inputs: [
|
90
|
+
{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }
|
91
|
+
],
|
92
|
+
name: "Initialized",
|
93
|
+
type: "event"
|
94
|
+
},
|
95
|
+
{
|
96
|
+
anonymous: false,
|
97
|
+
inputs: [
|
98
|
+
{
|
99
|
+
indexed: false,
|
100
|
+
internalType: "uint256",
|
101
|
+
name: "idCommitment",
|
102
|
+
type: "uint256"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
indexed: false,
|
106
|
+
internalType: "uint32",
|
107
|
+
name: "membershipRateLimit",
|
108
|
+
type: "uint32"
|
109
|
+
},
|
110
|
+
{ indexed: false, internalType: "uint32", name: "index", type: "uint32" }
|
111
|
+
],
|
112
|
+
name: "MembershipErased",
|
113
|
+
type: "event"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
anonymous: false,
|
117
|
+
inputs: [
|
118
|
+
{
|
119
|
+
indexed: false,
|
120
|
+
internalType: "uint256",
|
121
|
+
name: "idCommitment",
|
122
|
+
type: "uint256"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
indexed: false,
|
126
|
+
internalType: "uint32",
|
127
|
+
name: "membershipRateLimit",
|
128
|
+
type: "uint32"
|
129
|
+
},
|
130
|
+
{ indexed: false, internalType: "uint32", name: "index", type: "uint32" }
|
131
|
+
],
|
132
|
+
name: "MembershipExpired",
|
133
|
+
type: "event"
|
134
|
+
},
|
135
|
+
{
|
136
|
+
anonymous: false,
|
137
|
+
inputs: [
|
138
|
+
{
|
139
|
+
indexed: false,
|
140
|
+
internalType: "uint256",
|
141
|
+
name: "idCommitment",
|
142
|
+
type: "uint256"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
indexed: false,
|
146
|
+
internalType: "uint32",
|
147
|
+
name: "membershipRateLimit",
|
148
|
+
type: "uint32"
|
149
|
+
},
|
150
|
+
{ indexed: false, internalType: "uint32", name: "index", type: "uint32" },
|
151
|
+
{
|
152
|
+
indexed: false,
|
153
|
+
internalType: "uint256",
|
154
|
+
name: "newGracePeriodStartTimestamp",
|
155
|
+
type: "uint256"
|
156
|
+
}
|
157
|
+
],
|
158
|
+
name: "MembershipExtended",
|
159
|
+
type: "event"
|
160
|
+
},
|
161
|
+
{
|
162
|
+
anonymous: false,
|
163
|
+
inputs: [
|
164
|
+
{
|
165
|
+
indexed: false,
|
166
|
+
internalType: "uint256",
|
167
|
+
name: "idCommitment",
|
168
|
+
type: "uint256"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
indexed: false,
|
172
|
+
internalType: "uint256",
|
173
|
+
name: "membershipRateLimit",
|
174
|
+
type: "uint256"
|
175
|
+
},
|
176
|
+
{ indexed: false, internalType: "uint32", name: "index", type: "uint32" }
|
177
|
+
],
|
178
|
+
name: "MembershipRegistered",
|
179
|
+
type: "event"
|
180
|
+
},
|
181
|
+
{
|
182
|
+
anonymous: false,
|
183
|
+
inputs: [
|
184
|
+
{
|
185
|
+
indexed: true,
|
186
|
+
internalType: "address",
|
187
|
+
name: "previousOwner",
|
188
|
+
type: "address"
|
189
|
+
},
|
190
|
+
{
|
191
|
+
indexed: true,
|
192
|
+
internalType: "address",
|
193
|
+
name: "newOwner",
|
194
|
+
type: "address"
|
195
|
+
}
|
196
|
+
],
|
197
|
+
name: "OwnershipTransferred",
|
198
|
+
type: "event"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
anonymous: false,
|
202
|
+
inputs: [
|
203
|
+
{
|
204
|
+
indexed: true,
|
205
|
+
internalType: "address",
|
206
|
+
name: "implementation",
|
207
|
+
type: "address"
|
208
|
+
}
|
209
|
+
],
|
210
|
+
name: "Upgraded",
|
211
|
+
type: "event"
|
212
|
+
},
|
213
|
+
{
|
214
|
+
inputs: [],
|
215
|
+
name: "MAX_MEMBERSHIP_SET_SIZE",
|
216
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
217
|
+
stateMutability: "view",
|
218
|
+
type: "function"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
inputs: [],
|
222
|
+
name: "MERKLE_TREE_DEPTH",
|
223
|
+
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
|
224
|
+
stateMutability: "view",
|
225
|
+
type: "function"
|
226
|
+
},
|
227
|
+
{
|
228
|
+
inputs: [],
|
229
|
+
name: "Q",
|
230
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
231
|
+
stateMutability: "view",
|
232
|
+
type: "function"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
inputs: [],
|
236
|
+
name: "activeDurationForNewMemberships",
|
237
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
238
|
+
stateMutability: "view",
|
239
|
+
type: "function"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
inputs: [],
|
243
|
+
name: "currentTotalRateLimit",
|
244
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
245
|
+
stateMutability: "view",
|
246
|
+
type: "function"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
inputs: [],
|
250
|
+
name: "deployedBlockNumber",
|
251
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
252
|
+
stateMutability: "view",
|
253
|
+
type: "function"
|
254
|
+
},
|
255
|
+
{
|
256
|
+
inputs: [
|
257
|
+
{ internalType: "address", name: "holder", type: "address" },
|
258
|
+
{ internalType: "address", name: "token", type: "address" }
|
259
|
+
],
|
260
|
+
name: "depositsToWithdraw",
|
261
|
+
outputs: [{ internalType: "uint256", name: "balance", type: "uint256" }],
|
262
|
+
stateMutability: "view",
|
263
|
+
type: "function"
|
264
|
+
},
|
265
|
+
{
|
266
|
+
inputs: [
|
267
|
+
{ internalType: "uint256[]", name: "idCommitments", type: "uint256[]" }
|
268
|
+
],
|
269
|
+
name: "eraseMemberships",
|
270
|
+
outputs: [],
|
271
|
+
stateMutability: "nonpayable",
|
272
|
+
type: "function"
|
273
|
+
},
|
274
|
+
{
|
275
|
+
inputs: [
|
276
|
+
{ internalType: "uint256[]", name: "idCommitments", type: "uint256[]" },
|
277
|
+
{ internalType: "bool", name: "eraseFromMembershipSet", type: "bool" }
|
278
|
+
],
|
279
|
+
name: "eraseMemberships",
|
280
|
+
outputs: [],
|
281
|
+
stateMutability: "nonpayable",
|
282
|
+
type: "function"
|
283
|
+
},
|
284
|
+
{
|
285
|
+
inputs: [
|
286
|
+
{ internalType: "uint256[]", name: "idCommitments", type: "uint256[]" }
|
287
|
+
],
|
288
|
+
name: "extendMemberships",
|
289
|
+
outputs: [],
|
290
|
+
stateMutability: "nonpayable",
|
291
|
+
type: "function"
|
292
|
+
},
|
293
|
+
{
|
294
|
+
inputs: [
|
295
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
296
|
+
],
|
297
|
+
name: "getMembershipInfo",
|
298
|
+
outputs: [
|
299
|
+
{ internalType: "uint32", name: "", type: "uint32" },
|
300
|
+
{ internalType: "uint32", name: "", type: "uint32" },
|
301
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
302
|
+
],
|
303
|
+
stateMutability: "view",
|
304
|
+
type: "function"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
inputs: [{ internalType: "uint40", name: "index", type: "uint40" }],
|
308
|
+
name: "getMerkleProof",
|
309
|
+
outputs: [{ internalType: "uint256[20]", name: "", type: "uint256[20]" }],
|
310
|
+
stateMutability: "view",
|
311
|
+
type: "function"
|
312
|
+
},
|
313
|
+
{
|
314
|
+
inputs: [
|
315
|
+
{ internalType: "uint32", name: "startIndex", type: "uint32" },
|
316
|
+
{ internalType: "uint32", name: "endIndex", type: "uint32" }
|
317
|
+
],
|
318
|
+
name: "getRateCommitmentsInRangeBoundsInclusive",
|
319
|
+
outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }],
|
320
|
+
stateMutability: "view",
|
321
|
+
type: "function"
|
322
|
+
},
|
323
|
+
{
|
324
|
+
inputs: [],
|
325
|
+
name: "gracePeriodDurationForNewMemberships",
|
326
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
327
|
+
stateMutability: "view",
|
328
|
+
type: "function"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
332
|
+
name: "indicesOfLazilyErasedMemberships",
|
333
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
334
|
+
stateMutability: "view",
|
335
|
+
type: "function"
|
336
|
+
},
|
337
|
+
{
|
338
|
+
inputs: [
|
339
|
+
{ internalType: "address", name: "_priceCalculator", type: "address" },
|
340
|
+
{ internalType: "uint32", name: "_maxTotalRateLimit", type: "uint32" },
|
341
|
+
{
|
342
|
+
internalType: "uint32",
|
343
|
+
name: "_minMembershipRateLimit",
|
344
|
+
type: "uint32"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
internalType: "uint32",
|
348
|
+
name: "_maxMembershipRateLimit",
|
349
|
+
type: "uint32"
|
350
|
+
},
|
351
|
+
{ internalType: "uint32", name: "_activeDuration", type: "uint32" },
|
352
|
+
{ internalType: "uint32", name: "_gracePeriod", type: "uint32" }
|
353
|
+
],
|
354
|
+
name: "initialize",
|
355
|
+
outputs: [],
|
356
|
+
stateMutability: "nonpayable",
|
357
|
+
type: "function"
|
358
|
+
},
|
359
|
+
{
|
360
|
+
inputs: [
|
361
|
+
{ internalType: "uint256", name: "_idCommitment", type: "uint256" }
|
362
|
+
],
|
363
|
+
name: "isExpired",
|
364
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
365
|
+
stateMutability: "view",
|
366
|
+
type: "function"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
inputs: [
|
370
|
+
{ internalType: "uint256", name: "_idCommitment", type: "uint256" }
|
371
|
+
],
|
372
|
+
name: "isInGracePeriod",
|
373
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
374
|
+
stateMutability: "view",
|
375
|
+
type: "function"
|
376
|
+
},
|
377
|
+
{
|
378
|
+
inputs: [
|
379
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
380
|
+
],
|
381
|
+
name: "isInMembershipSet",
|
382
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
383
|
+
stateMutability: "view",
|
384
|
+
type: "function"
|
385
|
+
},
|
386
|
+
{
|
387
|
+
inputs: [
|
388
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
389
|
+
],
|
390
|
+
name: "isValidIdCommitment",
|
391
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
392
|
+
stateMutability: "pure",
|
393
|
+
type: "function"
|
394
|
+
},
|
395
|
+
{
|
396
|
+
inputs: [{ internalType: "uint32", name: "rateLimit", type: "uint32" }],
|
397
|
+
name: "isValidMembershipRateLimit",
|
398
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
399
|
+
stateMutability: "view",
|
400
|
+
type: "function"
|
401
|
+
},
|
402
|
+
{
|
403
|
+
inputs: [],
|
404
|
+
name: "maxMembershipRateLimit",
|
405
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
406
|
+
stateMutability: "view",
|
407
|
+
type: "function"
|
408
|
+
},
|
409
|
+
{
|
410
|
+
inputs: [],
|
411
|
+
name: "maxTotalRateLimit",
|
412
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
413
|
+
stateMutability: "view",
|
414
|
+
type: "function"
|
415
|
+
},
|
416
|
+
{
|
417
|
+
inputs: [
|
418
|
+
{ internalType: "uint256", name: "_idCommitment", type: "uint256" }
|
419
|
+
],
|
420
|
+
name: "membershipExpirationTimestamp",
|
421
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
422
|
+
stateMutability: "view",
|
423
|
+
type: "function"
|
424
|
+
},
|
425
|
+
{
|
426
|
+
inputs: [
|
427
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" }
|
428
|
+
],
|
429
|
+
name: "memberships",
|
430
|
+
outputs: [
|
431
|
+
{ internalType: "uint256", name: "depositAmount", type: "uint256" },
|
432
|
+
{ internalType: "uint32", name: "activeDuration", type: "uint32" },
|
433
|
+
{
|
434
|
+
internalType: "uint256",
|
435
|
+
name: "gracePeriodStartTimestamp",
|
436
|
+
type: "uint256"
|
437
|
+
},
|
438
|
+
{ internalType: "uint32", name: "gracePeriodDuration", type: "uint32" },
|
439
|
+
{ internalType: "uint32", name: "rateLimit", type: "uint32" },
|
440
|
+
{ internalType: "uint32", name: "index", type: "uint32" },
|
441
|
+
{ internalType: "address", name: "holder", type: "address" },
|
442
|
+
{ internalType: "address", name: "token", type: "address" }
|
443
|
+
],
|
444
|
+
stateMutability: "view",
|
445
|
+
type: "function"
|
446
|
+
},
|
447
|
+
{
|
448
|
+
inputs: [],
|
449
|
+
name: "merkleTree",
|
450
|
+
outputs: [
|
451
|
+
{ internalType: "uint40", name: "maxIndex", type: "uint40" },
|
452
|
+
{ internalType: "uint40", name: "numberOfLeaves", type: "uint40" }
|
453
|
+
],
|
454
|
+
stateMutability: "view",
|
455
|
+
type: "function"
|
456
|
+
},
|
457
|
+
{
|
458
|
+
inputs: [],
|
459
|
+
name: "minMembershipRateLimit",
|
460
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
461
|
+
stateMutability: "view",
|
462
|
+
type: "function"
|
463
|
+
},
|
464
|
+
{
|
465
|
+
inputs: [],
|
466
|
+
name: "nextFreeIndex",
|
467
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
468
|
+
stateMutability: "view",
|
469
|
+
type: "function"
|
470
|
+
},
|
471
|
+
{
|
472
|
+
inputs: [],
|
473
|
+
name: "owner",
|
474
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
475
|
+
stateMutability: "view",
|
476
|
+
type: "function"
|
477
|
+
},
|
478
|
+
{
|
479
|
+
inputs: [],
|
480
|
+
name: "priceCalculator",
|
481
|
+
outputs: [
|
482
|
+
{ internalType: "contract IPriceCalculator", name: "", type: "address" }
|
483
|
+
],
|
484
|
+
stateMutability: "view",
|
485
|
+
type: "function"
|
486
|
+
},
|
487
|
+
{
|
488
|
+
inputs: [],
|
489
|
+
name: "proxiableUUID",
|
490
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
491
|
+
stateMutability: "view",
|
492
|
+
type: "function"
|
493
|
+
},
|
494
|
+
{
|
495
|
+
inputs: [
|
496
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" },
|
497
|
+
{ internalType: "uint32", name: "rateLimit", type: "uint32" },
|
498
|
+
{
|
499
|
+
internalType: "uint256[]",
|
500
|
+
name: "idCommitmentsToErase",
|
501
|
+
type: "uint256[]"
|
502
|
+
}
|
503
|
+
],
|
504
|
+
name: "register",
|
505
|
+
outputs: [],
|
506
|
+
stateMutability: "nonpayable",
|
507
|
+
type: "function"
|
508
|
+
},
|
509
|
+
{
|
510
|
+
inputs: [
|
511
|
+
{ internalType: "address", name: "owner", type: "address" },
|
512
|
+
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
513
|
+
{ internalType: "uint8", name: "v", type: "uint8" },
|
514
|
+
{ internalType: "bytes32", name: "r", type: "bytes32" },
|
515
|
+
{ internalType: "bytes32", name: "s", type: "bytes32" },
|
516
|
+
{ internalType: "uint256", name: "idCommitment", type: "uint256" },
|
517
|
+
{ internalType: "uint32", name: "rateLimit", type: "uint32" },
|
518
|
+
{
|
519
|
+
internalType: "uint256[]",
|
520
|
+
name: "idCommitmentsToErase",
|
521
|
+
type: "uint256[]"
|
522
|
+
}
|
523
|
+
],
|
524
|
+
name: "registerWithPermit",
|
525
|
+
outputs: [],
|
526
|
+
stateMutability: "nonpayable",
|
527
|
+
type: "function"
|
528
|
+
},
|
529
|
+
{
|
530
|
+
inputs: [],
|
531
|
+
name: "renounceOwnership",
|
532
|
+
outputs: [],
|
533
|
+
stateMutability: "nonpayable",
|
534
|
+
type: "function"
|
535
|
+
},
|
536
|
+
{
|
537
|
+
inputs: [],
|
538
|
+
name: "root",
|
539
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
540
|
+
stateMutability: "view",
|
541
|
+
type: "function"
|
542
|
+
},
|
543
|
+
{
|
544
|
+
inputs: [
|
545
|
+
{
|
546
|
+
internalType: "uint32",
|
547
|
+
name: "_activeDurationForNewMembership",
|
548
|
+
type: "uint32"
|
549
|
+
}
|
550
|
+
],
|
551
|
+
name: "setActiveDuration",
|
552
|
+
outputs: [],
|
553
|
+
stateMutability: "nonpayable",
|
554
|
+
type: "function"
|
555
|
+
},
|
556
|
+
{
|
557
|
+
inputs: [
|
558
|
+
{
|
559
|
+
internalType: "uint32",
|
560
|
+
name: "_gracePeriodDurationForNewMembership",
|
561
|
+
type: "uint32"
|
562
|
+
}
|
563
|
+
],
|
564
|
+
name: "setGracePeriodDuration",
|
565
|
+
outputs: [],
|
566
|
+
stateMutability: "nonpayable",
|
567
|
+
type: "function"
|
568
|
+
},
|
569
|
+
{
|
570
|
+
inputs: [
|
571
|
+
{
|
572
|
+
internalType: "uint32",
|
573
|
+
name: "_maxMembershipRateLimit",
|
574
|
+
type: "uint32"
|
575
|
+
}
|
576
|
+
],
|
577
|
+
name: "setMaxMembershipRateLimit",
|
578
|
+
outputs: [],
|
579
|
+
stateMutability: "nonpayable",
|
580
|
+
type: "function"
|
581
|
+
},
|
582
|
+
{
|
583
|
+
inputs: [
|
584
|
+
{ internalType: "uint32", name: "_maxTotalRateLimit", type: "uint32" }
|
585
|
+
],
|
586
|
+
name: "setMaxTotalRateLimit",
|
587
|
+
outputs: [],
|
588
|
+
stateMutability: "nonpayable",
|
589
|
+
type: "function"
|
590
|
+
},
|
591
|
+
{
|
592
|
+
inputs: [
|
593
|
+
{
|
594
|
+
internalType: "uint32",
|
595
|
+
name: "_minMembershipRateLimit",
|
596
|
+
type: "uint32"
|
597
|
+
}
|
598
|
+
],
|
599
|
+
name: "setMinMembershipRateLimit",
|
600
|
+
outputs: [],
|
601
|
+
stateMutability: "nonpayable",
|
602
|
+
type: "function"
|
603
|
+
},
|
604
|
+
{
|
605
|
+
inputs: [
|
606
|
+
{ internalType: "address", name: "_priceCalculator", type: "address" }
|
607
|
+
],
|
608
|
+
name: "setPriceCalculator",
|
609
|
+
outputs: [],
|
610
|
+
stateMutability: "nonpayable",
|
611
|
+
type: "function"
|
612
|
+
},
|
613
|
+
{
|
614
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
615
|
+
name: "transferOwnership",
|
616
|
+
outputs: [],
|
617
|
+
stateMutability: "nonpayable",
|
618
|
+
type: "function"
|
619
|
+
},
|
620
|
+
{
|
621
|
+
inputs: [
|
622
|
+
{ internalType: "address", name: "newImplementation", type: "address" }
|
623
|
+
],
|
624
|
+
name: "upgradeTo",
|
625
|
+
outputs: [],
|
626
|
+
stateMutability: "nonpayable",
|
627
|
+
type: "function"
|
628
|
+
},
|
629
|
+
{
|
630
|
+
inputs: [
|
631
|
+
{ internalType: "address", name: "newImplementation", type: "address" },
|
632
|
+
{ internalType: "bytes", name: "data", type: "bytes" }
|
633
|
+
],
|
634
|
+
name: "upgradeToAndCall",
|
635
|
+
outputs: [],
|
636
|
+
stateMutability: "payable",
|
637
|
+
type: "function"
|
638
|
+
},
|
639
|
+
{
|
640
|
+
inputs: [{ internalType: "address", name: "token", type: "address" }],
|
641
|
+
name: "withdraw",
|
642
|
+
outputs: [],
|
643
|
+
stateMutability: "nonpayable",
|
644
|
+
type: "function"
|
645
|
+
}
|
646
|
+
];
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { RLN_ABI } from "./abi.js";
|
2
2
|
|
3
3
|
export const SEPOLIA_CONTRACT = {
|
4
|
-
chainId:
|
5
|
-
|
6
|
-
|
4
|
+
chainId: 59141,
|
5
|
+
// Implementation contract: 0xde2260ca49300357d5af4153cda0d18f7b3ea9b3
|
6
|
+
address: "0xb9cd878c90e49f797b4431fbf4fb333108cb90e6",
|
7
|
+
abi: RLN_ABI
|
7
8
|
};
|
8
9
|
|
9
10
|
/**
|
@@ -17,19 +18,12 @@ export const RATE_LIMIT_TIERS = {
|
|
17
18
|
HIGH: 600 // Suggested maximum rate - 600 messages per epoch
|
18
19
|
} as const;
|
19
20
|
|
20
|
-
// Default to maximum rate limit if not specified
|
21
|
-
export const DEFAULT_RATE_LIMIT = RATE_LIMIT_TIERS.HIGH;
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Epoch length in seconds (10 minutes)
|
25
|
-
* This is a constant defined in the smart contract
|
26
|
-
*/
|
27
|
-
export const EPOCH_LENGTH = 600;
|
28
|
-
|
29
21
|
// Global rate limit parameters
|
30
22
|
export const RATE_LIMIT_PARAMS = {
|
31
23
|
MIN_RATE: RATE_LIMIT_TIERS.LOW,
|
32
24
|
MAX_RATE: RATE_LIMIT_TIERS.HIGH,
|
33
25
|
MAX_TOTAL_RATE: 160_000, // Maximum total rate limit across all memberships
|
34
|
-
EPOCH_LENGTH:
|
26
|
+
EPOCH_LENGTH: 600 // Epoch length in seconds (10 minutes)
|
35
27
|
} as const;
|
28
|
+
|
29
|
+
export const DEFAULT_RATE_LIMIT = RATE_LIMIT_PARAMS.MAX_RATE;
|