@zkp2p/sdk 0.0.8 → 0.0.10
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 +42 -37
- package/dist/{Zkp2pClient-w5Pzlea6.d.mts → Zkp2pClient-tpqzO2dc.d.mts} +4 -0
- package/dist/{Zkp2pClient-w5Pzlea6.d.ts → Zkp2pClient-tpqzO2dc.d.ts} +4 -0
- package/dist/{chunk-NRU6Z6WS.mjs → chunk-34DVWMT5.mjs} +4 -4
- package/dist/{chunk-NRU6Z6WS.mjs.map → chunk-34DVWMT5.mjs.map} +1 -1
- package/dist/chunk-37HJPVJE.mjs +11 -0
- package/dist/chunk-37HJPVJE.mjs.map +1 -0
- package/dist/{chunk-MWFONYDJ.mjs → chunk-37YHT3UF.mjs} +5 -4
- package/dist/chunk-37YHT3UF.mjs.map +1 -0
- package/dist/{chunk-LZJL5J5X.mjs → chunk-MDLTLKWK.mjs} +3 -3
- package/dist/chunk-MDLTLKWK.mjs.map +1 -0
- package/dist/{constants-S277YHME.mjs → constants-BBJQLAU3.mjs} +4 -5
- package/dist/{constants-S277YHME.mjs.map → constants-BBJQLAU3.mjs.map} +1 -1
- package/dist/currency-P4HY7S34.mjs +4 -0
- package/dist/{currency-NTRIKAOH.mjs.map → currency-P4HY7S34.mjs.map} +1 -1
- package/dist/index.cjs +49 -2273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +58 -40
- package/dist/index.mjs.map +1 -1
- package/dist/paymentResolution-UPQTQCCC.mjs +4 -0
- package/dist/{paymentResolution-WNXTUSNH.mjs.map → paymentResolution-UPQTQCCC.mjs.map} +1 -1
- package/dist/protocolViewerParsers-MUTCT3IW.mjs +6 -0
- package/dist/{protocolViewerParsers-FCIK2ZTT.mjs.map → protocolViewerParsers-MUTCT3IW.mjs.map} +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{timeout-7HCFGU6P.mjs → timeout-QB7K5SOB.mjs} +2 -3
- package/dist/timeout-QB7K5SOB.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-3QS3WKRC.mjs +0 -29
- package/dist/chunk-3QS3WKRC.mjs.map +0 -1
- package/dist/chunk-J34QNX2H.mjs +0 -196
- package/dist/chunk-J34QNX2H.mjs.map +0 -1
- package/dist/chunk-LZJL5J5X.mjs.map +0 -1
- package/dist/chunk-MWFONYDJ.mjs.map +0 -1
- package/dist/currency-NTRIKAOH.mjs +0 -5
- package/dist/paymentResolution-WNXTUSNH.mjs +0 -5
- package/dist/protocolViewerParsers-FCIK2ZTT.mjs +0 -7
- package/dist/timeout-7HCFGU6P.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -21,10 +21,10 @@ var basePaymentMethodsRaw = require('@zkp2p/contracts-v2/paymentMethods/base.jso
|
|
|
21
21
|
var baseSepoliaPaymentMethodsRaw = require('@zkp2p/contracts-v2/paymentMethods/baseSepolia.json');
|
|
22
22
|
var baseStagingPaymentMethodsRaw = require('@zkp2p/contracts-v2/paymentMethods/baseStaging.json');
|
|
23
23
|
var viem = require('viem');
|
|
24
|
-
var ethers = require('ethers');
|
|
25
24
|
var baseSepoliaPaymentMethods2 = require('@zkp2p/contracts-v2/paymentMethods/baseSepolia');
|
|
26
25
|
var baseStagingPaymentMethods2 = require('@zkp2p/contracts-v2/paymentMethods/baseStaging');
|
|
27
26
|
var chains = require('viem/chains');
|
|
27
|
+
var ethers = require('ethers');
|
|
28
28
|
var erc8021 = require('ox/erc8021');
|
|
29
29
|
|
|
30
30
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -52,38 +52,15 @@ var baseStagingPaymentMethodsRaw__default = /*#__PURE__*/_interopDefault(baseSta
|
|
|
52
52
|
var baseSepoliaPaymentMethods2__default = /*#__PURE__*/_interopDefault(baseSepoliaPaymentMethods2);
|
|
53
53
|
var baseStagingPaymentMethods2__default = /*#__PURE__*/_interopDefault(baseStagingPaymentMethods2);
|
|
54
54
|
|
|
55
|
-
var __create = Object.create;
|
|
56
55
|
var __defProp = Object.defineProperty;
|
|
57
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
58
56
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
59
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
60
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
61
57
|
var __esm = (fn, res) => function __init() {
|
|
62
58
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
63
59
|
};
|
|
64
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
65
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
66
|
-
};
|
|
67
60
|
var __export = (target, all) => {
|
|
68
61
|
for (var name in all)
|
|
69
62
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
70
63
|
};
|
|
71
|
-
var __copyProps = (to, from, except, desc) => {
|
|
72
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
73
|
-
for (let key of __getOwnPropNames(from))
|
|
74
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
75
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
76
|
-
}
|
|
77
|
-
return to;
|
|
78
|
-
};
|
|
79
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
80
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
81
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
82
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
83
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
84
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
85
|
-
mod
|
|
86
|
-
));
|
|
87
64
|
function unwrapAddresses(mod) {
|
|
88
65
|
if (!mod) return {};
|
|
89
66
|
const m = mod;
|
|
@@ -298,7 +275,8 @@ function ensureBytes32(value, { hashIfAscii = false } = {}) {
|
|
|
298
275
|
if (bytes.length !== 32) throw new Error("Expected 32-byte hex value");
|
|
299
276
|
return value;
|
|
300
277
|
}
|
|
301
|
-
if (!hashIfAscii)
|
|
278
|
+
if (!hashIfAscii)
|
|
279
|
+
throw new Error("Expected 32-byte hex; received ascii string. Pass hashIfAscii=true to hash.");
|
|
302
280
|
const hashed = viem.keccak256(viem.toBytes(value));
|
|
303
281
|
return hashed;
|
|
304
282
|
}
|
|
@@ -313,2234 +291,13 @@ var init_bytes32 = __esm({
|
|
|
313
291
|
"src/utils/bytes32.ts"() {
|
|
314
292
|
}
|
|
315
293
|
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
"../../node_modules/.pnpm/canonicalize@2.1.0/node_modules/canonicalize/lib/canonicalize.js"(exports$1, module) {
|
|
320
|
-
module.exports = function serialize(object) {
|
|
321
|
-
if (typeof object === "number" && isNaN(object)) {
|
|
322
|
-
throw new Error("NaN is not allowed");
|
|
323
|
-
}
|
|
324
|
-
if (typeof object === "number" && !isFinite(object)) {
|
|
325
|
-
throw new Error("Infinity is not allowed");
|
|
326
|
-
}
|
|
327
|
-
if (object === null || typeof object !== "object") {
|
|
328
|
-
return JSON.stringify(object);
|
|
329
|
-
}
|
|
330
|
-
if (object.toJSON instanceof Function) {
|
|
331
|
-
return serialize(object.toJSON());
|
|
332
|
-
}
|
|
333
|
-
if (Array.isArray(object)) {
|
|
334
|
-
const values2 = object.reduce((t, cv, ci) => {
|
|
335
|
-
const comma = ci === 0 ? "" : ",";
|
|
336
|
-
const value = cv === void 0 || typeof cv === "symbol" ? null : cv;
|
|
337
|
-
return `${t}${comma}${serialize(value)}`;
|
|
338
|
-
}, "");
|
|
339
|
-
return `[${values2}]`;
|
|
340
|
-
}
|
|
341
|
-
const values = Object.keys(object).sort().reduce((t, cv) => {
|
|
342
|
-
if (object[cv] === void 0 || typeof object[cv] === "symbol") {
|
|
343
|
-
return t;
|
|
344
|
-
}
|
|
345
|
-
const comma = t.length === 0 ? "" : ",";
|
|
346
|
-
return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;
|
|
347
|
-
}, "");
|
|
348
|
-
return `{${values}}`;
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
var usdcUnits, currencyKeccak256, Currency, currencyInfo, PaymentPlatform, venmoSendConfig, venmoVerifyConfig, venmoDepositConfig, venmoConfig, cashappSendConfig, cashappVerifyConfig, cashappDepositConfig, cashappConfig, chimeSendConfig, readChimeMetadataValue, formatChimeAmount, parseChimeDate, parseChimeMetadataFields, chimeVerifyConfig, chimeDepositConfig, chimeConfig, getMinorDigits, formatMajorAmountFromMinor, revolutSendConfig, revolutVerifyConfig, revolutDepositConfig, revolutConfig, getMinorDigits2, formatMajorAmountFromMinor2, wiseSendConfig, wiseVerifyConfig, wiseDepositConfig, wiseConfig, mercadoPagoSendConfig, mercadoPagoVerifyConfig, mercadoPagoDepositConfig, mercadoPagoConfig, encodeZelleRecipientId, zelleBankOfAmericaSendConfig, zelleBankOfAmericaVerifyConfig, zelleChaseSendConfig, zelleChaseVerifyConfig, zelleCitiSendConfig, zelleCitiVerifyConfig, zelleDepositConfig, zelleConfig, paypalSendConfig, paypalVerifyConfig, paypalDepositConfig, paypalConfig, monzoSendConfig, monzoVerifyConfig, monzoDepositConfig, monzoConfig, formatAmountFromCents, n26SendConfig, n26VerifyConfig, n26DepositConfig, n26Config, decodeUnicodeEscapes, parseAlipayAmount, parseAlipayDate, alipaySendConfig, alipayVerifyConfig, alipayDepositConfig, alipayConfig, METHOD_NAME_TO_HASH;
|
|
353
|
-
var init_utils = __esm({
|
|
354
|
-
"../core/dist/utils/index.js"() {
|
|
355
|
-
__toESM(require_canonicalize());
|
|
356
|
-
usdcUnits = (amount) => {
|
|
357
|
-
return viem.parseUnits(amount.toString(), 6);
|
|
358
|
-
};
|
|
294
|
+
var currencyKeccak256;
|
|
295
|
+
var init_currencyKeccak256 = __esm({
|
|
296
|
+
"src/utils/currencyKeccak256.ts"() {
|
|
359
297
|
currencyKeccak256 = (inputString) => {
|
|
360
298
|
const bytes = new TextEncoder().encode(inputString);
|
|
361
299
|
return viem.keccak256(bytes);
|
|
362
300
|
};
|
|
363
|
-
Currency = {
|
|
364
|
-
AED: "AED",
|
|
365
|
-
ARS: "ARS",
|
|
366
|
-
AUD: "AUD",
|
|
367
|
-
CAD: "CAD",
|
|
368
|
-
CHF: "CHF",
|
|
369
|
-
CNY: "CNY",
|
|
370
|
-
CZK: "CZK",
|
|
371
|
-
DKK: "DKK",
|
|
372
|
-
EUR: "EUR",
|
|
373
|
-
GBP: "GBP",
|
|
374
|
-
HKD: "HKD",
|
|
375
|
-
HUF: "HUF",
|
|
376
|
-
IDR: "IDR",
|
|
377
|
-
ILS: "ILS",
|
|
378
|
-
INR: "INR",
|
|
379
|
-
JPY: "JPY",
|
|
380
|
-
KES: "KES",
|
|
381
|
-
NOK: "NOK",
|
|
382
|
-
MXN: "MXN",
|
|
383
|
-
MYR: "MYR",
|
|
384
|
-
NZD: "NZD",
|
|
385
|
-
PHP: "PHP",
|
|
386
|
-
PLN: "PLN",
|
|
387
|
-
RON: "RON",
|
|
388
|
-
SAR: "SAR",
|
|
389
|
-
SEK: "SEK",
|
|
390
|
-
SGD: "SGD",
|
|
391
|
-
THB: "THB",
|
|
392
|
-
TRY: "TRY",
|
|
393
|
-
UGX: "UGX",
|
|
394
|
-
USD: "USD",
|
|
395
|
-
VND: "VND",
|
|
396
|
-
ZAR: "ZAR"
|
|
397
|
-
};
|
|
398
|
-
currencyInfo = {
|
|
399
|
-
[Currency.AED]: {
|
|
400
|
-
currency: Currency.AED,
|
|
401
|
-
currencyCode: "AED",
|
|
402
|
-
currencyName: "United Arab Emirates Dirham",
|
|
403
|
-
currencyCodeHash: currencyKeccak256("AED"),
|
|
404
|
-
currencySymbol: "\u062F.\u0625",
|
|
405
|
-
countryCode: "ae"
|
|
406
|
-
},
|
|
407
|
-
[Currency.ARS]: {
|
|
408
|
-
currency: Currency.ARS,
|
|
409
|
-
currencyCode: "ARS",
|
|
410
|
-
currencyName: "Argentine Peso",
|
|
411
|
-
currencyCodeHash: currencyKeccak256("ARS"),
|
|
412
|
-
currencySymbol: "$",
|
|
413
|
-
countryCode: "ar"
|
|
414
|
-
},
|
|
415
|
-
[Currency.AUD]: {
|
|
416
|
-
currency: Currency.AUD,
|
|
417
|
-
currencyCode: "AUD",
|
|
418
|
-
currencyName: "Australian Dollar",
|
|
419
|
-
currencyCodeHash: currencyKeccak256("AUD"),
|
|
420
|
-
currencySymbol: "A$",
|
|
421
|
-
countryCode: "au"
|
|
422
|
-
},
|
|
423
|
-
[Currency.CAD]: {
|
|
424
|
-
currency: Currency.CAD,
|
|
425
|
-
currencyCode: "CAD",
|
|
426
|
-
currencyName: "Canadian Dollar",
|
|
427
|
-
currencyCodeHash: currencyKeccak256("CAD"),
|
|
428
|
-
currencySymbol: "C$",
|
|
429
|
-
countryCode: "ca"
|
|
430
|
-
},
|
|
431
|
-
[Currency.CHF]: {
|
|
432
|
-
currency: Currency.CHF,
|
|
433
|
-
currencyCode: "CHF",
|
|
434
|
-
currencyName: "Swiss Franc",
|
|
435
|
-
currencyCodeHash: currencyKeccak256("CHF"),
|
|
436
|
-
currencySymbol: "Fr",
|
|
437
|
-
countryCode: "ch"
|
|
438
|
-
},
|
|
439
|
-
[Currency.CNY]: {
|
|
440
|
-
currency: Currency.CNY,
|
|
441
|
-
currencyCode: "CNY",
|
|
442
|
-
currencyName: "Chinese Yuan",
|
|
443
|
-
currencyCodeHash: currencyKeccak256("CNY"),
|
|
444
|
-
currencySymbol: "\xA5",
|
|
445
|
-
countryCode: "cn"
|
|
446
|
-
},
|
|
447
|
-
[Currency.CZK]: {
|
|
448
|
-
currency: Currency.CZK,
|
|
449
|
-
currencyCode: "CZK",
|
|
450
|
-
currencyName: "Czech Koruna",
|
|
451
|
-
currencyCodeHash: currencyKeccak256("CZK"),
|
|
452
|
-
currencySymbol: "K\u010D",
|
|
453
|
-
countryCode: "cz"
|
|
454
|
-
},
|
|
455
|
-
[Currency.DKK]: {
|
|
456
|
-
currency: Currency.DKK,
|
|
457
|
-
currencyCode: "DKK",
|
|
458
|
-
currencyName: "Danish Krone",
|
|
459
|
-
currencyCodeHash: currencyKeccak256("DKK"),
|
|
460
|
-
currencySymbol: "kr",
|
|
461
|
-
countryCode: "dk"
|
|
462
|
-
},
|
|
463
|
-
[Currency.EUR]: {
|
|
464
|
-
currency: Currency.EUR,
|
|
465
|
-
currencyCode: "EUR",
|
|
466
|
-
currencyName: "Euro",
|
|
467
|
-
currencyCodeHash: currencyKeccak256("EUR"),
|
|
468
|
-
currencySymbol: "\u20AC",
|
|
469
|
-
countryCode: "eu"
|
|
470
|
-
},
|
|
471
|
-
[Currency.GBP]: {
|
|
472
|
-
currency: Currency.GBP,
|
|
473
|
-
currencyCode: "GBP",
|
|
474
|
-
currencyName: "British Pound",
|
|
475
|
-
currencyCodeHash: currencyKeccak256("GBP"),
|
|
476
|
-
currencySymbol: "\xA3",
|
|
477
|
-
countryCode: "gb"
|
|
478
|
-
},
|
|
479
|
-
[Currency.HKD]: {
|
|
480
|
-
currency: Currency.HKD,
|
|
481
|
-
currencyCode: "HKD",
|
|
482
|
-
currencyName: "Hong Kong Dollar",
|
|
483
|
-
currencyCodeHash: currencyKeccak256("HKD"),
|
|
484
|
-
currencySymbol: "HK$",
|
|
485
|
-
countryCode: "hk"
|
|
486
|
-
},
|
|
487
|
-
[Currency.HUF]: {
|
|
488
|
-
currency: Currency.HUF,
|
|
489
|
-
currencyCode: "HUF",
|
|
490
|
-
currencyName: "Hungarian Forint",
|
|
491
|
-
currencyCodeHash: currencyKeccak256("HUF"),
|
|
492
|
-
currencySymbol: "Ft",
|
|
493
|
-
countryCode: "hu"
|
|
494
|
-
},
|
|
495
|
-
[Currency.IDR]: {
|
|
496
|
-
currency: Currency.IDR,
|
|
497
|
-
currencyCode: "IDR",
|
|
498
|
-
currencyName: "Indonesian Rupiah",
|
|
499
|
-
currencyCodeHash: currencyKeccak256("IDR"),
|
|
500
|
-
currencySymbol: "Rp",
|
|
501
|
-
countryCode: "id"
|
|
502
|
-
},
|
|
503
|
-
[Currency.INR]: {
|
|
504
|
-
currency: Currency.INR,
|
|
505
|
-
currencyCode: "INR",
|
|
506
|
-
currencyName: "Indian Rupee",
|
|
507
|
-
currencyCodeHash: currencyKeccak256("INR"),
|
|
508
|
-
currencySymbol: "\u20B9",
|
|
509
|
-
countryCode: "in"
|
|
510
|
-
},
|
|
511
|
-
[Currency.ILS]: {
|
|
512
|
-
currency: Currency.ILS,
|
|
513
|
-
currencyCode: "ILS",
|
|
514
|
-
currencyName: "Israeli New Shekel",
|
|
515
|
-
currencyCodeHash: currencyKeccak256("ILS"),
|
|
516
|
-
currencySymbol: "\u20AA",
|
|
517
|
-
countryCode: "il"
|
|
518
|
-
},
|
|
519
|
-
[Currency.JPY]: {
|
|
520
|
-
currency: Currency.JPY,
|
|
521
|
-
currencyCode: "JPY",
|
|
522
|
-
currencyName: "Japanese Yen",
|
|
523
|
-
currencyCodeHash: currencyKeccak256("JPY"),
|
|
524
|
-
currencySymbol: "\xA5",
|
|
525
|
-
countryCode: "jp"
|
|
526
|
-
},
|
|
527
|
-
[Currency.KES]: {
|
|
528
|
-
currency: Currency.KES,
|
|
529
|
-
currencyCode: "KES",
|
|
530
|
-
currencyName: "Kenyan Shilling",
|
|
531
|
-
currencyCodeHash: currencyKeccak256("KES"),
|
|
532
|
-
currencySymbol: "KSh",
|
|
533
|
-
countryCode: "ke"
|
|
534
|
-
},
|
|
535
|
-
[Currency.MXN]: {
|
|
536
|
-
currency: Currency.MXN,
|
|
537
|
-
currencyCode: "MXN",
|
|
538
|
-
currencyName: "Mexican Peso",
|
|
539
|
-
currencyCodeHash: currencyKeccak256("MXN"),
|
|
540
|
-
currencySymbol: "$",
|
|
541
|
-
countryCode: "mx"
|
|
542
|
-
},
|
|
543
|
-
[Currency.MYR]: {
|
|
544
|
-
currency: Currency.MYR,
|
|
545
|
-
currencyCode: "MYR",
|
|
546
|
-
currencyName: "Malaysian Ringgit",
|
|
547
|
-
currencyCodeHash: currencyKeccak256("MYR"),
|
|
548
|
-
currencySymbol: "RM",
|
|
549
|
-
countryCode: "my"
|
|
550
|
-
},
|
|
551
|
-
[Currency.NOK]: {
|
|
552
|
-
currency: Currency.NOK,
|
|
553
|
-
currencyCode: "NOK",
|
|
554
|
-
currencyName: "Norwegian Krone",
|
|
555
|
-
currencyCodeHash: currencyKeccak256("NOK"),
|
|
556
|
-
currencySymbol: "kr",
|
|
557
|
-
countryCode: "no"
|
|
558
|
-
},
|
|
559
|
-
[Currency.NZD]: {
|
|
560
|
-
currency: Currency.NZD,
|
|
561
|
-
currencyCode: "NZD",
|
|
562
|
-
currencyName: "New Zealand Dollar",
|
|
563
|
-
currencyCodeHash: currencyKeccak256("NZD"),
|
|
564
|
-
currencySymbol: "NZ$",
|
|
565
|
-
countryCode: "nz"
|
|
566
|
-
},
|
|
567
|
-
[Currency.PHP]: {
|
|
568
|
-
currency: Currency.PHP,
|
|
569
|
-
currencyCode: "PHP",
|
|
570
|
-
currencyName: "Philippine Peso",
|
|
571
|
-
currencyCodeHash: currencyKeccak256("PHP"),
|
|
572
|
-
currencySymbol: "\u20B1",
|
|
573
|
-
countryCode: "ph"
|
|
574
|
-
},
|
|
575
|
-
[Currency.PLN]: {
|
|
576
|
-
currency: Currency.PLN,
|
|
577
|
-
currencyCode: "PLN",
|
|
578
|
-
currencyName: "Polish Z\u0142oty",
|
|
579
|
-
currencyCodeHash: currencyKeccak256("PLN"),
|
|
580
|
-
currencySymbol: "z\u0142",
|
|
581
|
-
countryCode: "pl"
|
|
582
|
-
},
|
|
583
|
-
[Currency.RON]: {
|
|
584
|
-
currency: Currency.RON,
|
|
585
|
-
currencyCode: "RON",
|
|
586
|
-
currencyName: "Romanian Leu",
|
|
587
|
-
currencyCodeHash: currencyKeccak256("RON"),
|
|
588
|
-
currencySymbol: "lei",
|
|
589
|
-
countryCode: "ro"
|
|
590
|
-
},
|
|
591
|
-
[Currency.SAR]: {
|
|
592
|
-
currency: Currency.SAR,
|
|
593
|
-
currencyCode: "SAR",
|
|
594
|
-
currencyName: "Saudi Riyal",
|
|
595
|
-
currencyCodeHash: currencyKeccak256("SAR"),
|
|
596
|
-
currencySymbol: "\uFDFC",
|
|
597
|
-
countryCode: "sa"
|
|
598
|
-
},
|
|
599
|
-
[Currency.SEK]: {
|
|
600
|
-
currency: Currency.SEK,
|
|
601
|
-
currencyCode: "SEK",
|
|
602
|
-
currencyName: "Swedish Krona",
|
|
603
|
-
currencyCodeHash: currencyKeccak256("SEK"),
|
|
604
|
-
currencySymbol: "kr",
|
|
605
|
-
countryCode: "se"
|
|
606
|
-
},
|
|
607
|
-
[Currency.SGD]: {
|
|
608
|
-
currency: Currency.SGD,
|
|
609
|
-
currencyCode: "SGD",
|
|
610
|
-
currencyName: "Singapore Dollar",
|
|
611
|
-
currencyCodeHash: currencyKeccak256("SGD"),
|
|
612
|
-
currencySymbol: "S$",
|
|
613
|
-
countryCode: "sg"
|
|
614
|
-
},
|
|
615
|
-
[Currency.THB]: {
|
|
616
|
-
currency: Currency.THB,
|
|
617
|
-
currencyCode: "THB",
|
|
618
|
-
currencyName: "Thai Baht",
|
|
619
|
-
currencyCodeHash: currencyKeccak256("THB"),
|
|
620
|
-
currencySymbol: "\u0E3F",
|
|
621
|
-
countryCode: "th"
|
|
622
|
-
},
|
|
623
|
-
[Currency.TRY]: {
|
|
624
|
-
currency: Currency.TRY,
|
|
625
|
-
currencyCode: "TRY",
|
|
626
|
-
currencyName: "Turkish Lira",
|
|
627
|
-
currencyCodeHash: currencyKeccak256("TRY"),
|
|
628
|
-
currencySymbol: "\u20BA",
|
|
629
|
-
countryCode: "tr"
|
|
630
|
-
},
|
|
631
|
-
[Currency.UGX]: {
|
|
632
|
-
currency: Currency.UGX,
|
|
633
|
-
currencyCode: "UGX",
|
|
634
|
-
currencyName: "Ugandan Shilling",
|
|
635
|
-
currencyCodeHash: currencyKeccak256("UGX"),
|
|
636
|
-
currencySymbol: "USh",
|
|
637
|
-
countryCode: "ug"
|
|
638
|
-
},
|
|
639
|
-
[Currency.USD]: {
|
|
640
|
-
currency: Currency.USD,
|
|
641
|
-
currencyCode: "USD",
|
|
642
|
-
currencyName: "United States Dollar",
|
|
643
|
-
currencyCodeHash: currencyKeccak256("USD"),
|
|
644
|
-
currencySymbol: "$",
|
|
645
|
-
countryCode: "us"
|
|
646
|
-
},
|
|
647
|
-
[Currency.VND]: {
|
|
648
|
-
currency: Currency.VND,
|
|
649
|
-
currencyCode: "VND",
|
|
650
|
-
currencyName: "Vietnamese Dong",
|
|
651
|
-
currencyCodeHash: currencyKeccak256("VND"),
|
|
652
|
-
currencySymbol: "\u20AB",
|
|
653
|
-
countryCode: "vn"
|
|
654
|
-
},
|
|
655
|
-
[Currency.ZAR]: {
|
|
656
|
-
currency: Currency.ZAR,
|
|
657
|
-
currencyCode: "ZAR",
|
|
658
|
-
currencyName: "South African Rand",
|
|
659
|
-
currencyCodeHash: currencyKeccak256("ZAR"),
|
|
660
|
-
currencySymbol: "R",
|
|
661
|
-
countryCode: "za"
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
PaymentPlatform = {
|
|
665
|
-
VENMO: "venmo",
|
|
666
|
-
CASHAPP: "cashapp",
|
|
667
|
-
CHIME: "chime",
|
|
668
|
-
REVOLUT: "revolut",
|
|
669
|
-
WISE: "wise",
|
|
670
|
-
MERCADO_PAGO: "mercadopago",
|
|
671
|
-
ZELLE: "zelle",
|
|
672
|
-
PAYPAL: "paypal",
|
|
673
|
-
MONZO: "monzo",
|
|
674
|
-
N26: "n26",
|
|
675
|
-
ALIPAY: "alipay"
|
|
676
|
-
};
|
|
677
|
-
[...Object.values(PaymentPlatform)];
|
|
678
|
-
venmoSendConfig = {
|
|
679
|
-
defaultPaymentMode: "QR_CODE",
|
|
680
|
-
useCustomQRCode: true,
|
|
681
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://account.venmo.com/pay?recipients=${recipientId}¬e=Thx&amount=${amountFiatToSend?.replace(",", "")}`,
|
|
682
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `venmo://paycharge?txn=pay&recipients=${recipientId}¬e=Thx&amount=${amountFiatToSend?.replace(",", "")}`,
|
|
683
|
-
supportsSendingPaymentOnWeb: true,
|
|
684
|
-
showTroubleScanningQRCodeLink: true,
|
|
685
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
686
|
-
return `Please do NOT toggle the "Turn on for purchases" option. Ensure you pay friends & family when making the payment on Venmo.`;
|
|
687
|
-
},
|
|
688
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
689
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment. Double-check the username before confirming.`;
|
|
690
|
-
},
|
|
691
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
692
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] },
|
|
693
|
-
{ text: "Pay friends & family", emphasize: ["friends & family"] },
|
|
694
|
-
{ text: "Double-check the username before confirming", emphasize: ["Double-check"] }
|
|
695
|
-
],
|
|
696
|
-
sendPaymentDonts: () => [
|
|
697
|
-
{ text: "Do not use a business account", emphasize: ["Do not", "business"] },
|
|
698
|
-
{ text: 'Do not toggle "Turn on for purchases"', emphasize: ["Do not", "Turn on for purchases"] },
|
|
699
|
-
{ text: "Do not include zkp2p, crypto, or related terms in the memo", emphasize: ["zkp2p", "crypto"] }
|
|
700
|
-
]
|
|
701
|
-
};
|
|
702
|
-
venmoVerifyConfig = {
|
|
703
|
-
authLink: "https://account.venmo.com/?feed=mine",
|
|
704
|
-
actionType: "transfer_venmo",
|
|
705
|
-
actionPlatform: "venmo",
|
|
706
|
-
numPaymentsFetched: 10,
|
|
707
|
-
minExtensionVersion: "0.2.1",
|
|
708
|
-
supportsAppclip: false,
|
|
709
|
-
totalProofs: 1,
|
|
710
|
-
parseExtractedParameters: (context) => {
|
|
711
|
-
const contextObject = JSON.parse(context);
|
|
712
|
-
const params = contextObject.extractedParameters;
|
|
713
|
-
const date = /* @__PURE__ */ new Date(params.date + "Z");
|
|
714
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
715
|
-
year: "numeric",
|
|
716
|
-
month: "short",
|
|
717
|
-
day: "numeric",
|
|
718
|
-
hour: "numeric",
|
|
719
|
-
minute: "numeric",
|
|
720
|
-
hour12: true
|
|
721
|
-
});
|
|
722
|
-
const amount = Number(params.amount.replace("-", "")).toString();
|
|
723
|
-
return {
|
|
724
|
-
amount,
|
|
725
|
-
date: formattedDate,
|
|
726
|
-
currency: "USD",
|
|
727
|
-
paymentPlatform: PaymentPlatform.VENMO,
|
|
728
|
-
paymentId: params.paymentId,
|
|
729
|
-
recipient: params.receiverId,
|
|
730
|
-
intentHash: contextObject.contextMessage,
|
|
731
|
-
providerHash: contextObject.providerHash
|
|
732
|
-
};
|
|
733
|
-
},
|
|
734
|
-
parseMetadata: (metadata) => {
|
|
735
|
-
try {
|
|
736
|
-
const amountStr = String(metadata.amount ?? "").replace(/[^0-9.]/g, "");
|
|
737
|
-
const dateStr = `${metadata.date ?? ""}Z`;
|
|
738
|
-
const recipientIdStr = metadata.recipient || "";
|
|
739
|
-
return {
|
|
740
|
-
amount: amountStr,
|
|
741
|
-
parsedAmount: amountStr !== "",
|
|
742
|
-
date: dateStr,
|
|
743
|
-
parsedDate: dateStr !== "",
|
|
744
|
-
recipientId: recipientIdStr,
|
|
745
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
746
|
-
currency: Currency.USD,
|
|
747
|
-
parsedCurrency: true
|
|
748
|
-
};
|
|
749
|
-
} catch (error) {
|
|
750
|
-
console.error("[Venmo] Failed to parse payment metadata:", {
|
|
751
|
-
error: error instanceof Error ? error.message : error,
|
|
752
|
-
metadata
|
|
753
|
-
});
|
|
754
|
-
return {
|
|
755
|
-
amount: "",
|
|
756
|
-
parsedAmount: false,
|
|
757
|
-
date: "",
|
|
758
|
-
parsedDate: false,
|
|
759
|
-
recipientId: "",
|
|
760
|
-
parsedRecipientId: false,
|
|
761
|
-
currency: "",
|
|
762
|
-
parsedCurrency: false
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
},
|
|
766
|
-
getSubjectText: (metadata) => {
|
|
767
|
-
const venmoStringSplit = String(metadata.amount ?? "").split(" ");
|
|
768
|
-
return venmoStringSplit[0] === "-" ? `Sent ${venmoStringSplit[1]} to ${metadata.recipient}` : ``;
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
venmoDepositConfig = {
|
|
772
|
-
depositRequiresApproval: false,
|
|
773
|
-
payeeDetailInputPlaceholder: "Enter your Venmo username",
|
|
774
|
-
payeeDetailInputHelperText: "This is your Venmo username",
|
|
775
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your username. Do not include the @. Username is case sensitive.",
|
|
776
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
777
|
-
return {
|
|
778
|
-
venmoUsername: payeeDetails,
|
|
779
|
-
telegramUsername: telegramUsername || ""
|
|
780
|
-
};
|
|
781
|
-
},
|
|
782
|
-
getPayeeDetail: (data) => {
|
|
783
|
-
return data.venmoUsername;
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
venmoConfig = {
|
|
787
|
-
platformId: PaymentPlatform.VENMO,
|
|
788
|
-
platformName: "Venmo",
|
|
789
|
-
platformCurrencies: [Currency.USD],
|
|
790
|
-
platformLogo: void 0,
|
|
791
|
-
// venmoLogo - Legal counsel advised not to use logo
|
|
792
|
-
platformColor: "#3D95CE",
|
|
793
|
-
// Venmo's brand blue color
|
|
794
|
-
minFiatAmount: "0.1",
|
|
795
|
-
// 0.1 USD
|
|
796
|
-
maxUsdcPerIntent: "5000",
|
|
797
|
-
// Client-side pre-validation to avoid unnecessary API calls
|
|
798
|
-
localeTimeString: "en-US",
|
|
799
|
-
depositConfig: venmoDepositConfig,
|
|
800
|
-
hasMultiplePaymentMethods: false,
|
|
801
|
-
paymentMethods: [
|
|
802
|
-
{
|
|
803
|
-
sendConfig: venmoSendConfig,
|
|
804
|
-
verifyConfig: venmoVerifyConfig
|
|
805
|
-
}
|
|
806
|
-
]
|
|
807
|
-
};
|
|
808
|
-
cashappSendConfig = {
|
|
809
|
-
defaultPaymentMode: "QR_CODE",
|
|
810
|
-
useCustomQRCode: false,
|
|
811
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => recipientId.startsWith("$") ? `https://cash.app/qr/${recipientId}?size=288&margin=0` : `https://cash.app/qr/$${recipientId}?size=288&margin=0`,
|
|
812
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => recipientId.startsWith("$") ? `https://cash.app/qr/${recipientId}?size=288&margin=0` : `https://cash.app/qr/$${recipientId}?size=288&margin=0`,
|
|
813
|
-
supportsSendingPaymentOnWeb: false,
|
|
814
|
-
showTroubleScanningQRCodeLink: true,
|
|
815
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
816
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment.`;
|
|
817
|
-
},
|
|
818
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
819
|
-
return `Please do not put zkp2p, crypto or any related terms in the payment notes or memo field.`;
|
|
820
|
-
},
|
|
821
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
822
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] },
|
|
823
|
-
{ text: "Use the Cash App QR or Cashtag to pay" },
|
|
824
|
-
{ text: "Double-check the recipient before confirming", emphasize: ["Double-check"] }
|
|
825
|
-
],
|
|
826
|
-
sendPaymentDonts: () => [
|
|
827
|
-
{ text: "Do not include zkp2p, crypto, or related terms in the memo", emphasize: ["zkp2p", "crypto"] }
|
|
828
|
-
]
|
|
829
|
-
};
|
|
830
|
-
cashappVerifyConfig = {
|
|
831
|
-
authLink: "https://cash.app/account/activity",
|
|
832
|
-
actionType: "transfer_cashapp",
|
|
833
|
-
actionPlatform: "cashapp",
|
|
834
|
-
numPaymentsFetched: 15,
|
|
835
|
-
minExtensionVersion: "0.2.1",
|
|
836
|
-
supportsAppclip: false,
|
|
837
|
-
totalProofs: 1,
|
|
838
|
-
parseExtractedParameters: (context) => {
|
|
839
|
-
const contextObject = JSON.parse(context);
|
|
840
|
-
const params = contextObject.extractedParameters;
|
|
841
|
-
const date = new Date(Number(params.date));
|
|
842
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
843
|
-
year: "numeric",
|
|
844
|
-
month: "short",
|
|
845
|
-
day: "numeric",
|
|
846
|
-
hour: "numeric",
|
|
847
|
-
minute: "numeric",
|
|
848
|
-
hour12: true
|
|
849
|
-
});
|
|
850
|
-
return {
|
|
851
|
-
amount: params.amount,
|
|
852
|
-
date: formattedDate,
|
|
853
|
-
currency: params.currency_code,
|
|
854
|
-
paymentPlatform: PaymentPlatform.CASHAPP,
|
|
855
|
-
paymentId: params.paymentId,
|
|
856
|
-
recipient: params.receiverId,
|
|
857
|
-
intentHash: contextObject.contextMessage,
|
|
858
|
-
providerHash: contextObject.providerHash
|
|
859
|
-
};
|
|
860
|
-
},
|
|
861
|
-
parseMetadata: (metadata) => {
|
|
862
|
-
try {
|
|
863
|
-
const amountUnits = Number(metadata.amount) / 100;
|
|
864
|
-
const amountStr = parseFloat(amountUnits.toFixed(2)).toString();
|
|
865
|
-
const currency = metadata.currency ?? "";
|
|
866
|
-
const dateString = new Date(metadata.date ?? "").toISOString();
|
|
867
|
-
const recipientId = metadata.recipient ?? "";
|
|
868
|
-
return {
|
|
869
|
-
amount: amountStr,
|
|
870
|
-
parsedAmount: amountStr !== "",
|
|
871
|
-
date: dateString,
|
|
872
|
-
parsedDate: dateString !== "",
|
|
873
|
-
recipientId,
|
|
874
|
-
parsedRecipientId: recipientId !== "",
|
|
875
|
-
currency,
|
|
876
|
-
parsedCurrency: currency !== ""
|
|
877
|
-
};
|
|
878
|
-
} catch (error) {
|
|
879
|
-
console.error("Error parsing Cash App metadata", error);
|
|
880
|
-
return {
|
|
881
|
-
amount: "",
|
|
882
|
-
parsedAmount: false,
|
|
883
|
-
date: "",
|
|
884
|
-
parsedDate: false,
|
|
885
|
-
recipientId: "",
|
|
886
|
-
parsedRecipientId: false,
|
|
887
|
-
currency: "",
|
|
888
|
-
parsedCurrency: false
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
},
|
|
892
|
-
getSubjectText: (metadata) => {
|
|
893
|
-
return `Transfer of $${Number(metadata.amount) / 100} to ${metadata.recipient}`;
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
cashappDepositConfig = {
|
|
897
|
-
depositRequiresApproval: false,
|
|
898
|
-
payeeDetailInputPlaceholder: "Enter your Cashtag",
|
|
899
|
-
payeeDetailInputHelperText: "This is your Cashtag. Please ensure you have set your Cashtag as discoverable by others. Do not include the $ symbol.",
|
|
900
|
-
payeeDetailValidationFailureMessage: "Make sure you have set your Cashtag as discoverable by others. Do not include the $ symbol.",
|
|
901
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
902
|
-
return {
|
|
903
|
-
cashtag: payeeDetails,
|
|
904
|
-
telegramUsername: telegramUsername || ""
|
|
905
|
-
};
|
|
906
|
-
},
|
|
907
|
-
getPayeeDetail: (data) => {
|
|
908
|
-
const tag = data.cashtag;
|
|
909
|
-
return tag.startsWith("$") ? tag : `$${tag}`;
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
cashappConfig = {
|
|
913
|
-
platformId: PaymentPlatform.CASHAPP,
|
|
914
|
-
platformLogo: "",
|
|
915
|
-
platformName: "Cash App",
|
|
916
|
-
platformColor: "#00D632",
|
|
917
|
-
// Cash App's brand green color
|
|
918
|
-
platformCurrencies: [Currency.USD],
|
|
919
|
-
minFiatAmount: "0.1",
|
|
920
|
-
// 0.1 USD
|
|
921
|
-
localeTimeString: "en-US",
|
|
922
|
-
depositConfig: cashappDepositConfig,
|
|
923
|
-
hasMultiplePaymentMethods: false,
|
|
924
|
-
paymentMethods: [
|
|
925
|
-
{
|
|
926
|
-
sendConfig: cashappSendConfig,
|
|
927
|
-
verifyConfig: cashappVerifyConfig
|
|
928
|
-
}
|
|
929
|
-
]
|
|
930
|
-
};
|
|
931
|
-
chimeSendConfig = {
|
|
932
|
-
defaultPaymentMode: "QR_CODE",
|
|
933
|
-
useCustomQRCode: true,
|
|
934
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://app.chime.com/login`,
|
|
935
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `https://app.chime.com/link/qr?u=${recipientId}`,
|
|
936
|
-
supportsSendingPaymentOnWeb: false,
|
|
937
|
-
showTroubleScanningQRCodeLink: true,
|
|
938
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
939
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment.`;
|
|
940
|
-
},
|
|
941
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
942
|
-
return `Please do not put zkp2p, crypto or any related terms in the payment notes or memo field.`;
|
|
943
|
-
},
|
|
944
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
945
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] },
|
|
946
|
-
{ text: "Use the Chime QR or ChimeSign to pay" },
|
|
947
|
-
{ text: "Double-check the recipient before confirming", emphasize: ["Double-check"] }
|
|
948
|
-
],
|
|
949
|
-
sendPaymentDonts: () => [
|
|
950
|
-
{ text: "Do not include zkp2p, crypto, or related terms in the memo", emphasize: ["zkp2p", "crypto"] }
|
|
951
|
-
]
|
|
952
|
-
};
|
|
953
|
-
readChimeMetadataValue = (value) => {
|
|
954
|
-
if (Array.isArray(value)) {
|
|
955
|
-
const [first] = value;
|
|
956
|
-
return first === void 0 || first === null ? "" : String(first);
|
|
957
|
-
}
|
|
958
|
-
return value === void 0 || value === null ? "" : String(value);
|
|
959
|
-
};
|
|
960
|
-
formatChimeAmount = (value) => {
|
|
961
|
-
const amountValue = Number(value);
|
|
962
|
-
if (!Number.isFinite(amountValue)) {
|
|
963
|
-
return "";
|
|
964
|
-
}
|
|
965
|
-
return parseFloat(amountValue.toFixed(2)).toString();
|
|
966
|
-
};
|
|
967
|
-
parseChimeDate = (value) => {
|
|
968
|
-
if (!value) {
|
|
969
|
-
return "";
|
|
970
|
-
}
|
|
971
|
-
const parsedDate = new Date(value);
|
|
972
|
-
if (Number.isNaN(parsedDate.getTime())) {
|
|
973
|
-
return "";
|
|
974
|
-
}
|
|
975
|
-
return parsedDate.toISOString();
|
|
976
|
-
};
|
|
977
|
-
parseChimeMetadataFields = (metadata) => {
|
|
978
|
-
if (Array.isArray(metadata)) {
|
|
979
|
-
const [
|
|
980
|
-
headerDate,
|
|
981
|
-
amountRaw,
|
|
982
|
-
isoDate,
|
|
983
|
-
recipientRaw,
|
|
984
|
-
_paymentIdRaw,
|
|
985
|
-
statusRaw
|
|
986
|
-
] = metadata;
|
|
987
|
-
return {
|
|
988
|
-
amountStr: formatChimeAmount(readChimeMetadataValue(amountRaw)),
|
|
989
|
-
currency: Currency.USD,
|
|
990
|
-
dateString: parseChimeDate(readChimeMetadataValue(isoDate) || readChimeMetadataValue(headerDate)),
|
|
991
|
-
recipientId: readChimeMetadataValue(recipientRaw),
|
|
992
|
-
status: readChimeMetadataValue(statusRaw)
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
const typedMetadata = metadata;
|
|
996
|
-
return {
|
|
997
|
-
amountStr: formatChimeAmount(typedMetadata.amount),
|
|
998
|
-
currency: typedMetadata.currency ?? Currency.USD,
|
|
999
|
-
dateString: parseChimeDate(typedMetadata.date ?? ""),
|
|
1000
|
-
recipientId: typedMetadata.recipient ?? "",
|
|
1001
|
-
status: ""
|
|
1002
|
-
};
|
|
1003
|
-
};
|
|
1004
|
-
chimeVerifyConfig = {
|
|
1005
|
-
authLink: "https://app.chime.com/login",
|
|
1006
|
-
actionType: "transfer_chime",
|
|
1007
|
-
actionPlatform: "chime",
|
|
1008
|
-
numPaymentsFetched: 1,
|
|
1009
|
-
minExtensionVersion: "0.3.0",
|
|
1010
|
-
supportsAppclip: false,
|
|
1011
|
-
totalProofs: 1,
|
|
1012
|
-
parseExtractedParameters: (context) => {
|
|
1013
|
-
const contextObject = JSON.parse(context);
|
|
1014
|
-
const params = contextObject.extractedParameters;
|
|
1015
|
-
const date = new Date(Number(params.date));
|
|
1016
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1017
|
-
year: "numeric",
|
|
1018
|
-
month: "short",
|
|
1019
|
-
day: "numeric",
|
|
1020
|
-
hour: "numeric",
|
|
1021
|
-
minute: "numeric",
|
|
1022
|
-
hour12: true
|
|
1023
|
-
});
|
|
1024
|
-
return {
|
|
1025
|
-
amount: params.amount,
|
|
1026
|
-
date: formattedDate,
|
|
1027
|
-
currency: params.currency_code,
|
|
1028
|
-
paymentPlatform: PaymentPlatform.CHIME,
|
|
1029
|
-
paymentId: params.paymentId,
|
|
1030
|
-
recipient: params.receiverId,
|
|
1031
|
-
intentHash: contextObject.contextMessage,
|
|
1032
|
-
providerHash: contextObject.providerHash
|
|
1033
|
-
};
|
|
1034
|
-
},
|
|
1035
|
-
parseMetadata: (metadata) => {
|
|
1036
|
-
try {
|
|
1037
|
-
const {
|
|
1038
|
-
amountStr,
|
|
1039
|
-
currency,
|
|
1040
|
-
dateString,
|
|
1041
|
-
recipientId
|
|
1042
|
-
} = parseChimeMetadataFields(metadata);
|
|
1043
|
-
return {
|
|
1044
|
-
amount: amountStr,
|
|
1045
|
-
parsedAmount: amountStr !== "",
|
|
1046
|
-
date: dateString,
|
|
1047
|
-
parsedDate: dateString !== "",
|
|
1048
|
-
recipientId,
|
|
1049
|
-
parsedRecipientId: recipientId !== "",
|
|
1050
|
-
currency,
|
|
1051
|
-
parsedCurrency: currency !== ""
|
|
1052
|
-
};
|
|
1053
|
-
} catch (error) {
|
|
1054
|
-
console.error("Error parsing Chime metadata", error);
|
|
1055
|
-
return {
|
|
1056
|
-
amount: "",
|
|
1057
|
-
parsedAmount: false,
|
|
1058
|
-
date: "",
|
|
1059
|
-
parsedDate: false,
|
|
1060
|
-
recipientId: "",
|
|
1061
|
-
parsedRecipientId: false,
|
|
1062
|
-
currency: "",
|
|
1063
|
-
parsedCurrency: false
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
},
|
|
1067
|
-
getSubjectText: (metadata) => {
|
|
1068
|
-
const { amountStr, recipientId, status } = parseChimeMetadataFields(metadata);
|
|
1069
|
-
if (!amountStr || !recipientId) {
|
|
1070
|
-
return "";
|
|
1071
|
-
}
|
|
1072
|
-
if (status && status !== "SUCCEEDED") {
|
|
1073
|
-
return "";
|
|
1074
|
-
}
|
|
1075
|
-
return `Transfer of $${amountStr} to ${recipientId}`;
|
|
1076
|
-
}
|
|
1077
|
-
};
|
|
1078
|
-
chimeDepositConfig = {
|
|
1079
|
-
depositRequiresApproval: false,
|
|
1080
|
-
payeeDetailInputPlaceholder: "Enter your $ChimeSign",
|
|
1081
|
-
payeeDetailInputHelperText: "This is your ChimeSign. Please ensure you have set your ChimeSign as discoverable by others. Include the $ symbol.",
|
|
1082
|
-
payeeDetailValidationFailureMessage: "Make sure you have set your ChimeSign as discoverable by others and include the $ symbol.",
|
|
1083
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
1084
|
-
const normalizedPayeeDetails = payeeDetails.trim().toLowerCase();
|
|
1085
|
-
return {
|
|
1086
|
-
chimesign: normalizedPayeeDetails,
|
|
1087
|
-
telegramUsername: telegramUsername || ""
|
|
1088
|
-
};
|
|
1089
|
-
},
|
|
1090
|
-
getPayeeDetail: (data) => {
|
|
1091
|
-
const normalizedSign = data.chimesign?.trim().toLowerCase() ?? "";
|
|
1092
|
-
return normalizedSign;
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
chimeConfig = {
|
|
1096
|
-
platformId: PaymentPlatform.CHIME,
|
|
1097
|
-
platformLogo: "",
|
|
1098
|
-
platformName: "Chime",
|
|
1099
|
-
platformColor: "#1EC677",
|
|
1100
|
-
// Chime brand green
|
|
1101
|
-
platformCurrencies: [Currency.USD],
|
|
1102
|
-
minFiatAmount: "0.1",
|
|
1103
|
-
// 0.1 USD
|
|
1104
|
-
localeTimeString: "en-US",
|
|
1105
|
-
depositConfig: chimeDepositConfig,
|
|
1106
|
-
hasMultiplePaymentMethods: false,
|
|
1107
|
-
paymentMethods: [
|
|
1108
|
-
{
|
|
1109
|
-
sendConfig: chimeSendConfig,
|
|
1110
|
-
verifyConfig: chimeVerifyConfig
|
|
1111
|
-
}
|
|
1112
|
-
]
|
|
1113
|
-
};
|
|
1114
|
-
getMinorDigits = (currency) => {
|
|
1115
|
-
const code = (currency || "").toString().toUpperCase();
|
|
1116
|
-
return code === "JPY" ? 0 : 2;
|
|
1117
|
-
};
|
|
1118
|
-
formatMajorAmountFromMinor = (minorAmount, currency) => {
|
|
1119
|
-
const digits = getMinorDigits(currency);
|
|
1120
|
-
const major = minorAmount / Math.pow(10, digits);
|
|
1121
|
-
if (digits === 0) {
|
|
1122
|
-
return Math.round(major).toString();
|
|
1123
|
-
}
|
|
1124
|
-
return parseFloat(major.toFixed(digits)).toString();
|
|
1125
|
-
};
|
|
1126
|
-
revolutSendConfig = {
|
|
1127
|
-
defaultPaymentMode: "QR_CODE",
|
|
1128
|
-
useCustomQRCode: true,
|
|
1129
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://revolut.me/${recipientId}`,
|
|
1130
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `https://revolut.me/${recipientId}`,
|
|
1131
|
-
supportsSendingPaymentOnWeb: false,
|
|
1132
|
-
showTroubleScanningQRCodeLink: false,
|
|
1133
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1134
|
-
return `Avoid cross-currency conversion. If you do send the wrong currency, a 5% penalty will be automatically applied.`;
|
|
1135
|
-
},
|
|
1136
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1137
|
-
return `Use your existing Revolut account. Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment. Ensure the seller receives exactly ${currencyInfo[sendCurrency].currencyCode}.`;
|
|
1138
|
-
},
|
|
1139
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1140
|
-
{ text: "Use your existing Revolut account", emphasize: ["existing"] },
|
|
1141
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] },
|
|
1142
|
-
{ text: `Ensure the seller receives exactly ${currencyInfo[sendCurrency].currencyCode}`, emphasize: ["exactly", currencyInfo[sendCurrency].currencyCode] }
|
|
1143
|
-
],
|
|
1144
|
-
sendPaymentDonts: () => [
|
|
1145
|
-
{ text: "Avoid cross-currency conversion", emphasize: ["cross-currency"] },
|
|
1146
|
-
{ text: "If you do send the wrong currency, a 5% penalty will be automatically applied.", emphasize: ["5% penalty"] },
|
|
1147
|
-
{ text: "Do not pay from a Revolut Business account", emphasize: ["Revolut Business"] }
|
|
1148
|
-
]
|
|
1149
|
-
};
|
|
1150
|
-
revolutVerifyConfig = {
|
|
1151
|
-
authLink: "https://app.revolut.com/home",
|
|
1152
|
-
actionType: "transfer_revolut",
|
|
1153
|
-
actionPlatform: "revolut",
|
|
1154
|
-
numPaymentsFetched: 20,
|
|
1155
|
-
minExtensionVersion: "0.2.1",
|
|
1156
|
-
supportsAppclip: false,
|
|
1157
|
-
totalProofs: 1,
|
|
1158
|
-
parseExtractedParameters: (context) => {
|
|
1159
|
-
const contextObject = JSON.parse(context);
|
|
1160
|
-
const params = contextObject.extractedParameters;
|
|
1161
|
-
const date = new Date(Number(params.completedDate));
|
|
1162
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1163
|
-
year: "numeric",
|
|
1164
|
-
month: "short",
|
|
1165
|
-
day: "numeric",
|
|
1166
|
-
hour: "numeric",
|
|
1167
|
-
minute: "numeric",
|
|
1168
|
-
hour12: true
|
|
1169
|
-
});
|
|
1170
|
-
const amount = formatMajorAmountFromMinor(
|
|
1171
|
-
Number(params.amount.replace("-", "")),
|
|
1172
|
-
params.currency
|
|
1173
|
-
);
|
|
1174
|
-
return {
|
|
1175
|
-
amount,
|
|
1176
|
-
date: formattedDate,
|
|
1177
|
-
currency: params.currency,
|
|
1178
|
-
paymentPlatform: PaymentPlatform.REVOLUT,
|
|
1179
|
-
paymentId: params.id,
|
|
1180
|
-
recipient: params.username,
|
|
1181
|
-
intentHash: contextObject.contextMessage,
|
|
1182
|
-
providerHash: contextObject.providerHash
|
|
1183
|
-
};
|
|
1184
|
-
},
|
|
1185
|
-
parseMetadata: (metadata) => {
|
|
1186
|
-
try {
|
|
1187
|
-
const amountStr = formatMajorAmountFromMinor(
|
|
1188
|
-
Number(metadata.amount) * -1,
|
|
1189
|
-
metadata.currency
|
|
1190
|
-
);
|
|
1191
|
-
const dateStr = metadata.date ? new Date(metadata.date).toISOString() : "";
|
|
1192
|
-
return {
|
|
1193
|
-
amount: amountStr,
|
|
1194
|
-
parsedAmount: amountStr !== "",
|
|
1195
|
-
date: dateStr,
|
|
1196
|
-
parsedDate: dateStr !== "",
|
|
1197
|
-
recipientId: metadata.recipient ?? "",
|
|
1198
|
-
parsedRecipientId: metadata.recipient ? true : false,
|
|
1199
|
-
currency: metadata.currency ?? "",
|
|
1200
|
-
parsedCurrency: metadata.currency ? true : false
|
|
1201
|
-
};
|
|
1202
|
-
} catch (error) {
|
|
1203
|
-
console.error("Error parsing Revolut metadata", error);
|
|
1204
|
-
return {
|
|
1205
|
-
amount: "",
|
|
1206
|
-
parsedAmount: false,
|
|
1207
|
-
date: "",
|
|
1208
|
-
parsedDate: false,
|
|
1209
|
-
recipientId: "",
|
|
1210
|
-
parsedRecipientId: false,
|
|
1211
|
-
currency: "",
|
|
1212
|
-
parsedCurrency: false
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
},
|
|
1216
|
-
getSubjectText: (metadata) => {
|
|
1217
|
-
if (Number(metadata.amount) < 0) {
|
|
1218
|
-
const currencySymbol = currencyInfo[metadata.currency ?? ""]?.currencySymbol ?? "";
|
|
1219
|
-
const revolutFormattedAmount = formatMajorAmountFromMinor(
|
|
1220
|
-
Number(metadata.amount) * -1,
|
|
1221
|
-
metadata.currency
|
|
1222
|
-
);
|
|
1223
|
-
return `Sent ${currencySymbol}${revolutFormattedAmount} to ${metadata.recipient} `;
|
|
1224
|
-
} else {
|
|
1225
|
-
return ``;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
};
|
|
1229
|
-
revolutDepositConfig = {
|
|
1230
|
-
depositRequiresApproval: false,
|
|
1231
|
-
// Align with product guidance: clarify that '@' should not be included.
|
|
1232
|
-
payeeDetailInputPlaceholder: "Enter your Revtag (without @)",
|
|
1233
|
-
payeeDetailInputHelperText: "This is your Revtag. Do not include the @. Make sure you have set your Revtag to be publicly discoverable.",
|
|
1234
|
-
payeeDetailValidationFailureMessage: "Do not include the @. Make sure your Revtag is publicly discoverable and there are no typos.",
|
|
1235
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
1236
|
-
return {
|
|
1237
|
-
revolutUsername: payeeDetails,
|
|
1238
|
-
telegramUsername: telegramUsername || ""
|
|
1239
|
-
};
|
|
1240
|
-
},
|
|
1241
|
-
getPayeeDetail: (data) => {
|
|
1242
|
-
return data.revolutUsername;
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
revolutConfig = {
|
|
1246
|
-
platformId: PaymentPlatform.REVOLUT,
|
|
1247
|
-
platformName: "Revolut",
|
|
1248
|
-
platformLogo: "",
|
|
1249
|
-
platformColor: "#000000",
|
|
1250
|
-
// Revolut's brand blue color
|
|
1251
|
-
platformCurrencies: [
|
|
1252
|
-
Currency.USD,
|
|
1253
|
-
Currency.EUR,
|
|
1254
|
-
Currency.GBP,
|
|
1255
|
-
Currency.SGD,
|
|
1256
|
-
Currency.NZD,
|
|
1257
|
-
Currency.AUD,
|
|
1258
|
-
Currency.CAD,
|
|
1259
|
-
Currency.HKD,
|
|
1260
|
-
Currency.MXN,
|
|
1261
|
-
Currency.SAR,
|
|
1262
|
-
Currency.AED,
|
|
1263
|
-
Currency.THB,
|
|
1264
|
-
Currency.TRY,
|
|
1265
|
-
Currency.PLN,
|
|
1266
|
-
Currency.CHF,
|
|
1267
|
-
Currency.ZAR,
|
|
1268
|
-
Currency.JPY,
|
|
1269
|
-
Currency.CZK,
|
|
1270
|
-
Currency.CNY,
|
|
1271
|
-
Currency.DKK,
|
|
1272
|
-
Currency.HUF,
|
|
1273
|
-
Currency.NOK,
|
|
1274
|
-
Currency.RON,
|
|
1275
|
-
Currency.SEK
|
|
1276
|
-
],
|
|
1277
|
-
minFiatAmount: "0.1",
|
|
1278
|
-
// 0.1 USD/EUR/GBP
|
|
1279
|
-
localeTimeString: "en-US",
|
|
1280
|
-
depositConfig: revolutDepositConfig,
|
|
1281
|
-
hasMultiplePaymentMethods: false,
|
|
1282
|
-
paymentMethods: [
|
|
1283
|
-
{
|
|
1284
|
-
sendConfig: revolutSendConfig,
|
|
1285
|
-
verifyConfig: revolutVerifyConfig
|
|
1286
|
-
}
|
|
1287
|
-
]
|
|
1288
|
-
};
|
|
1289
|
-
getMinorDigits2 = (currency) => {
|
|
1290
|
-
const code = (currency || "").toString().toUpperCase();
|
|
1291
|
-
return code === "JPY" ? 0 : 2;
|
|
1292
|
-
};
|
|
1293
|
-
formatMajorAmountFromMinor2 = (minorAmount, currency) => {
|
|
1294
|
-
const digits = getMinorDigits2(currency);
|
|
1295
|
-
const major = minorAmount / Math.pow(10, digits);
|
|
1296
|
-
if (digits === 0) {
|
|
1297
|
-
return Math.round(major).toString();
|
|
1298
|
-
}
|
|
1299
|
-
return parseFloat(major.toFixed(digits)).toString();
|
|
1300
|
-
};
|
|
1301
|
-
wiseSendConfig = {
|
|
1302
|
-
defaultPaymentMode: "QR_CODE",
|
|
1303
|
-
useCustomQRCode: true,
|
|
1304
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://wise.com/pay/me/${recipientId}`,
|
|
1305
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `https://wise.com/pay/me/${recipientId}`,
|
|
1306
|
-
supportsSendingPaymentOnWeb: true,
|
|
1307
|
-
showTroubleScanningQRCodeLink: true,
|
|
1308
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1309
|
-
return `Avoid cross-currency conversion, if you do send cross currency you will lose 5%.`;
|
|
1310
|
-
},
|
|
1311
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1312
|
-
return `Ensure the seller receives exactly ${currencyInfo[sendCurrency].currencyCode} in a single payment. Please do not put zkp2p, crypto or any related terms in the payment notes or memo field.`;
|
|
1313
|
-
},
|
|
1314
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1315
|
-
{ text: `Ensure the seller receives exactly ${currencyInfo[sendCurrency].currencyCode}`, emphasize: ["exactly", currencyInfo[sendCurrency].currencyCode] },
|
|
1316
|
-
{ text: "Send in a single payment", emphasize: ["single"] }
|
|
1317
|
-
],
|
|
1318
|
-
sendPaymentDonts: () => [
|
|
1319
|
-
{ text: "Avoid cross-currency conversion, if you do send cross currency you will lose 5%.", emphasize: ["cross-currency conversion", "5%"] },
|
|
1320
|
-
{ text: "Do not include zkp2p, crypto, or related terms in the memo", emphasize: ["zkp2p", "crypto"] }
|
|
1321
|
-
]
|
|
1322
|
-
};
|
|
1323
|
-
wiseVerifyConfig = {
|
|
1324
|
-
authLink: "https://wise.com/all-transactions?direction=OUTGOING",
|
|
1325
|
-
actionType: "transfer_wise",
|
|
1326
|
-
actionPlatform: "wise",
|
|
1327
|
-
numPaymentsFetched: 20,
|
|
1328
|
-
minExtensionVersion: "0.2.1",
|
|
1329
|
-
supportsAppclip: false,
|
|
1330
|
-
totalProofs: 1,
|
|
1331
|
-
parseExtractedParameters: (context) => {
|
|
1332
|
-
const contextObject = JSON.parse(context);
|
|
1333
|
-
const params = contextObject.extractedParameters;
|
|
1334
|
-
const date = new Date(Number(params.completedDate));
|
|
1335
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1336
|
-
year: "numeric",
|
|
1337
|
-
month: "short",
|
|
1338
|
-
day: "numeric",
|
|
1339
|
-
hour: "numeric",
|
|
1340
|
-
minute: "numeric",
|
|
1341
|
-
hour12: true
|
|
1342
|
-
});
|
|
1343
|
-
const amount = formatMajorAmountFromMinor2(
|
|
1344
|
-
Number(params.amount.replace("-", "")),
|
|
1345
|
-
params.currency
|
|
1346
|
-
);
|
|
1347
|
-
return {
|
|
1348
|
-
amount,
|
|
1349
|
-
date: formattedDate,
|
|
1350
|
-
currency: params.currency,
|
|
1351
|
-
paymentPlatform: PaymentPlatform.WISE,
|
|
1352
|
-
paymentId: params.id,
|
|
1353
|
-
recipient: params.username,
|
|
1354
|
-
intentHash: contextObject.contextMessage,
|
|
1355
|
-
providerHash: contextObject.providerHash
|
|
1356
|
-
};
|
|
1357
|
-
},
|
|
1358
|
-
parseMetadata: (metadata) => {
|
|
1359
|
-
try {
|
|
1360
|
-
const amountParts = (metadata.amount ?? "").split(" ");
|
|
1361
|
-
const currency = amountParts.pop() || metadata.currency || "";
|
|
1362
|
-
let amountStr = amountParts.join("").replace(/\s+/g, "");
|
|
1363
|
-
if (amountStr) {
|
|
1364
|
-
if (amountStr.includes(",") && amountStr.includes(".")) {
|
|
1365
|
-
const lastCommaIndex = amountStr.lastIndexOf(",");
|
|
1366
|
-
const lastDotIndex = amountStr.lastIndexOf(".");
|
|
1367
|
-
if (lastCommaIndex > lastDotIndex) {
|
|
1368
|
-
amountStr = amountStr.replace(/\./g, "").replace(",", ".");
|
|
1369
|
-
} else {
|
|
1370
|
-
amountStr = amountStr.replace(/,/g, "");
|
|
1371
|
-
}
|
|
1372
|
-
} else if (amountStr.includes(",")) {
|
|
1373
|
-
amountStr = amountStr.replace(",", ".");
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
return {
|
|
1377
|
-
amount: amountStr,
|
|
1378
|
-
parsedAmount: amountStr !== "",
|
|
1379
|
-
date: metadata.date ?? "",
|
|
1380
|
-
parsedDate: metadata.date ? true : false,
|
|
1381
|
-
recipientId: String(metadata.recipient ?? "").replace(/<[^>]*>?/gm, ""),
|
|
1382
|
-
parsedRecipientId: false,
|
|
1383
|
-
// cause above is name and not wisetag
|
|
1384
|
-
currency,
|
|
1385
|
-
parsedCurrency: currency !== ""
|
|
1386
|
-
};
|
|
1387
|
-
} catch (error) {
|
|
1388
|
-
console.error("Error parsing Wise metadata", error);
|
|
1389
|
-
return {
|
|
1390
|
-
amount: "",
|
|
1391
|
-
parsedAmount: false,
|
|
1392
|
-
date: "",
|
|
1393
|
-
parsedDate: false,
|
|
1394
|
-
recipientId: "",
|
|
1395
|
-
parsedRecipientId: false,
|
|
1396
|
-
currency: "",
|
|
1397
|
-
parsedCurrency: false
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
},
|
|
1401
|
-
getSubjectText: (metadata) => {
|
|
1402
|
-
const recipient = String(metadata.recipient ?? "").replace(/<[^>]*>?/gm, "");
|
|
1403
|
-
const amount = String(metadata.amount ?? "").replace(/<[^>]*>?/gm, "");
|
|
1404
|
-
return `Sent ${amount} to ${recipient}`;
|
|
1405
|
-
}
|
|
1406
|
-
};
|
|
1407
|
-
wiseDepositConfig = {
|
|
1408
|
-
depositRequiresApproval: true,
|
|
1409
|
-
payeeDetailInputPlaceholder: "Enter your Wisetag without @",
|
|
1410
|
-
payeeDetailInputHelperText: "This is your Wisetag. Do not include the @ symbol.",
|
|
1411
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos. Do not include the @ symbol.",
|
|
1412
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
1413
|
-
return {
|
|
1414
|
-
wisetag: payeeDetails,
|
|
1415
|
-
telegramUsername: telegramUsername || ""
|
|
1416
|
-
};
|
|
1417
|
-
},
|
|
1418
|
-
getPayeeDetail: (data) => {
|
|
1419
|
-
return data.wisetag;
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
wiseConfig = {
|
|
1423
|
-
platformId: PaymentPlatform.WISE,
|
|
1424
|
-
platformName: "Wise",
|
|
1425
|
-
platformLogo: "",
|
|
1426
|
-
platformColor: "#163300",
|
|
1427
|
-
// Wise's brand blue color
|
|
1428
|
-
platformCurrencies: [
|
|
1429
|
-
Currency.USD,
|
|
1430
|
-
Currency.CNY,
|
|
1431
|
-
Currency.EUR,
|
|
1432
|
-
Currency.GBP,
|
|
1433
|
-
Currency.AUD,
|
|
1434
|
-
Currency.NZD,
|
|
1435
|
-
Currency.CAD,
|
|
1436
|
-
Currency.AED,
|
|
1437
|
-
Currency.CHF,
|
|
1438
|
-
Currency.ZAR,
|
|
1439
|
-
Currency.SGD,
|
|
1440
|
-
Currency.ILS,
|
|
1441
|
-
Currency.HKD,
|
|
1442
|
-
Currency.JPY,
|
|
1443
|
-
Currency.PLN,
|
|
1444
|
-
Currency.TRY,
|
|
1445
|
-
Currency.IDR,
|
|
1446
|
-
Currency.KES,
|
|
1447
|
-
Currency.MYR,
|
|
1448
|
-
Currency.MXN,
|
|
1449
|
-
Currency.THB,
|
|
1450
|
-
Currency.VND,
|
|
1451
|
-
Currency.UGX,
|
|
1452
|
-
// 29 July 2025
|
|
1453
|
-
Currency.CZK,
|
|
1454
|
-
Currency.DKK,
|
|
1455
|
-
Currency.HUF,
|
|
1456
|
-
Currency.INR,
|
|
1457
|
-
Currency.NOK,
|
|
1458
|
-
Currency.PHP,
|
|
1459
|
-
Currency.RON,
|
|
1460
|
-
Currency.SEK
|
|
1461
|
-
],
|
|
1462
|
-
minFiatAmount: "0.1",
|
|
1463
|
-
// 0.1 USD
|
|
1464
|
-
localeTimeString: "en-US",
|
|
1465
|
-
depositConfig: wiseDepositConfig,
|
|
1466
|
-
hasMultiplePaymentMethods: false,
|
|
1467
|
-
paymentMethods: [
|
|
1468
|
-
{
|
|
1469
|
-
sendConfig: wiseSendConfig,
|
|
1470
|
-
verifyConfig: wiseVerifyConfig
|
|
1471
|
-
}
|
|
1472
|
-
]
|
|
1473
|
-
};
|
|
1474
|
-
mercadoPagoSendConfig = {
|
|
1475
|
-
defaultPaymentMode: "WEB_PAYMENT",
|
|
1476
|
-
useCustomQRCode: true,
|
|
1477
|
-
payeeDetailPrefix: "CVU",
|
|
1478
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.mercadopago.com.ar/money-out/transfer/`,
|
|
1479
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.mercadopago.com.ar/money-out/transfer/`,
|
|
1480
|
-
supportsSendingPaymentOnWeb: true,
|
|
1481
|
-
showTroubleScanningQRCodeLink: true,
|
|
1482
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1483
|
-
return `IMPORTANT: Only make payments through the Mercado Pago website. Do not use the mobile app.`;
|
|
1484
|
-
},
|
|
1485
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1486
|
-
return `Double check that the CVU matches exactly before sending the payment. Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment.`;
|
|
1487
|
-
},
|
|
1488
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1489
|
-
{ text: "Use the Mercado Pago website to send", emphasize: ["Mercado Pago website"] },
|
|
1490
|
-
{ text: "Double check that the CVU matches exactly", emphasize: ["exactly", "CVU"] },
|
|
1491
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] }
|
|
1492
|
-
],
|
|
1493
|
-
sendPaymentDonts: () => [
|
|
1494
|
-
{ text: "Do not use the mobile app for this payment", emphasize: ["Do not", "mobile app"] }
|
|
1495
|
-
]
|
|
1496
|
-
};
|
|
1497
|
-
mercadoPagoVerifyConfig = {
|
|
1498
|
-
authLink: "https://www.mercadopago.com.ar/home",
|
|
1499
|
-
actionType: "transfer_mercadopago",
|
|
1500
|
-
actionPlatform: "mercadopago",
|
|
1501
|
-
numPaymentsFetched: 20,
|
|
1502
|
-
minExtensionVersion: "0.2.1",
|
|
1503
|
-
supportsAppclip: false,
|
|
1504
|
-
totalProofs: 1,
|
|
1505
|
-
parseExtractedParameters: (context) => {
|
|
1506
|
-
const contextObject = JSON.parse(context);
|
|
1507
|
-
const params = contextObject.extractedParameters;
|
|
1508
|
-
const date = new Date(params.date);
|
|
1509
|
-
const formattedDate = date.toLocaleString("es-AR", {
|
|
1510
|
-
year: "numeric",
|
|
1511
|
-
month: "short",
|
|
1512
|
-
day: "numeric",
|
|
1513
|
-
hour: "numeric",
|
|
1514
|
-
minute: "numeric",
|
|
1515
|
-
hour12: false,
|
|
1516
|
-
timeZone: "America/Argentina/Buenos_Aires"
|
|
1517
|
-
});
|
|
1518
|
-
const amount = Number(params.amt.replace("-", "")).toString();
|
|
1519
|
-
return {
|
|
1520
|
-
amount,
|
|
1521
|
-
date: formattedDate,
|
|
1522
|
-
currency: params.curr,
|
|
1523
|
-
paymentPlatform: PaymentPlatform.MERCADO_PAGO,
|
|
1524
|
-
paymentId: params.paymentId,
|
|
1525
|
-
recipient: params.recipientId,
|
|
1526
|
-
intentHash: contextObject.contextMessage,
|
|
1527
|
-
providerHash: contextObject.providerHash
|
|
1528
|
-
};
|
|
1529
|
-
},
|
|
1530
|
-
parseMetadata: (metadata) => {
|
|
1531
|
-
try {
|
|
1532
|
-
let amountStr = "";
|
|
1533
|
-
const amountValue = String(metadata.amount ?? "");
|
|
1534
|
-
if (amountValue) {
|
|
1535
|
-
const isSentTransaction = amountValue.startsWith("-");
|
|
1536
|
-
amountStr = isSentTransaction ? amountValue.substring(1) : amountValue;
|
|
1537
|
-
amountStr = amountStr.replace(/\./g, "").replace(/,/g, ".");
|
|
1538
|
-
amountStr = isSentTransaction ? amountStr : `-${amountStr}`;
|
|
1539
|
-
}
|
|
1540
|
-
const dateStr = new Date(metadata.date ?? "").toISOString();
|
|
1541
|
-
return {
|
|
1542
|
-
amount: amountStr,
|
|
1543
|
-
parsedAmount: false,
|
|
1544
|
-
// amountStr !== '',
|
|
1545
|
-
date: dateStr,
|
|
1546
|
-
parsedDate: false,
|
|
1547
|
-
// dateStr !== '',
|
|
1548
|
-
recipientId: "",
|
|
1549
|
-
parsedRecipientId: false,
|
|
1550
|
-
currency: "ARS",
|
|
1551
|
-
parsedCurrency: false
|
|
1552
|
-
// true,
|
|
1553
|
-
};
|
|
1554
|
-
} catch (error) {
|
|
1555
|
-
console.error("Error parsing Mercado Pago metadata", error);
|
|
1556
|
-
return {
|
|
1557
|
-
amount: "",
|
|
1558
|
-
parsedAmount: false,
|
|
1559
|
-
date: "",
|
|
1560
|
-
parsedDate: false,
|
|
1561
|
-
recipientId: "",
|
|
1562
|
-
parsedRecipientId: false,
|
|
1563
|
-
currency: "",
|
|
1564
|
-
parsedCurrency: false
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
},
|
|
1568
|
-
getSubjectText: (metadata) => {
|
|
1569
|
-
const amountValue = String(metadata.amount ?? "");
|
|
1570
|
-
const sentTransaction = amountValue.includes("-");
|
|
1571
|
-
if (sentTransaction) {
|
|
1572
|
-
const amount = amountValue.replace("-", "");
|
|
1573
|
-
return `Sent $ ${amount} to ${metadata.recipient}`;
|
|
1574
|
-
} else {
|
|
1575
|
-
return ``;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
};
|
|
1579
|
-
mercadoPagoDepositConfig = {
|
|
1580
|
-
depositRequiresApproval: false,
|
|
1581
|
-
payeeDetailInputPlaceholder: "Enter your Mercado Pago / Bank CVU",
|
|
1582
|
-
payeeDetailInputHelperText: "This is your Mercado Pago CVU. You can find it in your Mercado Pago account.",
|
|
1583
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos.",
|
|
1584
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
1585
|
-
return {
|
|
1586
|
-
cvu: payeeDetails,
|
|
1587
|
-
telegramUsername: telegramUsername || ""
|
|
1588
|
-
};
|
|
1589
|
-
},
|
|
1590
|
-
getPayeeDetail: (data) => {
|
|
1591
|
-
return data.cvu;
|
|
1592
|
-
}
|
|
1593
|
-
};
|
|
1594
|
-
mercadoPagoConfig = {
|
|
1595
|
-
platformId: PaymentPlatform.MERCADO_PAGO,
|
|
1596
|
-
platformName: "Mercado Pago",
|
|
1597
|
-
platformLogo: "",
|
|
1598
|
-
platformColor: "#00B1EA",
|
|
1599
|
-
// Mercado Pago's brand blue color
|
|
1600
|
-
platformCurrencies: [Currency.ARS],
|
|
1601
|
-
minFiatAmount: "1",
|
|
1602
|
-
// 1 ARS
|
|
1603
|
-
localeTimeString: "es-AR",
|
|
1604
|
-
depositConfig: mercadoPagoDepositConfig,
|
|
1605
|
-
hasMultiplePaymentMethods: false,
|
|
1606
|
-
paymentMethods: [
|
|
1607
|
-
{
|
|
1608
|
-
sendConfig: mercadoPagoSendConfig,
|
|
1609
|
-
verifyConfig: mercadoPagoVerifyConfig
|
|
1610
|
-
}
|
|
1611
|
-
]
|
|
1612
|
-
};
|
|
1613
|
-
encodeZelleRecipientId = (recipientId) => {
|
|
1614
|
-
const payload = {
|
|
1615
|
-
name: "",
|
|
1616
|
-
action: "payment",
|
|
1617
|
-
token: recipientId
|
|
1618
|
-
};
|
|
1619
|
-
return btoa(JSON.stringify(payload));
|
|
1620
|
-
};
|
|
1621
|
-
zelleBankOfAmericaSendConfig = {
|
|
1622
|
-
paymentMethodName: "Bank of America",
|
|
1623
|
-
paymentMethodIcon: void 0,
|
|
1624
|
-
// Icon provided by client-side assets
|
|
1625
|
-
defaultPaymentMode: "QR_CODE",
|
|
1626
|
-
useCustomQRCode: true,
|
|
1627
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.bankofamerica.com/`,
|
|
1628
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
1629
|
-
return `https://www.bankofamerica.com/movemoney`;
|
|
1630
|
-
},
|
|
1631
|
-
supportsSendingPaymentOnWeb: true,
|
|
1632
|
-
showTroubleScanningQRCodeLink: true,
|
|
1633
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1634
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment through Bank of America's Zelle.`;
|
|
1635
|
-
},
|
|
1636
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1637
|
-
return `Only use Bank of America. Scan the QR code and manually enter the recipient email. Double-check the email before sending.`;
|
|
1638
|
-
},
|
|
1639
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1640
|
-
{ text: "Use Bank of America", emphasize: ["Bank of America"] },
|
|
1641
|
-
{ text: "Scan the QR code and manually enter the recipient email", emphasize: ["manually", "recipient email"] },
|
|
1642
|
-
{ text: "Double-check the email before sending", emphasize: ["Double-check"] },
|
|
1643
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] }
|
|
1644
|
-
],
|
|
1645
|
-
sendPaymentDonts: () => [
|
|
1646
|
-
{ text: "Do not use any other bank", emphasize: ["Do not"] }
|
|
1647
|
-
]
|
|
1648
|
-
};
|
|
1649
|
-
zelleBankOfAmericaVerifyConfig = {
|
|
1650
|
-
authLink: "https://www.bankofamerica.com/",
|
|
1651
|
-
actionType: "transfer_zelle",
|
|
1652
|
-
actionPlatform: "bankofamerica",
|
|
1653
|
-
numPaymentsFetched: 15,
|
|
1654
|
-
minExtensionVersion: "0.2.1",
|
|
1655
|
-
supportsAppclip: false,
|
|
1656
|
-
totalProofs: 1,
|
|
1657
|
-
parseExtractedParameters: (context) => {
|
|
1658
|
-
const contextObject = JSON.parse(context);
|
|
1659
|
-
const params = contextObject.extractedParameters;
|
|
1660
|
-
const date = new Date(Number(params.date));
|
|
1661
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1662
|
-
year: "numeric",
|
|
1663
|
-
month: "short",
|
|
1664
|
-
day: "numeric",
|
|
1665
|
-
hour: "numeric",
|
|
1666
|
-
minute: "numeric",
|
|
1667
|
-
hour12: true
|
|
1668
|
-
});
|
|
1669
|
-
return {
|
|
1670
|
-
amount: params.amount,
|
|
1671
|
-
date: formattedDate,
|
|
1672
|
-
currency: params.currency_code,
|
|
1673
|
-
paymentPlatform: PaymentPlatform.ZELLE,
|
|
1674
|
-
paymentId: params.paymentId,
|
|
1675
|
-
recipient: params.receiverId,
|
|
1676
|
-
intentHash: contextObject.contextMessage,
|
|
1677
|
-
providerHash: contextObject.providerHash
|
|
1678
|
-
};
|
|
1679
|
-
},
|
|
1680
|
-
parseMetadata: (metadata) => {
|
|
1681
|
-
try {
|
|
1682
|
-
const amountStr = metadata.amount ?? "";
|
|
1683
|
-
let dateStr = metadata.date ?? "";
|
|
1684
|
-
if (dateStr && dateStr.length === 10) {
|
|
1685
|
-
dateStr = `${dateStr}T23:59:59`;
|
|
1686
|
-
}
|
|
1687
|
-
const recipientIdStr = metadata.recipient || "";
|
|
1688
|
-
return {
|
|
1689
|
-
amount: amountStr,
|
|
1690
|
-
parsedAmount: amountStr !== "",
|
|
1691
|
-
date: dateStr,
|
|
1692
|
-
parsedDate: dateStr !== "",
|
|
1693
|
-
recipientId: recipientIdStr,
|
|
1694
|
-
parsedRecipientId: false,
|
|
1695
|
-
currency: Currency.USD,
|
|
1696
|
-
parsedCurrency: true
|
|
1697
|
-
};
|
|
1698
|
-
} catch (error) {
|
|
1699
|
-
console.error("Error parsing Zelle Bank of America metadata", error);
|
|
1700
|
-
return {
|
|
1701
|
-
amount: "",
|
|
1702
|
-
parsedAmount: false,
|
|
1703
|
-
date: "",
|
|
1704
|
-
parsedDate: false,
|
|
1705
|
-
recipientId: "",
|
|
1706
|
-
parsedRecipientId: false,
|
|
1707
|
-
currency: "",
|
|
1708
|
-
parsedCurrency: false
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
},
|
|
1712
|
-
getSubjectText: (metadata) => {
|
|
1713
|
-
if (!metadata.amount || !metadata.recipient) {
|
|
1714
|
-
return "";
|
|
1715
|
-
}
|
|
1716
|
-
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1719
|
-
zelleChaseSendConfig = {
|
|
1720
|
-
paymentMethodName: "Chase",
|
|
1721
|
-
paymentMethodIcon: void 0,
|
|
1722
|
-
// Icon provided by client-side assets
|
|
1723
|
-
defaultPaymentMode: "QR_CODE",
|
|
1724
|
-
useCustomQRCode: true,
|
|
1725
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/singleDoorController/index`,
|
|
1726
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
1727
|
-
const encodedRecipientId = encodeZelleRecipientId(recipientId);
|
|
1728
|
-
return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
|
|
1729
|
-
},
|
|
1730
|
-
supportsSendingPaymentOnWeb: true,
|
|
1731
|
-
showTroubleScanningQRCodeLink: true,
|
|
1732
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1733
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment through Chase's Zelle.`;
|
|
1734
|
-
},
|
|
1735
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1736
|
-
return `Do not send using any other bank.`;
|
|
1737
|
-
},
|
|
1738
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1739
|
-
{ text: "Use Chase for this payment", emphasize: ["Chase"] },
|
|
1740
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] }
|
|
1741
|
-
],
|
|
1742
|
-
sendPaymentDonts: () => [
|
|
1743
|
-
{ text: "Do not send using any other bank", emphasize: ["Do not"] }
|
|
1744
|
-
]
|
|
1745
|
-
};
|
|
1746
|
-
zelleChaseVerifyConfig = {
|
|
1747
|
-
authLink: "https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/payments/activity;params=qp,sentactivity",
|
|
1748
|
-
actionType: "transfer_zelle",
|
|
1749
|
-
actionPlatform: "chase",
|
|
1750
|
-
numPaymentsFetched: 15,
|
|
1751
|
-
minExtensionVersion: "0.2.1",
|
|
1752
|
-
supportsAppclip: false,
|
|
1753
|
-
totalProofs: 2,
|
|
1754
|
-
parseExtractedParameters: (context) => {
|
|
1755
|
-
const contextObject = JSON.parse(context);
|
|
1756
|
-
const params = contextObject.extractedParameters;
|
|
1757
|
-
const date = new Date(Number(params.date));
|
|
1758
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1759
|
-
year: "numeric",
|
|
1760
|
-
month: "short",
|
|
1761
|
-
day: "numeric",
|
|
1762
|
-
hour: "numeric",
|
|
1763
|
-
minute: "numeric",
|
|
1764
|
-
hour12: true
|
|
1765
|
-
});
|
|
1766
|
-
return {
|
|
1767
|
-
amount: params.amount,
|
|
1768
|
-
date: formattedDate,
|
|
1769
|
-
currency: params.currency_code,
|
|
1770
|
-
paymentPlatform: PaymentPlatform.ZELLE,
|
|
1771
|
-
paymentId: params.paymentId,
|
|
1772
|
-
recipient: params.receiverId,
|
|
1773
|
-
intentHash: contextObject.contextMessage,
|
|
1774
|
-
providerHash: contextObject.providerHash
|
|
1775
|
-
};
|
|
1776
|
-
},
|
|
1777
|
-
parseMetadata: (metadata) => {
|
|
1778
|
-
try {
|
|
1779
|
-
const amountStr = metadata.amount ?? "";
|
|
1780
|
-
let dateStr = metadata.date ?? "";
|
|
1781
|
-
if (dateStr && dateStr.length === 8) {
|
|
1782
|
-
const year = dateStr.substring(0, 4);
|
|
1783
|
-
const month = dateStr.substring(4, 6);
|
|
1784
|
-
const day = dateStr.substring(6, 8);
|
|
1785
|
-
dateStr = `${year}-${month}-${day}T23:59:59`;
|
|
1786
|
-
}
|
|
1787
|
-
const recipientIdStr = metadata.recipient || "";
|
|
1788
|
-
return {
|
|
1789
|
-
amount: amountStr,
|
|
1790
|
-
parsedAmount: amountStr !== "",
|
|
1791
|
-
date: dateStr,
|
|
1792
|
-
parsedDate: dateStr !== "",
|
|
1793
|
-
recipientId: recipientIdStr,
|
|
1794
|
-
parsedRecipientId: false,
|
|
1795
|
-
currency: Currency.USD,
|
|
1796
|
-
parsedCurrency: true
|
|
1797
|
-
};
|
|
1798
|
-
} catch (error) {
|
|
1799
|
-
console.error("Error parsing Zelle Chase metadata", error);
|
|
1800
|
-
return {
|
|
1801
|
-
amount: "",
|
|
1802
|
-
parsedAmount: false,
|
|
1803
|
-
date: "",
|
|
1804
|
-
parsedDate: false,
|
|
1805
|
-
recipientId: "",
|
|
1806
|
-
parsedRecipientId: false,
|
|
1807
|
-
currency: "",
|
|
1808
|
-
parsedCurrency: false
|
|
1809
|
-
};
|
|
1810
|
-
}
|
|
1811
|
-
},
|
|
1812
|
-
getSubjectText: (metadata) => {
|
|
1813
|
-
if (!metadata.amount || !metadata.recipient) {
|
|
1814
|
-
return "";
|
|
1815
|
-
}
|
|
1816
|
-
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
1817
|
-
}
|
|
1818
|
-
};
|
|
1819
|
-
zelleCitiSendConfig = {
|
|
1820
|
-
paymentMethodName: "Citi",
|
|
1821
|
-
paymentMethodIcon: void 0,
|
|
1822
|
-
// Icon provided by client-side assets
|
|
1823
|
-
defaultPaymentMode: "QR_CODE",
|
|
1824
|
-
useCustomQRCode: true,
|
|
1825
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://online.citi.com/US/nga/zelle/transfer`,
|
|
1826
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
1827
|
-
const encodedRecipientId = encodeZelleRecipientId(recipientId);
|
|
1828
|
-
return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
|
|
1829
|
-
},
|
|
1830
|
-
supportsSendingPaymentOnWeb: true,
|
|
1831
|
-
showTroubleScanningQRCodeLink: true,
|
|
1832
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1833
|
-
return `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment through Citi's Zelle.`;
|
|
1834
|
-
},
|
|
1835
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1836
|
-
return `Do not send using any other bank.`;
|
|
1837
|
-
},
|
|
1838
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1839
|
-
{ text: "Use Citi for this payment", emphasize: ["Citi"] },
|
|
1840
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] }
|
|
1841
|
-
],
|
|
1842
|
-
sendPaymentDonts: () => [
|
|
1843
|
-
{ text: "Do not send using any other bank", emphasize: ["Do not"] }
|
|
1844
|
-
]
|
|
1845
|
-
};
|
|
1846
|
-
zelleCitiVerifyConfig = {
|
|
1847
|
-
authLink: "https://online.citi.com/US/nga/zelle/transfer",
|
|
1848
|
-
actionType: "transfer_zelle",
|
|
1849
|
-
actionPlatform: "citi",
|
|
1850
|
-
numPaymentsFetched: 15,
|
|
1851
|
-
minExtensionVersion: "0.2.1",
|
|
1852
|
-
supportsAppclip: false,
|
|
1853
|
-
totalProofs: 1,
|
|
1854
|
-
parseExtractedParameters: (context) => {
|
|
1855
|
-
const contextObject = JSON.parse(context);
|
|
1856
|
-
const params = contextObject.extractedParameters;
|
|
1857
|
-
const date = new Date(Number(params.date));
|
|
1858
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
1859
|
-
year: "numeric",
|
|
1860
|
-
month: "short",
|
|
1861
|
-
day: "numeric",
|
|
1862
|
-
hour: "numeric",
|
|
1863
|
-
minute: "numeric",
|
|
1864
|
-
hour12: true
|
|
1865
|
-
});
|
|
1866
|
-
return {
|
|
1867
|
-
amount: params.amount,
|
|
1868
|
-
date: formattedDate,
|
|
1869
|
-
currency: params.currency_code,
|
|
1870
|
-
paymentPlatform: PaymentPlatform.ZELLE,
|
|
1871
|
-
paymentId: params.paymentId,
|
|
1872
|
-
recipient: params.receiverId,
|
|
1873
|
-
intentHash: contextObject.contextMessage,
|
|
1874
|
-
providerHash: contextObject.providerHash
|
|
1875
|
-
};
|
|
1876
|
-
},
|
|
1877
|
-
parseMetadata: (metadata) => {
|
|
1878
|
-
try {
|
|
1879
|
-
const amountStr = metadata.amount ?? "";
|
|
1880
|
-
let dateStr = metadata.date ?? "";
|
|
1881
|
-
if (dateStr && dateStr.length === 8) {
|
|
1882
|
-
const year = dateStr.substring(0, 4);
|
|
1883
|
-
const month = dateStr.substring(4, 6);
|
|
1884
|
-
const day = dateStr.substring(6, 8);
|
|
1885
|
-
dateStr = `${year}-${month}-${day}T23:59:59`;
|
|
1886
|
-
}
|
|
1887
|
-
const recipientIdStr = metadata.recipient || "";
|
|
1888
|
-
return {
|
|
1889
|
-
amount: amountStr,
|
|
1890
|
-
parsedAmount: amountStr !== "",
|
|
1891
|
-
date: dateStr,
|
|
1892
|
-
parsedDate: dateStr !== "",
|
|
1893
|
-
recipientId: recipientIdStr,
|
|
1894
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
1895
|
-
currency: Currency.USD,
|
|
1896
|
-
parsedCurrency: true
|
|
1897
|
-
};
|
|
1898
|
-
} catch (error) {
|
|
1899
|
-
console.error("Error parsing Zelle Citi metadata", error);
|
|
1900
|
-
return {
|
|
1901
|
-
amount: "",
|
|
1902
|
-
parsedAmount: false,
|
|
1903
|
-
date: "",
|
|
1904
|
-
parsedDate: false,
|
|
1905
|
-
recipientId: "",
|
|
1906
|
-
parsedRecipientId: false,
|
|
1907
|
-
currency: "",
|
|
1908
|
-
parsedCurrency: false
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
},
|
|
1912
|
-
getSubjectText: (metadata) => {
|
|
1913
|
-
if (!metadata.amount || !metadata.recipient) {
|
|
1914
|
-
return "";
|
|
1915
|
-
}
|
|
1916
|
-
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
1917
|
-
}
|
|
1918
|
-
};
|
|
1919
|
-
zelleDepositConfig = {
|
|
1920
|
-
depositRequiresApproval: false,
|
|
1921
|
-
payeeDetailInputPlaceholder: "Enter your email",
|
|
1922
|
-
payeeDetailInputHelperText: "This is the email you use with Zelle",
|
|
1923
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your email",
|
|
1924
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
1925
|
-
return {
|
|
1926
|
-
zelleEmail: payeeDetails,
|
|
1927
|
-
telegramUsername: telegramUsername || ""
|
|
1928
|
-
};
|
|
1929
|
-
},
|
|
1930
|
-
getPayeeDetail: (data) => {
|
|
1931
|
-
return data.zelleEmail;
|
|
1932
|
-
}
|
|
1933
|
-
};
|
|
1934
|
-
zelleConfig = {
|
|
1935
|
-
platformId: PaymentPlatform.ZELLE,
|
|
1936
|
-
platformName: "Zelle",
|
|
1937
|
-
platformLogo: "",
|
|
1938
|
-
platformColor: "#6D1ED4",
|
|
1939
|
-
// Zelle's brand purple color
|
|
1940
|
-
platformCurrencies: [Currency.USD],
|
|
1941
|
-
minFiatAmount: "0.1",
|
|
1942
|
-
// 0.1 USD
|
|
1943
|
-
localeTimeString: "en-US",
|
|
1944
|
-
depositConfig: zelleDepositConfig,
|
|
1945
|
-
hasMultiplePaymentMethods: true,
|
|
1946
|
-
paymentMethods: [
|
|
1947
|
-
// Ensure payment method identifiers are same as that stored on the contract
|
|
1948
|
-
{
|
|
1949
|
-
sendConfig: zelleChaseSendConfig,
|
|
1950
|
-
verifyConfig: zelleChaseVerifyConfig
|
|
1951
|
-
},
|
|
1952
|
-
{
|
|
1953
|
-
sendConfig: zelleBankOfAmericaSendConfig,
|
|
1954
|
-
verifyConfig: zelleBankOfAmericaVerifyConfig
|
|
1955
|
-
},
|
|
1956
|
-
{
|
|
1957
|
-
sendConfig: zelleCitiSendConfig,
|
|
1958
|
-
verifyConfig: zelleCitiVerifyConfig
|
|
1959
|
-
}
|
|
1960
|
-
]
|
|
1961
|
-
};
|
|
1962
|
-
paypalSendConfig = {
|
|
1963
|
-
defaultPaymentMode: "WEB_PAYMENT",
|
|
1964
|
-
useCustomQRCode: true,
|
|
1965
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.paypal.com/myaccount/transfer/homepage`,
|
|
1966
|
-
// Mobile deep link into PayPal app
|
|
1967
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `paypal://`,
|
|
1968
|
-
supportsSendingPaymentOnWeb: true,
|
|
1969
|
-
showTroubleScanningQRCodeLink: true,
|
|
1970
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
1971
|
-
return `Make sure the "Your Send" amount is at least ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} after PayPal fees. Only personal PayPal accounts are supported (business/merchant accounts are not allowed).`;
|
|
1972
|
-
},
|
|
1973
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
1974
|
-
return `Ensure "Friends and Family" is selected as the recipient type. If "Goods and Services" is the only option, please DO NOT send the payment and report in the Help section. Please do not put zkp2p, crypto or any related terms in the payment notes or memo field.`;
|
|
1975
|
-
},
|
|
1976
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
1977
|
-
{ text: "Use a personal PayPal account", emphasize: ["personal"] },
|
|
1978
|
-
{ text: "Select Friends and Family", emphasize: ["Friends and Family"] },
|
|
1979
|
-
{ text: `Ensure Your Send is at least ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} after fees`, emphasize: ["at least", amountFiatToSend, currencyInfo[sendCurrency].currencyCode] }
|
|
1980
|
-
],
|
|
1981
|
-
sendPaymentDonts: () => [
|
|
1982
|
-
{ text: "Do not use a business or merchant account", emphasize: ["business", "merchant"] },
|
|
1983
|
-
{ text: "Do not include zkp2p, crypto, or related terms in the memo", emphasize: ["zkp2p", "crypto"] },
|
|
1984
|
-
{ text: "Avoid cross-currency conversion. If you do send the wrong currency, a 5% penalty will be automatically applied.", emphasize: ["cross-currency", "5% penalty"] },
|
|
1985
|
-
{ text: "Do not send as Goods and Services. You will lose funds.", emphasize: ["Goods and Services", "lose funds"] }
|
|
1986
|
-
]
|
|
1987
|
-
};
|
|
1988
|
-
paypalVerifyConfig = {
|
|
1989
|
-
authLink: "https://www.paypal.com/myaccount/activities/filter/?q=ZnJlZV90ZXh0X3NlYXJjaD0mc3RhcnRfZGF0ZT0yMDI1LTAxLTAxJmVuZF9kYXRlPTIwMzAtMTItMzEmdHlwZT0mc3RhdHVzPSZjdXJyZW5jeT0mZmlsdGVyX2lkPSZpc3N1YW5jZV9wcm9kdWN0X25hbWU9JmFzc2V0X25hbWVzPSZhc3NldF9zeW1ib2xzPQ",
|
|
1990
|
-
actionType: "transfer_paypal",
|
|
1991
|
-
actionPlatform: "paypal",
|
|
1992
|
-
numPaymentsFetched: 10,
|
|
1993
|
-
minExtensionVersion: "0.2.1",
|
|
1994
|
-
supportsAppclip: false,
|
|
1995
|
-
totalProofs: 1,
|
|
1996
|
-
parseExtractedParameters: (context) => {
|
|
1997
|
-
const contextObject = JSON.parse(context);
|
|
1998
|
-
const params = contextObject.extractedParameters;
|
|
1999
|
-
const date = new Date(params.date);
|
|
2000
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
2001
|
-
year: "numeric",
|
|
2002
|
-
month: "short",
|
|
2003
|
-
day: "numeric",
|
|
2004
|
-
hour: "numeric",
|
|
2005
|
-
minute: "numeric",
|
|
2006
|
-
hour12: true
|
|
2007
|
-
});
|
|
2008
|
-
const amount = Number(params.amount).toString();
|
|
2009
|
-
return {
|
|
2010
|
-
amount,
|
|
2011
|
-
date: formattedDate,
|
|
2012
|
-
currency: params.currencyCode,
|
|
2013
|
-
paymentPlatform: PaymentPlatform.PAYPAL,
|
|
2014
|
-
paymentId: params.paymentId,
|
|
2015
|
-
recipient: params.email,
|
|
2016
|
-
intentHash: contextObject.contextMessage,
|
|
2017
|
-
providerHash: contextObject.providerHash
|
|
2018
|
-
};
|
|
2019
|
-
},
|
|
2020
|
-
parseMetadata: (metadata) => {
|
|
2021
|
-
try {
|
|
2022
|
-
const amountStr = String(metadata.amount ?? "").split(" ")[0].replace(/[^0-9.]/g, "");
|
|
2023
|
-
const currencyStr = metadata.currency ?? "";
|
|
2024
|
-
const dateStr = metadata.date ?? "";
|
|
2025
|
-
const recipientIdStr = metadata.recipient || "";
|
|
2026
|
-
return {
|
|
2027
|
-
amount: amountStr,
|
|
2028
|
-
parsedAmount: amountStr !== "",
|
|
2029
|
-
date: dateStr,
|
|
2030
|
-
parsedDate: dateStr !== "",
|
|
2031
|
-
recipientId: recipientIdStr,
|
|
2032
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
2033
|
-
currency: currencyStr,
|
|
2034
|
-
parsedCurrency: currencyStr !== ""
|
|
2035
|
-
};
|
|
2036
|
-
} catch (error) {
|
|
2037
|
-
console.error("Error parsing Paypal metadata", error);
|
|
2038
|
-
return {
|
|
2039
|
-
amount: "",
|
|
2040
|
-
parsedAmount: false,
|
|
2041
|
-
date: "",
|
|
2042
|
-
parsedDate: false,
|
|
2043
|
-
recipientId: "",
|
|
2044
|
-
parsedRecipientId: false,
|
|
2045
|
-
currency: "",
|
|
2046
|
-
parsedCurrency: false
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
},
|
|
2050
|
-
getSubjectText: (metadata) => {
|
|
2051
|
-
const amountStr = String(metadata.amount ?? "").split(/\s+/)[0].replace(/[^0-9.]/g, "");
|
|
2052
|
-
const currencyStr = metadata.currency ?? "";
|
|
2053
|
-
if (metadata.type !== "SEND_MONEY_SENT") {
|
|
2054
|
-
return "";
|
|
2055
|
-
}
|
|
2056
|
-
return `Sent ${amountStr} ${currencyStr} to ${metadata.recipient}`;
|
|
2057
|
-
}
|
|
2058
|
-
};
|
|
2059
|
-
paypalDepositConfig = {
|
|
2060
|
-
depositRequiresApproval: false,
|
|
2061
|
-
payeeDetailInputPlaceholder: "Enter your Paypal email",
|
|
2062
|
-
payeeDetailInputHelperText: "This is your Paypal email",
|
|
2063
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your email.",
|
|
2064
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
2065
|
-
return {
|
|
2066
|
-
paypalEmail: payeeDetails,
|
|
2067
|
-
telegramUsername: telegramUsername || ""
|
|
2068
|
-
};
|
|
2069
|
-
},
|
|
2070
|
-
getPayeeDetail: (data) => {
|
|
2071
|
-
return data.paypalEmail;
|
|
2072
|
-
}
|
|
2073
|
-
};
|
|
2074
|
-
paypalConfig = {
|
|
2075
|
-
platformId: PaymentPlatform.PAYPAL,
|
|
2076
|
-
platformName: "Paypal",
|
|
2077
|
-
platformCurrencies: [
|
|
2078
|
-
Currency.USD,
|
|
2079
|
-
Currency.EUR,
|
|
2080
|
-
Currency.GBP,
|
|
2081
|
-
Currency.SGD,
|
|
2082
|
-
Currency.NZD,
|
|
2083
|
-
Currency.AUD,
|
|
2084
|
-
Currency.CAD
|
|
2085
|
-
],
|
|
2086
|
-
platformLogo: void 0,
|
|
2087
|
-
// paypalLogo - Legal counsel advised not to use logo
|
|
2088
|
-
platformColor: "#0070BA",
|
|
2089
|
-
// Paypal's brand blue color
|
|
2090
|
-
minFiatAmount: "0.1",
|
|
2091
|
-
// 0.1 USD
|
|
2092
|
-
localeTimeString: "en-US",
|
|
2093
|
-
depositConfig: paypalDepositConfig,
|
|
2094
|
-
hasMultiplePaymentMethods: false,
|
|
2095
|
-
paymentMethods: [
|
|
2096
|
-
{
|
|
2097
|
-
sendConfig: paypalSendConfig,
|
|
2098
|
-
verifyConfig: paypalVerifyConfig
|
|
2099
|
-
}
|
|
2100
|
-
]
|
|
2101
|
-
};
|
|
2102
|
-
monzoSendConfig = {
|
|
2103
|
-
defaultPaymentMode: "QR_CODE",
|
|
2104
|
-
useCustomQRCode: true,
|
|
2105
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://monzo.me/${recipientId}`,
|
|
2106
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `https://monzo.me/${recipientId}`,
|
|
2107
|
-
supportsSendingPaymentOnWeb: false,
|
|
2108
|
-
showTroubleScanningQRCodeLink: true,
|
|
2109
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
2110
|
-
return `Send ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment.`;
|
|
2111
|
-
},
|
|
2112
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
2113
|
-
return `Use the Monzo app to send payment. Do not pay via card.`;
|
|
2114
|
-
},
|
|
2115
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
2116
|
-
{ text: "Use the Monzo app to send payment", emphasize: ["Monzo app"] },
|
|
2117
|
-
{ text: `Send exactly ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode} in a single payment`, emphasize: ["exactly", amountFiatToSend, currencyInfo[sendCurrency].currencyCode, "single"] }
|
|
2118
|
-
],
|
|
2119
|
-
sendPaymentDonts: () => [
|
|
2120
|
-
{ text: "Do not pay via card", emphasize: ["Do not", "card"] }
|
|
2121
|
-
]
|
|
2122
|
-
};
|
|
2123
|
-
monzoVerifyConfig = {
|
|
2124
|
-
authLink: "https://web.monzo.com/",
|
|
2125
|
-
actionType: "transfer_monzo",
|
|
2126
|
-
actionPlatform: "monzo",
|
|
2127
|
-
numPaymentsFetched: 10,
|
|
2128
|
-
minExtensionVersion: "0.2.1",
|
|
2129
|
-
supportsAppclip: false,
|
|
2130
|
-
totalProofs: 1,
|
|
2131
|
-
parseExtractedParameters: (context) => {
|
|
2132
|
-
const contextObject = JSON.parse(context);
|
|
2133
|
-
const params = contextObject.extractedParameters;
|
|
2134
|
-
const date = new Date(params.completedDate);
|
|
2135
|
-
const formattedDate = date.toLocaleString("en-GB", {
|
|
2136
|
-
year: "numeric",
|
|
2137
|
-
month: "short",
|
|
2138
|
-
day: "numeric",
|
|
2139
|
-
hour: "numeric",
|
|
2140
|
-
minute: "numeric",
|
|
2141
|
-
hour12: true
|
|
2142
|
-
});
|
|
2143
|
-
const amount = (Number(params.amount.replace("-", "")) / 100).toString();
|
|
2144
|
-
return {
|
|
2145
|
-
amount,
|
|
2146
|
-
date: formattedDate,
|
|
2147
|
-
currency: params.currency,
|
|
2148
|
-
paymentPlatform: PaymentPlatform.MONZO,
|
|
2149
|
-
paymentId: params.TX_ID,
|
|
2150
|
-
recipient: params.userId,
|
|
2151
|
-
intentHash: contextObject.contextMessage,
|
|
2152
|
-
providerHash: contextObject.providerHash
|
|
2153
|
-
};
|
|
2154
|
-
},
|
|
2155
|
-
parseMetadata: (metadata) => {
|
|
2156
|
-
try {
|
|
2157
|
-
const amountUnits = Number(metadata.amount) * -1 / 100;
|
|
2158
|
-
const amountStr = parseFloat(amountUnits.toFixed(2)).toString();
|
|
2159
|
-
const currencyStr = metadata.currency ?? "";
|
|
2160
|
-
const dateStr = metadata.date ?? "";
|
|
2161
|
-
const recipientIdStr = metadata.recipient || "";
|
|
2162
|
-
return {
|
|
2163
|
-
amount: amountStr,
|
|
2164
|
-
parsedAmount: amountStr !== "",
|
|
2165
|
-
date: dateStr,
|
|
2166
|
-
parsedDate: dateStr !== "",
|
|
2167
|
-
recipientId: recipientIdStr,
|
|
2168
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
2169
|
-
currency: currencyStr,
|
|
2170
|
-
parsedCurrency: currencyStr !== ""
|
|
2171
|
-
};
|
|
2172
|
-
} catch (error) {
|
|
2173
|
-
console.error("Error parsing Monzo metadata", error);
|
|
2174
|
-
return {
|
|
2175
|
-
amount: "",
|
|
2176
|
-
parsedAmount: false,
|
|
2177
|
-
date: "",
|
|
2178
|
-
parsedDate: false,
|
|
2179
|
-
recipientId: "",
|
|
2180
|
-
parsedRecipientId: false,
|
|
2181
|
-
currency: "",
|
|
2182
|
-
parsedCurrency: false
|
|
2183
|
-
};
|
|
2184
|
-
}
|
|
2185
|
-
},
|
|
2186
|
-
getSubjectText: (metadata) => {
|
|
2187
|
-
if (Number(metadata.amount) < 0 && metadata.recipientName && metadata.recipientName !== void 0 && metadata.recipientName !== "") {
|
|
2188
|
-
const currencySymbol = currencyInfo[metadata.currency ?? ""]?.currencySymbol ?? "";
|
|
2189
|
-
const monzoFormattedAmount = Number(metadata.amount) * -1 / 100;
|
|
2190
|
-
return `Sent ${currencySymbol}${monzoFormattedAmount} to ${metadata.recipientName} `;
|
|
2191
|
-
} else {
|
|
2192
|
-
return ``;
|
|
2193
|
-
}
|
|
2194
|
-
},
|
|
2195
|
-
reverseTransactionHistoryOrder: true
|
|
2196
|
-
};
|
|
2197
|
-
monzoDepositConfig = {
|
|
2198
|
-
depositRequiresApproval: false,
|
|
2199
|
-
payeeDetailInputPlaceholder: "Enter your Monzo.me username",
|
|
2200
|
-
payeeDetailInputHelperText: "This is your Monzo.me username",
|
|
2201
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your username.",
|
|
2202
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
2203
|
-
return {
|
|
2204
|
-
monzoMeUsername: payeeDetails,
|
|
2205
|
-
telegramUsername: telegramUsername || ""
|
|
2206
|
-
};
|
|
2207
|
-
},
|
|
2208
|
-
getPayeeDetail: (data) => {
|
|
2209
|
-
return data.monzoMeUsername;
|
|
2210
|
-
}
|
|
2211
|
-
};
|
|
2212
|
-
monzoConfig = {
|
|
2213
|
-
platformId: PaymentPlatform.MONZO,
|
|
2214
|
-
platformName: "Monzo",
|
|
2215
|
-
platformCurrencies: [
|
|
2216
|
-
Currency.GBP
|
|
2217
|
-
],
|
|
2218
|
-
platformLogo: "",
|
|
2219
|
-
platformColor: "#112231",
|
|
2220
|
-
minFiatAmount: "0.1",
|
|
2221
|
-
// 0.1 GBP
|
|
2222
|
-
localeTimeString: "en-GB",
|
|
2223
|
-
depositConfig: monzoDepositConfig,
|
|
2224
|
-
hasMultiplePaymentMethods: false,
|
|
2225
|
-
paymentMethods: [
|
|
2226
|
-
{
|
|
2227
|
-
sendConfig: monzoSendConfig,
|
|
2228
|
-
verifyConfig: monzoVerifyConfig
|
|
2229
|
-
}
|
|
2230
|
-
]
|
|
2231
|
-
};
|
|
2232
|
-
formatAmountFromCents = (cents) => {
|
|
2233
|
-
return parseFloat((cents / 100).toFixed(2)).toString();
|
|
2234
|
-
};
|
|
2235
|
-
n26SendConfig = {
|
|
2236
|
-
defaultPaymentMode: "QR_CODE",
|
|
2237
|
-
useCustomQRCode: true,
|
|
2238
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://app.n26.com/`,
|
|
2239
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `number26://`,
|
|
2240
|
-
supportsSendingPaymentOnWeb: true,
|
|
2241
|
-
showTroubleScanningQRCodeLink: true,
|
|
2242
|
-
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
2243
|
-
{ text: `Enter the recipient's IBAN. You can use any name for the recipient.`, emphasize: ["You can use any name for the recipient"] },
|
|
2244
|
-
{ text: `Send at least ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode}`, emphasize: [amountFiatToSend] }
|
|
2245
|
-
],
|
|
2246
|
-
sendPaymentDonts: (sendCurrency, amountFiatToSend) => [
|
|
2247
|
-
{ text: `Do not send less than the required amount` },
|
|
2248
|
-
{ text: `Do not include zkp2p, crypto, or related terms in the memo` }
|
|
2249
|
-
]
|
|
2250
|
-
};
|
|
2251
|
-
n26VerifyConfig = {
|
|
2252
|
-
authLink: "https://app.n26.com/",
|
|
2253
|
-
actionType: "transfer_n26",
|
|
2254
|
-
actionPlatform: "n26",
|
|
2255
|
-
numPaymentsFetched: 1,
|
|
2256
|
-
minExtensionVersion: "0.2.3",
|
|
2257
|
-
supportsAppclip: false,
|
|
2258
|
-
totalProofs: 1,
|
|
2259
|
-
parseExtractedParameters: (context) => {
|
|
2260
|
-
const contextObject = JSON.parse(context);
|
|
2261
|
-
const params = contextObject.extractedParameters;
|
|
2262
|
-
const date = new Date(params.date);
|
|
2263
|
-
const formattedDate = date.toLocaleString("en-US", {
|
|
2264
|
-
year: "numeric",
|
|
2265
|
-
month: "short",
|
|
2266
|
-
day: "numeric",
|
|
2267
|
-
hour: "numeric",
|
|
2268
|
-
minute: "numeric",
|
|
2269
|
-
hour12: true
|
|
2270
|
-
});
|
|
2271
|
-
const amount = formatAmountFromCents(Number(params.amount));
|
|
2272
|
-
return {
|
|
2273
|
-
amount,
|
|
2274
|
-
date: formattedDate,
|
|
2275
|
-
currency: params.currency,
|
|
2276
|
-
paymentPlatform: PaymentPlatform.N26,
|
|
2277
|
-
paymentId: params.paymentId,
|
|
2278
|
-
recipient: params.recipientId,
|
|
2279
|
-
intentHash: contextObject.contextMessage,
|
|
2280
|
-
providerHash: contextObject.providerHash
|
|
2281
|
-
};
|
|
2282
|
-
},
|
|
2283
|
-
parseMetadata: (metadata) => {
|
|
2284
|
-
try {
|
|
2285
|
-
const amountStr = String(metadata.amount ?? "").split(" ")[0].replace(/[^0-9.]/g, "");
|
|
2286
|
-
const currencyStr = metadata.currency ?? "";
|
|
2287
|
-
const dateStr = metadata.date ?? "";
|
|
2288
|
-
const recipientIdStr = metadata.recipient || "";
|
|
2289
|
-
return {
|
|
2290
|
-
amount: amountStr,
|
|
2291
|
-
parsedAmount: amountStr !== "",
|
|
2292
|
-
date: dateStr,
|
|
2293
|
-
parsedDate: dateStr !== "",
|
|
2294
|
-
recipientId: recipientIdStr,
|
|
2295
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
2296
|
-
currency: currencyStr,
|
|
2297
|
-
parsedCurrency: currencyStr !== ""
|
|
2298
|
-
};
|
|
2299
|
-
} catch (error) {
|
|
2300
|
-
console.error("Error parsing N26 metadata", error);
|
|
2301
|
-
return {
|
|
2302
|
-
amount: "",
|
|
2303
|
-
parsedAmount: false,
|
|
2304
|
-
date: "",
|
|
2305
|
-
parsedDate: false,
|
|
2306
|
-
recipientId: "",
|
|
2307
|
-
parsedRecipientId: false,
|
|
2308
|
-
currency: "",
|
|
2309
|
-
parsedCurrency: false
|
|
2310
|
-
};
|
|
2311
|
-
}
|
|
2312
|
-
},
|
|
2313
|
-
getSubjectText: (metadata) => {
|
|
2314
|
-
const amountStr = formatAmountFromCents(
|
|
2315
|
-
Number(
|
|
2316
|
-
String(metadata.amount ?? "").split(/\s+/)[0].replace(/[^0-9.]/g, "")
|
|
2317
|
-
)
|
|
2318
|
-
);
|
|
2319
|
-
const currencyStr = metadata.currency ?? "";
|
|
2320
|
-
return `Sent ${amountStr} ${currencyStr} to ${metadata.recipient}`;
|
|
2321
|
-
}
|
|
2322
|
-
};
|
|
2323
|
-
n26DepositConfig = {
|
|
2324
|
-
depositRequiresApproval: false,
|
|
2325
|
-
payeeDetailInputPlaceholder: "Enter your IBAN",
|
|
2326
|
-
payeeDetailInputHelperText: "This is your IBAN. You may enter any valid IBAN.",
|
|
2327
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your IBAN.",
|
|
2328
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
2329
|
-
return {
|
|
2330
|
-
iban: payeeDetails.replace(/\s/g, ""),
|
|
2331
|
-
telegramUsername: telegramUsername || ""
|
|
2332
|
-
};
|
|
2333
|
-
},
|
|
2334
|
-
getPayeeDetail: (data) => {
|
|
2335
|
-
return data.iban;
|
|
2336
|
-
}
|
|
2337
|
-
};
|
|
2338
|
-
n26Config = {
|
|
2339
|
-
platformId: PaymentPlatform.N26,
|
|
2340
|
-
platformName: "N26",
|
|
2341
|
-
platformCurrencies: [
|
|
2342
|
-
Currency.EUR
|
|
2343
|
-
],
|
|
2344
|
-
platformLogo: void 0,
|
|
2345
|
-
// Logo provided by client-side assets
|
|
2346
|
-
platformColor: "#121212",
|
|
2347
|
-
// N26's brand black color
|
|
2348
|
-
minFiatAmount: "0.1",
|
|
2349
|
-
localeTimeString: "en-US",
|
|
2350
|
-
depositConfig: n26DepositConfig,
|
|
2351
|
-
hasMultiplePaymentMethods: false,
|
|
2352
|
-
paymentMethods: [
|
|
2353
|
-
{
|
|
2354
|
-
sendConfig: n26SendConfig,
|
|
2355
|
-
verifyConfig: n26VerifyConfig
|
|
2356
|
-
}
|
|
2357
|
-
]
|
|
2358
|
-
};
|
|
2359
|
-
decodeUnicodeEscapes = (str) => {
|
|
2360
|
-
return str.replace(
|
|
2361
|
-
/\\\\u([0-9a-fA-F]{4})|\\u([0-9a-fA-F]{4})/g,
|
|
2362
|
-
(_, doubleHex, singleHex) => String.fromCharCode(parseInt(doubleHex || singleHex, 16))
|
|
2363
|
-
);
|
|
2364
|
-
};
|
|
2365
|
-
parseAlipayAmount = (amount) => {
|
|
2366
|
-
if (!amount) return null;
|
|
2367
|
-
const trimmed = amount.trim();
|
|
2368
|
-
if (!trimmed.startsWith("-")) return null;
|
|
2369
|
-
return trimmed.replace(/^-\s*/, "");
|
|
2370
|
-
};
|
|
2371
|
-
parseAlipayDate = (dateStr) => {
|
|
2372
|
-
if (!dateStr) return "";
|
|
2373
|
-
if (dateStr.includes("\uFFFD") || dateStr.includes("\uFFFD")) {
|
|
2374
|
-
const timeMatch = dateStr.match(/(\d{1,2}:\d{2})/);
|
|
2375
|
-
const today = /* @__PURE__ */ new Date();
|
|
2376
|
-
const datePrefix = today.toISOString().split("T")[0];
|
|
2377
|
-
return timeMatch ? `${datePrefix} ${timeMatch[1]}` : datePrefix;
|
|
2378
|
-
}
|
|
2379
|
-
return dateStr;
|
|
2380
|
-
};
|
|
2381
|
-
alipaySendConfig = {
|
|
2382
|
-
defaultPaymentMode: "QR_CODE",
|
|
2383
|
-
useCustomQRCode: true,
|
|
2384
|
-
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.alipay.com/`,
|
|
2385
|
-
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => `alipays://`,
|
|
2386
|
-
supportsSendingPaymentOnWeb: true,
|
|
2387
|
-
showTroubleScanningQRCodeLink: true,
|
|
2388
|
-
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
2389
|
-
return `Make sure the "Your Send" amount is at least ${amountFiatToSend} ${currencyInfo[sendCurrency].currencyCode}.`;
|
|
2390
|
-
},
|
|
2391
|
-
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
2392
|
-
return `Ensure that you send the exact amount to the Alipay recipient.`;
|
|
2393
|
-
}
|
|
2394
|
-
};
|
|
2395
|
-
alipayVerifyConfig = {
|
|
2396
|
-
authLink: "https://www.alipay.com/",
|
|
2397
|
-
actionType: "transfer_alipay",
|
|
2398
|
-
actionPlatform: "alipay",
|
|
2399
|
-
numPaymentsFetched: 1,
|
|
2400
|
-
minExtensionVersion: "0.2.3",
|
|
2401
|
-
supportsAppclip: false,
|
|
2402
|
-
totalProofs: 1,
|
|
2403
|
-
parseExtractedParameters: (context) => {
|
|
2404
|
-
const contextObject = JSON.parse(context);
|
|
2405
|
-
const params = contextObject.extractedParameters;
|
|
2406
|
-
const date = new Date(params.date);
|
|
2407
|
-
const formattedDate = date.toLocaleString("zh-CN", {
|
|
2408
|
-
year: "numeric",
|
|
2409
|
-
month: "short",
|
|
2410
|
-
day: "numeric",
|
|
2411
|
-
hour: "numeric",
|
|
2412
|
-
minute: "numeric",
|
|
2413
|
-
hour12: false
|
|
2414
|
-
});
|
|
2415
|
-
const amount = Number(params.amount).toString();
|
|
2416
|
-
return {
|
|
2417
|
-
amount,
|
|
2418
|
-
date: formattedDate,
|
|
2419
|
-
currency: params.currency,
|
|
2420
|
-
paymentPlatform: PaymentPlatform.ALIPAY,
|
|
2421
|
-
paymentId: params.paymentId,
|
|
2422
|
-
recipient: params.recipientId,
|
|
2423
|
-
intentHash: contextObject.contextMessage,
|
|
2424
|
-
providerHash: contextObject.providerHash
|
|
2425
|
-
};
|
|
2426
|
-
},
|
|
2427
|
-
parseMetadata: (metadata) => {
|
|
2428
|
-
try {
|
|
2429
|
-
const amountStr = parseAlipayAmount(metadata.amount) ?? "";
|
|
2430
|
-
const currencyStr = metadata.currency ?? "";
|
|
2431
|
-
const dateStr = parseAlipayDate(metadata.date);
|
|
2432
|
-
const recipientIdStr = decodeUnicodeEscapes(metadata.recipient || "");
|
|
2433
|
-
return {
|
|
2434
|
-
amount: amountStr,
|
|
2435
|
-
parsedAmount: amountStr !== "",
|
|
2436
|
-
date: dateStr,
|
|
2437
|
-
parsedDate: dateStr !== "",
|
|
2438
|
-
recipientId: recipientIdStr,
|
|
2439
|
-
parsedRecipientId: recipientIdStr !== "",
|
|
2440
|
-
currency: currencyStr,
|
|
2441
|
-
parsedCurrency: currencyStr !== ""
|
|
2442
|
-
};
|
|
2443
|
-
} catch (error) {
|
|
2444
|
-
console.error("Error parsing Alipay metadata", error);
|
|
2445
|
-
return {
|
|
2446
|
-
amount: "",
|
|
2447
|
-
parsedAmount: false,
|
|
2448
|
-
date: "",
|
|
2449
|
-
parsedDate: false,
|
|
2450
|
-
recipientId: "",
|
|
2451
|
-
parsedRecipientId: false,
|
|
2452
|
-
currency: "",
|
|
2453
|
-
parsedCurrency: false
|
|
2454
|
-
};
|
|
2455
|
-
}
|
|
2456
|
-
},
|
|
2457
|
-
getSubjectText: (metadata) => {
|
|
2458
|
-
const amountStr = parseAlipayAmount(metadata.amount) ?? metadata.amount ?? "";
|
|
2459
|
-
const recipient = decodeUnicodeEscapes(metadata.recipient ?? "");
|
|
2460
|
-
return `Sent ${amountStr} CNY to ${recipient}`;
|
|
2461
|
-
}
|
|
2462
|
-
};
|
|
2463
|
-
alipayDepositConfig = {
|
|
2464
|
-
depositRequiresApproval: true,
|
|
2465
|
-
payeeDetailInputPlaceholder: "Enter your email or phone number",
|
|
2466
|
-
payeeDetailInputHelperText: "This is your email or phone number",
|
|
2467
|
-
payeeDetailValidationFailureMessage: "Make sure there are no typos in your email or phone number.",
|
|
2468
|
-
getDepositData: (payeeDetails, telegramUsername) => {
|
|
2469
|
-
return {
|
|
2470
|
-
alipayId: payeeDetails,
|
|
2471
|
-
telegramUsername: telegramUsername || ""
|
|
2472
|
-
};
|
|
2473
|
-
},
|
|
2474
|
-
getPayeeDetail: (data) => {
|
|
2475
|
-
return data.alipayId;
|
|
2476
|
-
}
|
|
2477
|
-
};
|
|
2478
|
-
alipayConfig = {
|
|
2479
|
-
platformId: PaymentPlatform.ALIPAY,
|
|
2480
|
-
platformName: "Alipay",
|
|
2481
|
-
platformCurrencies: [
|
|
2482
|
-
Currency.CNY
|
|
2483
|
-
],
|
|
2484
|
-
platformLogo: "",
|
|
2485
|
-
platformColor: "#1677FF",
|
|
2486
|
-
// Alipay's brand blue color
|
|
2487
|
-
minFiatAmount: "0.1",
|
|
2488
|
-
localeTimeString: "zh-CN",
|
|
2489
|
-
depositConfig: alipayDepositConfig,
|
|
2490
|
-
hasMultiplePaymentMethods: false,
|
|
2491
|
-
paymentMethods: [
|
|
2492
|
-
{
|
|
2493
|
-
sendConfig: alipaySendConfig,
|
|
2494
|
-
verifyConfig: alipayVerifyConfig
|
|
2495
|
-
}
|
|
2496
|
-
]
|
|
2497
|
-
};
|
|
2498
|
-
({
|
|
2499
|
-
[PaymentPlatform.VENMO]: venmoConfig,
|
|
2500
|
-
[PaymentPlatform.CASHAPP]: cashappConfig,
|
|
2501
|
-
[PaymentPlatform.CHIME]: chimeConfig,
|
|
2502
|
-
[PaymentPlatform.REVOLUT]: revolutConfig,
|
|
2503
|
-
[PaymentPlatform.ZELLE]: zelleConfig,
|
|
2504
|
-
[PaymentPlatform.PAYPAL]: paypalConfig,
|
|
2505
|
-
[PaymentPlatform.WISE]: wiseConfig,
|
|
2506
|
-
[PaymentPlatform.MERCADO_PAGO]: mercadoPagoConfig,
|
|
2507
|
-
[PaymentPlatform.MONZO]: monzoConfig,
|
|
2508
|
-
[PaymentPlatform.N26]: n26Config,
|
|
2509
|
-
[PaymentPlatform.ALIPAY]: alipayConfig
|
|
2510
|
-
});
|
|
2511
|
-
METHOD_NAME_TO_HASH = {
|
|
2512
|
-
venmo: "0x90262a3db0edd0be2369c6b28f9e8511ec0bac7136cefbada0880602f87e7268",
|
|
2513
|
-
revolut: "0x617f88ab82b5c1b014c539f7e75121427f0bb50a4c58b187a238531e7d58605d",
|
|
2514
|
-
cashapp: "0x10940ee67cfb3c6c064569ec92c0ee934cd7afa18dd2ca2d6a2254fcb009c17d",
|
|
2515
|
-
chime: "0x5908bb0c9b87763ac6171d4104847667e7f02b4c47b574fe890c1f439ed128bb",
|
|
2516
|
-
wise: "0x554a007c2217df766b977723b276671aee5ebb4adaea0edb6433c88b3e61dac5",
|
|
2517
|
-
mercadopago: "0xa5418819c024239299ea32e09defae8ec412c03e58f5c75f1b2fe84c857f5483",
|
|
2518
|
-
"zelle-citi": "0x817260692b75e93c7fbc51c71637d4075a975e221e1ebc1abeddfabd731fd90d",
|
|
2519
|
-
"zelle-chase": "0x6aa1d1401e79ad0549dced8b1b96fb72c41cd02b32a7d9ea1fed54ba9e17152e",
|
|
2520
|
-
"zelle-bofa": "0x4bc42b322a3ad413b91b2fde30549ca70d6ee900eded1681de91aaf32ffd7ab5",
|
|
2521
|
-
paypal: "0x3ccc3d4d5e769b1f82dc4988485551dc0cd3c7a3926d7d8a4dde91507199490f",
|
|
2522
|
-
monzo: "0x62c7ed738ad3e7618111348af32691b5767777fbaf46a2d8943237625552645c",
|
|
2523
|
-
n26: "0xd9ff4fd6b39a3e3dd43c41d05662a5547de4a878bc97a65bcb352ade493cdc6b",
|
|
2524
|
-
alipay: "0xcac9daea62d7b89d75ac73af4ee14dcf25721012ae82b568c2ea5c808eaa04ff"
|
|
2525
|
-
};
|
|
2526
|
-
Object.entries(METHOD_NAME_TO_HASH).reduce(
|
|
2527
|
-
(acc, [name, hash]) => {
|
|
2528
|
-
acc[hash.toLowerCase()] = name;
|
|
2529
|
-
return acc;
|
|
2530
|
-
},
|
|
2531
|
-
{}
|
|
2532
|
-
);
|
|
2533
|
-
BigInt(5e9);
|
|
2534
|
-
BigInt(1e9);
|
|
2535
|
-
BigInt(2e9);
|
|
2536
|
-
usdcUnits(0.1);
|
|
2537
|
-
}
|
|
2538
|
-
});
|
|
2539
|
-
|
|
2540
|
-
// src/utils/keccak.ts
|
|
2541
|
-
var init_keccak = __esm({
|
|
2542
|
-
"src/utils/keccak.ts"() {
|
|
2543
|
-
init_utils();
|
|
2544
301
|
}
|
|
2545
302
|
});
|
|
2546
303
|
|
|
@@ -2604,7 +361,7 @@ function resolvePaymentMethodNameFromHash(hash, catalog) {
|
|
|
2604
361
|
var init_paymentResolution = __esm({
|
|
2605
362
|
"src/utils/paymentResolution.ts"() {
|
|
2606
363
|
init_bytes32();
|
|
2607
|
-
|
|
364
|
+
init_currencyKeccak256();
|
|
2608
365
|
}
|
|
2609
366
|
});
|
|
2610
367
|
|
|
@@ -2672,7 +429,7 @@ function isSupportedCurrencyHash(hash) {
|
|
|
2672
429
|
exports.Currency = void 0; exports.currencyInfo = void 0;
|
|
2673
430
|
var init_currency = __esm({
|
|
2674
431
|
"src/utils/currency.ts"() {
|
|
2675
|
-
|
|
432
|
+
init_currencyKeccak256();
|
|
2676
433
|
exports.Currency = {
|
|
2677
434
|
AED: "AED",
|
|
2678
435
|
ARS: "ARS",
|
|
@@ -3131,6 +888,7 @@ var DEPOSIT_FIELDS = `
|
|
|
3131
888
|
escrowAddress
|
|
3132
889
|
depositId
|
|
3133
890
|
depositor
|
|
891
|
+
delegate
|
|
3134
892
|
token
|
|
3135
893
|
remainingDeposits
|
|
3136
894
|
intentAmountMin
|
|
@@ -3471,6 +1229,7 @@ function groupByDepositId(items) {
|
|
|
3471
1229
|
}
|
|
3472
1230
|
var DEFAULT_LIMIT = 100;
|
|
3473
1231
|
var DEFAULT_ORDER_FIELD = "remainingDeposits";
|
|
1232
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
3474
1233
|
var IndexerDepositService = class {
|
|
3475
1234
|
constructor(client) {
|
|
3476
1235
|
this.client = client;
|
|
@@ -3480,6 +1239,11 @@ var IndexerDepositService = class {
|
|
|
3480
1239
|
const where = {};
|
|
3481
1240
|
if (filter.status) where.status = { _eq: filter.status };
|
|
3482
1241
|
if (filter.depositor) where.depositor = { _ilike: filter.depositor };
|
|
1242
|
+
if (filter.delegate) {
|
|
1243
|
+
where.delegate = { _ilike: filter.delegate };
|
|
1244
|
+
} else if (filter.delegateIsSet !== void 0) {
|
|
1245
|
+
where.delegate = filter.delegateIsSet ? { _neq: ZERO_ADDRESS } : { _eq: ZERO_ADDRESS };
|
|
1246
|
+
}
|
|
3483
1247
|
if (filter.chainId) where.chainId = { _eq: filter.chainId };
|
|
3484
1248
|
if (filter.escrowAddresses && filter.escrowAddresses.length) {
|
|
3485
1249
|
where.escrowAddress = { _in: filter.escrowAddresses };
|
|
@@ -3791,7 +1555,8 @@ init_errors();
|
|
|
3791
1555
|
function createHeaders(apiKey, authToken) {
|
|
3792
1556
|
const headers2 = { "Content-Type": "application/json" };
|
|
3793
1557
|
if (apiKey) headers2["x-api-key"] = apiKey;
|
|
3794
|
-
if (authToken)
|
|
1558
|
+
if (authToken)
|
|
1559
|
+
headers2["Authorization"] = authToken.startsWith("Bearer ") ? authToken : `Bearer ${authToken}`;
|
|
3795
1560
|
return headers2;
|
|
3796
1561
|
}
|
|
3797
1562
|
function withApiBase(baseApiUrl) {
|
|
@@ -3812,26 +1577,31 @@ async function apiFetch({
|
|
|
3812
1577
|
retryDelayMs = 1e3
|
|
3813
1578
|
}) {
|
|
3814
1579
|
const endpoint = url.replace(/^[^/]*\/\/[^/]*/, "");
|
|
3815
|
-
return withRetry(
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
1580
|
+
return withRetry(
|
|
1581
|
+
async () => {
|
|
1582
|
+
let res;
|
|
1583
|
+
try {
|
|
1584
|
+
const options = {
|
|
1585
|
+
method,
|
|
1586
|
+
headers: createHeaders(apiKey, authToken)
|
|
1587
|
+
};
|
|
1588
|
+
if (body && method !== "GET") {
|
|
1589
|
+
options.body = JSON.stringify(body);
|
|
1590
|
+
}
|
|
1591
|
+
res = await fetch(url, options);
|
|
1592
|
+
} catch (error) {
|
|
1593
|
+
throw new exports.NetworkError("Failed to connect to API server", { endpoint, error });
|
|
3824
1594
|
}
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
1595
|
+
if (!res.ok) {
|
|
1596
|
+
const errorText = await res.text();
|
|
1597
|
+
throw parseAPIError(res, errorText);
|
|
1598
|
+
}
|
|
1599
|
+
return res.json();
|
|
1600
|
+
},
|
|
1601
|
+
retryCount,
|
|
1602
|
+
retryDelayMs,
|
|
1603
|
+
timeoutMs
|
|
1604
|
+
);
|
|
3835
1605
|
}
|
|
3836
1606
|
function processApiResponse(data, transformDates = true) {
|
|
3837
1607
|
if (!transformDates) return data;
|
|
@@ -3904,7 +1674,13 @@ async function apiValidatePayeeDetails(req, baseApiUrl, timeoutMs) {
|
|
|
3904
1674
|
return data;
|
|
3905
1675
|
}
|
|
3906
1676
|
function transformDatesToObjects(obj) {
|
|
3907
|
-
const dateFields = [
|
|
1677
|
+
const dateFields = [
|
|
1678
|
+
"createdAt",
|
|
1679
|
+
"updatedAt",
|
|
1680
|
+
"signalTimestamp",
|
|
1681
|
+
"fulfillTimestamp",
|
|
1682
|
+
"prunedTimestamp"
|
|
1683
|
+
];
|
|
3908
1684
|
const transformed = { ...obj };
|
|
3909
1685
|
for (const key in transformed) {
|
|
3910
1686
|
const value = transformed[key];
|
|
@@ -3950,7 +1726,7 @@ async function apiGetTakerTier(req, apiKey, baseApiUrl, authToken, timeoutMs) {
|
|
|
3950
1726
|
// src/client/Zkp2pClient.ts
|
|
3951
1727
|
init_contracts();
|
|
3952
1728
|
init_paymentResolution();
|
|
3953
|
-
|
|
1729
|
+
init_currencyKeccak256();
|
|
3954
1730
|
|
|
3955
1731
|
// src/utils/erc20.ts
|
|
3956
1732
|
var ERC20_ABI = [
|