@rango-dev/queue-manager-rango-preset 0.1.15-next.3 → 0.1.15-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/dist/actions/checkStatus.d.ts.map +1 -1
- package/dist/actions/createTransaction.d.ts.map +1 -1
- package/dist/helpers.d.ts +39 -13
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +396 -580
- 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 +398 -582
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/shared.d.ts +5 -5
- package/dist/shared.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/actions/checkStatus.ts +171 -73
- package/src/actions/createTransaction.ts +5 -50
- package/src/helpers.ts +256 -672
- package/src/shared.ts +31 -33
package/src/shared.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
2
2
|
import {
|
|
3
3
|
CosmosTransaction,
|
|
4
|
-
EvmBlockchainMeta,
|
|
5
4
|
EvmTransaction,
|
|
6
5
|
SimulationResult,
|
|
7
6
|
SolanaTransaction,
|
|
@@ -13,11 +12,18 @@ import {
|
|
|
13
12
|
MetaResponse,
|
|
14
13
|
Token,
|
|
15
14
|
SwapResult,
|
|
15
|
+
BlockchainMeta,
|
|
16
16
|
} from 'rango-sdk';
|
|
17
17
|
|
|
18
18
|
import { PrettyError } from './shared-errors';
|
|
19
19
|
import BigNumber from 'bignumber.js';
|
|
20
20
|
import { numberToString } from './numbers';
|
|
21
|
+
import {
|
|
22
|
+
isCosmosBlockchain,
|
|
23
|
+
isEvmBlockchain,
|
|
24
|
+
isStarknetBlockchain,
|
|
25
|
+
isTronBlockchain,
|
|
26
|
+
} from 'rango-types';
|
|
21
27
|
|
|
22
28
|
export interface PendingSwapWithQueueID {
|
|
23
29
|
id: string;
|
|
@@ -78,6 +84,7 @@ export type EventType =
|
|
|
78
84
|
| 'waiting_for_change_wallet_account'
|
|
79
85
|
| 'network_changed'
|
|
80
86
|
| 'not_enough_balance'
|
|
87
|
+
| 'not_enough_approval'
|
|
81
88
|
| 'waiting_for_queue'
|
|
82
89
|
| 'check_fee_failed'
|
|
83
90
|
| 'route_failed_to_find'
|
|
@@ -251,40 +258,31 @@ export const getCurrentBlockchainOf = (
|
|
|
251
258
|
return blockchain as Network;
|
|
252
259
|
};
|
|
253
260
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (evmBlochain.info.transactionUrl)
|
|
268
|
-
return evmBlochain.info.transactionUrl.replace(
|
|
269
|
-
'{txHash}',
|
|
270
|
-
tx.toLowerCase()
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
throw Error(`Explorer url for ${network} is not implemented`);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export const getStarknetApproveUrl = (tx: string): string => {
|
|
277
|
-
return 'https://starkscan.co/tx/{txHash}'.replace(
|
|
278
|
-
'{txHash}',
|
|
279
|
-
tx.toLowerCase()
|
|
280
|
-
);
|
|
261
|
+
const getBlockchainMetaExplorerBaseUrl = (
|
|
262
|
+
blockchainMeta: BlockchainMeta
|
|
263
|
+
): string | undefined => {
|
|
264
|
+
if (isCosmosBlockchain(blockchainMeta))
|
|
265
|
+
return blockchainMeta.info?.explorerUrlToTx;
|
|
266
|
+
else if (
|
|
267
|
+
isEvmBlockchain(blockchainMeta) ||
|
|
268
|
+
isStarknetBlockchain(blockchainMeta) ||
|
|
269
|
+
isTronBlockchain(blockchainMeta)
|
|
270
|
+
)
|
|
271
|
+
return blockchainMeta.info.transactionUrl;
|
|
272
|
+
return;
|
|
281
273
|
};
|
|
282
274
|
|
|
283
|
-
export const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
275
|
+
export const getScannerUrl = (
|
|
276
|
+
txHash: string,
|
|
277
|
+
network: Network,
|
|
278
|
+
blockchainMetaMap: { [key: string]: BlockchainMeta }
|
|
279
|
+
): string | undefined => {
|
|
280
|
+
const blockchainMeta = blockchainMetaMap[network];
|
|
281
|
+
const baseUrl = getBlockchainMetaExplorerBaseUrl(blockchainMeta);
|
|
282
|
+
if (!baseUrl) return;
|
|
283
|
+
if (baseUrl.indexOf('/{txHash}') !== -1)
|
|
284
|
+
return baseUrl.replace('{txHash}', txHash?.toLowerCase());
|
|
285
|
+
return `${baseUrl}/${txHash?.toLowerCase()}`;
|
|
288
286
|
};
|
|
289
287
|
|
|
290
288
|
export function getNextStep(
|