UNPKG

@lifi/sdk

Version:

LI.FI Any-to-Any Cross-Chain-Swap SDK

42 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EVM = EVM; const types_1 = require("@lifi/types"); const viem_1 = require("viem"); const EVMStepExecutor_js_1 = require("./EVMStepExecutor.js"); const getEVMBalance_js_1 = require("./getEVMBalance.js"); const resolveEVMAddress_js_1 = require("./resolveEVMAddress.js"); function EVM(options) { const _options = options ?? {}; return { get type() { return types_1.ChainType.EVM; }, get options() { return _options; }, isAddress: viem_1.isAddress, resolveAddress: resolveEVMAddress_js_1.resolveEVMAddress, getBalance: getEVMBalance_js_1.getEVMBalance, getWalletClient: _options.getWalletClient, async getStepExecutor(options) { if (!_options.getWalletClient) { throw new Error('Client is not provided.'); } const walletClient = await _options.getWalletClient(); const executor = new EVMStepExecutor_js_1.EVMStepExecutor({ client: walletClient, routeId: options.routeId, executionOptions: { ...options.executionOptions, switchChainHook: _options.switchChain ?? options.executionOptions?.switchChainHook, }, }); return executor; }, setOptions(options) { Object.assign(_options, options); }, }; } //# sourceMappingURL=EVM.js.map