@p2pdotme/sdk 1.0.5 → 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 +8 -1
  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 +5 -1
  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 +6 -6
  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 +6 -6
  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,1008 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/prices/index.ts
21
+ var prices_exports = {};
22
+ __export(prices_exports, {
23
+ PricesError: () => PricesError,
24
+ createPrices: () => createPrices
25
+ });
26
+ module.exports = __toCommonJS(prices_exports);
27
+
28
+ // src/contracts/abis/index.ts
29
+ var import_viem = require("viem");
30
+
31
+ // src/contracts/abis/order-flow-facet.ts
32
+ var orderFlowFacetAbi = [
33
+ {
34
+ inputs: [
35
+ { internalType: "uint256", name: "circleId", type: "uint256" },
36
+ { internalType: "uint256", name: "assignUpto", type: "uint256" },
37
+ { internalType: "bytes32", name: "currency", type: "bytes32" },
38
+ { internalType: "address", name: "user", type: "address" },
39
+ { internalType: "uint256", name: "usdtAmount", type: "uint256" },
40
+ { internalType: "uint256", name: "fiatAmount", type: "uint256" },
41
+ { internalType: "int256", name: "orderType", type: "int256" },
42
+ { internalType: "uint256", name: "preferredPCConfigId", type: "uint256" }
43
+ ],
44
+ name: "getAssignableMerchantsFromCircle",
45
+ outputs: [{ internalType: "address[]", name: "", type: "address[]" }],
46
+ stateMutability: "view",
47
+ type: "function"
48
+ },
49
+ {
50
+ inputs: [
51
+ { internalType: "address", name: "_user", type: "address" },
52
+ { internalType: "bytes32", name: "_nativeCurrency", type: "bytes32" }
53
+ ],
54
+ name: "userTxLimit",
55
+ outputs: [
56
+ { internalType: "uint256", name: "", type: "uint256" },
57
+ { internalType: "uint256", name: "", type: "uint256" }
58
+ ],
59
+ stateMutability: "view",
60
+ type: "function"
61
+ },
62
+ {
63
+ inputs: [
64
+ { internalType: "string", name: "_pubKey", type: "string" },
65
+ { internalType: "uint256", name: "_amount", type: "uint256" },
66
+ { internalType: "address", name: "_recipientAddr", type: "address" },
67
+ { internalType: "uint8", name: "_orderType", type: "uint8" },
68
+ { internalType: "string", name: "_userUpi", type: "string" },
69
+ { internalType: "string", name: "_userPubKey", type: "string" },
70
+ { internalType: "bytes32", name: "_currency", type: "bytes32" },
71
+ { internalType: "uint256", name: "preferredPaymentChannelConfigId", type: "uint256" },
72
+ { internalType: "uint256", name: "_circleId", type: "uint256" },
73
+ { internalType: "uint256", name: "_fiatAmountLimit", type: "uint256" }
74
+ ],
75
+ name: "placeOrder",
76
+ outputs: [],
77
+ stateMutability: "nonpayable",
78
+ type: "function"
79
+ },
80
+ {
81
+ inputs: [{ internalType: "uint256", name: "_orderId", type: "uint256" }],
82
+ name: "cancelOrder",
83
+ outputs: [],
84
+ stateMutability: "nonpayable",
85
+ type: "function"
86
+ },
87
+ {
88
+ inputs: [
89
+ { internalType: "uint256", name: "_orderId", type: "uint256" },
90
+ { internalType: "string", name: "_userEncUpi", type: "string" },
91
+ { internalType: "uint256", name: "_updatedAmount", type: "uint256" }
92
+ ],
93
+ name: "setSellOrderUpi",
94
+ outputs: [],
95
+ stateMutability: "nonpayable",
96
+ type: "function"
97
+ },
98
+ {
99
+ type: "event",
100
+ name: "OrderPlaced",
101
+ anonymous: false,
102
+ inputs: [
103
+ { indexed: true, name: "orderId", type: "uint256" },
104
+ { indexed: true, name: "user", type: "address" },
105
+ { indexed: true, name: "merchant", type: "address" },
106
+ { indexed: false, name: "amount", type: "uint256" },
107
+ { indexed: false, name: "orderType", type: "uint8" },
108
+ { indexed: false, name: "placedTimestamp", type: "uint256" },
109
+ {
110
+ indexed: false,
111
+ name: "_order",
112
+ type: "tuple",
113
+ components: [
114
+ { name: "amount", type: "uint256" },
115
+ { name: "fiatAmount", type: "uint256" },
116
+ { name: "placedTimestamp", type: "uint256" },
117
+ { name: "completedTimestamp", type: "uint256" },
118
+ { name: "userCompletedTimestamp", type: "uint256" },
119
+ { name: "acceptedMerchant", type: "address" },
120
+ { name: "user", type: "address" },
121
+ { name: "recipientAddr", type: "address" },
122
+ { name: "pubkey", type: "string" },
123
+ { name: "encUpi", type: "string" },
124
+ { name: "userCompleted", type: "bool" },
125
+ { name: "status", type: "uint8" },
126
+ { name: "orderType", type: "uint8" },
127
+ {
128
+ name: "disputeInfo",
129
+ type: "tuple",
130
+ components: [
131
+ { name: "raisedBy", type: "uint8" },
132
+ { name: "status", type: "uint8" },
133
+ { name: "redactTransId", type: "uint256" },
134
+ { name: "accountNumber", type: "uint256" }
135
+ ]
136
+ },
137
+ { name: "id", type: "uint256" },
138
+ { name: "userPubKey", type: "string" },
139
+ { name: "encMerchantUpi", type: "string" },
140
+ { name: "acceptedAccountNo", type: "uint256" },
141
+ { name: "assignedAccountNos", type: "uint256[]" },
142
+ { name: "currency", type: "bytes32" },
143
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
144
+ { name: "circleId", type: "uint256" }
145
+ ]
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ type: "event",
151
+ name: "OrderAccepted",
152
+ anonymous: false,
153
+ inputs: [
154
+ { indexed: true, name: "orderId", type: "uint256" },
155
+ { indexed: true, name: "merchant", type: "address" },
156
+ { indexed: false, name: "pubKey", type: "string" },
157
+ {
158
+ indexed: false,
159
+ name: "_order",
160
+ type: "tuple",
161
+ components: [
162
+ { name: "amount", type: "uint256" },
163
+ { name: "fiatAmount", type: "uint256" },
164
+ { name: "placedTimestamp", type: "uint256" },
165
+ { name: "completedTimestamp", type: "uint256" },
166
+ { name: "userCompletedTimestamp", type: "uint256" },
167
+ { name: "acceptedMerchant", type: "address" },
168
+ { name: "user", type: "address" },
169
+ { name: "recipientAddr", type: "address" },
170
+ { name: "pubkey", type: "string" },
171
+ { name: "encUpi", type: "string" },
172
+ { name: "userCompleted", type: "bool" },
173
+ { name: "status", type: "uint8" },
174
+ { name: "orderType", type: "uint8" },
175
+ {
176
+ name: "disputeInfo",
177
+ type: "tuple",
178
+ components: [
179
+ { name: "raisedBy", type: "uint8" },
180
+ { name: "status", type: "uint8" },
181
+ { name: "redactTransId", type: "uint256" },
182
+ { name: "accountNumber", type: "uint256" }
183
+ ]
184
+ },
185
+ { name: "id", type: "uint256" },
186
+ { name: "userPubKey", type: "string" },
187
+ { name: "encMerchantUpi", type: "string" },
188
+ { name: "acceptedAccountNo", type: "uint256" },
189
+ { name: "assignedAccountNos", type: "uint256[]" },
190
+ { name: "currency", type: "bytes32" },
191
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
192
+ { name: "circleId", type: "uint256" }
193
+ ]
194
+ }
195
+ ]
196
+ },
197
+ {
198
+ type: "event",
199
+ name: "BuyOrderPaid",
200
+ anonymous: false,
201
+ inputs: [
202
+ { indexed: true, name: "orderId", type: "uint256" },
203
+ { indexed: true, name: "user", type: "address" },
204
+ {
205
+ indexed: false,
206
+ name: "_order",
207
+ type: "tuple",
208
+ components: [
209
+ { name: "amount", type: "uint256" },
210
+ { name: "fiatAmount", type: "uint256" },
211
+ { name: "placedTimestamp", type: "uint256" },
212
+ { name: "completedTimestamp", type: "uint256" },
213
+ { name: "userCompletedTimestamp", type: "uint256" },
214
+ { name: "acceptedMerchant", type: "address" },
215
+ { name: "user", type: "address" },
216
+ { name: "recipientAddr", type: "address" },
217
+ { name: "pubkey", type: "string" },
218
+ { name: "encUpi", type: "string" },
219
+ { name: "userCompleted", type: "bool" },
220
+ { name: "status", type: "uint8" },
221
+ { name: "orderType", type: "uint8" },
222
+ {
223
+ name: "disputeInfo",
224
+ type: "tuple",
225
+ components: [
226
+ { name: "raisedBy", type: "uint8" },
227
+ { name: "status", type: "uint8" },
228
+ { name: "redactTransId", type: "uint256" },
229
+ { name: "accountNumber", type: "uint256" }
230
+ ]
231
+ },
232
+ { name: "id", type: "uint256" },
233
+ { name: "userPubKey", type: "string" },
234
+ { name: "encMerchantUpi", type: "string" },
235
+ { name: "acceptedAccountNo", type: "uint256" },
236
+ { name: "assignedAccountNos", type: "uint256[]" },
237
+ { name: "currency", type: "bytes32" },
238
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
239
+ { name: "circleId", type: "uint256" }
240
+ ]
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ type: "event",
246
+ name: "OrderCompleted",
247
+ anonymous: false,
248
+ inputs: [
249
+ { indexed: true, name: "orderId", type: "uint256" },
250
+ { indexed: true, name: "user", type: "address" },
251
+ { indexed: false, name: "completedTimestamp", type: "uint256" },
252
+ {
253
+ indexed: false,
254
+ name: "_order",
255
+ type: "tuple",
256
+ components: [
257
+ { name: "amount", type: "uint256" },
258
+ { name: "fiatAmount", type: "uint256" },
259
+ { name: "placedTimestamp", type: "uint256" },
260
+ { name: "completedTimestamp", type: "uint256" },
261
+ { name: "userCompletedTimestamp", type: "uint256" },
262
+ { name: "acceptedMerchant", type: "address" },
263
+ { name: "user", type: "address" },
264
+ { name: "recipientAddr", type: "address" },
265
+ { name: "pubkey", type: "string" },
266
+ { name: "encUpi", type: "string" },
267
+ { name: "userCompleted", type: "bool" },
268
+ { name: "status", type: "uint8" },
269
+ { name: "orderType", type: "uint8" },
270
+ {
271
+ name: "disputeInfo",
272
+ type: "tuple",
273
+ components: [
274
+ { name: "raisedBy", type: "uint8" },
275
+ { name: "status", type: "uint8" },
276
+ { name: "redactTransId", type: "uint256" },
277
+ { name: "accountNumber", type: "uint256" }
278
+ ]
279
+ },
280
+ { name: "id", type: "uint256" },
281
+ { name: "userPubKey", type: "string" },
282
+ { name: "encMerchantUpi", type: "string" },
283
+ { name: "acceptedAccountNo", type: "uint256" },
284
+ { name: "assignedAccountNos", type: "uint256[]" },
285
+ { name: "currency", type: "bytes32" },
286
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
287
+ { name: "circleId", type: "uint256" }
288
+ ]
289
+ }
290
+ ]
291
+ },
292
+ {
293
+ type: "event",
294
+ name: "CancelledOrders",
295
+ anonymous: false,
296
+ inputs: [
297
+ { indexed: true, name: "orderId", type: "uint256" },
298
+ {
299
+ indexed: false,
300
+ name: "_order",
301
+ type: "tuple",
302
+ components: [
303
+ { name: "amount", type: "uint256" },
304
+ { name: "fiatAmount", type: "uint256" },
305
+ { name: "placedTimestamp", type: "uint256" },
306
+ { name: "completedTimestamp", type: "uint256" },
307
+ { name: "userCompletedTimestamp", type: "uint256" },
308
+ { name: "acceptedMerchant", type: "address" },
309
+ { name: "user", type: "address" },
310
+ { name: "recipientAddr", type: "address" },
311
+ { name: "pubkey", type: "string" },
312
+ { name: "encUpi", type: "string" },
313
+ { name: "userCompleted", type: "bool" },
314
+ { name: "status", type: "uint8" },
315
+ { name: "orderType", type: "uint8" },
316
+ {
317
+ name: "disputeInfo",
318
+ type: "tuple",
319
+ components: [
320
+ { name: "raisedBy", type: "uint8" },
321
+ { name: "status", type: "uint8" },
322
+ { name: "redactTransId", type: "uint256" },
323
+ { name: "accountNumber", type: "uint256" }
324
+ ]
325
+ },
326
+ { name: "id", type: "uint256" },
327
+ { name: "userPubKey", type: "string" },
328
+ { name: "encMerchantUpi", type: "string" },
329
+ { name: "acceptedAccountNo", type: "uint256" },
330
+ { name: "assignedAccountNos", type: "uint256[]" },
331
+ { name: "currency", type: "bytes32" },
332
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
333
+ { name: "circleId", type: "uint256" }
334
+ ]
335
+ }
336
+ ]
337
+ }
338
+ ];
339
+
340
+ // src/contracts/abis/order-processor-facet.ts
341
+ var orderProcessorFacetAbi = [
342
+ {
343
+ type: "function",
344
+ name: "getOrdersById",
345
+ stateMutability: "view",
346
+ inputs: [{ name: "orderId", type: "uint256" }],
347
+ outputs: [
348
+ {
349
+ type: "tuple",
350
+ components: [
351
+ { name: "amount", type: "uint256" },
352
+ { name: "fiatAmount", type: "uint256" },
353
+ { name: "placedTimestamp", type: "uint256" },
354
+ { name: "completedTimestamp", type: "uint256" },
355
+ { name: "userCompletedTimestamp", type: "uint256" },
356
+ { name: "acceptedMerchant", type: "address" },
357
+ { name: "user", type: "address" },
358
+ { name: "recipientAddr", type: "address" },
359
+ { name: "pubkey", type: "string" },
360
+ { name: "encUpi", type: "string" },
361
+ { name: "userCompleted", type: "bool" },
362
+ { name: "status", type: "uint8" },
363
+ { name: "orderType", type: "uint8" },
364
+ {
365
+ name: "disputeInfo",
366
+ type: "tuple",
367
+ components: [
368
+ { name: "raisedBy", type: "uint8" },
369
+ { name: "status", type: "uint8" },
370
+ { name: "redactTransId", type: "uint256" },
371
+ { name: "accountNumber", type: "uint256" }
372
+ ]
373
+ },
374
+ { name: "id", type: "uint256" },
375
+ { name: "userPubKey", type: "string" },
376
+ { name: "encMerchantUpi", type: "string" },
377
+ { name: "acceptedAccountNo", type: "uint256" },
378
+ { name: "assignedAccountNos", type: "uint256[]" },
379
+ { name: "currency", type: "bytes32" },
380
+ { name: "preferredPaymentChannelConfigId", type: "uint256" },
381
+ { name: "circleId", type: "uint256" }
382
+ ]
383
+ }
384
+ ]
385
+ },
386
+ {
387
+ type: "function",
388
+ name: "getAdditionalOrderDetails",
389
+ stateMutability: "view",
390
+ inputs: [{ name: "orderId", type: "uint256" }],
391
+ outputs: [
392
+ {
393
+ type: "tuple",
394
+ components: [
395
+ { name: "fixedFeePaid", type: "uint64" },
396
+ { name: "tipsPaid", type: "uint64" },
397
+ { name: "acceptedTimestamp", type: "uint128" },
398
+ { name: "paidTimestamp", type: "uint128" },
399
+ { name: "reserved2", type: "uint128" },
400
+ { name: "actualUsdtAmount", type: "uint256" },
401
+ { name: "actualFiatAmount", type: "uint256" }
402
+ ]
403
+ }
404
+ ]
405
+ },
406
+ {
407
+ type: "function",
408
+ name: "getSmallOrderThreshold",
409
+ stateMutability: "view",
410
+ inputs: [{ name: "currency", type: "bytes32" }],
411
+ outputs: [{ name: "", type: "uint256" }]
412
+ },
413
+ {
414
+ type: "function",
415
+ name: "getSmallOrderFixedFee",
416
+ stateMutability: "view",
417
+ inputs: [{ name: "currency", type: "bytes32" }],
418
+ outputs: [{ name: "", type: "uint256" }]
419
+ },
420
+ {
421
+ type: "function",
422
+ name: "raiseDispute",
423
+ stateMutability: "nonpayable",
424
+ inputs: [
425
+ { name: "_orderId", type: "uint256" },
426
+ { name: "redactTransId", type: "uint256" }
427
+ ],
428
+ outputs: []
429
+ },
430
+ {
431
+ type: "function",
432
+ name: "paidBuyOrder",
433
+ stateMutability: "nonpayable",
434
+ inputs: [{ name: "_orderId", type: "uint256" }],
435
+ outputs: []
436
+ }
437
+ ];
438
+
439
+ // src/contracts/abis/p2p-config-facet.ts
440
+ var p2pConfigFacetAbi = [
441
+ {
442
+ inputs: [
443
+ {
444
+ internalType: "bytes32",
445
+ name: "_currency",
446
+ type: "bytes32"
447
+ }
448
+ ],
449
+ name: "getPriceConfig",
450
+ outputs: [
451
+ {
452
+ components: [
453
+ {
454
+ internalType: "uint256",
455
+ name: "buyPrice",
456
+ type: "uint256"
457
+ },
458
+ {
459
+ internalType: "uint256",
460
+ name: "sellPrice",
461
+ type: "uint256"
462
+ },
463
+ {
464
+ internalType: "int256",
465
+ name: "buyPriceOffset",
466
+ type: "int256"
467
+ },
468
+ {
469
+ internalType: "uint256",
470
+ name: "baseSpread",
471
+ type: "uint256"
472
+ }
473
+ ],
474
+ internalType: "struct P2pConfigStorage.PriceConfig",
475
+ name: "",
476
+ type: "tuple"
477
+ }
478
+ ],
479
+ stateMutability: "view",
480
+ type: "function"
481
+ },
482
+ {
483
+ inputs: [
484
+ {
485
+ internalType: "bytes32",
486
+ name: "_nativeCurrency",
487
+ type: "bytes32"
488
+ }
489
+ ],
490
+ name: "getRpPerUsdtLimitRational",
491
+ outputs: [
492
+ {
493
+ internalType: "uint256",
494
+ name: "numerator",
495
+ type: "uint256"
496
+ },
497
+ {
498
+ internalType: "uint256",
499
+ name: "denominator",
500
+ type: "uint256"
501
+ }
502
+ ],
503
+ stateMutability: "view",
504
+ type: "function"
505
+ }
506
+ ];
507
+
508
+ // src/contracts/abis/reputation-manager.ts
509
+ var reputationManagerAbi = [
510
+ {
511
+ inputs: [
512
+ {
513
+ internalType: "string",
514
+ name: "_socialName",
515
+ type: "string"
516
+ },
517
+ {
518
+ components: [
519
+ {
520
+ components: [
521
+ {
522
+ internalType: "string",
523
+ name: "provider",
524
+ type: "string"
525
+ },
526
+ {
527
+ internalType: "string",
528
+ name: "parameters",
529
+ type: "string"
530
+ },
531
+ {
532
+ internalType: "string",
533
+ name: "context",
534
+ type: "string"
535
+ }
536
+ ],
537
+ internalType: "struct IReclaimSDK.ClaimInfo",
538
+ name: "claimInfo",
539
+ type: "tuple"
540
+ },
541
+ {
542
+ components: [
543
+ {
544
+ components: [
545
+ {
546
+ internalType: "bytes32",
547
+ name: "identifier",
548
+ type: "bytes32"
549
+ },
550
+ {
551
+ internalType: "address",
552
+ name: "owner",
553
+ type: "address"
554
+ },
555
+ {
556
+ internalType: "uint32",
557
+ name: "timestampS",
558
+ type: "uint32"
559
+ },
560
+ {
561
+ internalType: "uint32",
562
+ name: "epoch",
563
+ type: "uint32"
564
+ }
565
+ ],
566
+ internalType: "struct IReclaimSDK.CompleteClaimData",
567
+ name: "claim",
568
+ type: "tuple"
569
+ },
570
+ {
571
+ internalType: "bytes[]",
572
+ name: "signatures",
573
+ type: "bytes[]"
574
+ }
575
+ ],
576
+ internalType: "struct IReclaimSDK.SignedClaim",
577
+ name: "signedClaim",
578
+ type: "tuple"
579
+ }
580
+ ],
581
+ internalType: "struct IReclaimSDK.Proof[]",
582
+ name: "proofs",
583
+ type: "tuple[]"
584
+ }
585
+ ],
586
+ name: "socialVerify",
587
+ outputs: [],
588
+ stateMutability: "nonpayable",
589
+ type: "function"
590
+ },
591
+ {
592
+ inputs: [
593
+ {
594
+ internalType: "uint256",
595
+ name: "nullifierSeed",
596
+ type: "uint256"
597
+ },
598
+ {
599
+ internalType: "uint256",
600
+ name: "nullifier",
601
+ type: "uint256"
602
+ },
603
+ {
604
+ internalType: "uint256",
605
+ name: "timestamp",
606
+ type: "uint256"
607
+ },
608
+ {
609
+ internalType: "uint256",
610
+ name: "signal",
611
+ type: "uint256"
612
+ },
613
+ {
614
+ internalType: "uint256[4]",
615
+ name: "revealArray",
616
+ type: "uint256[4]"
617
+ },
618
+ {
619
+ internalType: "uint256[8]",
620
+ name: "groth16Proof",
621
+ type: "uint256[8]"
622
+ }
623
+ ],
624
+ name: "submitAnonAadharProof",
625
+ outputs: [],
626
+ stateMutability: "nonpayable",
627
+ type: "function"
628
+ },
629
+ {
630
+ inputs: [
631
+ {
632
+ components: [
633
+ {
634
+ internalType: "bytes32",
635
+ name: "version",
636
+ type: "bytes32"
637
+ },
638
+ {
639
+ components: [
640
+ {
641
+ internalType: "bytes32",
642
+ name: "vkeyHash",
643
+ type: "bytes32"
644
+ },
645
+ {
646
+ internalType: "bytes",
647
+ name: "proof",
648
+ type: "bytes"
649
+ },
650
+ {
651
+ internalType: "bytes32[]",
652
+ name: "publicInputs",
653
+ type: "bytes32[]"
654
+ }
655
+ ],
656
+ internalType: "struct ProofVerificationData",
657
+ name: "proofVerificationData",
658
+ type: "tuple"
659
+ },
660
+ {
661
+ internalType: "bytes",
662
+ name: "committedInputs",
663
+ type: "bytes"
664
+ },
665
+ {
666
+ components: [
667
+ {
668
+ internalType: "uint256",
669
+ name: "validityPeriodInSeconds",
670
+ type: "uint256"
671
+ },
672
+ {
673
+ internalType: "string",
674
+ name: "domain",
675
+ type: "string"
676
+ },
677
+ {
678
+ internalType: "string",
679
+ name: "scope",
680
+ type: "string"
681
+ },
682
+ {
683
+ internalType: "bool",
684
+ name: "devMode",
685
+ type: "bool"
686
+ }
687
+ ],
688
+ internalType: "struct ServiceConfig",
689
+ name: "serviceConfig",
690
+ type: "tuple"
691
+ }
692
+ ],
693
+ internalType: "struct ProofVerificationParams",
694
+ name: "params",
695
+ type: "tuple"
696
+ },
697
+ {
698
+ internalType: "bool",
699
+ name: "isIDCard",
700
+ type: "bool"
701
+ }
702
+ ],
703
+ name: "zkPassportRegister",
704
+ outputs: [],
705
+ stateMutability: "nonpayable",
706
+ type: "function"
707
+ }
708
+ ];
709
+
710
+ // src/contracts/abis/index.ts
711
+ var DIAMOND_ABI = [
712
+ ...orderFlowFacetAbi,
713
+ ...orderProcessorFacetAbi,
714
+ ...p2pConfigFacetAbi
715
+ ];
716
+ var ABIS = {
717
+ DIAMOND: DIAMOND_ABI,
718
+ FACETS: {
719
+ ORDER_FLOW: orderFlowFacetAbi,
720
+ ORDER_PROCESSOR: orderProcessorFacetAbi,
721
+ CONFIG: p2pConfigFacetAbi
722
+ },
723
+ EXTERNAL: {
724
+ USDC: import_viem.erc20Abi,
725
+ REPUTATION_MANAGER: reputationManagerAbi
726
+ }
727
+ };
728
+
729
+ // src/contracts/order-flow/index.ts
730
+ var import_neverthrow3 = require("neverthrow");
731
+
732
+ // src/lib/subgraph.ts
733
+ var import_neverthrow2 = require("neverthrow");
734
+
735
+ // src/validation/errors.validation.ts
736
+ var SdkError = class extends Error {
737
+ code;
738
+ cause;
739
+ context;
740
+ constructor(message, options) {
741
+ super(message);
742
+ this.name = "SdkError";
743
+ this.code = options.code;
744
+ this.cause = options.cause;
745
+ this.context = options.context;
746
+ }
747
+ };
748
+
749
+ // src/validation/schemas.validation.ts
750
+ var import_neverthrow = require("neverthrow");
751
+ var import_viem2 = require("viem");
752
+ var import_zod = require("zod");
753
+
754
+ // src/country/currency.ts
755
+ var CURRENCY = {
756
+ IDR: "IDR",
757
+ INR: "INR",
758
+ BRL: "BRL",
759
+ ARS: "ARS",
760
+ MEX: "MEX",
761
+ VEN: "VEN",
762
+ EUR: "EUR",
763
+ NGN: "NGN",
764
+ USD: "USD",
765
+ COP: "COP"
766
+ };
767
+ var CURRENCY_CODES = Object.values(CURRENCY);
768
+
769
+ // src/validation/schemas.validation.ts
770
+ var ZodAddressSchema = import_zod.z.string().refine((s) => (0, import_viem2.isAddress)(s), { message: "Invalid Ethereum address" });
771
+ var ZodCurrencySchema = import_zod.z.enum(CURRENCY_CODES);
772
+ function validate(schema, data, toError) {
773
+ const result = schema.safeParse(data);
774
+ if (result.success) {
775
+ return (0, import_neverthrow.ok)(result.data);
776
+ }
777
+ return (0, import_neverthrow.err)(toError(import_zod.z.prettifyError(result.error), result.error, data));
778
+ }
779
+
780
+ // src/orders/internal/routing/validation.ts
781
+ var import_zod2 = require("zod");
782
+ var ZodCircleScoreStateSchema = import_zod2.z.object({
783
+ activeMerchantsCount: import_zod2.z.coerce.number()
784
+ });
785
+ var ZodCircleMetricsForRoutingSchema = import_zod2.z.object({
786
+ circleScore: import_zod2.z.coerce.number(),
787
+ circleStatus: import_zod2.z.string(),
788
+ scoreState: ZodCircleScoreStateSchema
789
+ });
790
+ var ZodCircleForRoutingSchema = import_zod2.z.object({
791
+ circleId: import_zod2.z.string(),
792
+ currency: import_zod2.z.string(),
793
+ metrics: ZodCircleMetricsForRoutingSchema
794
+ });
795
+ var ZodCirclesForRoutingResponseSchema = import_zod2.z.object({
796
+ circles: import_zod2.z.array(ZodCircleForRoutingSchema)
797
+ });
798
+ var ZodCheckCircleEligibilityParamsSchema = import_zod2.z.object({
799
+ circleId: import_zod2.z.bigint(),
800
+ currency: import_zod2.z.string(),
801
+ user: ZodAddressSchema,
802
+ usdtAmount: import_zod2.z.bigint(),
803
+ fiatAmount: import_zod2.z.bigint(),
804
+ orderType: import_zod2.z.bigint(),
805
+ preferredPCConfigId: import_zod2.z.bigint()
806
+ });
807
+ var ZodSelectCircleParamsSchema = import_zod2.z.object({
808
+ currency: import_zod2.z.string().min(1),
809
+ user: ZodAddressSchema,
810
+ usdtAmount: import_zod2.z.bigint(),
811
+ fiatAmount: import_zod2.z.bigint(),
812
+ orderType: import_zod2.z.bigint(),
813
+ preferredPCConfigId: import_zod2.z.bigint()
814
+ });
815
+
816
+ // src/contracts/order-processor/index.ts
817
+ var import_neverthrow4 = require("neverthrow");
818
+ var import_viem3 = require("viem");
819
+
820
+ // src/contracts/p2p-config/index.ts
821
+ var import_neverthrow5 = require("neverthrow");
822
+ var import_viem4 = require("viem");
823
+
824
+ // src/prices/errors.ts
825
+ var PricesError = class extends SdkError {
826
+ constructor(message, options) {
827
+ super(message, options);
828
+ this.name = "PricesError";
829
+ }
830
+ };
831
+
832
+ // src/prices/validation.ts
833
+ var import_zod3 = require("zod");
834
+ var ZodCurrencyScopedParamsSchema = import_zod3.z.object({
835
+ currency: ZodCurrencySchema
836
+ });
837
+
838
+ // src/contracts/p2p-config/index.ts
839
+ function getPriceConfig(publicClient, diamondAddress, params) {
840
+ return validate(
841
+ ZodCurrencyScopedParamsSchema,
842
+ params,
843
+ (message, cause, data) => new PricesError(message, {
844
+ code: "VALIDATION_ERROR",
845
+ cause,
846
+ context: { params: data }
847
+ })
848
+ ).asyncAndThen(
849
+ (validated) => import_neverthrow5.ResultAsync.fromPromise(
850
+ publicClient.readContract({
851
+ address: diamondAddress,
852
+ abi: ABIS.FACETS.CONFIG,
853
+ functionName: "getPriceConfig",
854
+ args: [(0, import_viem4.stringToHex)(validated.currency, { size: 32 })]
855
+ }),
856
+ (error) => new PricesError("Failed to read price config", {
857
+ code: "CONTRACT_READ_ERROR",
858
+ cause: error,
859
+ context: { currency: validated.currency, diamondAddress }
860
+ })
861
+ )
862
+ );
863
+ }
864
+ function getReputationPerUsdcLimit(publicClient, diamondAddress, params) {
865
+ return validate(
866
+ ZodCurrencyScopedParamsSchema,
867
+ params,
868
+ (message, cause, data) => new PricesError(message, {
869
+ code: "VALIDATION_ERROR",
870
+ cause,
871
+ context: { params: data }
872
+ })
873
+ ).asyncAndThen(
874
+ (validated) => import_neverthrow5.ResultAsync.fromPromise(
875
+ publicClient.readContract({
876
+ address: diamondAddress,
877
+ abi: ABIS.DIAMOND,
878
+ functionName: "getRpPerUsdtLimitRational",
879
+ args: [(0, import_viem4.stringToHex)(validated.currency, { size: 32 })]
880
+ }),
881
+ (error) => new PricesError("Failed to read reputation-per-USDC limit", {
882
+ code: "CONTRACT_READ_ERROR",
883
+ cause: error,
884
+ context: { currency: validated.currency, diamondAddress }
885
+ })
886
+ ).map(([numerator, denominator]) => ({
887
+ numerator,
888
+ denominator,
889
+ multiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0
890
+ }))
891
+ );
892
+ }
893
+
894
+ // src/contracts/reputation-manager/writes.ts
895
+ var import_neverthrow6 = require("neverthrow");
896
+ var import_viem5 = require("viem");
897
+
898
+ // src/zkkyc/validation.ts
899
+ var import_zod4 = require("zod");
900
+ var ZodAnonAadharProofParamsSchema = import_zod4.z.object({
901
+ nullifierSeed: import_zod4.z.bigint(),
902
+ nullifier: import_zod4.z.bigint(),
903
+ timestamp: import_zod4.z.bigint(),
904
+ signal: import_zod4.z.bigint(),
905
+ revealArray: import_zod4.z.tuple([import_zod4.z.bigint(), import_zod4.z.bigint(), import_zod4.z.bigint(), import_zod4.z.bigint()]),
906
+ packedGroth16Proof: import_zod4.z.tuple([
907
+ import_zod4.z.bigint(),
908
+ import_zod4.z.bigint(),
909
+ import_zod4.z.bigint(),
910
+ import_zod4.z.bigint(),
911
+ import_zod4.z.bigint(),
912
+ import_zod4.z.bigint(),
913
+ import_zod4.z.bigint(),
914
+ import_zod4.z.bigint()
915
+ ])
916
+ });
917
+ var ZodSocialVerifyParamsSchema = import_zod4.z.object({
918
+ _socialName: import_zod4.z.string(),
919
+ proofs: import_zod4.z.array(
920
+ import_zod4.z.object({
921
+ claimInfo: import_zod4.z.object({
922
+ provider: import_zod4.z.string(),
923
+ parameters: import_zod4.z.string(),
924
+ context: import_zod4.z.string()
925
+ }),
926
+ signedClaim: import_zod4.z.object({
927
+ claim: import_zod4.z.object({
928
+ identifier: import_zod4.z.string(),
929
+ owner: ZodAddressSchema,
930
+ timestampS: import_zod4.z.number(),
931
+ epoch: import_zod4.z.number()
932
+ }),
933
+ signatures: import_zod4.z.array(import_zod4.z.string())
934
+ })
935
+ })
936
+ )
937
+ });
938
+ var ZodSolidityVerifierParametersSchema = import_zod4.z.object({
939
+ version: import_zod4.z.string().refine((val) => val.startsWith("0x"), {
940
+ message: "Version must be a hex string"
941
+ }),
942
+ proofVerificationData: import_zod4.z.object({
943
+ vkeyHash: import_zod4.z.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
944
+ message: "Invalid bytes32 hex string"
945
+ }),
946
+ proof: import_zod4.z.string().refine((val) => val.startsWith("0x"), {
947
+ message: "Proof must be a hex string"
948
+ }),
949
+ publicInputs: import_zod4.z.array(
950
+ import_zod4.z.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
951
+ message: "Each public input must be a valid bytes32 hex string"
952
+ })
953
+ )
954
+ }),
955
+ committedInputs: import_zod4.z.string().refine((val) => val.startsWith("0x"), {
956
+ message: "Committed inputs must be a hex string"
957
+ }),
958
+ serviceConfig: import_zod4.z.object({
959
+ validityPeriodInSeconds: import_zod4.z.number().int().nonnegative(),
960
+ domain: import_zod4.z.string(),
961
+ scope: import_zod4.z.string(),
962
+ devMode: import_zod4.z.boolean()
963
+ })
964
+ });
965
+ var ZodZkPassportRegisterParamsSchema = import_zod4.z.object({
966
+ params: ZodSolidityVerifierParametersSchema,
967
+ isIDCard: import_zod4.z.boolean()
968
+ });
969
+
970
+ // src/contracts/tx-limits/index.ts
971
+ var import_neverthrow7 = require("neverthrow");
972
+ var import_viem6 = require("viem");
973
+
974
+ // src/profile/validation.ts
975
+ var import_zod5 = require("zod");
976
+ var ZodUsdcBalanceParamsSchema = import_zod5.z.object({
977
+ address: ZodAddressSchema
978
+ });
979
+ var ZodUsdcAllowanceParamsSchema = import_zod5.z.object({
980
+ owner: ZodAddressSchema
981
+ });
982
+ var ZodGetBalancesParamsSchema = import_zod5.z.object({
983
+ address: ZodAddressSchema,
984
+ currency: ZodCurrencySchema
985
+ });
986
+ var ZodTxLimitsParamsSchema = import_zod5.z.object({
987
+ address: ZodAddressSchema,
988
+ currency: ZodCurrencySchema
989
+ });
990
+
991
+ // src/contracts/usdc/index.ts
992
+ var import_neverthrow8 = require("neverthrow");
993
+ var import_viem7 = require("viem");
994
+
995
+ // src/prices/client.ts
996
+ function createPrices(config) {
997
+ const { publicClient, diamondAddress } = config;
998
+ return {
999
+ getPriceConfig: (params) => getPriceConfig(publicClient, diamondAddress, params),
1000
+ getReputationPerUsdcLimit: (params) => getReputationPerUsdcLimit(publicClient, diamondAddress, params)
1001
+ };
1002
+ }
1003
+ // Annotate the CommonJS export names for ESM import in node:
1004
+ 0 && (module.exports = {
1005
+ PricesError,
1006
+ createPrices
1007
+ });
1008
+ //# sourceMappingURL=prices.cjs.map