@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.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { err, ok } from "neverthrow";
|
|
|
21
21
|
import { isAddress } from "viem";
|
|
22
22
|
import { z } from "zod";
|
|
23
23
|
|
|
24
|
-
// src/
|
|
24
|
+
// src/country/currency.ts
|
|
25
25
|
var CURRENCY = {
|
|
26
26
|
IDR: "IDR",
|
|
27
27
|
INR: "INR",
|
|
@@ -34,10 +34,11 @@ var CURRENCY = {
|
|
|
34
34
|
USD: "USD",
|
|
35
35
|
COP: "COP"
|
|
36
36
|
};
|
|
37
|
+
var CURRENCY_CODES = Object.values(CURRENCY);
|
|
37
38
|
|
|
38
39
|
// src/validation/schemas.validation.ts
|
|
39
40
|
var ZodAddressSchema = z.string().refine((s) => isAddress(s), { message: "Invalid Ethereum address" });
|
|
40
|
-
var ZodCurrencySchema = z.enum(
|
|
41
|
+
var ZodCurrencySchema = z.enum(CURRENCY_CODES);
|
|
41
42
|
function validate(schema, data, toError) {
|
|
42
43
|
const result = schema.safeParse(data);
|
|
43
44
|
if (result.success) {
|
|
@@ -159,6 +160,381 @@ var orderFlowFacetAbi = [
|
|
|
159
160
|
],
|
|
160
161
|
stateMutability: "view",
|
|
161
162
|
type: "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
inputs: [
|
|
166
|
+
{ internalType: "string", name: "_pubKey", type: "string" },
|
|
167
|
+
{ internalType: "uint256", name: "_amount", type: "uint256" },
|
|
168
|
+
{ internalType: "address", name: "_recipientAddr", type: "address" },
|
|
169
|
+
{ internalType: "uint8", name: "_orderType", type: "uint8" },
|
|
170
|
+
{ internalType: "string", name: "_userUpi", type: "string" },
|
|
171
|
+
{ internalType: "string", name: "_userPubKey", type: "string" },
|
|
172
|
+
{ internalType: "bytes32", name: "_currency", type: "bytes32" },
|
|
173
|
+
{ internalType: "uint256", name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
174
|
+
{ internalType: "uint256", name: "_circleId", type: "uint256" },
|
|
175
|
+
{ internalType: "uint256", name: "_fiatAmountLimit", type: "uint256" }
|
|
176
|
+
],
|
|
177
|
+
name: "placeOrder",
|
|
178
|
+
outputs: [],
|
|
179
|
+
stateMutability: "nonpayable",
|
|
180
|
+
type: "function"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
inputs: [{ internalType: "uint256", name: "_orderId", type: "uint256" }],
|
|
184
|
+
name: "cancelOrder",
|
|
185
|
+
outputs: [],
|
|
186
|
+
stateMutability: "nonpayable",
|
|
187
|
+
type: "function"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
inputs: [
|
|
191
|
+
{ internalType: "uint256", name: "_orderId", type: "uint256" },
|
|
192
|
+
{ internalType: "string", name: "_userEncUpi", type: "string" },
|
|
193
|
+
{ internalType: "uint256", name: "_updatedAmount", type: "uint256" }
|
|
194
|
+
],
|
|
195
|
+
name: "setSellOrderUpi",
|
|
196
|
+
outputs: [],
|
|
197
|
+
stateMutability: "nonpayable",
|
|
198
|
+
type: "function"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "event",
|
|
202
|
+
name: "OrderPlaced",
|
|
203
|
+
anonymous: false,
|
|
204
|
+
inputs: [
|
|
205
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
206
|
+
{ indexed: true, name: "user", type: "address" },
|
|
207
|
+
{ indexed: true, name: "merchant", type: "address" },
|
|
208
|
+
{ indexed: false, name: "amount", type: "uint256" },
|
|
209
|
+
{ indexed: false, name: "orderType", type: "uint8" },
|
|
210
|
+
{ indexed: false, name: "placedTimestamp", type: "uint256" },
|
|
211
|
+
{
|
|
212
|
+
indexed: false,
|
|
213
|
+
name: "_order",
|
|
214
|
+
type: "tuple",
|
|
215
|
+
components: [
|
|
216
|
+
{ name: "amount", type: "uint256" },
|
|
217
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
218
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
219
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
220
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
221
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
222
|
+
{ name: "user", type: "address" },
|
|
223
|
+
{ name: "recipientAddr", type: "address" },
|
|
224
|
+
{ name: "pubkey", type: "string" },
|
|
225
|
+
{ name: "encUpi", type: "string" },
|
|
226
|
+
{ name: "userCompleted", type: "bool" },
|
|
227
|
+
{ name: "status", type: "uint8" },
|
|
228
|
+
{ name: "orderType", type: "uint8" },
|
|
229
|
+
{
|
|
230
|
+
name: "disputeInfo",
|
|
231
|
+
type: "tuple",
|
|
232
|
+
components: [
|
|
233
|
+
{ name: "raisedBy", type: "uint8" },
|
|
234
|
+
{ name: "status", type: "uint8" },
|
|
235
|
+
{ name: "redactTransId", type: "uint256" },
|
|
236
|
+
{ name: "accountNumber", type: "uint256" }
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{ name: "id", type: "uint256" },
|
|
240
|
+
{ name: "userPubKey", type: "string" },
|
|
241
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
242
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
243
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
244
|
+
{ name: "currency", type: "bytes32" },
|
|
245
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
246
|
+
{ name: "circleId", type: "uint256" }
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
type: "event",
|
|
253
|
+
name: "OrderAccepted",
|
|
254
|
+
anonymous: false,
|
|
255
|
+
inputs: [
|
|
256
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
257
|
+
{ indexed: true, name: "merchant", type: "address" },
|
|
258
|
+
{ indexed: false, name: "pubKey", type: "string" },
|
|
259
|
+
{
|
|
260
|
+
indexed: false,
|
|
261
|
+
name: "_order",
|
|
262
|
+
type: "tuple",
|
|
263
|
+
components: [
|
|
264
|
+
{ name: "amount", type: "uint256" },
|
|
265
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
266
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
267
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
268
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
269
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
270
|
+
{ name: "user", type: "address" },
|
|
271
|
+
{ name: "recipientAddr", type: "address" },
|
|
272
|
+
{ name: "pubkey", type: "string" },
|
|
273
|
+
{ name: "encUpi", type: "string" },
|
|
274
|
+
{ name: "userCompleted", type: "bool" },
|
|
275
|
+
{ name: "status", type: "uint8" },
|
|
276
|
+
{ name: "orderType", type: "uint8" },
|
|
277
|
+
{
|
|
278
|
+
name: "disputeInfo",
|
|
279
|
+
type: "tuple",
|
|
280
|
+
components: [
|
|
281
|
+
{ name: "raisedBy", type: "uint8" },
|
|
282
|
+
{ name: "status", type: "uint8" },
|
|
283
|
+
{ name: "redactTransId", type: "uint256" },
|
|
284
|
+
{ name: "accountNumber", type: "uint256" }
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{ name: "id", type: "uint256" },
|
|
288
|
+
{ name: "userPubKey", type: "string" },
|
|
289
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
290
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
291
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
292
|
+
{ name: "currency", type: "bytes32" },
|
|
293
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
294
|
+
{ name: "circleId", type: "uint256" }
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
type: "event",
|
|
301
|
+
name: "BuyOrderPaid",
|
|
302
|
+
anonymous: false,
|
|
303
|
+
inputs: [
|
|
304
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
305
|
+
{ indexed: true, name: "user", type: "address" },
|
|
306
|
+
{
|
|
307
|
+
indexed: false,
|
|
308
|
+
name: "_order",
|
|
309
|
+
type: "tuple",
|
|
310
|
+
components: [
|
|
311
|
+
{ name: "amount", type: "uint256" },
|
|
312
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
313
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
314
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
315
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
316
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
317
|
+
{ name: "user", type: "address" },
|
|
318
|
+
{ name: "recipientAddr", type: "address" },
|
|
319
|
+
{ name: "pubkey", type: "string" },
|
|
320
|
+
{ name: "encUpi", type: "string" },
|
|
321
|
+
{ name: "userCompleted", type: "bool" },
|
|
322
|
+
{ name: "status", type: "uint8" },
|
|
323
|
+
{ name: "orderType", type: "uint8" },
|
|
324
|
+
{
|
|
325
|
+
name: "disputeInfo",
|
|
326
|
+
type: "tuple",
|
|
327
|
+
components: [
|
|
328
|
+
{ name: "raisedBy", type: "uint8" },
|
|
329
|
+
{ name: "status", type: "uint8" },
|
|
330
|
+
{ name: "redactTransId", type: "uint256" },
|
|
331
|
+
{ name: "accountNumber", type: "uint256" }
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
{ name: "id", type: "uint256" },
|
|
335
|
+
{ name: "userPubKey", type: "string" },
|
|
336
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
337
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
338
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
339
|
+
{ name: "currency", type: "bytes32" },
|
|
340
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
341
|
+
{ name: "circleId", type: "uint256" }
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
type: "event",
|
|
348
|
+
name: "OrderCompleted",
|
|
349
|
+
anonymous: false,
|
|
350
|
+
inputs: [
|
|
351
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
352
|
+
{ indexed: true, name: "user", type: "address" },
|
|
353
|
+
{ indexed: false, name: "completedTimestamp", type: "uint256" },
|
|
354
|
+
{
|
|
355
|
+
indexed: false,
|
|
356
|
+
name: "_order",
|
|
357
|
+
type: "tuple",
|
|
358
|
+
components: [
|
|
359
|
+
{ name: "amount", type: "uint256" },
|
|
360
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
361
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
362
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
363
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
364
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
365
|
+
{ name: "user", type: "address" },
|
|
366
|
+
{ name: "recipientAddr", type: "address" },
|
|
367
|
+
{ name: "pubkey", type: "string" },
|
|
368
|
+
{ name: "encUpi", type: "string" },
|
|
369
|
+
{ name: "userCompleted", type: "bool" },
|
|
370
|
+
{ name: "status", type: "uint8" },
|
|
371
|
+
{ name: "orderType", type: "uint8" },
|
|
372
|
+
{
|
|
373
|
+
name: "disputeInfo",
|
|
374
|
+
type: "tuple",
|
|
375
|
+
components: [
|
|
376
|
+
{ name: "raisedBy", type: "uint8" },
|
|
377
|
+
{ name: "status", type: "uint8" },
|
|
378
|
+
{ name: "redactTransId", type: "uint256" },
|
|
379
|
+
{ name: "accountNumber", type: "uint256" }
|
|
380
|
+
]
|
|
381
|
+
},
|
|
382
|
+
{ name: "id", type: "uint256" },
|
|
383
|
+
{ name: "userPubKey", type: "string" },
|
|
384
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
385
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
386
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
387
|
+
{ name: "currency", type: "bytes32" },
|
|
388
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
389
|
+
{ name: "circleId", type: "uint256" }
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
type: "event",
|
|
396
|
+
name: "CancelledOrders",
|
|
397
|
+
anonymous: false,
|
|
398
|
+
inputs: [
|
|
399
|
+
{ indexed: true, name: "orderId", type: "uint256" },
|
|
400
|
+
{
|
|
401
|
+
indexed: false,
|
|
402
|
+
name: "_order",
|
|
403
|
+
type: "tuple",
|
|
404
|
+
components: [
|
|
405
|
+
{ name: "amount", type: "uint256" },
|
|
406
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
407
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
408
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
409
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
410
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
411
|
+
{ name: "user", type: "address" },
|
|
412
|
+
{ name: "recipientAddr", type: "address" },
|
|
413
|
+
{ name: "pubkey", type: "string" },
|
|
414
|
+
{ name: "encUpi", type: "string" },
|
|
415
|
+
{ name: "userCompleted", type: "bool" },
|
|
416
|
+
{ name: "status", type: "uint8" },
|
|
417
|
+
{ name: "orderType", type: "uint8" },
|
|
418
|
+
{
|
|
419
|
+
name: "disputeInfo",
|
|
420
|
+
type: "tuple",
|
|
421
|
+
components: [
|
|
422
|
+
{ name: "raisedBy", type: "uint8" },
|
|
423
|
+
{ name: "status", type: "uint8" },
|
|
424
|
+
{ name: "redactTransId", type: "uint256" },
|
|
425
|
+
{ name: "accountNumber", type: "uint256" }
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
{ name: "id", type: "uint256" },
|
|
429
|
+
{ name: "userPubKey", type: "string" },
|
|
430
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
431
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
432
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
433
|
+
{ name: "currency", type: "bytes32" },
|
|
434
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
435
|
+
{ name: "circleId", type: "uint256" }
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
];
|
|
441
|
+
|
|
442
|
+
// src/contracts/abis/order-processor-facet.ts
|
|
443
|
+
var orderProcessorFacetAbi = [
|
|
444
|
+
{
|
|
445
|
+
type: "function",
|
|
446
|
+
name: "getOrdersById",
|
|
447
|
+
stateMutability: "view",
|
|
448
|
+
inputs: [{ name: "orderId", type: "uint256" }],
|
|
449
|
+
outputs: [
|
|
450
|
+
{
|
|
451
|
+
type: "tuple",
|
|
452
|
+
components: [
|
|
453
|
+
{ name: "amount", type: "uint256" },
|
|
454
|
+
{ name: "fiatAmount", type: "uint256" },
|
|
455
|
+
{ name: "placedTimestamp", type: "uint256" },
|
|
456
|
+
{ name: "completedTimestamp", type: "uint256" },
|
|
457
|
+
{ name: "userCompletedTimestamp", type: "uint256" },
|
|
458
|
+
{ name: "acceptedMerchant", type: "address" },
|
|
459
|
+
{ name: "user", type: "address" },
|
|
460
|
+
{ name: "recipientAddr", type: "address" },
|
|
461
|
+
{ name: "pubkey", type: "string" },
|
|
462
|
+
{ name: "encUpi", type: "string" },
|
|
463
|
+
{ name: "userCompleted", type: "bool" },
|
|
464
|
+
{ name: "status", type: "uint8" },
|
|
465
|
+
{ name: "orderType", type: "uint8" },
|
|
466
|
+
{
|
|
467
|
+
name: "disputeInfo",
|
|
468
|
+
type: "tuple",
|
|
469
|
+
components: [
|
|
470
|
+
{ name: "raisedBy", type: "uint8" },
|
|
471
|
+
{ name: "status", type: "uint8" },
|
|
472
|
+
{ name: "redactTransId", type: "uint256" },
|
|
473
|
+
{ name: "accountNumber", type: "uint256" }
|
|
474
|
+
]
|
|
475
|
+
},
|
|
476
|
+
{ name: "id", type: "uint256" },
|
|
477
|
+
{ name: "userPubKey", type: "string" },
|
|
478
|
+
{ name: "encMerchantUpi", type: "string" },
|
|
479
|
+
{ name: "acceptedAccountNo", type: "uint256" },
|
|
480
|
+
{ name: "assignedAccountNos", type: "uint256[]" },
|
|
481
|
+
{ name: "currency", type: "bytes32" },
|
|
482
|
+
{ name: "preferredPaymentChannelConfigId", type: "uint256" },
|
|
483
|
+
{ name: "circleId", type: "uint256" }
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
type: "function",
|
|
490
|
+
name: "getAdditionalOrderDetails",
|
|
491
|
+
stateMutability: "view",
|
|
492
|
+
inputs: [{ name: "orderId", type: "uint256" }],
|
|
493
|
+
outputs: [
|
|
494
|
+
{
|
|
495
|
+
type: "tuple",
|
|
496
|
+
components: [
|
|
497
|
+
{ name: "fixedFeePaid", type: "uint64" },
|
|
498
|
+
{ name: "tipsPaid", type: "uint64" },
|
|
499
|
+
{ name: "acceptedTimestamp", type: "uint128" },
|
|
500
|
+
{ name: "paidTimestamp", type: "uint128" },
|
|
501
|
+
{ name: "reserved2", type: "uint128" },
|
|
502
|
+
{ name: "actualUsdtAmount", type: "uint256" },
|
|
503
|
+
{ name: "actualFiatAmount", type: "uint256" }
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
]
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
type: "function",
|
|
510
|
+
name: "getSmallOrderThreshold",
|
|
511
|
+
stateMutability: "view",
|
|
512
|
+
inputs: [{ name: "currency", type: "bytes32" }],
|
|
513
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
type: "function",
|
|
517
|
+
name: "getSmallOrderFixedFee",
|
|
518
|
+
stateMutability: "view",
|
|
519
|
+
inputs: [{ name: "currency", type: "bytes32" }],
|
|
520
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
type: "function",
|
|
524
|
+
name: "raiseDispute",
|
|
525
|
+
stateMutability: "nonpayable",
|
|
526
|
+
inputs: [
|
|
527
|
+
{ name: "_orderId", type: "uint256" },
|
|
528
|
+
{ name: "redactTransId", type: "uint256" }
|
|
529
|
+
],
|
|
530
|
+
outputs: []
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
type: "function",
|
|
534
|
+
name: "paidBuyOrder",
|
|
535
|
+
stateMutability: "nonpayable",
|
|
536
|
+
inputs: [{ name: "_orderId", type: "uint256" }],
|
|
537
|
+
outputs: []
|
|
162
538
|
}
|
|
163
539
|
];
|
|
164
540
|
|
|
@@ -434,11 +810,16 @@ var reputationManagerAbi = [
|
|
|
434
810
|
];
|
|
435
811
|
|
|
436
812
|
// src/contracts/abis/index.ts
|
|
437
|
-
var DIAMOND_ABI = [
|
|
813
|
+
var DIAMOND_ABI = [
|
|
814
|
+
...orderFlowFacetAbi,
|
|
815
|
+
...orderProcessorFacetAbi,
|
|
816
|
+
...p2pConfigFacetAbi
|
|
817
|
+
];
|
|
438
818
|
var ABIS = {
|
|
439
819
|
DIAMOND: DIAMOND_ABI,
|
|
440
820
|
FACETS: {
|
|
441
821
|
ORDER_FLOW: orderFlowFacetAbi,
|
|
822
|
+
ORDER_PROCESSOR: orderProcessorFacetAbi,
|
|
442
823
|
CONFIG: p2pConfigFacetAbi
|
|
443
824
|
},
|
|
444
825
|
EXTERNAL: {
|
|
@@ -593,7 +974,7 @@ var SOCIAL_PLATFORM_NAMES = {
|
|
|
593
974
|
|
|
594
975
|
// src/zkkyc/orchestrators/reclaim.ts
|
|
595
976
|
var RECLAIM_SESSION_API = "https://api.reclaimprotocol.org/api/sdk/session";
|
|
596
|
-
function createReclaimFlow(
|
|
977
|
+
function createReclaimFlow(params) {
|
|
597
978
|
return ResultAsync.fromPromise(
|
|
598
979
|
(async () => {
|
|
599
980
|
const mod = await import("@reclaimprotocol/js-sdk").catch(() => {
|
|
@@ -604,6 +985,9 @@ function createReclaimFlow(config, options) {
|
|
|
604
985
|
});
|
|
605
986
|
const { ReclaimProofRequest, transformForOnchain } = mod;
|
|
606
987
|
const {
|
|
988
|
+
appId,
|
|
989
|
+
appSecret,
|
|
990
|
+
providerIds,
|
|
607
991
|
platform,
|
|
608
992
|
walletAddress,
|
|
609
993
|
redirectUrl,
|
|
@@ -612,19 +996,16 @@ function createReclaimFlow(config, options) {
|
|
|
612
996
|
onStatus,
|
|
613
997
|
signal,
|
|
614
998
|
pollingIntervalMs = 5e3
|
|
615
|
-
} =
|
|
999
|
+
} = params;
|
|
616
1000
|
const socialName = SOCIAL_PLATFORM_NAMES[platform];
|
|
617
|
-
const providerId =
|
|
1001
|
+
const providerId = providerIds[platform];
|
|
618
1002
|
let sessionId;
|
|
619
1003
|
if (existingSessionId) {
|
|
620
1004
|
sessionId = existingSessionId;
|
|
621
1005
|
} else {
|
|
622
|
-
const reclaimProofRequest = await ReclaimProofRequest.init(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
providerId,
|
|
626
|
-
{ launchOptions: { canUseDeferredDeepLinksFlow: true } }
|
|
627
|
-
);
|
|
1006
|
+
const reclaimProofRequest = await ReclaimProofRequest.init(appId, appSecret, providerId, {
|
|
1007
|
+
launchOptions: { canUseDeferredDeepLinksFlow: true }
|
|
1008
|
+
});
|
|
628
1009
|
const statusUrl = reclaimProofRequest.getStatusUrl();
|
|
629
1010
|
sessionId = statusUrl.split("/").pop() || "";
|
|
630
1011
|
if (redirectUrl) {
|
|
@@ -698,7 +1079,7 @@ function createReclaimFlow(config, options) {
|
|
|
698
1079
|
|
|
699
1080
|
// src/zkkyc/orchestrators/zk-passport.ts
|
|
700
1081
|
import { ResultAsync as ResultAsync2 } from "neverthrow";
|
|
701
|
-
function createZkPassportFlow(
|
|
1082
|
+
function createZkPassportFlow(params) {
|
|
702
1083
|
return ResultAsync2.fromPromise(
|
|
703
1084
|
(async () => {
|
|
704
1085
|
const mod = await import("@zkpassport/sdk").catch(() => {
|
|
@@ -708,11 +1089,11 @@ function createZkPassportFlow(config, options) {
|
|
|
708
1089
|
);
|
|
709
1090
|
});
|
|
710
1091
|
const { ZKPassport } = mod;
|
|
711
|
-
const zkPassport = new ZKPassport(
|
|
1092
|
+
const zkPassport = new ZKPassport(params.domain);
|
|
712
1093
|
const queryBuilder = await zkPassport.request({
|
|
713
|
-
name:
|
|
714
|
-
logo:
|
|
715
|
-
purpose:
|
|
1094
|
+
name: params.name ?? "ZKPassport",
|
|
1095
|
+
logo: params.logo,
|
|
1096
|
+
purpose: params.purpose ?? "Prove your personhood",
|
|
716
1097
|
scope: "personhood",
|
|
717
1098
|
mode: "compressed-evm"
|
|
718
1099
|
});
|
|
@@ -724,22 +1105,22 @@ function createZkPassportFlow(config, options) {
|
|
|
724
1105
|
onResult,
|
|
725
1106
|
onReject,
|
|
726
1107
|
onError
|
|
727
|
-
} = queryBuilder.gte("age", 18).disclose("document_type").disclose("nationality").bind("user_address",
|
|
728
|
-
|
|
1108
|
+
} = queryBuilder.gte("age", 18).disclose("document_type").disclose("nationality").bind("user_address", params.walletAddress).done();
|
|
1109
|
+
params.onStatus?.({ type: "request_created", url });
|
|
729
1110
|
let aborted = false;
|
|
730
1111
|
const resultPromise = new Promise((resolve, reject) => {
|
|
731
1112
|
let proof = null;
|
|
732
1113
|
onRequestReceived(() => {
|
|
733
1114
|
if (aborted) return;
|
|
734
|
-
|
|
1115
|
+
params.onStatus?.({ type: "request_received" });
|
|
735
1116
|
});
|
|
736
1117
|
onGeneratingProof(() => {
|
|
737
1118
|
if (aborted) return;
|
|
738
|
-
|
|
1119
|
+
params.onStatus?.({ type: "generating_proof" });
|
|
739
1120
|
});
|
|
740
1121
|
onProofGenerated(async (result) => {
|
|
741
1122
|
if (aborted) return;
|
|
742
|
-
|
|
1123
|
+
params.onStatus?.({ type: "proof_generated" });
|
|
743
1124
|
proof = result;
|
|
744
1125
|
});
|
|
745
1126
|
onResult(
|
|
@@ -749,7 +1130,7 @@ function createZkPassportFlow(config, options) {
|
|
|
749
1130
|
verified
|
|
750
1131
|
}) => {
|
|
751
1132
|
if (aborted) return;
|
|
752
|
-
|
|
1133
|
+
params.onStatus?.({ type: "result_received" });
|
|
753
1134
|
if (!verified || !proof || !uniqueIdentifier) {
|
|
754
1135
|
reject(
|
|
755
1136
|
new ZkkycError("ZK Passport verification failed", {
|
|
@@ -777,7 +1158,7 @@ function createZkPassportFlow(config, options) {
|
|
|
777
1158
|
}
|
|
778
1159
|
);
|
|
779
1160
|
onReject(() => {
|
|
780
|
-
|
|
1161
|
+
params.onStatus?.({ type: "rejected" });
|
|
781
1162
|
reject(
|
|
782
1163
|
new ZkkycError("User rejected ZK Passport verification", {
|
|
783
1164
|
code: "ZK_PASSPORT_REJECTED"
|