@rango-dev/queue-manager-rango-preset 0.1.10-next.95 → 0.1.10-next.96
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/dist/actions/checkStatus.d.ts.map +1 -1
- package/dist/actions/executeTransaction.d.ts.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +34 -19
- package/dist/queue-manager-rango-preset.cjs.development.js.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js.map +1 -1
- package/dist/queue-manager-rango-preset.esm.js +34 -19
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +2 -0
- package/src/actions/executeTransaction.ts +7 -3
- package/src/helpers.ts +17 -4
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExecuterActions } from '@rango-dev/queue-manager-core';
|
|
2
|
+
import { Network } from '@rango-dev/wallets-shared';
|
|
2
3
|
import {
|
|
3
4
|
delay,
|
|
4
5
|
getCurrentStep,
|
|
@@ -81,6 +82,7 @@ async function checkTransactionStatus({
|
|
|
81
82
|
currentStep.starknetTransaction = null;
|
|
82
83
|
currentStep.tronApprovalTransaction = null;
|
|
83
84
|
currentStep.tronTransaction = null;
|
|
85
|
+
currentStep.fromBlockchain = newTransaction.blockChain as Network;
|
|
84
86
|
|
|
85
87
|
if (isEvmTransaction(newTransaction)) {
|
|
86
88
|
if (newTransaction.isApprovalTx)
|
|
@@ -57,9 +57,13 @@ export async function executeTransaction(
|
|
|
57
57
|
const isWrongAddress = !isRequiredWalletConnected(swap, context.state);
|
|
58
58
|
if (isWrongAddress) {
|
|
59
59
|
const { type, address } = getRequiredWallet(swap);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const isWalletInCompatible = wallets?.blockchains?.find(
|
|
61
|
+
(w) => !w.accounts?.find((account) => account.walletType === type)
|
|
62
|
+
);
|
|
63
|
+
const description =
|
|
64
|
+
!wallets || isWalletInCompatible
|
|
65
|
+
? ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION(type)
|
|
66
|
+
: ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address);
|
|
63
67
|
|
|
64
68
|
const blockedFor = {
|
|
65
69
|
reason: BlockReason.WAIT_FOR_CONNECT_WALLET,
|
package/src/helpers.ts
CHANGED
|
@@ -87,6 +87,16 @@ function claimQueue() {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* Returns "wallet and network" separately, even if the wallet is dashed inside.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
function splitWalletNetwork(input: string): string[] {
|
|
97
|
+
return input?.split(/-(?=[^-]*$)/);
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
/**
|
|
91
101
|
*
|
|
92
102
|
* Returns `steps`, if it's a `running` swap.
|
|
@@ -1521,8 +1531,7 @@ export function checkWaitingForConnectWalletChange(params: {
|
|
|
1521
1531
|
evmChains: EvmBlockchainMeta[];
|
|
1522
1532
|
}): void {
|
|
1523
1533
|
const { wallet_network, evmChains, manager } = params;
|
|
1524
|
-
const [wallet, network] = wallet_network
|
|
1525
|
-
|
|
1534
|
+
const [wallet, network] = splitWalletNetwork(wallet_network);
|
|
1526
1535
|
// We only need change network for EVM chains.
|
|
1527
1536
|
if (!evmChains.some((chain) => chain.name == network)) return;
|
|
1528
1537
|
|
|
@@ -1547,7 +1556,11 @@ export function checkWaitingForConnectWalletChange(params: {
|
|
|
1547
1556
|
}
|
|
1548
1557
|
);
|
|
1549
1558
|
|
|
1550
|
-
if (
|
|
1559
|
+
if (
|
|
1560
|
+
currentStepRequiredWallet === wallet &&
|
|
1561
|
+
hasWaitingForConnect &&
|
|
1562
|
+
getCurrentBlockchainOfOrNull(swap, currentStep) != network
|
|
1563
|
+
) {
|
|
1551
1564
|
const queueInstance = q.list;
|
|
1552
1565
|
const { type } = getRequiredWallet(swap);
|
|
1553
1566
|
const description = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK(type);
|
|
@@ -1620,7 +1633,7 @@ export function retryOn(
|
|
|
1620
1633
|
manager?: Manager,
|
|
1621
1634
|
options = { fallbackToOnlyWallet: true }
|
|
1622
1635
|
): void {
|
|
1623
|
-
const [wallet, network] = wallet_network
|
|
1636
|
+
const [wallet, network] = splitWalletNetwork(wallet_network);
|
|
1624
1637
|
if (!wallet || !network) {
|
|
1625
1638
|
return;
|
|
1626
1639
|
}
|