@lifi/sdk 4.0.0-alpha.2 → 4.0.0-alpha.21
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/cjs/actions/getChains.d.ts +1 -1
- package/dist/cjs/actions/getChains.js +4 -4
- package/dist/cjs/actions/getChains.js.map +1 -1
- package/dist/cjs/actions/getRelayedTransactionStatus.js +1 -1
- package/dist/cjs/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/cjs/actions/getStepTransaction.js +9 -1
- package/dist/cjs/actions/getStepTransaction.js.map +1 -1
- package/dist/cjs/actions/index.d.ts +3 -1
- package/dist/cjs/actions/index.js +2 -0
- package/dist/cjs/actions/index.js.map +1 -1
- package/dist/cjs/actions/patchContractCalls.d.ts +10 -0
- package/dist/cjs/actions/patchContractCalls.js +16 -0
- package/dist/cjs/actions/patchContractCalls.js.map +1 -0
- package/dist/cjs/client/createClient.js +4 -0
- package/dist/cjs/client/createClient.js.map +1 -1
- package/dist/cjs/client/getClientStorage.d.ts +1 -0
- package/dist/cjs/client/getClientStorage.js +18 -6
- package/dist/cjs/client/getClientStorage.js.map +1 -1
- package/dist/cjs/core/BaseStepExecutionTask.d.ts +5 -0
- package/dist/cjs/core/BaseStepExecutionTask.js +10 -0
- package/dist/cjs/core/BaseStepExecutionTask.js.map +1 -0
- package/dist/cjs/core/BaseStepExecutor.d.ts +10 -3
- package/dist/cjs/core/BaseStepExecutor.js +53 -0
- package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
- package/dist/cjs/core/StatusManager.d.ts +13 -12
- package/dist/cjs/core/StatusManager.js +55 -61
- package/dist/cjs/core/StatusManager.js.map +1 -1
- package/dist/cjs/core/TaskPipeline.d.ts +7 -0
- package/dist/cjs/core/TaskPipeline.js +27 -0
- package/dist/cjs/core/TaskPipeline.js.map +1 -0
- package/dist/cjs/core/actionMessages.d.ts +4 -0
- package/dist/cjs/core/{processMessages.js → actionMessages.js} +25 -9
- package/dist/cjs/core/actionMessages.js.map +1 -0
- package/dist/cjs/core/execution.js +13 -1
- package/dist/cjs/core/execution.js.map +1 -1
- package/dist/cjs/core/prepareRestart.js +6 -6
- package/dist/cjs/core/prepareRestart.js.map +1 -1
- package/dist/cjs/core/storage.d.ts +17 -0
- package/dist/cjs/core/storage.js +36 -0
- package/dist/cjs/core/storage.js.map +1 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +5 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.js +26 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +5 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.js +36 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +8 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js +73 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
- package/dist/cjs/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
- package/dist/cjs/core/{checkBalance.js → tasks/helpers/checkBalance.js} +6 -6
- package/dist/cjs/core/tasks/helpers/checkBalance.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +2 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js +30 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
- package/dist/cjs/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
- package/dist/cjs/core/{stepComparison.js → tasks/helpers/stepComparison.js} +3 -3
- package/dist/cjs/core/tasks/helpers/stepComparison.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +4 -0
- package/dist/cjs/core/{waitForTransactionStatus.js → tasks/helpers/waitForTransactionStatus.js} +10 -8
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
- package/dist/cjs/core/utils.d.ts +9 -3
- package/dist/cjs/core/utils.js +0 -5
- package/dist/cjs/core/utils.js.map +1 -1
- package/dist/cjs/errors/SDKError.d.ts +3 -3
- package/dist/cjs/errors/SDKError.js +3 -3
- package/dist/cjs/errors/SDKError.js.map +1 -1
- package/dist/cjs/errors/constants.d.ts +5 -2
- package/dist/cjs/errors/constants.js +3 -0
- package/dist/cjs/errors/constants.js.map +1 -1
- package/dist/cjs/errors/errors.d.ts +5 -0
- package/dist/cjs/errors/errors.js +9 -1
- package/dist/cjs/errors/errors.js.map +1 -1
- package/dist/cjs/index.d.ts +20 -10
- package/dist/cjs/index.js +34 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/core.d.ts +51 -21
- package/dist/cjs/types/execution.d.ts +22 -0
- package/dist/cjs/types/execution.js +3 -0
- package/dist/cjs/types/execution.js.map +1 -0
- package/dist/cjs/utils/convertQuoteToRoute.d.ts +6 -1
- package/dist/cjs/utils/convertQuoteToRoute.js +73 -5
- package/dist/cjs/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/cjs/utils/formatUnits.d.ts +1 -0
- package/dist/cjs/utils/formatUnits.js +18 -0
- package/dist/cjs/utils/formatUnits.js.map +1 -0
- package/dist/cjs/utils/isHex.d.ts +4 -0
- package/dist/cjs/utils/isHex.js +13 -0
- package/dist/cjs/utils/isHex.js.map +1 -0
- package/dist/cjs/utils/parseUnits.d.ts +1 -0
- package/dist/cjs/utils/parseUnits.js +44 -0
- package/dist/cjs/utils/parseUnits.js.map +1 -0
- package/dist/cjs/utils/request.js +7 -6
- package/dist/cjs/utils/request.js.map +1 -1
- package/dist/cjs/utils/waitForResult.d.ts +1 -1
- package/dist/cjs/utils/waitForResult.js +6 -2
- package/dist/cjs/utils/waitForResult.js.map +1 -1
- package/dist/cjs/utils/withDedupe.d.ts +5 -0
- package/dist/cjs/utils/withDedupe.js +2 -0
- package/dist/cjs/utils/withDedupe.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/getChains.d.ts +1 -1
- package/dist/esm/actions/getChains.js +2 -2
- package/dist/esm/actions/getChains.js.map +1 -1
- package/dist/esm/actions/getRelayedTransactionStatus.js +1 -1
- package/dist/esm/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/esm/actions/getStepTransaction.js +10 -1
- package/dist/esm/actions/getStepTransaction.js.map +1 -1
- package/dist/esm/actions/index.d.ts +9 -1
- package/dist/esm/actions/index.js +2 -0
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/actions/patchContractCalls.d.ts +10 -0
- package/dist/esm/actions/patchContractCalls.js +12 -0
- package/dist/esm/actions/patchContractCalls.js.map +1 -0
- package/dist/esm/client/createClient.js +4 -0
- package/dist/esm/client/createClient.js.map +1 -1
- package/dist/esm/client/getClientStorage.d.ts +1 -0
- package/dist/esm/client/getClientStorage.js +22 -7
- package/dist/esm/client/getClientStorage.js.map +1 -1
- package/dist/esm/core/BaseStepExecutionTask.d.ts +5 -0
- package/dist/esm/core/BaseStepExecutionTask.js +6 -0
- package/dist/esm/core/BaseStepExecutionTask.js.map +1 -0
- package/dist/esm/core/BaseStepExecutor.d.ts +10 -3
- package/dist/esm/core/BaseStepExecutor.js +53 -0
- package/dist/esm/core/BaseStepExecutor.js.map +1 -1
- package/dist/esm/core/StatusManager.d.ts +40 -39
- package/dist/esm/core/StatusManager.js +86 -92
- package/dist/esm/core/StatusManager.js.map +1 -1
- package/dist/esm/core/TaskPipeline.d.ts +7 -0
- package/dist/esm/core/TaskPipeline.js +23 -0
- package/dist/esm/core/TaskPipeline.js.map +1 -0
- package/dist/esm/core/actionMessages.d.ts +4 -0
- package/dist/esm/core/{processMessages.js → actionMessages.js} +24 -8
- package/dist/esm/core/actionMessages.js.map +1 -0
- package/dist/esm/core/execution.js +14 -3
- package/dist/esm/core/execution.js.map +1 -1
- package/dist/esm/core/prepareRestart.js +10 -9
- package/dist/esm/core/prepareRestart.js.map +1 -1
- package/dist/esm/core/storage.d.ts +17 -0
- package/dist/esm/core/storage.js +30 -0
- package/dist/esm/core/storage.js.map +1 -0
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts +5 -0
- package/dist/esm/core/tasks/CheckBalanceTask.js +22 -0
- package/dist/esm/core/tasks/CheckBalanceTask.js.map +1 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +5 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.js +32 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +8 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js +74 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
- package/dist/esm/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
- package/dist/esm/core/{checkBalance.js → tasks/helpers/checkBalance.js} +4 -4
- package/dist/esm/core/tasks/helpers/checkBalance.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +2 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js +26 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
- package/dist/esm/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
- package/dist/esm/core/{stepComparison.js → tasks/helpers/stepComparison.js} +3 -3
- package/dist/esm/core/tasks/helpers/stepComparison.js.map +1 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +4 -0
- package/dist/esm/core/{waitForTransactionStatus.js → tasks/helpers/waitForTransactionStatus.js} +9 -7
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
- package/dist/esm/core/utils.d.ts +9 -11
- package/dist/esm/core/utils.js +0 -11
- package/dist/esm/core/utils.js.map +1 -1
- package/dist/esm/errors/SDKError.d.ts +3 -3
- package/dist/esm/errors/SDKError.js +4 -4
- package/dist/esm/errors/SDKError.js.map +1 -1
- package/dist/esm/errors/constants.d.ts +5 -2
- package/dist/esm/errors/constants.js +3 -0
- package/dist/esm/errors/constants.js.map +1 -1
- package/dist/esm/errors/errors.d.ts +10 -0
- package/dist/esm/errors/errors.js +12 -0
- package/dist/esm/errors/errors.js.map +1 -1
- package/dist/esm/index.d.ts +20 -10
- package/dist/esm/index.js +17 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/core.d.ts +55 -21
- package/dist/esm/types/execution.d.ts +23 -0
- package/dist/esm/types/execution.js +2 -0
- package/dist/esm/types/execution.js.map +1 -0
- package/dist/esm/utils/convertQuoteToRoute.d.ts +11 -3
- package/dist/esm/utils/convertQuoteToRoute.js +76 -7
- package/dist/esm/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/esm/utils/formatUnits.d.ts +4 -0
- package/dist/esm/utils/formatUnits.js +18 -0
- package/dist/esm/utils/formatUnits.js.map +1 -0
- package/dist/esm/utils/isHex.d.ts +4 -0
- package/dist/esm/utils/isHex.js +10 -0
- package/dist/esm/utils/isHex.js.map +1 -0
- package/dist/esm/utils/parseUnits.d.ts +4 -0
- package/dist/esm/utils/parseUnits.js +46 -0
- package/dist/esm/utils/parseUnits.js.map +1 -0
- package/dist/esm/utils/request.js +7 -6
- package/dist/esm/utils/request.js.map +1 -1
- package/dist/esm/utils/waitForResult.d.ts +2 -2
- package/dist/esm/utils/waitForResult.js +7 -3
- package/dist/esm/utils/waitForResult.js.map +1 -1
- package/dist/esm/utils/withDedupe.d.ts +10 -0
- package/dist/esm/utils/withDedupe.js +1 -1
- package/dist/esm/utils/withDedupe.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/getChains.d.ts +1 -1
- package/dist/types/actions/getChains.d.ts.map +1 -1
- package/dist/types/actions/getStepTransaction.d.ts.map +1 -1
- package/dist/types/actions/index.d.ts +9 -1
- package/dist/types/actions/index.d.ts.map +1 -1
- package/dist/types/actions/patchContractCalls.d.ts +11 -0
- package/dist/types/actions/patchContractCalls.d.ts.map +1 -0
- package/dist/types/client/createClient.d.ts.map +1 -1
- package/dist/types/client/getClientStorage.d.ts +1 -0
- package/dist/types/client/getClientStorage.d.ts.map +1 -1
- package/dist/types/core/BaseStepExecutionTask.d.ts +6 -0
- package/dist/types/core/BaseStepExecutionTask.d.ts.map +1 -0
- package/dist/types/core/BaseStepExecutor.d.ts +10 -3
- package/dist/types/core/BaseStepExecutor.d.ts.map +1 -1
- package/dist/types/core/StatusManager.d.ts +40 -39
- package/dist/types/core/StatusManager.d.ts.map +1 -1
- package/dist/types/core/TaskPipeline.d.ts +8 -0
- package/dist/types/core/TaskPipeline.d.ts.map +1 -0
- package/dist/types/core/actionMessages.d.ts +5 -0
- package/dist/types/core/actionMessages.d.ts.map +1 -0
- package/dist/types/core/execution.d.ts.map +1 -1
- package/dist/types/core/prepareRestart.d.ts.map +1 -1
- package/dist/types/core/storage.d.ts +18 -0
- package/dist/types/core/storage.d.ts.map +1 -0
- package/dist/types/core/tasks/CheckBalanceTask.d.ts +6 -0
- package/dist/types/core/tasks/CheckBalanceTask.d.ts.map +1 -0
- package/dist/types/core/tasks/PrepareTransactionTask.d.ts +6 -0
- package/dist/types/core/tasks/PrepareTransactionTask.d.ts.map +1 -0
- package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts +9 -0
- package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -0
- package/dist/types/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
- package/dist/types/core/tasks/helpers/checkBalance.d.ts.map +1 -0
- package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts +3 -0
- package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -0
- package/dist/types/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
- package/dist/types/core/tasks/helpers/stepComparison.d.ts.map +1 -0
- package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts +5 -0
- package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -0
- package/dist/types/core/utils.d.ts +9 -11
- package/dist/types/core/utils.d.ts.map +1 -1
- package/dist/types/errors/SDKError.d.ts +3 -3
- package/dist/types/errors/SDKError.d.ts.map +1 -1
- package/dist/types/errors/constants.d.ts +5 -2
- package/dist/types/errors/constants.d.ts.map +1 -1
- package/dist/types/errors/errors.d.ts +10 -0
- package/dist/types/errors/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +20 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/core.d.ts +55 -21
- package/dist/types/types/core.d.ts.map +1 -1
- package/dist/types/types/execution.d.ts +24 -0
- package/dist/types/types/execution.d.ts.map +1 -0
- package/dist/types/utils/convertQuoteToRoute.d.ts +11 -3
- package/dist/types/utils/convertQuoteToRoute.d.ts.map +1 -1
- package/dist/types/utils/formatUnits.d.ts +5 -0
- package/dist/types/utils/formatUnits.d.ts.map +1 -0
- package/dist/types/utils/isHex.d.ts +5 -0
- package/dist/types/utils/isHex.d.ts.map +1 -0
- package/dist/types/utils/parseUnits.d.ts +5 -0
- package/dist/types/utils/parseUnits.d.ts.map +1 -0
- package/dist/types/utils/request.d.ts.map +1 -1
- package/dist/types/utils/waitForResult.d.ts +2 -2
- package/dist/types/utils/waitForResult.d.ts.map +1 -1
- package/dist/types/utils/withDedupe.d.ts +10 -0
- package/dist/types/utils/withDedupe.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/actions/getChains.ts +2 -2
- package/src/actions/getRelayedTransactionStatus.ts +1 -1
- package/src/actions/getStepTransaction.ts +20 -12
- package/src/actions/index.ts +18 -0
- package/src/actions/patchContractCalls.ts +30 -0
- package/src/client/createClient.ts +5 -1
- package/src/client/getClientStorage.ts +25 -7
- package/src/core/BaseStepExecutionTask.ts +9 -0
- package/src/core/BaseStepExecutor.ts +91 -2
- package/src/core/StatusManager.ts +108 -113
- package/src/core/TaskPipeline.ts +28 -0
- package/src/core/{processMessages.ts → actionMessages.ts} +32 -12
- package/src/core/execution.ts +17 -3
- package/src/core/prepareRestart.ts +12 -11
- package/src/core/storage.ts +42 -0
- package/src/core/tasks/CheckBalanceTask.ts +29 -0
- package/src/core/tasks/PrepareTransactionTask.ts +62 -0
- package/src/core/tasks/WaitForTransactionStatusTask.ts +114 -0
- package/src/core/{checkBalance.ts → tasks/helpers/checkBalance.ts} +5 -5
- package/src/core/tasks/helpers/getTransactionRequestData.ts +47 -0
- package/src/core/{stepComparison.ts → tasks/helpers/stepComparison.ts} +5 -5
- package/src/core/{waitForTransactionStatus.ts → tasks/helpers/waitForTransactionStatus.ts} +11 -9
- package/src/core/utils.ts +1 -13
- package/src/errors/SDKError.ts +5 -5
- package/src/errors/constants.ts +3 -0
- package/src/errors/errors.ts +24 -0
- package/src/index.ts +37 -12
- package/src/types/core.ts +69 -29
- package/src/types/execution.ts +32 -0
- package/src/utils/convertQuoteToRoute.ts +117 -8
- package/src/utils/formatUnits.ts +22 -0
- package/src/utils/isHex.ts +14 -0
- package/src/utils/parseUnits.ts +50 -0
- package/src/utils/request.ts +9 -6
- package/src/utils/waitForResult.ts +9 -4
- package/src/utils/withDedupe.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/cjs/core/checkBalance.js.map +0 -1
- package/dist/cjs/core/processMessages.d.ts +0 -4
- package/dist/cjs/core/processMessages.js.map +0 -1
- package/dist/cjs/core/stepComparison.js.map +0 -1
- package/dist/cjs/core/waitForDestinationChainTransaction.d.ts +0 -4
- package/dist/cjs/core/waitForDestinationChainTransaction.js +0 -69
- package/dist/cjs/core/waitForDestinationChainTransaction.js.map +0 -1
- package/dist/cjs/core/waitForTransactionStatus.d.ts +0 -4
- package/dist/cjs/core/waitForTransactionStatus.js.map +0 -1
- package/dist/esm/core/checkBalance.js.map +0 -1
- package/dist/esm/core/processMessages.d.ts +0 -4
- package/dist/esm/core/processMessages.js.map +0 -1
- package/dist/esm/core/stepComparison.js.map +0 -1
- package/dist/esm/core/waitForDestinationChainTransaction.d.ts +0 -4
- package/dist/esm/core/waitForDestinationChainTransaction.js +0 -71
- package/dist/esm/core/waitForDestinationChainTransaction.js.map +0 -1
- package/dist/esm/core/waitForTransactionStatus.d.ts +0 -4
- package/dist/esm/core/waitForTransactionStatus.js.map +0 -1
- package/dist/types/core/checkBalance.d.ts.map +0 -1
- package/dist/types/core/processMessages.d.ts +0 -5
- package/dist/types/core/processMessages.d.ts.map +0 -1
- package/dist/types/core/stepComparison.d.ts.map +0 -1
- package/dist/types/core/waitForDestinationChainTransaction.d.ts +0 -5
- package/dist/types/core/waitForDestinationChainTransaction.d.ts.map +0 -1
- package/dist/types/core/waitForTransactionStatus.d.ts +0 -5
- package/dist/types/core/waitForTransactionStatus.d.ts.map +0 -1
- package/src/core/waitForDestinationChainTransaction.ts +0 -106
|
@@ -1,34 +1,49 @@
|
|
|
1
1
|
import { ChainId, ChainType } from '@lifi/types';
|
|
2
|
-
import {
|
|
2
|
+
import { _getChains } from '../actions/getChains.js';
|
|
3
3
|
import { getRpcUrlsFromChains } from '../core/utils.js';
|
|
4
|
+
// 6 hours in milliseconds
|
|
5
|
+
const chainsRefreshInterval = 1000 * 60 * 60 * 6;
|
|
4
6
|
export const getClientStorage = (config) => {
|
|
5
7
|
let _chains = [];
|
|
6
8
|
let _rpcUrls = { ...config.rpcUrls };
|
|
7
9
|
let _chainsUpdatedAt;
|
|
10
|
+
const updateRpcUrls = () => {
|
|
11
|
+
_rpcUrls = { ...config.rpcUrls };
|
|
12
|
+
_rpcUrls = getRpcUrlsFromChains(_rpcUrls, _chains, [ChainId.SOL]);
|
|
13
|
+
};
|
|
8
14
|
return {
|
|
9
15
|
get needReset() {
|
|
10
16
|
return (!_chainsUpdatedAt ||
|
|
11
|
-
Date.now() - _chainsUpdatedAt >=
|
|
17
|
+
Date.now() - _chainsUpdatedAt >= chainsRefreshInterval);
|
|
18
|
+
},
|
|
19
|
+
setChains(chains) {
|
|
20
|
+
_chains = chains;
|
|
21
|
+
_chainsUpdatedAt = Date.now();
|
|
22
|
+
updateRpcUrls();
|
|
12
23
|
},
|
|
13
24
|
async getChains() {
|
|
25
|
+
// When preloadChains is false, SDK does not auto-fetch chains
|
|
26
|
+
// External consumer is responsible for calling setChains
|
|
27
|
+
if (!config.preloadChains) {
|
|
28
|
+
return _chains;
|
|
29
|
+
}
|
|
14
30
|
if (this.needReset || !_chains.length) {
|
|
15
|
-
_chains = await
|
|
31
|
+
_chains = await _getChains(config, {
|
|
16
32
|
chainTypes: [
|
|
17
33
|
ChainType.EVM,
|
|
18
34
|
ChainType.SVM,
|
|
19
35
|
ChainType.UTXO,
|
|
20
36
|
ChainType.MVM,
|
|
37
|
+
ChainType.TVM,
|
|
21
38
|
],
|
|
22
39
|
});
|
|
23
40
|
_chainsUpdatedAt = Date.now();
|
|
41
|
+
updateRpcUrls();
|
|
24
42
|
}
|
|
25
43
|
return _chains;
|
|
26
44
|
},
|
|
27
45
|
async getRpcUrls() {
|
|
28
|
-
|
|
29
|
-
const chains = await this.getChains();
|
|
30
|
-
_rpcUrls = getRpcUrlsFromChains(_rpcUrls, chains, [ChainId.SOL]);
|
|
31
|
-
}
|
|
46
|
+
await this.getChains(); // _rpcUrls is updated when needed
|
|
32
47
|
return _rpcUrls;
|
|
33
48
|
},
|
|
34
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientStorage.js","sourceRoot":"","sources":["../../../src/client/getClientStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getClientStorage.js","sourceRoot":"","sources":["../../../src/client/getClientStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAA;AACpE,OAAO,E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ACd,SAAS,CAAC,GAAG;wBACb,SAAS,CAAC,GAAG;qBACd;iBACF,CAAC,CAAA;gBACF,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;gBAC7B,aAAa,EAAE,CAAA;YACjB,CAAC;YACD,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,KAAK,CAAC,UAAU;YACd,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA,CAAC,kCAAkC;YACzD,OAAO,QAAQ,CAAA;QACjB,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseStepExecutionTask.js","sourceRoot":"","sources":["../../../src/core/BaseStepExecutionTask.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,qBAAqB;IACzC,SAAS,CAAC,QAA6B;QACrC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CAGF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { ExecuteStepRetryError } from '../errors/errors.js';
|
|
2
|
+
import type { SDKError } from '../errors/SDKError.js';
|
|
3
|
+
import type { ExecuteStepRetryParams, ExecutionAction, ExecutionOptions, InteractionSettings, LiFiStepExtended, SDKClient, StepExecutor, StepExecutorOptions } from '../types/core.js';
|
|
4
|
+
import type { StepExecutorBaseContext, StepExecutorContext } from '../types/execution.js';
|
|
3
5
|
import { StatusManager } from './StatusManager.js';
|
|
6
|
+
import type { TaskPipeline } from './TaskPipeline.js';
|
|
4
7
|
export declare abstract class BaseStepExecutor implements StepExecutor {
|
|
5
8
|
protected executionOptions?: ExecutionOptions;
|
|
6
9
|
protected statusManager: StatusManager;
|
|
@@ -8,5 +11,9 @@ export declare abstract class BaseStepExecutor implements StepExecutor {
|
|
|
8
11
|
allowExecution: boolean;
|
|
9
12
|
constructor(options: StepExecutorOptions);
|
|
10
13
|
setInteraction: (settings?: InteractionSettings) => void;
|
|
11
|
-
|
|
14
|
+
private createBaseContext;
|
|
15
|
+
abstract createContext(baseContext: StepExecutorBaseContext): Promise<StepExecutorContext>;
|
|
16
|
+
abstract createPipeline(context: StepExecutorContext): TaskPipeline;
|
|
17
|
+
abstract parseErrors(error: Error, step?: LiFiStepExtended, action?: ExecutionAction, retryParams?: ExecuteStepRetryParams): Promise<SDKError | ExecuteStepRetryError>;
|
|
18
|
+
executeStep: (client: SDKClient, step: LiFiStepExtended, retryParams?: ExecuteStepRetryParams) => Promise<LiFiStepExtended>;
|
|
12
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ExecuteStepRetryError } from '../errors/errors.js';
|
|
1
2
|
import { StatusManager } from './StatusManager.js';
|
|
2
3
|
// Please be careful when changing the defaults as it may break the behavior (e.g., background execution)
|
|
3
4
|
const defaultInteractionSettings = {
|
|
@@ -23,5 +24,57 @@ export class BaseStepExecutor {
|
|
|
23
24
|
this.statusManager.allowUpdates(interactionSettings.allowUpdates);
|
|
24
25
|
this.allowExecution = interactionSettings.allowExecution;
|
|
25
26
|
};
|
|
27
|
+
createBaseContext = async (client, step, retryParams) => {
|
|
28
|
+
const fromChain = await client.getChainById(step.action.fromChainId);
|
|
29
|
+
const toChain = await client.getChainById(step.action.toChainId);
|
|
30
|
+
const isBridgeExecution = fromChain.id !== toChain.id;
|
|
31
|
+
return {
|
|
32
|
+
client,
|
|
33
|
+
step,
|
|
34
|
+
fromChain,
|
|
35
|
+
toChain,
|
|
36
|
+
isBridgeExecution,
|
|
37
|
+
retryParams,
|
|
38
|
+
statusManager: this.statusManager,
|
|
39
|
+
executionOptions: this.executionOptions,
|
|
40
|
+
allowUserInteraction: this.allowUserInteraction,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
executeStep = async (client, step, retryParams) => {
|
|
44
|
+
try {
|
|
45
|
+
step.execution = this.statusManager.initializeExecution(step);
|
|
46
|
+
const baseContext = await this.createBaseContext(client, step, retryParams);
|
|
47
|
+
const context = await this.createContext(baseContext);
|
|
48
|
+
const pipeline = this.createPipeline(context);
|
|
49
|
+
await pipeline.run(context);
|
|
50
|
+
return step;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const action = step.execution?.lastActionType
|
|
54
|
+
? this.statusManager.findAction(step, step.execution.lastActionType)
|
|
55
|
+
: undefined;
|
|
56
|
+
const parsed = await this.parseErrors(error, step, action, retryParams);
|
|
57
|
+
if (!(parsed instanceof ExecuteStepRetryError)) {
|
|
58
|
+
if (action) {
|
|
59
|
+
this.statusManager.updateAction(step, action.type, 'FAILED', {
|
|
60
|
+
error: {
|
|
61
|
+
message: parsed.cause?.message,
|
|
62
|
+
code: parsed.code,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.statusManager.updateExecution(step, {
|
|
68
|
+
status: 'FAILED',
|
|
69
|
+
error: {
|
|
70
|
+
message: parsed.cause?.message,
|
|
71
|
+
code: parsed.code,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
throw parsed;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
26
79
|
}
|
|
27
80
|
//# sourceMappingURL=BaseStepExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStepExecutor.js","sourceRoot":"","sources":["../../../src/core/BaseStepExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseStepExecutor.js","sourceRoot":"","sources":["../../../src/core/BaseStepExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAgB3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,yGAAyG;AACzG,MAAM,0BAA0B,GAAG;IACjC,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;CACrB,CAAA;A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,QAAQ;wBAChB,KAAK,EAAE;4BACL,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO;4BAC9B,IAAI,EAAE,MAAM,CAAC,IAAI;yBAClB;qBACF,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;YACD,MAAM,MAAM,CAAA;QACd,CAAC;IACH,CAAC,CAAA;CACF"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { ChainId, LiFiStep } from '@lifi/types';
|
|
2
|
-
import type { Execution,
|
|
3
|
-
type
|
|
2
|
+
import type { Execution, ExecutionAction, ExecutionActionStatus, ExecutionActionType, LiFiStepExtended } from '../types/core.js';
|
|
3
|
+
type ActionProps = {
|
|
4
4
|
step: LiFiStepExtended;
|
|
5
|
-
type:
|
|
6
|
-
chainId
|
|
7
|
-
status
|
|
8
|
-
startedAt?: number;
|
|
5
|
+
type: ExecutionActionType;
|
|
6
|
+
chainId: ChainId;
|
|
7
|
+
status: ExecutionActionStatus;
|
|
9
8
|
};
|
|
10
9
|
/**
|
|
11
|
-
* Manages status updates of a route and provides various functions for tracking
|
|
12
|
-
* @param {string} routeId The route dd this StatusManger belongs to.
|
|
13
|
-
* @returns {StatusManager} An instance of StatusManager.
|
|
10
|
+
* Manages status updates of a route and provides various functions for tracking actions.
|
|
14
11
|
*/
|
|
15
12
|
export declare class StatusManager {
|
|
16
13
|
private readonly routeId;
|
|
@@ -18,50 +15,54 @@ export declare class StatusManager {
|
|
|
18
15
|
constructor(routeId: string);
|
|
19
16
|
/**
|
|
20
17
|
* Initializes the execution object of a Step.
|
|
21
|
-
* @param step
|
|
22
|
-
* @returns The initialized execution object for this step
|
|
18
|
+
* @param step The current step in execution
|
|
19
|
+
* @returns The initialized execution object for this step
|
|
23
20
|
*/
|
|
24
|
-
|
|
21
|
+
initializeExecution: (step: LiFiStepExtended) => Execution;
|
|
25
22
|
/**
|
|
26
23
|
* Updates the execution object of a Step.
|
|
27
|
-
* @param step
|
|
28
|
-
* @param
|
|
29
|
-
* @param execution Optional. Information about received tokens
|
|
24
|
+
* @param step The current step in execution
|
|
25
|
+
* @param execution Partial execution data to merge
|
|
30
26
|
* @returns The step with the updated execution object
|
|
31
27
|
*/
|
|
32
|
-
updateExecution(step: LiFiStepExtended,
|
|
28
|
+
updateExecution(step: LiFiStepExtended, execution: Partial<Execution>): LiFiStep;
|
|
33
29
|
/**
|
|
34
|
-
* Finds
|
|
30
|
+
* Finds an action of the specified type in the step's execution
|
|
35
31
|
* @param step The step to search in
|
|
36
|
-
* @param type The
|
|
37
|
-
* @
|
|
38
|
-
* @returns The found process or undefined if not found
|
|
32
|
+
* @param type The action type to find
|
|
33
|
+
* @returns The found action or undefined if not found
|
|
39
34
|
*/
|
|
40
|
-
|
|
35
|
+
findAction(step: LiFiStepExtended, type: ExecutionActionType): ExecutionAction | undefined;
|
|
41
36
|
/**
|
|
42
|
-
* Create and push a new
|
|
43
|
-
*
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @
|
|
37
|
+
* Create and push a new action into the execution.
|
|
38
|
+
* Caller is responsible for ensuring an action of this type does not already exist.
|
|
39
|
+
* @param step The step that should contain the new action.
|
|
40
|
+
* @param type Type of the action.
|
|
41
|
+
* @param chainId Chain Id of the action.
|
|
42
|
+
* @param status The initial status for the new action.
|
|
43
|
+
* @returns The created action.
|
|
48
44
|
*/
|
|
49
|
-
|
|
45
|
+
createAction: ({ step, type, chainId, status, }: ActionProps) => ExecutionAction;
|
|
50
46
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @param step The step
|
|
53
|
-
* @param type
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @returns The
|
|
47
|
+
* Find an existing action by type and update it, or create a new one if none exists.
|
|
48
|
+
* @param step The step that should contain the action.
|
|
49
|
+
* @param type Type of the action. Used to identify already existing actions.
|
|
50
|
+
* @param chainId Chain Id of the action (used when creating).
|
|
51
|
+
* @param status The status to set on the found or newly created action.
|
|
52
|
+
* @returns The updated or newly created action.
|
|
57
53
|
*/
|
|
58
|
-
|
|
54
|
+
initializeAction: ({ step, type, chainId, status, }: ActionProps) => ExecutionAction;
|
|
59
55
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param step The step where the
|
|
62
|
-
* @param type The
|
|
56
|
+
* Update an action object.
|
|
57
|
+
* @param step The step where the action should be updated
|
|
58
|
+
* @param type The action type to update
|
|
59
|
+
* @param status The status the action gets.
|
|
60
|
+
* @param [params] Additional parameters to append to the action.
|
|
61
|
+
* @returns The updated action
|
|
63
62
|
*/
|
|
64
|
-
|
|
63
|
+
updateAction: (step: LiFiStepExtended, type: ExecutionActionType, status: ExecutionActionStatus, params?: Partial<ExecutionAction & {
|
|
64
|
+
signedAt?: number;
|
|
65
|
+
}>) => ExecutionAction;
|
|
65
66
|
updateStepInRoute: (step: LiFiStep) => LiFiStep;
|
|
66
67
|
allowUpdates(value: boolean): void;
|
|
67
68
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { getActionMessage } from './actionMessages.js';
|
|
1
2
|
import { executionState } from './executionState.js';
|
|
2
|
-
import { getProcessMessage } from './processMessages.js';
|
|
3
3
|
/**
|
|
4
|
-
* Manages status updates of a route and provides various functions for tracking
|
|
5
|
-
* @param {string} routeId The route dd this StatusManger belongs to.
|
|
6
|
-
* @returns {StatusManager} An instance of StatusManager.
|
|
4
|
+
* Manages status updates of a route and provides various functions for tracking actions.
|
|
7
5
|
*/
|
|
8
6
|
export class StatusManager {
|
|
9
7
|
routeId;
|
|
@@ -13,15 +11,15 @@ export class StatusManager {
|
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
13
|
* Initializes the execution object of a Step.
|
|
16
|
-
* @param step
|
|
17
|
-
* @returns The initialized execution object for this step
|
|
14
|
+
* @param step The current step in execution
|
|
15
|
+
* @returns The initialized execution object for this step
|
|
18
16
|
*/
|
|
19
|
-
|
|
17
|
+
initializeExecution = (step) => {
|
|
20
18
|
if (!step.execution) {
|
|
21
19
|
step.execution = {
|
|
22
|
-
status: 'PENDING',
|
|
23
|
-
process: [],
|
|
24
20
|
startedAt: Date.now(),
|
|
21
|
+
status: 'PENDING',
|
|
22
|
+
actions: [],
|
|
25
23
|
};
|
|
26
24
|
this.updateStepInRoute(step);
|
|
27
25
|
}
|
|
@@ -29,144 +27,140 @@ export class StatusManager {
|
|
|
29
27
|
if (step.execution.status === 'FAILED') {
|
|
30
28
|
step.execution.startedAt = Date.now();
|
|
31
29
|
step.execution.status = 'PENDING';
|
|
30
|
+
step.execution.signedAt = undefined;
|
|
31
|
+
step.execution.lastActionType = undefined;
|
|
32
|
+
step.execution.error = undefined;
|
|
32
33
|
this.updateStepInRoute(step);
|
|
33
34
|
}
|
|
34
35
|
return step.execution;
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* Updates the execution object of a Step.
|
|
38
|
-
* @param step
|
|
39
|
-
* @param
|
|
40
|
-
* @param execution Optional. Information about received tokens
|
|
39
|
+
* @param step The current step in execution
|
|
40
|
+
* @param execution Partial execution data to merge
|
|
41
41
|
* @returns The step with the updated execution object
|
|
42
42
|
*/
|
|
43
|
-
updateExecution(step,
|
|
43
|
+
updateExecution(step, execution) {
|
|
44
44
|
if (!step.execution) {
|
|
45
45
|
throw Error("Can't update empty execution.");
|
|
46
46
|
}
|
|
47
|
-
step.execution
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (execution) {
|
|
52
|
-
step.execution = {
|
|
53
|
-
...step.execution,
|
|
54
|
-
...execution,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
47
|
+
step.execution = {
|
|
48
|
+
...step.execution,
|
|
49
|
+
...execution,
|
|
50
|
+
};
|
|
57
51
|
this.updateStepInRoute(step);
|
|
58
52
|
return step;
|
|
59
53
|
}
|
|
60
54
|
/**
|
|
61
|
-
* Finds
|
|
55
|
+
* Finds an action of the specified type in the step's execution
|
|
62
56
|
* @param step The step to search in
|
|
63
|
-
* @param type The
|
|
64
|
-
* @
|
|
65
|
-
* @returns The found process or undefined if not found
|
|
57
|
+
* @param type The action type to find
|
|
58
|
+
* @returns The found action or undefined if not found
|
|
66
59
|
*/
|
|
67
|
-
|
|
68
|
-
if (!step.execution?.
|
|
60
|
+
findAction(step, type) {
|
|
61
|
+
if (!step.execution?.actions) {
|
|
69
62
|
throw new Error("Execution hasn't been initialized.");
|
|
70
63
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
process.status = status;
|
|
74
|
-
this.updateStepInRoute(step);
|
|
75
|
-
}
|
|
76
|
-
return process;
|
|
64
|
+
const action = step.execution.actions.find((p) => p.type === type);
|
|
65
|
+
return action;
|
|
77
66
|
}
|
|
78
67
|
/**
|
|
79
|
-
* Create and push a new
|
|
80
|
-
*
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
84
|
-
* @
|
|
68
|
+
* Create and push a new action into the execution.
|
|
69
|
+
* Caller is responsible for ensuring an action of this type does not already exist.
|
|
70
|
+
* @param step The step that should contain the new action.
|
|
71
|
+
* @param type Type of the action.
|
|
72
|
+
* @param chainId Chain Id of the action.
|
|
73
|
+
* @param status The initial status for the new action.
|
|
74
|
+
* @returns The created action.
|
|
85
75
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return process;
|
|
76
|
+
createAction = ({ step, type, chainId, status, }) => {
|
|
77
|
+
if (!step.execution) {
|
|
78
|
+
throw new Error("Execution hasn't been initialized.");
|
|
90
79
|
}
|
|
91
|
-
const
|
|
92
|
-
type
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
chainId: chainId,
|
|
80
|
+
const newAction = {
|
|
81
|
+
type,
|
|
82
|
+
message: getActionMessage(type, status),
|
|
83
|
+
status,
|
|
84
|
+
chainId,
|
|
97
85
|
};
|
|
98
|
-
step.execution.
|
|
86
|
+
step.execution.actions.push(newAction);
|
|
87
|
+
step.execution.lastActionType = type;
|
|
99
88
|
this.updateStepInRoute(step);
|
|
100
|
-
return
|
|
89
|
+
return newAction;
|
|
101
90
|
};
|
|
102
91
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @param step The step
|
|
105
|
-
* @param type
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @returns The
|
|
92
|
+
* Find an existing action by type and update it, or create a new one if none exists.
|
|
93
|
+
* @param step The step that should contain the action.
|
|
94
|
+
* @param type Type of the action. Used to identify already existing actions.
|
|
95
|
+
* @param chainId Chain Id of the action (used when creating).
|
|
96
|
+
* @param status The status to set on the found or newly created action.
|
|
97
|
+
* @returns The updated or newly created action.
|
|
109
98
|
*/
|
|
110
|
-
|
|
99
|
+
initializeAction = ({ step, type, chainId, status, }) => {
|
|
100
|
+
const action = this.findAction(step, type);
|
|
101
|
+
if (action) {
|
|
102
|
+
return this.updateAction(step, type, status, {
|
|
103
|
+
error: undefined,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return this.createAction({ step, type, chainId, status });
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Update an action object.
|
|
110
|
+
* @param step The step where the action should be updated
|
|
111
|
+
* @param type The action type to update
|
|
112
|
+
* @param status The status the action gets.
|
|
113
|
+
* @param [params] Additional parameters to append to the action.
|
|
114
|
+
* @returns The updated action
|
|
115
|
+
*/
|
|
116
|
+
updateAction = (step, type, status, params) => {
|
|
111
117
|
if (!step.execution) {
|
|
112
118
|
throw new Error("Can't update an empty step execution.");
|
|
113
119
|
}
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
throw new Error("Can't find
|
|
120
|
+
const currentAction = this.findAction(step, type);
|
|
121
|
+
if (!currentAction) {
|
|
122
|
+
throw new Error("Can't find an action for the given type.");
|
|
117
123
|
}
|
|
118
124
|
switch (status) {
|
|
119
125
|
case 'CANCELLED':
|
|
120
|
-
currentProcess.doneAt = Date.now();
|
|
121
126
|
break;
|
|
122
127
|
case 'FAILED':
|
|
123
|
-
currentProcess.doneAt = Date.now();
|
|
124
128
|
step.execution.status = 'FAILED';
|
|
129
|
+
if (params?.error) {
|
|
130
|
+
step.execution.error = params.error;
|
|
131
|
+
}
|
|
125
132
|
break;
|
|
126
133
|
case 'DONE':
|
|
127
|
-
currentProcess.doneAt = Date.now();
|
|
128
134
|
break;
|
|
129
135
|
case 'PENDING':
|
|
130
136
|
step.execution.status = 'PENDING';
|
|
131
|
-
|
|
137
|
+
if (params?.signedAt) {
|
|
138
|
+
step.execution.signedAt = params.signedAt;
|
|
139
|
+
}
|
|
132
140
|
break;
|
|
133
141
|
case 'RESET_REQUIRED':
|
|
134
142
|
case 'MESSAGE_REQUIRED':
|
|
135
143
|
case 'ACTION_REQUIRED':
|
|
136
144
|
step.execution.status = 'ACTION_REQUIRED';
|
|
137
|
-
currentProcess.actionRequiredAt = Date.now();
|
|
138
145
|
break;
|
|
139
146
|
default:
|
|
140
147
|
break;
|
|
141
148
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
149
|
+
step.execution.lastActionType = type;
|
|
150
|
+
currentAction.status = status;
|
|
151
|
+
currentAction.message = getActionMessage(type, status);
|
|
152
|
+
// set extra parameters or overwrite the standard params set in the switch statement
|
|
145
153
|
if (params) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
154
|
+
const { signedAt: _signedAt, ...rest } = params;
|
|
155
|
+
Object.assign(currentAction, rest);
|
|
149
156
|
}
|
|
150
|
-
// Sort
|
|
151
|
-
step.execution.
|
|
152
|
-
...step.execution.
|
|
153
|
-
...step.execution.
|
|
157
|
+
// Sort actions, the ones with DONE status go first
|
|
158
|
+
step.execution.actions = [
|
|
159
|
+
...step.execution.actions.filter((action) => action.status === 'DONE'),
|
|
160
|
+
...step.execution.actions.filter((action) => action.status !== 'DONE'),
|
|
154
161
|
];
|
|
155
162
|
this.updateStepInRoute(step); // updates the step in the route
|
|
156
|
-
return
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Remove a process from the execution
|
|
160
|
-
* @param step The step where the process should be removed from
|
|
161
|
-
* @param type The process type to remove
|
|
162
|
-
*/
|
|
163
|
-
removeProcess = (step, type) => {
|
|
164
|
-
if (!step.execution) {
|
|
165
|
-
throw new Error("Execution hasn't been initialized.");
|
|
166
|
-
}
|
|
167
|
-
const index = step.execution.process.findIndex((p) => p.type === type);
|
|
168
|
-
step.execution.process.splice(index, 1);
|
|
169
|
-
this.updateStepInRoute(step);
|
|
163
|
+
return currentAction;
|
|
170
164
|
};
|
|
171
165
|
updateStepInRoute = (step) => {
|
|
172
166
|
if (!this.shouldUpdate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusManager.js","sourceRoot":"","sources":["../../../src/core/StatusManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StatusManager.js","sourceRoot":"","sources":["../../../src/core/StatusManager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AASpD;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,OAAO,CAAQ;IACxB,YAAY,GAAG,IAAI,CAAA;IAE3B,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACH,mBAAmB,GAAG,CAAC,IAAsB,EAAa,EAAE;QAC1D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG;gBACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,EAAE;aACZ,CAAA;YACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;QAED,sDAAsD;QACtD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,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F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StepExecutorContext, TaskResult } from '../types/execution.js';
|
|
2
|
+
import type { BaseStepExecutionTask } from './BaseStepExecutionTask.js';
|
|
3
|
+
export declare class TaskPipeline {
|
|
4
|
+
private readonly tasks;
|
|
5
|
+
constructor(tasks: BaseStepExecutionTask[]);
|
|
6
|
+
run(context: StepExecutorContext): Promise<TaskResult>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class TaskPipeline {
|
|
2
|
+
tasks;
|
|
3
|
+
constructor(tasks) {
|
|
4
|
+
this.tasks = tasks;
|
|
5
|
+
}
|
|
6
|
+
async run(context) {
|
|
7
|
+
for (const task of this.tasks) {
|
|
8
|
+
const shouldRun = await task.shouldRun(context);
|
|
9
|
+
if (!shouldRun) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const result = await task.run(context);
|
|
13
|
+
if (result.status === 'PAUSED') {
|
|
14
|
+
return { status: 'PAUSED' };
|
|
15
|
+
}
|
|
16
|
+
if (result.context && typeof result.context === 'object') {
|
|
17
|
+
Object.assign(context, result.context);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return { status: 'COMPLETED' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=TaskPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskPipeline.js","sourceRoot":"","sources":["../../../src/core/TaskPipeline.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,YAAY;IACN,KAAK,CAAyB;IAE/C,YAAY,KAA8B;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAA4B;QACpC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;YAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,SAAQ;YACV,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACtC,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;YAC7B,CAAC;YACD,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACzD,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StatusMessage, Substatus } from '@lifi/types';
|
|
2
|
+
import type { ExecutionActionStatus, ExecutionActionType } from '../types/core.js';
|
|
3
|
+
export declare function getActionMessage(type: ExecutionActionType, status: ExecutionActionStatus): string | undefined;
|
|
4
|
+
export declare function getSubstatusMessage(status: StatusMessage, substatus?: Substatus): string | undefined;
|