LI.FI Swidge Overview
Overview of the @lifi/wdk-protocol-swidge-lifi module for LI.FI swap and bridge routes.
Community modules are developed and maintained independently by third-party contributors.
Tether and the WDK Team do not endorse or assume responsibility for their code, security, or maintenance. Use your own judgment and proceed at your own risk.
The LI.FI Swidge module lets WDK EVM accounts quote and execute swap, bridge, and combined swap-plus-bridge routes through LI.FI using the shared SwidgeProtocol interface.
Use this module when an app needs live LI.FI route discovery, exact-input or exact-output quotes, execution through standard EVM accounts or ERC-4337 smart accounts, and status polling through the canonical WDK swidge status model.
Features
- Unified route interface: Implements
quoteSwidge(),swidge(),getSwidgeStatus(),getSupportedChains(), andgetSupportedTokens(). - LI.FI routing: Supports swap-only, bridge-only, and combined routes where source execution and recipient addressing are EVM-compatible.
- EVM account support: Works with
@tetherto/wdk-wallet-evmand@tetherto/wdk-wallet-evm-erc-4337. - Quotes and discovery without signing: Supports chain and token discovery without an account or provider. Accountless route quotes require
config.providerto resolve the source chain. - Fee controls: Applies optional
maxNetworkFeeBpsandmaxProtocolFeeBpslimits before execution. - Gasless-friendly: Opt-in
denyBridges: NATIVE_VALUE_BRIDGE_DENY_LISTandallowNativeValue: falsefilter native-value bridge routes and reject native-value quotes, so ERC-4337 sponsored execution can cover gas without the LI.FI route requiring separate native token value. - Reliability controls: Provides request timeouts, retry handling, rate-limit classification, and typed LI.FI errors.
- Transaction validation: Validates quote transaction data before forwarding it to the wallet account.
- Optional contract allowlist:
trustedContractscan require quote targets and approval addresses to match known LI.FI contracts.
Supported Routes
LI.FI determines the live route set. Discovery can return chains from non-EVM ecosystems, while this module executes from a WDK EVM account and validates EVM recipient addresses. Call getSupportedChains() and getSupportedTokens() at runtime, then expose only routes compatible with the selected account and recipient.
Common toChain aliases include:
| Alias | Chain |
|---|---|
ethereum | Ethereum |
arbitrum | Arbitrum |
base | Base |
optimism | Optimism |
polygon | Polygon |
bsc | BNB Smart Chain |
avalanche | Avalanche |
scroll | Scroll |
zksync | zkSync Era |
Numeric LI.FI chain IDs are also accepted where the module accepts chain input.
Wallet Compatibility
| Account type | Support |
|---|---|
WalletAccountEvm | Quotes and executes routes. |
WalletAccountEvmErc4337 | Quotes and executes routes with smart-account gas handling. |
WalletAccountReadOnlyEvm | Quotes, status lookups, and discovery only. |
| No account | Chain and token discovery; quotes when config.provider is supplied. |
Use a read-only EVM account when quotes should include its source address or when status lookups are needed. In no-account mode, quoteSwidge() uses the configured provider to resolve the source chain and omits fromAddress from the LI.FI request.
swidge() can approve and submit one or more EVM transactions. Show the quote, fee breakdown, destination token, destination chain, and recipient before calling it.
Next Steps
Configuration
Configure LI.FI routing, API, fee, retry, and contract-validation options.
Usage
Install the package, discover supported assets, quote routes, execute routes, and poll status.
API Reference
Review constructor options, methods, config fields, status mapping, fee mapping, and typed errors.