Skip to main content
POST
Get a set of routes for a request that describes a transfer of tokens
需要使用预设的路由策略?请在请求体中设置 options.preset,并查看 API 预设概览了解支持的配置。
在请求体中设置 options.pools.deny,可将特定 AMM 资金池或 Solana 交易场所排除在路由之外。请提供 1–100 个标识符:
  • **Uniswap V2/V3:**非零 EVM 资金池地址(0x + 40 位十六进制字符)
  • Uniswap V4:<poolManagerAddress>-<poolId>,其中 poolId 为 0x + 64 位十六进制字符
  • **Solana:**交易场所的程序 ID(base58),例如 HumidiFi 9H6tua7jkLhdm3w8BvgpTn5LZNU7g4ZynDmCiNN3q6Rp。它会排除该交易场所的所有资金池。不支持单个 Solana 资金池地址。
只有部分交易所支持排除资金池,因此这些条目会限制 swap 可使用的交易所:
  • EVM 资金池条目会将除 Solana 以外所有链上的 swap 限制为使用 fly。
  • Solana 程序 ID 会将 Solana 上的 swap 限制为使用 jupiter、titan 和 okx。
  • 如果某条链上没有匹配的条目,该链上的 swap 不受限制。
为每个步骤请求交易数据时,必须将同一份列表再次作为 denyPools 查询参数传给 /v1/advanced/stepTransaction。与 /v1/quote 相同,排除多个条目时请重复传入该查询参数。资金池排除列表仅在当前请求中生效,不会随返回的步骤自动传递。

请求头

x-lifi-api-key
string

Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.

请求体

application/json

The request object describes a desired any-to-any transfer and contains all information necessary to calculate the most efficient routes.

A description of a token transfer

fromChainId
number<number>
必填

The sending chain id

fromAmount
string
必填

The amount that should be transferred including all decimals (e.g. 1000000 for 1 USDC (6 decimals))

fromTokenAddress
string
必填

The address of the sending Token

toChainId
number<number>
必填

The id of the receiving chain

toTokenAddress
string
必填

The address of the receiving Token

options
Root Type for RouteOptions · object

Optional configuration for the routes

示例:
fromAddress
string

The sending wallet address

toAddress
string

The receiving wallet address

fromAmountForGas
string

The amount of the token to convert to gas on the destination side.

响应

The resulting routes that can be used to realize the described transfer of tokens

A list of routes that can be used to realize the described transfer of tokens

routes
Root Type for Route · object[]
必填

List of possible Routes for the given transfer

unavailableRoutes
object[]

An object representing the routes that are unavailable for the given transfer