@rango-dev/queue-manager-rango-preset 0.1.10-next.96 → 0.1.10-next.98

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.96",
3
+ "version": "0.1.10-next.98",
4
4
  "license": "MIT",
5
5
  "module": "dist/queue-manager-rango-preset.esm.js",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,4 @@
1
1
  import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
- import { Network } from '@rango-dev/wallets-shared';
3
2
  import {
4
3
  delay,
5
4
  getCurrentStep,
@@ -82,7 +81,6 @@ async function checkTransactionStatus({
82
81
  currentStep.starknetTransaction = null;
83
82
  currentStep.tronApprovalTransaction = null;
84
83
  currentStep.tronTransaction = null;
85
- currentStep.fromBlockchain = newTransaction.blockChain as Network;
86
84
 
87
85
  if (isEvmTransaction(newTransaction)) {
88
86
  if (newTransaction.isApprovalTx)
package/src/helpers.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { ExecuterActions, QueueType } from '@rango-dev/queue-manager-core';
1
+ import {
2
+ ExecuterActions,
3
+ QueueInfo,
4
+ QueueType,
5
+ } from '@rango-dev/queue-manager-core';
2
6
  import {
3
7
  BlockReason,
4
8
  SwapActionTypes,
@@ -1651,7 +1655,7 @@ export function retryOn(
1651
1655
  const currentStep = getCurrentStep(swap);
1652
1656
  if (currentStep) {
1653
1657
  if (
1654
- currentStep.fromBlockchain == network &&
1658
+ getCurrentBlockchainOfOrNull(swap, currentStep) == network &&
1655
1659
  queueStorage?.swapDetails.wallets[network]?.walletType === wallet
1656
1660
  ) {
1657
1661
  walletAndNetworkMatched.push(q.list);
@@ -1719,3 +1723,20 @@ export async function throwOnOK(
1719
1723
  throw e;
1720
1724
  }
1721
1725
  }
1726
+
1727
+ export function cancelSwap(swap: QueueInfo): {
1728
+ swap: PendingSwap;
1729
+ step: PendingSwapStep | null;
1730
+ } {
1731
+ swap.actions.cancel();
1732
+ return updateSwapStatus({
1733
+ getStorage: swap.actions.getStorage,
1734
+ setStorage: swap.actions.setStorage,
1735
+ message: 'Swap canceled by user.',
1736
+ details:
1737
+ "Warning: If you've already signed and sent a transaction, it won't be affected, but next swap steps will not be executed.",
1738
+ nextStatus: 'failed',
1739
+ nextStepStatus: 'failed',
1740
+ errorCode: 'USER_CANCEL',
1741
+ });
1742
+ }
package/src/index.ts CHANGED
@@ -48,5 +48,6 @@ export {
48
48
  getCurrentStep,
49
49
  getEvmProvider,
50
50
  getRelatedWallet,
51
+ cancelSwap,
51
52
  } from './helpers';
52
53
  export { useMigration, useQueueManager } from './hooks';