@lifi/sdk 2.3.1 → 3.0.0-alpha.10
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/LiFi.js +222 -250
- package/dist/cjs/LiFi.js.map +1 -0
- package/dist/cjs/allowance/getAllowance.js +82 -0
- package/dist/cjs/allowance/getAllowance.js.map +1 -0
- package/dist/cjs/allowance/index.js +5 -16
- package/dist/cjs/allowance/index.js.map +1 -0
- package/dist/cjs/allowance/setAllowance.js +71 -0
- package/dist/cjs/allowance/setAllowance.js.map +1 -0
- package/dist/cjs/{types/internal.types.js → allowance/types.js} +1 -0
- package/dist/cjs/allowance/types.js.map +1 -0
- package/dist/cjs/balance/getBalance.js +97 -0
- package/dist/cjs/balance/getBalance.js.map +1 -0
- package/dist/cjs/balance/getTokenBalance.js +7 -10
- package/dist/cjs/balance/getTokenBalance.js.map +1 -0
- package/dist/cjs/balance/index.js +4 -24
- package/dist/cjs/balance/index.js.map +1 -0
- package/dist/cjs/connectors.js +28 -48
- package/dist/cjs/connectors.js.map +1 -0
- package/dist/cjs/constants.js +7 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/execution/BaseStepExecutor.js +54 -0
- package/dist/cjs/execution/BaseStepExecutor.js.map +1 -0
- package/dist/cjs/execution/EVMStepExecutor.js +271 -0
- package/dist/cjs/execution/EVMStepExecutor.js.map +1 -0
- package/dist/cjs/execution/RouteExecutionManager.js +196 -197
- package/dist/cjs/execution/RouteExecutionManager.js.map +1 -0
- package/dist/cjs/execution/StatusManager.js +142 -136
- package/dist/cjs/execution/StatusManager.js.map +1 -0
- package/dist/cjs/execution/StepExecutionManager.js +220 -233
- package/dist/cjs/execution/StepExecutionManager.js.map +1 -0
- package/dist/cjs/execution/checkAllowance.js +76 -0
- package/dist/cjs/execution/checkAllowance.js.map +1 -0
- package/dist/cjs/execution/checkBalance.js +42 -0
- package/dist/cjs/execution/checkBalance.js.map +1 -0
- package/dist/cjs/execution/index.js +4 -15
- package/dist/cjs/execution/index.js.map +1 -0
- package/dist/cjs/execution/multisig.js +13 -17
- package/dist/cjs/execution/multisig.js.map +1 -0
- package/dist/cjs/execution/prepareRestart.js +23 -0
- package/dist/cjs/execution/prepareRestart.js.map +1 -0
- package/dist/cjs/execution/stepComparison.js +5 -17
- package/dist/cjs/execution/stepComparison.js.map +1 -0
- package/dist/cjs/execution/switchChain.js +10 -22
- package/dist/cjs/execution/switchChain.js.map +1 -0
- package/dist/cjs/execution/types.js +3 -0
- package/dist/cjs/execution/types.js.map +1 -0
- package/dist/cjs/execution/utils.js +12 -67
- package/dist/cjs/execution/utils.js.map +1 -0
- package/dist/cjs/execution/waitForReceivingTransaction.js +56 -0
- package/dist/cjs/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/cjs/helpers.js +12 -58
- package/dist/cjs/helpers.js.map +1 -0
- package/dist/cjs/index.js +16 -22
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/providers/EVM.js +35 -0
- package/dist/cjs/providers/EVM.js.map +1 -0
- package/dist/cjs/providers/Solana.js +38 -0
- package/dist/cjs/providers/Solana.js.map +1 -0
- package/dist/cjs/providers/index.js +5 -0
- package/dist/cjs/providers/index.js.map +1 -0
- package/dist/cjs/providers/types.js +9 -0
- package/dist/cjs/providers/types.js.map +1 -0
- package/dist/cjs/request.js +10 -13
- package/dist/cjs/request.js.map +1 -0
- package/dist/cjs/services/ApiService.js +70 -86
- package/dist/cjs/services/ApiService.js.map +1 -0
- package/dist/cjs/services/ChainsService.js +19 -9
- package/dist/cjs/services/ChainsService.js.map +1 -0
- package/dist/cjs/services/ConfigService.js +94 -67
- package/dist/cjs/services/ConfigService.js.map +1 -0
- package/dist/cjs/typeguards.js +1 -0
- package/dist/cjs/typeguards.js.map +1 -0
- package/dist/cjs/types/abi.js +46 -0
- package/dist/cjs/types/abi.js.map +1 -0
- package/dist/cjs/types/index.js +4 -20
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/internal.js +3 -0
- package/dist/cjs/types/internal.js.map +1 -0
- package/dist/cjs/utils/errors.js +63 -40
- package/dist/cjs/utils/errors.js.map +1 -0
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js +23 -0
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/median.js +16 -0
- package/dist/cjs/utils/median.js.map +1 -0
- package/dist/cjs/utils/parseError.js +55 -92
- package/dist/cjs/utils/parseError.js.map +1 -0
- package/dist/cjs/utils/utils.js +10 -85
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/cjs/version.js +2 -1
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/LiFi.js +375 -0
- package/dist/esm/LiFi.js.map +1 -0
- package/dist/esm/allowance/getAllowance.js +79 -0
- package/dist/esm/allowance/getAllowance.js.map +1 -0
- package/dist/esm/allowance/index.js +4 -0
- package/dist/esm/allowance/index.js.map +1 -0
- package/dist/esm/allowance/setAllowance.js +67 -0
- package/dist/esm/allowance/setAllowance.js.map +1 -0
- package/dist/esm/allowance/types.js +2 -0
- package/dist/esm/allowance/types.js.map +1 -0
- package/dist/esm/balance/getBalance.js +93 -0
- package/dist/esm/balance/getBalance.js.map +1 -0
- package/dist/{balance → esm/balance}/getTokenBalance.js +5 -4
- package/dist/esm/balance/getTokenBalance.js.map +1 -0
- package/dist/esm/balance/index.js +3 -0
- package/dist/esm/balance/index.js.map +1 -0
- package/dist/esm/connectors.js +42 -0
- package/dist/esm/connectors.js.map +1 -0
- package/dist/esm/constants.js +7 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/execution/BaseStepExecutor.js +51 -0
- package/dist/esm/execution/BaseStepExecutor.js.map +1 -0
- package/dist/esm/execution/EVMStepExecutor.js +299 -0
- package/dist/esm/execution/EVMStepExecutor.js.map +1 -0
- package/dist/esm/execution/RouteExecutionManager.js +268 -0
- package/dist/esm/execution/RouteExecutionManager.js.map +1 -0
- package/dist/esm/execution/StatusManager.js +216 -0
- package/dist/esm/execution/StatusManager.js.map +1 -0
- package/dist/esm/execution/StepExecutionManager.js +280 -0
- package/dist/esm/execution/StepExecutionManager.js.map +1 -0
- package/dist/esm/execution/checkAllowance.js +74 -0
- package/dist/esm/execution/checkAllowance.js.map +1 -0
- package/dist/esm/execution/checkBalance.js +39 -0
- package/dist/esm/execution/checkBalance.js.map +1 -0
- package/dist/esm/execution/index.js +3 -0
- package/dist/esm/execution/index.js.map +1 -0
- package/dist/esm/execution/multisig.js +26 -0
- package/dist/esm/execution/multisig.js.map +1 -0
- package/dist/esm/execution/prepareRestart.js +64 -0
- package/dist/esm/execution/prepareRestart.js.map +1 -0
- package/dist/{execution → esm/execution}/stepComparison.js +5 -4
- package/dist/esm/execution/stepComparison.js.map +1 -0
- package/dist/{execution → esm/execution}/switchChain.js +19 -12
- package/dist/esm/execution/switchChain.js.map +1 -0
- package/dist/esm/execution/types.js +2 -0
- package/dist/esm/execution/types.js.map +1 -0
- package/dist/esm/execution/utils.js +80 -0
- package/dist/esm/execution/utils.js.map +1 -0
- package/dist/esm/execution/waitForReceivingTransaction.js +52 -0
- package/dist/esm/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/{helpers.js → esm/helpers.js} +9 -37
- package/dist/esm/helpers.js.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/providers/EVM.js +30 -0
- package/dist/esm/providers/EVM.js.map +1 -0
- package/dist/esm/providers/Solana.js +34 -0
- package/dist/esm/providers/Solana.js.map +1 -0
- package/dist/esm/providers/index.js +2 -0
- package/dist/esm/providers/index.js.map +1 -0
- package/dist/esm/providers/types.js +6 -0
- package/dist/esm/providers/types.js.map +1 -0
- package/dist/{request.js → esm/request.js} +6 -5
- package/dist/esm/request.js.map +1 -0
- package/dist/{services → esm/services}/ApiService.js +29 -26
- package/dist/esm/services/ApiService.js.map +1 -0
- package/dist/{services → esm/services}/ChainsService.js +16 -4
- package/dist/esm/services/ChainsService.js.map +1 -0
- package/dist/esm/services/ConfigService.js +143 -0
- package/dist/esm/services/ConfigService.js.map +1 -0
- package/dist/{typeguards.js → esm/typeguards.js} +1 -0
- package/dist/esm/typeguards.js.map +1 -0
- package/dist/esm/types/abi.js +43 -0
- package/dist/esm/types/abi.js.map +1 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/internal.js +2 -0
- package/dist/esm/types/internal.js.map +1 -0
- package/dist/{utils → esm/utils}/errors.js +61 -35
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/esm/utils/getMaxPriorityFeePerGas.js +19 -0
- package/dist/esm/utils/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/median.js +12 -0
- package/dist/esm/utils/median.js.map +1 -0
- package/dist/{utils → esm/utils}/parseError.js +45 -41
- package/dist/esm/utils/parseError.js.map +1 -0
- package/dist/esm/utils/utils.js +38 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/version.js +3 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/LiFi.d.ts +179 -0
- package/dist/types/LiFi.d.ts.map +1 -0
- package/dist/types/allowance/getAllowance.d.ts +7 -0
- package/dist/types/allowance/getAllowance.d.ts.map +1 -0
- package/dist/types/allowance/index.d.ts +4 -0
- package/dist/types/allowance/index.d.ts.map +1 -0
- package/dist/types/allowance/setAllowance.d.ts +7 -0
- package/dist/types/allowance/setAllowance.d.ts.map +1 -0
- package/dist/types/allowance/types.d.ts +28 -0
- package/dist/types/allowance/types.d.ts.map +1 -0
- package/dist/types/balance/getBalance.d.ts +3 -0
- package/dist/types/balance/getBalance.d.ts.map +1 -0
- package/dist/{balance → types/balance}/getTokenBalance.d.ts +3 -2
- package/dist/types/balance/getTokenBalance.d.ts.map +1 -0
- package/dist/types/balance/index.d.ts +3 -0
- package/dist/types/balance/index.d.ts.map +1 -0
- package/dist/types/connectors.d.ts +9 -0
- package/dist/types/connectors.d.ts.map +1 -0
- package/dist/types/constants.d.ts +7 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/execution/BaseStepExecutor.d.ts +13 -0
- package/dist/types/execution/BaseStepExecutor.d.ts.map +1 -0
- package/dist/types/execution/EVMStepExecutor.d.ts +14 -0
- package/dist/types/execution/EVMStepExecutor.d.ts.map +1 -0
- package/dist/types/execution/RouteExecutionManager.d.ts +61 -0
- package/dist/types/execution/RouteExecutionManager.d.ts.map +1 -0
- package/dist/types/execution/StatusManager.d.ts +69 -0
- package/dist/types/execution/StatusManager.d.ts.map +1 -0
- package/dist/types/execution/StepExecutionManager.d.ts +8 -0
- package/dist/types/execution/StepExecutionManager.d.ts.map +1 -0
- package/dist/types/execution/checkAllowance.d.ts +6 -0
- package/dist/types/execution/checkAllowance.d.ts.map +1 -0
- package/dist/types/execution/checkBalance.d.ts +3 -0
- package/dist/types/execution/checkBalance.d.ts.map +1 -0
- package/dist/types/execution/index.d.ts +3 -0
- package/dist/types/execution/index.d.ts.map +1 -0
- package/dist/types/execution/multisig.d.ts +5 -0
- package/dist/types/execution/multisig.d.ts.map +1 -0
- package/dist/types/execution/prepareRestart.d.ts +3 -0
- package/dist/types/execution/prepareRestart.d.ts.map +1 -0
- package/dist/{execution → types/execution}/stepComparison.d.ts +6 -4
- package/dist/types/execution/stepComparison.d.ts.map +1 -0
- package/dist/types/execution/switchChain.d.ts +23 -0
- package/dist/types/execution/switchChain.d.ts.map +1 -0
- package/dist/types/execution/types.d.ts +83 -0
- package/dist/types/execution/types.d.ts.map +1 -0
- package/dist/types/execution/utils.d.ts +13 -0
- package/dist/types/execution/utils.d.ts.map +1 -0
- package/dist/types/execution/waitForReceivingTransaction.d.ts +4 -0
- package/dist/types/execution/waitForReceivingTransaction.d.ts.map +1 -0
- package/dist/types/helpers.d.ts +19 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -3
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/providers/EVM.d.ts +11 -0
- package/dist/types/providers/EVM.d.ts.map +1 -0
- package/dist/types/providers/Solana.d.ts +10 -0
- package/dist/types/providers/Solana.d.ts.map +1 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/providers/index.d.ts.map +1 -0
- package/dist/types/providers/types.d.ts +13 -0
- package/dist/types/providers/types.d.ts.map +1 -0
- package/dist/{request.d.ts → types/request.d.ts} +1 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/{cjs → types}/services/ApiService.d.ts +5 -5
- package/dist/types/services/ApiService.d.ts.map +1 -0
- package/dist/{services → types/services}/ChainsService.d.ts +3 -2
- package/dist/types/services/ChainsService.d.ts.map +1 -0
- package/dist/{services → types/services}/ConfigService.d.ts +10 -6
- package/dist/types/services/ConfigService.d.ts.map +1 -0
- package/dist/{cjs → types}/typeguards.d.ts +3 -2
- package/dist/types/typeguards.d.ts.map +1 -0
- package/dist/types/types/abi.d.ts +6 -0
- package/dist/types/types/abi.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/internal.d.ts +61 -0
- package/dist/types/types/internal.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/errors.d.ts +16 -14
- package/dist/types/utils/errors.d.ts.map +1 -0
- package/dist/types/utils/getMaxPriorityFeePerGas.d.ts +3 -0
- package/dist/types/utils/getMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/median.d.ts +2 -0
- package/dist/types/utils/median.d.ts.map +1 -0
- package/dist/{utils → types/utils}/parseError.d.ts +7 -6
- package/dist/types/utils/parseError.d.ts.map +1 -0
- package/dist/types/utils/utils.d.ts +11 -0
- package/dist/types/utils/utils.d.ts.map +1 -0
- package/dist/types/version.d.ts +3 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +37 -95
- package/dist/LiFi.d.ts +0 -164
- package/dist/LiFi.js +0 -235
- package/dist/allowance/checkAllowance.d.ts +0 -4
- package/dist/allowance/checkAllowance.js +0 -96
- package/dist/allowance/index.d.ts +0 -2
- package/dist/allowance/index.js +0 -2
- package/dist/allowance/tokenApproval.d.ts +0 -22
- package/dist/allowance/tokenApproval.js +0 -59
- package/dist/allowance/utils.d.ts +0 -14
- package/dist/allowance/utils.js +0 -72
- package/dist/balance/checkBalance.d.ts +0 -3
- package/dist/balance/checkBalance.js +0 -38
- package/dist/balance/index.d.ts +0 -13
- package/dist/balance/index.js +0 -10
- package/dist/balance/utils.d.ts +0 -6
- package/dist/balance/utils.js +0 -143
- package/dist/cjs/LiFi.d.ts +0 -164
- package/dist/cjs/allowance/checkAllowance.d.ts +0 -4
- package/dist/cjs/allowance/checkAllowance.js +0 -103
- package/dist/cjs/allowance/index.d.ts +0 -2
- package/dist/cjs/allowance/tokenApproval.d.ts +0 -22
- package/dist/cjs/allowance/tokenApproval.js +0 -69
- package/dist/cjs/allowance/utils.d.ts +0 -14
- package/dist/cjs/allowance/utils.js +0 -82
- package/dist/cjs/balance/checkBalance.d.ts +0 -3
- package/dist/cjs/balance/checkBalance.js +0 -45
- package/dist/cjs/balance/getTokenBalance.d.ts +0 -8
- package/dist/cjs/balance/index.d.ts +0 -13
- package/dist/cjs/balance/utils.d.ts +0 -6
- package/dist/cjs/balance/utils.js +0 -150
- package/dist/cjs/connectors.d.ts +0 -6
- package/dist/cjs/execution/RouteExecutionManager.d.ts +0 -65
- package/dist/cjs/execution/StatusManager.d.ts +0 -68
- package/dist/cjs/execution/StepExecutionManager.d.ts +0 -7
- package/dist/cjs/execution/StepExecutor.d.ts +0 -15
- package/dist/cjs/execution/StepExecutor.js +0 -62
- package/dist/cjs/execution/index.d.ts +0 -1
- package/dist/cjs/execution/multisig.d.ts +0 -3
- package/dist/cjs/execution/stepComparison.d.ts +0 -14
- package/dist/cjs/execution/switchChain.d.ts +0 -16
- package/dist/cjs/execution/utils.d.ts +0 -6
- package/dist/cjs/helpers.d.ts +0 -28
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/request.d.ts +0 -9
- package/dist/cjs/services/ChainsService.d.ts +0 -11
- package/dist/cjs/services/ConfigService.d.ts +0 -23
- package/dist/cjs/types/ERC20.d.ts +0 -22
- package/dist/cjs/types/ERC20.js +0 -53
- package/dist/cjs/types/index.d.ts +0 -4
- package/dist/cjs/types/internal.types.d.ts +0 -151
- package/dist/cjs/utils/getProvider.d.ts +0 -3
- package/dist/cjs/utils/getProvider.js +0 -11
- package/dist/cjs/utils/multicall.d.ts +0 -10
- package/dist/cjs/utils/multicall.js +0 -68
- package/dist/cjs/utils/multicallAbi.json +0 -313
- package/dist/cjs/utils/parseError.d.ts +0 -37
- package/dist/cjs/utils/preRestart.d.ts +0 -3
- package/dist/cjs/utils/preRestart.js +0 -56
- package/dist/cjs/utils/utils.d.ts +0 -25
- package/dist/cjs/version.d.ts +0 -2
- package/dist/connectors.d.ts +0 -6
- package/dist/connectors.js +0 -57
- package/dist/execution/RouteExecutionManager.d.ts +0 -65
- package/dist/execution/RouteExecutionManager.js +0 -213
- package/dist/execution/StatusManager.d.ts +0 -68
- package/dist/execution/StatusManager.js +0 -168
- package/dist/execution/StepExecutionManager.d.ts +0 -7
- package/dist/execution/StepExecutionManager.js +0 -267
- package/dist/execution/StepExecutor.d.ts +0 -15
- package/dist/execution/StepExecutor.js +0 -58
- package/dist/execution/index.d.ts +0 -1
- package/dist/execution/index.js +0 -1
- package/dist/execution/multisig.d.ts +0 -3
- package/dist/execution/multisig.js +0 -27
- package/dist/execution/switchChain.d.ts +0 -16
- package/dist/execution/utils.d.ts +0 -6
- package/dist/execution/utils.js +0 -122
- package/dist/helpers.d.ts +0 -28
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/services/ApiService.d.ts +0 -17
- package/dist/services/ConfigService.js +0 -101
- package/dist/typeguards.d.ts +0 -4
- package/dist/types/ERC20.d.ts +0 -22
- package/dist/types/ERC20.js +0 -50
- package/dist/types/index.js +0 -4
- package/dist/types/internal.types.d.ts +0 -151
- package/dist/types/internal.types.js +0 -1
- package/dist/utils/errors.d.ts +0 -106
- package/dist/utils/getProvider.d.ts +0 -3
- package/dist/utils/getProvider.js +0 -7
- package/dist/utils/multicall.d.ts +0 -10
- package/dist/utils/multicall.js +0 -61
- package/dist/utils/multicallAbi.json +0 -313
- package/dist/utils/preRestart.d.ts +0 -3
- package/dist/utils/preRestart.js +0 -52
- package/dist/utils/utils.d.ts +0 -25
- package/dist/utils/utils.js +0 -99
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -2
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StatusManager } from '.';
|
|
2
|
-
import { InternalExecutionSettings, LifiStep } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* This method checks whether the new and updated Step meets the required exchange rate conditions.
|
|
5
|
-
* If yes it returns the updated Step.
|
|
6
|
-
* If no and if user interaction is allowed it triggers the acceptExchangeRateUpdateHook. If no user interaction is allowed it aborts.
|
|
7
|
-
*
|
|
8
|
-
* @param statusManager
|
|
9
|
-
* @param oldStep
|
|
10
|
-
* @param newStep
|
|
11
|
-
* @param settings
|
|
12
|
-
* @param allowUserInteraction
|
|
13
|
-
*/
|
|
14
|
-
export declare const stepComparison: (statusManager: StatusManager, oldStep: LifiStep, newStep: LifiStep, settings: InternalExecutionSettings, allowUserInteraction: boolean) => Promise<LifiStep>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LifiStep } from '@lifi/types';
|
|
2
|
-
import { Signer } from 'ethers';
|
|
3
|
-
import { SwitchChainHook } from '../types';
|
|
4
|
-
import { StatusManager } from './StatusManager';
|
|
5
|
-
/**
|
|
6
|
-
* This method checks whether the signer is configured for the correct chain.
|
|
7
|
-
* If yes it returns the signer.
|
|
8
|
-
* If no and if user interaction is allowed it triggers the switchChainHook. If no user interaction is allowed it aborts.
|
|
9
|
-
*
|
|
10
|
-
* @param signer
|
|
11
|
-
* @param statusManager
|
|
12
|
-
* @param step
|
|
13
|
-
* @param switchChainHook
|
|
14
|
-
* @param allowUserInteraction
|
|
15
|
-
*/
|
|
16
|
-
export declare const switchChain: (signer: Signer, statusManager: StatusManager, step: LifiStep, switchChainHook: SwitchChainHook, allowUserInteraction: boolean) => Promise<Signer | undefined>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LifiStep, ProcessType, Status, StatusMessage, StatusResponse, Substatus } from '@lifi/types';
|
|
2
|
-
import { StatusManager } from '..';
|
|
3
|
-
export declare function waitForReceivingTransaction(txHash: string, statusManager: StatusManager, processType: ProcessType, step: LifiStep): Promise<StatusResponse>;
|
|
4
|
-
export declare function getProcessMessage(type: ProcessType, status: Status): string | undefined;
|
|
5
|
-
export declare function getSubstatusMessage(status: StatusMessage, substatus?: Substatus): string | undefined;
|
|
6
|
-
export declare function checkStepSlippageThreshold(oldStep: LifiStep, newStep: LifiStep): boolean;
|
package/dist/cjs/helpers.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { LifiStep, Route, Token } from '@lifi/types';
|
|
2
|
-
import { TenderlyResponse } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Predefined hook that decrypts calldata using EIP-1193 compliant wallet functions.
|
|
5
|
-
* @param {string} walletAddress - The wallet address of the user that should decrypt the calldata.
|
|
6
|
-
* @return {(encryptedData: string) => Promise<any>} A function that decrypts data using EIP-1193 compliant wallet functions.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getEthereumDecryptionHook: (walletAddress: string) => (encryptedData: string) => Promise<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Predefined hook that get the public encryption key of a user using EIP-1193 compliant wallet functions.
|
|
11
|
-
* @param {string} walletAddress - The wallet address of the user.
|
|
12
|
-
* @return {(walletAddress: string) => () => Promise<any>} A function that return the public encryption key using EIP-1193 compliant wallet functions.
|
|
13
|
-
*/
|
|
14
|
-
export declare const getEthereumPublicKeyHook: (walletAddress: string) => () => Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Returns a random number between min (inclusive) and max (inclusive)
|
|
17
|
-
*/
|
|
18
|
-
export declare const getRandomNumber: (min: number, max: number) => number;
|
|
19
|
-
export declare const isSameToken: (tokenA: Token, tokenB: Token) => boolean;
|
|
20
|
-
export declare const checkPackageUpdates: (packageName?: string, packageVersion?: string, disableCheck?: boolean) => Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Converts a quote to Route
|
|
23
|
-
* @param {LifiStep} step - Step returned from the quote endpoint.
|
|
24
|
-
* @return {Route} - The route to be executed.
|
|
25
|
-
* @throws {ValidationError} Throws a ValidationError if the step has missing values.
|
|
26
|
-
*/
|
|
27
|
-
export declare const convertQuoteToRoute: (step: LifiStep) => Route;
|
|
28
|
-
export declare const fetchTxErrorDetails: (txHash: string, chainId: number) => Promise<TenderlyResponse>;
|
package/dist/cjs/index.d.ts
DELETED
package/dist/cjs/request.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const requestSettings: {
|
|
2
|
-
retries: number;
|
|
3
|
-
};
|
|
4
|
-
interface ExtendedRequestInit extends RequestInit {
|
|
5
|
-
retries?: number;
|
|
6
|
-
skipTrackingHeaders?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const request: <T = Response>(url: RequestInfo | URL, options?: ExtendedRequestInit) => Promise<T>;
|
|
9
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ChainId, ExtendedChain } from '@lifi/types';
|
|
2
|
-
export default class ChainsService {
|
|
3
|
-
private static instance;
|
|
4
|
-
private readonly loadingPromise;
|
|
5
|
-
private chains;
|
|
6
|
-
constructor();
|
|
7
|
-
private loadAvailableChains;
|
|
8
|
-
static getInstance(): ChainsService;
|
|
9
|
-
getChainById(chainId: ChainId): Promise<ExtendedChain>;
|
|
10
|
-
getChains(): Promise<ExtendedChain[]>;
|
|
11
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Chain, Config, ConfigUpdate } from '../types';
|
|
2
|
-
export default class ConfigService {
|
|
3
|
-
private static instance;
|
|
4
|
-
private readonly config;
|
|
5
|
-
private readonly setupPromise;
|
|
6
|
-
private resolveSetupPromise;
|
|
7
|
-
constructor();
|
|
8
|
-
private static chainIdToObject;
|
|
9
|
-
private static getDefaultConfig;
|
|
10
|
-
static getInstance(): ConfigService;
|
|
11
|
-
/**
|
|
12
|
-
* This call immediately returns the current config. It does not make sure that all chain data is already loaded
|
|
13
|
-
* Use this if you need access to basic information like API urls or settings
|
|
14
|
-
*/
|
|
15
|
-
getConfig: () => Config;
|
|
16
|
-
/**
|
|
17
|
-
* This call waits for all setup promises to be done.
|
|
18
|
-
* Use this if you need access to chain data (RPCs or multicalls)
|
|
19
|
-
*/
|
|
20
|
-
getConfigAsync: () => Promise<Config>;
|
|
21
|
-
updateConfig: (configUpdate: Partial<ConfigUpdate>) => Config;
|
|
22
|
-
updateChains: (chains: Chain[]) => Config;
|
|
23
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseContract, BigNumber, BigNumberish, CallOverrides, ContractTransaction, Overrides } from 'ethers';
|
|
2
|
-
export declare const ERC20_ABI: {
|
|
3
|
-
name: string;
|
|
4
|
-
inputs: {
|
|
5
|
-
internalType: string;
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
}[];
|
|
9
|
-
outputs: {
|
|
10
|
-
internalType: string;
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
}[];
|
|
14
|
-
stateMutability: string;
|
|
15
|
-
type: string;
|
|
16
|
-
}[];
|
|
17
|
-
export interface ERC20Contract extends BaseContract {
|
|
18
|
-
allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
19
|
-
approve(spender: string, amount: BigNumberish, overrides?: Overrides & {
|
|
20
|
-
from?: string | Promise<string>;
|
|
21
|
-
}): Promise<ContractTransaction>;
|
|
22
|
-
}
|
package/dist/cjs/types/ERC20.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERC20_ABI = void 0;
|
|
4
|
-
exports.ERC20_ABI = [
|
|
5
|
-
{
|
|
6
|
-
name: 'approve',
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
9
|
-
internalType: 'address',
|
|
10
|
-
name: 'spender',
|
|
11
|
-
type: 'address',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
internalType: 'uint256',
|
|
15
|
-
name: 'amount',
|
|
16
|
-
type: 'uint256',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
outputs: [
|
|
20
|
-
{
|
|
21
|
-
internalType: 'bool',
|
|
22
|
-
name: '',
|
|
23
|
-
type: 'bool',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
stateMutability: 'nonpayable',
|
|
27
|
-
type: 'function',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'allowance',
|
|
31
|
-
inputs: [
|
|
32
|
-
{
|
|
33
|
-
internalType: 'address',
|
|
34
|
-
name: 'owner',
|
|
35
|
-
type: 'address',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
internalType: 'address',
|
|
39
|
-
name: 'spender',
|
|
40
|
-
type: 'address',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
outputs: [
|
|
44
|
-
{
|
|
45
|
-
internalType: 'uint256',
|
|
46
|
-
name: '',
|
|
47
|
-
type: 'uint256',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
stateMutability: 'view',
|
|
51
|
-
type: 'function',
|
|
52
|
-
},
|
|
53
|
-
];
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { TransactionRequest } from '@ethersproject/abstract-provider';
|
|
2
|
-
import { LifiStep, Route, RouteOptions, Token } from '@lifi/types';
|
|
3
|
-
import BigNumber from 'bignumber.js';
|
|
4
|
-
import { Signer } from 'ethers';
|
|
5
|
-
import { ChainId } from '.';
|
|
6
|
-
import { StatusManager } from '../execution/StatusManager';
|
|
7
|
-
import { StepExecutor } from '../execution/StepExecutor';
|
|
8
|
-
export interface TokenWithAmounts extends Token {
|
|
9
|
-
amount?: BigNumber;
|
|
10
|
-
amountRendered?: string;
|
|
11
|
-
}
|
|
12
|
-
export type ParsedReceipt = {
|
|
13
|
-
fromAmount?: string;
|
|
14
|
-
toAmount: string;
|
|
15
|
-
gasUsed: string;
|
|
16
|
-
gasPrice: string;
|
|
17
|
-
gasFee: string;
|
|
18
|
-
toTokenAddress?: string;
|
|
19
|
-
};
|
|
20
|
-
export interface ExecutionParams {
|
|
21
|
-
signer: Signer;
|
|
22
|
-
step: LifiStep;
|
|
23
|
-
statusManager: StatusManager;
|
|
24
|
-
settings: InternalExecutionSettings;
|
|
25
|
-
}
|
|
26
|
-
export type UpdateRouteHook = (updatedRoute: Route) => void;
|
|
27
|
-
export type TransactionRequestUpdateHook = (updatedTxRequest: TransactionRequest) => Promise<TransactionRequest>;
|
|
28
|
-
export type Config = {
|
|
29
|
-
apiUrl: string;
|
|
30
|
-
apiKey?: string;
|
|
31
|
-
rpcs: Record<ChainId, string[]>;
|
|
32
|
-
multicallAddresses: Record<ChainId, string | undefined>;
|
|
33
|
-
defaultExecutionSettings: InternalExecutionSettings;
|
|
34
|
-
defaultRouteOptions: RouteOptions;
|
|
35
|
-
disableVersionCheck?: boolean;
|
|
36
|
-
userId?: string;
|
|
37
|
-
integrator: string;
|
|
38
|
-
widgetVersion?: string;
|
|
39
|
-
multisigConfig?: MultisigConfig;
|
|
40
|
-
};
|
|
41
|
-
export interface MultisigTxDetails {
|
|
42
|
-
status: 'DONE' | 'FAILED' | 'PENDING' | 'CANCELLED';
|
|
43
|
-
txHash?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface MultisigTransactionResponse {
|
|
46
|
-
hash: string;
|
|
47
|
-
}
|
|
48
|
-
export interface BaseTransaction {
|
|
49
|
-
to: string;
|
|
50
|
-
value: string;
|
|
51
|
-
data: string;
|
|
52
|
-
}
|
|
53
|
-
export interface MultisigConfig {
|
|
54
|
-
isMultisigSigner?: boolean;
|
|
55
|
-
getMultisigTransactionDetails?: (txHash: string, fromChainId: number, updateIntermediateStatus?: () => void) => Promise<MultisigTxDetails>;
|
|
56
|
-
sendBatchTransaction?: (batchTransactions: BaseTransaction[]) => Promise<MultisigTransactionResponse>;
|
|
57
|
-
shouldBatchTransactions?: boolean;
|
|
58
|
-
}
|
|
59
|
-
export type ConfigUpdate = {
|
|
60
|
-
apiUrl?: string;
|
|
61
|
-
apiKey?: string;
|
|
62
|
-
rpcs?: Record<number, string[]>;
|
|
63
|
-
multicallAddresses?: Record<number, string | undefined>;
|
|
64
|
-
defaultExecutionSettings?: ExecutionSettings;
|
|
65
|
-
defaultRouteOptions?: RouteOptions;
|
|
66
|
-
disableVersionCheck?: boolean;
|
|
67
|
-
userId?: string;
|
|
68
|
-
integrator: string;
|
|
69
|
-
widgetVersion?: string;
|
|
70
|
-
multisigConfig?: MultisigConfig;
|
|
71
|
-
};
|
|
72
|
-
export type SwitchChainHook = (requiredChainId: number) => Promise<Signer | undefined>;
|
|
73
|
-
export interface AcceptSlippageUpdateHookParams {
|
|
74
|
-
toToken: Token;
|
|
75
|
-
oldToAmount: string;
|
|
76
|
-
newToAmount: string;
|
|
77
|
-
oldSlippage: number;
|
|
78
|
-
newSlippage: number;
|
|
79
|
-
}
|
|
80
|
-
export type AcceptSlippageUpdateHook = (params: AcceptSlippageUpdateHookParams) => Promise<boolean | undefined>;
|
|
81
|
-
export interface ExchangeRateUpdateParams {
|
|
82
|
-
toToken: Token;
|
|
83
|
-
oldToAmount: string;
|
|
84
|
-
newToAmount: string;
|
|
85
|
-
}
|
|
86
|
-
export type AcceptExchangeRateUpdateHook = (params: ExchangeRateUpdateParams) => Promise<boolean | undefined>;
|
|
87
|
-
export interface RouteExecutionData {
|
|
88
|
-
route: Route;
|
|
89
|
-
executors: StepExecutor[];
|
|
90
|
-
settings: InternalExecutionSettings;
|
|
91
|
-
}
|
|
92
|
-
export type ExecutionSettings = Partial<InternalExecutionSettings>;
|
|
93
|
-
export interface InternalExecutionSettings {
|
|
94
|
-
acceptExchangeRateUpdateHook: AcceptExchangeRateUpdateHook;
|
|
95
|
-
switchChainHook: SwitchChainHook;
|
|
96
|
-
updateRouteHook: UpdateRouteHook;
|
|
97
|
-
updateTransactionRequestHook?: TransactionRequestUpdateHook;
|
|
98
|
-
executeInBackground: boolean;
|
|
99
|
-
infiniteApproval: boolean;
|
|
100
|
-
}
|
|
101
|
-
export type RouteExecutionDictionary = Partial<Record<string, RouteExecutionData>>;
|
|
102
|
-
export type RouteExecutionPromiseDictionary = Partial<Record<string, Promise<Route>>>;
|
|
103
|
-
export type RevokeTokenData = {
|
|
104
|
-
token: Token;
|
|
105
|
-
approvalAddress: string;
|
|
106
|
-
};
|
|
107
|
-
export interface InteractionSettings {
|
|
108
|
-
allowInteraction?: boolean;
|
|
109
|
-
allowUpdates?: boolean;
|
|
110
|
-
stopExecution?: boolean;
|
|
111
|
-
}
|
|
112
|
-
export interface TenderlyResponse {
|
|
113
|
-
hash: string;
|
|
114
|
-
block_hash: string;
|
|
115
|
-
block_number: number;
|
|
116
|
-
from: string;
|
|
117
|
-
gas: number;
|
|
118
|
-
gas_price: number;
|
|
119
|
-
gas_fee_cap: number;
|
|
120
|
-
gas_tip_cap: number;
|
|
121
|
-
cumulative_gas_used: number;
|
|
122
|
-
gas_used: number;
|
|
123
|
-
effective_gas_price: number;
|
|
124
|
-
input: string;
|
|
125
|
-
nonce: number;
|
|
126
|
-
to: string;
|
|
127
|
-
index: number;
|
|
128
|
-
value: string;
|
|
129
|
-
access_list: any;
|
|
130
|
-
status: boolean;
|
|
131
|
-
addresses: string[];
|
|
132
|
-
contract_ids: string[];
|
|
133
|
-
network_id: string;
|
|
134
|
-
timestamp: string;
|
|
135
|
-
function_selector: string;
|
|
136
|
-
l1_block_number: number;
|
|
137
|
-
l1_timestamp: number;
|
|
138
|
-
deposit_tx: boolean;
|
|
139
|
-
system_tx: boolean;
|
|
140
|
-
mint: number;
|
|
141
|
-
sig: Signature;
|
|
142
|
-
error_message: string;
|
|
143
|
-
method: string;
|
|
144
|
-
decoded_input: any;
|
|
145
|
-
call_trace: any;
|
|
146
|
-
}
|
|
147
|
-
export interface Signature {
|
|
148
|
-
v: string;
|
|
149
|
-
r: string;
|
|
150
|
-
s: string;
|
|
151
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProvider = void 0;
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
const getProvider = (signer) => {
|
|
6
|
-
if (!signer.provider) {
|
|
7
|
-
throw new errors_1.ProviderError(errors_1.LifiErrorCode.ProviderUnavailable, 'No provider available in signer.');
|
|
8
|
-
}
|
|
9
|
-
return signer.provider;
|
|
10
|
-
};
|
|
11
|
-
exports.getProvider = getProvider;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Fragment, JsonFragment } from '@ethersproject/abi';
|
|
2
|
-
export type MultiCallData = {
|
|
3
|
-
address: string;
|
|
4
|
-
name: string;
|
|
5
|
-
params?: any[];
|
|
6
|
-
};
|
|
7
|
-
export declare const fetchDataUsingMulticall: (calls: Array<MultiCallData>, abi: ReadonlyArray<Fragment | JsonFragment | string>, chainId: number, multicallAddress: string, requireSuccess?: boolean) => Promise<{
|
|
8
|
-
data: unknown;
|
|
9
|
-
blockNumber: number;
|
|
10
|
-
}[]>;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchDataUsingMulticall = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const contracts_1 = require("@ethersproject/contracts");
|
|
9
|
-
const connectors_1 = require("../connectors");
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
const multicallAbi_json_1 = __importDefault(require("./multicallAbi.json"));
|
|
12
|
-
const MAX_MULTICALL_SIZE = 100;
|
|
13
|
-
const fetchDataUsingMulticall = async (calls, abi, chainId, multicallAddress, requireSuccess = false) => {
|
|
14
|
-
// 1. create contract using multicall contract address and abi...
|
|
15
|
-
const provider = await (0, connectors_1.getRpcProvider)(chainId);
|
|
16
|
-
const multicallContract = new contracts_1.Contract(multicallAddress, multicallAbi_json_1.default, provider);
|
|
17
|
-
const abiInterface = new abi_1.Interface(abi);
|
|
18
|
-
// split up lists into chunks to stay below multicall limit
|
|
19
|
-
const chunkedList = (0, utils_1.splitListIntoChunks)(calls, MAX_MULTICALL_SIZE);
|
|
20
|
-
const chunkedResults = await Promise.all(chunkedList.map(async (chunkedCalls) => {
|
|
21
|
-
const callData = chunkedCalls.map((call) => [
|
|
22
|
-
call.address.toLowerCase(),
|
|
23
|
-
abiInterface.encodeFunctionData(call.name, call.params),
|
|
24
|
-
]);
|
|
25
|
-
try {
|
|
26
|
-
// 3. get bytes array from multicall contract by process aggregate method...
|
|
27
|
-
const { blockNumber, returnData } = await multicallContract.tryBlockAndAggregate(requireSuccess, callData);
|
|
28
|
-
// 4. decode bytes array to useful data array...
|
|
29
|
-
return returnData
|
|
30
|
-
.map(({ success, returnData }, i) => {
|
|
31
|
-
if (!success) {
|
|
32
|
-
// requested function failed
|
|
33
|
-
console.error(`Multicall unsuccessful for address "${chunkedCalls[i].address}", ` +
|
|
34
|
-
`function "${chunkedCalls[i].name}", chainId "${chainId}"`);
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
if (returnData.toString() === '0x') {
|
|
38
|
-
// requested function does probably not exist
|
|
39
|
-
console.error(`Multicall no response for address "${chunkedCalls[i].address}", ` +
|
|
40
|
-
`function "${chunkedCalls[i].name}", chainId "${chainId}"`);
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
return abiInterface.decodeFunctionResult(chunkedCalls[i].name, returnData);
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
// requested function returns other data than expected
|
|
48
|
-
console.error(`Multicall parsing unsuccessful for address "${chunkedCalls[i].address}", ` +
|
|
49
|
-
`function "${chunkedCalls[i].name}", chainId "${chainId}"`);
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
.map((data) => {
|
|
54
|
-
return {
|
|
55
|
-
data: data[0],
|
|
56
|
-
blockNumber: blockNumber.toNumber(),
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
// whole rpc call failed, probably an rpc issue
|
|
62
|
-
console.error(`Multicall failed on chainId "${chainId}"`, chunkedList, e);
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
return chunkedResults.flat();
|
|
67
|
-
};
|
|
68
|
-
exports.fetchDataUsingMulticall = fetchDataUsingMulticall;
|