@p2pdotme/sdk 1.0.5 → 1.1.1

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 (66) hide show
  1. package/README.md +103 -41
  2. package/dist/country.cjs +9 -2
  3. package/dist/country.cjs.map +1 -1
  4. package/dist/country.d.cts +35 -10
  5. package/dist/country.d.ts +35 -10
  6. package/dist/country.mjs +6 -2
  7. package/dist/country.mjs.map +1 -1
  8. package/dist/fraud-engine.cjs +52 -48
  9. package/dist/fraud-engine.cjs.map +1 -1
  10. package/dist/fraud-engine.mjs +46 -42
  11. package/dist/fraud-engine.mjs.map +1 -1
  12. package/dist/index.cjs +4 -14
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +41 -36
  15. package/dist/index.d.ts +41 -36
  16. package/dist/index.mjs +4 -12
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/orders.cjs +5961 -0
  19. package/dist/orders.cjs.map +1 -0
  20. package/dist/orders.d.cts +620 -0
  21. package/dist/orders.d.ts +620 -0
  22. package/dist/orders.mjs +5911 -0
  23. package/dist/orders.mjs.map +1 -0
  24. package/dist/prices.cjs +1432 -0
  25. package/dist/prices.cjs.map +1 -0
  26. package/dist/prices.d.cts +109 -0
  27. package/dist/prices.d.ts +109 -0
  28. package/dist/prices.mjs +1404 -0
  29. package/dist/prices.mjs.map +1 -0
  30. package/dist/profile.cjs +899 -69
  31. package/dist/profile.cjs.map +1 -1
  32. package/dist/profile.d.cts +39 -27
  33. package/dist/profile.d.ts +39 -27
  34. package/dist/profile.mjs +892 -62
  35. package/dist/profile.mjs.map +1 -1
  36. package/dist/qr-parsers.cjs +88 -7
  37. package/dist/qr-parsers.cjs.map +1 -1
  38. package/dist/qr-parsers.d.cts +38 -16
  39. package/dist/qr-parsers.d.ts +38 -16
  40. package/dist/qr-parsers.mjs +88 -7
  41. package/dist/qr-parsers.mjs.map +1 -1
  42. package/dist/react.cjs +2955 -1105
  43. package/dist/react.cjs.map +1 -1
  44. package/dist/react.d.cts +384 -104
  45. package/dist/react.d.ts +384 -104
  46. package/dist/react.mjs +2841 -992
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/zkkyc.cjs +405 -24
  49. package/dist/zkkyc.cjs.map +1 -1
  50. package/dist/zkkyc.d.cts +14 -9
  51. package/dist/zkkyc.d.ts +14 -9
  52. package/dist/zkkyc.mjs +405 -24
  53. package/dist/zkkyc.mjs.map +1 -1
  54. package/package.json +12 -12
  55. package/dist/order-routing.cjs +0 -888
  56. package/dist/order-routing.cjs.map +0 -1
  57. package/dist/order-routing.d.cts +0 -68
  58. package/dist/order-routing.d.ts +0 -68
  59. package/dist/order-routing.mjs +0 -860
  60. package/dist/order-routing.mjs.map +0 -1
  61. package/dist/payload.cjs +0 -3168
  62. package/dist/payload.cjs.map +0 -1
  63. package/dist/payload.d.cts +0 -147
  64. package/dist/payload.d.ts +0 -147
  65. package/dist/payload.mjs +0 -3124
  66. package/dist/payload.mjs.map +0 -1
@@ -0,0 +1,1404 @@
1
+ // src/contracts/abis/index.ts
2
+ import { erc20Abi } from "viem";
3
+
4
+ // src/contracts/abis/order-flow-facet.ts
5
+ var orderFlowFacetAbi = [
6
+ {
7
+ inputs: [
8
+ { internalType: "uint256", name: "circleId", type: "uint256" },
9
+ { internalType: "uint256", name: "assignUpto", type: "uint256" },
10
+ { internalType: "bytes32", name: "currency", type: "bytes32" },
11
+ { internalType: "address", name: "user", type: "address" },
12
+ { internalType: "uint256", name: "usdtAmount", type: "uint256" },
13
+ { internalType: "uint256", name: "fiatAmount", type: "uint256" },
14
+ { internalType: "int256", name: "orderType", type: "int256" },
15
+ { internalType: "uint256", name: "preferredPCConfigId", type: "uint256" }
16
+ ],
17
+ name: "getAssignableMerchantsFromCircle",
18
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
19
+ stateMutability: "view",
20
+ type: "function"
21
+ },
22
+ {
23
+ inputs: [
24
+ { internalType: "address", name: "_user", type: "address" },
25
+ { internalType: "bytes32", name: "_nativeCurrency", type: "bytes32" }
26
+ ],
27
+ name: "userTxLimit",
28
+ outputs: [
29
+ { internalType: "uint256", name: "", type: "uint256" },
30
+ { internalType: "uint256", name: "", type: "uint256" }
31
+ ],
32
+ stateMutability: "view",
33
+ type: "function"
34
+ },
35
+ {
36
+ inputs: [
37
+ { internalType: "string", name: "_pubKey", type: "string" },
38
+ { internalType: "uint256", name: "_amount", type: "uint256" },
39
+ { internalType: "address", name: "_recipientAddr", type: "address" },
40
+ { internalType: "uint8", name: "_orderType", type: "uint8" },
41
+ { internalType: "string", name: "_userUpi", type: "string" },
42
+ { internalType: "string", name: "_userPubKey", type: "string" },
43
+ { internalType: "bytes32", name: "_currency", type: "bytes32" },
44
+ { internalType: "uint256", name: "preferredPaymentChannelConfigId", type: "uint256" },
45
+ { internalType: "uint256", name: "_circleId", type: "uint256" },
46
+ { internalType: "uint256", name: "_fiatAmountLimit", type: "uint256" }
47
+ ],
48
+ name: "placeOrder",
49
+ outputs: [],
50
+ stateMutability: "nonpayable",
51
+ type: "function"
52
+ },
53
+ {
54
+ inputs: [{ internalType: "uint256", name: "_orderId", type: "uint256" }],
55
+ name: "cancelOrder",
56
+ outputs: [],
57
+ stateMutability: "nonpayable",
58
+ type: "function"
59
+ },
60
+ {
61
+ inputs: [
62
+ { internalType: "uint256", name: "_orderId", type: "uint256" },
63
+ { internalType: "string", name: "_userEncUpi", type: "string" },
64
+ { internalType: "uint256", name: "_updatedAmount", type: "uint256" }
65
+ ],
66
+ name: "setSellOrderUpi",
67
+ outputs: [],
68
+ stateMutability: "nonpayable",
69
+ type: "function"
70
+ },
71
+ {
72
+ type: "event",
73
+ name: "OrderPlaced",
74
+ anonymous: false,
75
+ inputs: [
76
+ { indexed: true, name: "orderId", type: "uint256" },
77
+ { indexed: true, name: "user", type: "address" },
78
+ { indexed: true, name: "merchant", type: "address" },
79
+ { indexed: false, name: "amount", type: "uint256" },
80
+ { indexed: false, name: "orderType", type: "uint8" },
81
+ { indexed: false, name: "placedTimestamp", type: "uint256" },
82
+ {
83
+ indexed: false,
84
+ name: "_order",
85
+ type: "tuple",
86
+ components: [
87
+ { name: "amount", type: "uint256" },
88
+ { name: "fiatAmount", type: "uint256" },
89
+ { name: "placedTimestamp", type: "uint256" },
90
+ { name: "completedTimestamp", type: "uint256" },
91
+ { name: "userCompletedTimestamp", type: "uint256" },
92
+ { name: "acceptedMerchant", type: "address" },
93
+ { name: "user", type: "address" },
94
+ { name: "recipientAddr", type: "address" },
95
+ { name: "pubkey", type: "string" },
96
+ { name: "encUpi", type: "string" },
97
+ { name: "userCompleted", type: "bool" },
98
+ { name: "status", type: "uint8" },
99
+ { name: "orderType", type: "uint8" },
100
+ {
101
+ name: "disputeInfo",
102
+ type: "tuple",
103
+ components: [
104
+ { name: "raisedBy", type: "uint8" },
105
+ { name: "status", type: "uint8" },
106
+ { name: "redactTransId", type: "uint256" },
107
+ { name: "accountNumber", type: "uint256" }
108
+ ]
109
+ },
110
+ { name: "id", type: "uint256" },
111
+ { name: "userPubKey", type: "string" },
112
+ { name: "encMerchantUpi", type: "string" },
113
+ { name: "acceptedAccountNo", type: "uint256" },
114
+ { name: "assignedAccountNos", type: "uint256[]" },
115
+ { name: "currency", type: "bytes32" },
116
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
117
+ { name: "circleId", type: "uint256" }
118
+ ]
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ type: "event",
124
+ name: "OrderAccepted",
125
+ anonymous: false,
126
+ inputs: [
127
+ { indexed: true, name: "orderId", type: "uint256" },
128
+ { indexed: true, name: "merchant", type: "address" },
129
+ { indexed: false, name: "pubKey", type: "string" },
130
+ {
131
+ indexed: false,
132
+ name: "_order",
133
+ type: "tuple",
134
+ components: [
135
+ { name: "amount", type: "uint256" },
136
+ { name: "fiatAmount", type: "uint256" },
137
+ { name: "placedTimestamp", type: "uint256" },
138
+ { name: "completedTimestamp", type: "uint256" },
139
+ { name: "userCompletedTimestamp", type: "uint256" },
140
+ { name: "acceptedMerchant", type: "address" },
141
+ { name: "user", type: "address" },
142
+ { name: "recipientAddr", type: "address" },
143
+ { name: "pubkey", type: "string" },
144
+ { name: "encUpi", type: "string" },
145
+ { name: "userCompleted", type: "bool" },
146
+ { name: "status", type: "uint8" },
147
+ { name: "orderType", type: "uint8" },
148
+ {
149
+ name: "disputeInfo",
150
+ type: "tuple",
151
+ components: [
152
+ { name: "raisedBy", type: "uint8" },
153
+ { name: "status", type: "uint8" },
154
+ { name: "redactTransId", type: "uint256" },
155
+ { name: "accountNumber", type: "uint256" }
156
+ ]
157
+ },
158
+ { name: "id", type: "uint256" },
159
+ { name: "userPubKey", type: "string" },
160
+ { name: "encMerchantUpi", type: "string" },
161
+ { name: "acceptedAccountNo", type: "uint256" },
162
+ { name: "assignedAccountNos", type: "uint256[]" },
163
+ { name: "currency", type: "bytes32" },
164
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
165
+ { name: "circleId", type: "uint256" }
166
+ ]
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ type: "event",
172
+ name: "BuyOrderPaid",
173
+ anonymous: false,
174
+ inputs: [
175
+ { indexed: true, name: "orderId", type: "uint256" },
176
+ { indexed: true, name: "user", type: "address" },
177
+ {
178
+ indexed: false,
179
+ name: "_order",
180
+ type: "tuple",
181
+ components: [
182
+ { name: "amount", type: "uint256" },
183
+ { name: "fiatAmount", type: "uint256" },
184
+ { name: "placedTimestamp", type: "uint256" },
185
+ { name: "completedTimestamp", type: "uint256" },
186
+ { name: "userCompletedTimestamp", type: "uint256" },
187
+ { name: "acceptedMerchant", type: "address" },
188
+ { name: "user", type: "address" },
189
+ { name: "recipientAddr", type: "address" },
190
+ { name: "pubkey", type: "string" },
191
+ { name: "encUpi", type: "string" },
192
+ { name: "userCompleted", type: "bool" },
193
+ { name: "status", type: "uint8" },
194
+ { name: "orderType", type: "uint8" },
195
+ {
196
+ name: "disputeInfo",
197
+ type: "tuple",
198
+ components: [
199
+ { name: "raisedBy", type: "uint8" },
200
+ { name: "status", type: "uint8" },
201
+ { name: "redactTransId", type: "uint256" },
202
+ { name: "accountNumber", type: "uint256" }
203
+ ]
204
+ },
205
+ { name: "id", type: "uint256" },
206
+ { name: "userPubKey", type: "string" },
207
+ { name: "encMerchantUpi", type: "string" },
208
+ { name: "acceptedAccountNo", type: "uint256" },
209
+ { name: "assignedAccountNos", type: "uint256[]" },
210
+ { name: "currency", type: "bytes32" },
211
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
212
+ { name: "circleId", type: "uint256" }
213
+ ]
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ type: "event",
219
+ name: "OrderCompleted",
220
+ anonymous: false,
221
+ inputs: [
222
+ { indexed: true, name: "orderId", type: "uint256" },
223
+ { indexed: true, name: "user", type: "address" },
224
+ { indexed: false, name: "completedTimestamp", type: "uint256" },
225
+ {
226
+ indexed: false,
227
+ name: "_order",
228
+ type: "tuple",
229
+ components: [
230
+ { name: "amount", type: "uint256" },
231
+ { name: "fiatAmount", type: "uint256" },
232
+ { name: "placedTimestamp", type: "uint256" },
233
+ { name: "completedTimestamp", type: "uint256" },
234
+ { name: "userCompletedTimestamp", type: "uint256" },
235
+ { name: "acceptedMerchant", type: "address" },
236
+ { name: "user", type: "address" },
237
+ { name: "recipientAddr", type: "address" },
238
+ { name: "pubkey", type: "string" },
239
+ { name: "encUpi", type: "string" },
240
+ { name: "userCompleted", type: "bool" },
241
+ { name: "status", type: "uint8" },
242
+ { name: "orderType", type: "uint8" },
243
+ {
244
+ name: "disputeInfo",
245
+ type: "tuple",
246
+ components: [
247
+ { name: "raisedBy", type: "uint8" },
248
+ { name: "status", type: "uint8" },
249
+ { name: "redactTransId", type: "uint256" },
250
+ { name: "accountNumber", type: "uint256" }
251
+ ]
252
+ },
253
+ { name: "id", type: "uint256" },
254
+ { name: "userPubKey", type: "string" },
255
+ { name: "encMerchantUpi", type: "string" },
256
+ { name: "acceptedAccountNo", type: "uint256" },
257
+ { name: "assignedAccountNos", type: "uint256[]" },
258
+ { name: "currency", type: "bytes32" },
259
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
260
+ { name: "circleId", type: "uint256" }
261
+ ]
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ type: "event",
267
+ name: "CancelledOrders",
268
+ anonymous: false,
269
+ inputs: [
270
+ { indexed: true, name: "orderId", type: "uint256" },
271
+ {
272
+ indexed: false,
273
+ name: "_order",
274
+ type: "tuple",
275
+ components: [
276
+ { name: "amount", type: "uint256" },
277
+ { name: "fiatAmount", type: "uint256" },
278
+ { name: "placedTimestamp", type: "uint256" },
279
+ { name: "completedTimestamp", type: "uint256" },
280
+ { name: "userCompletedTimestamp", type: "uint256" },
281
+ { name: "acceptedMerchant", type: "address" },
282
+ { name: "user", type: "address" },
283
+ { name: "recipientAddr", type: "address" },
284
+ { name: "pubkey", type: "string" },
285
+ { name: "encUpi", type: "string" },
286
+ { name: "userCompleted", type: "bool" },
287
+ { name: "status", type: "uint8" },
288
+ { name: "orderType", type: "uint8" },
289
+ {
290
+ name: "disputeInfo",
291
+ type: "tuple",
292
+ components: [
293
+ { name: "raisedBy", type: "uint8" },
294
+ { name: "status", type: "uint8" },
295
+ { name: "redactTransId", type: "uint256" },
296
+ { name: "accountNumber", type: "uint256" }
297
+ ]
298
+ },
299
+ { name: "id", type: "uint256" },
300
+ { name: "userPubKey", type: "string" },
301
+ { name: "encMerchantUpi", type: "string" },
302
+ { name: "acceptedAccountNo", type: "uint256" },
303
+ { name: "assignedAccountNos", type: "uint256[]" },
304
+ { name: "currency", type: "bytes32" },
305
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
306
+ { name: "circleId", type: "uint256" }
307
+ ]
308
+ }
309
+ ]
310
+ }
311
+ ];
312
+
313
+ // src/contracts/abis/order-processor-facet.ts
314
+ var orderProcessorFacetAbi = [
315
+ {
316
+ type: "function",
317
+ name: "getOrdersById",
318
+ stateMutability: "view",
319
+ inputs: [{ name: "orderId", type: "uint256" }],
320
+ outputs: [
321
+ {
322
+ type: "tuple",
323
+ components: [
324
+ { name: "amount", type: "uint256" },
325
+ { name: "fiatAmount", type: "uint256" },
326
+ { name: "placedTimestamp", type: "uint256" },
327
+ { name: "completedTimestamp", type: "uint256" },
328
+ { name: "userCompletedTimestamp", type: "uint256" },
329
+ { name: "acceptedMerchant", type: "address" },
330
+ { name: "user", type: "address" },
331
+ { name: "recipientAddr", type: "address" },
332
+ { name: "pubkey", type: "string" },
333
+ { name: "encUpi", type: "string" },
334
+ { name: "userCompleted", type: "bool" },
335
+ { name: "status", type: "uint8" },
336
+ { name: "orderType", type: "uint8" },
337
+ {
338
+ name: "disputeInfo",
339
+ type: "tuple",
340
+ components: [
341
+ { name: "raisedBy", type: "uint8" },
342
+ { name: "status", type: "uint8" },
343
+ { name: "redactTransId", type: "uint256" },
344
+ { name: "accountNumber", type: "uint256" }
345
+ ]
346
+ },
347
+ { name: "id", type: "uint256" },
348
+ { name: "userPubKey", type: "string" },
349
+ { name: "encMerchantUpi", type: "string" },
350
+ { name: "acceptedAccountNo", type: "uint256" },
351
+ { name: "assignedAccountNos", type: "uint256[]" },
352
+ { name: "currency", type: "bytes32" },
353
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
354
+ { name: "circleId", type: "uint256" }
355
+ ]
356
+ }
357
+ ]
358
+ },
359
+ {
360
+ type: "function",
361
+ name: "getAdditionalOrderDetails",
362
+ stateMutability: "view",
363
+ inputs: [{ name: "orderId", type: "uint256" }],
364
+ outputs: [
365
+ {
366
+ type: "tuple",
367
+ components: [
368
+ { name: "fixedFeePaid", type: "uint64" },
369
+ { name: "tipsPaid", type: "uint64" },
370
+ { name: "acceptedTimestamp", type: "uint128" },
371
+ { name: "paidTimestamp", type: "uint128" },
372
+ { name: "reserved2", type: "uint128" },
373
+ { name: "actualUsdtAmount", type: "uint256" },
374
+ { name: "actualFiatAmount", type: "uint256" }
375
+ ]
376
+ }
377
+ ]
378
+ },
379
+ {
380
+ type: "function",
381
+ name: "getSmallOrderThreshold",
382
+ stateMutability: "view",
383
+ inputs: [{ name: "currency", type: "bytes32" }],
384
+ outputs: [{ name: "", type: "uint256" }]
385
+ },
386
+ {
387
+ type: "function",
388
+ name: "getSmallOrderFixedFee",
389
+ stateMutability: "view",
390
+ inputs: [{ name: "currency", type: "bytes32" }],
391
+ outputs: [{ name: "", type: "uint256" }]
392
+ },
393
+ {
394
+ type: "function",
395
+ name: "raiseDispute",
396
+ stateMutability: "nonpayable",
397
+ inputs: [
398
+ { name: "_orderId", type: "uint256" },
399
+ { name: "redactTransId", type: "uint256" }
400
+ ],
401
+ outputs: []
402
+ },
403
+ {
404
+ type: "function",
405
+ name: "paidBuyOrder",
406
+ stateMutability: "nonpayable",
407
+ inputs: [{ name: "_orderId", type: "uint256" }],
408
+ outputs: []
409
+ }
410
+ ];
411
+
412
+ // src/contracts/abis/p2p-config-facet.ts
413
+ var p2pConfigFacetAbi = [
414
+ {
415
+ inputs: [
416
+ {
417
+ internalType: "bytes32",
418
+ name: "_currency",
419
+ type: "bytes32"
420
+ }
421
+ ],
422
+ name: "getPriceConfig",
423
+ outputs: [
424
+ {
425
+ components: [
426
+ {
427
+ internalType: "uint256",
428
+ name: "buyPrice",
429
+ type: "uint256"
430
+ },
431
+ {
432
+ internalType: "uint256",
433
+ name: "sellPrice",
434
+ type: "uint256"
435
+ },
436
+ {
437
+ internalType: "int256",
438
+ name: "buyPriceOffset",
439
+ type: "int256"
440
+ },
441
+ {
442
+ internalType: "uint256",
443
+ name: "baseSpread",
444
+ type: "uint256"
445
+ }
446
+ ],
447
+ internalType: "struct P2pConfigStorage.PriceConfig",
448
+ name: "",
449
+ type: "tuple"
450
+ }
451
+ ],
452
+ stateMutability: "view",
453
+ type: "function"
454
+ },
455
+ {
456
+ inputs: [
457
+ {
458
+ internalType: "bytes32",
459
+ name: "_nativeCurrency",
460
+ type: "bytes32"
461
+ }
462
+ ],
463
+ name: "getRpPerUsdtLimitRational",
464
+ outputs: [
465
+ {
466
+ internalType: "uint256",
467
+ name: "numerator",
468
+ type: "uint256"
469
+ },
470
+ {
471
+ internalType: "uint256",
472
+ name: "denominator",
473
+ type: "uint256"
474
+ }
475
+ ],
476
+ stateMutability: "view",
477
+ type: "function"
478
+ }
479
+ ];
480
+
481
+ // src/contracts/abis/reputation-manager.ts
482
+ var reputationManagerAbi = [
483
+ {
484
+ inputs: [
485
+ {
486
+ internalType: "string",
487
+ name: "_socialName",
488
+ type: "string"
489
+ },
490
+ {
491
+ components: [
492
+ {
493
+ components: [
494
+ {
495
+ internalType: "string",
496
+ name: "provider",
497
+ type: "string"
498
+ },
499
+ {
500
+ internalType: "string",
501
+ name: "parameters",
502
+ type: "string"
503
+ },
504
+ {
505
+ internalType: "string",
506
+ name: "context",
507
+ type: "string"
508
+ }
509
+ ],
510
+ internalType: "struct IReclaimSDK.ClaimInfo",
511
+ name: "claimInfo",
512
+ type: "tuple"
513
+ },
514
+ {
515
+ components: [
516
+ {
517
+ components: [
518
+ {
519
+ internalType: "bytes32",
520
+ name: "identifier",
521
+ type: "bytes32"
522
+ },
523
+ {
524
+ internalType: "address",
525
+ name: "owner",
526
+ type: "address"
527
+ },
528
+ {
529
+ internalType: "uint32",
530
+ name: "timestampS",
531
+ type: "uint32"
532
+ },
533
+ {
534
+ internalType: "uint32",
535
+ name: "epoch",
536
+ type: "uint32"
537
+ }
538
+ ],
539
+ internalType: "struct IReclaimSDK.CompleteClaimData",
540
+ name: "claim",
541
+ type: "tuple"
542
+ },
543
+ {
544
+ internalType: "bytes[]",
545
+ name: "signatures",
546
+ type: "bytes[]"
547
+ }
548
+ ],
549
+ internalType: "struct IReclaimSDK.SignedClaim",
550
+ name: "signedClaim",
551
+ type: "tuple"
552
+ }
553
+ ],
554
+ internalType: "struct IReclaimSDK.Proof[]",
555
+ name: "proofs",
556
+ type: "tuple[]"
557
+ }
558
+ ],
559
+ name: "socialVerify",
560
+ outputs: [],
561
+ stateMutability: "nonpayable",
562
+ type: "function"
563
+ },
564
+ {
565
+ inputs: [
566
+ {
567
+ internalType: "uint256",
568
+ name: "nullifierSeed",
569
+ type: "uint256"
570
+ },
571
+ {
572
+ internalType: "uint256",
573
+ name: "nullifier",
574
+ type: "uint256"
575
+ },
576
+ {
577
+ internalType: "uint256",
578
+ name: "timestamp",
579
+ type: "uint256"
580
+ },
581
+ {
582
+ internalType: "uint256",
583
+ name: "signal",
584
+ type: "uint256"
585
+ },
586
+ {
587
+ internalType: "uint256[4]",
588
+ name: "revealArray",
589
+ type: "uint256[4]"
590
+ },
591
+ {
592
+ internalType: "uint256[8]",
593
+ name: "groth16Proof",
594
+ type: "uint256[8]"
595
+ }
596
+ ],
597
+ name: "submitAnonAadharProof",
598
+ outputs: [],
599
+ stateMutability: "nonpayable",
600
+ type: "function"
601
+ },
602
+ {
603
+ inputs: [
604
+ {
605
+ components: [
606
+ {
607
+ internalType: "bytes32",
608
+ name: "version",
609
+ type: "bytes32"
610
+ },
611
+ {
612
+ components: [
613
+ {
614
+ internalType: "bytes32",
615
+ name: "vkeyHash",
616
+ type: "bytes32"
617
+ },
618
+ {
619
+ internalType: "bytes",
620
+ name: "proof",
621
+ type: "bytes"
622
+ },
623
+ {
624
+ internalType: "bytes32[]",
625
+ name: "publicInputs",
626
+ type: "bytes32[]"
627
+ }
628
+ ],
629
+ internalType: "struct ProofVerificationData",
630
+ name: "proofVerificationData",
631
+ type: "tuple"
632
+ },
633
+ {
634
+ internalType: "bytes",
635
+ name: "committedInputs",
636
+ type: "bytes"
637
+ },
638
+ {
639
+ components: [
640
+ {
641
+ internalType: "uint256",
642
+ name: "validityPeriodInSeconds",
643
+ type: "uint256"
644
+ },
645
+ {
646
+ internalType: "string",
647
+ name: "domain",
648
+ type: "string"
649
+ },
650
+ {
651
+ internalType: "string",
652
+ name: "scope",
653
+ type: "string"
654
+ },
655
+ {
656
+ internalType: "bool",
657
+ name: "devMode",
658
+ type: "bool"
659
+ }
660
+ ],
661
+ internalType: "struct ServiceConfig",
662
+ name: "serviceConfig",
663
+ type: "tuple"
664
+ }
665
+ ],
666
+ internalType: "struct ProofVerificationParams",
667
+ name: "params",
668
+ type: "tuple"
669
+ },
670
+ {
671
+ internalType: "bool",
672
+ name: "isIDCard",
673
+ type: "bool"
674
+ }
675
+ ],
676
+ name: "zkPassportRegister",
677
+ outputs: [],
678
+ stateMutability: "nonpayable",
679
+ type: "function"
680
+ }
681
+ ];
682
+
683
+ // src/contracts/abis/index.ts
684
+ var DIAMOND_ABI = [
685
+ ...orderFlowFacetAbi,
686
+ ...orderProcessorFacetAbi,
687
+ ...p2pConfigFacetAbi
688
+ ];
689
+ var ABIS = {
690
+ DIAMOND: DIAMOND_ABI,
691
+ FACETS: {
692
+ ORDER_FLOW: orderFlowFacetAbi,
693
+ ORDER_PROCESSOR: orderProcessorFacetAbi,
694
+ CONFIG: p2pConfigFacetAbi
695
+ },
696
+ EXTERNAL: {
697
+ USDC: erc20Abi,
698
+ REPUTATION_MANAGER: reputationManagerAbi
699
+ }
700
+ };
701
+
702
+ // src/contracts/errors.ts
703
+ var contractErrors = {
704
+ // Access control
705
+ NotAdmin: "NOT_ADMIN",
706
+ NotSuperAdmin: "NOT_SUPER_ADMIN",
707
+ NotAuthorized: "NOT_AUTHORIZED",
708
+ NotSelf: "NOT_SELF",
709
+ NotWhitelisted: "NOT_WHITELISTED",
710
+ NotCircleAdmin: "NOT_CIRCLE_ADMIN",
711
+ // Circle / community management
712
+ InvalidName: "INVALID_NAME",
713
+ InvalidCommunityUrl: "INVALID_COMMUNITY_URL",
714
+ InvalidAdminCommunityUrl: "INVALID_ADMIN_COMMUNITY_URL",
715
+ AdminAlreadyHasCircle: "ADMIN_ALREADY_HAS_CIRCLE",
716
+ CircleNameAlreadyTaken: "CIRCLE_NAME_ALREADY_TAKEN",
717
+ P2PStakeConfigNotSet: "P2P_STAKE_CONFIG_NOT_SET",
718
+ InsufficientP2PStake: "INSUFFICIENT_P2P_STAKE",
719
+ P2PTokenNotSet: "P2P_TOKEN_NOT_SET",
720
+ P2PUnstakeRequestPending: "P2P_UNSTAKE_REQUEST_PENDING",
721
+ NoP2PUnstakeRequest: "NO_P2P_UNSTAKE_REQUEST",
722
+ P2PUnstakeCooldownNotPassed: "P2P_UNSTAKE_COOLDOWN_NOT_PASSED",
723
+ SlashAmountExceedsStake: "SLASH_AMOUNT_EXCEEDS_STAKE",
724
+ CircleNotActive: "CIRCLE_NOT_ACTIVE",
725
+ InvalidCircleId: "INVALID_CIRCLE_ID",
726
+ CurrencyMismatch: "CURRENCY_MISMATCH",
727
+ CircleFull: "CIRCLE_FULL",
728
+ CircleIdMismatch: "CIRCLE_ID_MISMATCH",
729
+ DuplicateAccountName: "DUPLICATE_ACCOUNT_NAME",
730
+ EmptyName: "EMPTY_NAME",
731
+ AccountBoundToAnotherCircle: "ACCOUNT_BOUND_TO_ANOTHER_CIRCLE",
732
+ ExitAmountExceededCircleBalance: "EXIT_AMOUNT_EXCEEDED_CIRCLE_BALANCE",
733
+ UndelegationAmountTooHigh: "UNDELEGATION_AMOUNT_TOO_HIGH",
734
+ // Exchange / order lifecycle
735
+ ExchangeNotOperational: "EXCHANGE_NOT_OPERATIONAL",
736
+ OrderNotPlaced: "ORDER_NOT_PLACED",
737
+ OrderNotPaid: "ORDER_NOT_PAID",
738
+ OrderStatusInvalid: "ORDER_STATUS_INVALID",
739
+ OrderExpired: "ORDER_EXPIRED",
740
+ OrderAlreadyPaid: "ORDER_ALREADY_PAID",
741
+ OrderAlreadyCompleted: "ORDER_ALREADY_COMPLETED",
742
+ InvalidOrderType: "INVALID_ORDER_TYPE",
743
+ OrderTypeIncorrect: "ORDER_TYPE_INCORRECT",
744
+ OrderNotAccepted: "ORDER_NOT_ACCEPTED",
745
+ OrderNotAssigned: "ORDER_NOT_ASSIGNED",
746
+ OrderAmountExceedsLimit: "ORDER_AMOUNT_EXCEEDS_LIMIT",
747
+ InvalidOrderAmount: "INVALID_ORDER_AMOUNT",
748
+ InvalidOrderAmountToCoverFee: "INVALID_ORDER_AMOUNT_TO_COVER_FEE",
749
+ InvalidOrderId: "INVALID_ORDER_ID",
750
+ OrderTooEarlyForReassignment: "ORDER_TOO_EARLY_FOR_REASSIGNMENT",
751
+ OrderTooLateForReassignment: "ORDER_TOO_LATE_FOR_REASSIGNMENT",
752
+ ReAssignmentNotRequired: "REASSIGNMENT_NOT_REQUIRED",
753
+ TipAlreadyGiven: "TIP_ALREADY_GIVEN",
754
+ CashbackTransferFailed: "CASHBACK_TRANSFER_FAILED",
755
+ // Order limits
756
+ DailyBuyOrderLimitExceeded: "DAILY_BUY_ORDER_LIMIT_EXCEEDED",
757
+ MonthlyBuyOrderLimitExceeded: "MONTHLY_BUY_ORDER_LIMIT_EXCEEDED",
758
+ SellOrderAmountLimitExceeded: "SELL_ORDER_AMOUNT_LIMIT_EXCEEDED",
759
+ BuyOrderAmountExceedsLimit: "BUY_ORDER_AMOUNT_EXCEEDS_LIMIT",
760
+ SellOrderAmountExceedsLimit: "SELL_ORDER_AMOUNT_EXCEEDS_LIMIT",
761
+ BuyAmountExceedsUsdcLimit: "BUY_AMOUNT_EXCEEDS_USDC_LIMIT",
762
+ SellAmountExceedsFiatLimit: "SELL_AMOUNT_EXCEEDS_FIAT_LIMIT",
763
+ DailyVolumeLimitExceeded: "DAILY_VOLUME_LIMIT_EXCEEDED",
764
+ MonthlyVolumeLimitExceeded: "MONTHLY_VOLUME_LIMIT_EXCEEDED",
765
+ UserYearlyVolumeLimitExceeded: "USER_YEARLY_VOLUME_LIMIT_EXCEEDED",
766
+ // Dispute
767
+ DisputeTimeNotReached: "DISPUTE_TIME_NOT_REACHED",
768
+ DisputeTimeExpired: "DISPUTE_TIME_EXPIRED",
769
+ InvalidOrderStatusToRaiseDispute: "INVALID_ORDER_STATUS_TO_RAISE_DISPUTE",
770
+ DisputeNotRaised: "DISPUTE_NOT_RAISED",
771
+ CannotRaiseDisputeTwice: "CANNOT_RAISE_DISPUTE_TWICE",
772
+ DisputeAlreadySettled: "DISPUTE_ALREADY_SETTLED",
773
+ TransactionIdMismatch: "TRANSACTION_ID_MISMATCH",
774
+ AccountNumberMismatch: "ACCOUNT_NUMBER_MISMATCH",
775
+ NotPaidBuyOrder: "NOT_PAID_BUY_ORDER",
776
+ // Payment channels
777
+ PaymentChannelNotFound: "PAYMENT_CHANNEL_NOT_FOUND",
778
+ PaymentChannelNotActive: "PAYMENT_CHANNEL_NOT_ACTIVE",
779
+ PaymentChannelNotApproved: "PAYMENT_CHANNEL_NOT_APPROVED",
780
+ PaymentChannelNotRejected: "PAYMENT_CHANNEL_NOT_REJECTED",
781
+ InvalidPaymentChannelId: "INVALID_PAYMENT_CHANNEL_ID",
782
+ DuplicatePaymentChannel: "DUPLICATE_PAYMENT_CHANNEL",
783
+ OldPaymentChannelNotFound: "OLD_PAYMENT_CHANNEL_NOT_FOUND",
784
+ NewPaymentChannelNotFound: "NEW_PAYMENT_CHANNEL_NOT_FOUND",
785
+ SamePaymentChannel: "SAME_PAYMENT_CHANNEL",
786
+ OldPaymentChannelShouldBeInactive: "OLD_PAYMENT_CHANNEL_SHOULD_BE_INACTIVE",
787
+ NewPaymentChannelShouldBeActive: "NEW_PAYMENT_CHANNEL_SHOULD_BE_ACTIVE",
788
+ OngoingOrderOnPaymentChannel: "ONGOING_ORDER_ON_PAYMENT_CHANNEL",
789
+ UpiAlreadySent: "UPI_ALREADY_SENT",
790
+ InvalidOrderUpi: "INVALID_ORDER_UPI",
791
+ NoFiatLiquidity: "NO_FIAT_LIQUIDITY",
792
+ // Merchant
793
+ NotEnoughEligibleMerchants: "NOT_ENOUGH_ELIGIBLE_MERCHANTS",
794
+ MerchantNotRegistered: "MERCHANT_NOT_REGISTERED",
795
+ MerchantNotApproved: "MERCHANT_NOT_APPROVED",
796
+ MerchantAlreadyRegistered: "MERCHANT_ALREADY_REGISTERED",
797
+ MerchantAlreadyRejected: "MERCHANT_ALREADY_REJECTED",
798
+ MerchantBlacklisted: "MERCHANT_BLACKLISTED",
799
+ MerchantNotBlacklisted: "MERCHANT_NOT_BLACKLISTED",
800
+ MerchantAlreadyBlacklisted: "MERCHANT_ALREADY_BLACKLISTED",
801
+ MerchantHasOngoingOrders: "MERCHANT_HAS_ONGOING_ORDERS",
802
+ MerchantNotFullfilledEligibilityThreshold: "MERCHANT_NOT_FULLFILLED_ELIGIBILITY_THRESHOLD",
803
+ InvalidMerchant: "INVALID_MERCHANT",
804
+ // Staking / unstaking
805
+ StakeAmountTooLow: "STAKE_AMOUNT_TOO_LOW",
806
+ AdditionalStakeNotAllowed: "ADDITIONAL_STAKE_NOT_ALLOWED",
807
+ UnstakeRequestPending: "UNSTAKE_REQUEST_PENDING",
808
+ UnstakeRequestNotPending: "UNSTAKE_REQUEST_NOT_PENDING",
809
+ UnstakeAmountExceeded: "UNSTAKE_AMOUNT_EXCEEDED",
810
+ ZeroUnstakeAmount: "ZERO_UNSTAKE_AMOUNT",
811
+ NoWithdrawableAmount: "NO_WITHDRAWABLE_AMOUNT",
812
+ NoStake: "NO_STAKE",
813
+ NoStakers: "NO_STAKERS",
814
+ InsufficientStakedAmount: "INSUFFICIENT_STAKED_AMOUNT",
815
+ CooldownNotPassed: "COOLDOWN_NOT_PASSED",
816
+ ClaimableRewardsNotAvailable: "CLAIMABLE_REWARDS_NOT_AVAILABLE",
817
+ // Delegation
818
+ ExitWouldBreachDelegationInvariant: "EXIT_WOULD_BREACH_DELEGATION_INVARIANT",
819
+ AggregateDelegationExceedsTotalStaked: "AGGREGATE_DELEGATION_EXCEEDS_TOTAL_STAKED",
820
+ InsufficientMerchantRewards: "INSUFFICIENT_MERCHANT_REWARDS",
821
+ // Migration
822
+ InvalidMigrationStatus: "INVALID_MIGRATION_STATUS",
823
+ MigrationRequestNotPending: "MIGRATION_REQUEST_NOT_PENDING",
824
+ MigrationAlreadyRequested: "MIGRATION_ALREADY_REQUESTED",
825
+ // Token / currency
826
+ TokenAlreadyExists: "TOKEN_ALREADY_EXISTS",
827
+ TokenNotFound: "TOKEN_NOT_FOUND",
828
+ TokenEmpty: "TOKEN_EMPTY",
829
+ CurrencyNotSupported: "CURRENCY_NOT_SUPPORTED",
830
+ InvalidCurrency: "INVALID_CURRENCY",
831
+ // USDC / transfer
832
+ UsdtTransferFailed: "USDC_TRANSFER_FAILED",
833
+ UsdtTransferFailedWithErrorMessage: "USDC_TRANSFER_FAILED_WITH_ERROR_MESSAGE",
834
+ UsdtTransferFailedWithPanic: "USDC_TRANSFER_FAILED_WITH_PANIC",
835
+ InsufficientAllowance: "INSUFFICIENT_ALLOWANCE",
836
+ // ZK Passport
837
+ ZKPassportVerifierNotSet: "ZK_PASSPORT_VERIFIER_NOT_SET",
838
+ ZKPassportDomainEmpty: "ZK_PASSPORT_DOMAIN_EMPTY",
839
+ ZKPassportScopeEmpty: "ZK_PASSPORT_SCOPE_EMPTY",
840
+ PassportAlreadyVerified: "PASSPORT_ALREADY_VERIFIED",
841
+ ZKPassportProofInvalid: "ZK_PASSPORT_PROOF_INVALID",
842
+ ZKPassportIdentifierAlreadyVerified: "ZK_PASSPORT_IDENTIFIER_ALREADY_VERIFIED",
843
+ ZKPassportInvalidScope: "ZK_PASSPORT_INVALID_SCOPE",
844
+ ZKPassportUnexpectedSender: "ZK_PASSPORT_UNEXPECTED_SENDER",
845
+ ZKPassportAgeBelowMinimum: "ZK_PASSPORT_AGE_BELOW_MINIMUM",
846
+ ZKPassportMinAgeTooHigh: "ZK_PASSPORT_MIN_AGE_TOO_HIGH",
847
+ // Chainlink / oracle
848
+ UnexpectedRequestId: "UNEXPECTED_REQUEST_ID",
849
+ OnlyRouterCanFulfill: "ONLY_ROUTER_CAN_FULFILL",
850
+ RequestFailed: "REQUEST_FAILED",
851
+ SourceCodeMismatch: "SOURCE_CODE_MISMATCH",
852
+ ZeroMarketPrice: "ZERO_MARKET_PRICE",
853
+ InvalidComputedPrices: "INVALID_COMPUTED_PRICES",
854
+ NotPriceUpdaterForCurrency: "NOT_PRICE_UPDATER_FOR_CURRENCY",
855
+ ThresholdNotConfigured: "THRESHOLD_NOT_CONFIGURED",
856
+ SlippageExceeded: "SLIPPAGE_EXCEEDED",
857
+ // Reputation / verification
858
+ UserHasNoReputation: "USER_HAS_NO_REPUTATION",
859
+ ZeroReputationPoints: "ZERO_REPUTATION_POINTS",
860
+ NoReputation: "NO_REPUTATION",
861
+ InsufficientRP: "INSUFFICIENT_RP",
862
+ NullifierAlreadyVerified: "NULLIFIER_ALREADY_VERIFIED",
863
+ VerificationFailed: "VERIFICATION_FAILED",
864
+ InvalidSocialPlatform: "INVALID_SOCIAL_PLATFORM",
865
+ SocialAlreadyVerified: "SOCIAL_ALREADY_VERIFIED",
866
+ YearFieldNotInProof: "YEAR_FIELD_NOT_IN_PROOF",
867
+ UserIdFieldNotInProof: "USER_ID_FIELD_NOT_IN_PROOF",
868
+ UserIdAlreadyVerified: "USER_ID_ALREADY_VERIFIED",
869
+ UsernameAlreadyVerified: "USERNAME_ALREADY_VERIFIED",
870
+ UsernameNotInProof: "USERNAME_NOT_IN_PROOF",
871
+ LinkedInOnlyRpUpdates: "LINKEDIN_ONLY_RP_UPDATES",
872
+ FacebookOnlyRpUpdates: "FACEBOOK_ONLY_RP_UPDATES",
873
+ // Voting / referral
874
+ AlreadyReferred: "ALREADY_REFERRED",
875
+ SelfReferralNotAllowed: "SELF_REFERRAL_NOT_ALLOWED",
876
+ NotEligibleToRefer: "NOT_ELIGIBLE_TO_REFER",
877
+ MerchantMonthlyReferralLimitReached: "MERCHANT_MONTHLY_REFERRAL_LIMIT_REACHED",
878
+ NoRecommender: "NO_RECOMMENDER",
879
+ RecommendationAlreadyClaimed: "RECOMMENDATION_ALREADY_CLAIMED",
880
+ CannotVoteYourself: "CANNOT_VOTE_YOURSELF",
881
+ VotesPerEpochExceeded: "VOTES_PER_EPOCH_EXCEEDED",
882
+ AlreadyVoted: "ALREADY_VOTED",
883
+ FunctionNotFound: "FUNCTION_NOT_FOUND",
884
+ // Campaign
885
+ CampaignNotActive: "CAMPAIGN_NOT_ACTIVE",
886
+ InvalidManagerDetails: "INVALID_MANAGER_DETAILS",
887
+ UnclaimedRewardsExist: "UNCLAIMED_REWARDS_EXIST",
888
+ RewardAlreadyClaimed: "REWARD_ALREADY_CLAIMED",
889
+ OnlyNewUsersAllowed: "ONLY_NEW_USERS_ALLOWED",
890
+ ManagerNotFound: "MANAGER_NOT_FOUND",
891
+ ManagerInactive: "MANAGER_INACTIVE",
892
+ NoRewards: "NO_REWARDS",
893
+ InvalidCampaignId: "INVALID_CAMPAIGN_ID",
894
+ CannotClaimRevenueForCurrentMonth: "CANNOT_CLAIM_REVENUE_FOR_CURRENT_MONTH",
895
+ // Referral reward config
896
+ RewardPercentageTooHigh: "REWARD_PERCENTAGE_TOO_HIGH",
897
+ // Signature / nonce
898
+ NonceAlreadyUsed: "NONCE_ALREADY_USED",
899
+ SignatureValidationFailed: "SIGNATURE_VALIDATION_FAILED",
900
+ // Misc
901
+ InvalidAddress: "INVALID_ADDRESS",
902
+ InvalidBlockAmount: "INVALID_BLOCK_AMOUNT",
903
+ InvalidAmount: "INVALID_AMOUNT",
904
+ InvalidInput: "INVALID_INPUT",
905
+ InvalidStatusTransition: "INVALID_STATUS_TRANSITION",
906
+ ArrayLengthMismatch: "ARRAY_LENGTH_MISMATCH",
907
+ UserIsBlacklisted: "USER_IS_BLACKLISTED",
908
+ ZeroAddress: "ZERO_ADDRESS",
909
+ ReentrancyGuard: "REENTRANCY_GUARD",
910
+ BatchTooLarge: "BATCH_TOO_LARGE",
911
+ UnderflowSubtraction: "UNDERFLOW_SUBTRACTION",
912
+ TargetLongerThanData: "TARGET_LONGER_THAN_DATA"
913
+ };
914
+ var hexContractErrors = {
915
+ // Access control
916
+ "0x7bfa4b9f": contractErrors.NotAdmin,
917
+ "0x16c726b1": contractErrors.NotSuperAdmin,
918
+ "0xea8e4eb5": contractErrors.NotAuthorized,
919
+ "0x29c3b7ee": contractErrors.NotSelf,
920
+ "0x584a7938": contractErrors.NotWhitelisted,
921
+ "0xa8143fbc": contractErrors.NotCircleAdmin,
922
+ // Circle / community management
923
+ "0x430f13b3": contractErrors.InvalidName,
924
+ "0xe7cbf75a": contractErrors.InvalidCommunityUrl,
925
+ "0x3762bfee": contractErrors.InvalidAdminCommunityUrl,
926
+ "0x201c1ffc": contractErrors.AdminAlreadyHasCircle,
927
+ "0x6540a51d": contractErrors.CircleNameAlreadyTaken,
928
+ "0xcadc6786": contractErrors.P2PStakeConfigNotSet,
929
+ "0x78317f44": contractErrors.InsufficientP2PStake,
930
+ "0x18eda032": contractErrors.P2PTokenNotSet,
931
+ "0xdab11ea6": contractErrors.P2PUnstakeRequestPending,
932
+ "0xeb1ce40b": contractErrors.NoP2PUnstakeRequest,
933
+ "0xbf2d0ba1": contractErrors.P2PUnstakeCooldownNotPassed,
934
+ "0x06b663af": contractErrors.SlashAmountExceedsStake,
935
+ "0xff9b022c": contractErrors.CircleNotActive,
936
+ "0x3d90c0a6": contractErrors.InvalidCircleId,
937
+ "0xfb42a67d": contractErrors.CurrencyMismatch,
938
+ "0xf2775265": contractErrors.CircleFull,
939
+ "0x784b6c3c": contractErrors.CircleIdMismatch,
940
+ "0xee240e49": contractErrors.DuplicateAccountName,
941
+ "0x2ef13105": contractErrors.EmptyName,
942
+ "0x1b5433c8": contractErrors.AccountBoundToAnotherCircle,
943
+ "0x549e2555": contractErrors.ExitAmountExceededCircleBalance,
944
+ "0x865b21e1": contractErrors.UndelegationAmountTooHigh,
945
+ // Exchange / order lifecycle
946
+ "0x4bbac5de": contractErrors.ExchangeNotOperational,
947
+ "0x58db8ed6": contractErrors.OrderNotPlaced,
948
+ "0x1e3b9629": contractErrors.OrderNotPaid,
949
+ "0x181b1b2e": contractErrors.OrderStatusInvalid,
950
+ "0xc56873ba": contractErrors.OrderExpired,
951
+ "0x7f61b868": contractErrors.OrderAlreadyPaid,
952
+ "0x03683687": contractErrors.OrderAlreadyCompleted,
953
+ "0x688c176f": contractErrors.InvalidOrderType,
954
+ "0x2e757a60": contractErrors.OrderTypeIncorrect,
955
+ "0x6b1b90b4": contractErrors.OrderNotAccepted,
956
+ "0x1775c43e": contractErrors.OrderNotAssigned,
957
+ "0xf42e41a1": contractErrors.OrderAmountExceedsLimit,
958
+ "0x93845d68": contractErrors.InvalidOrderAmount,
959
+ "0x138b9d5a": contractErrors.InvalidOrderAmountToCoverFee,
960
+ "0x5d706033": contractErrors.InvalidOrderId,
961
+ "0xbb776720": contractErrors.OrderTooEarlyForReassignment,
962
+ "0x20d5910f": contractErrors.OrderTooLateForReassignment,
963
+ "0xccd87bf0": contractErrors.ReAssignmentNotRequired,
964
+ "0xb20277f8": contractErrors.TipAlreadyGiven,
965
+ "0xdf9f707c": contractErrors.CashbackTransferFailed,
966
+ // Order limits
967
+ "0xe595a7bf": contractErrors.DailyBuyOrderLimitExceeded,
968
+ "0x675dbc86": contractErrors.MonthlyBuyOrderLimitExceeded,
969
+ "0x64301cb8": contractErrors.SellOrderAmountLimitExceeded,
970
+ "0x91da284f": contractErrors.BuyOrderAmountExceedsLimit,
971
+ "0xb407b9ec": contractErrors.SellOrderAmountExceedsLimit,
972
+ "0x4b29cf0a": contractErrors.BuyAmountExceedsUsdcLimit,
973
+ "0xbba2edf9": contractErrors.SellAmountExceedsFiatLimit,
974
+ "0x7e2ee654": contractErrors.DailyVolumeLimitExceeded,
975
+ "0x49de1789": contractErrors.MonthlyVolumeLimitExceeded,
976
+ "0xb14a1ff3": contractErrors.UserYearlyVolumeLimitExceeded,
977
+ // Dispute
978
+ "0x07a2454f": contractErrors.DisputeTimeNotReached,
979
+ "0xb28c3e29": contractErrors.DisputeTimeExpired,
980
+ "0x2a829f07": contractErrors.InvalidOrderStatusToRaiseDispute,
981
+ "0x88d039ce": contractErrors.DisputeNotRaised,
982
+ "0x3764a75c": contractErrors.CannotRaiseDisputeTwice,
983
+ "0x866e9f89": contractErrors.DisputeAlreadySettled,
984
+ "0x6131d13d": contractErrors.TransactionIdMismatch,
985
+ "0x8ec051b8": contractErrors.AccountNumberMismatch,
986
+ "0xf8bfad32": contractErrors.NotPaidBuyOrder,
987
+ // Payment channels
988
+ "0x552ff5ec": contractErrors.PaymentChannelNotFound,
989
+ "0xfccd93cf": contractErrors.PaymentChannelNotActive,
990
+ "0x6764f4d6": contractErrors.PaymentChannelNotApproved,
991
+ "0xab284291": contractErrors.PaymentChannelNotRejected,
992
+ "0x99c8ef4d": contractErrors.InvalidPaymentChannelId,
993
+ "0x0569ab3e": contractErrors.DuplicatePaymentChannel,
994
+ "0xff4f83ca": contractErrors.OldPaymentChannelNotFound,
995
+ "0xb1198199": contractErrors.NewPaymentChannelNotFound,
996
+ "0xc905b99a": contractErrors.SamePaymentChannel,
997
+ "0xcedb41f1": contractErrors.OldPaymentChannelShouldBeInactive,
998
+ "0x487add97": contractErrors.NewPaymentChannelShouldBeActive,
999
+ "0x6d4c3f9e": contractErrors.OngoingOrderOnPaymentChannel,
1000
+ "0xc1654697": contractErrors.UpiAlreadySent,
1001
+ "0xaa60ec26": contractErrors.InvalidOrderUpi,
1002
+ "0x81c2b982": contractErrors.NoFiatLiquidity,
1003
+ // Merchant
1004
+ "0x5d04ff4c": contractErrors.NotEnoughEligibleMerchants,
1005
+ "0xa6af7ebe": contractErrors.MerchantNotRegistered,
1006
+ "0x7290a612": contractErrors.MerchantNotApproved,
1007
+ "0xf4a1e014": contractErrors.MerchantAlreadyRegistered,
1008
+ "0x8713aaba": contractErrors.MerchantAlreadyRejected,
1009
+ "0x9ae55bc7": contractErrors.MerchantBlacklisted,
1010
+ "0x0ee0b659": contractErrors.MerchantNotBlacklisted,
1011
+ "0x5f765689": contractErrors.MerchantAlreadyBlacklisted,
1012
+ "0x9c54e5a8": contractErrors.MerchantHasOngoingOrders,
1013
+ "0x70d753bd": contractErrors.MerchantNotFullfilledEligibilityThreshold,
1014
+ "0xc0b6c919": contractErrors.InvalidMerchant,
1015
+ // Staking / unstaking
1016
+ "0x3fd2347e": contractErrors.StakeAmountTooLow,
1017
+ "0x703cde0a": contractErrors.AdditionalStakeNotAllowed,
1018
+ "0xa9de99ae": contractErrors.UnstakeRequestPending,
1019
+ "0x0b7c70f3": contractErrors.UnstakeRequestNotPending,
1020
+ "0xe665491f": contractErrors.UnstakeAmountExceeded,
1021
+ "0x2d3087f9": contractErrors.ZeroUnstakeAmount,
1022
+ "0x1b1d7861": contractErrors.NoWithdrawableAmount,
1023
+ "0xcacf989a": contractErrors.NoStake,
1024
+ "0x21311aa3": contractErrors.NoStakers,
1025
+ "0xd06ff88e": contractErrors.InsufficientStakedAmount,
1026
+ "0x9ab7872d": contractErrors.CooldownNotPassed,
1027
+ "0x73380d99": contractErrors.ClaimableRewardsNotAvailable,
1028
+ // Delegation
1029
+ "0xec4b3ce6": contractErrors.ExitWouldBreachDelegationInvariant,
1030
+ "0x8f90a426": contractErrors.AggregateDelegationExceedsTotalStaked,
1031
+ "0x2cc11576": contractErrors.InsufficientMerchantRewards,
1032
+ // Migration
1033
+ "0x92aa7d0f": contractErrors.InvalidMigrationStatus,
1034
+ "0x7ff47425": contractErrors.MigrationRequestNotPending,
1035
+ "0x88ddec46": contractErrors.MigrationAlreadyRequested,
1036
+ // Token / currency
1037
+ "0xc991cbb1": contractErrors.TokenAlreadyExists,
1038
+ "0xcbdb7b30": contractErrors.TokenNotFound,
1039
+ "0x9f11a53f": contractErrors.TokenEmpty,
1040
+ "0x02a6fdd2": contractErrors.CurrencyNotSupported,
1041
+ "0xf5993428": contractErrors.InvalidCurrency,
1042
+ // USDC / transfer
1043
+ "0x149f9fca": contractErrors.UsdtTransferFailed,
1044
+ "0x47bfece5": contractErrors.UsdtTransferFailedWithErrorMessage,
1045
+ "0x279bbc0c": contractErrors.UsdtTransferFailedWithPanic,
1046
+ "0xfb8f41b2": contractErrors.InsufficientAllowance,
1047
+ // ZK Passport
1048
+ "0xfd8d4a6d": contractErrors.ZKPassportVerifierNotSet,
1049
+ "0xb87078f9": contractErrors.ZKPassportDomainEmpty,
1050
+ "0x5eadc4c2": contractErrors.ZKPassportScopeEmpty,
1051
+ "0x7642fe15": contractErrors.PassportAlreadyVerified,
1052
+ "0x1fa24b35": contractErrors.ZKPassportProofInvalid,
1053
+ "0x36bdb7b6": contractErrors.ZKPassportIdentifierAlreadyVerified,
1054
+ "0xd13a7934": contractErrors.ZKPassportInvalidScope,
1055
+ "0x69f5bfe7": contractErrors.ZKPassportUnexpectedSender,
1056
+ "0x0464115c": contractErrors.ZKPassportAgeBelowMinimum,
1057
+ "0x48183836": contractErrors.ZKPassportMinAgeTooHigh,
1058
+ // Chainlink / oracle
1059
+ "0x7f73f237": contractErrors.UnexpectedRequestId,
1060
+ "0xab948796": contractErrors.OnlyRouterCanFulfill,
1061
+ "0x61982c98": contractErrors.RequestFailed,
1062
+ "0xab66be18": contractErrors.SourceCodeMismatch,
1063
+ "0xff2826ef": contractErrors.ZeroMarketPrice,
1064
+ "0xbb6c216c": contractErrors.InvalidComputedPrices,
1065
+ "0x3a8fbef4": contractErrors.NotPriceUpdaterForCurrency,
1066
+ "0x3e2c36f2": contractErrors.ThresholdNotConfigured,
1067
+ "0x71c4efed": contractErrors.SlippageExceeded,
1068
+ // Reputation / verification
1069
+ "0x071ea33c": contractErrors.UserHasNoReputation,
1070
+ "0xd2e1e6e0": contractErrors.ZeroReputationPoints,
1071
+ "0x3c0ca622": contractErrors.NoReputation,
1072
+ "0x412dd2b1": contractErrors.InsufficientRP,
1073
+ "0x0f165e7b": contractErrors.NullifierAlreadyVerified,
1074
+ "0x439cc0cd": contractErrors.VerificationFailed,
1075
+ "0x2366073b": contractErrors.InvalidSocialPlatform,
1076
+ "0x2f850b6b": contractErrors.SocialAlreadyVerified,
1077
+ "0x466f52a8": contractErrors.YearFieldNotInProof,
1078
+ "0x4d460588": contractErrors.UserIdFieldNotInProof,
1079
+ "0xa18ea4e8": contractErrors.UserIdAlreadyVerified,
1080
+ "0x69470b13": contractErrors.UsernameAlreadyVerified,
1081
+ "0x8390b2dd": contractErrors.UsernameNotInProof,
1082
+ "0xef053cf4": contractErrors.LinkedInOnlyRpUpdates,
1083
+ "0x355b0709": contractErrors.FacebookOnlyRpUpdates,
1084
+ // Voting / referral
1085
+ "0x7aabdfe3": contractErrors.AlreadyReferred,
1086
+ "0x83463f4a": contractErrors.SelfReferralNotAllowed,
1087
+ "0x69f6994a": contractErrors.NotEligibleToRefer,
1088
+ "0x1b19ad97": contractErrors.MerchantMonthlyReferralLimitReached,
1089
+ "0x944a2241": contractErrors.NoRecommender,
1090
+ "0x0ece93a6": contractErrors.RecommendationAlreadyClaimed,
1091
+ "0x74785d0f": contractErrors.CannotVoteYourself,
1092
+ "0xc26d5f75": contractErrors.VotesPerEpochExceeded,
1093
+ "0x7c9a1cf9": contractErrors.AlreadyVoted,
1094
+ "0x403e7fa6": contractErrors.FunctionNotFound,
1095
+ // Campaign
1096
+ "0x7a551e38": contractErrors.CampaignNotActive,
1097
+ "0x668ca75d": contractErrors.InvalidManagerDetails,
1098
+ "0x2f950361": contractErrors.UnclaimedRewardsExist,
1099
+ "0x626b7c00": contractErrors.RewardAlreadyClaimed,
1100
+ "0x902ade67": contractErrors.OnlyNewUsersAllowed,
1101
+ "0x22a5e34b": contractErrors.ManagerNotFound,
1102
+ "0xa1610e37": contractErrors.ManagerInactive,
1103
+ "0x3fb087f4": contractErrors.NoRewards,
1104
+ "0x3eedee0f": contractErrors.InvalidCampaignId,
1105
+ "0x302c5138": contractErrors.CannotClaimRevenueForCurrentMonth,
1106
+ // Referral reward config
1107
+ "0x074a6991": contractErrors.RewardPercentageTooHigh,
1108
+ // Signature / nonce
1109
+ "0x1fb09b80": contractErrors.NonceAlreadyUsed,
1110
+ "0x2fdec18b": contractErrors.SignatureValidationFailed,
1111
+ // Misc
1112
+ "0xe6c4247b": contractErrors.InvalidAddress,
1113
+ "0x3eb17c88": contractErrors.InvalidBlockAmount,
1114
+ "0x2c5211c6": contractErrors.InvalidAmount,
1115
+ "0xb4fa3fb3": contractErrors.InvalidInput,
1116
+ "0x1117a646": contractErrors.InvalidStatusTransition,
1117
+ "0xa24a13a6": contractErrors.ArrayLengthMismatch,
1118
+ "0xebb6f34b": contractErrors.UserIsBlacklisted,
1119
+ "0xd92e233d": contractErrors.ZeroAddress,
1120
+ "0x8beb9d16": contractErrors.ReentrancyGuard,
1121
+ "0xbb1cb70b": contractErrors.BatchTooLarge,
1122
+ "0xd97cf1ba": contractErrors.UnderflowSubtraction,
1123
+ "0xc9b16952": contractErrors.TargetLongerThanData
1124
+ };
1125
+
1126
+ // src/contracts/order-flow/index.ts
1127
+ import { ResultAsync as ResultAsync2 } from "neverthrow";
1128
+
1129
+ // src/lib/subgraph.ts
1130
+ import { ResultAsync } from "neverthrow";
1131
+
1132
+ // src/validation/errors.validation.ts
1133
+ var SdkError = class extends Error {
1134
+ code;
1135
+ cause;
1136
+ context;
1137
+ constructor(message, options) {
1138
+ super(message);
1139
+ this.name = "SdkError";
1140
+ this.code = options.code;
1141
+ this.cause = options.cause;
1142
+ this.context = options.context;
1143
+ }
1144
+ };
1145
+
1146
+ // src/validation/schemas.validation.ts
1147
+ import { err, ok } from "neverthrow";
1148
+ import { isAddress } from "viem";
1149
+ import { z } from "zod";
1150
+
1151
+ // src/country/currency.ts
1152
+ var CURRENCY = {
1153
+ IDR: "IDR",
1154
+ INR: "INR",
1155
+ BRL: "BRL",
1156
+ ARS: "ARS",
1157
+ MEX: "MEX",
1158
+ VEN: "VEN",
1159
+ EUR: "EUR",
1160
+ NGN: "NGN",
1161
+ USD: "USD",
1162
+ COP: "COP"
1163
+ };
1164
+ var CURRENCY_CODES = Object.values(CURRENCY);
1165
+
1166
+ // src/validation/schemas.validation.ts
1167
+ var ZodAddressSchema = z.string().refine((s) => isAddress(s), { message: "Invalid Ethereum address" });
1168
+ var ZodCurrencySchema = z.enum(CURRENCY_CODES);
1169
+ function validate(schema, data, toError) {
1170
+ const result = schema.safeParse(data);
1171
+ if (result.success) {
1172
+ return ok(result.data);
1173
+ }
1174
+ return err(toError(z.prettifyError(result.error), result.error, data));
1175
+ }
1176
+
1177
+ // src/orders/internal/routing/validation.ts
1178
+ import { z as z2 } from "zod";
1179
+ var ZodCircleScoreStateSchema = z2.object({
1180
+ activeMerchantsCount: z2.coerce.number()
1181
+ });
1182
+ var ZodCircleMetricsForRoutingSchema = z2.object({
1183
+ circleScore: z2.coerce.number(),
1184
+ circleStatus: z2.string(),
1185
+ scoreState: ZodCircleScoreStateSchema
1186
+ });
1187
+ var ZodCircleForRoutingSchema = z2.object({
1188
+ circleId: z2.string(),
1189
+ currency: z2.string(),
1190
+ metrics: ZodCircleMetricsForRoutingSchema
1191
+ });
1192
+ var ZodCirclesForRoutingResponseSchema = z2.object({
1193
+ circles: z2.array(ZodCircleForRoutingSchema)
1194
+ });
1195
+ var ZodCheckCircleEligibilityParamsSchema = z2.object({
1196
+ circleId: z2.bigint(),
1197
+ currency: z2.string(),
1198
+ user: ZodAddressSchema,
1199
+ usdtAmount: z2.bigint(),
1200
+ fiatAmount: z2.bigint(),
1201
+ orderType: z2.bigint(),
1202
+ preferredPCConfigId: z2.bigint()
1203
+ });
1204
+ var ZodSelectCircleParamsSchema = z2.object({
1205
+ currency: z2.string().min(1),
1206
+ user: ZodAddressSchema,
1207
+ usdtAmount: z2.bigint(),
1208
+ fiatAmount: z2.bigint(),
1209
+ orderType: z2.bigint(),
1210
+ preferredPCConfigId: z2.bigint()
1211
+ });
1212
+
1213
+ // src/contracts/order-processor/index.ts
1214
+ import { ResultAsync as ResultAsync3 } from "neverthrow";
1215
+ import { stringToHex } from "viem";
1216
+
1217
+ // src/contracts/p2p-config/index.ts
1218
+ import { ResultAsync as ResultAsync4 } from "neverthrow";
1219
+ import { stringToHex as stringToHex2 } from "viem";
1220
+
1221
+ // src/prices/errors.ts
1222
+ var PricesError = class extends SdkError {
1223
+ constructor(message, options) {
1224
+ super(message, options);
1225
+ this.name = "PricesError";
1226
+ }
1227
+ };
1228
+
1229
+ // src/prices/validation.ts
1230
+ import { z as z3 } from "zod";
1231
+ var ZodCurrencyScopedParamsSchema = z3.object({
1232
+ currency: ZodCurrencySchema
1233
+ });
1234
+
1235
+ // src/contracts/p2p-config/index.ts
1236
+ function getPriceConfig(publicClient, diamondAddress, params) {
1237
+ return validate(
1238
+ ZodCurrencyScopedParamsSchema,
1239
+ params,
1240
+ (message, cause, data) => new PricesError(message, {
1241
+ code: "VALIDATION_ERROR",
1242
+ cause,
1243
+ context: { params: data }
1244
+ })
1245
+ ).asyncAndThen(
1246
+ (validated) => ResultAsync4.fromPromise(
1247
+ publicClient.readContract({
1248
+ address: diamondAddress,
1249
+ abi: ABIS.FACETS.CONFIG,
1250
+ functionName: "getPriceConfig",
1251
+ args: [stringToHex2(validated.currency, { size: 32 })]
1252
+ }),
1253
+ (error) => new PricesError("Failed to read price config", {
1254
+ code: "CONTRACT_READ_ERROR",
1255
+ cause: error,
1256
+ context: { currency: validated.currency, diamondAddress }
1257
+ })
1258
+ )
1259
+ );
1260
+ }
1261
+ function getReputationPerUsdcLimit(publicClient, diamondAddress, params) {
1262
+ return validate(
1263
+ ZodCurrencyScopedParamsSchema,
1264
+ params,
1265
+ (message, cause, data) => new PricesError(message, {
1266
+ code: "VALIDATION_ERROR",
1267
+ cause,
1268
+ context: { params: data }
1269
+ })
1270
+ ).asyncAndThen(
1271
+ (validated) => ResultAsync4.fromPromise(
1272
+ publicClient.readContract({
1273
+ address: diamondAddress,
1274
+ abi: ABIS.DIAMOND,
1275
+ functionName: "getRpPerUsdtLimitRational",
1276
+ args: [stringToHex2(validated.currency, { size: 32 })]
1277
+ }),
1278
+ (error) => new PricesError("Failed to read reputation-per-USDC limit", {
1279
+ code: "CONTRACT_READ_ERROR",
1280
+ cause: error,
1281
+ context: { currency: validated.currency, diamondAddress }
1282
+ })
1283
+ ).map(([numerator, denominator]) => ({
1284
+ numerator,
1285
+ denominator,
1286
+ multiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0
1287
+ }))
1288
+ );
1289
+ }
1290
+
1291
+ // src/contracts/reputation-manager/writes.ts
1292
+ import { Result } from "neverthrow";
1293
+ import { encodeFunctionData } from "viem";
1294
+
1295
+ // src/zkkyc/validation.ts
1296
+ import { z as z4 } from "zod";
1297
+ var ZodAnonAadharProofParamsSchema = z4.object({
1298
+ nullifierSeed: z4.bigint(),
1299
+ nullifier: z4.bigint(),
1300
+ timestamp: z4.bigint(),
1301
+ signal: z4.bigint(),
1302
+ revealArray: z4.tuple([z4.bigint(), z4.bigint(), z4.bigint(), z4.bigint()]),
1303
+ packedGroth16Proof: z4.tuple([
1304
+ z4.bigint(),
1305
+ z4.bigint(),
1306
+ z4.bigint(),
1307
+ z4.bigint(),
1308
+ z4.bigint(),
1309
+ z4.bigint(),
1310
+ z4.bigint(),
1311
+ z4.bigint()
1312
+ ])
1313
+ });
1314
+ var ZodSocialVerifyParamsSchema = z4.object({
1315
+ _socialName: z4.string(),
1316
+ proofs: z4.array(
1317
+ z4.object({
1318
+ claimInfo: z4.object({
1319
+ provider: z4.string(),
1320
+ parameters: z4.string(),
1321
+ context: z4.string()
1322
+ }),
1323
+ signedClaim: z4.object({
1324
+ claim: z4.object({
1325
+ identifier: z4.string(),
1326
+ owner: ZodAddressSchema,
1327
+ timestampS: z4.number(),
1328
+ epoch: z4.number()
1329
+ }),
1330
+ signatures: z4.array(z4.string())
1331
+ })
1332
+ })
1333
+ )
1334
+ });
1335
+ var ZodSolidityVerifierParametersSchema = z4.object({
1336
+ version: z4.string().refine((val) => val.startsWith("0x"), {
1337
+ message: "Version must be a hex string"
1338
+ }),
1339
+ proofVerificationData: z4.object({
1340
+ vkeyHash: z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1341
+ message: "Invalid bytes32 hex string"
1342
+ }),
1343
+ proof: z4.string().refine((val) => val.startsWith("0x"), {
1344
+ message: "Proof must be a hex string"
1345
+ }),
1346
+ publicInputs: z4.array(
1347
+ z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1348
+ message: "Each public input must be a valid bytes32 hex string"
1349
+ })
1350
+ )
1351
+ }),
1352
+ committedInputs: z4.string().refine((val) => val.startsWith("0x"), {
1353
+ message: "Committed inputs must be a hex string"
1354
+ }),
1355
+ serviceConfig: z4.object({
1356
+ validityPeriodInSeconds: z4.number().int().nonnegative(),
1357
+ domain: z4.string(),
1358
+ scope: z4.string(),
1359
+ devMode: z4.boolean()
1360
+ })
1361
+ });
1362
+ var ZodZkPassportRegisterParamsSchema = z4.object({
1363
+ params: ZodSolidityVerifierParametersSchema,
1364
+ isIDCard: z4.boolean()
1365
+ });
1366
+
1367
+ // src/contracts/tx-limits/index.ts
1368
+ import { ResultAsync as ResultAsync5 } from "neverthrow";
1369
+ import { formatUnits, stringToHex as stringToHex3 } from "viem";
1370
+
1371
+ // src/profile/validation.ts
1372
+ import { z as z5 } from "zod";
1373
+ var ZodUsdcBalanceParamsSchema = z5.object({
1374
+ address: ZodAddressSchema
1375
+ });
1376
+ var ZodUsdcAllowanceParamsSchema = z5.object({
1377
+ owner: ZodAddressSchema
1378
+ });
1379
+ var ZodGetBalancesParamsSchema = z5.object({
1380
+ address: ZodAddressSchema,
1381
+ currency: ZodCurrencySchema
1382
+ });
1383
+ var ZodTxLimitsParamsSchema = z5.object({
1384
+ address: ZodAddressSchema,
1385
+ currency: ZodCurrencySchema
1386
+ });
1387
+
1388
+ // src/contracts/usdc/index.ts
1389
+ import { ResultAsync as ResultAsync6 } from "neverthrow";
1390
+ import { erc20Abi as erc20Abi2 } from "viem";
1391
+
1392
+ // src/prices/client.ts
1393
+ function createPrices(config) {
1394
+ const { publicClient, diamondAddress } = config;
1395
+ return {
1396
+ getPriceConfig: (params) => getPriceConfig(publicClient, diamondAddress, params),
1397
+ getReputationPerUsdcLimit: (params) => getReputationPerUsdcLimit(publicClient, diamondAddress, params)
1398
+ };
1399
+ }
1400
+ export {
1401
+ PricesError,
1402
+ createPrices
1403
+ };
1404
+ //# sourceMappingURL=prices.mjs.map