@rango-dev/queue-manager-rango-preset 0.1.15-next.6 → 0.1.15-next.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.
@@ -829,20 +829,17 @@ function claimQueue() {
829
829
  }
830
830
  };
831
831
  }
832
- /**
833
- *
834
- * We use module-level variable to keep track of
835
- * map of transactions hash to the TransactionResponse
836
- *
837
- */
838
- var swapTransactionToResponseMap = {};
839
- function useTransactionsResponse() {
832
+ var swapTransactionToDataMap = {};
833
+ function useTransactionsData() {
840
834
  return {
841
- getTransactionResponseByHash: function getTransactionResponseByHash(hash) {
842
- return swapTransactionToResponseMap[hash];
835
+ getTransactionDataByHash: function getTransactionDataByHash(hash) {
836
+ return swapTransactionToDataMap[hash] || {};
843
837
  },
844
- setTransactionResponseByHash: function setTransactionResponseByHash(hash, response) {
845
- swapTransactionToResponseMap[hash] = response;
838
+ setTransactionDataByHash: function setTransactionDataByHash(hash, data) {
839
+ var r = swapTransactionToDataMap[hash];
840
+ if (!r) swapTransactionToDataMap[hash] = {};
841
+ swapTransactionToDataMap[hash].response = data.response || swapTransactionToDataMap[hash].response;
842
+ swapTransactionToDataMap[hash].receiptReceived = data.receiptReceived || swapTransactionToDataMap[hash].receiptReceived || false;
846
843
  }
847
844
  };
848
845
  }
@@ -960,7 +957,7 @@ function updateSwapStatus(_ref) {
960
957
  var swap = getStorage().swapDetails;
961
958
  var currentStep = getCurrentStep(swap);
962
959
  if (!!nextStepStatus && !!currentStep) currentStep.status = nextStepStatus;
963
- if (!!nextStatus) swap.status = nextStatus;
960
+ if (nextStatus) swap.status = nextStatus;
964
961
  swap.hasAlreadyProceededToSign = hasAlreadyProceededToSign;
965
962
  if (!!nextStatus && ['failed', 'success'].includes(nextStatus)) swap.finishTime = new Date().getTime().toString();
966
963
  if (!!message || !!details) {
@@ -1006,7 +1003,7 @@ function setStepTransactionIds(_ref2, txId, notifier, eventType, explorerUrl) {
1006
1003
  var currentStep = getCurrentStep(swap);
1007
1004
  currentStep.executedTransactionId = txId;
1008
1005
  currentStep.executedTransactionTime = new Date().getTime().toString();
1009
- if (!!(explorerUrl != null && explorerUrl.url)) currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
1006
+ if (explorerUrl != null && explorerUrl.url) currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
1010
1007
  url: explorerUrl.url,
1011
1008
  description: explorerUrl.description || null
1012
1009
  }]);
@@ -1022,7 +1019,7 @@ function setStepTransactionIds(_ref2, txId, notifier, eventType, explorerUrl) {
1022
1019
  setStorage(_extends({}, getStorage(), {
1023
1020
  swapDetails: swap
1024
1021
  }));
1025
- if (!!eventType) notifier({
1022
+ if (eventType) notifier({
1026
1023
  eventType: eventType,
1027
1024
  swap: swap,
1028
1025
  step: currentStep
@@ -1393,16 +1390,18 @@ function onBlockForChangeNetwork(_event, meta) {
1393
1390
  type = _getRequiredWallet2.type,
1394
1391
  network = _getRequiredWallet2.network;
1395
1392
  if (!!type && !!network) {
1396
- var _result = context.switchNetwork(type, network);
1397
- if (_result) {
1398
- _result.then(function () {
1399
- queue.unblock();
1400
- })["catch"](function (error) {
1401
- // ignore switch network errors
1402
- console.log({
1403
- error: error
1393
+ if (context.canSwitchNetworkTo(type, network)) {
1394
+ var _result = context.switchNetwork(type, network);
1395
+ if (_result) {
1396
+ _result.then(function () {
1397
+ queue.unblock();
1398
+ })["catch"](function (error) {
1399
+ // ignore switch network errors
1400
+ console.log({
1401
+ error: error
1402
+ });
1404
1403
  });
1405
- });
1404
+ }
1406
1405
  }
1407
1406
  }
1408
1407
  }
@@ -1464,7 +1463,7 @@ function onDependsOnOtherQueues(_event, meta) {
1464
1463
  resetClaimedBy: function resetClaimedBy() {
1465
1464
  reset();
1466
1465
  // TODO: Use key generator
1467
- retryOn(type + "-" + network + ":" + address, context.notifier, manager);
1466
+ retryOn(type + "-" + network + ":" + address, context.notifier, manager, context.canSwitchNetworkTo);
1468
1467
  }
1469
1468
  });
1470
1469
  }
@@ -1497,8 +1496,8 @@ function isRequiredWalletConnected(swap, getState) {
1497
1496
  };
1498
1497
  }
1499
1498
  function singTransaction(actions) {
1500
- var _useTransactionsRespo = useTransactionsResponse(),
1501
- setTransactionResponseByHash = _useTransactionsRespo.setTransactionResponseByHash;
1499
+ var _useTransactionsData = useTransactionsData(),
1500
+ setTransactionDataByHash = _useTransactionsData.setTransactionDataByHash;
1502
1501
  var getStorage = actions.getStorage,
1503
1502
  setStorage = actions.setStorage,
1504
1503
  failed = actions.failed,
@@ -1576,7 +1575,9 @@ function singTransaction(actions) {
1576
1575
  description: isApproval ? 'Approve' : 'Swap'
1577
1576
  } : undefined);
1578
1577
  // response used for evm transactions to get receipt and track replaced
1579
- response && setTransactionResponseByHash(hash, response);
1578
+ response && setTransactionDataByHash(hash, {
1579
+ response: response
1580
+ });
1580
1581
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1581
1582
  next();
1582
1583
  onFinish();
@@ -1739,8 +1740,8 @@ function resetRunningSwapNotifsOnPageLoad(runningSwaps, notifier) {
1739
1740
  * @param manager
1740
1741
  * @returns
1741
1742
  */
1742
- function retryOn(wallet_network, notifier, manager, options) {
1743
- var _finalQueueToBeRun;
1743
+ function retryOn(wallet_network, notifier, manager, canSwitchNetworkTo, options) {
1744
+ var _finalQueueToBeRun, _finalQueueToBeRun2;
1744
1745
  if (options === void 0) {
1745
1746
  options = {
1746
1747
  fallbackToOnlyWallet: true
@@ -1788,7 +1789,7 @@ function retryOn(wallet_network, notifier, manager, options) {
1788
1789
  } else if (onlyWalletMatched.length > 0 && options.fallbackToOnlyWallet) {
1789
1790
  finalQueueToBeRun = onlyWalletMatched[0];
1790
1791
  }
1791
- (_finalQueueToBeRun = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun.checkBlock();
1792
+ if (!(canSwitchNetworkTo != null && canSwitchNetworkTo(wallet, network))) (_finalQueueToBeRun = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun.unblock();else (_finalQueueToBeRun2 = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun2.checkBlock();
1792
1793
  }
1793
1794
  /*
1794
1795
  For avoiding conflict by making too many requests to wallet, we need to make sure
@@ -1810,27 +1811,22 @@ function _throwOnOK() {
1810
1811
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1811
1812
  while (1) switch (_context3.prev = _context3.next) {
1812
1813
  case 0:
1813
- _context3.prev = 0;
1814
- _context3.next = 3;
1814
+ _context3.next = 2;
1815
1815
  return rawResponse;
1816
- case 3:
1816
+ case 2:
1817
1817
  responseBody = _context3.sent;
1818
1818
  if (!(!responseBody.ok || !responseBody.transaction)) {
1819
- _context3.next = 6;
1819
+ _context3.next = 5;
1820
1820
  break;
1821
1821
  }
1822
1822
  throw PrettyError.CreateTransaction(responseBody.error || 'bad response from create tx endpoint');
1823
- case 6:
1823
+ case 5:
1824
1824
  return _context3.abrupt("return", responseBody);
1825
- case 9:
1826
- _context3.prev = 9;
1827
- _context3.t0 = _context3["catch"](0);
1828
- throw _context3.t0;
1829
- case 12:
1825
+ case 6:
1830
1826
  case "end":
1831
1827
  return _context3.stop();
1832
1828
  }
1833
- }, _callee3, null, [[0, 9]]);
1829
+ }, _callee3);
1834
1830
  }));
1835
1831
  return _throwOnOK.apply(this, arguments);
1836
1832
  }
@@ -1867,7 +1863,7 @@ function checkTransactionStatus(_x) {
1867
1863
  function _checkTransactionStatus() {
1868
1864
  _checkTransactionStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1869
1865
  var _status, _status2, _status3, _status4, _status5, _status6, _status7, _status9, _status10, _status11;
1870
- var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, currentStep, txId, getTxReceiptFailed, status, signer, _useTransactionsRespo, getTransactionResponseByHash, setTransactionResponseByHash, txType, sourceWallet, _signer, txResponse, _yield$signer$wait, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer, _prettifyErrorMessage, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, outputAmount, prevOutputAmount, newTransaction, nextStep, _status8;
1866
+ var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, currentStep, txId, getTxReceiptFailed, status, signer, _useTransactionsData, getTransactionDataByHash, setTransactionDataByHash, txType, sourceWallet, _signer, _getTransactionDataBy, txResponse, receiptReceived, _yield$signer$wait, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer, _prettifyErrorMessage, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, outputAmount, prevOutputAmount, newTransaction, nextStep, _status8;
1871
1867
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1872
1868
  while (1) switch (_context.prev = _context.next) {
1873
1869
  case 0:
@@ -1875,11 +1871,17 @@ function _checkTransactionStatus() {
1875
1871
  swap = getStorage().swapDetails;
1876
1872
  meta = context.meta; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1877
1873
  currentStep = getCurrentStep(swap);
1874
+ if (currentStep != null && currentStep.executedTransactionId) {
1875
+ _context.next = 6;
1876
+ break;
1877
+ }
1878
+ return _context.abrupt("return");
1879
+ case 6:
1878
1880
  txId = currentStep.executedTransactionId;
1879
1881
  getTxReceiptFailed = false;
1880
1882
  status = null;
1881
1883
  signer = null;
1882
- _useTransactionsRespo = useTransactionsResponse(), getTransactionResponseByHash = _useTransactionsRespo.getTransactionResponseByHash, setTransactionResponseByHash = _useTransactionsRespo.setTransactionResponseByHash;
1884
+ _useTransactionsData = useTransactionsData(), getTransactionDataByHash = _useTransactionsData.getTransactionDataByHash, setTransactionDataByHash = _useTransactionsData.setTransactionDataByHash;
1883
1885
  try {
1884
1886
  txType = getCurrentStepTxType(currentStep);
1885
1887
  sourceWallet = getRelatedWallet(swap, currentStep);
@@ -1888,15 +1890,16 @@ function _checkTransactionStatus() {
1888
1890
  // wallet is not connected yet
1889
1891
  // no need to do anything
1890
1892
  }
1891
- _context.prev = 10;
1892
- if (!((_signer = signer) != null && _signer.wait)) {
1893
- _context.next = 19;
1893
+ _context.prev = 12;
1894
+ // if wallet is connected, try to get transaction reciept
1895
+ _getTransactionDataBy = getTransactionDataByHash(txId), txResponse = _getTransactionDataBy.response, receiptReceived = _getTransactionDataBy.receiptReceived;
1896
+ if (!((_signer = signer) != null && _signer.wait && !receiptReceived)) {
1897
+ _context.next = 21;
1894
1898
  break;
1895
1899
  }
1896
- txResponse = getTransactionResponseByHash(txId);
1897
- _context.next = 15;
1900
+ _context.next = 17;
1898
1901
  return signer.wait(txId, txResponse);
1899
- case 15:
1902
+ case 17:
1900
1903
  _yield$signer$wait = _context.sent;
1901
1904
  updatedTxHash = _yield$signer$wait.hash;
1902
1905
  updatedTxResponse = _yield$signer$wait.response;
@@ -1913,14 +1916,20 @@ function _checkTransactionStatus() {
1913
1916
  }
1914
1917
  }
1915
1918
  txId = currentStep.executedTransactionId;
1916
- if (updatedTxHash && updatedTxResponse) setTransactionResponseByHash(updatedTxHash, updatedTxResponse);
1919
+ if (updatedTxHash && updatedTxResponse) setTransactionDataByHash(updatedTxHash, {
1920
+ response: updatedTxResponse
1921
+ });
1922
+ } else {
1923
+ setTransactionDataByHash(updatedTxHash, {
1924
+ receiptReceived: true
1925
+ });
1917
1926
  }
1918
- case 19:
1919
- _context.next = 27;
1920
- break;
1921
1927
  case 21:
1922
- _context.prev = 21;
1923
- _context.t0 = _context["catch"](10);
1928
+ _context.next = 29;
1929
+ break;
1930
+ case 23:
1931
+ _context.prev = 23;
1932
+ _context.t0 = _context["catch"](12);
1924
1933
  _prettifyErrorMessage = prettifyErrorMessage(_context.t0), extraMessage = _prettifyErrorMessage.extraMessage, extraMessageDetail = _prettifyErrorMessage.extraMessageDetail, extraMessageErrorCode = _prettifyErrorMessage.extraMessageErrorCode;
1925
1934
  updateResult = updateSwapStatus({
1926
1935
  getStorage: getStorage,
@@ -1937,39 +1946,39 @@ function _checkTransactionStatus() {
1937
1946
  getTxReceiptFailed = true;
1938
1947
  // We shouldn't return here, because we need to trigger check status job in backend.
1939
1948
  // This is not a ui requirement but the backend one.
1940
- case 27:
1941
- _context.prev = 27;
1942
- _context.next = 30;
1949
+ case 29:
1950
+ _context.prev = 29;
1951
+ _context.next = 32;
1943
1952
  return httpService().checkStatus({
1944
1953
  requestId: swap.requestId,
1945
1954
  txId: txId,
1946
1955
  step: currentStep.id
1947
1956
  });
1948
- case 30:
1957
+ case 32:
1949
1958
  status = _context.sent;
1950
- _context.next = 39;
1959
+ _context.next = 41;
1951
1960
  break;
1952
- case 33:
1953
- _context.prev = 33;
1954
- _context.t1 = _context["catch"](27);
1955
- _context.next = 37;
1961
+ case 35:
1962
+ _context.prev = 35;
1963
+ _context.t1 = _context["catch"](29);
1964
+ _context.next = 39;
1956
1965
  return delay(INTERVAL_FOR_CHECK);
1957
- case 37:
1966
+ case 39:
1958
1967
  retry();
1959
1968
  return _context.abrupt("return");
1960
- case 39:
1969
+ case 41:
1961
1970
  if (!getTxReceiptFailed) {
1962
- _context.next = 41;
1971
+ _context.next = 43;
1963
1972
  break;
1964
1973
  }
1965
1974
  return _context.abrupt("return", failed());
1966
- case 41:
1975
+ case 43:
1967
1976
  if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
1968
- _context.next = 43;
1977
+ _context.next = 45;
1969
1978
  break;
1970
1979
  }
1971
1980
  return _context.abrupt("return");
1972
- case 43:
1981
+ case 45:
1973
1982
  outputAmount = ((_status = status) == null ? void 0 : _status.outputAmount) || (currentStep.outputAmount ? currentStep.outputAmount : null);
1974
1983
  prevOutputAmount = currentStep.outputAmount || null;
1975
1984
  swap.extraMessage = ((_status2 = status) == null ? void 0 : _status2.extraMessage) || swap.extraMessage;
@@ -2015,31 +2024,31 @@ function _checkTransactionStatus() {
2015
2024
  swapDetails: swap
2016
2025
  }));
2017
2026
  if (!(((_status9 = status) == null ? void 0 : _status9.status) === 'failed')) {
2018
- _context.next = 62;
2027
+ _context.next = 64;
2019
2028
  break;
2020
2029
  }
2021
2030
  failed();
2022
- _context.next = 70;
2031
+ _context.next = 72;
2023
2032
  break;
2024
- case 62:
2033
+ case 64:
2025
2034
  if (!(((_status10 = status) == null ? void 0 : _status10.status) === 'success' || ((_status11 = status) == null ? void 0 : _status11.status) === 'running' && !!status.newTx)) {
2026
- _context.next = 67;
2035
+ _context.next = 69;
2027
2036
  break;
2028
2037
  }
2029
2038
  schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
2030
2039
  next();
2031
- _context.next = 70;
2040
+ _context.next = 72;
2032
2041
  break;
2033
- case 67:
2034
- _context.next = 69;
2035
- return delay(INTERVAL_FOR_CHECK);
2036
2042
  case 69:
2043
+ _context.next = 71;
2044
+ return delay(INTERVAL_FOR_CHECK);
2045
+ case 71:
2037
2046
  retry();
2038
- case 70:
2047
+ case 72:
2039
2048
  case "end":
2040
2049
  return _context.stop();
2041
2050
  }
2042
- }, _callee, null, [[10, 21], [27, 33]]);
2051
+ }, _callee, null, [[12, 23], [29, 35]]);
2043
2052
  }));
2044
2053
  return _checkTransactionStatus.apply(this, arguments);
2045
2054
  }
@@ -2056,14 +2065,14 @@ function checkApprovalStatus(_x2) {
2056
2065
  */
2057
2066
  function _checkApprovalStatus() {
2058
2067
  _checkApprovalStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
2059
- var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, _useTransactionsRespo2, getTransactionResponseByHash, setTransactionResponseByHash, currentStep, txId, signer, txType, sourceWallet, _signer2, txResponse, _yield$signer$wait2, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer2, _prettifyErrorMessage2, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, isApproved, response, message, details, _updateResult;
2068
+ var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, _useTransactionsData2, getTransactionDataByHash, setTransactionDataByHash, currentStep, txId, signer, txType, sourceWallet, _signer2, _getTransactionDataBy2, txResponse, receiptReceived, _yield$signer$wait2, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer2, _prettifyErrorMessage2, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, isApproved, response, message, details, _updateResult;
2060
2069
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2061
2070
  while (1) switch (_context2.prev = _context2.next) {
2062
2071
  case 0:
2063
2072
  getStorage = _ref2.getStorage, setStorage = _ref2.setStorage, next = _ref2.next, schedule = _ref2.schedule, retry = _ref2.retry, failed = _ref2.failed, context = _ref2.context;
2064
2073
  swap = getStorage().swapDetails;
2065
2074
  meta = context.meta;
2066
- _useTransactionsRespo2 = useTransactionsResponse(), getTransactionResponseByHash = _useTransactionsRespo2.getTransactionResponseByHash, setTransactionResponseByHash = _useTransactionsRespo2.setTransactionResponseByHash;
2075
+ _useTransactionsData2 = useTransactionsData(), getTransactionDataByHash = _useTransactionsData2.getTransactionDataByHash, setTransactionDataByHash = _useTransactionsData2.setTransactionDataByHash;
2067
2076
  currentStep = getCurrentStep(swap);
2068
2077
  if (currentStep) {
2069
2078
  _context2.next = 8;
@@ -2072,6 +2081,12 @@ function _checkApprovalStatus() {
2072
2081
  console.log('ignore check status, current step is null');
2073
2082
  return _context2.abrupt("return");
2074
2083
  case 8:
2084
+ if (currentStep != null && currentStep.executedTransactionId) {
2085
+ _context2.next = 10;
2086
+ break;
2087
+ }
2088
+ return _context2.abrupt("return");
2089
+ case 10:
2075
2090
  txId = currentStep.executedTransactionId;
2076
2091
  signer = null;
2077
2092
  try {
@@ -2082,15 +2097,15 @@ function _checkApprovalStatus() {
2082
2097
  // wallet is not connected yet
2083
2098
  // no need to do anything
2084
2099
  }
2085
- _context2.prev = 11;
2086
- if (!((_signer2 = signer) != null && _signer2.wait)) {
2087
- _context2.next = 20;
2100
+ _context2.prev = 13;
2101
+ _getTransactionDataBy2 = getTransactionDataByHash(txId), txResponse = _getTransactionDataBy2.response, receiptReceived = _getTransactionDataBy2.receiptReceived; // if wallet is connected, try to get transaction reciept
2102
+ if (!((_signer2 = signer) != null && _signer2.wait && !receiptReceived)) {
2103
+ _context2.next = 22;
2088
2104
  break;
2089
2105
  }
2090
- txResponse = getTransactionResponseByHash(txId);
2091
- _context2.next = 16;
2106
+ _context2.next = 18;
2092
2107
  return signer.wait(txId, txResponse);
2093
- case 16:
2108
+ case 18:
2094
2109
  _yield$signer$wait2 = _context2.sent;
2095
2110
  updatedTxHash = _yield$signer$wait2.hash;
2096
2111
  updatedTxResponse = _yield$signer$wait2.response;
@@ -2107,14 +2122,20 @@ function _checkApprovalStatus() {
2107
2122
  }
2108
2123
  }
2109
2124
  txId = currentStep.executedTransactionId;
2110
- if (updatedTxHash && updatedTxResponse) setTransactionResponseByHash(updatedTxHash, updatedTxResponse);
2125
+ if (updatedTxHash && updatedTxResponse) setTransactionDataByHash(updatedTxHash, {
2126
+ response: updatedTxResponse
2127
+ });
2128
+ } else {
2129
+ setTransactionDataByHash(updatedTxHash, {
2130
+ receiptReceived: true
2131
+ });
2111
2132
  }
2112
- case 20:
2113
- _context2.next = 28;
2114
- break;
2115
2133
  case 22:
2116
- _context2.prev = 22;
2117
- _context2.t0 = _context2["catch"](11);
2134
+ _context2.next = 30;
2135
+ break;
2136
+ case 24:
2137
+ _context2.prev = 24;
2138
+ _context2.t0 = _context2["catch"](13);
2118
2139
  _prettifyErrorMessage2 = prettifyErrorMessage(_context2.t0), extraMessage = _prettifyErrorMessage2.extraMessage, extraMessageDetail = _prettifyErrorMessage2.extraMessageDetail, extraMessageErrorCode = _prettifyErrorMessage2.extraMessageErrorCode;
2119
2140
  updateResult = updateSwapStatus({
2120
2141
  getStorage: getStorage,
@@ -2129,19 +2150,19 @@ function _checkApprovalStatus() {
2129
2150
  eventType: 'task_failed'
2130
2151
  }, updateResult));
2131
2152
  return _context2.abrupt("return", failed());
2132
- case 28:
2153
+ case 30:
2133
2154
  isApproved = false;
2134
- _context2.prev = 29;
2135
- _context2.next = 32;
2136
- return httpService().checkApproval(swap.requestId, currentStep.executedTransactionId || '');
2137
- case 32:
2155
+ _context2.prev = 31;
2156
+ _context2.next = 34;
2157
+ return httpService().checkApproval(swap.requestId, currentStep.executedTransactionId);
2158
+ case 34:
2138
2159
  response = _context2.sent;
2139
2160
  if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
2140
- _context2.next = 35;
2161
+ _context2.next = 37;
2141
2162
  break;
2142
2163
  }
2143
2164
  return _context2.abrupt("return");
2144
- case 35:
2165
+ case 37:
2145
2166
  isApproved = response.isApproved;
2146
2167
  if (!isApproved && (response.txStatus === 'failed' || response.txStatus === 'success')) {
2147
2168
  if (response.txStatus === 'failed') {
@@ -2174,15 +2195,15 @@ function _checkApprovalStatus() {
2174
2195
  step: currentStep
2175
2196
  });
2176
2197
  }
2177
- _context2.next = 42;
2198
+ _context2.next = 44;
2178
2199
  break;
2179
- case 39:
2180
- _context2.prev = 39;
2181
- _context2.t1 = _context2["catch"](29);
2200
+ case 41:
2201
+ _context2.prev = 41;
2202
+ _context2.t1 = _context2["catch"](31);
2182
2203
  isApproved = false;
2183
- case 42:
2204
+ case 44:
2184
2205
  if (!isApproved) {
2185
- _context2.next = 58;
2206
+ _context2.next = 60;
2186
2207
  break;
2187
2208
  }
2188
2209
  currentStep.status = 'approved';
@@ -2204,18 +2225,18 @@ function _checkApprovalStatus() {
2204
2225
  });
2205
2226
  schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
2206
2227
  next();
2207
- _context2.next = 61;
2228
+ _context2.next = 63;
2208
2229
  break;
2209
- case 58:
2210
- _context2.next = 60;
2211
- return delay(2000);
2212
2230
  case 60:
2231
+ _context2.next = 62;
2232
+ return delay(2000);
2233
+ case 62:
2213
2234
  retry();
2214
- case 61:
2235
+ case 63:
2215
2236
  case "end":
2216
2237
  return _context2.stop();
2217
2238
  }
2218
- }, _callee2, null, [[11, 22], [29, 39]]);
2239
+ }, _callee2, null, [[13, 24], [31, 41]]);
2219
2240
  }));
2220
2241
  return _checkApprovalStatus.apply(this, arguments);
2221
2242
  }
@@ -2737,7 +2758,7 @@ function useQueueManager(params) {
2737
2758
  manager: manager,
2738
2759
  notifier: params.notifier
2739
2760
  });
2740
- retryOn(params.lastConnectedWallet, params.notifier, manager);
2761
+ retryOn(params.lastConnectedWallet, params.notifier, manager, params.canSwitchNetworkTo);
2741
2762
  }
2742
2763
  }, [params.lastConnectedWallet]);
2743
2764
  useEffect(function () {