API Reference
CK Finance technical integration — powered by LI.FI aggregation.
API Reference
CK App uses the LI.FI Protocol as its liquidity aggregation layer. This provides access to 30+ chains, 20+ bridges, and all major DEXs through a single integration.
Architecture
User → CK App (Frontend) → LI.FI SDK → DEXs & Bridges → BlockchainCK App does not require a custom backend. All swap/bridge operations are executed client-side through the LI.FI SDK, with transactions signed directly by the user's wallet.
LI.FI Integration
Installation
npm install @lifi/sdk @lifi/typesInitialization
import { createConfig, EVM } from '@lifi/sdk';
createConfig({
integrator: 'ck.app',
providers: [EVM()],
});Endpoints
All data is fetched through the LI.FI SDK. Below are the main operations:
Get Supported Chains
import { getChains } from '@lifi/sdk';
const chains = await getChains();
// Returns: ExtendedChain[] — id, name, logoURI, nativeToken, etc.Get Tokens for a Chain
import { getTokens } from '@lifi/sdk';
const result = await getTokens({ chains: [1] }); // Ethereum
const tokens = result.tokens[1];
// Returns: Token[] — address, symbol, name, decimals, priceUSD, logoURIGet Swap/Bridge Quote
import { getQuote } from '@lifi/sdk';
const quote = await getQuote({
fromChain: 1, // Ethereum
toChain: 42161, // Arbitrum
fromToken: '0x0000000000000000000000000000000000000000', // ETH
toToken: '0x0000000000000000000000000000000000000000', // ETH
fromAmount: '1000000000000000000', // 1 ETH in wei
fromAddress: '0xYourWalletAddress',
slippage: 0.005, // 0.5%
});
// Returns a Step object with:
// - estimate.toAmount — output amount in base units
// - estimate.gasCosts — array of gas cost breakdowns
// - estimate.executionDuration — estimated seconds
// - transactionRequest — ready-to-sign tx data (to, data, value, gasLimit)
// - toolDetails.name — which DEX/bridge is usedGet Token Balances
import { getTokenBalances } from '@lifi/sdk';
const tokens = [
{ address: '0x0000...', chainId: 1, decimals: 18, symbol: 'ETH', name: 'ETH' }
];
const balances = await getTokenBalances('0xWalletAddress', tokens);
// Returns: Token[] with amount field (balance in base units)Execute a Transaction
Quotes include a transactionRequest object that can be sent directly via wagmi or viem:
import { useSendTransaction } from 'wagmi';
const { sendTransactionAsync } = useSendTransaction();
const hash = await sendTransactionAsync({
to: quote.transactionRequest.to,
data: quote.transactionRequest.data,
value: BigInt(quote.transactionRequest.value),
gas: BigInt(quote.transactionRequest.gasLimit),
});Check Transaction Status
import { getStatus } from '@lifi/sdk';
const status = await getStatus({
txHash: '0x...',
fromChain: 1,
toChain: 42161,
bridge: 'stargate', // optional
});
// Returns: StatusResponse with status, substatus, etc.Rate Limits
LI.FI's public API has generous rate limits suitable for frontend applications. For high-volume integrations, contact LI.FI for an API key.
CK API (Future)
A dedicated CK Finance API (https://api.ck.app/v1) is planned for additional features such as portfolio analytics, transaction history, and advanced routing. This will complement the LI.FI integration.