UNPKG

@lifi/types

Version:
132 lines 3.85 kB
import type { TypedData, TransactionRequest, SignedTypedData, ExecutionType } from './api.js'; import type { Token } from './tokens/index.js'; export interface FeeCost { name: string; description: string; percentage: string; token: Token; amount: string; amountUSD: string; included: boolean; } export interface GasCost { type: 'SUM' | 'APPROVE' | 'SEND' | 'FEE'; price: string; estimate: string; limit: string; amount: string; amountUSD: string; token: Token; } export interface Action { fromChainId: number; fromAmount: string; fromToken: Token; fromAddress?: string; toChainId: number; toToken: Token; toAddress?: string; slippage?: number; } export interface Estimate { tool: string; fromAmount: string; fromAmountUSD?: string; toAmount: string; toAmountMin: string; toAmountUSD?: string; approvalAddress: string; permit2Address?: string; permit2ProxyAddress?: string; feeCosts?: FeeCost[]; /** This is a list to account for approval gas costs and transaction gas costs. However, approval gas costs are not integrated yet. */ gasCosts?: GasCost[]; /** Estimated duration in seconds */ executionDuration: number; /** Optional flag to indicate approval reset requirement for legacy ERC-20 tokens */ approvalReset?: boolean; /** Optional flag to skip approval in the cases where we only need to sign the message (e.g. Hyperliquid)*/ skipApproval?: boolean; } export declare const _StepType: readonly ["lifi", "swap", "cross", "protocol", "custom"]; export type StepType = (typeof _StepType)[number]; export type StepTool = string; export type StepToolDetails = { key: string; name: string; logoURI: string; }; type StepInformationBase = { tool: string; type: string; action: Action; estimate: Estimate; }; export type StepInformation = StepInformationBase & { createdAt: Date; gasLimit: string; stepId: string; transactionId: string; intermediateActions: StepInformationBase[]; integrator?: string; relatedLifiSteps?: string[]; }; export interface StepBase { id: string; type: StepType; tool: StepTool; toolDetails: StepToolDetails; integrator?: string; referrer?: string; action: Action; estimate?: Estimate; executionType?: ExecutionType; transactionRequest?: TransactionRequest; transactionId?: string; /** * EIP-712 Typed Data * @link https://eips.ethereum.org/EIPS/eip-712 */ typedData?: TypedData[]; } export interface DestinationCallInfo { toContractAddress: string; toContractCallData: string; toFallbackAddress: string; callDataGasLimit: string; } export type CallAction = Action & DestinationCallInfo; export interface SwapStep extends StepBase { type: 'swap'; action: Action; estimate: Estimate; } export interface CrossStep extends StepBase { type: 'cross'; action: Action; estimate: Estimate; } export interface ProtocolStep extends StepBase { type: 'protocol'; action: Action; estimate: Estimate; } export interface CustomStep extends StepBase { type: 'custom'; action: CallAction; estimate: Estimate; } export type Step = SwapStep | CrossStep | CustomStep | ProtocolStep; export interface LiFiStep extends Omit<Step, 'type'> { type: 'lifi'; includedSteps: Step[]; } export interface SignedLiFiStep extends LiFiStep { typedData: SignedTypedData[]; } export declare function isSwapStep(step: Step): step is SwapStep; export declare function isCrossStep(step: Step): step is CrossStep; export declare function isProtocolStep(step: Step): step is ProtocolStep; export declare function isCustomStep(step: Step): step is CustomStep; export {}; //# sourceMappingURL=step.d.ts.map