@p2pdotme/sdk 1.0.4 → 1.1.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 (64) hide show
  1. package/README.md +71 -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/{payload.cjs → orders.cjs} +2357 -253
  19. package/dist/orders.cjs.map +1 -0
  20. package/dist/orders.d.cts +399 -0
  21. package/dist/orders.d.ts +399 -0
  22. package/dist/{payload.mjs → orders.mjs} +2340 -237
  23. package/dist/orders.mjs.map +1 -0
  24. package/dist/prices.cjs +1008 -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 +980 -0
  29. package/dist/prices.mjs.map +1 -0
  30. package/dist/profile.cjs +475 -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 +468 -62
  35. package/dist/profile.mjs.map +1 -1
  36. package/dist/qr-parsers.cjs +7 -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 +7 -7
  41. package/dist/qr-parsers.mjs.map +1 -1
  42. package/dist/react.cjs +2531 -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 +2417 -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.map +0 -1
  62. package/dist/payload.d.cts +0 -147
  63. package/dist/payload.d.ts +0 -147
  64. package/dist/payload.mjs.map +0 -1
@@ -0,0 +1,980 @@
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/order-flow/index.ts
703
+ import { ResultAsync as ResultAsync2 } from "neverthrow";
704
+
705
+ // src/lib/subgraph.ts
706
+ import { ResultAsync } from "neverthrow";
707
+
708
+ // src/validation/errors.validation.ts
709
+ var SdkError = class extends Error {
710
+ code;
711
+ cause;
712
+ context;
713
+ constructor(message, options) {
714
+ super(message);
715
+ this.name = "SdkError";
716
+ this.code = options.code;
717
+ this.cause = options.cause;
718
+ this.context = options.context;
719
+ }
720
+ };
721
+
722
+ // src/validation/schemas.validation.ts
723
+ import { err, ok } from "neverthrow";
724
+ import { isAddress } from "viem";
725
+ import { z } from "zod";
726
+
727
+ // src/country/currency.ts
728
+ var CURRENCY = {
729
+ IDR: "IDR",
730
+ INR: "INR",
731
+ BRL: "BRL",
732
+ ARS: "ARS",
733
+ MEX: "MEX",
734
+ VEN: "VEN",
735
+ EUR: "EUR",
736
+ NGN: "NGN",
737
+ USD: "USD",
738
+ COP: "COP"
739
+ };
740
+ var CURRENCY_CODES = Object.values(CURRENCY);
741
+
742
+ // src/validation/schemas.validation.ts
743
+ var ZodAddressSchema = z.string().refine((s) => isAddress(s), { message: "Invalid Ethereum address" });
744
+ var ZodCurrencySchema = z.enum(CURRENCY_CODES);
745
+ function validate(schema, data, toError) {
746
+ const result = schema.safeParse(data);
747
+ if (result.success) {
748
+ return ok(result.data);
749
+ }
750
+ return err(toError(z.prettifyError(result.error), result.error, data));
751
+ }
752
+
753
+ // src/orders/internal/routing/validation.ts
754
+ import { z as z2 } from "zod";
755
+ var ZodCircleScoreStateSchema = z2.object({
756
+ activeMerchantsCount: z2.coerce.number()
757
+ });
758
+ var ZodCircleMetricsForRoutingSchema = z2.object({
759
+ circleScore: z2.coerce.number(),
760
+ circleStatus: z2.string(),
761
+ scoreState: ZodCircleScoreStateSchema
762
+ });
763
+ var ZodCircleForRoutingSchema = z2.object({
764
+ circleId: z2.string(),
765
+ currency: z2.string(),
766
+ metrics: ZodCircleMetricsForRoutingSchema
767
+ });
768
+ var ZodCirclesForRoutingResponseSchema = z2.object({
769
+ circles: z2.array(ZodCircleForRoutingSchema)
770
+ });
771
+ var ZodCheckCircleEligibilityParamsSchema = z2.object({
772
+ circleId: z2.bigint(),
773
+ currency: z2.string(),
774
+ user: ZodAddressSchema,
775
+ usdtAmount: z2.bigint(),
776
+ fiatAmount: z2.bigint(),
777
+ orderType: z2.bigint(),
778
+ preferredPCConfigId: z2.bigint()
779
+ });
780
+ var ZodSelectCircleParamsSchema = z2.object({
781
+ currency: z2.string().min(1),
782
+ user: ZodAddressSchema,
783
+ usdtAmount: z2.bigint(),
784
+ fiatAmount: z2.bigint(),
785
+ orderType: z2.bigint(),
786
+ preferredPCConfigId: z2.bigint()
787
+ });
788
+
789
+ // src/contracts/order-processor/index.ts
790
+ import { ResultAsync as ResultAsync3 } from "neverthrow";
791
+ import { stringToHex } from "viem";
792
+
793
+ // src/contracts/p2p-config/index.ts
794
+ import { ResultAsync as ResultAsync4 } from "neverthrow";
795
+ import { stringToHex as stringToHex2 } from "viem";
796
+
797
+ // src/prices/errors.ts
798
+ var PricesError = class extends SdkError {
799
+ constructor(message, options) {
800
+ super(message, options);
801
+ this.name = "PricesError";
802
+ }
803
+ };
804
+
805
+ // src/prices/validation.ts
806
+ import { z as z3 } from "zod";
807
+ var ZodCurrencyScopedParamsSchema = z3.object({
808
+ currency: ZodCurrencySchema
809
+ });
810
+
811
+ // src/contracts/p2p-config/index.ts
812
+ function getPriceConfig(publicClient, diamondAddress, params) {
813
+ return validate(
814
+ ZodCurrencyScopedParamsSchema,
815
+ params,
816
+ (message, cause, data) => new PricesError(message, {
817
+ code: "VALIDATION_ERROR",
818
+ cause,
819
+ context: { params: data }
820
+ })
821
+ ).asyncAndThen(
822
+ (validated) => ResultAsync4.fromPromise(
823
+ publicClient.readContract({
824
+ address: diamondAddress,
825
+ abi: ABIS.FACETS.CONFIG,
826
+ functionName: "getPriceConfig",
827
+ args: [stringToHex2(validated.currency, { size: 32 })]
828
+ }),
829
+ (error) => new PricesError("Failed to read price config", {
830
+ code: "CONTRACT_READ_ERROR",
831
+ cause: error,
832
+ context: { currency: validated.currency, diamondAddress }
833
+ })
834
+ )
835
+ );
836
+ }
837
+ function getReputationPerUsdcLimit(publicClient, diamondAddress, params) {
838
+ return validate(
839
+ ZodCurrencyScopedParamsSchema,
840
+ params,
841
+ (message, cause, data) => new PricesError(message, {
842
+ code: "VALIDATION_ERROR",
843
+ cause,
844
+ context: { params: data }
845
+ })
846
+ ).asyncAndThen(
847
+ (validated) => ResultAsync4.fromPromise(
848
+ publicClient.readContract({
849
+ address: diamondAddress,
850
+ abi: ABIS.DIAMOND,
851
+ functionName: "getRpPerUsdtLimitRational",
852
+ args: [stringToHex2(validated.currency, { size: 32 })]
853
+ }),
854
+ (error) => new PricesError("Failed to read reputation-per-USDC limit", {
855
+ code: "CONTRACT_READ_ERROR",
856
+ cause: error,
857
+ context: { currency: validated.currency, diamondAddress }
858
+ })
859
+ ).map(([numerator, denominator]) => ({
860
+ numerator,
861
+ denominator,
862
+ multiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0
863
+ }))
864
+ );
865
+ }
866
+
867
+ // src/contracts/reputation-manager/writes.ts
868
+ import { Result } from "neverthrow";
869
+ import { encodeFunctionData } from "viem";
870
+
871
+ // src/zkkyc/validation.ts
872
+ import { z as z4 } from "zod";
873
+ var ZodAnonAadharProofParamsSchema = z4.object({
874
+ nullifierSeed: z4.bigint(),
875
+ nullifier: z4.bigint(),
876
+ timestamp: z4.bigint(),
877
+ signal: z4.bigint(),
878
+ revealArray: z4.tuple([z4.bigint(), z4.bigint(), z4.bigint(), z4.bigint()]),
879
+ packedGroth16Proof: z4.tuple([
880
+ z4.bigint(),
881
+ z4.bigint(),
882
+ z4.bigint(),
883
+ z4.bigint(),
884
+ z4.bigint(),
885
+ z4.bigint(),
886
+ z4.bigint(),
887
+ z4.bigint()
888
+ ])
889
+ });
890
+ var ZodSocialVerifyParamsSchema = z4.object({
891
+ _socialName: z4.string(),
892
+ proofs: z4.array(
893
+ z4.object({
894
+ claimInfo: z4.object({
895
+ provider: z4.string(),
896
+ parameters: z4.string(),
897
+ context: z4.string()
898
+ }),
899
+ signedClaim: z4.object({
900
+ claim: z4.object({
901
+ identifier: z4.string(),
902
+ owner: ZodAddressSchema,
903
+ timestampS: z4.number(),
904
+ epoch: z4.number()
905
+ }),
906
+ signatures: z4.array(z4.string())
907
+ })
908
+ })
909
+ )
910
+ });
911
+ var ZodSolidityVerifierParametersSchema = z4.object({
912
+ version: z4.string().refine((val) => val.startsWith("0x"), {
913
+ message: "Version must be a hex string"
914
+ }),
915
+ proofVerificationData: z4.object({
916
+ vkeyHash: z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
917
+ message: "Invalid bytes32 hex string"
918
+ }),
919
+ proof: z4.string().refine((val) => val.startsWith("0x"), {
920
+ message: "Proof must be a hex string"
921
+ }),
922
+ publicInputs: z4.array(
923
+ z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
924
+ message: "Each public input must be a valid bytes32 hex string"
925
+ })
926
+ )
927
+ }),
928
+ committedInputs: z4.string().refine((val) => val.startsWith("0x"), {
929
+ message: "Committed inputs must be a hex string"
930
+ }),
931
+ serviceConfig: z4.object({
932
+ validityPeriodInSeconds: z4.number().int().nonnegative(),
933
+ domain: z4.string(),
934
+ scope: z4.string(),
935
+ devMode: z4.boolean()
936
+ })
937
+ });
938
+ var ZodZkPassportRegisterParamsSchema = z4.object({
939
+ params: ZodSolidityVerifierParametersSchema,
940
+ isIDCard: z4.boolean()
941
+ });
942
+
943
+ // src/contracts/tx-limits/index.ts
944
+ import { ResultAsync as ResultAsync5 } from "neverthrow";
945
+ import { formatUnits, stringToHex as stringToHex3 } from "viem";
946
+
947
+ // src/profile/validation.ts
948
+ import { z as z5 } from "zod";
949
+ var ZodUsdcBalanceParamsSchema = z5.object({
950
+ address: ZodAddressSchema
951
+ });
952
+ var ZodUsdcAllowanceParamsSchema = z5.object({
953
+ owner: ZodAddressSchema
954
+ });
955
+ var ZodGetBalancesParamsSchema = z5.object({
956
+ address: ZodAddressSchema,
957
+ currency: ZodCurrencySchema
958
+ });
959
+ var ZodTxLimitsParamsSchema = z5.object({
960
+ address: ZodAddressSchema,
961
+ currency: ZodCurrencySchema
962
+ });
963
+
964
+ // src/contracts/usdc/index.ts
965
+ import { ResultAsync as ResultAsync6 } from "neverthrow";
966
+ import { erc20Abi as erc20Abi2 } from "viem";
967
+
968
+ // src/prices/client.ts
969
+ function createPrices(config) {
970
+ const { publicClient, diamondAddress } = config;
971
+ return {
972
+ getPriceConfig: (params) => getPriceConfig(publicClient, diamondAddress, params),
973
+ getReputationPerUsdcLimit: (params) => getReputationPerUsdcLimit(publicClient, diamondAddress, params)
974
+ };
975
+ }
976
+ export {
977
+ PricesError,
978
+ createPrices
979
+ };
980
+ //# sourceMappingURL=prices.mjs.map