@lifi/sdk 4.0.0-beta.1 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +12 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +14 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +9 -0
- package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +16 -0
- 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 -46
- 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 -45
- 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 -33
- 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 +66 -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 +43 -47
- package/dist/cjs/client/getClientStorage.js.map +1 -1
- package/dist/cjs/core/BaseStepExecutionTask.d.ts +9 -4
- package/dist/cjs/core/BaseStepExecutionTask.js +9 -8
- package/dist/cjs/core/BaseStepExecutionTask.js.map +1 -1
- package/dist/cjs/core/BaseStepExecutor.d.ts +23 -18
- package/dist/cjs/core/BaseStepExecutor.js +68 -77
- package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
- package/dist/cjs/core/StatusManager.d.ts +80 -21
- package/dist/cjs/core/StatusManager.js +175 -136
- package/dist/cjs/core/StatusManager.js.map +1 -1
- package/dist/cjs/core/TaskPipeline.d.ts +11 -6
- package/dist/cjs/core/TaskPipeline.js +20 -25
- package/dist/cjs/core/TaskPipeline.js.map +1 -1
- package/dist/cjs/core/actionMessages.d.ts +9 -4
- package/dist/cjs/core/actionMessages.js +72 -74
- 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 -133
- 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 -18
- package/dist/cjs/core/prepareRestart.js.map +1 -1
- package/dist/cjs/core/storage.d.ts +18 -14
- package/dist/cjs/core/storage.js +35 -33
- package/dist/cjs/core/storage.js.map +1 -1
- package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +9 -4
- package/dist/cjs/core/tasks/CheckBalanceTask.js +23 -24
- package/dist/cjs/core/tasks/CheckBalanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +9 -4
- package/dist/cjs/core/tasks/PrepareTransactionTask.js +28 -34
- package/dist/cjs/core/tasks/PrepareTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +12 -7
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js +62 -71
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/checkBalance.d.ts +8 -3
- package/dist/cjs/core/tasks/helpers/checkBalance.js +24 -33
- package/dist/cjs/core/tasks/helpers/checkBalance.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +7 -2
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js +21 -26
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/stepComparison.d.ts +21 -4
- package/dist/cjs/core/tasks/helpers/stepComparison.js +28 -21
- package/dist/cjs/core/tasks/helpers/stepComparison.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +9 -4
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js +45 -53
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js.map +1 -1
- package/dist/cjs/core/utils.d.ts +17 -91
- 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 +23 -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 +18 -18
- package/dist/cjs/errors/baseError.js.map +1 -1
- package/dist/cjs/errors/constants.d.ts +52 -48
- package/dist/cjs/errors/constants.js +60 -56
- package/dist/cjs/errors/constants.js.map +1 -1
- package/dist/cjs/errors/errors.d.ts +38 -28
- package/dist/cjs/errors/errors.js +58 -51
- package/dist/cjs/errors/errors.js.map +1 -1
- package/dist/cjs/errors/httpError.d.ts +21 -17
- package/dist/cjs/errors/httpError.js +63 -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 +54 -55
- package/dist/cjs/index.js +128 -138
- package/dist/cjs/types/actions.d.ts +12 -7
- package/dist/cjs/types/actions.js +0 -3
- package/dist/cjs/types/core.d.ts +184 -172
- package/dist/cjs/types/core.js +0 -3
- package/dist/cjs/types/execution.d.ts +25 -19
- package/dist/cjs/types/execution.js +0 -3
- 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 -30
- package/dist/cjs/utils/waitForResult.js.map +1 -1
- package/dist/cjs/utils/withDedupe.d.ts +20 -8
- package/dist/cjs/utils/withDedupe.js +32 -29
- package/dist/cjs/utils/withDedupe.js.map +1 -1
- 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/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +12 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +14 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +9 -0
- package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +11 -0
- 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 -45
- 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 -51
- 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 -39
- 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 +66 -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 +44 -48
- package/dist/esm/client/getClientStorage.js.map +1 -1
- package/dist/esm/core/BaseStepExecutionTask.d.ts +9 -4
- package/dist/esm/core/BaseStepExecutionTask.d.ts.map +1 -0
- package/dist/esm/core/BaseStepExecutionTask.js +9 -5
- package/dist/esm/core/BaseStepExecutionTask.js.map +1 -1
- package/dist/esm/core/BaseStepExecutor.d.ts +23 -18
- package/dist/esm/core/BaseStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/BaseStepExecutor.js +68 -76
- package/dist/esm/core/BaseStepExecutor.js.map +1 -1
- package/dist/esm/core/StatusManager.d.ts +79 -65
- package/dist/esm/core/StatusManager.d.ts.map +1 -0
- package/dist/esm/core/StatusManager.js +174 -180
- package/dist/esm/core/StatusManager.js.map +1 -1
- package/dist/esm/core/TaskPipeline.d.ts +11 -6
- package/dist/esm/core/TaskPipeline.d.ts.map +1 -0
- package/dist/esm/core/TaskPipeline.js +20 -22
- package/dist/esm/core/TaskPipeline.js.map +1 -1
- 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 -72
- 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 -173
- 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 -19
- package/dist/esm/core/prepareRestart.js.map +1 -1
- package/dist/esm/core/storage.d.ts +18 -14
- package/dist/esm/core/storage.d.ts.map +1 -0
- package/dist/esm/core/storage.js +33 -28
- package/dist/esm/core/storage.js.map +1 -1
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts +9 -4
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/CheckBalanceTask.js +23 -21
- package/dist/esm/core/tasks/CheckBalanceTask.js.map +1 -1
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +9 -4
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/PrepareTransactionTask.js +28 -31
- package/dist/esm/core/tasks/PrepareTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +12 -7
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js +62 -73
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.js.map +1 -1
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts +8 -3
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/checkBalance.js +25 -32
- package/dist/esm/core/tasks/helpers/checkBalance.js.map +1 -1
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +7 -2
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js +22 -24
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.js.map +1 -1
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts +20 -15
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/stepComparison.js +28 -32
- package/dist/esm/core/tasks/helpers/stepComparison.js.map +1 -1
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +9 -4
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js +44 -50
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js.map +1 -1
- package/dist/esm/core/utils.d.ts +16 -98
- 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 +23 -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 +18 -17
- package/dist/esm/errors/baseError.js.map +1 -1
- package/dist/esm/errors/constants.d.ts +52 -48
- package/dist/esm/errors/constants.d.ts.map +1 -0
- package/dist/esm/errors/constants.js +57 -53
- package/dist/esm/errors/constants.js.map +1 -1
- package/dist/esm/errors/errors.d.ts +30 -25
- package/dist/esm/errors/errors.d.ts.map +1 -0
- package/dist/esm/errors/errors.js +53 -48
- 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 +63 -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 +54 -55
- package/dist/esm/index.js +52 -54
- 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 +182 -177
- 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 +25 -20
- package/dist/esm/types/execution.d.ts.map +1 -0
- package/dist/esm/types/execution.js +0 -1
- 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 -35
- package/dist/esm/utils/waitForResult.js.map +1 -1
- package/dist/esm/utils/withDedupe.d.ts +18 -12
- package/dist/esm/utils/withDedupe.d.ts.map +1 -0
- package/dist/esm/utils/withDedupe.js +28 -29
- package/dist/esm/utils/withDedupe.js.map +1 -1
- 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 +5 -5
- package/src/actions/getChains.ts +2 -1
- package/src/actions/getTokens.ts +2 -1
- package/src/actions/getTools.ts +2 -1
- package/src/client/getClientStorage.ts +8 -1
- package/src/core/prepareRestart.ts +1 -1
- package/src/core/tasks/helpers/waitForTransactionStatus.ts +1 -0
- package/src/core/utils.ts +1 -1
- package/src/errors/httpError.ts +1 -3
- package/src/errors/utils/baseErrorRootCause.ts +2 -2
- package/src/errors/utils/rootCause.ts +1 -1
- 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/withDedupe.ts +1 -1
- package/src/version.ts +1 -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/execution.js.map +0 -1
- package/dist/cjs/types/request.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/execution.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/BaseStepExecutionTask.d.ts +0 -6
- package/dist/types/core/BaseStepExecutionTask.d.ts.map +0 -1
- package/dist/types/core/BaseStepExecutor.d.ts +0 -20
- package/dist/types/core/BaseStepExecutor.d.ts.map +0 -1
- package/dist/types/core/StatusManager.d.ts +0 -70
- package/dist/types/core/StatusManager.d.ts.map +0 -1
- package/dist/types/core/TaskPipeline.d.ts +0 -8
- package/dist/types/core/TaskPipeline.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/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/storage.d.ts +0 -18
- package/dist/types/core/storage.d.ts.map +0 -1
- package/dist/types/core/tasks/CheckBalanceTask.d.ts +0 -6
- package/dist/types/core/tasks/CheckBalanceTask.d.ts.map +0 -1
- package/dist/types/core/tasks/PrepareTransactionTask.d.ts +0 -6
- package/dist/types/core/tasks/PrepareTransactionTask.d.ts.map +0 -1
- package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts +0 -9
- package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts.map +0 -1
- package/dist/types/core/tasks/helpers/checkBalance.d.ts +0 -4
- package/dist/types/core/tasks/helpers/checkBalance.d.ts.map +0 -1
- package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts +0 -3
- package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts.map +0 -1
- package/dist/types/core/tasks/helpers/stepComparison.d.ts +0 -17
- package/dist/types/core/tasks/helpers/stepComparison.d.ts.map +0 -1
- package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts +0 -5
- package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts.map +0 -1
- package/dist/types/core/utils.d.ts +0 -100
- package/dist/types/core/utils.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 -52
- package/dist/types/errors/constants.d.ts.map +0 -1
- package/dist/types/errors/errors.d.ts +0 -34
- 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 -56
- 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 -183
- package/dist/types/types/core.d.ts.map +0 -1
- package/dist/types/types/execution.d.ts +0 -24
- package/dist/types/types/execution.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 -18
- 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
|
@@ -1,149 +1,147 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors_constants = require("../errors/constants.js");
|
|
3
|
+
const require_errors_errors = require("../errors/errors.js");
|
|
4
|
+
const require_core_executionState = require("./executionState.js");
|
|
5
|
+
const require_core_prepareRestart = require("./prepareRestart.js");
|
|
6
|
+
//#region src/core/execution.ts
|
|
7
|
+
/**
|
|
8
|
+
* Execute a route.
|
|
9
|
+
* @param client - The SDK client.
|
|
10
|
+
* @param route - The route that should be executed. Cannot be an active route.
|
|
11
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
12
|
+
* @returns The executed route.
|
|
13
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
14
|
+
*/
|
|
8
15
|
const executeRoute = async (client, route, executionOptions) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const clonedRoute = structuredClone(route);
|
|
17
|
+
let executionPromise = require_core_executionState.executionState.get(clonedRoute.id)?.promise;
|
|
18
|
+
if (executionPromise) return executionPromise;
|
|
19
|
+
require_core_executionState.executionState.create({
|
|
20
|
+
route: clonedRoute,
|
|
21
|
+
executionOptions
|
|
22
|
+
});
|
|
23
|
+
executionPromise = executeSteps(client, clonedRoute);
|
|
24
|
+
require_core_executionState.executionState.update({
|
|
25
|
+
route: clonedRoute,
|
|
26
|
+
promise: executionPromise
|
|
27
|
+
});
|
|
28
|
+
return executionPromise;
|
|
21
29
|
};
|
|
22
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Resume the execution of a route that has been stopped or had an error while executing.
|
|
32
|
+
* @param client - The SDK client.
|
|
33
|
+
* @param route - The route that is to be executed. Cannot be an active route.
|
|
34
|
+
* @param executionOptions - An object containing settings and callbacks.
|
|
35
|
+
* @returns The executed route.
|
|
36
|
+
* @throws {LiFiError} Throws a LiFiError if the execution fails.
|
|
37
|
+
*/
|
|
23
38
|
const resumeRoute = async (client, route, executionOptions) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return execution.promise;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
(0, prepareRestart_js_1.prepareRestart)(route);
|
|
38
|
-
return (0, exports.executeRoute)(client, route, executionOptions);
|
|
39
|
+
const execution = require_core_executionState.executionState.get(route.id);
|
|
40
|
+
if (execution) {
|
|
41
|
+
if (!execution.executors.some((executor) => !executor.allowExecution)) {
|
|
42
|
+
updateRouteExecution(route, { executeInBackground: executionOptions?.executeInBackground });
|
|
43
|
+
if (!execution.promise) throw new Error("Route execution promise not found.");
|
|
44
|
+
return execution.promise;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
require_core_prepareRestart.prepareRestart(route);
|
|
48
|
+
return executeRoute(client, route, executionOptions);
|
|
39
49
|
};
|
|
40
|
-
exports.resumeRoute = resumeRoute;
|
|
41
50
|
const executeSteps = async (client, route) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
if (e instanceof errors_js_1.ExecuteStepRetryError) {
|
|
82
|
-
step.execution = undefined;
|
|
83
|
-
executedStep = await stepExecutor.executeStep(client, step, e.retryParams);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
throw e;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (executedStep.execution?.status !== 'DONE') {
|
|
90
|
-
(0, exports.stopRouteExecution)(route);
|
|
91
|
-
}
|
|
92
|
-
if (!stepExecutor.allowExecution) {
|
|
93
|
-
return route;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
(0, exports.stopRouteExecution)(route);
|
|
98
|
-
throw e;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
executionState_js_1.executionState.delete(route.id);
|
|
102
|
-
return route;
|
|
51
|
+
for (let index = 0; index < route.steps.length; index++) {
|
|
52
|
+
const execution = require_core_executionState.executionState.get(route.id);
|
|
53
|
+
if (!execution) break;
|
|
54
|
+
const step = route.steps[index];
|
|
55
|
+
const previousStep = route.steps[index - 1];
|
|
56
|
+
if (step.execution?.status === "DONE") continue;
|
|
57
|
+
if (previousStep?.execution?.toAmount) {
|
|
58
|
+
step.action.fromAmount = previousStep.execution.toAmount;
|
|
59
|
+
if (step.includedSteps?.length) step.includedSteps[0].action.fromAmount = previousStep.execution.toAmount;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const fromAddress = step.action.fromAddress;
|
|
63
|
+
if (!fromAddress) throw new Error("Action fromAddress is not specified.");
|
|
64
|
+
const provider = client.providers.find((provider) => provider.isAddress(fromAddress));
|
|
65
|
+
if (!provider) throw new require_errors_errors.ProviderError(require_errors_constants.LiFiErrorCode.ProviderUnavailable, "SDK Execution Provider not found.");
|
|
66
|
+
const stepExecutor = await provider.getStepExecutor({
|
|
67
|
+
routeId: route.id,
|
|
68
|
+
executionOptions: execution.executionOptions
|
|
69
|
+
});
|
|
70
|
+
execution.executors.push(stepExecutor);
|
|
71
|
+
if (execution.executionOptions) updateRouteExecution(route, execution.executionOptions);
|
|
72
|
+
let executedStep;
|
|
73
|
+
try {
|
|
74
|
+
executedStep = await stepExecutor.executeStep(client, step);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (e instanceof require_errors_errors.ExecuteStepRetryError) {
|
|
77
|
+
step.execution = void 0;
|
|
78
|
+
executedStep = await stepExecutor.executeStep(client, step, e.retryParams);
|
|
79
|
+
} else throw e;
|
|
80
|
+
}
|
|
81
|
+
if (executedStep.execution?.status !== "DONE") stopRouteExecution(route);
|
|
82
|
+
if (!stepExecutor.allowExecution) return route;
|
|
83
|
+
} catch (e) {
|
|
84
|
+
stopRouteExecution(route);
|
|
85
|
+
throw e;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
require_core_executionState.executionState.delete(route.id);
|
|
89
|
+
return route;
|
|
103
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* Updates route execution to background or foreground state.
|
|
93
|
+
* @param route - A route that is currently in execution.
|
|
94
|
+
* @param options - An object with execution settings.
|
|
95
|
+
*/
|
|
104
96
|
const updateRouteExecution = (route, options) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
execution.executionOptions = {
|
|
118
|
-
...execution.executionOptions,
|
|
119
|
-
...options,
|
|
120
|
-
};
|
|
97
|
+
const execution = require_core_executionState.executionState.get(route.id);
|
|
98
|
+
if (!execution) return;
|
|
99
|
+
if ("executeInBackground" in options) for (const executor of execution.executors) executor.setInteraction({
|
|
100
|
+
allowInteraction: !options?.executeInBackground,
|
|
101
|
+
allowUpdates: true
|
|
102
|
+
});
|
|
103
|
+
execution.executionOptions = {
|
|
104
|
+
...execution.executionOptions,
|
|
105
|
+
...options
|
|
106
|
+
};
|
|
121
107
|
};
|
|
122
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Stops the execution of an active route.
|
|
110
|
+
* @param route - A route that is currently in execution.
|
|
111
|
+
* @returns The stopped route.
|
|
112
|
+
*/
|
|
123
113
|
const stopRouteExecution = (route) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
executionState_js_1.executionState.delete(route.id);
|
|
136
|
-
return execution.route;
|
|
114
|
+
const execution = require_core_executionState.executionState.get(route.id);
|
|
115
|
+
if (!execution) return route;
|
|
116
|
+
for (const executor of execution.executors) executor.setInteraction({
|
|
117
|
+
allowInteraction: false,
|
|
118
|
+
allowUpdates: false,
|
|
119
|
+
allowExecution: false
|
|
120
|
+
});
|
|
121
|
+
require_core_executionState.executionState.delete(route.id);
|
|
122
|
+
return execution.route;
|
|
137
123
|
};
|
|
138
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Get the list of active routes.
|
|
126
|
+
* @returns A list of routes.
|
|
127
|
+
*/
|
|
139
128
|
const getActiveRoutes = () => {
|
|
140
|
-
|
|
141
|
-
.map((dict) => dict?.route)
|
|
142
|
-
.filter(Boolean);
|
|
129
|
+
return Object.values(require_core_executionState.executionState.state).map((dict) => dict?.route).filter(Boolean);
|
|
143
130
|
};
|
|
144
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Return the current route information for given route. The route has to be active.
|
|
133
|
+
* @param routeId - A route id.
|
|
134
|
+
* @returns The updated route.
|
|
135
|
+
*/
|
|
145
136
|
const getActiveRoute = (routeId) => {
|
|
146
|
-
|
|
137
|
+
return require_core_executionState.executionState.get(routeId)?.route;
|
|
147
138
|
};
|
|
139
|
+
//#endregion
|
|
140
|
+
exports.executeRoute = executeRoute;
|
|
148
141
|
exports.getActiveRoute = getActiveRoute;
|
|
142
|
+
exports.getActiveRoutes = getActiveRoutes;
|
|
143
|
+
exports.resumeRoute = resumeRoute;
|
|
144
|
+
exports.stopRouteExecution = stopRouteExecution;
|
|
145
|
+
exports.updateRouteExecution = updateRouteExecution;
|
|
146
|
+
|
|
149
147
|
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","
|
|
1
|
+
{"version":3,"file":"execution.js","names":["executionState","ProviderError","LiFiErrorCode","ExecuteStepRetryError"],"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,MAAM;CAEjD,IAAI,mBAAmBA,4BAAAA,eAAe,IAAI,YAAY,GAAG,EAAE;AAE3D,KAAI,iBACF,QAAO;AAGT,6BAAA,eAAe,OAAO;EAAE,OAAO;EAAa;EAAkB,CAAC;AAC/D,oBAAmB,aAAa,QAAQ,YAAY;AACpD,6BAAA,eAAe,OAAO;EACpB,OAAO;EACP,SAAS;EACV,CAAC;AAEF,QAAO;;;;;;;;;;AAWT,MAAa,cAAc,OACzB,QACA,OACA,qBAC2B;CAC3B,MAAM,YAAYA,4BAAAA,eAAe,IAAI,MAAM,GAAG;AAE9C,KAAI;MAIE,CAHoB,UAAU,UAAU,MACzC,aAAa,CAAC,SAAS,eACzB,EACqB;AAEpB,wBAAqB,OAAO,EAC1B,qBAAqB,kBAAkB,qBACxC,CAAC;AACF,OAAI,CAAC,UAAU,QAEb,OAAM,IAAI,MAAM,qCAAqC;AAEvD,UAAO,UAAU;;;AAIrB,6BAAA,eAAe,MAAM;AAErB,QAAO,aAAa,QAAQ,OAAO,iBAAiB;;AAGtD,MAAM,eAAe,OACnB,QACA,UAC2B;AAE3B,MAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;EACvD,MAAM,YAAYA,4BAAAA,eAAe,IAAI,MAAM,GAAG;AAE9C,MAAI,CAAC,UACH;EAGF,MAAM,OAAO,MAAM,MAAM;EACzB,MAAM,eAAe,MAAM,MAAM,QAAQ;AAEzC,MAAI,KAAK,WAAW,WAAW,OAC7B;AAIF,MAAI,cAAc,WAAW,UAAU;AACrC,QAAK,OAAO,aAAa,aAAa,UAAU;AAChD,OAAI,KAAK,eAAe,OACtB,MAAK,cAAc,GAAG,OAAO,aAC3B,aAAa,UAAU;;AAI7B,MAAI;GACF,MAAM,cAAc,KAAK,OAAO;AAChC,OAAI,CAAC,YACH,OAAM,IAAI,MAAM,uCAAuC;GAGzD,MAAM,WAAW,OAAO,UAAU,MAAM,aACtC,SAAS,UAAU,YAAY,CAChC;AAED,OAAI,CAAC,SACH,OAAM,IAAIC,sBAAAA,cACRC,yBAAAA,cAAc,qBACd,oCACD;GAGH,MAAM,eAAe,MAAM,SAAS,gBAAgB;IAClD,SAAS,MAAM;IACf,kBAAkB,UAAU;IAC7B,CAAC;AACF,aAAU,UAAU,KAAK,aAAa;AAGtC,OAAI,UAAU,iBACZ,sBAAqB,OAAO,UAAU,iBAAiB;GAGzD,IAAI;AACJ,OAAI;AACF,mBAAe,MAAM,aAAa,YAAY,QAAQ,KAAK;YACpD,GAAG;AACV,QAAI,aAAaC,sBAAAA,uBAAuB;AACtC,UAAK,YAAY,KAAA;AACjB,oBAAe,MAAM,aAAa,YAChC,QACA,MACA,EAAE,YACH;UAED,OAAM;;AAKV,OAAI,aAAa,WAAW,WAAW,OACrC,oBAAmB,MAAM;AAI3B,OAAI,CAAC,aAAa,eAChB,QAAO;WAEF,GAAG;AACV,sBAAmB,MAAM;AACzB,SAAM;;;AAKV,6BAAA,eAAe,OAAO,MAAM,GAAG;AAC/B,QAAO;;;;;;;AAQT,MAAa,wBACX,OACA,YACS;CACT,MAAM,YAAYH,4BAAAA,eAAe,IAAI,MAAM,GAAG;AAC9C,KAAI,CAAC,UACH;AAGF,KAAI,yBAAyB,QAC3B,MAAK,MAAM,YAAY,UAAU,UAC/B,UAAS,eAAe;EACtB,kBAAkB,CAAC,SAAS;EAC5B,cAAc;EACf,CAAC;AAIN,WAAU,mBAAmB;EAC3B,GAAG,UAAU;EACb,GAAG;EACJ;;;;;;;AAQH,MAAa,sBAAsB,UAAwB;CACzD,MAAM,YAAYA,4BAAAA,eAAe,IAAI,MAAM,GAAG;AAC9C,KAAI,CAAC,UACH,QAAO;AAGT,MAAK,MAAM,YAAY,UAAU,UAC/B,UAAS,eAAe;EACtB,kBAAkB;EAClB,cAAc;EACd,gBAAgB;EACjB,CAAC;AAEJ,6BAAA,eAAe,OAAO,MAAM,GAAG;AAC/B,QAAO,UAAU;;;;;;AAOnB,MAAa,wBAAyC;AACpD,QAAO,OAAO,OAAOA,4BAAAA,eAAe,MAAM,CACvC,KAAK,SAAS,MAAM,MAAM,CAC1B,OAAO,QAAQ;;;;;;;AAQpB,MAAa,kBAAkB,YAA+C;AAC5E,QAAOA,4BAAAA,eAAe,IAAI,QAAQ,EAAE"}
|
|
@@ -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
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
delete(routeId) {
|
|
26
|
-
delete this.state[routeId];
|
|
27
|
-
},
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/executionState.ts
|
|
3
|
+
const executionState = {
|
|
4
|
+
state: {},
|
|
5
|
+
get(routeId) {
|
|
6
|
+
return this.state[routeId];
|
|
7
|
+
},
|
|
8
|
+
create(params) {
|
|
9
|
+
this.state[params.route.id] = {
|
|
10
|
+
...this.state[params.route.id],
|
|
11
|
+
...params,
|
|
12
|
+
executors: this.state[params.route.id]?.executors ?? []
|
|
13
|
+
};
|
|
14
|
+
return this.state[params.route.id];
|
|
15
|
+
},
|
|
16
|
+
update(state) {
|
|
17
|
+
if (this.state[state.route.id]) this.state[state.route.id] = {
|
|
18
|
+
...this.state[state.route.id],
|
|
19
|
+
...state
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
delete(routeId) {
|
|
23
|
+
delete this.state[routeId];
|
|
24
|
+
}
|
|
28
25
|
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.executionState = executionState;
|
|
28
|
+
|
|
29
29
|
//# 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,EAAE;CACT,IAAI,SAAiB;AACnB,SAAO,KAAK,MAAM;;CAEpB,OAAO,QAAQ;AACb,OAAK,MAAM,OAAO,MAAM,MAAM;GAC5B,GAAG,KAAK,MAAM,OAAO,MAAM;GAC3B,GAAG;GACH,WAAW,KAAK,MAAM,OAAO,MAAM,KAAK,aAAa,EAAE;GACxD;AACD,SAAO,KAAK,MAAM,OAAO,MAAM;;CAEjC,OAAO,OAAO;AACZ,MAAI,KAAK,MAAM,MAAM,MAAM,IACzB,MAAK,MAAM,MAAM,MAAM,MAAM;GAC3B,GAAG,KAAK,MAAM,MAAM,MAAM;GAC1B,GAAG;GACJ;;CAGL,OAAO,SAAS;AACd,SAAO,KAAK,MAAM;;CAErB"}
|
|
@@ -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
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.prepareRestart = void 0;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/prepareRestart.ts
|
|
4
3
|
const prepareRestart = (route) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
step.transactionRequest = undefined;
|
|
19
|
-
}
|
|
4
|
+
for (let index = 0; index < route.steps.length; index++) {
|
|
5
|
+
const step = route.steps[index];
|
|
6
|
+
if (step.execution) {
|
|
7
|
+
const lastValidIndex = step.execution.actions.findLastIndex((action) => [
|
|
8
|
+
"SWAP",
|
|
9
|
+
"CROSS_CHAIN",
|
|
10
|
+
"RECEIVING_CHAIN"
|
|
11
|
+
].includes(action.type) && (!!action.txHash || !!action.taskId) && action.status !== "FAILED");
|
|
12
|
+
if (lastValidIndex >= 0) step.execution.actions = step.execution.actions.slice(0, lastValidIndex + 1);
|
|
13
|
+
else step.execution.actions = [];
|
|
14
|
+
}
|
|
15
|
+
step.transactionRequest = void 0;
|
|
16
|
+
}
|
|
20
17
|
};
|
|
18
|
+
//#endregion
|
|
21
19
|
exports.prepareRestart = prepareRestart;
|
|
20
|
+
|
|
22
21
|
//# 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;AAC5D,MAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,MAAM,QAAQ,SAAS;EACvD,MAAM,OAAO,MAAM,MAAM;AACzB,MAAI,KAAK,WAAW;GAElB,MAAM,iBAAiB,KAAK,UAAU,QAAQ,eAC3C,WACC;IAAC;IAAQ;IAAe;IAAkB,CAAC,SAAS,OAAO,KAAK,KAC/D,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,WAC7B,OAAO,WAAW,SACrB;AAGD,OAAI,kBAAkB,EACpB,MAAK,UAAU,UAAU,KAAK,UAAU,QAAQ,MAC9C,GACA,iBAAiB,EAClB;OAGD,MAAK,UAAU,UAAU,EAAE;;AAG/B,OAAK,qBAAqB,KAAA"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/core/storage.d.ts
|
|
2
|
+
interface SDKStorage {
|
|
3
|
+
get(key: string): string | null | Promise<string | null>;
|
|
4
|
+
set(key: string, value: string): void | Promise<void>;
|
|
5
|
+
remove(key: string): void | Promise<void>;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
declare class LocalStorageAdapter implements SDKStorage {
|
|
8
|
+
get(key: string): string | null;
|
|
9
|
+
set(key: string, value: string): void;
|
|
10
|
+
remove(key: string): void;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
declare class InMemoryStorage implements SDKStorage {
|
|
13
|
+
private store;
|
|
14
|
+
get(key: string): string | null;
|
|
15
|
+
set(key: string, value: string): void;
|
|
16
|
+
remove(key: string): void;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
declare function createDefaultStorage(): SDKStorage;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { InMemoryStorage, LocalStorageAdapter, SDKStorage, createDefaultStorage };
|
|
21
|
+
//# sourceMappingURL=storage.d.ts.map
|
package/dist/cjs/core/storage.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
exports.InMemoryStorage = InMemoryStorage;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js");
|
|
3
|
+
//#region src/core/storage.ts
|
|
4
|
+
var LocalStorageAdapter = class {
|
|
5
|
+
get(key) {
|
|
6
|
+
return window.localStorage.getItem(key);
|
|
7
|
+
}
|
|
8
|
+
set(key, value) {
|
|
9
|
+
window.localStorage.setItem(key, value);
|
|
10
|
+
}
|
|
11
|
+
remove(key) {
|
|
12
|
+
window.localStorage.removeItem(key);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var InMemoryStorage = class {
|
|
16
|
+
constructor() {
|
|
17
|
+
require_defineProperty._defineProperty(this, "store", /* @__PURE__ */ new Map());
|
|
18
|
+
}
|
|
19
|
+
get(key) {
|
|
20
|
+
return this.store.get(key) ?? null;
|
|
21
|
+
}
|
|
22
|
+
set(key, value) {
|
|
23
|
+
this.store.set(key, value);
|
|
24
|
+
}
|
|
25
|
+
remove(key) {
|
|
26
|
+
this.store.delete(key);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
30
29
|
function createDefaultStorage() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return new InMemoryStorage();
|
|
30
|
+
if (typeof window !== "undefined" && window.localStorage) return new LocalStorageAdapter();
|
|
31
|
+
return new InMemoryStorage();
|
|
35
32
|
}
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.InMemoryStorage = InMemoryStorage;
|
|
35
|
+
exports.LocalStorageAdapter = LocalStorageAdapter;
|
|
36
|
+
exports.createDefaultStorage = createDefaultStorage;
|
|
37
|
+
|
|
36
38
|
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","
|
|
1
|
+
{"version":3,"file":"storage.js","names":[],"sources":["../../../src/core/storage.ts"],"sourcesContent":["export interface SDKStorage {\n get(key: string): string | null | Promise<string | null>\n set(key: string, value: string): void | Promise<void>\n remove(key: string): void | Promise<void>\n}\n\nexport class LocalStorageAdapter implements SDKStorage {\n get(key: string): string | null {\n return window.localStorage.getItem(key)\n }\n\n set(key: string, value: string): void {\n window.localStorage.setItem(key, value)\n }\n\n remove(key: string): void {\n window.localStorage.removeItem(key)\n }\n}\n\nexport class InMemoryStorage implements SDKStorage {\n private store = new Map<string, string>()\n\n get(key: string): string | null {\n return this.store.get(key) ?? null\n }\n\n set(key: string, value: string): void {\n this.store.set(key, value)\n }\n\n remove(key: string): void {\n this.store.delete(key)\n }\n}\n\nexport function createDefaultStorage(): SDKStorage {\n if (typeof window !== 'undefined' && window.localStorage) {\n return new LocalStorageAdapter()\n }\n return new InMemoryStorage()\n}\n"],"mappings":";;;AAMA,IAAa,sBAAb,MAAuD;CACrD,IAAI,KAA4B;AAC9B,SAAO,OAAO,aAAa,QAAQ,IAAI;;CAGzC,IAAI,KAAa,OAAqB;AACpC,SAAO,aAAa,QAAQ,KAAK,MAAM;;CAGzC,OAAO,KAAmB;AACxB,SAAO,aAAa,WAAW,IAAI;;;AAIvC,IAAa,kBAAb,MAAmD;;+CACzC,yBAAQ,IAAI,KAAqB,CAAA;;CAEzC,IAAI,KAA4B;AAC9B,SAAO,KAAK,MAAM,IAAI,IAAI,IAAI;;CAGhC,IAAI,KAAa,OAAqB;AACpC,OAAK,MAAM,IAAI,KAAK,MAAM;;CAG5B,OAAO,KAAmB;AACxB,OAAK,MAAM,OAAO,IAAI;;;AAI1B,SAAgB,uBAAmC;AACjD,KAAI,OAAO,WAAW,eAAe,OAAO,aAC1C,QAAO,IAAI,qBAAqB;AAElC,QAAO,IAAI,iBAAiB"}
|