@rango-dev/queue-manager-rango-preset 0.1.10-next.77

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.
Files changed (57) hide show
  1. package/dist/actions/checkStatus.d.ts +12 -0
  2. package/dist/actions/checkStatus.d.ts.map +1 -0
  3. package/dist/actions/createTransaction.d.ts +11 -0
  4. package/dist/actions/createTransaction.d.ts.map +1 -0
  5. package/dist/actions/executeTransaction.d.ts +13 -0
  6. package/dist/actions/executeTransaction.d.ts.map +1 -0
  7. package/dist/actions/scheduleNextStep.d.ts +13 -0
  8. package/dist/actions/scheduleNextStep.d.ts.map +1 -0
  9. package/dist/actions/start.d.ts +4 -0
  10. package/dist/actions/start.d.ts.map +1 -0
  11. package/dist/constants.d.ts +9 -0
  12. package/dist/constants.d.ts.map +1 -0
  13. package/dist/helpers.d.ts +159 -0
  14. package/dist/helpers.d.ts.map +1 -0
  15. package/dist/hooks.d.ts +19 -0
  16. package/dist/hooks.d.ts.map +1 -0
  17. package/dist/index.d.ts +10 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +8 -0
  20. package/dist/migration.d.ts +15 -0
  21. package/dist/migration.d.ts.map +1 -0
  22. package/dist/queue-manager-rango-preset.cjs.development.js +2249 -0
  23. package/dist/queue-manager-rango-preset.cjs.development.js.map +1 -0
  24. package/dist/queue-manager-rango-preset.cjs.production.min.js +2 -0
  25. package/dist/queue-manager-rango-preset.cjs.production.min.js.map +1 -0
  26. package/dist/queue-manager-rango-preset.esm.js +2242 -0
  27. package/dist/queue-manager-rango-preset.esm.js.map +1 -0
  28. package/dist/queueDef.d.ts +10 -0
  29. package/dist/queueDef.d.ts.map +1 -0
  30. package/dist/shared-api.d.ts +10 -0
  31. package/dist/shared-api.d.ts.map +1 -0
  32. package/dist/shared-errors.d.ts +56 -0
  33. package/dist/shared-errors.d.ts.map +1 -0
  34. package/dist/shared-sentry.d.ts +4 -0
  35. package/dist/shared-sentry.d.ts.map +1 -0
  36. package/dist/shared.d.ts +149 -0
  37. package/dist/shared.d.ts.map +1 -0
  38. package/dist/types.d.ts +46 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/package.json +59 -0
  41. package/readme.md +9 -0
  42. package/src/actions/checkStatus.ts +213 -0
  43. package/src/actions/createTransaction.ts +101 -0
  44. package/src/actions/executeTransaction.ts +117 -0
  45. package/src/actions/scheduleNextStep.ts +60 -0
  46. package/src/actions/start.ts +10 -0
  47. package/src/constants.ts +23 -0
  48. package/src/helpers.ts +1252 -0
  49. package/src/hooks.ts +75 -0
  50. package/src/index.ts +39 -0
  51. package/src/migration.ts +112 -0
  52. package/src/queueDef.ts +39 -0
  53. package/src/shared-api.ts +175 -0
  54. package/src/shared-errors.ts +156 -0
  55. package/src/shared-sentry.ts +24 -0
  56. package/src/shared.ts +333 -0
  57. package/src/types.ts +76 -0
@@ -0,0 +1,12 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
3
+ /**
4
+ *
5
+ * For doing a swap the user needs to accept a `contract` so it can use the user balance.
6
+ * There is two types of check status:
7
+ * 1. Checking approval transaction (Give permission to a contract)
8
+ * 2. Checking swap transaction.
9
+ *
10
+ */
11
+ export declare function checkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): Promise<void>;
12
+ //# sourceMappingURL=checkStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkStatus.d.ts","sourceRoot":"","sources":["../src/actions/checkStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAYhE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA+K1E;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -0,0 +1,11 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
3
+ /**
4
+ *
5
+ * When a user asks for a swap, We first create the transaction by sending a request to server
6
+ * Server will return the transaction that need to be sent to wallet.
7
+ * It can be failed if server goes through an error, If not, we will schedule the `EXECTUTE_TRANSACTION`.
8
+ *
9
+ */
10
+ export declare function createTransaction(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): Promise<void>;
11
+ //# sourceMappingURL=createTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/actions/createTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAc1E;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
@@ -0,0 +1,13 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
3
+ /**
4
+ * Excecute a created transaction.
5
+ *
6
+ * This function implemented the parallel mode by `claim` mechanism which means
7
+ * All the queues the meet certain situation (like multiple evm transaction) will go through
8
+ * a `claim` mechanims that decides which queue should be run and it blocks other ones.
9
+ *
10
+ * A queue will be go to sign process, if the wallet and network is matched.
11
+ */
12
+ export declare function executeTransaction(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): Promise<void>;
13
+ //# sourceMappingURL=executeTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTransaction.d.ts","sourceRoot":"","sources":["../src/actions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAkBhE,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAgFf"}
@@ -0,0 +1,13 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapQueueContext, SwapStorage } from '../types';
3
+ /**
4
+ *
5
+ * This function is responsibe for scheduling the correct `action` based on `PendingSwap` status.
6
+ * It means `action`s schedule this step to decide what should be the next step/task.
7
+ *
8
+ * It's acts like a `while(true)` and will `break` the loop on certain `action`s like `CHECK_STATUS`.
9
+ *
10
+ *
11
+ */
12
+ export declare function scheduleNextStep({ schedule, next, failed, setStorage, getStorage, context, }: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
13
+ //# sourceMappingURL=scheduleNextStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduleNextStep.d.ts","sourceRoot":"","sources":["../src/actions/scheduleNextStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1E;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,UAAU,EACV,UAAU,EACV,OAAO,GACR,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GAAG,IAAI,CAuCxE"}
@@ -0,0 +1,4 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapStorage } from '../types';
3
+ export declare function start({ schedule, next, }: ExecuterActions<SwapStorage, SwapActionTypes>): void;
4
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/actions/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAExD,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,IAAI,GACL,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,IAAI,CAGtD"}
@@ -0,0 +1,9 @@
1
+ export declare const RANGO_DAPP_ID_QUERY: string | undefined;
2
+ export declare const BASE_URL: string | undefined;
3
+ export declare const RANGO_COOKIE_HEADER = "X-Rango-Id";
4
+ export declare const ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES = "Waiting for other running tasks to be finished";
5
+ export declare const ERROR_MESSAGE_WAIT_FOR_WALLET = "Waiting for connecting wallet";
6
+ export declare const ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET: (type: string | null, address: string | null) => string;
7
+ export declare const ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION: (type: string | null) => string;
8
+ export declare const ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK: (network: string | null) => string;
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,oBAA4C,CAAC;AAC7E,eAAO,MAAM,QAAQ,oBAAiC,CAAC;AACvD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,qCAAqC,mDACA,CAAC;AACnD,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAC7E,eAAO,MAAM,sDAAsD,SAC3D,MAAM,GAAG,IAAI,WACV,MAAM,GAAG,IAAI,KACrB,MAGC,CAAC;AACL,eAAO,MAAM,yCAAyC,SAC9C,MAAM,GAAG,IAAI,KAClB,MAGqD,CAAC;AACzD,eAAO,MAAM,qCAAqC,YACvC,MAAM,GAAG,IAAI,KACrB,MAAqD,CAAC"}
@@ -0,0 +1,159 @@
1
+ import { ExecuterActions } from '@rango-dev/queue-manager-core';
2
+ import { SwapActionTypes, SwapQueueContext, SwapQueueDef, SwapStorage } from './types';
3
+ import { EvmBlockchainMeta, Meta, Network, Transaction, WalletState, WalletType } from '@rango-dev/wallets-shared';
4
+ import { Providers } from '@rango-dev/wallets-core';
5
+ import { TronTransaction, StarknetTransaction, CosmosTransaction, EvmTransaction, SolanaTransaction, Transfer as TransferTransaction } from 'rango-sdk';
6
+ import { Manager } from '@rango-dev/queue-manager-core';
7
+ import { EventType, PendingSwap, PendingSwapNetworkStatus, PendingSwapStep, StepStatus, SwapStatus, Wallet, WalletTypeAndAddress } from './shared';
8
+ declare type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
9
+ declare type WhenTaskBlockedEvent = WhenTaskBlocked[0];
10
+ declare type WhenTaskBlockedMeta = WhenTaskBlocked[1];
11
+ /**
12
+ *
13
+ * Returns `steps`, if it's a `running` swap.
14
+ * Each `PendingSwap` has a `steps` inside it, `steps` shows how many tasks should be created and run to finish the swap.
15
+ *
16
+ */
17
+ export declare const getCurrentStep: (swap: PendingSwap) => PendingSwapStep | null;
18
+ /**
19
+ * When we are doing a swap, there are some common fields that will be updated together.
20
+ * This function helps us to update a swap status and also it will update some more fields like `extraMessageSeverity` based on the input.
21
+ */
22
+ export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, nextStepStatus, message, details, errorCode, }: {
23
+ getStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['getStorage'];
24
+ setStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['setStorage'];
25
+ nextStatus?: SwapStatus;
26
+ nextStepStatus?: StepStatus;
27
+ message?: string;
28
+ details?: string | null | undefined;
29
+ errorCode?: string | null;
30
+ }): {
31
+ swap: PendingSwap;
32
+ step: PendingSwapStep | null;
33
+ };
34
+ export declare function setStepTransactionIds({ getStorage, setStorage }: ExecuterActions<SwapStorage, SwapActionTypes>, txId: string | null, eventType: EventType, notifier: SwapQueueContext['notifier']): void;
35
+ /**
36
+ * If a swap needs a wallet to be connected,
37
+ * By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
38
+ */
39
+ export declare function markRunningSwapAsWaitingForConnectingWallet({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>, reason: string, reasonDetail: string): void;
40
+ /**
41
+ * If a swap needs a certain network to proceed,
42
+ * By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
43
+ */
44
+ export declare function markRunningSwapAsSwitchingNetwork({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>): {
45
+ swap: PendingSwap;
46
+ step: PendingSwapStep;
47
+ } | undefined;
48
+ /**
49
+ * We are marking the queue as it depends on other queues to be run (on Parallel mode)
50
+ * By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
51
+ */
52
+ export declare function markRunningSwapAsDependsOnOtherQueues({ getStorage, setStorage, }: Pick<ExecuterActions, 'getStorage' | 'setStorage'>): {
53
+ swap: PendingSwap;
54
+ step: PendingSwapStep;
55
+ } | undefined;
56
+ export declare function delay(ms: number): Promise<unknown>;
57
+ export declare const isEvmTransaction: (tx: Transaction) => tx is EvmTransaction;
58
+ export declare const isCosmosTransaction: (tx: Transaction) => tx is CosmosTransaction;
59
+ export declare const isSolanaTransaction: (tx: Transaction) => tx is SolanaTransaction;
60
+ export declare const isTrasnferTransaction: (tx: Transaction) => tx is TransferTransaction;
61
+ export declare const isStarknetTransaction: (tx: Transaction) => tx is StarknetTransaction;
62
+ export declare const isTronTransaction: (tx: Transaction) => tx is TronTransaction;
63
+ /**
64
+ *
65
+ * To execute a swap, we are keeping the user prefrences on what wallet they are going to use for a sepecific blockchain
66
+ * By passing the swap and the network we are looking for, it returns the wallet name that user selected.
67
+ *
68
+ */
69
+ export declare const getSwapWalletType: (swap: PendingSwap, network: Network) => WalletType;
70
+ /**
71
+ *
72
+ * We are keeping the connected wallet in a specific structure (`Wallet`),
73
+ * By using this function we normally want to check a specific wallet is connected and exists or not.
74
+ *
75
+ */
76
+ export declare function isWalletNull(wallet: Wallet | null): boolean;
77
+ /**
78
+ * On our implementation for `wallets` package, We keep the instance in 2 ways
79
+ * If it's a single chain wallet, it returns the instance directly,
80
+ * If it's a multichain wallet, it returns a `Map` of instances.
81
+ * This function will get the `ETHEREUM` instance in both types.
82
+ */
83
+ export declare function getEvmProvider(providers: Providers, type: WalletType): any;
84
+ /**
85
+ * In a `PendingSwap`, each step needs a wallet to proceed,
86
+ * By using this function we can access what wallet exactly we need to run current step.
87
+ */
88
+ export declare function getRequiredWallet(swap: PendingSwap): {
89
+ type: WalletType | null;
90
+ network: Network | null;
91
+ address: string | null;
92
+ };
93
+ /**
94
+ * For running a swap safely, we need to make sure about the state of wallet
95
+ * which means the netowrk/chain of wallet should be exactly on what a transaction needs.
96
+ */
97
+ export declare function isNetworkMatchedForTransaction(swap: PendingSwap, step: PendingSwapStep, wallet: Wallet | null, meta: Meta, providers: Providers): Promise<boolean>;
98
+ /**
99
+ * Returns the wallet address, based on the current step of `PendingSwap`.
100
+ */
101
+ export declare const getCurrentAddressOf: (swap: PendingSwap, step: PendingSwapStep) => string;
102
+ export declare function getRelatedWallet(swap: PendingSwap, currentStep: PendingSwapStep): WalletTypeAndAddress;
103
+ export declare const isTxAlreadyCreated: (swap: PendingSwap, step: PendingSwapStep) => boolean;
104
+ export declare function resetNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
105
+ export declare function updateNetworkStatus(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>, data?: {
106
+ message: string;
107
+ details: string;
108
+ status: PendingSwapNetworkStatus | null;
109
+ }): void;
110
+ /**
111
+ * Event handler for blocked tasks.
112
+ * If a transcation execution is manually blocked (like for parallel or waiting for walle),
113
+ * This function will be called by queue manager using `queue definition`.
114
+ *
115
+ * It checks if the required wallet is connected, unblock the queue to be run.
116
+ */
117
+ export declare function onBlockForConnectWallet(event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
118
+ /**
119
+ * Event handler for blocked tasks.
120
+ * If a transcation execution is manually blocked (like for parallel or waiting for walle),
121
+ * This function will be called by queue manager using `queue definition`.
122
+ *
123
+ * It checks if the required network is connected, unblock the queue to be run.
124
+ * Note: it automatically try to switch the network if its `provider` supports.
125
+ */
126
+ export declare function onBlockForChangeNetwork(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
127
+ /**
128
+ * Event handler for blocked tasks. (Parallel mode)
129
+ * If a transcation execution is manually blocked (like for parallel or waiting for walle),
130
+ * This function will be called by queue manager using `queue definition`.
131
+ *
132
+ * It checks the blocked tasks, if there is no active `claimed` queue, try to give it to the best candidate.
133
+ */
134
+ export declare function onDependsOnOtherQueues(_event: WhenTaskBlockedEvent, meta: WhenTaskBlockedMeta): void;
135
+ export declare function isRequiredWalletConnected(swap: PendingSwap, getState: (type: WalletType) => WalletState): boolean;
136
+ export declare function singTransaction(actions: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>): void;
137
+ export declare function checkWaitingForConnectWalletChange(params: {
138
+ wallet_network: string;
139
+ manager?: Manager;
140
+ evmChains: EvmBlockchainMeta[];
141
+ }): void;
142
+ export declare function checkWaitingForNetworkChange(manager?: Manager): void;
143
+ /**
144
+ *
145
+ * Try to run blocked tasks by wallet and network name.
146
+ * Goes through queues and extract blocked queues with matched wallet.
147
+ * If found any blocked tasks with same wallet and network, runs them.
148
+ * If not, runs only blocked tasks with matched wallet.
149
+ *
150
+ * @param wallet_network a string includes `wallet` type and `network` type.
151
+ * @param manager
152
+ * @returns
153
+ */
154
+ export declare function retryOn(wallet_network: string, manager?: Manager, options?: {
155
+ fallbackToOnlyWallet: boolean;
156
+ }): void;
157
+ export declare function isNeedBlockQueueForParallel(step: PendingSwapStep): boolean;
158
+ export {};
159
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EAEjB,IAAI,EACJ,OAAO,EACP,WAAW,EAEX,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAsB,MAAM,yBAAyB,CAAC;AAExE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,QAAQ,IAAI,mBAAmB,EAChC,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,SAAS,EAMT,WAAW,EACX,wBAAwB,EACxB,eAAe,EAEf,UAAU,EACV,UAAU,EACV,MAAM,EACN,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAKlB,aAAK,eAAe,GAAG,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChF,aAAK,oBAAoB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAC/C,aAAK,mBAAmB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAuB9C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,SAAU,WAAW,KAAG,eAAe,GAAG,IAMpE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,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AAE,OAAO,CAAC;IAClB,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC,GAAG,IAAI,CAmDP;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CA8BpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,OAAO,EACjB,OAAO;;CAAiC,GACvC,IAAI,CAsDN;AAMD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAM1E"}
@@ -0,0 +1,19 @@
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
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +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,CAyB5D;AAED,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { SwapQueueDef } from './types';
2
+ /**
3
+ *
4
+ * The idea behind this queue is to be able dynamically add some steps.
5
+ * After running a swap, it can be blocked (like on waiting for switch netwrok)
6
+ * or waits for something happend (like checking status of a transaction from server)
7
+ *
8
+ */
9
+ export declare const swapQueueDef: SwapQueueDef;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,YAAY,EAAE,MAAM,SAAS,CAAC;AAYrE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,YAmB1B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./queue-manager-rango-preset.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./queue-manager-rango-preset.cjs.development.js')
8
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ *
3
+ * If `MIGRATED_KEY` is set, it means we already migrated data from localstorage.
4
+ *
5
+ */
6
+ declare function migrated(): boolean;
7
+ /**
8
+ *
9
+ * By calling this function, we first check if the data already migrated or not,
10
+ * If not, starting to migrating to IndexedDb with proper format that queue manager is understand.
11
+ *
12
+ */
13
+ declare function migration(): Promise<boolean>;
14
+ export { migration, migrated };
15
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["src/migration.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,iBAAS,QAAQ,IAAI,OAAO,CAE3B;AAED;;;;;GAKG;AACH,iBAAe,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAmF3C;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}