Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
将我们的 LI.FI SDK 集成到您的 dApp/钱包/交换 UI
yarn add @lifi/sdk
pnpm add @lifi/sdk
bun add @lifi/sdk
npm install @lifi/sdk
yarn add @lifi/sdk-provider-ethereum # For EVM chains (uses viem) yarn add @lifi/sdk-provider-solana # For Solana (uses @solana/kit) yarn add @lifi/sdk-provider-bitcoin # For Bitcoin (uses @bigmi/core) yarn add @lifi/sdk-provider-sui # For Sui (uses @mysten/sui v2) yarn add @lifi/sdk-provider-tron # For Tron (uses tronweb)
pnpm add @lifi/sdk-provider-ethereum # For EVM chains (uses viem) pnpm add @lifi/sdk-provider-solana # For Solana (uses @solana/kit) pnpm add @lifi/sdk-provider-bitcoin # For Bitcoin (uses @bigmi/core) pnpm add @lifi/sdk-provider-sui # For Sui (uses @mysten/sui v2) pnpm add @lifi/sdk-provider-tron # For Tron (uses tronweb)
npm install @lifi/sdk-provider-ethereum # For EVM chains (uses viem) npm install @lifi/sdk-provider-solana # For Solana (uses @solana/kit) npm install @lifi/sdk-provider-bitcoin # For Bitcoin (uses @bigmi/core) npm install @lifi/sdk-provider-sui # For Sui (uses @mysten/sui v2) npm install @lifi/sdk-provider-tron # For Tron (uses tronweb)
@lifi/sdk
设置 SDK
import { createClient } from '@lifi/sdk'; const client = createClient({ integrator: 'Your dApp/company name', });
请求报价
import { ChainId, getQuote } from '@lifi/sdk'; const quote = await getQuote(client, { fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', fromChain: ChainId.ARB, toChain: ChainId.OPT, fromToken: '0x0000000000000000000000000000000000000000', toToken: '0x0000000000000000000000000000000000000000', fromAmount: '1000000000000000000', });