@verified-network/verified-sdk 2.2.7 → 2.2.8

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.
@@ -405,9 +405,10 @@ class VerifiedContract {
405
405
  }
406
406
  /** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
407
407
  async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken, _apiKey) {
408
- var _a, _b, _c, _d, _e, _f, _g, _h;
408
+ var _a, _b, _c;
409
409
  let res = {};
410
410
  let txHash = "";
411
+ let recp;
411
412
  try {
412
413
  const meeClient = await (0, abstractjs_1.createMeeClient)({
413
414
  account: nexusAccount,
@@ -420,6 +421,7 @@ class VerifiedContract {
420
421
  calls: [tx],
421
422
  },
422
423
  });
424
+ const nowInSec = Math.floor(Date.now() / 1000);
423
425
  // Execute the transaction using passed paymentToken
424
426
  const { hash } = await meeClient.execute({
425
427
  feeToken: {
@@ -427,6 +429,7 @@ class VerifiedContract {
427
429
  address: paymentToken,
428
430
  },
429
431
  instructions: [transactionInstruction],
432
+ upperBoundTimestamp: nowInSec + 299, //highest is 5 minutes???
430
433
  });
431
434
  txHash = hash;
432
435
  console.log(`MEE transaction hash: ${hash}`);
@@ -465,74 +468,14 @@ class VerifiedContract {
465
468
  }
466
469
  }
467
470
  catch (err) {
468
- if ((txHash === null || txHash === void 0 ? void 0 : txHash.length) > 0 &&
469
- ((_d = err === null || err === void 0 ? void 0 : err.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes("execution deadline limit exceeded"))) {
470
- console.warn("MEE client transaction deadline exceeded, will fetch receipt manually...");
471
- const meeClient = await (0, abstractjs_1.createMeeClient)({
472
- account: nexusAccount,
473
- apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
474
- });
475
- for (let i = 0; i < Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND); i++) {
476
- try {
477
- await new Promise((resolve) => setTimeout(resolve, 6000)); // 6 second delay
478
- console.log("MEE deadline exceeded, fetching receipt for round:", i + 1, "out of", Number(constants_1.PaymasterConstants.MAX_WAITING_ROUND));
479
- const receipt = await meeClient.waitForSupertransactionReceipt({
480
- hash: txHash,
481
- });
482
- if (((_e = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _e === void 0 ? void 0 : _e.length) > 1) {
483
- //at least 2 receipts
484
- const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_f = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _f === void 0 ? void 0 : _f.length) - 1];
485
- if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
486
- res.status = STATUS.SUCCESS;
487
- res.response = {
488
- hash: txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.transactionHash,
489
- result: txReceipt,
490
- }; //TODO: update result on response
491
- res.message = "";
492
- break; // Exit the loop
493
- }
494
- else {
495
- res.status = STATUS.ERROR;
496
- res.response = {
497
- hash: txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.transactionHash,
498
- result: txReceipt,
499
- }; //TODO: update result on response
500
- res.message = "";
501
- break; // Exit the loop
502
- }
503
- }
504
- else {
505
- console.error("MEE client transaction failed with error: ", "Receipts lesser than one.");
506
- res.status = STATUS.ERROR;
507
- res.response = {
508
- hash: (_g = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _g === void 0 ? void 0 : _g.transactionHash,
509
- result: receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0],
510
- }; //TODO: update result on response
511
- res.message = "";
512
- return res;
513
- }
514
- }
515
- catch (_err) {
516
- if ((_h = _err === null || _err === void 0 ? void 0 : _err.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes("execution deadline limit exceeded")) {
517
- continue;
518
- }
519
- else {
520
- break;
521
- }
522
- }
523
- }
524
- return res;
525
- }
526
- else {
527
- console.error("MEE client transaction failed with error: ", err);
528
- res.status = STATUS.ERROR;
529
- res.response = {
530
- hash: txHash,
531
- result: {},
532
- }; //TODO: update result on response
533
- res.message = "";
534
- return res;
535
- }
471
+ console.error("MEE client transaction failed with error: ", err === null || err === void 0 ? void 0 : err.message);
472
+ res.status = STATUS.ERROR;
473
+ res.response = {
474
+ hash: txHash,
475
+ result: {},
476
+ }; //TODO: update result on response
477
+ res.message = "";
478
+ return res;
536
479
  }
537
480
  }
538
481
  async callContract(functionName, ...args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verified-network/verified-sdk",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "An SDK to develop applications on the Verified Network",
5
5
  "repository": {
6
6
  "type": "git",