@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/zkkyc.cjs
CHANGED
|
@@ -64,7 +64,7 @@ var import_neverthrow = require("neverthrow");
|
|
|
64
64
|
var import_viem = require("viem");
|
|
65
65
|
var import_zod = require("zod");
|
|
66
66
|
|
|
67
|
-
// src/
|
|
67
|
+
// src/country/currency.ts
|
|
68
68
|
var CURRENCY = {
|
|
69
69
|
IDR: "IDR",
|
|
70
70
|
INR: "INR",
|
|
@@ -77,10 +77,11 @@ var CURRENCY = {
|
|
|
77
77
|
USD: "USD",
|
|
78
78
|
COP: "COP"
|
|
79
79
|
};
|
|
80
|
+
var CURRENCY_CODES = Object.values(CURRENCY);
|
|
80
81
|
|
|
81
82
|
// src/validation/schemas.validation.ts
|
|
82
83
|
var ZodAddressSchema = import_zod.z.string().refine((s) => (0, import_viem.isAddress)(s), { message: "Invalid Ethereum address" });
|
|
83
|
-
var ZodCurrencySchema = import_zod.z.enum(
|
|
84
|
+
var ZodCurrencySchema = import_zod.z.enum(CURRENCY_CODES);
|
|
84
85
|
function validate(schema, data, toError) {
|
|
85
86
|
const result = schema.safeParse(data);
|
|
86
87
|
if (result.success) {
|
|
@@ -202,6 +203,381 @@ var orderFlowFacetAbi = [
|
|
|
202
203
|
],
|
|
203
204
|
stateMutability: "view",
|
|
204
205
|
type: "function"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
inputs: [
|
|
209
|
+
{ internalType: "string", name: "_pubKey", type: "string" },
|
|
210
|
+
{ internalType: "uint256", name: "_amount", type: "uint256" },
|
|
211
|
+
{ internalType: "address", name: "_recipientAddr", type: "address" },
|
|
212
|
+
{ internalType: "uint8", name: "_orderType", type: "uint8" },
|
|
213
|
+
{ internalType: "string", name: "_userUpi", type: "string" },
|
|
214
|
+
{ internalType: "string", name: "_userPubKey", type: "string" },
|
|
215
|
+
{ internalType: "bytes32", name: "_currency", type: "bytes32" },
|
|
216
|
+
{ internalType: "uint256", name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
217
|
+
{ internalType: "uint256", name: "_circleId", type: "uint256" },
|
|
218
|
+
{ internalType: "uint256", name: "_fiatAmountLimit", type: "uint256" }
|
|
219
|
+
],
|
|
220
|
+
name: "placeOrder",
|
|
221
|
+
outputs: [],
|
|
222
|
+
stateMutability: "nonpayable",
|
|
223
|
+
type: "function"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
inputs: [{ internalType: "uint256", name: "_orderId", type: "uint256" }],
|
|
227
|
+
name: "cancelOrder",
|
|
228
|
+
outputs: [],
|
|
229
|
+
stateMutability: "nonpayable",
|
|
230
|
+
type: "function"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
inputs: [
|
|
234
|
+
{ internalType: "uint256", name: "_orderId", type: "uint256" },
|
|
235
|
+
{ internalType: "string", name: "_userEncUpi", type: "string" },
|
|
236
|
+
{ internalType: "uint256", name: "_updatedAmount", type: "uint256" }
|
|
237
|
+
],
|
|
238
|
+
name: "setSellOrderUpi",
|
|
239
|
+
outputs: [],
|
|
240
|
+
stateMutability: "nonpayable",
|
|
241
|
+
type: "function"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
type: "event",
|
|
245
|
+
name: "OrderPlaced",
|
|
246
|
+
anonymous: false,
|
|
247
|
+
inputs: [
|
|
248
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
249
|
+
{ indexed: true, name: "user", type: "address" },
|
|
250
|
+
{ indexed: true, name: "merchant", type: "address" },
|
|
251
|
+
{ indexed: false, name: "amount", type: "uint256" },
|
|
252
|
+
{ indexed: false, name: "orderType", type: "uint8" },
|
|
253
|
+
{ indexed: false, name: "placedTimestamp", type: "uint256" },
|
|
254
|
+
{
|
|
255
|
+
indexed: false,
|
|
256
|
+
name: "_order",
|
|
257
|
+
type: "tuple",
|
|
258
|
+
components: [
|
|
259
|
+
{ name: "amount", type: "uint256" },
|
|
260
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
261
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
262
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
263
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
264
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
265
|
+
{ name: "user", type: "address" },
|
|
266
|
+
{ name: "recipientAddr", type: "address" },
|
|
267
|
+
{ name: "pubkey", type: "string" },
|
|
268
|
+
{ name: "encUpi", type: "string" },
|
|
269
|
+
{ name: "userCompleted", type: "bool" },
|
|
270
|
+
{ name: "status", type: "uint8" },
|
|
271
|
+
{ name: "orderType", type: "uint8" },
|
|
272
|
+
{
|
|
273
|
+
name: "disputeInfo",
|
|
274
|
+
type: "tuple",
|
|
275
|
+
components: [
|
|
276
|
+
{ name: "raisedBy", type: "uint8" },
|
|
277
|
+
{ name: "status", type: "uint8" },
|
|
278
|
+
{ name: "redactTransId", type: "uint256" },
|
|
279
|
+
{ name: "accountNumber", type: "uint256" }
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
{ name: "id", type: "uint256" },
|
|
283
|
+
{ name: "userPubKey", type: "string" },
|
|
284
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
285
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
286
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
287
|
+
{ name: "currency", type: "bytes32" },
|
|
288
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
289
|
+
{ name: "circleId", type: "uint256" }
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
type: "event",
|
|
296
|
+
name: "OrderAccepted",
|
|
297
|
+
anonymous: false,
|
|
298
|
+
inputs: [
|
|
299
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
300
|
+
{ indexed: true, name: "merchant", type: "address" },
|
|
301
|
+
{ indexed: false, name: "pubKey", type: "string" },
|
|
302
|
+
{
|
|
303
|
+
indexed: false,
|
|
304
|
+
name: "_order",
|
|
305
|
+
type: "tuple",
|
|
306
|
+
components: [
|
|
307
|
+
{ name: "amount", type: "uint256" },
|
|
308
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
309
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
310
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
311
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
312
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
313
|
+
{ name: "user", type: "address" },
|
|
314
|
+
{ name: "recipientAddr", type: "address" },
|
|
315
|
+
{ name: "pubkey", type: "string" },
|
|
316
|
+
{ name: "encUpi", type: "string" },
|
|
317
|
+
{ name: "userCompleted", type: "bool" },
|
|
318
|
+
{ name: "status", type: "uint8" },
|
|
319
|
+
{ name: "orderType", type: "uint8" },
|
|
320
|
+
{
|
|
321
|
+
name: "disputeInfo",
|
|
322
|
+
type: "tuple",
|
|
323
|
+
components: [
|
|
324
|
+
{ name: "raisedBy", type: "uint8" },
|
|
325
|
+
{ name: "status", type: "uint8" },
|
|
326
|
+
{ name: "redactTransId", type: "uint256" },
|
|
327
|
+
{ name: "accountNumber", type: "uint256" }
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{ name: "id", type: "uint256" },
|
|
331
|
+
{ name: "userPubKey", type: "string" },
|
|
332
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
333
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
334
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
335
|
+
{ name: "currency", type: "bytes32" },
|
|
336
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
337
|
+
{ name: "circleId", type: "uint256" }
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: "event",
|
|
344
|
+
name: "BuyOrderPaid",
|
|
345
|
+
anonymous: false,
|
|
346
|
+
inputs: [
|
|
347
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
348
|
+
{ indexed: true, name: "user", type: "address" },
|
|
349
|
+
{
|
|
350
|
+
indexed: false,
|
|
351
|
+
name: "_order",
|
|
352
|
+
type: "tuple",
|
|
353
|
+
components: [
|
|
354
|
+
{ name: "amount", type: "uint256" },
|
|
355
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
356
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
357
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
358
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
359
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
360
|
+
{ name: "user", type: "address" },
|
|
361
|
+
{ name: "recipientAddr", type: "address" },
|
|
362
|
+
{ name: "pubkey", type: "string" },
|
|
363
|
+
{ name: "encUpi", type: "string" },
|
|
364
|
+
{ name: "userCompleted", type: "bool" },
|
|
365
|
+
{ name: "status", type: "uint8" },
|
|
366
|
+
{ name: "orderType", type: "uint8" },
|
|
367
|
+
{
|
|
368
|
+
name: "disputeInfo",
|
|
369
|
+
type: "tuple",
|
|
370
|
+
components: [
|
|
371
|
+
{ name: "raisedBy", type: "uint8" },
|
|
372
|
+
{ name: "status", type: "uint8" },
|
|
373
|
+
{ name: "redactTransId", type: "uint256" },
|
|
374
|
+
{ name: "accountNumber", type: "uint256" }
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
{ name: "id", type: "uint256" },
|
|
378
|
+
{ name: "userPubKey", type: "string" },
|
|
379
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
380
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
381
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
382
|
+
{ name: "currency", type: "bytes32" },
|
|
383
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
384
|
+
{ name: "circleId", type: "uint256" }
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: "event",
|
|
391
|
+
name: "OrderCompleted",
|
|
392
|
+
anonymous: false,
|
|
393
|
+
inputs: [
|
|
394
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
395
|
+
{ indexed: true, name: "user", type: "address" },
|
|
396
|
+
{ indexed: false, name: "completedTimestamp", type: "uint256" },
|
|
397
|
+
{
|
|
398
|
+
indexed: false,
|
|
399
|
+
name: "_order",
|
|
400
|
+
type: "tuple",
|
|
401
|
+
components: [
|
|
402
|
+
{ name: "amount", type: "uint256" },
|
|
403
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
404
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
405
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
406
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
407
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
408
|
+
{ name: "user", type: "address" },
|
|
409
|
+
{ name: "recipientAddr", type: "address" },
|
|
410
|
+
{ name: "pubkey", type: "string" },
|
|
411
|
+
{ name: "encUpi", type: "string" },
|
|
412
|
+
{ name: "userCompleted", type: "bool" },
|
|
413
|
+
{ name: "status", type: "uint8" },
|
|
414
|
+
{ name: "orderType", type: "uint8" },
|
|
415
|
+
{
|
|
416
|
+
name: "disputeInfo",
|
|
417
|
+
type: "tuple",
|
|
418
|
+
components: [
|
|
419
|
+
{ name: "raisedBy", type: "uint8" },
|
|
420
|
+
{ name: "status", type: "uint8" },
|
|
421
|
+
{ name: "redactTransId", type: "uint256" },
|
|
422
|
+
{ name: "accountNumber", type: "uint256" }
|
|
423
|
+
]
|
|
424
|
+
},
|
|
425
|
+
{ name: "id", type: "uint256" },
|
|
426
|
+
{ name: "userPubKey", type: "string" },
|
|
427
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
428
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
429
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
430
|
+
{ name: "currency", type: "bytes32" },
|
|
431
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
432
|
+
{ name: "circleId", type: "uint256" }
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
type: "event",
|
|
439
|
+
name: "CancelledOrders",
|
|
440
|
+
anonymous: false,
|
|
441
|
+
inputs: [
|
|
442
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
443
|
+
{
|
|
444
|
+
indexed: false,
|
|
445
|
+
name: "_order",
|
|
446
|
+
type: "tuple",
|
|
447
|
+
components: [
|
|
448
|
+
{ name: "amount", type: "uint256" },
|
|
449
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
450
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
451
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
452
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
453
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
454
|
+
{ name: "user", type: "address" },
|
|
455
|
+
{ name: "recipientAddr", type: "address" },
|
|
456
|
+
{ name: "pubkey", type: "string" },
|
|
457
|
+
{ name: "encUpi", type: "string" },
|
|
458
|
+
{ name: "userCompleted", type: "bool" },
|
|
459
|
+
{ name: "status", type: "uint8" },
|
|
460
|
+
{ name: "orderType", type: "uint8" },
|
|
461
|
+
{
|
|
462
|
+
name: "disputeInfo",
|
|
463
|
+
type: "tuple",
|
|
464
|
+
components: [
|
|
465
|
+
{ name: "raisedBy", type: "uint8" },
|
|
466
|
+
{ name: "status", type: "uint8" },
|
|
467
|
+
{ name: "redactTransId", type: "uint256" },
|
|
468
|
+
{ name: "accountNumber", type: "uint256" }
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
{ name: "id", type: "uint256" },
|
|
472
|
+
{ name: "userPubKey", type: "string" },
|
|
473
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
474
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
475
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
476
|
+
{ name: "currency", type: "bytes32" },
|
|
477
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
478
|
+
{ name: "circleId", type: "uint256" }
|
|
479
|
+
]
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
// src/contracts/abis/order-processor-facet.ts
|
|
486
|
+
var orderProcessorFacetAbi = [
|
|
487
|
+
{
|
|
488
|
+
type: "function",
|
|
489
|
+
name: "getOrdersById",
|
|
490
|
+
stateMutability: "view",
|
|
491
|
+
inputs: [{ name: "orderId", type: "uint256" }],
|
|
492
|
+
outputs: [
|
|
493
|
+
{
|
|
494
|
+
type: "tuple",
|
|
495
|
+
components: [
|
|
496
|
+
{ name: "amount", type: "uint256" },
|
|
497
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
498
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
499
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
500
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
501
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
502
|
+
{ name: "user", type: "address" },
|
|
503
|
+
{ name: "recipientAddr", type: "address" },
|
|
504
|
+
{ name: "pubkey", type: "string" },
|
|
505
|
+
{ name: "encUpi", type: "string" },
|
|
506
|
+
{ name: "userCompleted", type: "bool" },
|
|
507
|
+
{ name: "status", type: "uint8" },
|
|
508
|
+
{ name: "orderType", type: "uint8" },
|
|
509
|
+
{
|
|
510
|
+
name: "disputeInfo",
|
|
511
|
+
type: "tuple",
|
|
512
|
+
components: [
|
|
513
|
+
{ name: "raisedBy", type: "uint8" },
|
|
514
|
+
{ name: "status", type: "uint8" },
|
|
515
|
+
{ name: "redactTransId", type: "uint256" },
|
|
516
|
+
{ name: "accountNumber", type: "uint256" }
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
{ name: "id", type: "uint256" },
|
|
520
|
+
{ name: "userPubKey", type: "string" },
|
|
521
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
522
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
523
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
524
|
+
{ name: "currency", type: "bytes32" },
|
|
525
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
526
|
+
{ name: "circleId", type: "uint256" }
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
]
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
type: "function",
|
|
533
|
+
name: "getAdditionalOrderDetails",
|
|
534
|
+
stateMutability: "view",
|
|
535
|
+
inputs: [{ name: "orderId", type: "uint256" }],
|
|
536
|
+
outputs: [
|
|
537
|
+
{
|
|
538
|
+
type: "tuple",
|
|
539
|
+
components: [
|
|
540
|
+
{ name: "fixedFeePaid", type: "uint64" },
|
|
541
|
+
{ name: "tipsPaid", type: "uint64" },
|
|
542
|
+
{ name: "acceptedTimestamp", type: "uint128" },
|
|
543
|
+
{ name: "paidTimestamp", type: "uint128" },
|
|
544
|
+
{ name: "reserved2", type: "uint128" },
|
|
545
|
+
{ name: "actualUsdtAmount", type: "uint256" },
|
|
546
|
+
{ name: "actualFiatAmount", type: "uint256" }
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
type: "function",
|
|
553
|
+
name: "getSmallOrderThreshold",
|
|
554
|
+
stateMutability: "view",
|
|
555
|
+
inputs: [{ name: "currency", type: "bytes32" }],
|
|
556
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: "function",
|
|
560
|
+
name: "getSmallOrderFixedFee",
|
|
561
|
+
stateMutability: "view",
|
|
562
|
+
inputs: [{ name: "currency", type: "bytes32" }],
|
|
563
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
type: "function",
|
|
567
|
+
name: "raiseDispute",
|
|
568
|
+
stateMutability: "nonpayable",
|
|
569
|
+
inputs: [
|
|
570
|
+
{ name: "_orderId", type: "uint256" },
|
|
571
|
+
{ name: "redactTransId", type: "uint256" }
|
|
572
|
+
],
|
|
573
|
+
outputs: []
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "function",
|
|
577
|
+
name: "paidBuyOrder",
|
|
578
|
+
stateMutability: "nonpayable",
|
|
579
|
+
inputs: [{ name: "_orderId", type: "uint256" }],
|
|
580
|
+
outputs: []
|
|
205
581
|
}
|
|
206
582
|
];
|
|
207
583
|
|
|
@@ -477,11 +853,16 @@ var reputationManagerAbi = [
|
|
|
477
853
|
];
|
|
478
854
|
|
|
479
855
|
// src/contracts/abis/index.ts
|
|
480
|
-
var DIAMOND_ABI = [
|
|
856
|
+
var DIAMOND_ABI = [
|
|
857
|
+
...orderFlowFacetAbi,
|
|
858
|
+
...orderProcessorFacetAbi,
|
|
859
|
+
...p2pConfigFacetAbi
|
|
860
|
+
];
|
|
481
861
|
var ABIS = {
|
|
482
862
|
DIAMOND: DIAMOND_ABI,
|
|
483
863
|
FACETS: {
|
|
484
864
|
ORDER_FLOW: orderFlowFacetAbi,
|
|
865
|
+
ORDER_PROCESSOR: orderProcessorFacetAbi,
|
|
485
866
|
CONFIG: p2pConfigFacetAbi
|
|
486
867
|
},
|
|
487
868
|
EXTERNAL: {
|
|
@@ -636,7 +1017,7 @@ var SOCIAL_PLATFORM_NAMES = {
|
|
|
636
1017
|
|
|
637
1018
|
// src/zkkyc/orchestrators/reclaim.ts
|
|
638
1019
|
var RECLAIM_SESSION_API = "https://api.reclaimprotocol.org/api/sdk/session";
|
|
639
|
-
function createReclaimFlow(
|
|
1020
|
+
function createReclaimFlow(params) {
|
|
640
1021
|
return import_neverthrow3.ResultAsync.fromPromise(
|
|
641
1022
|
(async () => {
|
|
642
1023
|
const mod = await import("@reclaimprotocol/js-sdk").catch(() => {
|
|
@@ -647,6 +1028,9 @@ function createReclaimFlow(config, options) {
|
|
|
647
1028
|
});
|
|
648
1029
|
const { ReclaimProofRequest, transformForOnchain } = mod;
|
|
649
1030
|
const {
|
|
1031
|
+
appId,
|
|
1032
|
+
appSecret,
|
|
1033
|
+
providerIds,
|
|
650
1034
|
platform,
|
|
651
1035
|
walletAddress,
|
|
652
1036
|
redirectUrl,
|
|
@@ -655,19 +1039,16 @@ function createReclaimFlow(config, options) {
|
|
|
655
1039
|
onStatus,
|
|
656
1040
|
signal,
|
|
657
1041
|
pollingIntervalMs = 5e3
|
|
658
|
-
} =
|
|
1042
|
+
} = params;
|
|
659
1043
|
const socialName = SOCIAL_PLATFORM_NAMES[platform];
|
|
660
|
-
const providerId =
|
|
1044
|
+
const providerId = providerIds[platform];
|
|
661
1045
|
let sessionId;
|
|
662
1046
|
if (existingSessionId) {
|
|
663
1047
|
sessionId = existingSessionId;
|
|
664
1048
|
} else {
|
|
665
|
-
const reclaimProofRequest = await ReclaimProofRequest.init(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
providerId,
|
|
669
|
-
{ launchOptions: { canUseDeferredDeepLinksFlow: true } }
|
|
670
|
-
);
|
|
1049
|
+
const reclaimProofRequest = await ReclaimProofRequest.init(appId, appSecret, providerId, {
|
|
1050
|
+
launchOptions: { canUseDeferredDeepLinksFlow: true }
|
|
1051
|
+
});
|
|
671
1052
|
const statusUrl = reclaimProofRequest.getStatusUrl();
|
|
672
1053
|
sessionId = statusUrl.split("/").pop() || "";
|
|
673
1054
|
if (redirectUrl) {
|
|
@@ -741,7 +1122,7 @@ function createReclaimFlow(config, options) {
|
|
|
741
1122
|
|
|
742
1123
|
// src/zkkyc/orchestrators/zk-passport.ts
|
|
743
1124
|
var import_neverthrow4 = require("neverthrow");
|
|
744
|
-
function createZkPassportFlow(
|
|
1125
|
+
function createZkPassportFlow(params) {
|
|
745
1126
|
return import_neverthrow4.ResultAsync.fromPromise(
|
|
746
1127
|
(async () => {
|
|
747
1128
|
const mod = await import("@zkpassport/sdk").catch(() => {
|
|
@@ -751,11 +1132,11 @@ function createZkPassportFlow(config, options) {
|
|
|
751
1132
|
);
|
|
752
1133
|
});
|
|
753
1134
|
const { ZKPassport } = mod;
|
|
754
|
-
const zkPassport = new ZKPassport(
|
|
1135
|
+
const zkPassport = new ZKPassport(params.domain);
|
|
755
1136
|
const queryBuilder = await zkPassport.request({
|
|
756
|
-
name:
|
|
757
|
-
logo:
|
|
758
|
-
purpose:
|
|
1137
|
+
name: params.name ?? "ZKPassport",
|
|
1138
|
+
logo: params.logo,
|
|
1139
|
+
purpose: params.purpose ?? "Prove your personhood",
|
|
759
1140
|
scope: "personhood",
|
|
760
1141
|
mode: "compressed-evm"
|
|
761
1142
|
});
|
|
@@ -767,22 +1148,22 @@ function createZkPassportFlow(config, options) {
|
|
|
767
1148
|
onResult,
|
|
768
1149
|
onReject,
|
|
769
1150
|
onError
|
|
770
|
-
} = queryBuilder.gte("age", 18).disclose("document_type").disclose("nationality").bind("user_address",
|
|
771
|
-
|
|
1151
|
+
} = queryBuilder.gte("age", 18).disclose("document_type").disclose("nationality").bind("user_address", params.walletAddress).done();
|
|
1152
|
+
params.onStatus?.({ type: "request_created", url });
|
|
772
1153
|
let aborted = false;
|
|
773
1154
|
const resultPromise = new Promise((resolve, reject) => {
|
|
774
1155
|
let proof = null;
|
|
775
1156
|
onRequestReceived(() => {
|
|
776
1157
|
if (aborted) return;
|
|
777
|
-
|
|
1158
|
+
params.onStatus?.({ type: "request_received" });
|
|
778
1159
|
});
|
|
779
1160
|
onGeneratingProof(() => {
|
|
780
1161
|
if (aborted) return;
|
|
781
|
-
|
|
1162
|
+
params.onStatus?.({ type: "generating_proof" });
|
|
782
1163
|
});
|
|
783
1164
|
onProofGenerated(async (result) => {
|
|
784
1165
|
if (aborted) return;
|
|
785
|
-
|
|
1166
|
+
params.onStatus?.({ type: "proof_generated" });
|
|
786
1167
|
proof = result;
|
|
787
1168
|
});
|
|
788
1169
|
onResult(
|
|
@@ -792,7 +1173,7 @@ function createZkPassportFlow(config, options) {
|
|
|
792
1173
|
verified
|
|
793
1174
|
}) => {
|
|
794
1175
|
if (aborted) return;
|
|
795
|
-
|
|
1176
|
+
params.onStatus?.({ type: "result_received" });
|
|
796
1177
|
if (!verified || !proof || !uniqueIdentifier) {
|
|
797
1178
|
reject(
|
|
798
1179
|
new ZkkycError("ZK Passport verification failed", {
|
|
@@ -820,7 +1201,7 @@ function createZkPassportFlow(config, options) {
|
|
|
820
1201
|
}
|
|
821
1202
|
);
|
|
822
1203
|
onReject(() => {
|
|
823
|
-
|
|
1204
|
+
params.onStatus?.({ type: "rejected" });
|
|
824
1205
|
reject(
|
|
825
1206
|
new ZkkycError("User rejected ZK Passport verification", {
|
|
826
1207
|
code: "ZK_PASSPORT_REJECTED"
|