@rango-dev/queue-manager-rango-preset 0.1.12-next.1 → 0.1.12-next.4

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.12-next.1",
3
+ "version": "0.1.12-next.4",
4
4
  "license": "MIT",
5
5
  "module": "dist/queue-manager-rango-preset.esm.js",
6
6
  "main": "dist/index.js",
package/readme.md CHANGED
@@ -1 +1,3 @@
1
1
  # @rango-dev/queue-manager-rango-preset
2
+
3
+ // TODO
package/src/helpers.ts CHANGED
@@ -713,9 +713,14 @@ export function onBlockForChangeNetwork(
713
713
  if (!!type && !!network) {
714
714
  const result = context.switchNetwork(type, network);
715
715
  if (result) {
716
- result.then(() => {
717
- queue.unblock();
718
- });
716
+ result
717
+ .then(() => {
718
+ queue.unblock();
719
+ })
720
+ .catch((error) => {
721
+ // ignore switch network errors
722
+ console.log({ error });
723
+ });
719
724
  }
720
725
  }
721
726
  }
@@ -1755,12 +1760,17 @@ export async function throwOnOK(
1755
1760
  }
1756
1761
  }
1757
1762
 
1758
- export function cancelSwap(swap: QueueInfo): {
1763
+ export function cancelSwap(
1764
+ swap: QueueInfo,
1765
+ manager?: Manager
1766
+ ): {
1759
1767
  swap: PendingSwap;
1760
1768
  step: PendingSwapStep | null;
1761
1769
  } {
1770
+ const { reset } = claimQueue();
1762
1771
  swap.actions.cancel();
1763
- return updateSwapStatus({
1772
+
1773
+ const updateResult = updateSwapStatus({
1764
1774
  getStorage: swap.actions.getStorage,
1765
1775
  setStorage: swap.actions.setStorage,
1766
1776
  message: 'Swap canceled by user.',
@@ -1770,4 +1780,8 @@ export function cancelSwap(swap: QueueInfo): {
1770
1780
  nextStepStatus: 'failed',
1771
1781
  errorCode: 'USER_CANCEL',
1772
1782
  });
1783
+ reset();
1784
+ if (manager) manager?.retry();
1785
+
1786
+ return updateResult;
1773
1787
  }