Skip to content
docs

LifiSwap2Config

Defined in: protocol-swap2-lifi/src/protocol.ts:6

Explicit constructor configuration; no deployment environment is read.

optional accountChain?: string

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:66

Optional account chain identity when the account does not expose a provider.

Swap2EngineConfig.accountChain


optional allowInsecureApiUrl?: boolean

Defined in: protocol-swap2-lifi/src/provider.ts:179

Allow an http: apiUrl (local development only): the quotes and the Diamond calldata travel it, and over plain http anyone on the path rewrites them (scan 2026-10-27 modules, F20).

LifiProviderConfig.allowInsecureApiUrl


optional allowUnlistedTokens?: boolean

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:107

Accept tokens the swap catalog does not list, named by their contract (EVM) or mint (Solana): tokens the user added at their own risk. Off by default. The source token’s decimals are read with the account’s getTokenInfo (a fromTokenDecimals that disagrees is refused); an account without it must be given fromTokenDecimals. Only providers that trade any token (LI.FI, Uniswap, Balancer, Fynd, Jupiter) quote them, and they have no USD value: the router cannot judge their price, so show the user the amounts.

Swap2EngineConfig.allowUnlistedTokens


optional apiKey?: string

Defined in: protocol-swap2-lifi/src/provider.ts:180

LifiProviderConfig.apiKey


optional apiUrl?: string

Defined in: protocol-swap2-lifi/src/provider.ts:174

LI.FI REST base URL. Explicitly injectable for proxies and tests; must be https unless allowInsecureApiUrl.

LifiProviderConfig.apiUrl


optional chooseRoute?: (routes, params) => LifiRouteChoice | null | undefined

Defined in: protocol-swap2-lifi/src/provider.ts:204

Route policy hook. When set, a cross-chain quote first asks LI.FI’s /advanced/routes for the candidates, hands them to this function and restricts /quote to what it returns (allowBridges / denyBridges / order). Returning null/undefined, or any failure of the routes call, leaves LI.FI’s default pick. The policy itself (tie band, max ETA, deny list) belongs to the app; the module only carries the choice.

readonly LifiRouteOption[]

QuoteParams

LifiRouteChoice | null | undefined

LifiProviderConfig.chooseRoute


optional decodeTonBody?: (bocBase64) => unknown

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:74

Decodes a base64 BoC into a TON Cell for deposits that carry a cell body (e.g. Omniston escrow payloads). The package deliberately does not depend on @ton/core; the caller supplies e.g. (b) => Cell.fromBase64(b). Without it, cell-body deposits fail closed — a TON account treats a string body as a TEXT COMMENT, which would strand the swap.

string

unknown

Swap2EngineConfig.decodeTonBody


optional defaultSlippageBps?: number

Defined in: protocol-swap2-lifi/src/provider.ts:195

Slippage sent when the caller names none (bps, default 50 = LI.FI’s own documented default). Left unset, LI.FI picks it per request and it swings (0.9%–6% within a minute on Base ETH → Robinhood, 2026-10-12): the display quote’s minimum then sits above the live one and the execution floor refuses a route that hasn’t moved.

LifiProviderConfig.defaultSlippageBps


optional enabled?: boolean

Defined in: protocol-swap2-lifi/src/provider.ts:172

LifiProviderConfig.enabled


fromChain: string

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:60

CAIP-2 of the chain the bound account lives on (the swap2 source).

Swap2EngineConfig.fromChain


optional integrator?: string

Defined in: protocol-swap2-lifi/src/provider.ts:181

LifiProviderConfig.integrator


optional maxNetworkFeeBps?: number | bigint

Defined in: core/dist/index-QWdcwE6y.d.ts:429

Maximum acceptable network fee, basis points of the input amount.

Swap2EngineConfig.maxNetworkFeeBps


optional maxProtocolFeeBps?: number | bigint

Defined in: core/dist/index-QWdcwE6y.d.ts:431

Maximum acceptable protocol fee, basis points of the input amount.

Swap2EngineConfig.maxProtocolFeeBps


optional onExecutionPhase?: (phase, detail?) => void

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:62

Progress observer, see Swap2ExecutionPhase.

Swap2ExecutionPhase

Swap2ExecutionPhaseDetail

void

Swap2EngineConfig.onExecutionPhase


optional quoteTtlMs?: number

Defined in: protocol-swap2-lifi/src/provider.ts:187

Fail-closed local lifetime for the provider’s documented ~60s quote window.

LifiProviderConfig.quoteTtlMs


optional reviewExecution?: (plan) => void | Promise<void>

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:98

Review gate: called once the live quote is built and every payload/value check has passed, BEFORE any approval or signature. It receives a copy of exactly what will be signed; throwing (the user cancelled) aborts with nothing sent. A quote that expires while the gate is open is refused before the first approval. When the quote expires while the engine’s own approval is being mined, the engine re-quotes once; if the fresh quote differs from the reviewed one (payload, gas, a worse output) the gate is called again with requoted: true, and throwing then revokes the allowance.

Swap2ExecutionPlan

void | Promise<void>

Swap2EngineConfig.reviewExecution


optional serializedNativeAllowance?: string | number | bigint

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:81

Provider-SERIALIZED legs (a swap aggregator’s fully built Solana transaction): how much native coin, in base units, the account may lose on top of the swap input — rent for a destination token account, wrapped SOL juggling, priority fees. Default 20 000 000 lamports (0.02 SOL).

Swap2EngineConfig.serializedNativeAllowance


optional skipAccountChainCheck?: boolean

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:64

Explicit escape hatch for adapters that can prove chain binding elsewhere.

Swap2EngineConfig.skipAccountChainCheck


optional tonGasCeiling?: string | number | bigint

Defined in: protocol-swap2-core/dist/swap2/base.d.ts:87

The most nanoTON a TON cell-body deposit may attach as gas: on top of the input for a native source, the whole attached value for a jetton source (default 1 TON; live Omniston swaps attach 0.1–0.4). A build attaching more is refused (scan 2026-10-27 modules, F7).

Swap2EngineConfig.tonGasCeiling


optional trustedApprovalAddresses?: Readonly<Record<string, readonly string[]>>

Defined in: protocol-swap2-lifi/src/provider.ts:185

Additional audited ERC-20 spenders returned by LI.FI for direct routes.

LifiProviderConfig.trustedApprovalAddresses


optional trustedTransactionTargets?: Readonly<Record<string, readonly string[]>>

Defined in: protocol-swap2-lifi/src/provider.ts:183

Additional audited LI.FI entry points for networks whose Diamond differs.

LifiProviderConfig.trustedTransactionTargets