@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
package/dist/profile.mjs CHANGED
@@ -31,6 +31,381 @@ var orderFlowFacetAbi = [
31
31
  ],
32
32
  stateMutability: "view",
33
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: []
34
409
  }
35
410
  ];
36
411
 
@@ -306,11 +681,16 @@ var reputationManagerAbi = [
306
681
  ];
307
682
 
308
683
  // src/contracts/abis/index.ts
309
- var DIAMOND_ABI = [...orderFlowFacetAbi, ...p2pConfigFacetAbi];
684
+ var DIAMOND_ABI = [
685
+ ...orderFlowFacetAbi,
686
+ ...orderProcessorFacetAbi,
687
+ ...p2pConfigFacetAbi
688
+ ];
310
689
  var ABIS = {
311
690
  DIAMOND: DIAMOND_ABI,
312
691
  FACETS: {
313
692
  ORDER_FLOW: orderFlowFacetAbi,
693
+ ORDER_PROCESSOR: orderProcessorFacetAbi,
314
694
  CONFIG: p2pConfigFacetAbi
315
695
  },
316
696
  EXTERNAL: {
@@ -319,7 +699,434 @@ var ABIS = {
319
699
  }
320
700
  };
321
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
+
322
1126
  // src/contracts/order-flow/index.ts
1127
+ import { ResultAsync as ResultAsync2 } from "neverthrow";
1128
+
1129
+ // src/lib/subgraph.ts
323
1130
  import { ResultAsync } from "neverthrow";
324
1131
 
325
1132
  // src/validation/errors.validation.ts
@@ -341,7 +1148,7 @@ import { err, ok } from "neverthrow";
341
1148
  import { isAddress } from "viem";
342
1149
  import { z } from "zod";
343
1150
 
344
- // src/constants/currencies.constant.ts
1151
+ // src/country/currency.ts
345
1152
  var CURRENCY = {
346
1153
  IDR: "IDR",
347
1154
  INR: "INR",
@@ -354,10 +1161,11 @@ var CURRENCY = {
354
1161
  USD: "USD",
355
1162
  COP: "COP"
356
1163
  };
1164
+ var CURRENCY_CODES = Object.values(CURRENCY);
357
1165
 
358
1166
  // src/validation/schemas.validation.ts
359
1167
  var ZodAddressSchema = z.string().refine((s) => isAddress(s), { message: "Invalid Ethereum address" });
360
- var ZodCurrencySchema = z.enum(Object.values(CURRENCY));
1168
+ var ZodCurrencySchema = z.enum(CURRENCY_CODES);
361
1169
  function validate(schema, data, toError) {
362
1170
  const result = schema.safeParse(data);
363
1171
  if (result.success) {
@@ -366,7 +1174,7 @@ function validate(schema, data, toError) {
366
1174
  return err(toError(z.prettifyError(result.error), result.error, data));
367
1175
  }
368
1176
 
369
- // src/order-routing/validation.ts
1177
+ // src/orders/internal/routing/validation.ts
370
1178
  import { z as z2 } from "zod";
371
1179
  var ZodCircleScoreStateSchema = z2.object({
372
1180
  activeMerchantsCount: z2.coerce.number()
@@ -402,54 +1210,47 @@ var ZodSelectCircleParamsSchema = z2.object({
402
1210
  preferredPCConfigId: z2.bigint()
403
1211
  });
404
1212
 
405
- // src/contracts/p2p-config/index.ts
406
- import { ResultAsync as ResultAsync2 } from "neverthrow";
1213
+ // src/contracts/order-processor/index.ts
1214
+ import { ResultAsync as ResultAsync3 } from "neverthrow";
407
1215
  import { stringToHex } from "viem";
408
1216
 
409
- // src/profile/errors.ts
410
- var ProfileError = class extends SdkError {
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 {
411
1223
  constructor(message, options) {
412
1224
  super(message, options);
413
- this.name = "ProfileError";
1225
+ this.name = "PricesError";
414
1226
  }
415
1227
  };
416
1228
 
417
- // src/profile/validation.ts
1229
+ // src/prices/validation.ts
418
1230
  import { z as z3 } from "zod";
419
- var ZodUsdcBalanceParamsSchema = z3.object({
420
- address: ZodAddressSchema
421
- });
422
- var ZodGetBalancesParamsSchema = z3.object({
423
- address: ZodAddressSchema,
424
- currency: ZodCurrencySchema
425
- });
426
- var ZodTxLimitsParamsSchema = z3.object({
427
- address: ZodAddressSchema,
428
- currency: ZodCurrencySchema
429
- });
430
- var ZodPriceConfigParamsSchema = z3.object({
1231
+ var ZodCurrencyScopedParamsSchema = z3.object({
431
1232
  currency: ZodCurrencySchema
432
1233
  });
433
1234
 
434
1235
  // src/contracts/p2p-config/index.ts
435
1236
  function getPriceConfig(publicClient, diamondAddress, params) {
436
1237
  return validate(
437
- ZodPriceConfigParamsSchema,
1238
+ ZodCurrencyScopedParamsSchema,
438
1239
  params,
439
- (message, cause, data) => new ProfileError(message, {
1240
+ (message, cause, data) => new PricesError(message, {
440
1241
  code: "VALIDATION_ERROR",
441
1242
  cause,
442
1243
  context: { params: data }
443
1244
  })
444
1245
  ).asyncAndThen(
445
- (validated) => ResultAsync2.fromPromise(
1246
+ (validated) => ResultAsync4.fromPromise(
446
1247
  publicClient.readContract({
447
1248
  address: diamondAddress,
448
1249
  abi: ABIS.FACETS.CONFIG,
449
1250
  functionName: "getPriceConfig",
450
- args: [stringToHex(validated.currency, { size: 32 })]
1251
+ args: [stringToHex2(validated.currency, { size: 32 })]
451
1252
  }),
452
- (error) => new ProfileError("Failed to read price config", {
1253
+ (error) => new PricesError("Failed to read price config", {
453
1254
  code: "CONTRACT_READ_ERROR",
454
1255
  cause: error,
455
1256
  context: { currency: validated.currency, diamondAddress }
@@ -535,8 +1336,35 @@ var ZodZkPassportRegisterParamsSchema = z4.object({
535
1336
  });
536
1337
 
537
1338
  // src/contracts/tx-limits/index.ts
538
- import { ResultAsync as ResultAsync3 } from "neverthrow";
539
- import { formatUnits, stringToHex as stringToHex2 } from "viem";
1339
+ import { ResultAsync as ResultAsync5 } from "neverthrow";
1340
+ import { formatUnits, stringToHex as stringToHex3 } from "viem";
1341
+
1342
+ // src/profile/errors.ts
1343
+ var ProfileError = class extends SdkError {
1344
+ constructor(message, options) {
1345
+ super(message, options);
1346
+ this.name = "ProfileError";
1347
+ }
1348
+ };
1349
+
1350
+ // src/profile/validation.ts
1351
+ import { z as z5 } from "zod";
1352
+ var ZodUsdcBalanceParamsSchema = z5.object({
1353
+ address: ZodAddressSchema
1354
+ });
1355
+ var ZodUsdcAllowanceParamsSchema = z5.object({
1356
+ owner: ZodAddressSchema
1357
+ });
1358
+ var ZodGetBalancesParamsSchema = z5.object({
1359
+ address: ZodAddressSchema,
1360
+ currency: ZodCurrencySchema
1361
+ });
1362
+ var ZodTxLimitsParamsSchema = z5.object({
1363
+ address: ZodAddressSchema,
1364
+ currency: ZodCurrencySchema
1365
+ });
1366
+
1367
+ // src/contracts/tx-limits/index.ts
540
1368
  function getTxLimits(publicClient, diamondAddress, params) {
541
1369
  return validate(
542
1370
  ZodTxLimitsParamsSchema,
@@ -547,12 +1375,12 @@ function getTxLimits(publicClient, diamondAddress, params) {
547
1375
  context: { params: data }
548
1376
  })
549
1377
  ).asyncAndThen(
550
- (validated) => ResultAsync3.fromPromise(
1378
+ (validated) => ResultAsync5.fromPromise(
551
1379
  publicClient.readContract({
552
1380
  address: diamondAddress,
553
1381
  abi: ABIS.FACETS.ORDER_FLOW,
554
1382
  functionName: "userTxLimit",
555
- args: [validated.address, stringToHex2(validated.currency, { size: 32 })]
1383
+ args: [validated.address, stringToHex3(validated.currency, { size: 32 })]
556
1384
  }),
557
1385
  (error) => new ProfileError("Failed to read tx limits", {
558
1386
  code: "CONTRACT_READ_ERROR",
@@ -565,9 +1393,13 @@ function getTxLimits(publicClient, diamondAddress, params) {
565
1393
  }))
566
1394
  );
567
1395
  }
568
- function getRpPerUsdtLimitRational(publicClient, diamondAddress, params) {
1396
+
1397
+ // src/contracts/usdc/index.ts
1398
+ import { ResultAsync as ResultAsync6 } from "neverthrow";
1399
+ import { erc20Abi as erc20Abi2 } from "viem";
1400
+ function getUsdcBalance(publicClient, usdcAddress, params) {
569
1401
  return validate(
570
- ZodPriceConfigParamsSchema,
1402
+ ZodUsdcBalanceParamsSchema,
571
1403
  params,
572
1404
  (message, cause, data) => new ProfileError(message, {
573
1405
  code: "VALIDATION_ERROR",
@@ -575,31 +1407,24 @@ function getRpPerUsdtLimitRational(publicClient, diamondAddress, params) {
575
1407
  context: { params: data }
576
1408
  })
577
1409
  ).asyncAndThen(
578
- (validated) => ResultAsync3.fromPromise(
1410
+ (validated) => ResultAsync6.fromPromise(
579
1411
  publicClient.readContract({
580
- address: diamondAddress,
581
- abi: ABIS.DIAMOND,
582
- functionName: "getRpPerUsdtLimitRational",
583
- args: [stringToHex2(validated.currency, { size: 32 })]
1412
+ address: usdcAddress,
1413
+ abi: ABIS.EXTERNAL.USDC,
1414
+ functionName: "balanceOf",
1415
+ args: [validated.address]
584
1416
  }),
585
- (error) => new ProfileError("Failed to read RP per USDT limit rational", {
1417
+ (error) => new ProfileError("Failed to read USDC balance", {
586
1418
  code: "CONTRACT_READ_ERROR",
587
1419
  cause: error,
588
- context: { currency: validated.currency, diamondAddress }
1420
+ context: { address: validated.address, usdcAddress }
589
1421
  })
590
- ).map(([numerator, denominator]) => ({
591
- numerator,
592
- denominator,
593
- multiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0
594
- }))
1422
+ )
595
1423
  );
596
1424
  }
597
-
598
- // src/contracts/usdc/index.ts
599
- import { ResultAsync as ResultAsync4 } from "neverthrow";
600
- function getUsdcBalance(publicClient, usdcAddress, params) {
1425
+ function getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params) {
601
1426
  return validate(
602
- ZodUsdcBalanceParamsSchema,
1427
+ ZodUsdcAllowanceParamsSchema,
603
1428
  params,
604
1429
  (message, cause, data) => new ProfileError(message, {
605
1430
  code: "VALIDATION_ERROR",
@@ -607,24 +1432,24 @@ function getUsdcBalance(publicClient, usdcAddress, params) {
607
1432
  context: { params: data }
608
1433
  })
609
1434
  ).asyncAndThen(
610
- (validated) => ResultAsync4.fromPromise(
1435
+ (validated) => ResultAsync6.fromPromise(
611
1436
  publicClient.readContract({
612
1437
  address: usdcAddress,
613
- abi: ABIS.EXTERNAL.USDC,
614
- functionName: "balanceOf",
615
- args: [validated.address]
1438
+ abi: erc20Abi2,
1439
+ functionName: "allowance",
1440
+ args: [validated.owner, diamondAddress]
616
1441
  }),
617
- (error) => new ProfileError("Failed to read USDC balance", {
1442
+ (error) => new ProfileError("Failed to read USDC allowance", {
618
1443
  code: "CONTRACT_READ_ERROR",
619
1444
  cause: error,
620
- context: { address: validated.address, usdcAddress }
1445
+ context: { owner: validated.owner, usdcAddress, diamondAddress }
621
1446
  })
622
1447
  )
623
1448
  );
624
1449
  }
625
1450
 
626
1451
  // src/profile/contracts/actions.ts
627
- import { ResultAsync as ResultAsync5 } from "neverthrow";
1452
+ import { ResultAsync as ResultAsync7 } from "neverthrow";
628
1453
  import { formatUnits as formatUnits2 } from "viem";
629
1454
  function getBalances(publicClient, usdcAddress, diamondAddress, params) {
630
1455
  return validate(
@@ -636,13 +1461,19 @@ function getBalances(publicClient, usdcAddress, diamondAddress, params) {
636
1461
  context: { params: data }
637
1462
  })
638
1463
  ).asyncAndThen(
639
- (validated) => ResultAsync5.combine([
1464
+ (validated) => ResultAsync7.combine([
640
1465
  getUsdcBalance(publicClient, usdcAddress, {
641
1466
  address: validated.address
642
1467
  }),
643
1468
  getPriceConfig(publicClient, diamondAddress, {
644
1469
  currency: validated.currency
645
- })
1470
+ }).mapErr(
1471
+ (cause) => new ProfileError("Failed to read price config for balance conversion", {
1472
+ code: "CONTRACT_READ_ERROR",
1473
+ cause,
1474
+ context: { currency: validated.currency }
1475
+ })
1476
+ )
646
1477
  ]).map(([usdc, priceConfig]) => {
647
1478
  const usdcFormatted = Number(formatUnits2(usdc, 6));
648
1479
  const sellPriceFormatted = Number(formatUnits2(priceConfig.sellPrice, 6));
@@ -660,10 +1491,9 @@ function createProfile(config) {
660
1491
  const { publicClient, diamondAddress, usdcAddress } = config;
661
1492
  return {
662
1493
  getUsdcBalance: (params) => getUsdcBalance(publicClient, usdcAddress, params),
663
- getPriceConfig: (params) => getPriceConfig(publicClient, diamondAddress, params),
1494
+ getUsdcAllowance: (params) => getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params),
664
1495
  getBalances: (params) => getBalances(publicClient, usdcAddress, diamondAddress, params),
665
- getTxLimits: (params) => getTxLimits(publicClient, diamondAddress, params),
666
- getRpPerUsdtLimitRational: (params) => getRpPerUsdtLimitRational(publicClient, diamondAddress, params)
1496
+ getTxLimits: (params) => getTxLimits(publicClient, diamondAddress, params)
667
1497
  };
668
1498
  }
669
1499
  export {