The LI.FI SDK package provides access to the LI.FI API to find and execute the best on-chain and cross-chain routes across various bridges and exchanges.
Installation
Check out our complete examples in the SDK repository, and feel free to file an issue if you encounter any problems.
Quick Start
Set up the SDK
Firstly, create SDK config with your integrator string.
import { createConfig } from '@lifi/sdk'
createConfig({
integrator: 'Your dApp/company name',
})
Request a quote
Now you can interact with the SDK and for example request a quote.
import { ChainId, getQuote } from '@lifi/sdk'
const quote = await getQuote({
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
fromChain: ChainId.ARB,
toChain: ChainId.OPT,
fromToken: '0x0000000000000000000000000000000000000000',
toToken: '0x0000000000000000000000000000000000000000',
fromAmount: '1000000000000000000',
})
Firstly, create SDK config with your integrator string.
import { createConfig } from '@lifi/sdk'
createConfig({
integrator: 'Your dApp/company name',
})
Request a Quote
Now you can interact with the SDK and for example request a quote.
import { ChainId, getQuote } from '@lifi/sdk'
const quote = await getQuote({
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
fromChain: ChainId.ARB,
toChain: ChainId.OPT,
fromToken: '0x0000000000000000000000000000000000000000',
toToken: '0x0000000000000000000000000000000000000000',
fromAmount: '1000000000000000000',
})
You can learn more about the configuring the SDK in the next section.