@rango-dev/queue-manager-rango-preset 0.41.1-next.1 → 0.42.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/dist/actions/checkStatus.d.ts.map +1 -1
- package/dist/actions/executeTransaction.d.ts.map +1 -1
- package/dist/actions/scheduleNextStep.d.ts.map +1 -1
- package/dist/helpers.d.ts +8 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- 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/services/eventEmitter.d.ts.map +1 -1
- package/dist/shared.d.ts +3 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/types.d.ts +9 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +11 -5
- package/src/actions/executeTransaction.ts +3 -5
- package/src/actions/scheduleNextStep.ts +6 -0
- package/src/helpers.ts +90 -37
- package/src/index.ts +2 -6
- package/src/services/eventEmitter.ts +18 -8
- package/src/shared.ts +29 -71
- package/src/types.ts +11 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/configs.ts":{"bytes":816,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":7204,"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":11480,"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":7692,"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":43427,"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":"rango-sdk","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":15043,"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":2970,"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":2363,"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":166299},"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":"rango-sdk","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":15055},"src/services/httpService.ts":{"bytesInOutput":118},"src/services/index.ts":{"bytesInOutput":0},"src/shared.ts":{"bytesInOutput":4891},"src/numbers.ts":{"bytesInOutput":689},"src/shared-errors.ts":{"bytesInOutput":2212},"src/services/eventEmitter.ts":{"bytesInOutput":3364},"src/actions/checkStatus.ts":{"bytesInOutput":5364},"src/actions/createTransaction.ts":{"bytesInOutput":858},"src/actions/executeTransaction.ts":{"bytesInOutput":957},"src/actions/scheduleNextStep.ts":{"bytesInOutput":701},"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":38693}}}
|
|
1
|
+
{"inputs":{"src/configs.ts":{"bytes":816,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":7333,"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":10387,"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":8000,"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":44731,"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-sdk","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":15310,"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":2970,"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":4408,"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":2657,"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":1476,"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":168679},"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-sdk","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","getCurrentBlockchainOfOrNull","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":15674},"src/services/httpService.ts":{"bytesInOutput":118},"src/services/index.ts":{"bytesInOutput":0},"src/shared.ts":{"bytesInOutput":4526},"src/numbers.ts":{"bytesInOutput":689},"src/shared-errors.ts":{"bytesInOutput":2212},"src/services/eventEmitter.ts":{"bytesInOutput":3490},"src/actions/checkStatus.ts":{"bytesInOutput":5409},"src/actions/createTransaction.ts":{"bytesInOutput":858},"src/actions/executeTransaction.ts":{"bytesInOutput":949},"src/actions/scheduleNextStep.ts":{"bytesInOutput":762},"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":39172}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../src/services/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAIf,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../src/services/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAIf,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqBhE,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CAC9B,GAAG;IACF,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC;CAClE,CAAC;AAkJF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,QAsG9C"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { NamespaceInputForConnect } from '@rango-dev/wallets-core/dist/legacy/types';
|
|
2
1
|
import type { Network, WalletType } from '@rango-dev/wallets-shared';
|
|
3
2
|
import type { BlockchainMeta, ConfirmRouteResponse, MetaResponse, SwapResult, Token } from 'rango-sdk';
|
|
4
3
|
import type { PendingSwap, PendingSwapStep, SwapSavedSettings, WalletTypeAndAddress } from 'rango-types';
|
|
@@ -19,6 +18,7 @@ export type WalletBalance = {
|
|
|
19
18
|
usdPrice: number | null;
|
|
20
19
|
};
|
|
21
20
|
export type Account = {
|
|
21
|
+
balances: WalletBalance[] | null;
|
|
22
22
|
address: string;
|
|
23
23
|
loading: boolean;
|
|
24
24
|
walletType: WalletType;
|
|
@@ -41,12 +41,8 @@ export declare enum MessageSeverity {
|
|
|
41
41
|
success = "success"
|
|
42
42
|
}
|
|
43
43
|
export type SwapStatus = 'running' | 'failed' | 'success';
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
network: string;
|
|
47
|
-
}
|
|
48
|
-
export declare const getCurrentNamespaceOfOrNull: (swap: PendingSwap, step: PendingSwapStep) => TargetNamespace | null;
|
|
49
|
-
export declare const getCurrentNamespaceOf: (swap: PendingSwap, step: PendingSwapStep) => TargetNamespace;
|
|
44
|
+
export declare const getCurrentBlockchainOfOrNull: (swap: PendingSwap, step: PendingSwapStep) => Network | null;
|
|
45
|
+
export declare const getCurrentBlockchainOf: (swap: PendingSwap, step: PendingSwapStep) => Network;
|
|
50
46
|
export declare const getScannerUrl: (txHash: string, network: Network, blockchainMetaMap: {
|
|
51
47
|
[key: string]: BlockchainMeta;
|
|
52
48
|
}) => string | undefined;
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,K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EAAE,eAAe,GAAG,IAAI,GAClC,oBAAoB,GAAG,IAAI,CAS7B;AAED,eAAO,MAAM,WAAW,eACV,MAAM,UACV,MAAM,WACL,MAAM,GAAG,IAAI,aACX,KAAK,EAAE,KACjB,MAAM,GAAG,IAQX,CAAC;AAEF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,KAAK,EAAE,GACjB,SAAS,CAoBX;AA6CD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,WAAW,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAAA;CAAE,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,oBAAoB,EAAE,OAAO,EAC7B,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,QAAQ,CAAC,GAAG,IAAI,GACxD,WAAW,CAuEb"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Wallet } from './shared';
|
|
2
2
|
import type { QueueContext, QueueDef, QueueStorage } from '@rango-dev/queue-manager-core';
|
|
3
3
|
import type { LegacyConnectResult as ConnectResult } from '@rango-dev/wallets-core/legacy';
|
|
4
4
|
import type { Meta, Network, Providers, WalletState, WalletType } from '@rango-dev/wallets-shared';
|
|
@@ -35,8 +35,9 @@ export interface SwapQueueContext extends QueueContext {
|
|
|
35
35
|
wallets: Wallet | null;
|
|
36
36
|
providers: Providers;
|
|
37
37
|
getSigners: (type: WalletType) => Promise<SignerFactory>;
|
|
38
|
-
switchNetwork: (wallet: WalletType,
|
|
38
|
+
switchNetwork: (wallet: WalletType, network: Network) => Promise<ConnectResult | undefined> | undefined;
|
|
39
39
|
canSwitchNetworkTo: (type: WalletType, network: Network) => boolean;
|
|
40
|
+
connect: (wallet: WalletType, network: Network) => Promise<ConnectResult> | undefined;
|
|
40
41
|
state: (type: WalletType) => WalletState;
|
|
41
42
|
isMobileWallet: (type: WalletType) => boolean;
|
|
42
43
|
claimedBy?: string;
|
|
@@ -106,10 +107,15 @@ export type FailedRouteEventPayload = {
|
|
|
106
107
|
};
|
|
107
108
|
export type FailedStepEventPayload = FailedRouteEventPayload;
|
|
108
109
|
export type SucceededRouteEventPayload = {
|
|
110
|
+
inputAmount: string;
|
|
111
|
+
inputAmountUsd: string;
|
|
109
112
|
outputAmount: string;
|
|
113
|
+
outputAmountUsd: string;
|
|
110
114
|
};
|
|
111
115
|
export type SucceededStepEventPayload = SucceededRouteEventPayload;
|
|
112
|
-
export type OutputRevealedEventPayload =
|
|
116
|
+
export type OutputRevealedEventPayload = {
|
|
117
|
+
outputAmount: string;
|
|
118
|
+
};
|
|
113
119
|
export type StepExecutionEventPayload = {
|
|
114
120
|
status: StepExecutionEventStatus.CREATE_TX | StepExecutionEventStatus.SEND_TX | StepExecutionEventStatus.TX_SENT;
|
|
115
121
|
};
|
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,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,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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AAc,CAAC;IAC1C,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;CACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
getCurrentStep,
|
|
10
10
|
getCurrentStepTx,
|
|
11
11
|
getCurrentStepTxType,
|
|
12
|
+
getLastSuccessfulStepInput,
|
|
13
|
+
getLastSuccessfulStepInputUsd,
|
|
14
|
+
getLastSuccessfulStepOutputUsd,
|
|
12
15
|
inMemoryTransactionsData,
|
|
13
16
|
resetNetworkStatus,
|
|
14
17
|
setCurrentStepTx,
|
|
@@ -17,7 +20,7 @@ import {
|
|
|
17
20
|
import { httpService } from '../services';
|
|
18
21
|
import { notifier } from '../services/eventEmitter';
|
|
19
22
|
import {
|
|
20
|
-
|
|
23
|
+
getCurrentBlockchainOf,
|
|
21
24
|
getNextStep,
|
|
22
25
|
getRelatedWallet,
|
|
23
26
|
getScannerUrl,
|
|
@@ -90,13 +93,13 @@ async function checkTransactionStatus({
|
|
|
90
93
|
if (updatedTxHash !== txId) {
|
|
91
94
|
currentStep.executedTransactionId =
|
|
92
95
|
updatedTxHash || currentStep.executedTransactionId;
|
|
93
|
-
const
|
|
96
|
+
const currentStepBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
94
97
|
let explorerUrl: string | undefined;
|
|
95
98
|
const blockchainsMetaNotEmpty = !!Object.keys(meta.blockchains).length;
|
|
96
99
|
if (blockchainsMetaNotEmpty) {
|
|
97
100
|
explorerUrl = getScannerUrl(
|
|
98
101
|
currentStep.executedTransactionId,
|
|
99
|
-
|
|
102
|
+
currentStepBlockchain,
|
|
100
103
|
meta.blockchains
|
|
101
104
|
);
|
|
102
105
|
}
|
|
@@ -222,7 +225,10 @@ async function checkTransactionStatus({
|
|
|
222
225
|
notifier({
|
|
223
226
|
event: {
|
|
224
227
|
type: StepEventType.SUCCEEDED,
|
|
228
|
+
inputAmount: getLastSuccessfulStepInput(swap),
|
|
229
|
+
inputAmountUsd: getLastSuccessfulStepInputUsd(swap),
|
|
225
230
|
outputAmount: currentStep.outputAmount ?? '',
|
|
231
|
+
outputAmountUsd: getLastSuccessfulStepOutputUsd(swap),
|
|
226
232
|
},
|
|
227
233
|
swap,
|
|
228
234
|
step: currentStep,
|
|
@@ -314,13 +320,13 @@ async function checkApprovalStatus({
|
|
|
314
320
|
if (updatedTxHash !== txId) {
|
|
315
321
|
currentStep.executedTransactionId =
|
|
316
322
|
updatedTxHash || currentStep.executedTransactionId;
|
|
317
|
-
const
|
|
323
|
+
const currentStepBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
318
324
|
let explorerUrl: string | undefined;
|
|
319
325
|
const blockchainsMetaNotEmpty = !!Object.keys(meta.blockchains).length;
|
|
320
326
|
if (blockchainsMetaNotEmpty) {
|
|
321
327
|
explorerUrl = getScannerUrl(
|
|
322
328
|
currentStep.executedTransactionId,
|
|
323
|
-
|
|
329
|
+
currentStepBlockchain,
|
|
324
330
|
meta.blockchains
|
|
325
331
|
);
|
|
326
332
|
}
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
signTransaction,
|
|
22
22
|
updateNetworkStatus,
|
|
23
23
|
} from '../helpers';
|
|
24
|
-
import {
|
|
24
|
+
import { getCurrentBlockchainOf } from '../shared';
|
|
25
25
|
import { BlockReason } from '../types';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -95,10 +95,8 @@ export async function executeTransaction(
|
|
|
95
95
|
requestBlock(blockedFor);
|
|
96
96
|
return;
|
|
97
97
|
} else if (!networkMatched) {
|
|
98
|
-
const
|
|
99
|
-
const details = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK(
|
|
100
|
-
fromNamespace.network
|
|
101
|
-
);
|
|
98
|
+
const fromBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
99
|
+
const details = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK(fromBlockchain);
|
|
102
100
|
|
|
103
101
|
const blockedFor = {
|
|
104
102
|
reason: BlockReason.WAIT_FOR_NETWORK_CHANGE,
|
|
@@ -5,6 +5,9 @@ import type { PendingSwapStep } from 'rango-types';
|
|
|
5
5
|
import {
|
|
6
6
|
getCurrentStep,
|
|
7
7
|
getLastSuccessfulStep,
|
|
8
|
+
getLastSuccessfulStepInput,
|
|
9
|
+
getLastSuccessfulStepInputUsd,
|
|
10
|
+
getLastSuccessfulStepOutputUsd,
|
|
8
11
|
isTxAlreadyCreated,
|
|
9
12
|
} from '../helpers';
|
|
10
13
|
import { notifier } from '../services/eventEmitter';
|
|
@@ -76,8 +79,11 @@ export function scheduleNextStep({
|
|
|
76
79
|
: {
|
|
77
80
|
event: {
|
|
78
81
|
type: StepEventType.SUCCEEDED,
|
|
82
|
+
inputAmount: getLastSuccessfulStepInput(swap),
|
|
83
|
+
inputAmountUsd: getLastSuccessfulStepInputUsd(swap),
|
|
79
84
|
outputAmount:
|
|
80
85
|
getLastSuccessfulStep(swap.steps)?.outputAmount ?? '',
|
|
86
|
+
outputAmountUsd: getLastSuccessfulStepOutputUsd(swap),
|
|
81
87
|
},
|
|
82
88
|
}),
|
|
83
89
|
swap: swap,
|
package/src/helpers.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable destructuring/in-params */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
4
|
-
import type { SwapStatus,
|
|
4
|
+
import type { SwapStatus, Wallet } from './shared';
|
|
5
5
|
import type {
|
|
6
6
|
ArrayElement,
|
|
7
7
|
Step,
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
getEvmProvider,
|
|
45
45
|
splitWalletNetwork,
|
|
46
46
|
} from '@rango-dev/wallets-shared';
|
|
47
|
+
import BigNumber from 'bignumber.js';
|
|
47
48
|
import { TransactionType } from 'rango-sdk';
|
|
48
49
|
import { PendingSwapNetworkStatus, SignerError } from 'rango-types';
|
|
49
50
|
|
|
@@ -57,8 +58,8 @@ import { httpService } from './services';
|
|
|
57
58
|
import { notifier } from './services/eventEmitter';
|
|
58
59
|
import {
|
|
59
60
|
getCurrentAddressOf,
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
getCurrentBlockchainOf,
|
|
62
|
+
getCurrentBlockchainOfOrNull,
|
|
62
63
|
getRelatedWallet,
|
|
63
64
|
getRelatedWalletOrNull,
|
|
64
65
|
getScannerUrl,
|
|
@@ -519,9 +520,9 @@ export function markRunningSwapAsSwitchingNetwork({
|
|
|
519
520
|
|
|
520
521
|
// Generate message
|
|
521
522
|
const { type } = getRequiredWallet(swap);
|
|
522
|
-
const
|
|
523
|
-
const reason = `Change ${type} wallet network to ${
|
|
524
|
-
const reasonDetail = `Please change your ${type} wallet network to ${
|
|
523
|
+
const fromBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
524
|
+
const reason = `Change ${type} wallet network to ${fromBlockchain}`;
|
|
525
|
+
const reasonDetail = `Please change your ${type} wallet network to ${fromBlockchain}.`;
|
|
525
526
|
|
|
526
527
|
const currentTime = new Date();
|
|
527
528
|
swap.lastNotificationTime = currentTime.getTime().toString();
|
|
@@ -621,26 +622,26 @@ export function isWalletNull(wallet: Wallet | null): boolean {
|
|
|
621
622
|
*/
|
|
622
623
|
export function getRequiredWallet(swap: PendingSwap): {
|
|
623
624
|
type: WalletType | null;
|
|
624
|
-
|
|
625
|
+
network: Network | null;
|
|
625
626
|
address: string | null;
|
|
626
627
|
} {
|
|
627
628
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
628
629
|
const step = getCurrentStep(swap)!;
|
|
629
|
-
const
|
|
630
|
-
if (!
|
|
630
|
+
const bcName = getCurrentBlockchainOfOrNull(swap, step);
|
|
631
|
+
if (!bcName) {
|
|
631
632
|
return {
|
|
632
633
|
type: null,
|
|
633
|
-
|
|
634
|
+
network: null,
|
|
634
635
|
address: null,
|
|
635
636
|
};
|
|
636
637
|
}
|
|
637
638
|
|
|
638
|
-
const walletType = getSwapWalletType(swap,
|
|
639
|
-
const sourceWallet = swap.wallets[
|
|
639
|
+
const walletType = getSwapWalletType(swap, bcName);
|
|
640
|
+
const sourceWallet = swap.wallets[bcName];
|
|
640
641
|
|
|
641
642
|
return {
|
|
642
643
|
type: walletType || null,
|
|
643
|
-
|
|
644
|
+
network: bcName,
|
|
644
645
|
address: sourceWallet ? sourceWallet.address : null,
|
|
645
646
|
};
|
|
646
647
|
}
|
|
@@ -674,18 +675,18 @@ export async function isNetworkMatchedForTransaction(
|
|
|
674
675
|
if (isWalletNull(wallet)) {
|
|
675
676
|
return false;
|
|
676
677
|
}
|
|
677
|
-
const
|
|
678
|
-
if (!
|
|
678
|
+
const fromBlockChain = getCurrentBlockchainOfOrNull(swap, step);
|
|
679
|
+
if (!fromBlockChain) {
|
|
679
680
|
return false;
|
|
680
681
|
}
|
|
681
682
|
|
|
682
683
|
if (
|
|
683
684
|
meta.evmBasedChains.find(
|
|
684
|
-
(evmBlochain) => evmBlochain.name ===
|
|
685
|
+
(evmBlochain) => evmBlochain.name === fromBlockChain
|
|
685
686
|
)
|
|
686
687
|
) {
|
|
687
688
|
try {
|
|
688
|
-
const sourceWallet = swap.wallets[
|
|
689
|
+
const sourceWallet = swap.wallets[fromBlockChain];
|
|
689
690
|
if (sourceWallet) {
|
|
690
691
|
const provider = getEvmProvider(providers, sourceWallet.walletType);
|
|
691
692
|
const chainId: number | string | null = await getChainId(provider);
|
|
@@ -698,13 +699,13 @@ export async function isNetworkMatchedForTransaction(
|
|
|
698
699
|
);
|
|
699
700
|
if (
|
|
700
701
|
blockChain &&
|
|
701
|
-
blockChain.toLowerCase() ===
|
|
702
|
+
blockChain.toLowerCase() === fromBlockChain.toLowerCase()
|
|
702
703
|
) {
|
|
703
704
|
return true;
|
|
704
705
|
}
|
|
705
706
|
if (
|
|
706
707
|
blockChain &&
|
|
707
|
-
blockChain.toLowerCase() !==
|
|
708
|
+
blockChain.toLowerCase() !== fromBlockChain.toLowerCase()
|
|
708
709
|
) {
|
|
709
710
|
return false;
|
|
710
711
|
}
|
|
@@ -856,10 +857,7 @@ export function onBlockForChangeNetwork(
|
|
|
856
857
|
setStorage: queue.setStorage.bind(queue),
|
|
857
858
|
});
|
|
858
859
|
|
|
859
|
-
const requiredNetwork =
|
|
860
|
-
swap,
|
|
861
|
-
currentStep
|
|
862
|
-
)?.network;
|
|
860
|
+
const requiredNetwork = getCurrentBlockchainOfOrNull(swap, currentStep);
|
|
863
861
|
|
|
864
862
|
const requiredWallet = getRequiredWallet(swap).type;
|
|
865
863
|
|
|
@@ -881,10 +879,10 @@ export function onBlockForChangeNetwork(
|
|
|
881
879
|
}
|
|
882
880
|
|
|
883
881
|
// Try to auto switch
|
|
884
|
-
const { type,
|
|
885
|
-
if (!!type && !!
|
|
886
|
-
if (context.canSwitchNetworkTo(type,
|
|
887
|
-
const result = context.switchNetwork(type,
|
|
882
|
+
const { type, network } = getRequiredWallet(swap);
|
|
883
|
+
if (!!type && !!network) {
|
|
884
|
+
if (context.canSwitchNetworkTo(type, network)) {
|
|
885
|
+
const result = context.switchNetwork(type, network);
|
|
888
886
|
if (result) {
|
|
889
887
|
result
|
|
890
888
|
.then(() => {
|
|
@@ -953,7 +951,7 @@ export function onDependsOnOtherQueues(
|
|
|
953
951
|
|
|
954
952
|
setClaimer(task.queue_id);
|
|
955
953
|
const claimedStorage = task.storage.get() as SwapStorage;
|
|
956
|
-
const { type,
|
|
954
|
+
const { type, network, address } = getRequiredWallet(
|
|
957
955
|
claimedStorage.swapDetails
|
|
958
956
|
);
|
|
959
957
|
|
|
@@ -964,7 +962,7 @@ export function onDependsOnOtherQueues(
|
|
|
964
962
|
reset();
|
|
965
963
|
// TODO: Use key generator
|
|
966
964
|
retryOn(
|
|
967
|
-
`${type}-${
|
|
965
|
+
`${type}-${network}:${address}`,
|
|
968
966
|
manager,
|
|
969
967
|
context.canSwitchNetworkTo
|
|
970
968
|
);
|
|
@@ -1007,7 +1005,7 @@ export async function signTransaction(
|
|
|
1007
1005
|
const sourceWallet = getRelatedWallet(swap, currentStep);
|
|
1008
1006
|
const mobileWallet = isMobileWallet(sourceWallet?.walletType);
|
|
1009
1007
|
const walletAddress = getCurrentAddressOf(swap, currentStep);
|
|
1010
|
-
const
|
|
1008
|
+
const currentStepBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
1011
1009
|
|
|
1012
1010
|
const onFinish = () => {
|
|
1013
1011
|
// TODO resetClaimedBy is undefined here
|
|
@@ -1119,7 +1117,7 @@ export async function signTransaction(
|
|
|
1119
1117
|
({ hash, response }) => {
|
|
1120
1118
|
const explorerUrl = getScannerUrl(
|
|
1121
1119
|
hash,
|
|
1122
|
-
|
|
1120
|
+
currentStepBlockchain,
|
|
1123
1121
|
meta.blockchains
|
|
1124
1122
|
);
|
|
1125
1123
|
setStepTransactionIds(
|
|
@@ -1218,10 +1216,7 @@ export function checkWaitingForConnectWalletChange(params: {
|
|
|
1218
1216
|
}
|
|
1219
1217
|
);
|
|
1220
1218
|
|
|
1221
|
-
const requiredNetwork =
|
|
1222
|
-
swap,
|
|
1223
|
-
currentStep
|
|
1224
|
-
)?.network;
|
|
1219
|
+
const requiredNetwork = getCurrentBlockchainOfOrNull(swap, currentStep);
|
|
1225
1220
|
|
|
1226
1221
|
if (
|
|
1227
1222
|
currentStepRequiredWallet === wallet &&
|
|
@@ -1392,8 +1387,7 @@ export function retryOn(
|
|
|
1392
1387
|
const currentStep = getCurrentStep(swap);
|
|
1393
1388
|
if (currentStep) {
|
|
1394
1389
|
if (
|
|
1395
|
-
|
|
1396
|
-
network &&
|
|
1390
|
+
getCurrentBlockchainOfOrNull(swap, currentStep) == network &&
|
|
1397
1391
|
queueStorage?.swapDetails.wallets[network]?.walletType === wallet
|
|
1398
1392
|
) {
|
|
1399
1393
|
walletAndNetworkMatched.push(q.list);
|
|
@@ -1525,3 +1519,62 @@ export function isApprovalTX(step: Step): boolean {
|
|
|
1525
1519
|
|
|
1526
1520
|
return approvalTx;
|
|
1527
1521
|
}
|
|
1522
|
+
|
|
1523
|
+
export function getTokenAmountInUsd(
|
|
1524
|
+
amount: string | number,
|
|
1525
|
+
usdPrice: string | number
|
|
1526
|
+
): string {
|
|
1527
|
+
const usdValue = new BigNumber(amount).multipliedBy(usdPrice);
|
|
1528
|
+
if (isNaN(usdValue.toNumber())) {
|
|
1529
|
+
return '';
|
|
1530
|
+
}
|
|
1531
|
+
return usdValue.toString();
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
export function getSwapInputUsd(swap: PendingSwap): string {
|
|
1535
|
+
return getTokenAmountInUsd(
|
|
1536
|
+
swap.inputAmount,
|
|
1537
|
+
swap.steps[0].fromUsdPrice ?? ''
|
|
1538
|
+
);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
export function getSwapOutputUsd(swap: PendingSwap): string {
|
|
1542
|
+
const lastStep = swap.steps[swap.steps.length - 1];
|
|
1543
|
+
|
|
1544
|
+
return getTokenAmountInUsd(
|
|
1545
|
+
lastStep.outputAmount ?? '',
|
|
1546
|
+
lastStep.toUsdPrice ?? ''
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
export function getLastSuccessfulStepInput(swap: PendingSwap): string {
|
|
1551
|
+
const lastSuccessfulStepIndex = swap.steps.findLastIndex(
|
|
1552
|
+
(step) => step.status === 'success'
|
|
1553
|
+
);
|
|
1554
|
+
|
|
1555
|
+
if (lastSuccessfulStepIndex < 0) {
|
|
1556
|
+
return '';
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
return lastSuccessfulStepIndex === 0
|
|
1560
|
+
? swap.inputAmount
|
|
1561
|
+
: swap.steps[lastSuccessfulStepIndex - 1].outputAmount ?? '';
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
export function getLastSuccessfulStepInputUsd(swap: PendingSwap): string {
|
|
1565
|
+
const lastSuccessfulStep = getLastSuccessfulStep(swap.steps);
|
|
1566
|
+
|
|
1567
|
+
return getTokenAmountInUsd(
|
|
1568
|
+
getLastSuccessfulStepInput(swap),
|
|
1569
|
+
lastSuccessfulStep?.fromUsdPrice ?? ''
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
export function getLastSuccessfulStepOutputUsd(swap: PendingSwap): string {
|
|
1574
|
+
const lastSuccessfulStep = getLastSuccessfulStep(swap.steps);
|
|
1575
|
+
|
|
1576
|
+
return getTokenAmountInUsd(
|
|
1577
|
+
lastSuccessfulStep?.outputAmount ?? '',
|
|
1578
|
+
lastSuccessfulStep?.toUsdPrice ?? ''
|
|
1579
|
+
);
|
|
1580
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -35,13 +35,9 @@ export {
|
|
|
35
35
|
StepExecutionBlockedEventStatus,
|
|
36
36
|
EventSeverity,
|
|
37
37
|
} from './types';
|
|
38
|
-
export type {
|
|
39
|
-
PendingSwapWithQueueID,
|
|
40
|
-
EventType,
|
|
41
|
-
TargetNamespace,
|
|
42
|
-
} from './shared';
|
|
38
|
+
export type { PendingSwapWithQueueID, EventType } from './shared';
|
|
43
39
|
export {
|
|
44
|
-
|
|
40
|
+
getCurrentBlockchainOfOrNull,
|
|
45
41
|
getRelatedWalletOrNull,
|
|
46
42
|
getRelatedWallet,
|
|
47
43
|
MessageSeverity,
|