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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/queue-manager-rango-preset",
3
- "version": "0.1.10-next.92",
3
+ "version": "0.1.10-next.93",
4
4
  "license": "MIT",
5
5
  "module": "dist/queue-manager-rango-preset.esm.js",
6
6
  "main": "dist/index.js",
package/src/helpers.ts CHANGED
@@ -675,7 +675,7 @@ export function onBlockForChangeNetwork(
675
675
  const swap = queue.getStorage().swapDetails as SwapStorage['swapDetails'];
676
676
  const currentStep = getCurrentStep(swap);
677
677
 
678
- if (!currentStep) return;
678
+ if (!currentStep || swap.status !== 'running') return;
679
679
 
680
680
  const result = markRunningSwapAsSwitchingNetwork({
681
681
  getStorage: queue.getStorage.bind(queue),
@@ -1491,7 +1491,7 @@ export function checkWaitingForConnectWalletChange(params: {
1491
1491
  manager?.getAll().forEach((q) => {
1492
1492
  const queueStorage = q.list.getStorage() as SwapStorage | undefined;
1493
1493
  const swap = queueStorage?.swapDetails;
1494
- if (swap) {
1494
+ if (swap && swap.status === 'running') {
1495
1495
  const currentStep = getCurrentStep(swap);
1496
1496
  if (currentStep) {
1497
1497
  const currentStepRequiredWallet =
@@ -1511,8 +1511,6 @@ export function checkWaitingForConnectWalletChange(params: {
1511
1511
 
1512
1512
  if (currentStepRequiredWallet === wallet && hasWaitingForConnect) {
1513
1513
  const queueInstance = q.list;
1514
- const swap = queueInstance.getStorage()
1515
- ?.swapDetails as SwapStorage['swapDetails'];
1516
1514
  const { type } = getRequiredWallet(swap);
1517
1515
  const description = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK(type);
1518
1516
 
@@ -1552,16 +1550,18 @@ export function checkWaitingForNetworkChange(manager?: Manager): void {
1552
1550
  if (hasWaitingForNetwork) {
1553
1551
  const swap = q.list.getStorage()
1554
1552
  ?.swapDetails as SwapStorage['swapDetails'];
1555
- const { type } = getRequiredWallet(swap);
1556
- const description = ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION(type);
1557
-
1558
- // Change the block reason to waiting for connecting wallet
1559
- q.list.block({
1560
- reason: {
1561
- reason: BlockReason.WAIT_FOR_CONNECT_WALLET,
1562
- description,
1563
- },
1564
- });
1553
+ if (swap.status === 'running') {
1554
+ const { type } = getRequiredWallet(swap);
1555
+ const description = ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION(type);
1556
+
1557
+ // Change the block reason to waiting for connecting wallet
1558
+ q.list.block({
1559
+ reason: {
1560
+ reason: BlockReason.WAIT_FOR_CONNECT_WALLET,
1561
+ description,
1562
+ },
1563
+ });
1564
+ }
1565
1565
  }
1566
1566
  });
1567
1567
  }
@@ -1596,7 +1596,7 @@ export function retryOn(
1596
1596
  const queueStorage = q.list.getStorage() as SwapStorage | undefined;
1597
1597
  const swap = queueStorage?.swapDetails;
1598
1598
 
1599
- if (swap) {
1599
+ if (swap && swap.status === 'running') {
1600
1600
  const currentStep = getCurrentStep(swap);
1601
1601
  if (currentStep) {
1602
1602
  if (