@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.
- package/README.md +71 -41
- package/dist/country.cjs +8 -1
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +35 -10
- package/dist/country.d.ts +35 -10
- package/dist/country.mjs +5 -1
- package/dist/country.mjs.map +1 -1
- package/dist/fraud-engine.cjs +52 -48
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +46 -42
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -36
- package/dist/index.d.ts +41 -36
- package/dist/index.mjs +4 -12
- package/dist/index.mjs.map +1 -1
- package/dist/{payload.cjs → orders.cjs} +2357 -253
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +399 -0
- package/dist/orders.d.ts +399 -0
- package/dist/{payload.mjs → orders.mjs} +2340 -237
- package/dist/orders.mjs.map +1 -0
- package/dist/prices.cjs +1008 -0
- package/dist/prices.cjs.map +1 -0
- package/dist/prices.d.cts +109 -0
- package/dist/prices.d.ts +109 -0
- package/dist/prices.mjs +980 -0
- package/dist/prices.mjs.map +1 -0
- package/dist/profile.cjs +475 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +39 -27
- package/dist/profile.d.ts +39 -27
- package/dist/profile.mjs +468 -62
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +6 -6
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +38 -16
- package/dist/qr-parsers.d.ts +38 -16
- package/dist/qr-parsers.mjs +6 -6
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +2531 -1105
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +384 -104
- package/dist/react.d.ts +384 -104
- package/dist/react.mjs +2417 -992
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +405 -24
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.d.cts +14 -9
- package/dist/zkkyc.d.ts +14 -9
- package/dist/zkkyc.mjs +405 -24
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/order-routing.cjs +0 -888
- package/dist/order-routing.cjs.map +0 -1
- package/dist/order-routing.d.cts +0 -68
- package/dist/order-routing.d.ts +0 -68
- package/dist/order-routing.mjs +0 -860
- package/dist/order-routing.mjs.map +0 -1
- package/dist/payload.cjs.map +0 -1
- package/dist/payload.d.cts +0 -147
- package/dist/payload.d.ts +0 -147
- package/dist/payload.mjs.map +0 -1
package/dist/profile.cjs
CHANGED
|
@@ -58,6 +58,381 @@ var orderFlowFacetAbi = [
|
|
|
58
58
|
],
|
|
59
59
|
stateMutability: "view",
|
|
60
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: []
|
|
61
436
|
}
|
|
62
437
|
];
|
|
63
438
|
|
|
@@ -333,11 +708,16 @@ var reputationManagerAbi = [
|
|
|
333
708
|
];
|
|
334
709
|
|
|
335
710
|
// src/contracts/abis/index.ts
|
|
336
|
-
var DIAMOND_ABI = [
|
|
711
|
+
var DIAMOND_ABI = [
|
|
712
|
+
...orderFlowFacetAbi,
|
|
713
|
+
...orderProcessorFacetAbi,
|
|
714
|
+
...p2pConfigFacetAbi
|
|
715
|
+
];
|
|
337
716
|
var ABIS = {
|
|
338
717
|
DIAMOND: DIAMOND_ABI,
|
|
339
718
|
FACETS: {
|
|
340
719
|
ORDER_FLOW: orderFlowFacetAbi,
|
|
720
|
+
ORDER_PROCESSOR: orderProcessorFacetAbi,
|
|
341
721
|
CONFIG: p2pConfigFacetAbi
|
|
342
722
|
},
|
|
343
723
|
EXTERNAL: {
|
|
@@ -347,6 +727,9 @@ var ABIS = {
|
|
|
347
727
|
};
|
|
348
728
|
|
|
349
729
|
// src/contracts/order-flow/index.ts
|
|
730
|
+
var import_neverthrow3 = require("neverthrow");
|
|
731
|
+
|
|
732
|
+
// src/lib/subgraph.ts
|
|
350
733
|
var import_neverthrow2 = require("neverthrow");
|
|
351
734
|
|
|
352
735
|
// src/validation/errors.validation.ts
|
|
@@ -368,7 +751,7 @@ var import_neverthrow = require("neverthrow");
|
|
|
368
751
|
var import_viem2 = require("viem");
|
|
369
752
|
var import_zod = require("zod");
|
|
370
753
|
|
|
371
|
-
// src/
|
|
754
|
+
// src/country/currency.ts
|
|
372
755
|
var CURRENCY = {
|
|
373
756
|
IDR: "IDR",
|
|
374
757
|
INR: "INR",
|
|
@@ -381,10 +764,11 @@ var CURRENCY = {
|
|
|
381
764
|
USD: "USD",
|
|
382
765
|
COP: "COP"
|
|
383
766
|
};
|
|
767
|
+
var CURRENCY_CODES = Object.values(CURRENCY);
|
|
384
768
|
|
|
385
769
|
// src/validation/schemas.validation.ts
|
|
386
770
|
var ZodAddressSchema = import_zod.z.string().refine((s) => (0, import_viem2.isAddress)(s), { message: "Invalid Ethereum address" });
|
|
387
|
-
var ZodCurrencySchema = import_zod.z.enum(
|
|
771
|
+
var ZodCurrencySchema = import_zod.z.enum(CURRENCY_CODES);
|
|
388
772
|
function validate(schema, data, toError) {
|
|
389
773
|
const result = schema.safeParse(data);
|
|
390
774
|
if (result.success) {
|
|
@@ -393,7 +777,7 @@ function validate(schema, data, toError) {
|
|
|
393
777
|
return (0, import_neverthrow.err)(toError(import_zod.z.prettifyError(result.error), result.error, data));
|
|
394
778
|
}
|
|
395
779
|
|
|
396
|
-
// src/
|
|
780
|
+
// src/orders/internal/routing/validation.ts
|
|
397
781
|
var import_zod2 = require("zod");
|
|
398
782
|
var ZodCircleScoreStateSchema = import_zod2.z.object({
|
|
399
783
|
activeMerchantsCount: import_zod2.z.coerce.number()
|
|
@@ -429,54 +813,47 @@ var ZodSelectCircleParamsSchema = import_zod2.z.object({
|
|
|
429
813
|
preferredPCConfigId: import_zod2.z.bigint()
|
|
430
814
|
});
|
|
431
815
|
|
|
432
|
-
// src/contracts/
|
|
433
|
-
var
|
|
816
|
+
// src/contracts/order-processor/index.ts
|
|
817
|
+
var import_neverthrow4 = require("neverthrow");
|
|
434
818
|
var import_viem3 = require("viem");
|
|
435
819
|
|
|
436
|
-
// src/
|
|
437
|
-
var
|
|
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 {
|
|
438
826
|
constructor(message, options) {
|
|
439
827
|
super(message, options);
|
|
440
|
-
this.name = "
|
|
828
|
+
this.name = "PricesError";
|
|
441
829
|
}
|
|
442
830
|
};
|
|
443
831
|
|
|
444
|
-
// src/
|
|
832
|
+
// src/prices/validation.ts
|
|
445
833
|
var import_zod3 = require("zod");
|
|
446
|
-
var
|
|
447
|
-
address: ZodAddressSchema
|
|
448
|
-
});
|
|
449
|
-
var ZodGetBalancesParamsSchema = import_zod3.z.object({
|
|
450
|
-
address: ZodAddressSchema,
|
|
451
|
-
currency: ZodCurrencySchema
|
|
452
|
-
});
|
|
453
|
-
var ZodTxLimitsParamsSchema = import_zod3.z.object({
|
|
454
|
-
address: ZodAddressSchema,
|
|
455
|
-
currency: ZodCurrencySchema
|
|
456
|
-
});
|
|
457
|
-
var ZodPriceConfigParamsSchema = import_zod3.z.object({
|
|
834
|
+
var ZodCurrencyScopedParamsSchema = import_zod3.z.object({
|
|
458
835
|
currency: ZodCurrencySchema
|
|
459
836
|
});
|
|
460
837
|
|
|
461
838
|
// src/contracts/p2p-config/index.ts
|
|
462
839
|
function getPriceConfig(publicClient, diamondAddress, params) {
|
|
463
840
|
return validate(
|
|
464
|
-
|
|
841
|
+
ZodCurrencyScopedParamsSchema,
|
|
465
842
|
params,
|
|
466
|
-
(message, cause, data) => new
|
|
843
|
+
(message, cause, data) => new PricesError(message, {
|
|
467
844
|
code: "VALIDATION_ERROR",
|
|
468
845
|
cause,
|
|
469
846
|
context: { params: data }
|
|
470
847
|
})
|
|
471
848
|
).asyncAndThen(
|
|
472
|
-
(validated) =>
|
|
849
|
+
(validated) => import_neverthrow5.ResultAsync.fromPromise(
|
|
473
850
|
publicClient.readContract({
|
|
474
851
|
address: diamondAddress,
|
|
475
852
|
abi: ABIS.FACETS.CONFIG,
|
|
476
853
|
functionName: "getPriceConfig",
|
|
477
|
-
args: [(0,
|
|
854
|
+
args: [(0, import_viem4.stringToHex)(validated.currency, { size: 32 })]
|
|
478
855
|
}),
|
|
479
|
-
(error) => new
|
|
856
|
+
(error) => new PricesError("Failed to read price config", {
|
|
480
857
|
code: "CONTRACT_READ_ERROR",
|
|
481
858
|
cause: error,
|
|
482
859
|
context: { currency: validated.currency, diamondAddress }
|
|
@@ -486,8 +863,8 @@ function getPriceConfig(publicClient, diamondAddress, params) {
|
|
|
486
863
|
}
|
|
487
864
|
|
|
488
865
|
// src/contracts/reputation-manager/writes.ts
|
|
489
|
-
var
|
|
490
|
-
var
|
|
866
|
+
var import_neverthrow6 = require("neverthrow");
|
|
867
|
+
var import_viem5 = require("viem");
|
|
491
868
|
|
|
492
869
|
// src/zkkyc/validation.ts
|
|
493
870
|
var import_zod4 = require("zod");
|
|
@@ -562,8 +939,35 @@ var ZodZkPassportRegisterParamsSchema = import_zod4.z.object({
|
|
|
562
939
|
});
|
|
563
940
|
|
|
564
941
|
// src/contracts/tx-limits/index.ts
|
|
565
|
-
var
|
|
566
|
-
var
|
|
942
|
+
var import_neverthrow7 = require("neverthrow");
|
|
943
|
+
var import_viem6 = require("viem");
|
|
944
|
+
|
|
945
|
+
// src/profile/errors.ts
|
|
946
|
+
var ProfileError = class extends SdkError {
|
|
947
|
+
constructor(message, options) {
|
|
948
|
+
super(message, options);
|
|
949
|
+
this.name = "ProfileError";
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// src/profile/validation.ts
|
|
954
|
+
var import_zod5 = require("zod");
|
|
955
|
+
var ZodUsdcBalanceParamsSchema = import_zod5.z.object({
|
|
956
|
+
address: ZodAddressSchema
|
|
957
|
+
});
|
|
958
|
+
var ZodUsdcAllowanceParamsSchema = import_zod5.z.object({
|
|
959
|
+
owner: ZodAddressSchema
|
|
960
|
+
});
|
|
961
|
+
var ZodGetBalancesParamsSchema = import_zod5.z.object({
|
|
962
|
+
address: ZodAddressSchema,
|
|
963
|
+
currency: ZodCurrencySchema
|
|
964
|
+
});
|
|
965
|
+
var ZodTxLimitsParamsSchema = import_zod5.z.object({
|
|
966
|
+
address: ZodAddressSchema,
|
|
967
|
+
currency: ZodCurrencySchema
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
// src/contracts/tx-limits/index.ts
|
|
567
971
|
function getTxLimits(publicClient, diamondAddress, params) {
|
|
568
972
|
return validate(
|
|
569
973
|
ZodTxLimitsParamsSchema,
|
|
@@ -574,12 +978,12 @@ function getTxLimits(publicClient, diamondAddress, params) {
|
|
|
574
978
|
context: { params: data }
|
|
575
979
|
})
|
|
576
980
|
).asyncAndThen(
|
|
577
|
-
(validated) =>
|
|
981
|
+
(validated) => import_neverthrow7.ResultAsync.fromPromise(
|
|
578
982
|
publicClient.readContract({
|
|
579
983
|
address: diamondAddress,
|
|
580
984
|
abi: ABIS.FACETS.ORDER_FLOW,
|
|
581
985
|
functionName: "userTxLimit",
|
|
582
|
-
args: [validated.address, (0,
|
|
986
|
+
args: [validated.address, (0, import_viem6.stringToHex)(validated.currency, { size: 32 })]
|
|
583
987
|
}),
|
|
584
988
|
(error) => new ProfileError("Failed to read tx limits", {
|
|
585
989
|
code: "CONTRACT_READ_ERROR",
|
|
@@ -587,14 +991,18 @@ function getTxLimits(publicClient, diamondAddress, params) {
|
|
|
587
991
|
context: { address: validated.address, currency: validated.currency, diamondAddress }
|
|
588
992
|
})
|
|
589
993
|
).map(([buyLimit, sellLimit]) => ({
|
|
590
|
-
buyLimit: Number((0,
|
|
591
|
-
sellLimit: Number((0,
|
|
994
|
+
buyLimit: Number((0, import_viem6.formatUnits)(buyLimit, 6)),
|
|
995
|
+
sellLimit: Number((0, import_viem6.formatUnits)(sellLimit, 6))
|
|
592
996
|
}))
|
|
593
997
|
);
|
|
594
998
|
}
|
|
595
|
-
|
|
999
|
+
|
|
1000
|
+
// src/contracts/usdc/index.ts
|
|
1001
|
+
var import_neverthrow8 = require("neverthrow");
|
|
1002
|
+
var import_viem7 = require("viem");
|
|
1003
|
+
function getUsdcBalance(publicClient, usdcAddress, params) {
|
|
596
1004
|
return validate(
|
|
597
|
-
|
|
1005
|
+
ZodUsdcBalanceParamsSchema,
|
|
598
1006
|
params,
|
|
599
1007
|
(message, cause, data) => new ProfileError(message, {
|
|
600
1008
|
code: "VALIDATION_ERROR",
|
|
@@ -602,31 +1010,24 @@ function getRpPerUsdtLimitRational(publicClient, diamondAddress, params) {
|
|
|
602
1010
|
context: { params: data }
|
|
603
1011
|
})
|
|
604
1012
|
).asyncAndThen(
|
|
605
|
-
(validated) =>
|
|
1013
|
+
(validated) => import_neverthrow8.ResultAsync.fromPromise(
|
|
606
1014
|
publicClient.readContract({
|
|
607
|
-
address:
|
|
608
|
-
abi: ABIS.
|
|
609
|
-
functionName: "
|
|
610
|
-
args: [
|
|
1015
|
+
address: usdcAddress,
|
|
1016
|
+
abi: ABIS.EXTERNAL.USDC,
|
|
1017
|
+
functionName: "balanceOf",
|
|
1018
|
+
args: [validated.address]
|
|
611
1019
|
}),
|
|
612
|
-
(error) => new ProfileError("Failed to read
|
|
1020
|
+
(error) => new ProfileError("Failed to read USDC balance", {
|
|
613
1021
|
code: "CONTRACT_READ_ERROR",
|
|
614
1022
|
cause: error,
|
|
615
|
-
context: {
|
|
1023
|
+
context: { address: validated.address, usdcAddress }
|
|
616
1024
|
})
|
|
617
|
-
)
|
|
618
|
-
numerator,
|
|
619
|
-
denominator,
|
|
620
|
-
multiplier: numerator > 0n ? Number(denominator) / Number(numerator) : 0
|
|
621
|
-
}))
|
|
1025
|
+
)
|
|
622
1026
|
);
|
|
623
1027
|
}
|
|
624
|
-
|
|
625
|
-
// src/contracts/usdc/index.ts
|
|
626
|
-
var import_neverthrow6 = require("neverthrow");
|
|
627
|
-
function getUsdcBalance(publicClient, usdcAddress, params) {
|
|
1028
|
+
function getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params) {
|
|
628
1029
|
return validate(
|
|
629
|
-
|
|
1030
|
+
ZodUsdcAllowanceParamsSchema,
|
|
630
1031
|
params,
|
|
631
1032
|
(message, cause, data) => new ProfileError(message, {
|
|
632
1033
|
code: "VALIDATION_ERROR",
|
|
@@ -634,25 +1035,25 @@ function getUsdcBalance(publicClient, usdcAddress, params) {
|
|
|
634
1035
|
context: { params: data }
|
|
635
1036
|
})
|
|
636
1037
|
).asyncAndThen(
|
|
637
|
-
(validated) =>
|
|
1038
|
+
(validated) => import_neverthrow8.ResultAsync.fromPromise(
|
|
638
1039
|
publicClient.readContract({
|
|
639
1040
|
address: usdcAddress,
|
|
640
|
-
abi:
|
|
641
|
-
functionName: "
|
|
642
|
-
args: [validated.
|
|
1041
|
+
abi: import_viem7.erc20Abi,
|
|
1042
|
+
functionName: "allowance",
|
|
1043
|
+
args: [validated.owner, diamondAddress]
|
|
643
1044
|
}),
|
|
644
|
-
(error) => new ProfileError("Failed to read USDC
|
|
1045
|
+
(error) => new ProfileError("Failed to read USDC allowance", {
|
|
645
1046
|
code: "CONTRACT_READ_ERROR",
|
|
646
1047
|
cause: error,
|
|
647
|
-
context: {
|
|
1048
|
+
context: { owner: validated.owner, usdcAddress, diamondAddress }
|
|
648
1049
|
})
|
|
649
1050
|
)
|
|
650
1051
|
);
|
|
651
1052
|
}
|
|
652
1053
|
|
|
653
1054
|
// src/profile/contracts/actions.ts
|
|
654
|
-
var
|
|
655
|
-
var
|
|
1055
|
+
var import_neverthrow9 = require("neverthrow");
|
|
1056
|
+
var import_viem8 = require("viem");
|
|
656
1057
|
function getBalances(publicClient, usdcAddress, diamondAddress, params) {
|
|
657
1058
|
return validate(
|
|
658
1059
|
ZodGetBalancesParamsSchema,
|
|
@@ -663,16 +1064,22 @@ function getBalances(publicClient, usdcAddress, diamondAddress, params) {
|
|
|
663
1064
|
context: { params: data }
|
|
664
1065
|
})
|
|
665
1066
|
).asyncAndThen(
|
|
666
|
-
(validated) =>
|
|
1067
|
+
(validated) => import_neverthrow9.ResultAsync.combine([
|
|
667
1068
|
getUsdcBalance(publicClient, usdcAddress, {
|
|
668
1069
|
address: validated.address
|
|
669
1070
|
}),
|
|
670
1071
|
getPriceConfig(publicClient, diamondAddress, {
|
|
671
1072
|
currency: validated.currency
|
|
672
|
-
})
|
|
1073
|
+
}).mapErr(
|
|
1074
|
+
(cause) => new ProfileError("Failed to read price config for balance conversion", {
|
|
1075
|
+
code: "CONTRACT_READ_ERROR",
|
|
1076
|
+
cause,
|
|
1077
|
+
context: { currency: validated.currency }
|
|
1078
|
+
})
|
|
1079
|
+
)
|
|
673
1080
|
]).map(([usdc, priceConfig]) => {
|
|
674
|
-
const usdcFormatted = Number((0,
|
|
675
|
-
const sellPriceFormatted = Number((0,
|
|
1081
|
+
const usdcFormatted = Number((0, import_viem8.formatUnits)(usdc, 6));
|
|
1082
|
+
const sellPriceFormatted = Number((0, import_viem8.formatUnits)(priceConfig.sellPrice, 6));
|
|
676
1083
|
return {
|
|
677
1084
|
usdc: usdcFormatted,
|
|
678
1085
|
fiat: usdcFormatted * sellPriceFormatted,
|
|
@@ -687,10 +1094,9 @@ function createProfile(config) {
|
|
|
687
1094
|
const { publicClient, diamondAddress, usdcAddress } = config;
|
|
688
1095
|
return {
|
|
689
1096
|
getUsdcBalance: (params) => getUsdcBalance(publicClient, usdcAddress, params),
|
|
690
|
-
|
|
1097
|
+
getUsdcAllowance: (params) => getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params),
|
|
691
1098
|
getBalances: (params) => getBalances(publicClient, usdcAddress, diamondAddress, params),
|
|
692
|
-
getTxLimits: (params) => getTxLimits(publicClient, diamondAddress, params)
|
|
693
|
-
getRpPerUsdtLimitRational: (params) => getRpPerUsdtLimitRational(publicClient, diamondAddress, params)
|
|
1099
|
+
getTxLimits: (params) => getTxLimits(publicClient, diamondAddress, params)
|
|
694
1100
|
};
|
|
695
1101
|
}
|
|
696
1102
|
// Annotate the CommonJS export names for ESM import in node:
|