import type { ChainType, Execution, LiFiStep, Route, Step, Token, TokenAmount, } from '@lifi/types'; import type { WalletClient } from 'viem'; import type { ChainId } from '../types/base.js'; export interface SDKProvider { readonly type: ChainType; isAddress(address: string): boolean; resolveAddress(name: string): Promise; getStepExecutor(options: StepExecutorOptions): Promise; getBalance(walletAddress: string, tokens: Token[]): Promise; } export interface StepExecutorOptions { routeId: string; executionOptions?: ExecutionOptions; } export interface InteractionSettings { allowInteraction?: boolean; allowUpdates?: boolean; allowExecution?: boolean; } export interface StepExecutor { allowUserInteraction: boolean; allowExecution: boolean; setInteraction(settings?: InteractionSettings): void; executeStep(step: LiFiStepExtended): Promise; } export interface RouteExtended extends Omit { steps: LiFiStepExtended[]; } export interface LiFiStepExtended extends LiFiStep { execution?: Execution; } export type StepExtended = Step & { execution?: Execution; }; export type TransactionParameters = { chainId?: number; to?: string; from?: string; nonce?: number; data?: string; value?: bigint; gas?: bigint; gasPrice?: bigint; maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint; }; export interface RouteExecutionData { route: Route; executors: StepExecutor[]; executionOptions?: ExecutionOptions; } export type RouteExecutionDataDictionary = Partial< Record >; export type RouteExecutionDictionary = Partial>>; export type UpdateRouteHook = (updatedRoute: RouteExtended) => void; export interface TransactionRequestParameters extends TransactionParameters { requestType: 'approve' | 'transaction'; } export type TransactionRequestUpdateHook = ( updatedTxRequest: TransactionRequestParameters, ) => Promise; export type SwitchChainHook = ( chainId: number, ) => Promise; export interface AcceptSlippageUpdateHookParams { toToken: Token; oldToAmount: string; newToAmount: string; oldSlippage: number; newSlippage: number; } export type AcceptSlippageUpdateHook = ( params: AcceptSlippageUpdateHookParams, ) => Promise; export interface ExchangeRateUpdateParams { toToken: Token; oldToAmount: string; newToAmount: string; } export type AcceptExchangeRateUpdateHook = ( params: ExchangeRateUpdateParams, ) => Promise; export interface ExecutionOptions { commissionBps?: Partial>; commissionBpsSDK?: Partial>; acceptExchangeRateUpdateHook?: AcceptExchangeRateUpdateHook; switchChainHook?: SwitchChainHook; updateRouteHook?: UpdateRouteHook; updateTransactionRequestHook?: TransactionRequestUpdateHook; executeInBackground?: boolean; infiniteApproval?: boolean; slippage?: string; } export interface LiFiStepExtended extends LiFiStep { execution?: Execution; }