@rango-dev/queue-manager-rango-preset 0.45.2-next.0 → 0.45.2-next.2
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/helpers.d.ts +3 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/queue-manager-rango-preset.build.json +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/helpers.ts +25 -13
- package/src/hooks.ts +26 -10
- package/src/index.ts +1 -0
- package/src/types.ts +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/configs.ts":{"bytes":816,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":7327,"imports":[],"format":"esm"},"src/constants.ts":{"bytes":742,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/httpService.ts":{"bytes":284,"imports":[{"path":"rango-sdk","kind":"import-statement","external":true},{"path":"src/configs.ts","kind":"import-statement","original":"../configs"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/index.ts":{"bytes":45,"imports":[{"path":"src/services/httpService.ts","kind":"import-statement","original":"./httpService"}],"format":"esm"},"src/numbers.ts":{"bytes":1637,"imports":[{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/shared-errors.ts":{"bytes":4547,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/shared.ts":{"bytes":11715,"imports":[{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"src/numbers.ts","kind":"import-statement","original":"./numbers"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/eventEmitter.ts":{"bytes":8191,"imports":[{"path":"src/configs.ts","kind":"import-statement","original":"../configs"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":45811,"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"./services/eventEmitter"},{"path":"src/shared.ts","kind":"import-statement","original":"./shared"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/checkStatus.ts":{"bytes":15772,"imports":[{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"../shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/createTransaction.ts":{"bytes":3041,"imports":[{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"../shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/executeTransaction.ts":{"bytes":4424,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/scheduleNextStep.ts":{"bytes":2758,"imports":[{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/start.ts":{"bytes":484,"imports":[{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/queueDef.ts":{"bytes":1523,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/actions/checkStatus.ts","kind":"import-statement","original":"./actions/checkStatus"},{"path":"src/actions/createTransaction.ts","kind":"import-statement","original":"./actions/createTransaction"},{"path":"src/actions/executeTransaction.ts","kind":"import-statement","original":"./actions/executeTransaction"},{"path":"src/actions/scheduleNextStep.ts","kind":"import-statement","original":"./actions/scheduleNextStep"},{"path":"src/actions/start.ts","kind":"import-statement","original":"./actions/start"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"}],"format":"esm"},"src/migration.ts":{"bytes":3321,"imports":[{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"uuid","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hooks.ts":{"bytes":1958,"imports":[{"path":"@rango-dev/queue-manager-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/migration.ts","kind":"import-statement","original":"./migration"},{"path":"./types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1499,"imports":[{"path":"src/configs.ts","kind":"import-statement","original":"./configs"},{"path":"src/queueDef.ts","kind":"import-statement","original":"./queueDef"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/shared.ts","kind":"import-statement","original":"./shared"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/hooks.ts","kind":"import-statement","original":"./hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":173781},"dist/index.js":{"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"rango-sdk","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"uuid","kind":"import-statement","external":true}],"exports":["EventSeverity","MessageSeverity","PrettyError","RouteEventType","StepEventType","StepExecutionBlockedEventStatus","StepExecutionEventStatus","WidgetEvents","calculatePendingSwap","cancelSwap","checkWaitingForNetworkChange","getCurrentNamespaceOfOrNull","getCurrentStep","getLastSuccessfulStep","getRelatedWallet","getRelatedWalletOrNull","getRequiredWallet","getRunningSwaps","getUsdPrice","isApprovalTX","makeQueueDefinition","prettifyErrorMessage","resetRunningSwapNotifsOnPageLoad","updateSwapStatus","useMigration","useQueueManager"],"entryPoint":"src/index.ts","inputs":{"src/configs.ts":{"bytesInOutput":167},"src/types.ts":{"bytesInOutput":846},"src/constants.ts":{"bytesInOutput":431},"src/helpers.ts":{"bytesInOutput":16198},"src/services/httpService.ts":{"bytesInOutput":118},"src/services/index.ts":{"bytesInOutput":0},"src/shared.ts":{"bytesInOutput":5026},"src/numbers.ts":{"bytesInOutput":689},"src/shared-errors.ts":{"bytesInOutput":2212},"src/services/eventEmitter.ts":{"bytesInOutput":3548},"src/actions/checkStatus.ts":{"bytesInOutput":5534},"src/actions/createTransaction.ts":{"bytesInOutput":895},"src/actions/executeTransaction.ts":{"bytesInOutput":957},"src/actions/scheduleNextStep.ts":{"bytesInOutput":804},"src/actions/start.ts":{"bytesInOutput":155},"src/queueDef.ts":{"bytesInOutput":340},"src/index.ts":{"bytesInOutput":59},"src/hooks.ts":{"bytesInOutput":592},"src/migration.ts":{"bytesInOutput":1138}},"bytes":40465}}}
|
|
1
|
+
{"inputs":{"src/configs.ts":{"bytes":816,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":7452,"imports":[],"format":"esm"},"src/constants.ts":{"bytes":742,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/httpService.ts":{"bytes":284,"imports":[{"path":"rango-sdk","kind":"import-statement","external":true},{"path":"src/configs.ts","kind":"import-statement","original":"../configs"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/index.ts":{"bytes":45,"imports":[{"path":"src/services/httpService.ts","kind":"import-statement","original":"./httpService"}],"format":"esm"},"src/numbers.ts":{"bytes":1637,"imports":[{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/shared-errors.ts":{"bytes":4547,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/shared.ts":{"bytes":11715,"imports":[{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"src/numbers.ts","kind":"import-statement","original":"./numbers"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/services/eventEmitter.ts":{"bytes":8191,"imports":[{"path":"src/configs.ts","kind":"import-statement","original":"../configs"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":46157,"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"./services/eventEmitter"},{"path":"src/shared.ts","kind":"import-statement","original":"./shared"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/checkStatus.ts":{"bytes":15772,"imports":[{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"../shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/createTransaction.ts":{"bytes":3041,"imports":[{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"../shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/executeTransaction.ts":{"bytes":4424,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/shared.ts","kind":"import-statement","original":"../shared"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/scheduleNextStep.ts":{"bytes":2758,"imports":[{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/actions/start.ts":{"bytes":484,"imports":[{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types"},{"path":"src/services/eventEmitter.ts","kind":"import-statement","original":"../services/eventEmitter"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/queueDef.ts":{"bytes":1523,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/actions/checkStatus.ts","kind":"import-statement","original":"./actions/checkStatus"},{"path":"src/actions/createTransaction.ts","kind":"import-statement","original":"./actions/createTransaction"},{"path":"src/actions/executeTransaction.ts","kind":"import-statement","original":"./actions/executeTransaction"},{"path":"src/actions/scheduleNextStep.ts","kind":"import-statement","original":"./actions/scheduleNextStep"},{"path":"src/actions/start.ts","kind":"import-statement","original":"./actions/start"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"}],"format":"esm"},"src/migration.ts":{"bytes":3321,"imports":[{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"uuid","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hooks.ts":{"bytes":2290,"imports":[{"path":"@rango-dev/queue-manager-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/migration.ts","kind":"import-statement","original":"./migration"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1522,"imports":[{"path":"src/configs.ts","kind":"import-statement","original":"./configs"},{"path":"src/queueDef.ts","kind":"import-statement","original":"./queueDef"},{"path":"src/shared-errors.ts","kind":"import-statement","original":"./shared-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/shared.ts","kind":"import-statement","original":"./shared"},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/hooks.ts","kind":"import-statement","original":"./hooks"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":174989},"dist/index.js":{"imports":[{"path":"@rango-dev/logging-core","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"rango-sdk","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"bignumber.js","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/queue-manager-core","kind":"import-statement","external":true},{"path":"uuid","kind":"import-statement","external":true}],"exports":["EventSeverity","MessageSeverity","PrettyError","RouteEventType","StepEventType","StepExecutionBlockedEventStatus","StepExecutionEventStatus","WidgetEvents","calculatePendingSwap","cancelSwap","checkWaitingForNetworkChange","getCurrentNamespaceOfOrNull","getCurrentStep","getLastSuccessfulStep","getRelatedWallet","getRelatedWalletOrNull","getRequiredWallet","getRunningSwaps","getUsdPrice","isApprovalTX","makeQueueDefinition","prettifyErrorMessage","resetRunningSwapNotifsOnPageLoad","updateSwapStatus","useMigration","useQueueManager"],"entryPoint":"src/index.ts","inputs":{"src/configs.ts":{"bytesInOutput":167},"src/types.ts":{"bytesInOutput":846},"src/constants.ts":{"bytesInOutput":431},"src/helpers.ts":{"bytesInOutput":16273},"src/services/httpService.ts":{"bytesInOutput":118},"src/services/index.ts":{"bytesInOutput":0},"src/shared.ts":{"bytesInOutput":5026},"src/numbers.ts":{"bytesInOutput":689},"src/shared-errors.ts":{"bytesInOutput":2212},"src/services/eventEmitter.ts":{"bytesInOutput":3548},"src/actions/checkStatus.ts":{"bytesInOutput":5534},"src/actions/createTransaction.ts":{"bytesInOutput":895},"src/actions/executeTransaction.ts":{"bytesInOutput":957},"src/actions/scheduleNextStep.ts":{"bytesInOutput":804},"src/actions/start.ts":{"bytesInOutput":155},"src/queueDef.ts":{"bytesInOutput":340},"src/index.ts":{"bytesInOutput":59},"src/hooks.ts":{"bytesInOutput":652},"src/migration.ts":{"bytesInOutput":1138}},"bytes":40600}}}
|
package/dist/types.d.ts
CHANGED
|
@@ -42,8 +42,13 @@ export interface SwapQueueContext extends QueueContext {
|
|
|
42
42
|
claimedBy?: string;
|
|
43
43
|
resetClaimedBy?: () => void;
|
|
44
44
|
}
|
|
45
|
+
export type LastConnectedWallet = {
|
|
46
|
+
walletType: string;
|
|
47
|
+
network?: string;
|
|
48
|
+
accounts?: string[];
|
|
49
|
+
};
|
|
45
50
|
export interface UseQueueManagerParams {
|
|
46
|
-
lastConnectedWallet:
|
|
51
|
+
lastConnectedWallet: LastConnectedWallet | null;
|
|
47
52
|
disconnectedWallet: WalletType | undefined;
|
|
48
53
|
clearDisconnectedWallet: () => void;
|
|
49
54
|
evmChains: EvmBlockchainMeta[];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,KAAK,EACV,IAAI,EACJ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,aAAa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espace, Wallet } from './shared';
|
|
5
5
|
import type {
|
|
6
6
|
ArrayElement,
|
|
7
|
+
LastConnectedWallet,
|
|
7
8
|
Step,
|
|
8
9
|
SwapQueueContext,
|
|
9
10
|
SwapQueueDef,
|
|
@@ -42,7 +43,6 @@ import { legacyReadAccountAddress as readAccountAddress } from '@rango-dev/walle
|
|
|
42
43
|
import {
|
|
43
44
|
getBlockChainNameFromId,
|
|
44
45
|
getEvmProvider,
|
|
45
|
-
splitWalletNetwork,
|
|
46
46
|
} from '@rango-dev/wallets-shared';
|
|
47
47
|
import BigNumber from 'bignumber.js';
|
|
48
48
|
import {
|
|
@@ -973,11 +973,17 @@ export function onDependsOnOtherQueues(
|
|
|
973
973
|
resetClaimedBy: () => {
|
|
974
974
|
reset();
|
|
975
975
|
// TODO: Use key generator
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
976
|
+
if (type) {
|
|
977
|
+
retryOn(
|
|
978
|
+
{
|
|
979
|
+
walletType: type,
|
|
980
|
+
network: namespace?.network,
|
|
981
|
+
accounts: address ? [address] : [],
|
|
982
|
+
},
|
|
983
|
+
manager,
|
|
984
|
+
context.canSwitchNetworkTo
|
|
985
|
+
);
|
|
986
|
+
}
|
|
981
987
|
},
|
|
982
988
|
});
|
|
983
989
|
}
|
|
@@ -1203,12 +1209,12 @@ export async function signTransaction(
|
|
|
1203
1209
|
}
|
|
1204
1210
|
|
|
1205
1211
|
export function checkWaitingForConnectWalletChange(params: {
|
|
1206
|
-
|
|
1212
|
+
lastConnectedWallet: LastConnectedWallet;
|
|
1207
1213
|
manager?: Manager;
|
|
1208
1214
|
evmChains: EvmBlockchainMeta[];
|
|
1209
1215
|
}): void {
|
|
1210
|
-
const {
|
|
1211
|
-
const
|
|
1216
|
+
const { lastConnectedWallet, evmChains, manager } = params;
|
|
1217
|
+
const { walletType: wallet, network } = lastConnectedWallet;
|
|
1212
1218
|
// We only need change network for EVM chains.
|
|
1213
1219
|
if (!evmChains.some((chain) => chain.name == network)) {
|
|
1214
1220
|
return;
|
|
@@ -1241,6 +1247,11 @@ export function checkWaitingForConnectWalletChange(params: {
|
|
|
1241
1247
|
currentStep
|
|
1242
1248
|
)?.network;
|
|
1243
1249
|
|
|
1250
|
+
// We only need change network for EVM chains.
|
|
1251
|
+
if (!evmChains.some((chain) => chain.name == requiredNetwork)) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1244
1255
|
if (
|
|
1245
1256
|
currentStepRequiredWallet === wallet &&
|
|
1246
1257
|
hasWaitingForConnect &&
|
|
@@ -1387,13 +1398,13 @@ export function resetRunningSwapNotifsOnPageLoad(runningSwaps: PendingSwap[]) {
|
|
|
1387
1398
|
* @returns
|
|
1388
1399
|
*/
|
|
1389
1400
|
export function retryOn(
|
|
1390
|
-
|
|
1401
|
+
lastConnectedWallet: LastConnectedWallet,
|
|
1391
1402
|
manager?: Manager,
|
|
1392
1403
|
canSwitchNetworkTo?: (type: WalletType, network: Network) => boolean,
|
|
1393
1404
|
options = { fallbackToOnlyWallet: true }
|
|
1394
1405
|
): void {
|
|
1395
|
-
const
|
|
1396
|
-
if (!wallet
|
|
1406
|
+
const { walletType: wallet, network } = lastConnectedWallet;
|
|
1407
|
+
if (!wallet) {
|
|
1397
1408
|
return;
|
|
1398
1409
|
}
|
|
1399
1410
|
|
|
@@ -1410,6 +1421,7 @@ export function retryOn(
|
|
|
1410
1421
|
const currentStep = getCurrentStep(swap);
|
|
1411
1422
|
if (currentStep) {
|
|
1412
1423
|
if (
|
|
1424
|
+
network &&
|
|
1413
1425
|
getCurrentNamespaceOfOrNull(swap, currentStep)?.network ==
|
|
1414
1426
|
network &&
|
|
1415
1427
|
queueStorage?.swapDetails.wallets[network]?.walletType === wallet
|
|
@@ -1444,7 +1456,7 @@ export function retryOn(
|
|
|
1444
1456
|
finalQueueToBeRun = onlyWalletMatched[0];
|
|
1445
1457
|
}
|
|
1446
1458
|
|
|
1447
|
-
if (!canSwitchNetworkTo?.(wallet, network)) {
|
|
1459
|
+
if (!network || !canSwitchNetworkTo?.(wallet, network)) {
|
|
1448
1460
|
finalQueueToBeRun?.unblock();
|
|
1449
1461
|
} else {
|
|
1450
1462
|
finalQueueToBeRun?.checkBlock();
|
package/src/hooks.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { LastConnectedWallet, UseQueueManagerParams } from './types';
|
|
2
|
+
|
|
1
3
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
2
4
|
import { useEffect, useState } from 'react';
|
|
3
5
|
|
|
@@ -7,10 +9,17 @@ import {
|
|
|
7
9
|
retryOn,
|
|
8
10
|
} from './helpers';
|
|
9
11
|
import { migrated, migration } from './migration';
|
|
10
|
-
import { type UseQueueManagerParams } from './types';
|
|
11
12
|
|
|
12
13
|
let isCalled = 0;
|
|
13
14
|
|
|
15
|
+
function getLastConnectedWalletHash(
|
|
16
|
+
lastConnectedWallet: LastConnectedWallet | null
|
|
17
|
+
) {
|
|
18
|
+
return `${lastConnectedWallet?.walletType}-${
|
|
19
|
+
lastConnectedWallet?.network
|
|
20
|
+
}-${lastConnectedWallet?.accounts?.toString()}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
*
|
|
16
25
|
* Runs a migration (old swaps from localstorage to queue manager's IndexedDB)
|
|
@@ -31,7 +40,7 @@ function useMigration(): {
|
|
|
31
40
|
}
|
|
32
41
|
isCalled = 1;
|
|
33
42
|
|
|
34
|
-
migration().finally(() => {
|
|
43
|
+
void migration().finally(() => {
|
|
35
44
|
setStatus(true);
|
|
36
45
|
});
|
|
37
46
|
})();
|
|
@@ -50,29 +59,36 @@ function useMigration(): {
|
|
|
50
59
|
*/
|
|
51
60
|
function useQueueManager(params: UseQueueManagerParams): void {
|
|
52
61
|
const { manager } = useManager();
|
|
62
|
+
const {
|
|
63
|
+
lastConnectedWallet,
|
|
64
|
+
disconnectedWallet,
|
|
65
|
+
evmChains,
|
|
66
|
+
canSwitchNetworkTo,
|
|
67
|
+
clearDisconnectedWallet,
|
|
68
|
+
} = params;
|
|
53
69
|
|
|
54
70
|
useEffect(() => {
|
|
55
|
-
if (
|
|
71
|
+
if (lastConnectedWallet) {
|
|
56
72
|
checkWaitingForConnectWalletChange({
|
|
57
|
-
evmChains
|
|
58
|
-
|
|
73
|
+
evmChains,
|
|
74
|
+
lastConnectedWallet,
|
|
59
75
|
manager,
|
|
60
76
|
});
|
|
61
|
-
retryOn(
|
|
77
|
+
retryOn(lastConnectedWallet, manager, canSwitchNetworkTo);
|
|
62
78
|
}
|
|
63
|
-
}, [
|
|
79
|
+
}, [getLastConnectedWalletHash(lastConnectedWallet)]);
|
|
64
80
|
|
|
65
81
|
useEffect(() => {
|
|
66
|
-
if (
|
|
82
|
+
if (disconnectedWallet) {
|
|
67
83
|
checkWaitingForNetworkChange(manager);
|
|
68
84
|
|
|
69
85
|
/*
|
|
70
86
|
*We need to reset the state value, so if a wallet disconnected twice (after reconnect),
|
|
71
87
|
*this effect will be run properly.
|
|
72
88
|
*/
|
|
73
|
-
|
|
89
|
+
clearDisconnectedWallet();
|
|
74
90
|
}
|
|
75
|
-
}, [
|
|
91
|
+
}, [disconnectedWallet]);
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
export { useQueueManager, useMigration };
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -81,8 +81,14 @@ export interface SwapQueueContext extends QueueContext {
|
|
|
81
81
|
resetClaimedBy?: () => void;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
export type LastConnectedWallet = {
|
|
85
|
+
walletType: string;
|
|
86
|
+
network?: string;
|
|
87
|
+
accounts?: string[];
|
|
88
|
+
};
|
|
89
|
+
|
|
84
90
|
export interface UseQueueManagerParams {
|
|
85
|
-
lastConnectedWallet:
|
|
91
|
+
lastConnectedWallet: LastConnectedWallet | null;
|
|
86
92
|
disconnectedWallet: WalletType | undefined;
|
|
87
93
|
clearDisconnectedWallet: () => void;
|
|
88
94
|
evmChains: EvmBlockchainMeta[];
|