LI.FI Documentation
LI.FI WebsiteAPI ReferenceHelp / FAQ / Create support ticketRequest API Key
  • 🏡Getting Started
    • ❓What is LI.FI
    • 🌟Why LI.FI?
    • 🆚LI.FI vs Aggregators/DEXs/Bridges
    • 📖LI.FI Terminology
    • ❓FAQ
    • 💡Use Cases
      • Mobile/Gaming Wallets
    • 🏹LI.FI vs. Other Aggregators
    • 🤝Partnership
    • 🌐Powered by LI.FI
  • 🔐Security First
  • ✅List: Chains, Bridges, DEX Aggregators, Solvers
  • 💲Monetization / Take Fees
  • 🔎Transaction Explorer
  • 🔏Rate Limits & API Key
  • How to get integrated by LI.FI?
    • For Bridges
    • For DEXs/Aggregators/Solvers
  • 🆘Technical FAQ
  • LI.FI PRODUCTS
    • Glacis
    • LI.FI Solver
    • LI.FI Intents System
  • LI.FI API
    • ⚙️LI.FI API
      • Transferring Tokens (Example)
      • Requesting supported Chains
      • Requesting all supported Tools
      • Requesting all known Tokens
      • Getting Token Information
      • Getting all possible Connections
      • Requesting a Quote
        • Token Transfer
        • Optimizing quote response timing
        • Cross-Chain Contract Calls
        • Possible Tool Errors
        • Testing your integration
      • Status of a Transaction
      • Requesting Analytics Data
    • ⚔️TX-Batching aka "Zaps"
    • 🏄Solana
      • Request examples
    • 🪙Bitcoin
      • Request examples
    • ⛽LI.Fuel
  • Integrate LI.FI SDK
    • 🚀LI.FI SDK Overview
    • 📦Install LI.FI SDK
    • ⚙️Configure SDK
    • 🪐Configure SDK Providers
    • 📜Request Routes/Quotes
    • 🎯Execute Routes/Quotes
    • ⛓️Chains and Tools
    • 💰Token Management
    • 🕵️Testing Integration
    • 🚗Migrate from v2 to v3
  • INTEGRATE LI.FI WIDGET
    • 🧩LI.FI Widget Overview
    • 📦Install Widget
    • 🎮Select Widget Variants
    • ⚙️Configure Widget
    • 🎨Customize Widget
    • ⚡Widget Events
    • 👛Wallet Management
    • 🌍Internationalization
    • ⚛️Compatibility with Next.js, Remix, Nuxt, etc.
    • 🛣️React Router Compatibility
    • 📖Widget API Reference
    • 🚗Migrate from v2 to v3
  • Smart Contracts
    • Overview
    • Deployments/Contract Addresses
    • Audits
  • Support & Misc.
    • API Status
    • Technical Help Desk & FAQ
    • Create a Partner Ticket
    • Discord Support
    • Telegram Support
    • Twitter
    • Github
    • Licenses
Powered by GitBook
LogoLogo

Connect with us

  • Github
  • Twitter
  • Discord
  • LinkedIn

More Information

  • Help Desk / FAQ
  • API Reference
  • Website
On this page
  • Get available chains
  • getChains
  • Get available bridges and DEXs
  • getTools
  • Get available connections
  • getConnections

Was this helpful?

Export as PDF
  1. Integrate LI.FI SDK

Chains and Tools

Request all available chains, bridges, and exchanges.

Get an overview of which options (chains, bridges, DEXs) are available at this moment.

Get available chains

getChains

Fetches a list of all available chains supported by the SDK.

Parameters

  • params (ChainsRequest, optional): Configuration for the requested chains.

    • chainTypes (ChainType[], optional): List of chain types.

  • options (RequestOptions, optional): Additional request options.

Returns

A Promise that resolves to an array of ExtendedChain objects.

Example

import { ChainType, getChains } from '@lifi/sdk';

try {
  const chains = await getChains({ chainTypes: [ChainType.EVM] });
  console.log(chains);
} catch (error) {
  console.error(error);
}

Get available bridges and DEXs

getTools

Fetches the tools available for bridging and swapping tokens.

Parameters

  • params (ToolsRequest, optional): Configuration for the requested tools.

    • chains ((ChainKey | ChainId)[], optional): List of chain IDs or keys.

  • options (RequestOptions, optional): Additional request options.

Returns

A Promise that resolves to ToolsResponse and contains information about available bridges and DEXs.

Example

import { getTools } from '@lifi/sdk';

try {
  const tools = await getTools();
  console.log(tools);
} catch (error) {
  console.error(error);
}

Get available connections

A connection is a pair of two tokens (on the same chain or on different chains) that can be exchanged via our platform.

Read more Getting all possible Connections

getConnections

Gets all the available connections for swapping or bridging tokens.

Parameters

  • connectionRequest (ConnectionsRequest): Configuration of the connection request.

    • fromChain (number, optional): The source chain ID.

    • fromToken (string, optional): The source token address.

    • toChain (number, optional): The destination chain ID.

    • toToken (string, optional): The destination token address.

    • allowBridges (string[], optional): Allowed bridges.

    • denyBridges (string[], optional): Denied bridges.

    • preferBridges (string[], optional): Preferred bridges.

    • allowExchanges (string[], optional): Allowed exchanges.

    • denyExchanges (string[], optional): Denied exchanges.

    • preferExchanges (string[], optional): Preferred exchanges.

    • allowSwitchChain (boolean, optional): Whether connections that require chain switch (multiple signatures) are included. Default is true.

    • allowDestinationCall (boolean, optional): Whether connections that include destination calls are included. Default is true.

    • chainTypes (ChainType[], optional): Types of chains to include.

  • options (RequestOptions, optional): Request options.

Returns

A Promise that resolves to a ConnectionsResponse.

Example

import { getConnections } from '@lifi/sdk';

const connectionRequest = {
  fromChain: 1,
  fromToken: '0x0000000000000000000000000000000000000000',
  toChain: 10,
  toToken: '0x0000000000000000000000000000000000000000',
};

try {
  const connections = await getConnections(connectionRequest);
  console.log('Connections:', connections);
} catch (error) {
  console.error('Error:', error);
}

For more detailed information on each endpoint and their responses, please refer to the LI.FI API documentation.

Last updated 11 months ago

Was this helpful?

⛓️
💰Token Management