@rango-dev/queue-manager-rango-preset 0.1.15-next.8 → 0.2.0
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/CHANGELOG.md +11 -0
- package/dist/actions/checkStatus.d.ts +11 -11
- package/dist/actions/checkStatus.d.ts.map +1 -1
- package/dist/actions/createTransaction.d.ts +10 -10
- package/dist/actions/createTransaction.d.ts.map +1 -1
- package/dist/actions/executeTransaction.d.ts +12 -12
- package/dist/actions/executeTransaction.d.ts.map +1 -1
- package/dist/actions/scheduleNextStep.d.ts +12 -12
- package/dist/actions/scheduleNextStep.d.ts.map +1 -1
- package/dist/actions/start.d.ts +3 -3
- package/dist/actions/start.d.ts.map +1 -1
- package/dist/configs.d.ts +7 -7
- package/dist/configs.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/helpers.d.ts +242 -242
- package/dist/helpers.d.ts.map +1 -1
- package/dist/hooks.d.ts +18 -18
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +7 -0
- package/dist/migration.d.ts +14 -14
- package/dist/migration.d.ts.map +1 -1
- package/dist/numbers.d.ts +2 -2
- package/dist/numbers.d.ts.map +1 -1
- package/dist/queueDef.d.ts +9 -9
- package/dist/queueDef.d.ts.map +1 -1
- package/dist/services/httpService.d.ts +2 -2
- package/dist/services/httpService.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/shared-errors.d.ts +24 -24
- package/dist/shared-errors.d.ts.map +1 -1
- package/dist/shared-sentry.d.ts +3 -3
- package/dist/shared-sentry.d.ts.map +1 -1
- package/dist/shared.d.ts +158 -158
- package/dist/shared.d.ts.map +1 -1
- package/dist/types.d.ts +50 -50
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/index.ts +8 -6
- package/dist/queue-manager-rango-preset.cjs.development.js +0 -2803
- package/dist/queue-manager-rango-preset.cjs.development.js.map +0 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js +0 -2
- package/dist/queue-manager-rango-preset.cjs.production.min.js.map +0 -1
- package/dist/queue-manager-rango-preset.esm.js +0 -2782
- package/dist/queue-manager-rango-preset.esm.js.map +0 -1
package/dist/helpers.d.ts
CHANGED
|
@@ -1,243 +1,243 @@
|
|
|
1
|
-
import { ExecuterActions, QueueInfo } from '@rango-dev/queue-manager-core';
|
|
2
|
-
import { SwapActionTypes, SwapQueueContext, SwapQueueDef, SwapStorage } from './types';
|
|
3
|
-
import { Meta, Network, WalletState, WalletType } from '@rango-dev/wallets-shared';
|
|
4
|
-
import { Providers } from '@rango-dev/wallets-core';
|
|
5
|
-
import { Transaction, TransactionType, EvmBlockchainMeta, CreateTransactionResponse } from 'rango-sdk';
|
|
6
|
-
import { Manager } from '@rango-dev/queue-manager-core';
|
|
7
|
-
import { EventType, PendingSwap, PendingSwapNetworkStatus, PendingSwapStep, StepStatus, SwapStatus, Wallet } from './shared';
|
|
8
|
-
import { APIErrorCode, SignerErrorCode } from 'rango-types/lib';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* We simply use module-level variable to keep track of which queue has claimed the execution of parallel runnings.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export declare function claimQueue(): {
|
|
18
|
-
claimedBy: () => string | undefined;
|
|
19
|
-
setClaimer: (queue_id: string) => void;
|
|
20
|
-
reset: () => void;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* We use module-level variable to keep track of
|
|
25
|
-
* map of transactions hash to the TransactionResponse and ...
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
response?: any;
|
|
30
|
-
receiptReceived?: boolean;
|
|
31
|
-
};
|
|
32
|
-
export declare function useTransactionsData(): {
|
|
33
|
-
getTransactionDataByHash: (hash: string) => TransactionData;
|
|
34
|
-
setTransactionDataByHash: (hash: string, data: TransactionData) => void;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Sample inputs are:
|
|
38
|
-
* - "metamask-ETH"
|
|
39
|
-
* - "metamask-BSC-BSC:0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
40
|
-
* - "token-pocket-BSC-BSC:0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
41
|
-
* Returns "wallet and network" separately, even if the wallet is dashed inside.
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
export declare function splitWalletNetwork(input: string): string[];
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* Returns `steps`, if it's a `running` swap.
|
|
48
|
-
* Each `PendingSwap` has a `steps` inside it, `steps` shows how many tasks should be created and run to finish the swap.
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
export declare const getCurrentStep: (swap: PendingSwap) => PendingSwapStep | null;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* Returns current step transaction
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
export declare const getCurrentStepTx: (currentStep: PendingSwapStep) => Transaction | null;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* Set current step transaction
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
export declare const setCurrentStepTx: (currentStep: PendingSwapStep, transaction: Transaction) => PendingSwapStep;
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* Returns current step transaction type
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
export declare const getCurrentStepTxType: (currentStep: PendingSwapStep) => TransactionType | undefined;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* Returns a boolean indicating that current step is an approval tx or not.
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
export declare const isApprovalCurrentStepTx: (currentStep: PendingSwapStep) => boolean;
|
|
76
|
-
/**
|
|
77
|
-
* When we are doing a swap, there are some common fields that will be updated together.
|
|
78
|
-
* This function helps us to update a swap status and also it will update some more fields like `extraMessageSeverity` based on the input.
|
|
79
|
-
*/
|
|
80
|
-
export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, nextStepStatus, message, details, errorCode, hasAlreadyProceededToSign, }: {
|
|
81
|
-
getStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['getStorage'];
|
|
82
|
-
setStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['setStorage'];
|
|
83
|
-
nextStatus?: SwapStatus;
|
|
84
|
-
nextStepStatus?: StepStatus;
|
|
85
|
-
message?: string;
|
|
86
|
-
details?: string | null | undefined;
|
|
87
|
-
errorCode?: APIErrorCode | SignerErrorCode | null;
|
|
88
|
-
hasAlreadyProceededToSign?: boolean;
|
|
89
|
-
}): {
|
|
90
|
-
swap: PendingSwap;
|
|
91
|
-
step: PendingSwapStep | null;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* Set current step transaction hash, update pending swap status, and notify user if needed
|
|
96
|
-
*
|
|
97
|
-
*/
|
|
98
|
-
export declare function setStepTransactionIds({ getStorage, setStorage }: ExecuterActions<SwapStorage, SwapActionTypes>, txId: string | null, notifier: SwapQueueContext['notifier'], eventType?: EventType, explorerUrl?: {
|
|
99
|
-
url?: string;
|
|
100
|
-
description?: string;
|
|
101
|
-
}): void;
|
|
102
|
-
/**
|
|
103
|
-
* If a swap needs a wallet to be connected,
|
|
104
|
-
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
105
|
-
*/
|
|
106
|
-
export declare function markRunningSwapAsWaitingForConnectingWallet({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>, reason: string, reasonDetail: string): void;
|
|
107
|
-
/**
|
|
108
|
-
* If a swap needs a certain network to proceed,
|
|
109
|
-
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
110
|
-
*/
|
|
111
|
-
export declare function markRunningSwapAsSwitchingNetwork({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>): {
|
|
112
|
-
swap: PendingSwap;
|
|
113
|
-
step: PendingSwapStep;
|
|
114
|
-
} | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* We are marking the queue as it depends on other queues to be run (on Parallel mode)
|
|
117
|
-
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
118
|
-
*/
|
|
119
|
-
export declare function markRunningSwapAsDependsOnOtherQueues({ getStorage, setStorage, notifier, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'> & {
|
|
120
|
-
notifier: SwapQueueContext['notifier'];
|
|
121
|
-
}): {
|
|
122
|
-
swap: PendingSwap;
|
|
123
|
-
step: PendingSwapStep;
|
|
124
|
-
} | undefined;
|
|
125
|
-
export declare function delay(ms: number): Promise<unknown>;
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
* To execute a swap, we are keeping the user prefrences on what wallet they are going to use for a sepecific blockchain
|
|
129
|
-
* By passing the swap and the network we are looking for, it returns the wallet name that user selected.
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
export declare const getSwapWalletType: (swap: PendingSwap, network: Network) => WalletType;
|
|
133
|
-
/**
|
|
134
|
-
*
|
|
135
|
-
* We are keeping the connected wallet in a specific structure (`Wallet`),
|
|
136
|
-
* By using this function we normally want to check a specific wallet is connected and exists or not.
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
|
-
export declare function isWalletNull(wallet: Wallet | null): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* On our implementation for `wallets` package, We keep the instance in 2 ways
|
|
142
|
-
* If it's a single chain wallet, it returns the instance directly,
|
|
143
|
-
* If it's a multichain wallet, it returns a `Map` of instances.
|
|
144
|
-
* This function will get the `ETHEREUM` instance in both types.
|
|
145
|
-
*/
|
|
146
|
-
export declare function getEvmProvider(providers: Providers, type: WalletType): any;
|
|
147
|
-
/**
|
|
148
|
-
* In a `PendingSwap`, each step needs a wallet to proceed,
|
|
149
|
-
* By using this function we can access what wallet exactly we need to run current step.
|
|
150
|
-
*/
|
|
151
|
-
export declare function getRequiredWallet(swap: PendingSwap): {
|
|
152
|
-
type: WalletType | null;
|
|
153
|
-
network: Network | null;
|
|
154
|
-
address: string | null;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* For running a swap safely, we need to make sure about the state of wallet
|
|
158
|
-
* which means the netowrk/chain of wallet should be exactly on what a transaction needs.
|
|
159
|
-
*/
|
|
160
|
-
export declare function isNetworkMatchedForTransaction(swap: PendingSwap, step: PendingSwapStep, wallet: Wallet | null, meta: Meta, providers: Providers): Promise<boolean>;
|
|
161
|
-
export declare const isTxAlreadyCreated: (swap: PendingSwap, step: PendingSwapStep) => boolean;
|
|
162
|
-
export declare function resetNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
|
|
163
|
-
export declare function updateNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>, data?: {
|
|
164
|
-
message: string;
|
|
165
|
-
details: string;
|
|
166
|
-
status: PendingSwapNetworkStatus | null;
|
|
167
|
-
}): void;
|
|
168
|
-
/**
|
|
169
|
-
* Event handler for blocked tasks.
|
|
170
|
-
* If a transcation execution is manually blocked (like for parallel or waiting for wallet),
|
|
171
|
-
* This function will be called by queue manager using `queue definition`.
|
|
172
|
-
*
|
|
173
|
-
* It checks if the required wallet is connected, unblock the queue to be run.
|
|
174
|
-
*/
|
|
175
|
-
export declare function onBlockForConnectWallet(event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
176
|
-
/**
|
|
177
|
-
* Event handler for blocked tasks.
|
|
178
|
-
* If a transcation execution is manually blocked (like for parallel or waiting for walle),
|
|
179
|
-
* This function will be called by queue manager using `queue definition`.
|
|
180
|
-
*
|
|
181
|
-
* It checks if the required network is connected, unblock the queue to be run.
|
|
182
|
-
* Note: it automatically try to switch the network if its `provider` supports.
|
|
183
|
-
*/
|
|
184
|
-
export declare function onBlockForChangeNetwork(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
185
|
-
/**
|
|
186
|
-
* Event handler for blocked tasks. (Parallel mode)
|
|
187
|
-
* If a transcation execution flow is manually blocked (like for parallel or waiting for walle),
|
|
188
|
-
* This function will be called by queue manager using `queue definition`.
|
|
189
|
-
*
|
|
190
|
-
* It checks the blocked tasks, if there is no active `claimed` queue, try to give it to the best candidate.
|
|
191
|
-
*/
|
|
192
|
-
export declare function onDependsOnOtherQueues(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
193
|
-
export declare function isRequiredWalletConnected(swap: PendingSwap, getState: (type: WalletType) => WalletState): {
|
|
194
|
-
ok: boolean;
|
|
195
|
-
reason: 'not_connected' | 'account_miss_match';
|
|
196
|
-
};
|
|
197
|
-
export declare function singTransaction(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
|
|
198
|
-
export declare function checkWaitingForConnectWalletChange(params: {
|
|
199
|
-
wallet_network: string;
|
|
200
|
-
manager?: Manager;
|
|
201
|
-
evmChains: EvmBlockchainMeta[];
|
|
202
|
-
notifier: SwapQueueContext['notifier'];
|
|
203
|
-
}): void;
|
|
204
|
-
export declare function checkWaitingForNetworkChange(manager?: Manager): void;
|
|
205
|
-
/**
|
|
206
|
-
* Get list of all running swaps
|
|
207
|
-
*
|
|
208
|
-
* @param manager
|
|
209
|
-
* @returns list of pending swaps
|
|
210
|
-
*/
|
|
211
|
-
export declare function getRunningSwaps(manager: Manager): PendingSwap[];
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
214
|
-
* Trying to reset notifications for pending swaps to correct message on page load.
|
|
215
|
-
* We could remove this after supporting auto connect for wallets.
|
|
216
|
-
*
|
|
217
|
-
* @param swaps
|
|
218
|
-
* @param notifier
|
|
219
|
-
* @returns
|
|
220
|
-
*/
|
|
221
|
-
export declare function resetRunningSwapNotifsOnPageLoad(runningSwaps: PendingSwap[], notifier: SwapQueueContext['notifier']): void;
|
|
222
|
-
/**
|
|
223
|
-
*
|
|
224
|
-
* Try to run blocked tasks by wallet and network name.
|
|
225
|
-
* Goes through queues and extract blocked queues with matched wallet.
|
|
226
|
-
* If found any blocked tasks with same wallet and network, runs them.
|
|
227
|
-
* If not, runs only blocked tasks with matched wallet.
|
|
228
|
-
*
|
|
229
|
-
* @param wallet_network a string includes `wallet` type and `network` type.
|
|
230
|
-
* @param manager
|
|
231
|
-
* @returns
|
|
232
|
-
*/
|
|
233
|
-
export declare function retryOn(wallet_network: string, notifier: SwapQueueContext['notifier'], manager?: Manager, canSwitchNetworkTo?: (type: WalletType, network: Network) => boolean, options?: {
|
|
234
|
-
fallbackToOnlyWallet: boolean;
|
|
235
|
-
}): void;
|
|
236
|
-
export declare function isNeedBlockQueueForParallel(step: PendingSwapStep): boolean;
|
|
237
|
-
export declare function throwOnOK(rawResponse: Promise<CreateTransactionResponse>): Promise<CreateTransactionResponse>;
|
|
238
|
-
export declare function cancelSwap(swap: QueueInfo, manager?: Manager): {
|
|
239
|
-
swap: PendingSwap;
|
|
240
|
-
step: PendingSwapStep | null;
|
|
241
|
-
};
|
|
242
|
-
export {};
|
|
1
|
+
import { ExecuterActions, QueueInfo } from '@rango-dev/queue-manager-core';
|
|
2
|
+
import { SwapActionTypes, SwapQueueContext, SwapQueueDef, SwapStorage } from './types';
|
|
3
|
+
import { Meta, Network, WalletState, WalletType } from '@rango-dev/wallets-shared';
|
|
4
|
+
import { Providers } from '@rango-dev/wallets-core';
|
|
5
|
+
import { Transaction, TransactionType, EvmBlockchainMeta, CreateTransactionResponse } from 'rango-sdk';
|
|
6
|
+
import { Manager } from '@rango-dev/queue-manager-core';
|
|
7
|
+
import { EventType, PendingSwap, PendingSwapNetworkStatus, PendingSwapStep, StepStatus, SwapStatus, Wallet } from './shared';
|
|
8
|
+
import { APIErrorCode, SignerErrorCode } from 'rango-types/lib';
|
|
9
|
+
type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
|
|
10
|
+
type WhenTaskBlockedEvent = WhenTaskBlocked[0];
|
|
11
|
+
type WhenTaskBlockedMeta = WhenTaskBlocked[1];
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* We simply use module-level variable to keep track of which queue has claimed the execution of parallel runnings.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare function claimQueue(): {
|
|
18
|
+
claimedBy: () => string | undefined;
|
|
19
|
+
setClaimer: (queue_id: string) => void;
|
|
20
|
+
reset: () => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* We use module-level variable to keep track of
|
|
25
|
+
* map of transactions hash to the TransactionResponse and ...
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
type TransactionData = {
|
|
29
|
+
response?: any;
|
|
30
|
+
receiptReceived?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function useTransactionsData(): {
|
|
33
|
+
getTransactionDataByHash: (hash: string) => TransactionData;
|
|
34
|
+
setTransactionDataByHash: (hash: string, data: TransactionData) => void;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Sample inputs are:
|
|
38
|
+
* - "metamask-ETH"
|
|
39
|
+
* - "metamask-BSC-BSC:0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
40
|
+
* - "token-pocket-BSC-BSC:0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
41
|
+
* Returns "wallet and network" separately, even if the wallet is dashed inside.
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export declare function splitWalletNetwork(input: string): string[];
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* Returns `steps`, if it's a `running` swap.
|
|
48
|
+
* Each `PendingSwap` has a `steps` inside it, `steps` shows how many tasks should be created and run to finish the swap.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export declare const getCurrentStep: (swap: PendingSwap) => PendingSwapStep | null;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* Returns current step transaction
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export declare const getCurrentStepTx: (currentStep: PendingSwapStep) => Transaction | null;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* Set current step transaction
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
export declare const setCurrentStepTx: (currentStep: PendingSwapStep, transaction: Transaction) => PendingSwapStep;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* Returns current step transaction type
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
export declare const getCurrentStepTxType: (currentStep: PendingSwapStep) => TransactionType | undefined;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* Returns a boolean indicating that current step is an approval tx or not.
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
export declare const isApprovalCurrentStepTx: (currentStep: PendingSwapStep) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* When we are doing a swap, there are some common fields that will be updated together.
|
|
78
|
+
* This function helps us to update a swap status and also it will update some more fields like `extraMessageSeverity` based on the input.
|
|
79
|
+
*/
|
|
80
|
+
export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, nextStepStatus, message, details, errorCode, hasAlreadyProceededToSign, }: {
|
|
81
|
+
getStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['getStorage'];
|
|
82
|
+
setStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['setStorage'];
|
|
83
|
+
nextStatus?: SwapStatus;
|
|
84
|
+
nextStepStatus?: StepStatus;
|
|
85
|
+
message?: string;
|
|
86
|
+
details?: string | null | undefined;
|
|
87
|
+
errorCode?: APIErrorCode | SignerErrorCode | null;
|
|
88
|
+
hasAlreadyProceededToSign?: boolean;
|
|
89
|
+
}): {
|
|
90
|
+
swap: PendingSwap;
|
|
91
|
+
step: PendingSwapStep | null;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* Set current step transaction hash, update pending swap status, and notify user if needed
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
export declare function setStepTransactionIds({ getStorage, setStorage }: ExecuterActions<SwapStorage, SwapActionTypes>, txId: string | null, notifier: SwapQueueContext['notifier'], eventType?: EventType, explorerUrl?: {
|
|
99
|
+
url?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}): void;
|
|
102
|
+
/**
|
|
103
|
+
* If a swap needs a wallet to be connected,
|
|
104
|
+
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
105
|
+
*/
|
|
106
|
+
export declare function markRunningSwapAsWaitingForConnectingWallet({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>, reason: string, reasonDetail: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* If a swap needs a certain network to proceed,
|
|
109
|
+
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
110
|
+
*/
|
|
111
|
+
export declare function markRunningSwapAsSwitchingNetwork({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>): {
|
|
112
|
+
swap: PendingSwap;
|
|
113
|
+
step: PendingSwapStep;
|
|
114
|
+
} | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* We are marking the queue as it depends on other queues to be run (on Parallel mode)
|
|
117
|
+
* By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
|
|
118
|
+
*/
|
|
119
|
+
export declare function markRunningSwapAsDependsOnOtherQueues({ getStorage, setStorage, notifier, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'> & {
|
|
120
|
+
notifier: SwapQueueContext['notifier'];
|
|
121
|
+
}): {
|
|
122
|
+
swap: PendingSwap;
|
|
123
|
+
step: PendingSwapStep;
|
|
124
|
+
} | undefined;
|
|
125
|
+
export declare function delay(ms: number): Promise<unknown>;
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* To execute a swap, we are keeping the user prefrences on what wallet they are going to use for a sepecific blockchain
|
|
129
|
+
* By passing the swap and the network we are looking for, it returns the wallet name that user selected.
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
export declare const getSwapWalletType: (swap: PendingSwap, network: Network) => WalletType;
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* We are keeping the connected wallet in a specific structure (`Wallet`),
|
|
136
|
+
* By using this function we normally want to check a specific wallet is connected and exists or not.
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
139
|
+
export declare function isWalletNull(wallet: Wallet | null): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* On our implementation for `wallets` package, We keep the instance in 2 ways
|
|
142
|
+
* If it's a single chain wallet, it returns the instance directly,
|
|
143
|
+
* If it's a multichain wallet, it returns a `Map` of instances.
|
|
144
|
+
* This function will get the `ETHEREUM` instance in both types.
|
|
145
|
+
*/
|
|
146
|
+
export declare function getEvmProvider(providers: Providers, type: WalletType): any;
|
|
147
|
+
/**
|
|
148
|
+
* In a `PendingSwap`, each step needs a wallet to proceed,
|
|
149
|
+
* By using this function we can access what wallet exactly we need to run current step.
|
|
150
|
+
*/
|
|
151
|
+
export declare function getRequiredWallet(swap: PendingSwap): {
|
|
152
|
+
type: WalletType | null;
|
|
153
|
+
network: Network | null;
|
|
154
|
+
address: string | null;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* For running a swap safely, we need to make sure about the state of wallet
|
|
158
|
+
* which means the netowrk/chain of wallet should be exactly on what a transaction needs.
|
|
159
|
+
*/
|
|
160
|
+
export declare function isNetworkMatchedForTransaction(swap: PendingSwap, step: PendingSwapStep, wallet: Wallet | null, meta: Meta, providers: Providers): Promise<boolean>;
|
|
161
|
+
export declare const isTxAlreadyCreated: (swap: PendingSwap, step: PendingSwapStep) => boolean;
|
|
162
|
+
export declare function resetNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
|
|
163
|
+
export declare function updateNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>, data?: {
|
|
164
|
+
message: string;
|
|
165
|
+
details: string;
|
|
166
|
+
status: PendingSwapNetworkStatus | null;
|
|
167
|
+
}): void;
|
|
168
|
+
/**
|
|
169
|
+
* Event handler for blocked tasks.
|
|
170
|
+
* If a transcation execution is manually blocked (like for parallel or waiting for wallet),
|
|
171
|
+
* This function will be called by queue manager using `queue definition`.
|
|
172
|
+
*
|
|
173
|
+
* It checks if the required wallet is connected, unblock the queue to be run.
|
|
174
|
+
*/
|
|
175
|
+
export declare function onBlockForConnectWallet(event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
176
|
+
/**
|
|
177
|
+
* Event handler for blocked tasks.
|
|
178
|
+
* If a transcation execution is manually blocked (like for parallel or waiting for walle),
|
|
179
|
+
* This function will be called by queue manager using `queue definition`.
|
|
180
|
+
*
|
|
181
|
+
* It checks if the required network is connected, unblock the queue to be run.
|
|
182
|
+
* Note: it automatically try to switch the network if its `provider` supports.
|
|
183
|
+
*/
|
|
184
|
+
export declare function onBlockForChangeNetwork(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
185
|
+
/**
|
|
186
|
+
* Event handler for blocked tasks. (Parallel mode)
|
|
187
|
+
* If a transcation execution flow is manually blocked (like for parallel or waiting for walle),
|
|
188
|
+
* This function will be called by queue manager using `queue definition`.
|
|
189
|
+
*
|
|
190
|
+
* It checks the blocked tasks, if there is no active `claimed` queue, try to give it to the best candidate.
|
|
191
|
+
*/
|
|
192
|
+
export declare function onDependsOnOtherQueues(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
|
|
193
|
+
export declare function isRequiredWalletConnected(swap: PendingSwap, getState: (type: WalletType) => WalletState): {
|
|
194
|
+
ok: boolean;
|
|
195
|
+
reason: 'not_connected' | 'account_miss_match';
|
|
196
|
+
};
|
|
197
|
+
export declare function singTransaction(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
|
|
198
|
+
export declare function checkWaitingForConnectWalletChange(params: {
|
|
199
|
+
wallet_network: string;
|
|
200
|
+
manager?: Manager;
|
|
201
|
+
evmChains: EvmBlockchainMeta[];
|
|
202
|
+
notifier: SwapQueueContext['notifier'];
|
|
203
|
+
}): void;
|
|
204
|
+
export declare function checkWaitingForNetworkChange(manager?: Manager): void;
|
|
205
|
+
/**
|
|
206
|
+
* Get list of all running swaps
|
|
207
|
+
*
|
|
208
|
+
* @param manager
|
|
209
|
+
* @returns list of pending swaps
|
|
210
|
+
*/
|
|
211
|
+
export declare function getRunningSwaps(manager: Manager): PendingSwap[];
|
|
212
|
+
/**
|
|
213
|
+
*
|
|
214
|
+
* Trying to reset notifications for pending swaps to correct message on page load.
|
|
215
|
+
* We could remove this after supporting auto connect for wallets.
|
|
216
|
+
*
|
|
217
|
+
* @param swaps
|
|
218
|
+
* @param notifier
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
export declare function resetRunningSwapNotifsOnPageLoad(runningSwaps: PendingSwap[], notifier: SwapQueueContext['notifier']): void;
|
|
222
|
+
/**
|
|
223
|
+
*
|
|
224
|
+
* Try to run blocked tasks by wallet and network name.
|
|
225
|
+
* Goes through queues and extract blocked queues with matched wallet.
|
|
226
|
+
* If found any blocked tasks with same wallet and network, runs them.
|
|
227
|
+
* If not, runs only blocked tasks with matched wallet.
|
|
228
|
+
*
|
|
229
|
+
* @param wallet_network a string includes `wallet` type and `network` type.
|
|
230
|
+
* @param manager
|
|
231
|
+
* @returns
|
|
232
|
+
*/
|
|
233
|
+
export declare function retryOn(wallet_network: string, notifier: SwapQueueContext['notifier'], manager?: Manager, canSwitchNetworkTo?: (type: WalletType, network: Network) => boolean, options?: {
|
|
234
|
+
fallbackToOnlyWallet: boolean;
|
|
235
|
+
}): void;
|
|
236
|
+
export declare function isNeedBlockQueueForParallel(step: PendingSwapStep): boolean;
|
|
237
|
+
export declare function throwOnOK(rawResponse: Promise<CreateTransactionResponse>): Promise<CreateTransactionResponse>;
|
|
238
|
+
export declare function cancelSwap(swap: QueueInfo, manager?: Manager): {
|
|
239
|
+
swap: PendingSwap;
|
|
240
|
+
step: PendingSwapStep | null;
|
|
241
|
+
};
|
|
242
|
+
export {};
|
|
243
243
|
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EAGV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAsB,MAAM,yBAAyB,CAAC;AAExE,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAO1B,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,SAAS,EAMT,WAAW,EACX,wBAAwB,EACxB,eAAe,EACf,UAAU,EACV,UAAU,EACV,MAAM,EAGP,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EAGV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YA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 @@
|
|
|
1
|
-
import { UseQueueManagerParams } from './types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Runs a migration (old swaps from localstorage to queue manager's IndexedDB)
|
|
5
|
-
* It will be run only once on page load.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
declare function useMigration(): {
|
|
9
|
-
status: boolean;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* On initial load and also connect/disconnet we may need to update swap's notified message.
|
|
14
|
-
* And also if a new wallet is connected we will retry the queue to see we can resume it or not.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
declare function useQueueManager(params: UseQueueManagerParams): void;
|
|
18
|
-
export { useQueueManager, useMigration };
|
|
1
|
+
import { UseQueueManagerParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Runs a migration (old swaps from localstorage to queue manager's IndexedDB)
|
|
5
|
+
* It will be run only once on page load.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
declare function useMigration(): {
|
|
9
|
+
status: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* On initial load and also connect/disconnet we may need to update swap's notified message.
|
|
14
|
+
* And also if a new wallet is connected we will retry the queue to see we can resume it or not.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
declare function useQueueManager(params: UseQueueManagerParams): void;
|
|
18
|
+
export { useQueueManager, useMigration };
|
|
19
19
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["src/hooks.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIhD;;;;;GAKG;AACH,iBAAS,YAAY,IAAI;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAmBA;AAED;;;;;GAKG;AACH,iBAAS,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CA+B5D;AAED,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIhD;;;;;GAKG;AACH,iBAAS,YAAY,IAAI;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAmBA;AAED;;;;;GAKG;AACH,iBAAS,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CA+B5D;AAED,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Configs } from './configs';
|
|
2
|
-
import { SwapQueueDef } from './types';
|
|
3
|
-
export { PrettyError, prettifyErrorMessage } from './shared-errors';
|
|
4
|
-
export { SwapQueueContext, SwapStorage } from './types';
|
|
5
|
-
export { PendingSwapWithQueueID,
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
1
|
+
import { Configs } from './configs';
|
|
2
|
+
import { SwapQueueDef } from './types';
|
|
3
|
+
export { PrettyError, prettifyErrorMessage } from './shared-errors';
|
|
4
|
+
export type { SwapQueueContext, SwapStorage } from './types';
|
|
5
|
+
export type { PendingSwapWithQueueID, PendingSwapStep, PendingSwap, EventType, SwapProgressNotification, } from './shared';
|
|
6
|
+
export { getCurrentBlockchainOfOrNull, getRelatedWalletOrNull, getRelatedWallet, MessageSeverity, PendingSwapNetworkStatus, calculatePendingSwap, } from './shared';
|
|
7
|
+
export { updateSwapStatus, checkWaitingForNetworkChange, getCurrentStep, getEvmProvider, cancelSwap, getRequiredWallet, getRunningSwaps, splitWalletNetwork, resetRunningSwapNotifsOnPageLoad, } from './helpers';
|
|
8
|
+
export { useMigration, useQueueManager } from './hooks';
|
|
9
|
+
export declare function makeQueueDefinition(configs: Configs): SwapQueueDef;
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACpE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,SAAS,EACT,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,CAGlE"}
|