@rango-dev/queue-manager-rango-preset 0.1.10-next.102 → 0.1.10-next.104

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.
@@ -1014,42 +1014,41 @@ function _isNetworkMatchedForTransaction() {
1014
1014
  while (1) switch (_context2.prev = _context2.next) {
1015
1015
  case 0:
1016
1016
  if (!isWalletNull(wallet)) {
1017
- _context2.next = 3;
1017
+ _context2.next = 2;
1018
1018
  break;
1019
1019
  }
1020
- console.warn('wallet object is null');
1021
1020
  return _context2.abrupt("return", false);
1022
- case 3:
1021
+ case 2:
1023
1022
  fromBlockChain = getCurrentBlockchainOfOrNull(swap, step);
1024
1023
  if (fromBlockChain) {
1025
- _context2.next = 6;
1024
+ _context2.next = 5;
1026
1025
  break;
1027
1026
  }
1028
1027
  return _context2.abrupt("return", false);
1029
- case 6:
1028
+ case 5:
1030
1029
  if (!meta.evmBasedChains.find(function (evmBlochain) {
1031
1030
  return evmBlochain.name === fromBlockChain;
1032
1031
  })) {
1033
- _context2.next = 30;
1032
+ _context2.next = 29;
1034
1033
  break;
1035
1034
  }
1036
- _context2.prev = 7;
1035
+ _context2.prev = 6;
1037
1036
  sourceWallet = swap.wallets[fromBlockChain];
1038
1037
  if (!sourceWallet) {
1039
- _context2.next = 24;
1038
+ _context2.next = 23;
1040
1039
  break;
1041
1040
  }
1042
1041
  if (![WalletType.META_MASK, WalletType.BINANCE_CHAIN, WalletType.XDEFI, WalletType.WALLET_CONNECT, WalletType.TRUST_WALLET, WalletType.COIN98, WalletType.EXODUS, WalletType.OKX, WalletType.COINBASE, WalletType.TOKEN_POCKET, WalletType.MATH, WalletType.SAFEPAL, WalletType.COSMOSTATION, WalletType.CLOVER, WalletType.BRAVE, WalletType.FRONTIER, WalletType.KUCOIN].includes(sourceWallet.walletType)) {
1043
- _context2.next = 23;
1042
+ _context2.next = 22;
1044
1043
  break;
1045
1044
  }
1046
1045
  provider = getEvmProvider(providers, sourceWallet.walletType);
1047
- _context2.next = 14;
1046
+ _context2.next = 13;
1048
1047
  return getChainId(provider);
1049
- case 14:
1048
+ case 13:
1050
1049
  chainId = _context2.sent;
1051
1050
  if (!chainId) {
1052
- _context2.next = 21;
1051
+ _context2.next = 20;
1053
1052
  break;
1054
1053
  }
1055
1054
  blockChain = getBlockChainNameFromId(chainId, Object.entries(meta.blockchains).map(function (_ref6) {
@@ -1057,37 +1056,37 @@ function _isNetworkMatchedForTransaction() {
1057
1056
  return blockchainMeta;
1058
1057
  }));
1059
1058
  if (!(blockChain && blockChain.toLowerCase() === fromBlockChain.toLowerCase())) {
1060
- _context2.next = 19;
1059
+ _context2.next = 18;
1061
1060
  break;
1062
1061
  }
1063
1062
  return _context2.abrupt("return", true);
1064
- case 19:
1063
+ case 18:
1065
1064
  if (!(blockChain && blockChain.toLowerCase() !== fromBlockChain.toLowerCase())) {
1066
- _context2.next = 21;
1065
+ _context2.next = 20;
1067
1066
  break;
1068
1067
  }
1069
1068
  return _context2.abrupt("return", false);
1070
- case 21:
1071
- _context2.next = 24;
1069
+ case 20:
1070
+ _context2.next = 23;
1072
1071
  break;
1073
- case 23:
1072
+ case 22:
1074
1073
  return _context2.abrupt("return", true);
1075
- case 24:
1076
- _context2.next = 29;
1074
+ case 23:
1075
+ _context2.next = 28;
1077
1076
  break;
1078
- case 26:
1079
- _context2.prev = 26;
1080
- _context2.t0 = _context2["catch"](7);
1077
+ case 25:
1078
+ _context2.prev = 25;
1079
+ _context2.t0 = _context2["catch"](6);
1081
1080
  console.log(_context2.t0);
1082
- case 29:
1081
+ case 28:
1083
1082
  return _context2.abrupt("return", false);
1084
- case 30:
1083
+ case 29:
1085
1084
  return _context2.abrupt("return", true);
1086
- case 31:
1085
+ case 30:
1087
1086
  case "end":
1088
1087
  return _context2.stop();
1089
1088
  }
1090
- }, _callee2, null, [[7, 26]]);
1089
+ }, _callee2, null, [[6, 25]]);
1091
1090
  }));
1092
1091
  return _isNetworkMatchedForTransaction.apply(this, arguments);
1093
1092
  }
@@ -1227,6 +1226,7 @@ function onDependsOnOtherQueues(_event, meta) {
1227
1226
  }
1228
1227
  var claimerId = claimedBy();
1229
1228
  var isClaimedByAnyQueue = !!claimerId;
1229
+ if (claimerId === queue.id) return;
1230
1230
  // Check if any queue `claimed` before, if yes, we don't should do anything.
1231
1231
  if (isClaimedByAnyQueue) {
1232
1232
  // We need to keep the latest swap messages
@@ -1258,7 +1258,7 @@ function onDependsOnOtherQueues(_event, meta) {
1258
1258
  resetClaimedBy: function resetClaimedBy() {
1259
1259
  reset();
1260
1260
  // TODO: Use key generator
1261
- retryOn(type + "-" + network + "-" + address, context.notifier, manager);
1261
+ retryOn(type + "-" + network + ":" + address, context.notifier, manager);
1262
1262
  }
1263
1263
  });
1264
1264
  }
@@ -1338,7 +1338,6 @@ function singTransaction(actions) {
1338
1338
  }, updateResult));
1339
1339
  // Execute transaction
1340
1340
  walletSigners.getSigner(TransactionType.EVM).signAndSendTx(evmApprovalTransaction, walletAddress, null).then(function (hash) {
1341
- console.debug('transaction of approval minted successfully', hash);
1342
1341
  var approveUrl = getEvmApproveUrl(hash, getCurrentBlockchainOf(swap, currentStep), meta.evmBasedChains);
1343
1342
  setStepTransactionIds(actions, hash, notifier, 'check_approve_tx_status', approveUrl);
1344
1343
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
@@ -1347,7 +1346,6 @@ function singTransaction(actions) {
1347
1346
  }, function (error) {
1348
1347
  var _error$root, _error$root2, _error$root3;
1349
1348
  if (swap.status === 'failed') return;
1350
- console.debug('error in approving', error);
1351
1349
  var _prettifyErrorMessage = prettifyErrorMessage(error),
1352
1350
  extraMessage = _prettifyErrorMessage.extraMessage,
1353
1351
  extraMessageDetail = _prettifyErrorMessage.extraMessageDetail,
@@ -1386,7 +1384,6 @@ function singTransaction(actions) {
1386
1384
  }, _updateResult));
1387
1385
  // Execute transaction
1388
1386
  walletSigners.getSigner(TransactionType.TRON).signAndSendTx(tronApprovalTransaction, walletAddress, null).then(function (hash) {
1389
- console.debug('transaction of approval minted successfully', hash);
1390
1387
  var approveUrl = getTronApproveUrl(hash);
1391
1388
  setStepTransactionIds(actions, hash, notifier, 'check_approve_tx_status', approveUrl);
1392
1389
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
@@ -1395,7 +1392,6 @@ function singTransaction(actions) {
1395
1392
  }, function (error) {
1396
1393
  var _error$root4, _error$root5, _error$root6;
1397
1394
  if (swap.status === 'failed') return;
1398
- console.debug('error in approving', error);
1399
1395
  var _prettifyErrorMessage2 = prettifyErrorMessage(error),
1400
1396
  extraMessage = _prettifyErrorMessage2.extraMessage,
1401
1397
  extraMessageDetail = _prettifyErrorMessage2.extraMessageDetail,
@@ -1434,7 +1430,6 @@ function singTransaction(actions) {
1434
1430
  }, _updateResult2));
1435
1431
  // Execute transaction
1436
1432
  walletSigners.getSigner(TransactionType.STARKNET).signAndSendTx(starknetApprovalTransaction, walletAddress, null).then(function (hash) {
1437
- console.debug('transaction of approval minted successfully', hash);
1438
1433
  var approveUrl = getStarknetApproveUrl(hash);
1439
1434
  setStepTransactionIds(actions, hash, notifier, 'check_approve_tx_status', approveUrl);
1440
1435
  schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
@@ -1443,7 +1438,6 @@ function singTransaction(actions) {
1443
1438
  }, function (error) {
1444
1439
  var _error$root7, _error$root8, _error$root9;
1445
1440
  if (swap.status === 'failed') return;
1446
- console.debug('error in approving', error);
1447
1441
  var _prettifyErrorMessage3 = prettifyErrorMessage(error),
1448
1442
  extraMessage = _prettifyErrorMessage3.extraMessage,
1449
1443
  extraMessageDetail = _prettifyErrorMessage3.extraMessageDetail,
@@ -2206,16 +2200,15 @@ function _checkApprovalStatus() {
2206
2200
  step: currentStep
2207
2201
  });
2208
2202
  }
2209
- _context2.next = 16;
2203
+ _context2.next = 15;
2210
2204
  break;
2211
2205
  case 12:
2212
2206
  _context2.prev = 12;
2213
2207
  _context2.t0 = _context2["catch"](4);
2214
- console.error('Failed to check getApprovedAmount', _context2.t0);
2215
2208
  isApproved = false;
2216
- case 16:
2209
+ case 15:
2217
2210
  if (!isApproved) {
2218
- _context2.next = 32;
2211
+ _context2.next = 31;
2219
2212
  break;
2220
2213
  }
2221
2214
  currentStep.status = 'approved';
@@ -2237,14 +2230,14 @@ function _checkApprovalStatus() {
2237
2230
  });
2238
2231
  schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
2239
2232
  next();
2240
- _context2.next = 35;
2241
- break;
2242
- case 32:
2243
2233
  _context2.next = 34;
2234
+ break;
2235
+ case 31:
2236
+ _context2.next = 33;
2244
2237
  return delay(2000);
2245
- case 34:
2238
+ case 33:
2246
2239
  retry();
2247
- case 35:
2240
+ case 34:
2248
2241
  case "end":
2249
2242
  return _context2.stop();
2250
2243
  }
@@ -2439,7 +2432,7 @@ function _executeTransaction() {
2439
2432
  We only run one request at a time (In parallel mode).
2440
2433
  */
2441
2434
  needsToBlockQueue = isNeedBlockQueueForParallel(currentStep);
2442
- if (!(needsToBlockQueue && !isClaimed && context.claimedBy)) {
2435
+ if (!(needsToBlockQueue && !isClaimed)) {
2443
2436
  _context.next = 20;
2444
2437
  break;
2445
2438
  }