@verified-network/verified-sdk 2.5.4 → 2.5.6
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/dist/contract/index.d.ts +2 -1
- package/dist/contract/index.js +105 -94
- package/dist/utils/constants.js +28 -9
- package/package.json +1 -1
package/dist/contract/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare class VerifiedContract {
|
|
|
32
32
|
private signer;
|
|
33
33
|
private contract;
|
|
34
34
|
private abiInterface;
|
|
35
|
+
private abiRaw;
|
|
35
36
|
constructor(address: string, abi: string, signer: VerifiedWallet | Signer);
|
|
36
37
|
protected validateInput(type: DATATYPES, data: any): Promise<boolean>;
|
|
37
38
|
protected sanitiseInput(type: DATATYPES, data: any): any;
|
|
@@ -60,7 +61,7 @@ export declare class VerifiedContract {
|
|
|
60
61
|
/** Constructs and call function as userop for biconomy gassless(sponsored/erc20 mode) */
|
|
61
62
|
callFunctionAsUserOp(smartAccount: any, tx: any, functionName: string, paymentToken: string, ...args: any): Promise<SCResponse>;
|
|
62
63
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
63
|
-
callFunctionWithMEEClient(nexusAccount: any, chainId: number, tx: any, functionName: string, paymentToken: `0x${string}`, isSponsor?: boolean, _apiKey?: string, ...args: any): Promise<SCResponse>;
|
|
64
|
+
callFunctionWithMEEClient(nexusAccount: any, chainId: number, rpc: string, tx: any, functionName: string, paymentToken: `0x${string}`, isSponsor?: boolean, signerPk?: string, _apiKey?: string, ...args: any): Promise<SCResponse>;
|
|
64
65
|
callContract(functionName: string, ...args: any): Promise<SCResponse>;
|
|
65
66
|
getQuote(paymentTokenAddress: string, functionName: string, args: any[], rpc?: string, _apiKey?: string, isReactNative?: boolean): Promise<{
|
|
66
67
|
tokenAddress: string;
|
package/dist/contract/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const abstractjs_1 = require("@biconomy/abstractjs");
|
|
|
12
12
|
const chains_1 = require("viem/chains");
|
|
13
13
|
const viem_1 = require("viem");
|
|
14
14
|
const biconomyRNFix_1 = require("../lib/biconomyRNFix");
|
|
15
|
-
const
|
|
15
|
+
const ERC20_json_1 = __importDefault(require("../abi/payments/ERC20.json"));
|
|
16
16
|
var STATUS;
|
|
17
17
|
(function (STATUS) {
|
|
18
18
|
STATUS[STATUS["SUCCESS"] = 0] = "SUCCESS";
|
|
@@ -32,6 +32,7 @@ class VerifiedContract {
|
|
|
32
32
|
constructor(address, abi, signer) {
|
|
33
33
|
this.signer = signer;
|
|
34
34
|
this.abiInterface = new ethers_1.utils.Interface(abi);
|
|
35
|
+
this.abiRaw = JSON.parse(abi);
|
|
35
36
|
this.contract = new ethers_1.ethers.Contract(address, this.abiInterface, signer);
|
|
36
37
|
}
|
|
37
38
|
async validateInput(type, data) {
|
|
@@ -194,12 +195,14 @@ class VerifiedContract {
|
|
|
194
195
|
}
|
|
195
196
|
/** Checks if a contract support gasless transaction */
|
|
196
197
|
supportsGasless(chainId) {
|
|
197
|
-
let isSupported = false;
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
// let isSupported = false;
|
|
199
|
+
// if (
|
|
200
|
+
// PaymasterConstants[`${chainId}`] &&
|
|
201
|
+
// PaymasterConstants[`${chainId}`]["PAYMASTER_API_KEY"] &&
|
|
202
|
+
// PaymasterConstants[`${chainId}`]["BUNDLER_API_KEY"]
|
|
203
|
+
// )
|
|
204
|
+
// isSupported = true;
|
|
205
|
+
return true;
|
|
203
206
|
}
|
|
204
207
|
/** Creates Biconomy smart account */
|
|
205
208
|
async createSmartAccount(chainId) {
|
|
@@ -378,8 +381,8 @@ class VerifiedContract {
|
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
383
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
381
|
-
async callFunctionWithMEEClient(nexusAccount, chainId, tx, functionName, paymentToken, isSponsor, _apiKey, ...args) {
|
|
382
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
384
|
+
async callFunctionWithMEEClient(nexusAccount, chainId, rpc, tx, functionName, paymentToken, isSponsor, signerPk, _apiKey, ...args) {
|
|
385
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
383
386
|
let res = {};
|
|
384
387
|
let txHash = "";
|
|
385
388
|
let recp;
|
|
@@ -404,11 +407,9 @@ class VerifiedContract {
|
|
|
404
407
|
let transferInstruction, transferTx;
|
|
405
408
|
if (!isSponsor) {
|
|
406
409
|
const signerAny = this.signer;
|
|
407
|
-
const tokenContract = new
|
|
408
|
-
const tokenDecimals = await tokenContract
|
|
409
|
-
|
|
410
|
-
.then((res) => { var _a; return (_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.result[0]; });
|
|
411
|
-
const fn = tokenContract.contract.populateTransaction["transfer"];
|
|
410
|
+
const tokenContract = new ethers_1.ethers.Contract(paymentToken, new ethers_1.utils.Interface(ERC20_json_1.default === null || ERC20_json_1.default === void 0 ? void 0 : ERC20_json_1.default.abi), signerAny);
|
|
411
|
+
const tokenDecimals = await tokenContract.decimals();
|
|
412
|
+
const fn = tokenContract.populateTransaction["transfer"];
|
|
412
413
|
const amountFmt = ethers_1.ethers.utils.parseUnits(constants_1.PaymasterConstants.COMPENSATION_AMOUNT, Number(tokenDecimals));
|
|
413
414
|
const transferArgs = [
|
|
414
415
|
constants_1.PaymasterConstants.ADMIN_WALLET_ADDRESS,
|
|
@@ -430,7 +431,8 @@ class VerifiedContract {
|
|
|
430
431
|
}
|
|
431
432
|
const isTestnet = (_b = constants_1.PaymasterConstants.TEST_CHAINS) === null || _b === void 0 ? void 0 : _b.includes(chainId);
|
|
432
433
|
let sponsorInfo;
|
|
433
|
-
|
|
434
|
+
//Use constant gas tanks instead of fetching from server to reduce tx time???
|
|
435
|
+
if (isSponsor) {
|
|
434
436
|
const response = await fetch("https://network.biconomy.io/v1/sponsorship/info", { method: "GET" });
|
|
435
437
|
if (!response.ok) {
|
|
436
438
|
sponsorInfo = {};
|
|
@@ -439,32 +441,26 @@ class VerifiedContract {
|
|
|
439
441
|
sponsorInfo = await response.json();
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
|
-
const sponsorUrl =
|
|
443
|
-
? abstractjs_1.DEFAULT_PATHFINDER_URL
|
|
444
|
-
: constants_1.PaymasterConstants.HOSTED_SPONSOR_URL;
|
|
444
|
+
const sponsorUrl = constants_1.PaymasterConstants.HOSTED_SPONSOR_URL;
|
|
445
445
|
let quote, cmpQuote;
|
|
446
446
|
if (isSponsor) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
: (_c = sponsorInfo[chainId === null || chainId === void 0 ? void 0 : chainId.toString()]) === null || _c === void 0 ? void 0 : _c.account,
|
|
456
|
-
token: isTestnet
|
|
457
|
-
? abstractjs_1.DEFAULT_MEE_TESTNET_SPONSORSHIP_TOKEN_ADDRESS
|
|
458
|
-
: (_d = sponsorInfo[chainId === null || chainId === void 0 ? void 0 : chainId.toString()]) === null || _d === void 0 ? void 0 : _d.token,
|
|
459
|
-
chainId: isTestnet
|
|
460
|
-
? abstractjs_1.DEFAULT_MEE_TESTNET_SPONSORSHIP_CHAIN_ID
|
|
461
|
-
: Number(chainId),
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
simulation: {
|
|
465
|
-
simulate: true,
|
|
447
|
+
const response = await fetch(`${sponsorUrl}/sponsorship/sign/${(_c = sponsorInfo[isTestnet ? "84532" : "8453"]) === null || _c === void 0 ? void 0 : _c.chainId}/${(_d = sponsorInfo[isTestnet ? "84532" : "8453"]) === null || _d === void 0 ? void 0 : _d.account}`, {
|
|
448
|
+
method: "POST",
|
|
449
|
+
headers: {
|
|
450
|
+
"cnt-tx": JSON.stringify(tx),
|
|
451
|
+
"cnt-chainid": chainId === null || chainId === void 0 ? void 0 : chainId.toString(),
|
|
452
|
+
"cnt-rpc": rpc,
|
|
453
|
+
"cnt-isquote": "true",
|
|
454
|
+
"cnt-pk": signerPk,
|
|
466
455
|
},
|
|
456
|
+
body: null,
|
|
467
457
|
});
|
|
458
|
+
if (!response.ok) {
|
|
459
|
+
quote = null;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
quote = await response.json();
|
|
463
|
+
}
|
|
468
464
|
}
|
|
469
465
|
else {
|
|
470
466
|
cmpQuote = await meeClient.getQuote({
|
|
@@ -504,29 +500,28 @@ class VerifiedContract {
|
|
|
504
500
|
},
|
|
505
501
|
});
|
|
506
502
|
}
|
|
507
|
-
// Execute the transaction using passed paymentToken
|
|
503
|
+
// Execute the transaction using passed paymentToken or gasless details
|
|
508
504
|
let _txHash;
|
|
509
505
|
if (isSponsor) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
? abstractjs_1.DEFAULT_MEE_TESTNET_SPONSORSHIP_TOKEN_ADDRESS
|
|
520
|
-
: (_k = sponsorInfo[chainId === null || chainId === void 0 ? void 0 : chainId.toString()]) === null || _k === void 0 ? void 0 : _k.token,
|
|
521
|
-
chainId: isTestnet
|
|
522
|
-
? abstractjs_1.DEFAULT_MEE_TESTNET_SPONSORSHIP_CHAIN_ID
|
|
523
|
-
: Number(chainId),
|
|
524
|
-
},
|
|
506
|
+
let res;
|
|
507
|
+
const response = await fetch(`${sponsorUrl}/sponsorship/sign/${(_j = sponsorInfo[isTestnet ? "84532" : "8453"]) === null || _j === void 0 ? void 0 : _j.chainId}/${(_k = sponsorInfo[isTestnet ? "84532" : "8453"]) === null || _k === void 0 ? void 0 : _k.account}`, {
|
|
508
|
+
method: "POST",
|
|
509
|
+
headers: {
|
|
510
|
+
"cnt-tx": JSON.stringify(Object.assign(Object.assign({}, tx), { gasLimit: (_m = quote === null || quote === void 0 ? void 0 : quote.userOps[((_l = quote === null || quote === void 0 ? void 0 : quote.userOps) === null || _l === void 0 ? void 0 : _l.length) - 1]) === null || _m === void 0 ? void 0 : _m.maxGasLimit })),
|
|
511
|
+
"cnt-chainid": chainId === null || chainId === void 0 ? void 0 : chainId.toString(),
|
|
512
|
+
"cnt-rpc": rpc,
|
|
513
|
+
"cnt-isquote": "false",
|
|
514
|
+
"cnt-pk": signerPk,
|
|
525
515
|
},
|
|
526
|
-
|
|
527
|
-
upperBoundTimestamp: nowInSec + 299, //highest is 5 minutes???
|
|
516
|
+
body: null,
|
|
528
517
|
});
|
|
529
|
-
|
|
518
|
+
if (!response.ok) {
|
|
519
|
+
res = { hash: "" };
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
res = await response.json();
|
|
523
|
+
}
|
|
524
|
+
_txHash = res === null || res === void 0 ? void 0 : res.hash;
|
|
530
525
|
}
|
|
531
526
|
else {
|
|
532
527
|
//handle it seperately as batch kept failing???
|
|
@@ -542,9 +537,9 @@ class VerifiedContract {
|
|
|
542
537
|
const cmpReceipt = await meeClient.waitForSupertransactionReceipt({
|
|
543
538
|
hash: cmpHash,
|
|
544
539
|
});
|
|
545
|
-
if (((
|
|
540
|
+
if (((_o = cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts) === null || _o === void 0 ? void 0 : _o.length) > 0) {
|
|
546
541
|
//always pick last receipt????
|
|
547
|
-
const txReceipt = cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts[((
|
|
542
|
+
const txReceipt = cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts[((_p = cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts) === null || _p === void 0 ? void 0 : _p.length) - 1];
|
|
548
543
|
if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
|
|
549
544
|
// console.log(
|
|
550
545
|
// "Compensation tx successful will move to regular transaction...",
|
|
@@ -573,7 +568,7 @@ class VerifiedContract {
|
|
|
573
568
|
console.error("MEE client transaction failed with error: ", "Invalid receipts length");
|
|
574
569
|
res.status = STATUS.ERROR;
|
|
575
570
|
res.response = {
|
|
576
|
-
hash: (
|
|
571
|
+
hash: (_q = cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts[0]) === null || _q === void 0 ? void 0 : _q.transactionHash,
|
|
577
572
|
result: cmpReceipt === null || cmpReceipt === void 0 ? void 0 : cmpReceipt.receipts[0],
|
|
578
573
|
}; //TODO: update result on response
|
|
579
574
|
res.message = "";
|
|
@@ -588,9 +583,9 @@ class VerifiedContract {
|
|
|
588
583
|
});
|
|
589
584
|
// console.log("receipts: ", receipt);
|
|
590
585
|
// console.log("receiptsss...: ", receipt?.receipts);
|
|
591
|
-
if (((
|
|
586
|
+
if (((_r = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _r === void 0 ? void 0 : _r.length) > 0) {
|
|
592
587
|
//always pick last receipt????
|
|
593
|
-
const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((
|
|
588
|
+
const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_s = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _s === void 0 ? void 0 : _s.length) - 1];
|
|
594
589
|
if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
|
|
595
590
|
res.status = STATUS.SUCCESS;
|
|
596
591
|
res.response = {
|
|
@@ -624,7 +619,7 @@ class VerifiedContract {
|
|
|
624
619
|
else {
|
|
625
620
|
res.status = STATUS.ERROR;
|
|
626
621
|
res.response = {
|
|
627
|
-
hash: (
|
|
622
|
+
hash: (_t = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _t === void 0 ? void 0 : _t.transactionHash,
|
|
628
623
|
result: receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0],
|
|
629
624
|
}; //TODO: update result on response
|
|
630
625
|
res.message = "";
|
|
@@ -650,7 +645,7 @@ class VerifiedContract {
|
|
|
650
645
|
}
|
|
651
646
|
}
|
|
652
647
|
async callContract(functionName, ...args) {
|
|
653
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
648
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
654
649
|
// Check if the function is a read function
|
|
655
650
|
if (this.isReadFunction(functionName)) {
|
|
656
651
|
console.log("read function will use ethers");
|
|
@@ -683,6 +678,8 @@ class VerifiedContract {
|
|
|
683
678
|
chains_1.polygon,
|
|
684
679
|
chains_1.sepolia,
|
|
685
680
|
chains_1.baseSepolia,
|
|
681
|
+
chains_1.arbitrum,
|
|
682
|
+
chains_1.arbitrumSepolia,
|
|
686
683
|
].find((nt) => Number(nt === null || nt === void 0 ? void 0 : nt.id) === Number(chainId));
|
|
687
684
|
if (!chainToUse) {
|
|
688
685
|
throw new Error(`Chaind id: ${chainId} not supported on Verified Sdk. Supported chain ids are: ${(_b = (_a = [
|
|
@@ -692,45 +689,59 @@ class VerifiedContract {
|
|
|
692
689
|
chains_1.polygon,
|
|
693
690
|
chains_1.sepolia,
|
|
694
691
|
chains_1.baseSepolia,
|
|
692
|
+
chains_1.arbitrum,
|
|
693
|
+
chains_1.arbitrumSepolia,
|
|
695
694
|
]) === null || _a === void 0 ? void 0 : _a.map((nt) => nt === null || nt === void 0 ? void 0 : nt.id)) === null || _b === void 0 ? void 0 : _b.join(", ")}`);
|
|
696
695
|
}
|
|
697
696
|
const prov = this.signer.provider;
|
|
698
697
|
const rpcUrl = (_c = prov === null || prov === void 0 ? void 0 : prov.connection) === null || _c === void 0 ? void 0 : _c.url;
|
|
699
698
|
let nexusAccount;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
(
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
699
|
+
try {
|
|
700
|
+
if ((_d = optionsRaw[0]) === null || _d === void 0 ? void 0 : _d.isReactNative) {
|
|
701
|
+
nexusAccount = await (0, biconomyRNFix_1.createMultiChainNexusAccount)({
|
|
702
|
+
chains: [chainToUse],
|
|
703
|
+
transports: [
|
|
704
|
+
(0, viem_1.http)(rpcUrl ||
|
|
705
|
+
((_e = optionsRaw[0]) === null || _e === void 0 ? void 0 : _e.rpcUrl) ||
|
|
706
|
+
((_f = constants_1.PaymasterConstants[Number(chainId)]) === null || _f === void 0 ? void 0 : _f.RPC_URL)),
|
|
707
|
+
],
|
|
708
|
+
signer: _signer,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
713
|
+
signer: _signer,
|
|
714
|
+
chainConfigurations: [
|
|
715
|
+
{
|
|
716
|
+
chain: chainToUse,
|
|
717
|
+
transport: (0, viem_1.http)(rpcUrl ||
|
|
718
|
+
((_g = optionsRaw[0]) === null || _g === void 0 ? void 0 : _g.rpcUrl) ||
|
|
719
|
+
((_h = constants_1.PaymasterConstants[Number(chainId)]) === null || _h === void 0 ? void 0 : _h.RPC_URL)),
|
|
720
|
+
version: (0, abstractjs_1.getMEEVersion)(abstractjs_1.MEEVersion.V2_0_0),
|
|
721
|
+
},
|
|
722
|
+
],
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
// const meeAddress = nexusAccount.addressOn(chainId);
|
|
710
726
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
chainConfigurations: [
|
|
715
|
-
{
|
|
716
|
-
chain: chainToUse,
|
|
717
|
-
transport: (0, viem_1.http)(rpcUrl ||
|
|
718
|
-
((_g = optionsRaw[0]) === null || _g === void 0 ? void 0 : _g.rpcUrl) ||
|
|
719
|
-
((_h = constants_1.PaymasterConstants[Number(chainId)]) === null || _h === void 0 ? void 0 : _h.RPC_URL)),
|
|
720
|
-
version: (0, abstractjs_1.getMEEVersion)(abstractjs_1.MEEVersion.V2_0_0),
|
|
721
|
-
},
|
|
722
|
-
],
|
|
723
|
-
});
|
|
727
|
+
catch (err) {
|
|
728
|
+
console.log("Gas sponsorship failed will use ethers...");
|
|
729
|
+
return await this.callFunctionWithEthers(functionName, ...args);
|
|
724
730
|
}
|
|
725
|
-
// const meeAddress = nexusAccount.addressOn(chainId);
|
|
726
731
|
if ((_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.paymentToken) {
|
|
727
732
|
console.log("Using Mee erc20 payment with paymentToken of: ", (_k = optionsRaw[0]) === null || _k === void 0 ? void 0 : _k.paymentToken);
|
|
728
733
|
// console.log("nexus account address: ", meeAddress);
|
|
729
|
-
return await this.callFunctionWithMEEClient(nexusAccount, chainId,
|
|
734
|
+
return await this.callFunctionWithMEEClient(nexusAccount, chainId, rpcUrl ||
|
|
735
|
+
((_l = optionsRaw[0]) === null || _l === void 0 ? void 0 : _l.rpcUrl) ||
|
|
736
|
+
((_m = constants_1.PaymasterConstants[Number(chainId)]) === null || _m === void 0 ? void 0 : _m.RPC_URL), tx1, functionName, (_o = optionsRaw[0]) === null || _o === void 0 ? void 0 : _o.paymentToken, false, undefined, (_p = optionsRaw[0]) === null || _p === void 0 ? void 0 : _p.apiKey, ...args);
|
|
730
737
|
}
|
|
731
738
|
else {
|
|
732
739
|
console.log("Using mee gas sponsorship since no payment token...");
|
|
733
|
-
|
|
740
|
+
const signerAny = this.signer;
|
|
741
|
+
const signerPk = (_q = signerAny === null || signerAny === void 0 ? void 0 : signerAny._signingKey()) === null || _q === void 0 ? void 0 : _q.privateKey;
|
|
742
|
+
return await this.callFunctionWithMEEClient(nexusAccount, chainId, rpcUrl ||
|
|
743
|
+
((_r = optionsRaw[0]) === null || _r === void 0 ? void 0 : _r.rpcUrl) ||
|
|
744
|
+
((_s = constants_1.PaymasterConstants[Number(chainId)]) === null || _s === void 0 ? void 0 : _s.RPC_URL), tx1, functionName, (_t = optionsRaw[0]) === null || _t === void 0 ? void 0 : _t.paymentToken, true, signerPk, (_u = optionsRaw[0]) === null || _u === void 0 ? void 0 : _u.apiKey, ...args);
|
|
734
745
|
}
|
|
735
746
|
}
|
|
736
747
|
else {
|
|
@@ -751,6 +762,8 @@ class VerifiedContract {
|
|
|
751
762
|
chains_1.polygon,
|
|
752
763
|
chains_1.sepolia,
|
|
753
764
|
chains_1.baseSepolia,
|
|
765
|
+
chains_1.arbitrum,
|
|
766
|
+
chains_1.arbitrumSepolia,
|
|
754
767
|
].find((nt) => Number(nt === null || nt === void 0 ? void 0 : nt.id) === Number(chainId));
|
|
755
768
|
if (chainToUse) {
|
|
756
769
|
const prov = this.signer.provider;
|
|
@@ -804,11 +817,9 @@ class VerifiedContract {
|
|
|
804
817
|
},
|
|
805
818
|
});
|
|
806
819
|
const signerAny = this.signer;
|
|
807
|
-
const tokenContract = new
|
|
808
|
-
const tokenDecimals = await tokenContract
|
|
809
|
-
|
|
810
|
-
.then((res) => { var _a; return (_a = res === null || res === void 0 ? void 0 : res.response) === null || _a === void 0 ? void 0 : _a.result[0]; });
|
|
811
|
-
const fnTransfer = tokenContract.contract.populateTransaction["transfer"];
|
|
820
|
+
const tokenContract = new ethers_1.ethers.Contract(paymentTokenAddress, new ethers_1.utils.Interface(ERC20_json_1.default === null || ERC20_json_1.default === void 0 ? void 0 : ERC20_json_1.default.abi), signerAny);
|
|
821
|
+
const tokenDecimals = await tokenContract.decimals();
|
|
822
|
+
const fnTransfer = tokenContract.populateTransaction["transfer"];
|
|
812
823
|
const amountFmt = ethers_1.ethers.utils.parseUnits(constants_1.PaymasterConstants.COMPENSATION_AMOUNT, Number(tokenDecimals));
|
|
813
824
|
const transferArgs = [
|
|
814
825
|
constants_1.PaymasterConstants.ADMIN_WALLET_ADDRESS,
|
package/dist/utils/constants.js
CHANGED
|
@@ -3,16 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PaymasterConstants = void 0;
|
|
4
4
|
//Todo: add more network paymaster details for gasless
|
|
5
5
|
exports.PaymasterConstants = {
|
|
6
|
-
MEE_API_KEY: "
|
|
6
|
+
MEE_API_KEY: "mee_G5SSkmZYg9kiGksxJwFT9x", //Non sponsored key from dashboard
|
|
7
7
|
MEE_API_KEY_STAGING: "mee_3Zmc7H6Pbd5wUfUGu27aGzdf", //Biconomy sponsorship enabled staging api key???
|
|
8
8
|
MEE_URL_STAGING: "https://staging-network.biconomy.io/v1",
|
|
9
|
-
TEST_CHAINS: [11155111, 84532],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
token: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
13
|
-
address: "0x8a2997ba9B9A51aF7C63914829450260B12B75e5",
|
|
14
|
-
},
|
|
15
|
-
HOSTED_SPONSOR_URL: "https://gateway.verified.network/api/sponsor", //TODO: update to hosted sponsor url
|
|
16
|
-
ADMIN_WALLET_ADDRESS: "0x5DBDA7BE05F68131e260f5A2bC573b24692a5B34", //test admin
|
|
9
|
+
TEST_CHAINS: [11155111, 84532, 421614],
|
|
10
|
+
HOSTED_SPONSOR_URL: "https://gateway.verified.network/api/sponsor",
|
|
11
|
+
ADMIN_WALLET_ADDRESS: "0x5DBDA7BE05F68131e260f5A2bC573b24692a5B34", //current admin???
|
|
17
12
|
COMPENSATION_AMOUNT: "0.02", //2 Cents
|
|
13
|
+
//ethereum sepolia
|
|
14
|
+
11155111: {
|
|
15
|
+
RPC_URL: "https://eth-sepolia.public.blastapi.io",
|
|
16
|
+
},
|
|
17
|
+
//polgon mainnet
|
|
18
|
+
137: {
|
|
19
|
+
RPC_URL: "https://polygon-rpc.com",
|
|
20
|
+
},
|
|
21
|
+
//base sepolia
|
|
22
|
+
84532: {
|
|
23
|
+
RPC_URL: "https://sepolia.base.org",
|
|
24
|
+
},
|
|
25
|
+
//ethereum mainnet
|
|
26
|
+
1: {
|
|
27
|
+
RPC_URL: "https://eth-mainnet.public.blastapi.io",
|
|
28
|
+
},
|
|
29
|
+
//base mainnet
|
|
30
|
+
8453: {
|
|
31
|
+
RPC_URL: "https://base-mainnet.public.blastapi.io",
|
|
32
|
+
},
|
|
33
|
+
//gnosis
|
|
34
|
+
100: {
|
|
35
|
+
RPC_URL: "https://rpc.gnosischain.com",
|
|
36
|
+
},
|
|
18
37
|
};
|