@verified-network/verified-sdk 2.5.1 → 2.5.2
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.js +37 -15
- package/package.json +3 -3
package/dist/contract/index.js
CHANGED
|
@@ -406,7 +406,7 @@ class VerifiedContract {
|
|
|
406
406
|
}
|
|
407
407
|
/** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
|
|
408
408
|
async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken, _apiKey) {
|
|
409
|
-
var _a, _b, _c, _d;
|
|
409
|
+
var _a, _b, _c, _d, _e, _f;
|
|
410
410
|
let res = {};
|
|
411
411
|
let txHash = "";
|
|
412
412
|
let recp;
|
|
@@ -428,14 +428,30 @@ class VerifiedContract {
|
|
|
428
428
|
calls: [tx],
|
|
429
429
|
},
|
|
430
430
|
});
|
|
431
|
+
const quote = await meeClient.getQuote({
|
|
432
|
+
instructions: [transactionInstruction],
|
|
433
|
+
feeToken: { address: paymentToken, chainId },
|
|
434
|
+
simulation: {
|
|
435
|
+
simulate: true,
|
|
436
|
+
},
|
|
437
|
+
});
|
|
431
438
|
const nowInSec = Math.floor(Date.now() / 1000);
|
|
439
|
+
const transactionInstructionFinal = await nexusAccount.build({
|
|
440
|
+
type: "default",
|
|
441
|
+
data: {
|
|
442
|
+
chainId,
|
|
443
|
+
calls: [
|
|
444
|
+
Object.assign(Object.assign({}, tx), { gasLimit: (_c = quote === null || quote === void 0 ? void 0 : quote.userOps[((_b = quote === null || quote === void 0 ? void 0 : quote.userOps) === null || _b === void 0 ? void 0 : _b.length) - 1]) === null || _c === void 0 ? void 0 : _c.maxGasLimit }),
|
|
445
|
+
],
|
|
446
|
+
},
|
|
447
|
+
});
|
|
432
448
|
// Execute the transaction using passed paymentToken
|
|
433
449
|
const { hash } = await meeClient.execute({
|
|
434
450
|
feeToken: {
|
|
435
451
|
chainId,
|
|
436
452
|
address: paymentToken,
|
|
437
453
|
},
|
|
438
|
-
instructions: [
|
|
454
|
+
instructions: [transactionInstructionFinal],
|
|
439
455
|
upperBoundTimestamp: nowInSec + 299, //highest is 5 minutes???
|
|
440
456
|
});
|
|
441
457
|
txHash = hash;
|
|
@@ -444,9 +460,9 @@ class VerifiedContract {
|
|
|
444
460
|
const receipt = await meeClient.waitForSupertransactionReceipt({ hash });
|
|
445
461
|
// console.log("receipts: ", receipt);
|
|
446
462
|
// console.log("receipt: ", receipt?.receipts);
|
|
447
|
-
if (((
|
|
463
|
+
if (((_d = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
448
464
|
//always pick last receipt????
|
|
449
|
-
const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((
|
|
465
|
+
const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_e = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _e === void 0 ? void 0 : _e.length) - 1];
|
|
450
466
|
if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
|
|
451
467
|
res.status = STATUS.SUCCESS;
|
|
452
468
|
res.response = {
|
|
@@ -469,7 +485,7 @@ class VerifiedContract {
|
|
|
469
485
|
console.error("MEE client transaction failed with error: ", "Invalid receipts length");
|
|
470
486
|
res.status = STATUS.ERROR;
|
|
471
487
|
res.response = {
|
|
472
|
-
hash: (
|
|
488
|
+
hash: (_f = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _f === void 0 ? void 0 : _f.transactionHash,
|
|
473
489
|
result: receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0],
|
|
474
490
|
}; //TODO: update result on response
|
|
475
491
|
res.message = "";
|
|
@@ -556,13 +572,16 @@ class VerifiedContract {
|
|
|
556
572
|
}
|
|
557
573
|
else {
|
|
558
574
|
nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
559
|
-
chains: [chainToUse],
|
|
560
|
-
transports: [
|
|
561
|
-
(0, viem_1.http)(rpcUrl ||
|
|
562
|
-
((_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.rpcUrl) ||
|
|
563
|
-
((_k = constants_1.PaymasterConstants[Number(chainId)]) === null || _k === void 0 ? void 0 : _k.RPC_URL)),
|
|
564
|
-
],
|
|
565
575
|
signer: _signer,
|
|
576
|
+
chainConfigurations: [
|
|
577
|
+
{
|
|
578
|
+
chain: chainToUse,
|
|
579
|
+
transport: (0, viem_1.http)(rpcUrl ||
|
|
580
|
+
((_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.rpcUrl) ||
|
|
581
|
+
((_k = constants_1.PaymasterConstants[Number(chainId)]) === null || _k === void 0 ? void 0 : _k.RPC_URL)),
|
|
582
|
+
version: (0, abstractjs_1.getMEEVersion)(abstractjs_1.MEEVersion.V2_0_0),
|
|
583
|
+
},
|
|
584
|
+
],
|
|
566
585
|
});
|
|
567
586
|
}
|
|
568
587
|
const meeAddress = nexusAccount.addressOn(chainId);
|
|
@@ -611,11 +630,14 @@ class VerifiedContract {
|
|
|
611
630
|
}
|
|
612
631
|
else {
|
|
613
632
|
nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
|
|
614
|
-
chains: [chainToUse],
|
|
615
|
-
transports: [
|
|
616
|
-
(0, viem_1.http)(rpcUrl || rpc || ((_c = constants_1.PaymasterConstants[Number(chainId)]) === null || _c === void 0 ? void 0 : _c.RPC_URL)),
|
|
617
|
-
],
|
|
618
633
|
signer: _signer,
|
|
634
|
+
chainConfigurations: [
|
|
635
|
+
{
|
|
636
|
+
chain: chainToUse,
|
|
637
|
+
transport: (0, viem_1.http)(rpcUrl || rpc || ((_c = constants_1.PaymasterConstants[Number(chainId)]) === null || _c === void 0 ? void 0 : _c.RPC_URL)),
|
|
638
|
+
version: (0, abstractjs_1.getMEEVersion)(abstractjs_1.MEEVersion.V2_1_0),
|
|
639
|
+
},
|
|
640
|
+
],
|
|
619
641
|
});
|
|
620
642
|
}
|
|
621
643
|
// const nexusAccount = await toMultichainNexusAccount({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verified-network/verified-sdk",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "An SDK to develop applications on the Verified Network",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"greet": "./bin/index.bin.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@biconomy/abstractjs": "^1.
|
|
34
|
+
"@biconomy/abstractjs": "^1.1.21",
|
|
35
35
|
"@biconomy/account": "^4.1.1",
|
|
36
36
|
"@rhinestone/module-sdk": "^0.2.8",
|
|
37
37
|
"ethers": "^5.7.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"viem": "^2.26.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/mocha": "^10.0.
|
|
42
|
+
"@types/mocha": "^10.0.10",
|
|
43
43
|
"mocha": "^10.2.0",
|
|
44
44
|
"ts-node": "^10.9.1",
|
|
45
45
|
"typescript": "^5.4.5"
|