@lifi/sdk 4.0.1-alpha.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1219 -0
- package/README.md +88 -5
- package/dist/cjs/actions/getChains.d.ts +17 -4
- package/dist/cjs/actions/getChains.js +22 -19
- package/dist/cjs/actions/getChains.js.map +1 -1
- package/dist/cjs/actions/getConnections.d.ts +15 -3
- package/dist/cjs/actions/getConnections.js +30 -35
- package/dist/cjs/actions/getConnections.js.map +1 -1
- package/dist/cjs/actions/getContractCallsQuote.d.ts +16 -3
- package/dist/cjs/actions/getContractCallsQuote.js +41 -42
- package/dist/cjs/actions/getContractCallsQuote.js.map +1 -1
- package/dist/cjs/actions/getGasRecommendation.d.ts +16 -3
- package/dist/cjs/actions/getGasRecommendation.js +20 -19
- package/dist/cjs/actions/getGasRecommendation.js.map +1 -1
- package/dist/cjs/actions/getNameServiceAddress.d.ts +15 -3
- package/dist/cjs/actions/getNameServiceAddress.js +25 -27
- package/dist/cjs/actions/getNameServiceAddress.js.map +1 -1
- package/dist/cjs/actions/getQuote.d.ts +18 -5
- package/dist/cjs/actions/getQuote.js +32 -45
- package/dist/cjs/actions/getQuote.js.map +1 -1
- package/dist/cjs/actions/getRelayedTransactionStatus.d.ts +16 -3
- package/dist/cjs/actions/getRelayedTransactionStatus.js +26 -26
- package/dist/cjs/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/cjs/actions/getRelayerQuote.d.ts +17 -4
- package/dist/cjs/actions/getRelayerQuote.js +40 -44
- package/dist/cjs/actions/getRelayerQuote.js.map +1 -1
- package/dist/cjs/actions/getRoutes.d.ts +16 -3
- package/dist/cjs/actions/getRoutes.js +28 -23
- package/dist/cjs/actions/getRoutes.js.map +1 -1
- package/dist/cjs/actions/getStatus.d.ts +17 -4
- package/dist/cjs/actions/getStatus.js +18 -14
- package/dist/cjs/actions/getStatus.js.map +1 -1
- package/dist/cjs/actions/getStepTransaction.d.ts +16 -3
- package/dist/cjs/actions/getStepTransaction.js +32 -24
- package/dist/cjs/actions/getStepTransaction.js.map +1 -1
- package/dist/cjs/actions/getToken.d.ts +17 -3
- package/dist/cjs/actions/getToken.js +22 -18
- package/dist/cjs/actions/getToken.js.map +1 -1
- package/dist/cjs/actions/getTokenBalance.d.ts +17 -3
- package/dist/cjs/actions/getTokenBalance.js +16 -6
- package/dist/cjs/actions/getTokenBalance.js.map +1 -1
- package/dist/cjs/actions/getTokenBalances.d.ts +17 -3
- package/dist/cjs/actions/getTokenBalances.js +12 -13
- package/dist/cjs/actions/getTokenBalances.js.map +1 -1
- package/dist/cjs/actions/getTokenBalancesByChain.d.ts +19 -5
- package/dist/cjs/actions/getTokenBalancesByChain.js +22 -37
- package/dist/cjs/actions/getTokenBalancesByChain.js.map +1 -1
- package/dist/cjs/actions/getTokens.d.ts +18 -6
- package/dist/cjs/actions/getTokens.js +14 -18
- package/dist/cjs/actions/getTokens.js.map +1 -1
- package/dist/cjs/actions/getTools.d.ts +15 -3
- package/dist/cjs/actions/getTools.js +17 -14
- package/dist/cjs/actions/getTools.js.map +1 -1
- package/dist/cjs/actions/getTransactionHistory.d.ts +26 -3
- package/dist/cjs/actions/getTransactionHistory.js +27 -21
- package/dist/cjs/actions/getTransactionHistory.js.map +1 -1
- package/dist/cjs/actions/getWalletBalances.d.ts +16 -3
- package/dist/cjs/actions/getWalletBalances.js +16 -12
- package/dist/cjs/actions/getWalletBalances.js.map +1 -1
- package/dist/cjs/actions/index.d.ts +171 -39
- package/dist/cjs/actions/index.js +49 -47
- package/dist/cjs/actions/index.js.map +1 -1
- package/dist/cjs/actions/patchContractCalls.d.ts +14 -9
- package/dist/cjs/actions/patchContractCalls.js +11 -12
- package/dist/cjs/actions/patchContractCalls.js.map +1 -1
- package/dist/cjs/actions/relayTransaction.d.ts +16 -3
- package/dist/cjs/actions/relayTransaction.js +30 -34
- package/dist/cjs/actions/relayTransaction.js.map +1 -1
- package/dist/cjs/client/createClient.d.ts +7 -2
- package/dist/cjs/client/createClient.js +67 -75
- package/dist/cjs/client/createClient.js.map +1 -1
- package/dist/cjs/client/getClientStorage.d.ts +14 -8
- package/dist/cjs/client/getClientStorage.js +44 -47
- package/dist/cjs/client/getClientStorage.js.map +1 -1
- package/dist/cjs/core/BaseStepExecutionTask.d.ts +10 -0
- package/dist/cjs/core/BaseStepExecutionTask.js +11 -0
- package/dist/cjs/core/BaseStepExecutionTask.js.map +1 -0
- package/dist/cjs/core/BaseStepExecutor.d.ts +23 -11
- package/dist/cjs/core/BaseStepExecutor.js +67 -26
- package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
- package/dist/cjs/core/StatusManager.d.ts +81 -20
- package/dist/cjs/core/StatusManager.js +158 -137
- package/dist/cjs/core/StatusManager.js.map +1 -1
- package/dist/cjs/core/TaskPipeline.d.ts +12 -0
- package/dist/cjs/core/TaskPipeline.js +21 -0
- package/dist/cjs/core/TaskPipeline.js.map +1 -0
- package/dist/cjs/core/actionMessages.d.ts +9 -4
- package/dist/cjs/core/actionMessages.js +72 -58
- package/dist/cjs/core/actionMessages.js.map +1 -1
- package/dist/cjs/core/execution.d.ts +48 -8
- package/dist/cjs/core/execution.js +131 -121
- package/dist/cjs/core/execution.js.map +1 -1
- package/dist/cjs/core/executionState.d.ts +17 -13
- package/dist/cjs/core/executionState.js +27 -27
- package/dist/cjs/core/executionState.js.map +1 -1
- package/dist/cjs/core/prepareRestart.d.ts +7 -2
- package/dist/cjs/core/prepareRestart.js +17 -19
- package/dist/cjs/core/prepareRestart.js.map +1 -1
- package/dist/cjs/core/storage.d.ts +21 -0
- package/dist/cjs/core/storage.js +35 -0
- package/dist/cjs/core/storage.js.map +1 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +19 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.js +35 -0
- package/dist/cjs/core/tasks/CheckBalanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.js +30 -0
- package/dist/cjs/core/tasks/PrepareTransactionTask.js.map +1 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +13 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js +63 -0
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/checkBalance.d.ts +30 -0
- package/dist/cjs/core/tasks/helpers/checkBalance.js +108 -0
- package/dist/cjs/core/tasks/helpers/checkBalance.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js +25 -0
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/stepComparison.d.ts +21 -0
- package/dist/cjs/core/tasks/helpers/stepComparison.js +32 -0
- package/dist/cjs/core/tasks/helpers/stepComparison.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +9 -0
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js +48 -0
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
- package/dist/cjs/core/utils.d.ts +17 -86
- package/dist/cjs/core/utils.js +37 -38
- package/dist/cjs/core/utils.js.map +1 -1
- package/dist/cjs/errors/SDKError.d.ts +16 -11
- package/dist/cjs/errors/SDKError.js +22 -21
- package/dist/cjs/errors/SDKError.js.map +1 -1
- package/dist/cjs/errors/baseError.d.ts +10 -5
- package/dist/cjs/errors/baseError.js +17 -18
- package/dist/cjs/errors/baseError.js.map +1 -1
- package/dist/cjs/errors/constants.d.ts +52 -47
- package/dist/cjs/errors/constants.js +60 -55
- package/dist/cjs/errors/constants.js.map +1 -1
- package/dist/cjs/errors/errors.d.ts +31 -16
- package/dist/cjs/errors/errors.js +57 -43
- package/dist/cjs/errors/errors.js.map +1 -1
- package/dist/cjs/errors/httpError.d.ts +21 -17
- package/dist/cjs/errors/httpError.js +62 -65
- package/dist/cjs/errors/httpError.js.map +1 -1
- package/dist/cjs/errors/utils/baseErrorRootCause.d.ts +8 -3
- package/dist/cjs/errors/utils/baseErrorRootCause.js +12 -15
- package/dist/cjs/errors/utils/baseErrorRootCause.js.map +1 -1
- package/dist/cjs/errors/utils/rootCause.d.ts +5 -1
- package/dist/cjs/errors/utils/rootCause.js +7 -8
- package/dist/cjs/errors/utils/rootCause.js.map +1 -1
- package/dist/cjs/index.d.ts +55 -46
- package/dist/cjs/index.js +130 -119
- package/dist/cjs/types/actions.d.ts +12 -7
- package/dist/cjs/types/actions.js +0 -3
- package/dist/cjs/types/core.d.ts +181 -164
- package/dist/cjs/types/core.js +0 -3
- package/dist/cjs/types/execution.d.ts +28 -0
- package/dist/cjs/types/execution.js +0 -0
- package/dist/cjs/types/request.d.ts +6 -2
- package/dist/cjs/types/request.js +0 -3
- package/dist/cjs/utils/checkPackageUpdates.d.ts +5 -1
- package/dist/cjs/utils/checkPackageUpdates.js +11 -16
- package/dist/cjs/utils/checkPackageUpdates.js.map +1 -1
- package/dist/cjs/utils/convertQuoteToRoute.d.ts +20 -5
- package/dist/cjs/utils/convertQuoteToRoute.js +72 -85
- package/dist/cjs/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/cjs/utils/decode.d.ts +5 -1
- package/dist/cjs/utils/decode.js +5 -10
- package/dist/cjs/utils/decode.js.map +1 -1
- package/dist/cjs/utils/fetchTxErrorDetails.d.ts +5 -1
- package/dist/cjs/utils/fetchTxErrorDetails.js +9 -9
- package/dist/cjs/utils/fetchTxErrorDetails.js.map +1 -1
- package/dist/cjs/utils/formatUnits.d.ts +8 -1
- package/dist/cjs/utils/formatUnits.js +15 -15
- package/dist/cjs/utils/formatUnits.js.map +1 -1
- package/dist/cjs/utils/getTransactionMessage.d.ts +8 -3
- package/dist/cjs/utils/getTransactionMessage.js +8 -10
- package/dist/cjs/utils/getTransactionMessage.js.map +1 -1
- package/dist/cjs/utils/isHex.d.ts +9 -3
- package/dist/cjs/utils/isHex.js +8 -10
- package/dist/cjs/utils/isHex.js.map +1 -1
- package/dist/cjs/utils/isRoutesRequest.d.ts +7 -2
- package/dist/cjs/utils/isRoutesRequest.js +7 -14
- package/dist/cjs/utils/isRoutesRequest.js.map +1 -1
- package/dist/cjs/utils/isStep.d.ts +7 -2
- package/dist/cjs/utils/isStep.js +15 -25
- package/dist/cjs/utils/isStep.js.map +1 -1
- package/dist/cjs/utils/isToken.d.ts +7 -2
- package/dist/cjs/utils/isToken.js +6 -7
- package/dist/cjs/utils/isToken.js.map +1 -1
- package/dist/cjs/utils/parseUnits.d.ts +8 -1
- package/dist/cjs/utils/parseUnits.js +32 -41
- package/dist/cjs/utils/parseUnits.js.map +1 -1
- package/dist/cjs/utils/request.d.ts +10 -5
- package/dist/cjs/utils/request.js +53 -69
- package/dist/cjs/utils/request.js.map +1 -1
- package/dist/cjs/utils/sleep.d.ts +5 -1
- package/dist/cjs/utils/sleep.js +8 -6
- package/dist/cjs/utils/sleep.js.map +1 -1
- package/dist/cjs/utils/waitForResult.d.ts +14 -1
- package/dist/cjs/utils/waitForResult.js +33 -26
- package/dist/cjs/utils/waitForResult.js.map +1 -1
- package/dist/cjs/utils/withDedupe.d.ts +21 -4
- package/dist/cjs/utils/withDedupe.js +31 -27
- package/dist/cjs/utils/withDedupe.js.map +1 -1
- package/dist/cjs/utils/withTimeout.d.ts +26 -0
- package/dist/cjs/utils/withTimeout.js +35 -0
- package/dist/cjs/utils/withTimeout.js.map +1 -0
- package/dist/cjs/version.d.ts +6 -2
- package/dist/cjs/version.js +8 -5
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/getChains.d.ts +16 -11
- package/dist/esm/actions/getChains.d.ts.map +1 -0
- package/dist/esm/actions/getChains.js +22 -24
- package/dist/esm/actions/getChains.js.map +1 -1
- package/dist/esm/actions/getConnections.d.ts +14 -9
- package/dist/esm/actions/getConnections.d.ts.map +1 -0
- package/dist/esm/actions/getConnections.js +30 -39
- package/dist/esm/actions/getConnections.js.map +1 -1
- package/dist/esm/actions/getContractCallsQuote.d.ts +15 -10
- package/dist/esm/actions/getContractCallsQuote.d.ts.map +1 -0
- package/dist/esm/actions/getContractCallsQuote.js +41 -51
- package/dist/esm/actions/getContractCallsQuote.js.map +1 -1
- package/dist/esm/actions/getGasRecommendation.d.ts +15 -10
- package/dist/esm/actions/getGasRecommendation.d.ts.map +1 -0
- package/dist/esm/actions/getGasRecommendation.js +20 -24
- package/dist/esm/actions/getGasRecommendation.js.map +1 -1
- package/dist/esm/actions/getNameServiceAddress.d.ts +14 -9
- package/dist/esm/actions/getNameServiceAddress.d.ts.map +1 -0
- package/dist/esm/actions/getNameServiceAddress.js +25 -31
- package/dist/esm/actions/getNameServiceAddress.js.map +1 -1
- package/dist/esm/actions/getQuote.d.ts +17 -12
- package/dist/esm/actions/getQuote.d.ts.map +1 -0
- package/dist/esm/actions/getQuote.js +32 -44
- package/dist/esm/actions/getQuote.js.map +1 -1
- package/dist/esm/actions/getRelayedTransactionStatus.d.ts +15 -10
- package/dist/esm/actions/getRelayedTransactionStatus.d.ts.map +1 -0
- package/dist/esm/actions/getRelayedTransactionStatus.js +26 -32
- package/dist/esm/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/esm/actions/getRelayerQuote.d.ts +16 -11
- package/dist/esm/actions/getRelayerQuote.d.ts.map +1 -0
- package/dist/esm/actions/getRelayerQuote.js +40 -50
- package/dist/esm/actions/getRelayerQuote.js.map +1 -1
- package/dist/esm/actions/getRoutes.d.ts +15 -10
- package/dist/esm/actions/getRoutes.d.ts.map +1 -0
- package/dist/esm/actions/getRoutes.js +28 -29
- package/dist/esm/actions/getRoutes.js.map +1 -1
- package/dist/esm/actions/getStatus.d.ts +16 -11
- package/dist/esm/actions/getStatus.d.ts.map +1 -0
- package/dist/esm/actions/getStatus.js +18 -19
- package/dist/esm/actions/getStatus.js.map +1 -1
- package/dist/esm/actions/getStepTransaction.d.ts +15 -10
- package/dist/esm/actions/getStepTransaction.d.ts.map +1 -0
- package/dist/esm/actions/getStepTransaction.js +32 -31
- package/dist/esm/actions/getStepTransaction.js.map +1 -1
- package/dist/esm/actions/getToken.d.ts +16 -11
- package/dist/esm/actions/getToken.d.ts.map +1 -0
- package/dist/esm/actions/getToken.js +22 -24
- package/dist/esm/actions/getToken.js.map +1 -1
- package/dist/esm/actions/getTokenBalance.d.ts +16 -11
- package/dist/esm/actions/getTokenBalance.d.ts.map +1 -0
- package/dist/esm/actions/getTokenBalance.js +16 -12
- package/dist/esm/actions/getTokenBalance.js.map +1 -1
- package/dist/esm/actions/getTokenBalances.d.ts +16 -11
- package/dist/esm/actions/getTokenBalances.d.ts.map +1 -0
- package/dist/esm/actions/getTokenBalances.js +12 -12
- package/dist/esm/actions/getTokenBalances.js.map +1 -1
- package/dist/esm/actions/getTokenBalancesByChain.d.ts +18 -13
- package/dist/esm/actions/getTokenBalancesByChain.d.ts.map +1 -0
- package/dist/esm/actions/getTokenBalancesByChain.js +22 -37
- package/dist/esm/actions/getTokenBalancesByChain.js.map +1 -1
- package/dist/esm/actions/getTokens.d.ts +17 -12
- package/dist/esm/actions/getTokens.d.ts.map +1 -0
- package/dist/esm/actions/getTokens.js +14 -16
- package/dist/esm/actions/getTokens.js.map +1 -1
- package/dist/esm/actions/getTools.d.ts +14 -9
- package/dist/esm/actions/getTools.d.ts.map +1 -0
- package/dist/esm/actions/getTools.js +17 -18
- package/dist/esm/actions/getTools.js.map +1 -1
- package/dist/esm/actions/getTransactionHistory.d.ts +25 -15
- package/dist/esm/actions/getTransactionHistory.d.ts.map +1 -0
- package/dist/esm/actions/getTransactionHistory.js +27 -31
- package/dist/esm/actions/getTransactionHistory.js.map +1 -1
- package/dist/esm/actions/getWalletBalances.d.ts +15 -10
- package/dist/esm/actions/getWalletBalances.d.ts.map +1 -0
- package/dist/esm/actions/getWalletBalances.js +16 -17
- package/dist/esm/actions/getWalletBalances.js.map +1 -1
- package/dist/esm/actions/index.d.ts +171 -166
- package/dist/esm/actions/index.d.ts.map +1 -0
- package/dist/esm/actions/index.js +49 -45
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/actions/patchContractCalls.d.ts +14 -9
- package/dist/esm/actions/patchContractCalls.d.ts.map +1 -0
- package/dist/esm/actions/patchContractCalls.js +12 -10
- package/dist/esm/actions/patchContractCalls.js.map +1 -1
- package/dist/esm/actions/relayTransaction.d.ts +15 -10
- package/dist/esm/actions/relayTransaction.d.ts.map +1 -0
- package/dist/esm/actions/relayTransaction.js +30 -41
- package/dist/esm/actions/relayTransaction.js.map +1 -1
- package/dist/esm/client/createClient.d.ts +7 -2
- package/dist/esm/client/createClient.d.ts.map +1 -0
- package/dist/esm/client/createClient.js +67 -74
- package/dist/esm/client/createClient.js.map +1 -1
- package/dist/esm/client/getClientStorage.d.ts +14 -8
- package/dist/esm/client/getClientStorage.d.ts.map +1 -0
- package/dist/esm/client/getClientStorage.js +45 -48
- package/dist/esm/client/getClientStorage.js.map +1 -1
- package/dist/esm/core/BaseStepExecutionTask.d.ts +10 -0
- package/dist/esm/core/BaseStepExecutionTask.d.ts.map +1 -0
- package/dist/esm/core/BaseStepExecutionTask.js +10 -0
- package/dist/esm/core/BaseStepExecutionTask.js.map +1 -0
- package/dist/esm/core/BaseStepExecutor.d.ts +23 -11
- package/dist/esm/core/BaseStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/BaseStepExecutor.js +67 -24
- package/dist/esm/core/BaseStepExecutor.js.map +1 -1
- package/dist/esm/core/StatusManager.d.ts +80 -64
- package/dist/esm/core/StatusManager.d.ts.map +1 -0
- package/dist/esm/core/StatusManager.js +157 -181
- package/dist/esm/core/StatusManager.js.map +1 -1
- package/dist/esm/core/TaskPipeline.d.ts +12 -0
- package/dist/esm/core/TaskPipeline.d.ts.map +1 -0
- package/dist/esm/core/TaskPipeline.js +20 -0
- package/dist/esm/core/TaskPipeline.js.map +1 -0
- package/dist/esm/core/actionMessages.d.ts +9 -4
- package/dist/esm/core/actionMessages.d.ts.map +1 -0
- package/dist/esm/core/actionMessages.js +72 -56
- package/dist/esm/core/actionMessages.js.map +1 -1
- package/dist/esm/core/execution.d.ts +42 -37
- package/dist/esm/core/execution.d.ts.map +1 -0
- package/dist/esm/core/execution.js +126 -162
- package/dist/esm/core/execution.js.map +1 -1
- package/dist/esm/core/executionState.d.ts +17 -13
- package/dist/esm/core/executionState.d.ts.map +1 -0
- package/dist/esm/core/executionState.js +26 -24
- package/dist/esm/core/executionState.js.map +1 -1
- package/dist/esm/core/prepareRestart.d.ts +7 -2
- package/dist/esm/core/prepareRestart.d.ts.map +1 -0
- package/dist/esm/core/prepareRestart.js +18 -20
- package/dist/esm/core/prepareRestart.js.map +1 -1
- package/dist/esm/core/storage.d.ts +21 -0
- package/dist/esm/core/storage.d.ts.map +1 -0
- package/dist/esm/core/storage.js +32 -0
- package/dist/esm/core/storage.js.map +1 -0
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts +19 -0
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/CheckBalanceTask.js +34 -0
- package/dist/esm/core/tasks/CheckBalanceTask.js.map +1 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.js +29 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.js.map +1 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +13 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js +61 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts +30 -0
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/checkBalance.js +107 -0
- package/dist/esm/core/tasks/helpers/checkBalance.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js +24 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts +21 -0
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/stepComparison.js +31 -0
- package/dist/esm/core/tasks/helpers/stepComparison.js.map +1 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +9 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js +47 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
- package/dist/esm/core/utils.d.ts +16 -93
- package/dist/esm/core/utils.d.ts.map +1 -0
- package/dist/esm/core/utils.js +36 -45
- package/dist/esm/core/utils.js.map +1 -1
- package/dist/esm/errors/SDKError.d.ts +16 -11
- package/dist/esm/errors/SDKError.d.ts.map +1 -0
- package/dist/esm/errors/SDKError.js +22 -20
- package/dist/esm/errors/SDKError.js.map +1 -1
- package/dist/esm/errors/baseError.d.ts +10 -5
- package/dist/esm/errors/baseError.d.ts.map +1 -0
- package/dist/esm/errors/baseError.js +17 -17
- package/dist/esm/errors/baseError.js.map +1 -1
- package/dist/esm/errors/constants.d.ts +52 -47
- package/dist/esm/errors/constants.d.ts.map +1 -0
- package/dist/esm/errors/constants.js +57 -52
- package/dist/esm/errors/constants.js.map +1 -1
- package/dist/esm/errors/errors.d.ts +31 -16
- package/dist/esm/errors/errors.d.ts.map +1 -0
- package/dist/esm/errors/errors.js +53 -37
- package/dist/esm/errors/errors.js.map +1 -1
- package/dist/esm/errors/httpError.d.ts +21 -17
- package/dist/esm/errors/httpError.d.ts.map +1 -0
- package/dist/esm/errors/httpError.js +62 -62
- package/dist/esm/errors/httpError.js.map +1 -1
- package/dist/esm/errors/utils/baseErrorRootCause.d.ts +8 -3
- package/dist/esm/errors/utils/baseErrorRootCause.d.ts.map +1 -0
- package/dist/esm/errors/utils/baseErrorRootCause.js +13 -13
- package/dist/esm/errors/utils/baseErrorRootCause.js.map +1 -1
- package/dist/esm/errors/utils/rootCause.d.ts +5 -1
- package/dist/esm/errors/utils/rootCause.d.ts.map +1 -0
- package/dist/esm/errors/utils/rootCause.js +8 -6
- package/dist/esm/errors/utils/rootCause.js.map +1 -1
- package/dist/esm/index.d.ts +55 -46
- package/dist/esm/index.js +53 -47
- package/dist/esm/package.json +1 -1
- package/dist/esm/types/actions.d.ts +12 -7
- package/dist/esm/types/actions.d.ts.map +1 -0
- package/dist/esm/types/actions.js +0 -1
- package/dist/esm/types/core.d.ts +181 -167
- package/dist/esm/types/core.d.ts.map +1 -0
- package/dist/esm/types/core.js +0 -1
- package/dist/esm/types/execution.d.ts +28 -0
- package/dist/esm/types/execution.d.ts.map +1 -0
- package/dist/esm/types/execution.js +1 -0
- package/dist/esm/types/request.d.ts +6 -2
- package/dist/esm/types/request.d.ts.map +1 -0
- package/dist/esm/types/request.js +0 -1
- package/dist/esm/utils/checkPackageUpdates.d.ts +5 -1
- package/dist/esm/utils/checkPackageUpdates.d.ts.map +1 -0
- package/dist/esm/utils/checkPackageUpdates.js +12 -15
- package/dist/esm/utils/checkPackageUpdates.js.map +1 -1
- package/dist/esm/utils/convertQuoteToRoute.d.ts +19 -15
- package/dist/esm/utils/convertQuoteToRoute.d.ts.map +1 -0
- package/dist/esm/utils/convertQuoteToRoute.js +72 -92
- package/dist/esm/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/esm/utils/decode.d.ts +5 -1
- package/dist/esm/utils/decode.d.ts.map +1 -0
- package/dist/esm/utils/decode.js +6 -8
- package/dist/esm/utils/decode.js.map +1 -1
- package/dist/esm/utils/fetchTxErrorDetails.d.ts +5 -1
- package/dist/esm/utils/fetchTxErrorDetails.d.ts.map +1 -0
- package/dist/esm/utils/fetchTxErrorDetails.js +10 -7
- package/dist/esm/utils/fetchTxErrorDetails.js.map +1 -1
- package/dist/esm/utils/formatUnits.d.ts +7 -3
- package/dist/esm/utils/formatUnits.d.ts.map +1 -0
- package/dist/esm/utils/formatUnits.js +14 -15
- package/dist/esm/utils/formatUnits.js.map +1 -1
- package/dist/esm/utils/getTransactionMessage.d.ts +8 -3
- package/dist/esm/utils/getTransactionMessage.d.ts.map +1 -0
- package/dist/esm/utils/getTransactionMessage.js +9 -8
- package/dist/esm/utils/getTransactionMessage.js.map +1 -1
- package/dist/esm/utils/isHex.d.ts +9 -3
- package/dist/esm/utils/isHex.d.ts.map +1 -0
- package/dist/esm/utils/isHex.js +8 -8
- package/dist/esm/utils/isHex.js.map +1 -1
- package/dist/esm/utils/isRoutesRequest.d.ts +7 -2
- package/dist/esm/utils/isRoutesRequest.d.ts.map +1 -0
- package/dist/esm/utils/isRoutesRequest.js +8 -12
- package/dist/esm/utils/isRoutesRequest.js.map +1 -1
- package/dist/esm/utils/isStep.d.ts +7 -2
- package/dist/esm/utils/isStep.d.ts.map +1 -0
- package/dist/esm/utils/isStep.js +16 -23
- package/dist/esm/utils/isStep.js.map +1 -1
- package/dist/esm/utils/isToken.d.ts +7 -2
- package/dist/esm/utils/isToken.d.ts.map +1 -0
- package/dist/esm/utils/isToken.js +7 -5
- package/dist/esm/utils/isToken.js.map +1 -1
- package/dist/esm/utils/parseUnits.d.ts +7 -3
- package/dist/esm/utils/parseUnits.d.ts.map +1 -0
- package/dist/esm/utils/parseUnits.js +31 -43
- package/dist/esm/utils/parseUnits.js.map +1 -1
- package/dist/esm/utils/request.d.ts +10 -5
- package/dist/esm/utils/request.d.ts.map +1 -0
- package/dist/esm/utils/request.js +52 -67
- package/dist/esm/utils/request.js.map +1 -1
- package/dist/esm/utils/sleep.d.ts +5 -1
- package/dist/esm/utils/sleep.d.ts.map +1 -0
- package/dist/esm/utils/sleep.js +8 -4
- package/dist/esm/utils/sleep.js.map +1 -1
- package/dist/esm/utils/waitForResult.d.ts +13 -9
- package/dist/esm/utils/waitForResult.d.ts.map +1 -0
- package/dist/esm/utils/waitForResult.js +32 -31
- package/dist/esm/utils/waitForResult.js.map +1 -1
- package/dist/esm/utils/withDedupe.d.ts +20 -4
- package/dist/esm/utils/withDedupe.d.ts.map +1 -0
- package/dist/esm/utils/withDedupe.js +26 -28
- package/dist/esm/utils/withDedupe.js.map +1 -1
- package/dist/esm/utils/withTimeout.d.ts +26 -0
- package/dist/esm/utils/withTimeout.d.ts.map +1 -0
- package/dist/esm/utils/withTimeout.js +34 -0
- package/dist/esm/utils/withTimeout.js.map +1 -0
- package/dist/esm/version.d.ts +6 -2
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +6 -2
- package/dist/esm/version.js.map +1 -1
- package/package.json +6 -5
- package/src/actions/getChains.ts +2 -1
- package/src/actions/getQuote.ts +4 -1
- package/src/actions/getRelayedTransactionStatus.ts +1 -1
- package/src/actions/getRelayerQuote.ts +4 -1
- package/src/actions/getStepTransaction.ts +13 -5
- package/src/actions/getTokens.ts +6 -3
- package/src/actions/getTools.ts +2 -1
- package/src/client/createClient.ts +9 -7
- package/src/client/getClientStorage.ts +9 -1
- package/src/core/BaseStepExecutionTask.ts +9 -0
- package/src/core/BaseStepExecutor.ts +90 -2
- package/src/core/StatusManager.ts +62 -61
- package/src/core/TaskPipeline.ts +28 -0
- package/src/core/actionMessages.ts +20 -3
- package/src/core/execution.ts +17 -3
- package/src/core/prepareRestart.ts +3 -4
- package/src/core/storage.ts +42 -0
- package/src/core/tasks/CheckBalanceTask.ts +46 -0
- package/src/core/tasks/PrepareTransactionTask.ts +62 -0
- package/src/core/tasks/WaitForTransactionStatusTask.ts +114 -0
- package/src/core/tasks/helpers/checkBalance.ts +218 -0
- 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} +10 -7
- package/src/core/utils.ts +1 -1
- package/src/errors/constants.ts +1 -0
- package/src/errors/errors.ts +24 -0
- package/src/errors/httpError.ts +4 -6
- package/src/errors/utils/baseErrorRootCause.ts +2 -2
- package/src/errors/utils/rootCause.ts +1 -1
- package/src/index.ts +28 -4
- package/src/types/core.ts +23 -17
- package/src/types/execution.ts +32 -0
- package/src/utils/checkPackageUpdates.ts +1 -1
- package/src/utils/convertQuoteToRoute.ts +1 -1
- package/src/utils/decode.ts +1 -1
- package/src/utils/fetchTxErrorDetails.ts +7 -2
- package/src/utils/formatUnits.ts +1 -1
- package/src/utils/parseUnits.ts +1 -1
- package/src/utils/waitForResult.ts +9 -4
- package/src/utils/withDedupe.ts +2 -2
- package/src/utils/withTimeout.ts +50 -0
- package/src/version.ts +1 -1
- package/dist/cjs/core/checkBalance.d.ts +0 -3
- package/dist/cjs/core/checkBalance.js +0 -37
- package/dist/cjs/core/checkBalance.js.map +0 -1
- package/dist/cjs/core/stepComparison.d.ts +0 -4
- package/dist/cjs/core/stepComparison.js +0 -25
- 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 -71
- package/dist/cjs/core/waitForDestinationChainTransaction.js.map +0 -1
- package/dist/cjs/core/waitForTransactionStatus.d.ts +0 -4
- package/dist/cjs/core/waitForTransactionStatus.js +0 -54
- package/dist/cjs/core/waitForTransactionStatus.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types/actions.js.map +0 -1
- package/dist/cjs/types/core.js.map +0 -1
- package/dist/cjs/types/request.js.map +0 -1
- package/dist/esm/core/checkBalance.d.ts +0 -3
- package/dist/esm/core/checkBalance.js +0 -34
- package/dist/esm/core/checkBalance.js.map +0 -1
- package/dist/esm/core/stepComparison.d.ts +0 -16
- package/dist/esm/core/stepComparison.js +0 -35
- 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 -74
- package/dist/esm/core/waitForDestinationChainTransaction.js.map +0 -1
- package/dist/esm/core/waitForTransactionStatus.d.ts +0 -4
- package/dist/esm/core/waitForTransactionStatus.js +0 -51
- package/dist/esm/core/waitForTransactionStatus.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/actions.js.map +0 -1
- package/dist/esm/types/core.js.map +0 -1
- package/dist/esm/types/request.js.map +0 -1
- package/dist/types/actions/getChains.d.ts +0 -13
- package/dist/types/actions/getChains.d.ts.map +0 -1
- package/dist/types/actions/getConnections.d.ts +0 -11
- package/dist/types/actions/getConnections.d.ts.map +0 -1
- package/dist/types/actions/getContractCallsQuote.d.ts +0 -12
- package/dist/types/actions/getContractCallsQuote.d.ts.map +0 -1
- package/dist/types/actions/getGasRecommendation.d.ts +0 -12
- package/dist/types/actions/getGasRecommendation.d.ts.map +0 -1
- package/dist/types/actions/getNameServiceAddress.d.ts +0 -11
- package/dist/types/actions/getNameServiceAddress.d.ts.map +0 -1
- package/dist/types/actions/getQuote.d.ts +0 -14
- package/dist/types/actions/getQuote.d.ts.map +0 -1
- package/dist/types/actions/getRelayedTransactionStatus.d.ts +0 -12
- package/dist/types/actions/getRelayedTransactionStatus.d.ts.map +0 -1
- package/dist/types/actions/getRelayerQuote.d.ts +0 -13
- package/dist/types/actions/getRelayerQuote.d.ts.map +0 -1
- package/dist/types/actions/getRoutes.d.ts +0 -12
- package/dist/types/actions/getRoutes.d.ts.map +0 -1
- package/dist/types/actions/getStatus.d.ts +0 -13
- package/dist/types/actions/getStatus.d.ts.map +0 -1
- package/dist/types/actions/getStepTransaction.d.ts +0 -12
- package/dist/types/actions/getStepTransaction.d.ts.map +0 -1
- package/dist/types/actions/getToken.d.ts +0 -13
- package/dist/types/actions/getToken.d.ts.map +0 -1
- package/dist/types/actions/getTokenBalance.d.ts +0 -13
- package/dist/types/actions/getTokenBalance.d.ts.map +0 -1
- package/dist/types/actions/getTokenBalances.d.ts +0 -13
- package/dist/types/actions/getTokenBalances.d.ts.map +0 -1
- package/dist/types/actions/getTokenBalancesByChain.d.ts +0 -17
- package/dist/types/actions/getTokenBalancesByChain.d.ts.map +0 -1
- package/dist/types/actions/getTokens.d.ts +0 -16
- package/dist/types/actions/getTokens.d.ts.map +0 -1
- package/dist/types/actions/getTools.d.ts +0 -11
- package/dist/types/actions/getTools.d.ts.map +0 -1
- package/dist/types/actions/getTransactionHistory.d.ts +0 -17
- package/dist/types/actions/getTransactionHistory.d.ts.map +0 -1
- package/dist/types/actions/getWalletBalances.d.ts +0 -12
- package/dist/types/actions/getWalletBalances.d.ts.map +0 -1
- package/dist/types/actions/index.d.ts +0 -168
- package/dist/types/actions/index.d.ts.map +0 -1
- package/dist/types/actions/patchContractCalls.d.ts +0 -11
- package/dist/types/actions/patchContractCalls.d.ts.map +0 -1
- package/dist/types/actions/relayTransaction.d.ts +0 -12
- package/dist/types/actions/relayTransaction.d.ts.map +0 -1
- package/dist/types/client/createClient.d.ts +0 -3
- package/dist/types/client/createClient.d.ts.map +0 -1
- package/dist/types/client/getClientStorage.d.ts +0 -9
- package/dist/types/client/getClientStorage.d.ts.map +0 -1
- package/dist/types/core/BaseStepExecutor.d.ts +0 -13
- package/dist/types/core/BaseStepExecutor.d.ts.map +0 -1
- package/dist/types/core/StatusManager.d.ts +0 -68
- package/dist/types/core/StatusManager.d.ts.map +0 -1
- package/dist/types/core/actionMessages.d.ts +0 -5
- package/dist/types/core/actionMessages.d.ts.map +0 -1
- package/dist/types/core/checkBalance.d.ts +0 -4
- package/dist/types/core/checkBalance.d.ts.map +0 -1
- package/dist/types/core/execution.d.ts +0 -44
- package/dist/types/core/execution.d.ts.map +0 -1
- package/dist/types/core/executionState.d.ts +0 -18
- package/dist/types/core/executionState.d.ts.map +0 -1
- package/dist/types/core/prepareRestart.d.ts +0 -3
- package/dist/types/core/prepareRestart.d.ts.map +0 -1
- package/dist/types/core/stepComparison.d.ts +0 -17
- package/dist/types/core/stepComparison.d.ts.map +0 -1
- package/dist/types/core/utils.d.ts +0 -95
- package/dist/types/core/utils.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/dist/types/errors/SDKError.d.ts +0 -13
- package/dist/types/errors/SDKError.d.ts.map +0 -1
- package/dist/types/errors/baseError.d.ts +0 -7
- package/dist/types/errors/baseError.d.ts.map +0 -1
- package/dist/types/errors/constants.d.ts +0 -51
- package/dist/types/errors/constants.d.ts.map +0 -1
- package/dist/types/errors/errors.d.ts +0 -24
- package/dist/types/errors/errors.d.ts.map +0 -1
- package/dist/types/errors/httpError.d.ts +0 -21
- package/dist/types/errors/httpError.d.ts.map +0 -1
- package/dist/types/errors/utils/baseErrorRootCause.d.ts +0 -4
- package/dist/types/errors/utils/baseErrorRootCause.d.ts.map +0 -1
- package/dist/types/errors/utils/rootCause.d.ts +0 -2
- package/dist/types/errors/utils/rootCause.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -47
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/types/actions.d.ts +0 -10
- package/dist/types/types/actions.d.ts.map +0 -1
- package/dist/types/types/core.d.ts +0 -171
- package/dist/types/types/core.d.ts.map +0 -1
- package/dist/types/types/request.d.ts +0 -4
- package/dist/types/types/request.d.ts.map +0 -1
- package/dist/types/utils/checkPackageUpdates.d.ts +0 -2
- package/dist/types/utils/checkPackageUpdates.d.ts.map +0 -1
- package/dist/types/utils/convertQuoteToRoute.d.ts +0 -19
- package/dist/types/utils/convertQuoteToRoute.d.ts.map +0 -1
- package/dist/types/utils/decode.d.ts +0 -2
- package/dist/types/utils/decode.d.ts.map +0 -1
- package/dist/types/utils/fetchTxErrorDetails.d.ts +0 -2
- package/dist/types/utils/fetchTxErrorDetails.d.ts.map +0 -1
- package/dist/types/utils/formatUnits.d.ts +0 -5
- package/dist/types/utils/formatUnits.d.ts.map +0 -1
- package/dist/types/utils/getTransactionMessage.d.ts +0 -4
- package/dist/types/utils/getTransactionMessage.d.ts.map +0 -1
- package/dist/types/utils/isHex.d.ts +0 -5
- package/dist/types/utils/isHex.d.ts.map +0 -1
- package/dist/types/utils/isRoutesRequest.d.ts +0 -3
- package/dist/types/utils/isRoutesRequest.d.ts.map +0 -1
- package/dist/types/utils/isStep.d.ts +0 -3
- package/dist/types/utils/isStep.d.ts.map +0 -1
- package/dist/types/utils/isToken.d.ts +0 -3
- package/dist/types/utils/isToken.d.ts.map +0 -1
- package/dist/types/utils/parseUnits.d.ts +0 -5
- package/dist/types/utils/parseUnits.d.ts.map +0 -1
- package/dist/types/utils/request.d.ts +0 -7
- package/dist/types/utils/request.d.ts.map +0 -1
- package/dist/types/utils/sleep.d.ts +0 -2
- package/dist/types/utils/sleep.d.ts.map +0 -1
- package/dist/types/utils/waitForResult.d.ts +0 -11
- package/dist/types/utils/waitForResult.d.ts.map +0 -1
- package/dist/types/utils/withDedupe.d.ts +0 -8
- package/dist/types/utils/withDedupe.d.ts.map +0 -1
- package/dist/types/version.d.ts +0 -3
- package/dist/types/version.d.ts.map +0 -1
- package/src/core/checkBalance.ts +0 -51
- package/src/core/waitForDestinationChainTransaction.ts +0 -112
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ExecutionOptions, RouteExtended, SDKClient } from "../types/core.js";
|
|
2
|
+
import { Route } from "@lifi/types";
|
|
3
|
+
|
|
4
|
+
//#region src/core/execution.d.ts
|
|
3
5
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
* Execute a route.
|
|
7
|
+
* @param client - The SDK client.
|
|
8
|
+
* @param route - The route that should be executed. Cannot be an active route.
|
|
9
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
10
|
+
* @returns The executed route.
|
|
11
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
12
|
+
*/
|
|
13
|
+
declare const executeRoute: (client: SDKClient, route: Route, executionOptions?: ExecutionOptions) => Promise<RouteExtended>;
|
|
12
14
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
* Resume the execution of a route that has been stopped or had an error while executing.
|
|
16
|
+
* @param client - The SDK client.
|
|
17
|
+
* @param route - The route that is to be executed. Cannot be an active route.
|
|
18
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
19
|
+
* @returns The executed route.
|
|
20
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
21
|
+
*/
|
|
22
|
+
declare const resumeRoute: (client: SDKClient, route: Route, executionOptions?: ExecutionOptions) => Promise<RouteExtended>;
|
|
21
23
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
* Updates route execution to background or foreground state.
|
|
25
|
+
* @param route - A route that is currently in execution.
|
|
26
|
+
* @param options - An object with execution settings.
|
|
27
|
+
*/
|
|
28
|
+
declare const updateRouteExecution: (route: Route, options: ExecutionOptions) => void;
|
|
27
29
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
* Stops the execution of an active route.
|
|
31
|
+
* @param route - A route that is currently in execution.
|
|
32
|
+
* @returns The stopped route.
|
|
33
|
+
*/
|
|
34
|
+
declare const stopRouteExecution: (route: Route) => Route;
|
|
33
35
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Get the list of active routes.
|
|
37
|
+
* @returns A list of routes.
|
|
38
|
+
*/
|
|
39
|
+
declare const getActiveRoutes: () => RouteExtended[];
|
|
38
40
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* Return the current route information for given route. The route has to be active.
|
|
42
|
+
* @param routeId - A route id.
|
|
43
|
+
* @returns The updated route.
|
|
44
|
+
*/
|
|
45
|
+
declare const getActiveRoute: (routeId: string) => RouteExtended | undefined;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { executeRoute, getActiveRoute, getActiveRoutes, resumeRoute, stopRouteExecution, updateRouteExecution };
|
|
48
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","names":[],"sources":["../../../src/core/execution.ts"],"mappings":";;;;;;AAqBA;;;;;;cAAa,YAAA,GACX,MAAA,EAAQ,SAAA,EACR,KAAA,EAAO,KAAA,EACP,gBAAA,GAAmB,gBAAA,KAClB,OAAA,CAAQ,aAAA;;;;;;;;;cA4BE,WAAA,GACX,MAAA,EAAQ,SAAA,EACR,KAAA,EAAO,KAAA,EACP,gBAAA,GAAmB,gBAAA,KAClB,OAAA,CAAQ,aAAA;;;;AAhCA;AA4BX;cA8Ha,oBAAA,GACX,KAAA,EAAO,KAAA,EACP,OAAA,EAAS,gBAAA;;;;;;cA2BE,kBAAA,GAAsB,KAAA,EAAO,KAAA,KAAQ,KAAA;;;;;cAqBrC,eAAA,QAAsB,aAAA;;;;;;cAWtB,cAAA,GAAkB,OAAA,aAAkB,aAAA"}
|
|
@@ -1,177 +1,141 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ProviderError } from
|
|
3
|
-
import { executionState } from
|
|
4
|
-
import { prepareRestart } from
|
|
1
|
+
import "../errors/constants.js";
|
|
2
|
+
import { ExecuteStepRetryError, ProviderError } from "../errors/errors.js";
|
|
3
|
+
import { executionState } from "./executionState.js";
|
|
4
|
+
import { prepareRestart } from "./prepareRestart.js";
|
|
5
|
+
//#region src/core/execution.ts
|
|
5
6
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return executionPromise;
|
|
7
|
+
* Execute a route.
|
|
8
|
+
* @param client - The SDK client.
|
|
9
|
+
* @param route - The route that should be executed. Cannot be an active route.
|
|
10
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
11
|
+
* @returns The executed route.
|
|
12
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
13
|
+
*/
|
|
14
|
+
const executeRoute = async (client, route, executionOptions) => {
|
|
15
|
+
const clonedRoute = structuredClone(route);
|
|
16
|
+
let executionPromise = executionState.get(clonedRoute.id)?.promise;
|
|
17
|
+
if (executionPromise) return executionPromise;
|
|
18
|
+
executionState.create({
|
|
19
|
+
route: clonedRoute,
|
|
20
|
+
executionOptions
|
|
21
|
+
});
|
|
22
|
+
executionPromise = executeSteps(client, clonedRoute);
|
|
23
|
+
executionState.update({
|
|
24
|
+
route: clonedRoute,
|
|
25
|
+
promise: executionPromise
|
|
26
|
+
});
|
|
27
|
+
return executionPromise;
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new Error('Route execution promise not found.');
|
|
49
|
-
}
|
|
50
|
-
return execution.promise;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
prepareRestart(route);
|
|
54
|
-
return executeRoute(client, route, executionOptions);
|
|
30
|
+
* Resume the execution of a route that has been stopped or had an error while executing.
|
|
31
|
+
* @param client - The SDK client.
|
|
32
|
+
* @param route - The route that is to be executed. Cannot be an active route.
|
|
33
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
34
|
+
* @returns The executed route.
|
|
35
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
36
|
+
*/
|
|
37
|
+
const resumeRoute = async (client, route, executionOptions) => {
|
|
38
|
+
const execution = executionState.get(route.id);
|
|
39
|
+
if (execution) {
|
|
40
|
+
if (!execution.executors.some((executor) => !executor.allowExecution)) {
|
|
41
|
+
updateRouteExecution(route, { executeInBackground: executionOptions?.executeInBackground });
|
|
42
|
+
if (!execution.promise) throw new Error("Route execution promise not found.");
|
|
43
|
+
return execution.promise;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
prepareRestart(route);
|
|
47
|
+
return executeRoute(client, route, executionOptions);
|
|
55
48
|
};
|
|
56
49
|
const executeSteps = async (client, route) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
const executedStep = await stepExecutor.executeStep(client, step);
|
|
98
|
-
// We may reach this point if user interaction isn't allowed. We want to stop execution until we resume it
|
|
99
|
-
if (executedStep.execution?.status !== 'DONE') {
|
|
100
|
-
stopRouteExecution(route);
|
|
101
|
-
}
|
|
102
|
-
// Execution stopped during the current step, we don't want to continue to the next step so we return already
|
|
103
|
-
if (!stepExecutor.allowExecution) {
|
|
104
|
-
return route;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
stopRouteExecution(route);
|
|
109
|
-
throw e;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Clean up after the execution
|
|
113
|
-
executionState.delete(route.id);
|
|
114
|
-
return route;
|
|
50
|
+
for (let index = 0; index < route.steps.length; index++) {
|
|
51
|
+
const execution = executionState.get(route.id);
|
|
52
|
+
if (!execution) break;
|
|
53
|
+
const step = route.steps[index];
|
|
54
|
+
const previousStep = route.steps[index - 1];
|
|
55
|
+
if (step.execution?.status === "DONE") continue;
|
|
56
|
+
if (previousStep?.execution?.toAmount) {
|
|
57
|
+
step.action.fromAmount = previousStep.execution.toAmount;
|
|
58
|
+
if (step.includedSteps?.length) step.includedSteps[0].action.fromAmount = previousStep.execution.toAmount;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const fromAddress = step.action.fromAddress;
|
|
62
|
+
if (!fromAddress) throw new Error("Action fromAddress is not specified.");
|
|
63
|
+
const provider = client.providers.find((provider) => provider.isAddress(fromAddress));
|
|
64
|
+
if (!provider) throw new ProviderError(1005, "SDK Execution Provider not found.");
|
|
65
|
+
const stepExecutor = await provider.getStepExecutor({
|
|
66
|
+
routeId: route.id,
|
|
67
|
+
executionOptions: execution.executionOptions
|
|
68
|
+
});
|
|
69
|
+
execution.executors.push(stepExecutor);
|
|
70
|
+
if (execution.executionOptions) updateRouteExecution(route, execution.executionOptions);
|
|
71
|
+
let executedStep;
|
|
72
|
+
try {
|
|
73
|
+
executedStep = await stepExecutor.executeStep(client, step);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
if (e instanceof ExecuteStepRetryError) {
|
|
76
|
+
step.execution = void 0;
|
|
77
|
+
executedStep = await stepExecutor.executeStep(client, step, e.retryParams);
|
|
78
|
+
} else throw e;
|
|
79
|
+
}
|
|
80
|
+
if (executedStep.execution?.status !== "DONE") stopRouteExecution(route);
|
|
81
|
+
if (!stepExecutor.allowExecution) return route;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
stopRouteExecution(route);
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
executionState.delete(route.id);
|
|
88
|
+
return route;
|
|
115
89
|
};
|
|
116
90
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Update active route settings so we know what the current state of execution is
|
|
135
|
-
execution.executionOptions = {
|
|
136
|
-
...execution.executionOptions,
|
|
137
|
-
...options,
|
|
138
|
-
};
|
|
91
|
+
* Updates route execution to background or foreground state.
|
|
92
|
+
* @param route - A route that is currently in execution.
|
|
93
|
+
* @param options - An object with execution settings.
|
|
94
|
+
*/
|
|
95
|
+
const updateRouteExecution = (route, options) => {
|
|
96
|
+
const execution = executionState.get(route.id);
|
|
97
|
+
if (!execution) return;
|
|
98
|
+
if ("executeInBackground" in options) for (const executor of execution.executors) executor.setInteraction({
|
|
99
|
+
allowInteraction: !options?.executeInBackground,
|
|
100
|
+
allowUpdates: true
|
|
101
|
+
});
|
|
102
|
+
execution.executionOptions = {
|
|
103
|
+
...execution.executionOptions,
|
|
104
|
+
...options
|
|
105
|
+
};
|
|
139
106
|
};
|
|
140
107
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
executionState.delete(route.id);
|
|
158
|
-
return execution.route;
|
|
108
|
+
* Stops the execution of an active route.
|
|
109
|
+
* @param route - A route that is currently in execution.
|
|
110
|
+
* @returns The stopped route.
|
|
111
|
+
*/
|
|
112
|
+
const stopRouteExecution = (route) => {
|
|
113
|
+
const execution = executionState.get(route.id);
|
|
114
|
+
if (!execution) return route;
|
|
115
|
+
for (const executor of execution.executors) executor.setInteraction({
|
|
116
|
+
allowInteraction: false,
|
|
117
|
+
allowUpdates: false,
|
|
118
|
+
allowExecution: false
|
|
119
|
+
});
|
|
120
|
+
executionState.delete(route.id);
|
|
121
|
+
return execution.route;
|
|
159
122
|
};
|
|
160
123
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
.map((dict) => dict?.route)
|
|
167
|
-
.filter(Boolean);
|
|
124
|
+
* Get the list of active routes.
|
|
125
|
+
* @returns A list of routes.
|
|
126
|
+
*/
|
|
127
|
+
const getActiveRoutes = () => {
|
|
128
|
+
return Object.values(executionState.state).map((dict) => dict?.route).filter(Boolean);
|
|
168
129
|
};
|
|
169
130
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
131
|
+
* Return the current route information for given route. The route has to be active.
|
|
132
|
+
* @param routeId - A route id.
|
|
133
|
+
* @returns The updated route.
|
|
134
|
+
*/
|
|
135
|
+
const getActiveRoute = (routeId) => {
|
|
136
|
+
return executionState.get(routeId)?.route;
|
|
176
137
|
};
|
|
138
|
+
//#endregion
|
|
139
|
+
export { executeRoute, getActiveRoute, getActiveRoutes, resumeRoute, stopRouteExecution, updateRouteExecution };
|
|
140
|
+
|
|
177
141
|
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","
|
|
1
|
+
{"version":3,"file":"execution.js","names":[],"sources":["../../../src/core/execution.ts"],"sourcesContent":["import type { Route } from '@lifi/types'\nimport { LiFiErrorCode } from '../errors/constants.js'\nimport { ExecuteStepRetryError, ProviderError } from '../errors/errors.js'\nimport type {\n ExecutionOptions,\n LiFiStepExtended,\n RouteExtended,\n SDKClient,\n SDKProvider,\n} from '../types/core.js'\nimport { executionState } from './executionState.js'\nimport { prepareRestart } from './prepareRestart.js'\n\n/**\n * Execute a route.\n * @param client - The SDK client.\n * @param route - The route that should be executed. Cannot be an active route.\n * @param executionOptions - An object containing settings and callbacks.\n * @returns The executed route.\n * @throws {LiFiError} Throws a LiFiError if the execution fails.\n */\nexport const executeRoute = async (\n client: SDKClient,\n route: Route,\n executionOptions?: ExecutionOptions\n): Promise<RouteExtended> => {\n // Deep clone to prevent side effects\n const clonedRoute = structuredClone<Route>(route)\n\n let executionPromise = executionState.get(clonedRoute.id)?.promise\n // Check if route is already running\n if (executionPromise) {\n return executionPromise\n }\n\n executionState.create({ route: clonedRoute, executionOptions })\n executionPromise = executeSteps(client, clonedRoute)\n executionState.update({\n route: clonedRoute,\n promise: executionPromise,\n })\n\n return executionPromise\n}\n\n/**\n * Resume the execution of a route that has been stopped or had an error while executing.\n * @param client - The SDK client.\n * @param route - The route that is to be executed. Cannot be an active route.\n * @param executionOptions - An object containing settings and callbacks.\n * @returns The executed route.\n * @throws {LiFiError} Throws a LiFiError if the execution fails.\n */\nexport const resumeRoute = async (\n client: SDKClient,\n route: Route,\n executionOptions?: ExecutionOptions\n): Promise<RouteExtended> => {\n const execution = executionState.get(route.id)\n\n if (execution) {\n const executionHalted = execution.executors.some(\n (executor) => !executor.allowExecution\n )\n if (!executionHalted) {\n // Check if we want to resume route execution in the background\n updateRouteExecution(route, {\n executeInBackground: executionOptions?.executeInBackground,\n })\n if (!execution.promise) {\n // We should never reach this point if we do clean-up properly\n throw new Error('Route execution promise not found.')\n }\n return execution.promise\n }\n }\n\n prepareRestart(route)\n\n return executeRoute(client, route, executionOptions)\n}\n\nconst executeSteps = async (\n client: SDKClient,\n route: RouteExtended\n): Promise<RouteExtended> => {\n // Loop over steps and execute them\n for (let index = 0; index < route.steps.length; index++) {\n const execution = executionState.get(route.id)\n // Check if execution has stopped in the meantime\n if (!execution) {\n break\n }\n\n const step = route.steps[index]\n const previousStep = route.steps[index - 1]\n // Check if the step is already done\n if (step.execution?.status === 'DONE') {\n continue\n }\n\n // Update step fromAmount using output of the previous step execution. In the future this should be handled by calling `updateRoute`\n if (previousStep?.execution?.toAmount) {\n step.action.fromAmount = previousStep.execution.toAmount\n if (step.includedSteps?.length) {\n step.includedSteps[0].action.fromAmount =\n previousStep.execution.toAmount\n }\n }\n\n try {\n const fromAddress = step.action.fromAddress\n if (!fromAddress) {\n throw new Error('Action fromAddress is not specified.')\n }\n\n const provider = client.providers.find((provider: SDKProvider) =>\n provider.isAddress(fromAddress)\n )\n\n if (!provider) {\n throw new ProviderError(\n LiFiErrorCode.ProviderUnavailable,\n 'SDK Execution Provider not found.'\n )\n }\n\n const stepExecutor = await provider.getStepExecutor({\n routeId: route.id,\n executionOptions: execution.executionOptions,\n })\n execution.executors.push(stepExecutor)\n\n // Check if we want to execute this step in the background\n if (execution.executionOptions) {\n updateRouteExecution(route, execution.executionOptions)\n }\n\n let executedStep: LiFiStepExtended\n try {\n executedStep = await stepExecutor.executeStep(client, step)\n } catch (e) {\n if (e instanceof ExecuteStepRetryError) {\n step.execution = undefined\n executedStep = await stepExecutor.executeStep(\n client,\n step,\n e.retryParams\n )\n } else {\n throw e\n }\n }\n\n // We may reach this point if user interaction isn't allowed. We want to stop execution until we resume it\n if (executedStep.execution?.status !== 'DONE') {\n stopRouteExecution(route)\n }\n\n // Execution stopped during the current step, we don't want to continue to the next step so we return already\n if (!stepExecutor.allowExecution) {\n return route\n }\n } catch (e) {\n stopRouteExecution(route)\n throw e\n }\n }\n\n // Clean up after the execution\n executionState.delete(route.id)\n return route\n}\n\n/**\n * Updates route execution to background or foreground state.\n * @param route - A route that is currently in execution.\n * @param options - An object with execution settings.\n */\nexport const updateRouteExecution = (\n route: Route,\n options: ExecutionOptions\n): void => {\n const execution = executionState.get(route.id)\n if (!execution) {\n return\n }\n\n if ('executeInBackground' in options) {\n for (const executor of execution.executors) {\n executor.setInteraction({\n allowInteraction: !options?.executeInBackground,\n allowUpdates: true,\n })\n }\n }\n // Update active route settings so we know what the current state of execution is\n execution.executionOptions = {\n ...execution.executionOptions,\n ...options,\n }\n}\n\n/**\n * Stops the execution of an active route.\n * @param route - A route that is currently in execution.\n * @returns The stopped route.\n */\nexport const stopRouteExecution = (route: Route): Route => {\n const execution = executionState.get(route.id)\n if (!execution) {\n return route\n }\n\n for (const executor of execution.executors) {\n executor.setInteraction({\n allowInteraction: false,\n allowUpdates: false,\n allowExecution: false,\n })\n }\n executionState.delete(route.id)\n return execution.route\n}\n\n/**\n * Get the list of active routes.\n * @returns A list of routes.\n */\nexport const getActiveRoutes = (): RouteExtended[] => {\n return Object.values(executionState.state)\n .map((dict) => dict?.route)\n .filter(Boolean) as RouteExtended[]\n}\n\n/**\n * Return the current route information for given route. The route has to be active.\n * @param routeId - A route id.\n * @returns The updated route.\n */\nexport const getActiveRoute = (routeId: string): RouteExtended | undefined => {\n return executionState.get(routeId)?.route\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAa,eAAe,OAC1B,QACA,OACA,qBAC2B;CAE3B,MAAM,cAAc,gBAAuB,KAAK;CAEhD,IAAI,mBAAmB,eAAe,IAAI,YAAY,EAAE,CAAC,EAAE;CAE3D,IAAI,kBACF,OAAO;CAGT,eAAe,OAAO;EAAE,OAAO;EAAa;CAAiB,CAAC;CAC9D,mBAAmB,aAAa,QAAQ,WAAW;CACnD,eAAe,OAAO;EACpB,OAAO;EACP,SAAS;CACX,CAAC;CAED,OAAO;AACT;;;;;;;;;AAUA,MAAa,cAAc,OACzB,QACA,OACA,qBAC2B;CAC3B,MAAM,YAAY,eAAe,IAAI,MAAM,EAAE;CAE7C,IAAI;MAIE,CAHoB,UAAU,UAAU,MACzC,aAAa,CAAC,SAAS,cAEP,GAAG;GAEpB,qBAAqB,OAAO,EAC1B,qBAAqB,kBAAkB,oBACzC,CAAC;GACD,IAAI,CAAC,UAAU,SAEb,MAAM,IAAI,MAAM,oCAAoC;GAEtD,OAAO,UAAU;EACnB;;CAGF,eAAe,KAAK;CAEpB,OAAO,aAAa,QAAQ,OAAO,gBAAgB;AACrD;AAEA,MAAM,eAAe,OACnB,QACA,UAC2B;CAE3B,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;EACvD,MAAM,YAAY,eAAe,IAAI,MAAM,EAAE;EAE7C,IAAI,CAAC,WACH;EAGF,MAAM,OAAO,MAAM,MAAM;EACzB,MAAM,eAAe,MAAM,MAAM,QAAQ;EAEzC,IAAI,KAAK,WAAW,WAAW,QAC7B;EAIF,IAAI,cAAc,WAAW,UAAU;GACrC,KAAK,OAAO,aAAa,aAAa,UAAU;GAChD,IAAI,KAAK,eAAe,QACtB,KAAK,cAAc,EAAE,CAAC,OAAO,aAC3B,aAAa,UAAU;EAE7B;EAEA,IAAI;GACF,MAAM,cAAc,KAAK,OAAO;GAChC,IAAI,CAAC,aACH,MAAM,IAAI,MAAM,sCAAsC;GAGxD,MAAM,WAAW,OAAO,UAAU,MAAM,aACtC,SAAS,UAAU,WAAW,CAChC;GAEA,IAAI,CAAC,UACH,MAAM,IAAI,cAAA,MAER,mCACF;GAGF,MAAM,eAAe,MAAM,SAAS,gBAAgB;IAClD,SAAS,MAAM;IACf,kBAAkB,UAAU;GAC9B,CAAC;GACD,UAAU,UAAU,KAAK,YAAY;GAGrC,IAAI,UAAU,kBACZ,qBAAqB,OAAO,UAAU,gBAAgB;GAGxD,IAAI;GACJ,IAAI;IACF,eAAe,MAAM,aAAa,YAAY,QAAQ,IAAI;GAC5D,SAAS,GAAG;IACV,IAAI,aAAa,uBAAuB;KACtC,KAAK,YAAY,KAAA;KACjB,eAAe,MAAM,aAAa,YAChC,QACA,MACA,EAAE,WACJ;IACF,OACE,MAAM;GAEV;GAGA,IAAI,aAAa,WAAW,WAAW,QACrC,mBAAmB,KAAK;GAI1B,IAAI,CAAC,aAAa,gBAChB,OAAO;EAEX,SAAS,GAAG;GACV,mBAAmB,KAAK;GACxB,MAAM;EACR;CACF;CAGA,eAAe,OAAO,MAAM,EAAE;CAC9B,OAAO;AACT;;;;;;AAOA,MAAa,wBACX,OACA,YACS;CACT,MAAM,YAAY,eAAe,IAAI,MAAM,EAAE;CAC7C,IAAI,CAAC,WACH;CAGF,IAAI,yBAAyB,SAC3B,KAAK,MAAM,YAAY,UAAU,WAC/B,SAAS,eAAe;EACtB,kBAAkB,CAAC,SAAS;EAC5B,cAAc;CAChB,CAAC;CAIL,UAAU,mBAAmB;EAC3B,GAAG,UAAU;EACb,GAAG;CACL;AACF;;;;;;AAOA,MAAa,sBAAsB,UAAwB;CACzD,MAAM,YAAY,eAAe,IAAI,MAAM,EAAE;CAC7C,IAAI,CAAC,WACH,OAAO;CAGT,KAAK,MAAM,YAAY,UAAU,WAC/B,SAAS,eAAe;EACtB,kBAAkB;EAClB,cAAc;EACd,gBAAgB;CAClB,CAAC;CAEH,eAAe,OAAO,MAAM,EAAE;CAC9B,OAAO,UAAU;AACnB;;;;;AAMA,MAAa,wBAAyC;CACpD,OAAO,OAAO,OAAO,eAAe,KAAK,CAAC,CACvC,KAAK,SAAS,MAAM,KAAK,CAAC,CAC1B,OAAO,OAAO;AACnB;;;;;;AAOA,MAAa,kBAAkB,YAA+C;CAC5E,OAAO,eAAe,IAAI,OAAO,CAAC,EAAE;AACtC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExecutionOptions, RouteExtended, StepExecutor } from "../types/core.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/executionState.d.ts
|
|
2
4
|
interface ExecutionData {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
route: RouteExtended;
|
|
6
|
+
executors: StepExecutor[];
|
|
7
|
+
executionOptions?: ExecutionOptions;
|
|
8
|
+
promise?: Promise<RouteExtended>;
|
|
7
9
|
}
|
|
8
|
-
type ExecutionStateParams = Omit<ExecutionData,
|
|
10
|
+
type ExecutionStateParams = Omit<ExecutionData, "executors">;
|
|
9
11
|
interface ExecutionState {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
state: Partial<Record<string, ExecutionData>>;
|
|
13
|
+
get(routeId: string): ExecutionData | undefined;
|
|
14
|
+
create(params: ExecutionStateParams): ExecutionData;
|
|
15
|
+
update(params: ExecutionStateParams): void;
|
|
16
|
+
delete(routeId: string): void;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
declare const executionState: ExecutionState;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { executionState };
|
|
21
|
+
//# sourceMappingURL=executionState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionState.d.ts","names":[],"sources":["../../../src/core/executionState.ts"],"mappings":";;;UAMU,aAAA;EACR,KAAA,EAAO,aAAA;EACP,SAAA,EAAW,YAAA;EACX,gBAAA,GAAmB,gBAAA;EACnB,OAAA,GAAU,OAAA,CAAQ,aAAA;AAAA;AAAA,KAGf,oBAAA,GAAuB,IAAA,CAAK,aAAA;AAAA,UAEvB,cAAA;EACR,KAAA,EAAO,OAAA,CAAQ,MAAA,SAAe,aAAA;EAC9B,GAAA,CAAI,OAAA,WAAkB,aAAA;EACtB,MAAA,CAAO,MAAA,EAAQ,oBAAA,GAAuB,aAAA;EACtC,MAAA,CAAO,MAAA,EAAQ,oBAAA;EACf,MAAA,CAAO,OAAA;AAAA;AAAA,cAGI,cAAA,EAAgB,cAAA"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
1
|
+
//#region src/core/executionState.ts
|
|
2
|
+
const executionState = {
|
|
3
|
+
state: {},
|
|
4
|
+
get(routeId) {
|
|
5
|
+
return this.state[routeId];
|
|
6
|
+
},
|
|
7
|
+
create(params) {
|
|
8
|
+
this.state[params.route.id] = {
|
|
9
|
+
...this.state[params.route.id],
|
|
10
|
+
...params,
|
|
11
|
+
executors: this.state[params.route.id]?.executors ?? []
|
|
12
|
+
};
|
|
13
|
+
return this.state[params.route.id];
|
|
14
|
+
},
|
|
15
|
+
update(state) {
|
|
16
|
+
if (this.state[state.route.id]) this.state[state.route.id] = {
|
|
17
|
+
...this.state[state.route.id],
|
|
18
|
+
...state
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
delete(routeId) {
|
|
22
|
+
delete this.state[routeId];
|
|
23
|
+
}
|
|
25
24
|
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { executionState };
|
|
27
|
+
|
|
26
28
|
//# sourceMappingURL=executionState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executionState.js","
|
|
1
|
+
{"version":3,"file":"executionState.js","names":[],"sources":["../../../src/core/executionState.ts"],"sourcesContent":["import type {\n ExecutionOptions,\n RouteExtended,\n StepExecutor,\n} from '../types/core.js'\n\ninterface ExecutionData {\n route: RouteExtended\n executors: StepExecutor[]\n executionOptions?: ExecutionOptions\n promise?: Promise<RouteExtended>\n}\n\ntype ExecutionStateParams = Omit<ExecutionData, 'executors'>\n\ninterface ExecutionState {\n state: Partial<Record<string, ExecutionData>>\n get(routeId: string): ExecutionData | undefined\n create(params: ExecutionStateParams): ExecutionData\n update(params: ExecutionStateParams): void\n delete(routeId: string): void\n}\n\nexport const executionState: ExecutionState = {\n state: {},\n get(routeId: string) {\n return this.state[routeId]\n },\n create(params) {\n this.state[params.route.id] = {\n ...this.state[params.route.id],\n ...params,\n executors: this.state[params.route.id]?.executors ?? [],\n }\n return this.state[params.route.id]!\n },\n update(state) {\n if (this.state[state.route.id]) {\n this.state[state.route.id] = {\n ...this.state[state.route.id]!,\n ...state,\n }\n }\n },\n delete(routeId) {\n delete this.state[routeId]\n },\n}\n"],"mappings":";AAuBA,MAAa,iBAAiC;CAC5C,OAAO,CAAC;CACR,IAAI,SAAiB;EACnB,OAAO,KAAK,MAAM;CACpB;CACA,OAAO,QAAQ;EACb,KAAK,MAAM,OAAO,MAAM,MAAM;GAC5B,GAAG,KAAK,MAAM,OAAO,MAAM;GAC3B,GAAG;GACH,WAAW,KAAK,MAAM,OAAO,MAAM,GAAG,EAAE,aAAa,CAAC;EACxD;EACA,OAAO,KAAK,MAAM,OAAO,MAAM;CACjC;CACA,OAAO,OAAO;EACZ,IAAI,KAAK,MAAM,MAAM,MAAM,KACzB,KAAK,MAAM,MAAM,MAAM,MAAM;GAC3B,GAAG,KAAK,MAAM,MAAM,MAAM;GAC1B,GAAG;EACL;CAEJ;CACA,OAAO,SAAS;EACd,OAAO,KAAK,MAAM;CACpB;AACF"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { RouteExtended } from "../types/core.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/prepareRestart.d.ts
|
|
4
|
+
declare const prepareRestart: (route: RouteExtended) => void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { prepareRestart };
|
|
7
|
+
//# sourceMappingURL=prepareRestart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareRestart.d.ts","names":[],"sources":["../../../src/core/prepareRestart.ts"],"mappings":";;;cAEa,cAAA,GAAkB,KAAO,EAAA,aAAA"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
step.execution.actions = [];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
step.transactionRequest = undefined;
|
|
20
|
-
}
|
|
1
|
+
//#region src/core/prepareRestart.ts
|
|
2
|
+
const prepareRestart = (route) => {
|
|
3
|
+
for (let index = 0; index < route.steps.length; index++) {
|
|
4
|
+
const step = route.steps[index];
|
|
5
|
+
if (step.execution) {
|
|
6
|
+
const lastValidIndex = step.execution.actions.findLastIndex((action) => [
|
|
7
|
+
"SWAP",
|
|
8
|
+
"CROSS_CHAIN",
|
|
9
|
+
"RECEIVING_CHAIN"
|
|
10
|
+
].includes(action.type) && (!!action.txHash || !!action.taskId) && action.status !== "FAILED");
|
|
11
|
+
if (lastValidIndex >= 0) step.execution.actions = step.execution.actions.slice(0, lastValidIndex + 1);
|
|
12
|
+
else step.execution.actions = [];
|
|
13
|
+
}
|
|
14
|
+
step.transactionRequest = void 0;
|
|
15
|
+
}
|
|
21
16
|
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { prepareRestart };
|
|
19
|
+
|
|
22
20
|
//# sourceMappingURL=prepareRestart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareRestart.js","
|
|
1
|
+
{"version":3,"file":"prepareRestart.js","names":[],"sources":["../../../src/core/prepareRestart.ts"],"sourcesContent":["import type { RouteExtended } from '../types/core.js'\n\nexport const prepareRestart = (route: RouteExtended): void => {\n for (let index = 0; index < route.steps.length; index++) {\n const step = route.steps[index]\n if (step.execution) {\n // Find the index of the last action that has tx hash, taskId, or signed messages\n const lastValidIndex = step.execution.actions.findLastIndex(\n (action) =>\n ['SWAP', 'CROSS_CHAIN', 'RECEIVING_CHAIN'].includes(action.type) &&\n (!!action.txHash || !!action.taskId) &&\n action.status !== 'FAILED'\n )\n\n // Keep all actions up to the one with tx hash\n if (lastValidIndex >= 0) {\n step.execution.actions = step.execution.actions.slice(\n 0,\n lastValidIndex + 1\n )\n } else {\n // If no tx hash exists, reset the actions array\n step.execution.actions = []\n }\n }\n step.transactionRequest = undefined\n }\n}\n"],"mappings":";AAEA,MAAa,kBAAkB,UAA+B;CAC5D,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;EACvD,MAAM,OAAO,MAAM,MAAM;EACzB,IAAI,KAAK,WAAW;GAElB,MAAM,iBAAiB,KAAK,UAAU,QAAQ,eAC3C,WACC;IAAC;IAAQ;IAAe;GAAiB,CAAC,CAAC,SAAS,OAAO,IAAI,MAC9D,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,WAC7B,OAAO,WAAW,QACtB;GAGA,IAAI,kBAAkB,GACpB,KAAK,UAAU,UAAU,KAAK,UAAU,QAAQ,MAC9C,GACA,iBAAiB,CACnB;QAGA,KAAK,UAAU,UAAU,CAAC;EAE9B;EACA,KAAK,qBAAqB,KAAA;CAC5B;AACF"}
|