@rango-dev/queue-manager-rango-preset 0.1.10-next.93 → 0.1.10-next.95

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.
@@ -1498,7 +1498,10 @@ function singTransaction(actions) {
1498
1498
  });
1499
1499
  var notification = getSwapNotitfication('confirm_transfer', _updateResult3);
1500
1500
  notifier(notification);
1501
- if (notification.eventType !== 'transaction_expired') {
1501
+ if (notification.eventType === 'transaction_expired') {
1502
+ failed();
1503
+ onFinish();
1504
+ } else {
1502
1505
  walletSigners.getSigner(TransactionType.TRANSFER).signAndSendTx(transferTransaction, walletAddress, null).then(function (txId) {
1503
1506
  setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
1504
1507
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
@@ -1538,7 +1541,10 @@ function singTransaction(actions) {
1538
1541
  });
1539
1542
  var _notification = getSwapNotitfication('calling_smart_contract', _updateResult4);
1540
1543
  notifier(_notification);
1541
- if (_notification.eventType !== 'transaction_expired') {
1544
+ if (_notification.eventType === 'transaction_expired') {
1545
+ failed();
1546
+ onFinish();
1547
+ } else {
1542
1548
  walletSigners.getSigner(TransactionType.EVM).signAndSendTx(evmTransaction, walletAddress, null).then(function (id) {
1543
1549
  setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1544
1550
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
@@ -1582,7 +1588,10 @@ function singTransaction(actions) {
1582
1588
  });
1583
1589
  var _notification2 = getSwapNotitfication('calling_smart_contract', _updateResult5);
1584
1590
  notifier(_notification2);
1585
- if (_notification2.eventType !== 'transaction_expired') {
1591
+ if (_notification2.eventType === 'transaction_expired') {
1592
+ failed();
1593
+ onFinish();
1594
+ } else {
1586
1595
  // If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
1587
1596
  if (((currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'TerraSwap' || (currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'ThorChain' && (currentStep == null ? void 0 : currentStep.fromBlockchain) === Network.TERRA || (currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'Terra Bridge' && currentStep.fromBlockchain === Network.TERRA) &&
1588
1597
  // here we must allow ibc on terrastatus
@@ -1648,7 +1657,10 @@ function singTransaction(actions) {
1648
1657
  });
1649
1658
  var _notification3 = getSwapNotitfication('calling_smart_contract', _updateResult7);
1650
1659
  notifier(_notification3);
1651
- if (_notification3.eventType !== 'transaction_expired') {
1660
+ if (_notification3.eventType === 'transaction_expired') {
1661
+ failed();
1662
+ onFinish();
1663
+ } else {
1652
1664
  var tx = solanaTransaction;
1653
1665
  walletSigners.getSigner(TransactionType.SOLANA).signAndSendTx(tx, walletAddress, null).then(function (txId) {
1654
1666
  setStepTransactionIds(actions, txId, 'smart_contract_called', notifier);
@@ -1681,84 +1693,96 @@ function singTransaction(actions) {
1681
1693
  var _updateResult8 = updateSwapStatus({
1682
1694
  getStorage: getStorage,
1683
1695
  setStorage: setStorage,
1684
- nextStepStatus: 'running',
1696
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1697
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1685
1698
  message: executeMessage,
1686
- details: executeDetails
1699
+ details: executeDetails,
1700
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1687
1701
  });
1688
- notifier(_extends({
1689
- eventType: 'calling_smart_contract'
1690
- }, _updateResult8));
1691
- walletSigners.getSigner(TransactionType.TRON).signAndSendTx(tronTransaction, walletAddress, null).then(function (id) {
1692
- setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1693
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1694
- next();
1695
- onFinish();
1696
- }, function (error) {
1697
- var _error$root13, _error$root14, _error$root15;
1698
- if (swap.status === 'failed') return;
1699
- var _prettifyErrorMessage9 = prettifyErrorMessage(error),
1700
- extraMessage = _prettifyErrorMessage9.extraMessage,
1701
- extraMessageDetail = _prettifyErrorMessage9.extraMessageDetail,
1702
- extraMessageErrorCode = _prettifyErrorMessage9.extraMessageErrorCode;
1703
- if (error && error != null && error.root && error != null && (_error$root13 = error.root) != null && _error$root13.message && error != null && (_error$root14 = error.root) != null && _error$root14.code && error != null && (_error$root15 = error.root) != null && _error$root15.reason) {
1704
- logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1705
- }
1706
- var updateResult = updateSwapStatus({
1707
- getStorage: getStorage,
1708
- setStorage: setStorage,
1709
- nextStatus: 'failed',
1710
- nextStepStatus: 'failed',
1711
- message: extraMessage,
1712
- details: extraMessageDetail,
1713
- errorCode: extraMessageErrorCode
1714
- });
1715
- notifier(_extends({
1716
- eventType: 'smart_contract_call_failed'
1717
- }, updateResult));
1702
+ var _notification4 = getSwapNotitfication('calling_smart_contract', _updateResult8);
1703
+ notifier(_notification4);
1704
+ if (_notification4.eventType === 'transaction_expired') {
1718
1705
  failed();
1719
1706
  onFinish();
1720
- });
1707
+ } else {
1708
+ walletSigners.getSigner(TransactionType.TRON).signAndSendTx(tronTransaction, walletAddress, null).then(function (id) {
1709
+ setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1710
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1711
+ next();
1712
+ onFinish();
1713
+ }, function (error) {
1714
+ var _error$root13, _error$root14, _error$root15;
1715
+ if (swap.status === 'failed') return;
1716
+ var _prettifyErrorMessage9 = prettifyErrorMessage(error),
1717
+ extraMessage = _prettifyErrorMessage9.extraMessage,
1718
+ extraMessageDetail = _prettifyErrorMessage9.extraMessageDetail,
1719
+ extraMessageErrorCode = _prettifyErrorMessage9.extraMessageErrorCode;
1720
+ if (error && error != null && error.root && error != null && (_error$root13 = error.root) != null && _error$root13.message && error != null && (_error$root14 = error.root) != null && _error$root14.code && error != null && (_error$root15 = error.root) != null && _error$root15.reason) {
1721
+ logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1722
+ }
1723
+ var updateResult = updateSwapStatus({
1724
+ getStorage: getStorage,
1725
+ setStorage: setStorage,
1726
+ nextStatus: 'failed',
1727
+ nextStepStatus: 'failed',
1728
+ message: extraMessage,
1729
+ details: extraMessageDetail,
1730
+ errorCode: extraMessageErrorCode
1731
+ });
1732
+ notifier(_extends({
1733
+ eventType: 'smart_contract_call_failed'
1734
+ }, updateResult));
1735
+ failed();
1736
+ onFinish();
1737
+ });
1738
+ }
1721
1739
  } else if (!!starknetTransaction) {
1722
1740
  var _updateResult9 = updateSwapStatus({
1723
1741
  getStorage: getStorage,
1724
1742
  setStorage: setStorage,
1725
- nextStepStatus: 'running',
1743
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1744
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1726
1745
  message: executeMessage,
1727
- details: executeDetails
1746
+ details: executeDetails,
1747
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1728
1748
  });
1729
- notifier(_extends({
1730
- eventType: 'calling_smart_contract'
1731
- }, _updateResult9));
1732
- walletSigners.getSigner(TransactionType.STARKNET).signAndSendTx(starknetTransaction, walletAddress, null).then(function (id) {
1733
- setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1734
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1735
- next();
1736
- onFinish();
1737
- }, function (error) {
1738
- var _error$root16, _error$root17, _error$root18;
1739
- if (swap.status === 'failed') return;
1740
- var _prettifyErrorMessage10 = prettifyErrorMessage(error),
1741
- extraMessage = _prettifyErrorMessage10.extraMessage,
1742
- extraMessageDetail = _prettifyErrorMessage10.extraMessageDetail,
1743
- extraMessageErrorCode = _prettifyErrorMessage10.extraMessageErrorCode;
1744
- if (error && error != null && error.root && error != null && (_error$root16 = error.root) != null && _error$root16.message && error != null && (_error$root17 = error.root) != null && _error$root17.code && error != null && (_error$root18 = error.root) != null && _error$root18.reason) {
1745
- logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1746
- }
1747
- var updateResult = updateSwapStatus({
1748
- getStorage: getStorage,
1749
- setStorage: setStorage,
1750
- nextStatus: 'failed',
1751
- nextStepStatus: 'failed',
1752
- message: extraMessage,
1753
- details: extraMessageDetail,
1754
- errorCode: extraMessageErrorCode
1755
- });
1756
- notifier(_extends({
1757
- eventType: 'smart_contract_call_failed'
1758
- }, updateResult));
1749
+ var _notification5 = getSwapNotitfication('calling_smart_contract', _updateResult9);
1750
+ notifier(_notification5);
1751
+ if (_notification5.eventType === 'transaction_expired') {
1759
1752
  failed();
1760
1753
  onFinish();
1761
- });
1754
+ } else {
1755
+ walletSigners.getSigner(TransactionType.STARKNET).signAndSendTx(starknetTransaction, walletAddress, null).then(function (id) {
1756
+ setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1757
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1758
+ next();
1759
+ onFinish();
1760
+ }, function (error) {
1761
+ var _error$root16, _error$root17, _error$root18;
1762
+ if (swap.status === 'failed') return;
1763
+ var _prettifyErrorMessage10 = prettifyErrorMessage(error),
1764
+ extraMessage = _prettifyErrorMessage10.extraMessage,
1765
+ extraMessageDetail = _prettifyErrorMessage10.extraMessageDetail,
1766
+ extraMessageErrorCode = _prettifyErrorMessage10.extraMessageErrorCode;
1767
+ if (error && error != null && error.root && error != null && (_error$root16 = error.root) != null && _error$root16.message && error != null && (_error$root17 = error.root) != null && _error$root17.code && error != null && (_error$root18 = error.root) != null && _error$root18.reason) {
1768
+ logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1769
+ }
1770
+ var updateResult = updateSwapStatus({
1771
+ getStorage: getStorage,
1772
+ setStorage: setStorage,
1773
+ nextStatus: 'failed',
1774
+ nextStepStatus: 'failed',
1775
+ message: extraMessage,
1776
+ details: extraMessageDetail,
1777
+ errorCode: extraMessageErrorCode
1778
+ });
1779
+ notifier(_extends({
1780
+ eventType: 'smart_contract_call_failed'
1781
+ }, updateResult));
1782
+ failed();
1783
+ onFinish();
1784
+ });
1785
+ }
1762
1786
  }
1763
1787
  }
1764
1788
  function checkWaitingForConnectWalletChange(params) {
@@ -2486,7 +2510,7 @@ function _migration() {
2486
2510
  var _tasks;
2487
2511
  var taskId = v4();
2488
2512
  var convertedSwap = {
2489
- id: v4(),
2513
+ id: swap.requestId,
2490
2514
  createdAt: Number(swap.creationTime),
2491
2515
  name: 'swap',
2492
2516
  status: Status.RUNNING,
@@ -2514,7 +2538,7 @@ function _migration() {
2514
2538
  */
2515
2539
  var status = swap.status === 'success' ? Status.SUCCESS : Status.FAILED;
2516
2540
  var _convertedSwap = {
2517
- id: v4(),
2541
+ id: swap.requestId,
2518
2542
  createdAt: Number(swap.creationTime),
2519
2543
  name: 'swap',
2520
2544
  status: status,