@lifi/sdk 3.0.0-alpha.1 → 3.0.0-alpha.11
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 -261
- package/dist/cjs/LiFi.js.map +1 -0
- package/dist/cjs/allowance/getAllowance.js +13 -16
- package/dist/cjs/allowance/getAllowance.js.map +1 -0
- package/dist/cjs/allowance/index.js +5 -17
- package/dist/cjs/allowance/index.js.map +1 -0
- package/dist/cjs/allowance/setAllowance.js +33 -18
- package/dist/cjs/allowance/setAllowance.js.map +1 -0
- package/dist/cjs/allowance/types.js +1 -0
- package/dist/cjs/allowance/types.js.map +1 -0
- package/dist/cjs/balance/getBalance.js +14 -14
- package/dist/cjs/balance/getBalance.js.map +1 -0
- package/dist/cjs/balance/getTokenBalance.js +3 -3
- package/dist/cjs/balance/getTokenBalance.js.map +1 -0
- package/dist/cjs/balance/index.js +4 -16
- package/dist/cjs/balance/index.js.map +1 -0
- package/dist/cjs/connectors.js +7 -35
- package/dist/cjs/connectors.js.map +1 -0
- package/dist/cjs/constants.js +2 -4
- 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 -179
- package/dist/cjs/execution/RouteExecutionManager.js.map +1 -0
- package/dist/cjs/execution/StatusManager.js +142 -135
- package/dist/cjs/execution/StatusManager.js.map +1 -0
- package/dist/cjs/execution/StepExecutionManager.js +223 -229
- package/dist/cjs/execution/StepExecutionManager.js.map +1 -0
- package/dist/cjs/execution/checkAllowance.js +9 -10
- package/dist/cjs/execution/checkAllowance.js.map +1 -0
- package/dist/cjs/execution/checkBalance.js +5 -5
- 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 +6 -8
- package/dist/cjs/execution/multisig.js.map +1 -0
- package/dist/cjs/execution/prepareRestart.js +2 -44
- 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 +4 -21
- package/dist/cjs/execution/switchChain.js.map +1 -0
- package/dist/cjs/{types/internal.types.js → execution/types.js} +1 -0
- package/dist/cjs/execution/types.js.map +1 -0
- package/dist/cjs/execution/utils.js +1 -9
- package/dist/cjs/execution/utils.js.map +1 -0
- package/dist/cjs/execution/waitForReceivingTransaction.js +9 -11
- package/dist/cjs/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/cjs/helpers.js +11 -25
- 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 +19 -16
- package/dist/cjs/request.js.map +1 -0
- package/dist/cjs/services/ApiService.js +72 -90
- 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 -65
- 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 +1 -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 +25 -3
- package/dist/cjs/utils/errors.js.map +1 -0
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js +3 -2
- package/dist/cjs/utils/getMaxPriorityFeePerGas.js.map +1 -0
- package/dist/cjs/utils/index.js +7 -19
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/median.js +1 -0
- package/dist/cjs/utils/median.js.map +1 -0
- package/dist/cjs/utils/parseError.js +39 -79
- package/dist/cjs/utils/parseError.js.map +1 -0
- package/dist/cjs/utils/utils.js +5 -11
- 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/{allowance → esm/allowance}/getAllowance.js +5 -4
- 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/{allowance → esm/allowance}/setAllowance.js +28 -11
- 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/{balance → esm/balance}/getBalance.js +5 -5
- package/dist/esm/balance/getBalance.js.map +1 -0
- package/dist/{balance → esm/balance}/getTokenBalance.js +2 -1
- 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/{connectors.js → esm/connectors.js} +3 -2
- package/dist/esm/connectors.js.map +1 -0
- package/dist/{constants.js → esm/constants.js} +1 -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/{execution → esm/execution}/checkAllowance.js +5 -4
- package/dist/esm/execution/checkAllowance.js.map +1 -0
- package/dist/{execution → esm/execution}/checkBalance.js +3 -2
- 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/{execution → esm/execution}/multisig.js +3 -2
- 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 +4 -3
- package/dist/esm/execution/stepComparison.js.map +1 -0
- package/dist/{execution → esm/execution}/switchChain.js +3 -1
- 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/{execution → esm/execution}/utils.js +1 -0
- package/dist/esm/execution/utils.js.map +1 -0
- package/dist/{execution → esm/execution}/waitForReceivingTransaction.js +5 -4
- package/dist/esm/execution/waitForReceivingTransaction.js.map +1 -0
- package/dist/{helpers.js → esm/helpers.js} +4 -3
- 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} +16 -9
- package/dist/esm/request.js.map +1 -0
- package/dist/{services → esm/services}/ApiService.js +29 -28
- 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/{types → esm/types}/abi.js +1 -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 +25 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/{utils → esm/utils}/getMaxPriorityFeePerGas.js +2 -1
- 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/{utils → esm/utils}/median.js +1 -0
- package/dist/esm/utils/median.js.map +1 -0
- package/dist/{utils → esm/utils}/parseError.js +4 -3
- package/dist/esm/utils/parseError.js.map +1 -0
- package/dist/{utils → esm/utils}/utils.js +2 -1
- 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/{LiFi.d.ts → types/LiFi.d.ts} +29 -21
- package/dist/types/LiFi.d.ts.map +1 -0
- package/dist/{cjs → types}/allowance/getAllowance.d.ts +2 -1
- 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/{allowance → types/allowance}/types.d.ts +1 -0
- package/dist/types/allowance/types.d.ts.map +1 -0
- package/dist/{balance → types/balance}/getBalance.d.ts +1 -0
- package/dist/types/balance/getBalance.d.ts.map +1 -0
- package/dist/{balance → types/balance}/getTokenBalance.d.ts +1 -0
- 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/{cjs → types}/connectors.d.ts +2 -1
- package/dist/types/connectors.d.ts.map +1 -0
- package/dist/{cjs → types}/constants.d.ts +1 -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/{cjs → types}/execution/RouteExecutionManager.d.ts +10 -8
- package/dist/types/execution/RouteExecutionManager.d.ts.map +1 -0
- package/dist/{execution → types/execution}/StatusManager.d.ts +9 -7
- package/dist/types/execution/StatusManager.d.ts.map +1 -0
- package/dist/{execution → types/execution}/StepExecutionManager.d.ts +4 -3
- 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/{cjs → types}/execution/stepComparison.d.ts +6 -4
- package/dist/types/execution/stepComparison.d.ts.map +1 -0
- package/dist/{cjs → types}/execution/switchChain.d.ts +6 -4
- package/dist/types/execution/switchChain.d.ts.map +1 -0
- package/dist/types/{internal.types.d.ts → execution/types.d.ts} +38 -98
- package/dist/types/execution/types.d.ts.map +1 -0
- package/dist/{execution → types/execution}/utils.d.ts +3 -2
- 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/{helpers.d.ts → types/helpers.d.ts} +4 -3
- 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/{services → types/services}/ApiService.d.ts +5 -5
- package/dist/types/services/ApiService.d.ts.map +1 -0
- package/dist/{cjs → types}/services/ChainsService.d.ts +2 -1
- 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/{cjs → types}/types/abi.d.ts +1 -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 +1 -0
- package/dist/types/utils/errors.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/getMaxPriorityFeePerGas.d.ts +1 -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/{cjs → types}/utils/median.d.ts +1 -0
- package/dist/types/utils/median.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/parseError.d.ts +6 -5
- package/dist/types/utils/parseError.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/utils.d.ts +1 -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 -96
- package/dist/LiFi.js +0 -246
- package/dist/allowance/getAllowance.d.ts +0 -6
- package/dist/allowance/index.d.ts +0 -3
- package/dist/allowance/index.js +0 -3
- package/dist/allowance/setAllowance.d.ts +0 -5
- package/dist/allowance/types.js +0 -1
- package/dist/balance/index.d.ts +0 -2
- package/dist/balance/index.js +0 -2
- package/dist/cjs/LiFi.d.ts +0 -171
- package/dist/cjs/allowance/index.d.ts +0 -3
- package/dist/cjs/allowance/setAllowance.d.ts +0 -5
- package/dist/cjs/allowance/types.d.ts +0 -27
- package/dist/cjs/balance/getBalance.d.ts +0 -2
- package/dist/cjs/balance/getTokenBalance.d.ts +0 -8
- package/dist/cjs/balance/index.d.ts +0 -2
- package/dist/cjs/execution/StatusManager.d.ts +0 -67
- 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/checkAllowance.d.ts +0 -4
- package/dist/cjs/execution/checkBalance.d.ts +0 -2
- package/dist/cjs/execution/index.d.ts +0 -1
- package/dist/cjs/execution/multisig.d.ts +0 -4
- package/dist/cjs/execution/prepareRestart.d.ts +0 -3
- package/dist/cjs/execution/utils.d.ts +0 -12
- package/dist/cjs/execution/waitForReceivingTransaction.d.ts +0 -3
- package/dist/cjs/helpers.d.ts +0 -18
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/request.d.ts +0 -9
- package/dist/cjs/services/ApiService.d.ts +0 -17
- package/dist/cjs/services/ConfigService.d.ts +0 -23
- package/dist/cjs/types/index.d.ts +0 -4
- package/dist/cjs/types/internal.types.d.ts +0 -143
- package/dist/cjs/utils/index.d.ts +0 -5
- package/dist/cjs/version.d.ts +0 -2
- package/dist/connectors.d.ts +0 -8
- package/dist/constants.d.ts +0 -6
- package/dist/execution/RouteExecutionManager.d.ts +0 -59
- package/dist/execution/RouteExecutionManager.js +0 -195
- package/dist/execution/StatusManager.js +0 -167
- package/dist/execution/StepExecutionManager.js +0 -260
- package/dist/execution/StepExecutor.d.ts +0 -15
- package/dist/execution/StepExecutor.js +0 -58
- package/dist/execution/checkAllowance.d.ts +0 -4
- package/dist/execution/checkBalance.d.ts +0 -2
- package/dist/execution/index.d.ts +0 -1
- package/dist/execution/index.js +0 -1
- package/dist/execution/multisig.d.ts +0 -4
- package/dist/execution/prepareRestart.d.ts +0 -3
- package/dist/execution/prepareRestart.js +0 -61
- package/dist/execution/stepComparison.d.ts +0 -14
- package/dist/execution/switchChain.d.ts +0 -21
- package/dist/execution/waitForReceivingTransaction.d.ts +0 -3
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/services/ChainsService.d.ts +0 -11
- package/dist/services/ConfigService.js +0 -99
- package/dist/typeguards.d.ts +0 -4
- package/dist/types/abi.d.ts +0 -5
- package/dist/types/index.js +0 -4
- package/dist/types/internal.types.js +0 -1
- package/dist/utils/errors.d.ts +0 -107
- package/dist/utils/getMaxPriorityFeePerGas.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -5
- package/dist/utils/median.d.ts +0 -1
- package/dist/utils/parseError.d.ts +0 -37
- package/dist/utils/utils.d.ts +0 -10
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChainId, ExtendedChain } from '@lifi/types';
|
|
2
|
-
export
|
|
2
|
+
export declare class ChainsService {
|
|
3
3
|
private static instance;
|
|
4
4
|
private readonly loadingPromise;
|
|
5
5
|
private chains;
|
|
@@ -9,3 +9,4 @@ export default class ChainsService {
|
|
|
9
9
|
getChainById(chainId: ChainId): Promise<ExtendedChain>;
|
|
10
10
|
getChains(): Promise<ExtendedChain[]>;
|
|
11
11
|
}
|
|
12
|
+
//# sourceMappingURL=ChainsService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChainsService.d.ts","sourceRoot":"","sources":["../../../src/services/ChainsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIzD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,MAAM,CAAsB;;YAMtB,mBAAmB;WAInB,WAAW,IAAI,aAAa;IAQ7B,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAatD,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAOnD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Chain
|
|
2
|
-
|
|
1
|
+
import type { Chain } from '@lifi/types';
|
|
2
|
+
import type { SDKConfig, SDKOptions } from '../types/index.js';
|
|
3
|
+
export declare class ConfigService {
|
|
3
4
|
private static instance;
|
|
4
5
|
private readonly config;
|
|
5
6
|
private readonly setupPromise;
|
|
@@ -11,13 +12,16 @@ export default class ConfigService {
|
|
|
11
12
|
/**
|
|
12
13
|
* This call immediately returns the current config. It does not make sure that all chain data is already loaded
|
|
13
14
|
* Use this if you need access to basic information like API urls or settings
|
|
15
|
+
* @returns SDKConfig
|
|
14
16
|
*/
|
|
15
|
-
getConfig: () =>
|
|
17
|
+
getConfig: () => SDKConfig;
|
|
16
18
|
/**
|
|
17
19
|
* This call waits for all setup promises to be done.
|
|
18
20
|
* Use this if you need access to chain data (RPCs or multicalls)
|
|
21
|
+
* @returns SDKConfig
|
|
19
22
|
*/
|
|
20
|
-
getConfigAsync: () => Promise<
|
|
21
|
-
updateConfig: (configUpdate: Partial<
|
|
22
|
-
updateChains: (chains: Chain[]) =>
|
|
23
|
+
getConfigAsync: () => Promise<SDKConfig>;
|
|
24
|
+
updateConfig: (configUpdate: Partial<SDKOptions>) => SDKConfig;
|
|
25
|
+
updateChains: (chains: Chain[]) => SDKConfig;
|
|
23
26
|
}
|
|
27
|
+
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAY9D,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkB;IAC/C,OAAO,CAAC,mBAAmB,CAAyC;;IAUpE,OAAO,CAAC,MAAM,CAAC,eAAe;IAa9B,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAW9B;WAEa,WAAW,IAAI,aAAa;IAQ1C;;;;OAIG;IACI,SAAS,QAAO,SAAS,CAE/B;IAED;;;;OAIG;IACI,cAAc,QAAa,QAAQ,SAAS,CAAC,CAGnD;IAEM,YAAY,iBAAkB,QAAQ,UAAU,CAAC,KAAG,SAAS,CAqCnE;IAEM,YAAY,WAAY,KAAK,EAAE,KAAG,SAAS,CAkBjD;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LiFiStep, RoutesRequest, StaticToken } from '@lifi/types';
|
|
2
2
|
export declare const isRoutesRequest: (routesRequest: RoutesRequest) => routesRequest is RoutesRequest;
|
|
3
|
-
export declare const isStep: (step:
|
|
3
|
+
export declare const isStep: (step: LiFiStep) => step is LiFiStep;
|
|
4
4
|
export declare const isToken: (token: StaticToken) => token is StaticToken;
|
|
5
|
+
//# sourceMappingURL=typeguards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeguards.d.ts","sourceRoot":"","sources":["../../src/typeguards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,QAAQ,EAER,aAAa,EACb,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,eAAO,MAAM,eAAe,kBACX,aAAa,mCAsB7B,CAAA;AAOD,eAAO,MAAM,MAAM,SAAU,QAAQ,qBAUpC,CAAA;AA+BD,eAAO,MAAM,OAAO,UAAW,WAAW,yBAQzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../../src/types/abi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAE/B,eAAO,MAAM,UAAU,EAAE,GAWxB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,GAW1B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,GAQ9B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,GAQ1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ChainId, RouteOptions } from '@lifi/types';
|
|
2
|
+
import type { ExecutionSettings, InternalExecutionSettings, MultisigConfig } from '../execution/types.js';
|
|
3
|
+
import type { SDKProvider } from '../providers/index.js';
|
|
4
|
+
export interface SDKConfig {
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
rpcs: Record<ChainId, string[]>;
|
|
8
|
+
multicallAddresses: Record<ChainId, string | undefined>;
|
|
9
|
+
defaultExecutionSettings: InternalExecutionSettings;
|
|
10
|
+
defaultRouteOptions: RouteOptions;
|
|
11
|
+
disableVersionCheck?: boolean;
|
|
12
|
+
userId?: string;
|
|
13
|
+
integrator: string;
|
|
14
|
+
widgetVersion?: string;
|
|
15
|
+
multisig?: MultisigConfig;
|
|
16
|
+
providers?: SDKProvider[];
|
|
17
|
+
}
|
|
18
|
+
export interface SDKOptions extends Partial<Omit<SDKConfig, 'defaultExecutionSettings' | 'integrator'>> {
|
|
19
|
+
defaultExecutionSettings?: ExecutionSettings;
|
|
20
|
+
integrator: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TenderlyResponse {
|
|
23
|
+
hash: string;
|
|
24
|
+
block_hash: string;
|
|
25
|
+
block_number: number;
|
|
26
|
+
from: string;
|
|
27
|
+
gas: number;
|
|
28
|
+
gas_price: number;
|
|
29
|
+
gas_fee_cap: number;
|
|
30
|
+
gas_tip_cap: number;
|
|
31
|
+
cumulative_gas_used: number;
|
|
32
|
+
gas_used: number;
|
|
33
|
+
effective_gas_price: number;
|
|
34
|
+
input: string;
|
|
35
|
+
nonce: number;
|
|
36
|
+
to: string;
|
|
37
|
+
index: number;
|
|
38
|
+
value: string;
|
|
39
|
+
access_list: unknown;
|
|
40
|
+
status: boolean;
|
|
41
|
+
addresses: string[];
|
|
42
|
+
contract_ids: string[];
|
|
43
|
+
network_id: string;
|
|
44
|
+
timestamp: string;
|
|
45
|
+
function_selector: string;
|
|
46
|
+
l1_block_number: number;
|
|
47
|
+
l1_timestamp: number;
|
|
48
|
+
deposit_tx: boolean;
|
|
49
|
+
system_tx: boolean;
|
|
50
|
+
mint: number;
|
|
51
|
+
sig: {
|
|
52
|
+
v: string;
|
|
53
|
+
r: string;
|
|
54
|
+
s: string;
|
|
55
|
+
};
|
|
56
|
+
error_message: string;
|
|
57
|
+
method: string;
|
|
58
|
+
decoded_input: unknown;
|
|
59
|
+
call_trace: unknown;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/types/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EACzB,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/B,kBAAkB,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvD,wBAAwB,EAAE,yBAAyB,CAAA;IACnD,mBAAmB,EAAE,YAAY,CAAA;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,UACf,SAAQ,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,GAAG,YAAY,CAAC,CAAC;IAC3E,wBAAwB,CAAC,EAAE,iBAAiB,CAAA;IAC5C,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA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,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CASlE;AAED,qBAAa,YAAa,SAAQ,SAAS;gBAEvC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM;CAIjB;AAED,qBAAa,SAAU,SAAQ,KAAK;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;gBAET,QAAQ,EAAE,QAAQ;CAY/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMaxPriorityFeePerGas.d.ts","sourceRoot":"","sources":["../../../src/utils/getMaxPriorityFeePerGas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,MAAM,CAAA;AAGrD,eAAO,MAAM,uBAAuB,WAC1B,YAAY,KACnB,QAAQ,MAAM,GAAG,SAAS,CA0B5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"median.d.ts","sourceRoot":"","sources":["../../../src/utils/median.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,QAAS,MAAM,EAAE,KAAG,MAAM,GAAG,SAU/C,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { LiFiError } from './errors';
|
|
1
|
+
import type { LiFiStep, Process } from '@lifi/types';
|
|
2
|
+
import { LiFiError } from './errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Available MetaMask error codes:
|
|
5
5
|
*
|
|
@@ -31,7 +31,8 @@ import { LiFiError } from './errors';
|
|
|
31
31
|
* https://eips.ethereum.org/EIPS/eip-1474#error-codes
|
|
32
32
|
* https://eips.ethereum.org/EIPS/eip-1193#provider-errors
|
|
33
33
|
*/
|
|
34
|
-
export declare const getTransactionNotSentMessage: (step?:
|
|
35
|
-
export declare const getTransactionFailedMessage: (step:
|
|
36
|
-
export declare const parseError: (e: any, step?:
|
|
34
|
+
export declare const getTransactionNotSentMessage: (step?: LiFiStep, process?: Process) => Promise<string>;
|
|
35
|
+
export declare const getTransactionFailedMessage: (step: LiFiStep, txLink?: string) => Promise<string>;
|
|
36
|
+
export declare const parseError: (e: any, step?: LiFiStep, process?: Process) => Promise<LiFiError>;
|
|
37
37
|
export declare const parseBackendError: (e: any) => Promise<LiFiError>;
|
|
38
|
+
//# sourceMappingURL=parseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseError.d.ts","sourceRoot":"","sources":["../../../src/utils/parseError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAQpD,OAAO,EAIL,SAAS,EAWV,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,4BAA4B,UAChC,QAAQ,YACL,OAAO,KAChB,QAAQ,MAAM,CAyBhB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,QAAQ,WACL,MAAM,KACd,QAAQ,MAAM,CAUhB,CAAA;AAED,eAAO,MAAM,UAAU,MAClB,GAAG,SACC,QAAQ,YACL,OAAO,KAChB,QAAQ,SAAS,CAmJnB,CAAA;AAED,eAAO,MAAM,iBAAiB,MAAa,GAAG,KAAG,QAAQ,SAAS,CAwCjE,CAAA"}
|
|
@@ -8,3 +8,4 @@ export declare const wait: (ms: number) => Promise<undefined>;
|
|
|
8
8
|
export declare const repeatUntilDone: <T>(toRepeat: () => Promise<T | undefined>, timeout?: number) => Promise<T>;
|
|
9
9
|
export declare const isZeroAddress: (address: string) => boolean;
|
|
10
10
|
export declare const isNativeTokenAddress: (address: string) => boolean;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,OAAQ,MAAM,KAAG,QAAQ,SAAS,CAIlD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,6EAc3B,CAAA;AAED,eAAO,MAAM,aAAa,YAAa,MAAM,KAAG,OAK/C,CAAA;AAED,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,OAUtD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,111 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk",
|
|
3
|
-
"version": "3.0.0-alpha.1",
|
|
4
3
|
"description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"build": "yarn clean && tsc --project ./tsconfig.json && tsc --project ./tsconfig.cjs.json",
|
|
11
|
-
"clean": "node tools/cleanup",
|
|
12
|
-
"coverage": "vitest run --coverage",
|
|
13
|
-
"lint": "eslint --ext .tsx --ext .ts ./src",
|
|
14
|
-
"lint:fix": "eslint --ext .tsx --ext .ts ./src --fix",
|
|
15
|
-
"package": "npm run build && npm pack",
|
|
16
|
-
"postpublish": "npm run use:gitReadme && pinst --enable",
|
|
17
|
-
"pre-commit": "lint-staged",
|
|
18
|
-
"pre-push": "yarn types:check && yarn build && yarn test:unit",
|
|
19
|
-
"prepare": "husky install",
|
|
20
|
-
"prepublishOnly": "run-s build use:npmReadme && pinst --enable",
|
|
21
|
-
"prettier:fix": "prettier --write ./src/.",
|
|
22
|
-
"release": "standard-version -a",
|
|
23
|
-
"release:alpha": "standard-version -a --prerelease alpha --skip.changelog",
|
|
24
|
-
"release:beta": "standard-version -a --prerelease beta --skip.changelog",
|
|
25
|
-
"test": "vitest --run --dangerouslyIgnoreUnhandledErrors",
|
|
26
|
-
"test:cov": "yarn test --coverage",
|
|
27
|
-
"test:e2e": "yarn test -c vitest.e2e.config.ts",
|
|
28
|
-
"test:unit": "yarn test .unit.spec.ts",
|
|
29
|
-
"types:check": "tsc --noEmit",
|
|
30
|
-
"use:gitReadme": "mv 'README.md' 'npm.README.md' && mv 'git.README.md' 'README.md'",
|
|
31
|
-
"use:npmReadme": "mv 'README.md' 'git.README.md' && mv 'npm.README.md' 'README.md'",
|
|
32
|
-
"watch": "tsc -w -p ./tsconfig.json"
|
|
33
|
-
},
|
|
34
|
-
"standard-version": {
|
|
35
|
-
"scripts": {
|
|
36
|
-
"postbump": "node scripts/version.js && git add ."
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"lint-staged": {
|
|
40
|
-
"src/**/*.{ts,tsx}": [
|
|
41
|
-
"yarn run lint:fix",
|
|
42
|
-
"yarn run prettier:fix"
|
|
43
|
-
]
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@lifi/types": "^9.0.0-alpha.16",
|
|
6
|
+
"@solana/web3.js": "^1.78.4",
|
|
7
|
+
"eth-rpc-errors": "^4.0.3",
|
|
8
|
+
"viem": "^1.10.8"
|
|
44
9
|
},
|
|
10
|
+
"version": "3.0.0-alpha.11",
|
|
45
11
|
"files": [
|
|
46
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"!dist/**/*.tsbuildinfo"
|
|
47
14
|
],
|
|
48
|
-
"
|
|
49
|
-
"
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/types/index.d.ts",
|
|
18
|
+
"import": "./dist/esm/index.js",
|
|
19
|
+
"default": "./dist/cjs/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
50
22
|
},
|
|
51
|
-
"
|
|
23
|
+
"main": "./dist/cjs/index.js",
|
|
24
|
+
"module": "./dist/esm/index.js",
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"typings": "./dist/types/index.d.ts",
|
|
52
27
|
"license": "Apache-2.0",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+ssh://git@github.com/lifinance/sdk.git"
|
|
31
|
+
},
|
|
53
32
|
"keywords": [
|
|
54
|
-
"sdk",
|
|
55
|
-
"ethereum",
|
|
56
|
-
"dapp",
|
|
57
33
|
"bridge",
|
|
58
|
-
"
|
|
59
|
-
"web3",
|
|
60
|
-
"lifi",
|
|
61
|
-
"ethers",
|
|
34
|
+
"bridge-aggregation",
|
|
62
35
|
"cross-chain",
|
|
63
|
-
"defi",
|
|
64
|
-
"web3-react",
|
|
65
36
|
"cross-chain-applications",
|
|
66
37
|
"cross-chain-bridge",
|
|
67
|
-
"
|
|
38
|
+
"dapp",
|
|
39
|
+
"defi",
|
|
40
|
+
"ethereum",
|
|
41
|
+
"ethers",
|
|
42
|
+
"lifi",
|
|
43
|
+
"metamask",
|
|
68
44
|
"multi-chain",
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
"bugs": {
|
|
77
|
-
"url": "https://github.com/lifinance/sdk/issues"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@lifi/types": "^9.0.0-alpha.0",
|
|
81
|
-
"eth-rpc-errors": "^4.0.3",
|
|
82
|
-
"viem": "^1.5.2"
|
|
83
|
-
},
|
|
84
|
-
"devDependencies": {
|
|
85
|
-
"@commitlint/cli": "^17.6.7",
|
|
86
|
-
"@commitlint/config-conventional": "^17.6.7",
|
|
87
|
-
"@mswjs/interceptors": "^0.22.16",
|
|
88
|
-
"@types/ws": "^8.5.5",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
90
|
-
"@typescript-eslint/parser": "^6.2.1",
|
|
91
|
-
"@vitest/coverage-v8": "^0.34.1",
|
|
92
|
-
"cross-fetch": "^4.0.0",
|
|
93
|
-
"eslint": "^8.46.0",
|
|
94
|
-
"eslint-config-prettier": "^8.10.0",
|
|
95
|
-
"eslint-plugin-jsdoc": "^46.4.5",
|
|
96
|
-
"eslint-plugin-prettier": "^5.0.0",
|
|
97
|
-
"husky": "^8.0.3",
|
|
98
|
-
"lint-staged": "^13.2.3",
|
|
99
|
-
"msw": "1.0.1",
|
|
100
|
-
"npm-run-all": "^4.1.5",
|
|
101
|
-
"pinst": "^3.0.0",
|
|
102
|
-
"prettier": "^3.0.1",
|
|
103
|
-
"standard-version": "^9.5.0",
|
|
104
|
-
"typescript": "^5.1.6",
|
|
105
|
-
"vitest": "^0.34.1"
|
|
106
|
-
},
|
|
107
|
-
"directories": {
|
|
108
|
-
"test": "test"
|
|
109
|
-
},
|
|
110
|
-
"packageManager": "yarn@3.6.1"
|
|
45
|
+
"sdk",
|
|
46
|
+
"swap",
|
|
47
|
+
"viem",
|
|
48
|
+
"wagmi",
|
|
49
|
+
"web3",
|
|
50
|
+
"web3-react"
|
|
51
|
+
]
|
|
111
52
|
}
|
package/dist/LiFi.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { getTokenAllowance, getTokenAllowanceMulticall, revokeTokenApproval, setTokenAllowance, } from './allowance';
|
|
2
|
-
import * as balance from './balance';
|
|
3
|
-
import { getPublicClient } from './connectors';
|
|
4
|
-
import { RouteExecutionManager } from './execution/RouteExecutionManager';
|
|
5
|
-
import { checkPackageUpdates } from './helpers';
|
|
6
|
-
import ApiService from './services/ApiService';
|
|
7
|
-
import ChainsService from './services/ChainsService';
|
|
8
|
-
import { isToken } from './typeguards';
|
|
9
|
-
import { ValidationError } from './utils/errors';
|
|
10
|
-
import { name, version } from './version';
|
|
11
|
-
export class LiFi extends RouteExecutionManager {
|
|
12
|
-
constructor(configUpdate) {
|
|
13
|
-
super(configUpdate);
|
|
14
|
-
/**
|
|
15
|
-
* Get the current configuration of the SDK
|
|
16
|
-
* @returns - The config object
|
|
17
|
-
*/
|
|
18
|
-
this.getConfig = () => {
|
|
19
|
-
return this.configService.getConfig();
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Get the SDK configuration after all setup calls are finished
|
|
23
|
-
* @returns - The config object
|
|
24
|
-
*/
|
|
25
|
-
this.getConfigAsync = () => {
|
|
26
|
-
return this.configService.getConfigAsync();
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Get an instance of a provider for a specific chain
|
|
30
|
-
* @param chainId - Id of the chain the provider is for
|
|
31
|
-
* @returns The public client for the given chain
|
|
32
|
-
*/
|
|
33
|
-
this.getPublicClient = (chainId) => {
|
|
34
|
-
return getPublicClient(chainId);
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Set a new confuration for the SDK
|
|
38
|
-
* @param configUpdate - An object containing the configuration fields that should be updated.
|
|
39
|
-
* @returns The renewed config object
|
|
40
|
-
*/
|
|
41
|
-
this.setConfig = (configUpdate) => {
|
|
42
|
-
return this.configService.updateConfig(configUpdate);
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Get a set of current possibilities based on a request that specifies which chains, exchanges and bridges are preferred or unwanted.
|
|
46
|
-
* @param request - Object defining preferences regarding chain, exchanges and bridges
|
|
47
|
-
* @param options
|
|
48
|
-
* @returns Object listing current possibilities for any-to-any cross-chain-swaps based on the provided preferences.
|
|
49
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
50
|
-
* @deprecated We don't want to support this endpoint anymore in the future. /chains, /tools, /connections, and /tokens should be used instead
|
|
51
|
-
*/
|
|
52
|
-
this.getPossibilities = async (request, options) => {
|
|
53
|
-
return ApiService.getPossibilities(request, options);
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Fetch information about a Token
|
|
57
|
-
* @param chain - Id or key of the chain that contains the token
|
|
58
|
-
* @param token - Address or symbol of the token on the requested chain
|
|
59
|
-
* @param options
|
|
60
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
61
|
-
*/
|
|
62
|
-
this.getToken = async (chain, token, options) => {
|
|
63
|
-
return ApiService.getToken(chain, token, options);
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Get a quote for a token transfer
|
|
67
|
-
* @param request - The configuration of the requested quote
|
|
68
|
-
* @param options
|
|
69
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
70
|
-
*/
|
|
71
|
-
this.getQuote = async (request, options) => {
|
|
72
|
-
return ApiService.getQuote(request, options);
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Get a quote for a destination contract call
|
|
76
|
-
* @param request - The configuration of the requested destination call
|
|
77
|
-
* @param options
|
|
78
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
79
|
-
* @returns - Returns step.
|
|
80
|
-
*/
|
|
81
|
-
this.getContractCallQuote = async (request, options) => {
|
|
82
|
-
return ApiService.getContractCallQuote(request, options);
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Check the status of a transfer. For cross chain transfers, the "bridge" parameter is required.
|
|
86
|
-
* @param request - Configuration of the requested status
|
|
87
|
-
* @param options - Rrquest options.
|
|
88
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
89
|
-
* @returns Returns status response.
|
|
90
|
-
*/
|
|
91
|
-
this.getStatus = async (request, options) => {
|
|
92
|
-
return ApiService.getStatus(request, options);
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Get the available tools to bridge and swap tokens.
|
|
96
|
-
* @param request - The configuration of the requested tools
|
|
97
|
-
* @param options
|
|
98
|
-
* @returns The tools that are available on the requested chains
|
|
99
|
-
*/
|
|
100
|
-
this.getTools = async (request, options) => {
|
|
101
|
-
return ApiService.getTools(request || {}, options);
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Get all known tokens.
|
|
105
|
-
* @param request - The configuration of the requested tokens
|
|
106
|
-
* @param options
|
|
107
|
-
* @returns The tokens that are available on the requested chains
|
|
108
|
-
*/
|
|
109
|
-
this.getTokens = async (request, options) => {
|
|
110
|
-
return ApiService.getTokens(request || {}, options);
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Get all available chains
|
|
114
|
-
* @returns A list of all available chains
|
|
115
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
116
|
-
*/
|
|
117
|
-
this.getChains = async () => {
|
|
118
|
-
return this.chainsService.getChains();
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Get a set of routes for a request that describes a transfer of tokens.
|
|
122
|
-
* @param request - A description of the transfer.
|
|
123
|
-
* @param options
|
|
124
|
-
* @returns The resulting routes that can be used to realize the described transfer of tokens.
|
|
125
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
126
|
-
*/
|
|
127
|
-
this.getRoutes = async (request, options) => {
|
|
128
|
-
return ApiService.getRoutes(request, options);
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Get the transaction data for a single step of a route
|
|
132
|
-
* @param step - The step object.
|
|
133
|
-
* @param options
|
|
134
|
-
* @returns The step populated with the transaction data.
|
|
135
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
136
|
-
*/
|
|
137
|
-
this.getStepTransaction = async (step, options) => {
|
|
138
|
-
return ApiService.getStepTransaction(step, options);
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Get gas recommendation for a certain chain
|
|
142
|
-
* @param request - Configuration of the requested recommendation.
|
|
143
|
-
* @param options
|
|
144
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
145
|
-
*/
|
|
146
|
-
this.getGasRecommendation = async (request, options) => {
|
|
147
|
-
return ApiService.getGasRecommendation(request, options);
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Returns the balances of a specific token a wallet holds across all aggregated chains.
|
|
151
|
-
* @param walletAddress - A wallet address.
|
|
152
|
-
* @param token - A Token object.
|
|
153
|
-
* @returns An object containing the token and the amounts on different chains.
|
|
154
|
-
* @throws {ValidationError} Throws a ValidationError if parameters are invalid.
|
|
155
|
-
*/
|
|
156
|
-
this.getTokenBalance = async (walletAddress, token) => {
|
|
157
|
-
if (!walletAddress) {
|
|
158
|
-
throw new ValidationError('Missing walletAddress.');
|
|
159
|
-
}
|
|
160
|
-
if (!isToken(token)) {
|
|
161
|
-
throw new ValidationError(`Invalid token passed: address "${token.address}" on chainId "${token.chainId}"`);
|
|
162
|
-
}
|
|
163
|
-
return balance.getTokenBalance(walletAddress, token);
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Returns the balances for a list tokens a wallet holds across all aggregated chains.
|
|
167
|
-
* @param walletAddress - A wallet address.
|
|
168
|
-
* @param tokens - A list of Token objects.
|
|
169
|
-
* @returns A list of objects containing the tokens and the amounts on different chains.
|
|
170
|
-
* @throws {ValidationError} Throws a ValidationError if parameters are invalid.
|
|
171
|
-
*/
|
|
172
|
-
this.getTokenBalances = async (walletAddress, tokens) => {
|
|
173
|
-
if (!walletAddress) {
|
|
174
|
-
throw new ValidationError('Missing walletAddress.');
|
|
175
|
-
}
|
|
176
|
-
const invalidTokens = tokens.filter((token) => !isToken(token));
|
|
177
|
-
if (invalidTokens.length) {
|
|
178
|
-
throw new ValidationError(`Invalid token passed: address "${invalidTokens[0].address}" on chainId "${invalidTokens[0].chainId}"`);
|
|
179
|
-
}
|
|
180
|
-
return balance.getTokenBalances(walletAddress, tokens);
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* This method queries the balances of tokens for a specific list of chains for a given wallet.
|
|
184
|
-
* @param walletAddress - A walletaddress.
|
|
185
|
-
* @param tokensByChain - A list of Token objects organized by chain ids.
|
|
186
|
-
* @returns A list of objects containing the tokens and the amounts on different chains organized by the chosen chains.
|
|
187
|
-
* @throws {ValidationError} Throws a ValidationError if parameters are invalid.
|
|
188
|
-
*/
|
|
189
|
-
this.getTokenBalancesByChain = async (walletAddress, tokensByChain) => {
|
|
190
|
-
if (!walletAddress) {
|
|
191
|
-
throw new ValidationError('Missing walletAddress.');
|
|
192
|
-
}
|
|
193
|
-
const tokenList = Object.values(tokensByChain).flat();
|
|
194
|
-
const invalidTokens = tokenList.filter((token) => !isToken(token));
|
|
195
|
-
if (invalidTokens.length) {
|
|
196
|
-
throw new ValidationError(`Invalid token passed: address "${invalidTokens[0].address}" on chainId "${invalidTokens[0].chainId}"`);
|
|
197
|
-
}
|
|
198
|
-
return balance.getTokenBalancesByChain(walletAddress, tokensByChain);
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* Get the current allowance for a certain token.
|
|
202
|
-
* @param token - The token that should be checked
|
|
203
|
-
* @param ownerAddress - The owner of the token
|
|
204
|
-
* @param spenderAddress - The spender address that has to be approved
|
|
205
|
-
*/
|
|
206
|
-
this.getTokenAllowance = async (token, ownerAddress, spenderAddress) => {
|
|
207
|
-
return getTokenAllowance(token, ownerAddress, spenderAddress);
|
|
208
|
-
};
|
|
209
|
-
/**
|
|
210
|
-
* Get the current allowance for a list of token / spender address pairs.
|
|
211
|
-
* @param ownerAddress - The owner of the tokens
|
|
212
|
-
* @param tokens - A list of token and spender address pairs
|
|
213
|
-
*/
|
|
214
|
-
this.getTokenAllowanceMulticall = async (ownerAddress, tokens) => {
|
|
215
|
-
return getTokenAllowanceMulticall(ownerAddress, tokens);
|
|
216
|
-
};
|
|
217
|
-
/**
|
|
218
|
-
* Set approval for a certain token and amount.
|
|
219
|
-
* @param request - The approval request
|
|
220
|
-
*/
|
|
221
|
-
this.setTokenApproval = (request) => {
|
|
222
|
-
return setTokenAllowance(request);
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Revoke approval for a certain token.
|
|
226
|
-
* @param request - The revoke request
|
|
227
|
-
*/
|
|
228
|
-
this.revokeTokenApproval = (request) => {
|
|
229
|
-
return revokeTokenApproval(request);
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* Get all the available connections for swap/bridging tokens
|
|
233
|
-
* @param connectionRequest ConnectionsRequest
|
|
234
|
-
* @returns ConnectionsResponse
|
|
235
|
-
*/
|
|
236
|
-
this.getConnections = async (connectionRequest) => {
|
|
237
|
-
const connections = await ApiService.getAvailableConnections(connectionRequest);
|
|
238
|
-
return connections;
|
|
239
|
-
};
|
|
240
|
-
this.chainsService = ChainsService.getInstance();
|
|
241
|
-
this.chainsService.getChains().then((chains) => {
|
|
242
|
-
this.configService.updateChains(chains);
|
|
243
|
-
});
|
|
244
|
-
checkPackageUpdates(name, version, configUpdate.disableVersionCheck);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ChainId, Token } from '@lifi/types';
|
|
2
|
-
import type { TokenAllowance, TokenSpender, TokenSpenderAllowance } from './types';
|
|
3
|
-
export declare const getAllowance: (chainId: ChainId, tokenAddress: string, ownerAddress: string, spenderAddress: string) => Promise<bigint>;
|
|
4
|
-
export declare const getAllowanceMulticall: (chainId: ChainId, tokens: TokenSpender[], ownerAddress: string) => Promise<TokenSpenderAllowance[]>;
|
|
5
|
-
export declare const getTokenAllowance: (token: Token, ownerAddress: string, spenderAddress: string) => Promise<bigint | undefined>;
|
|
6
|
-
export declare const getTokenAllowanceMulticall: (ownerAddress: string, tokens: TokenSpender[]) => Promise<TokenAllowance[]>;
|