API Reference
The SwapKitApi
provides access to swap quotes, price feeds, token lists, and other essential data. All methods are available through the @swapkit/helpers/api
import.
Getting Started
Section titled “Getting Started”// @noErrorValidationimport { SwapKitApi } from "@swapkit/helpers/api";
const price = await SwapKitApi.getPrice({ identifier: "ETH.ETH", currency: "USD",});
Swap Quotes
Section titled “Swap Quotes”getSwapQuote
Section titled “getSwapQuote”Get swap quotes from multiple providers with enhanced v4 features:
// @noErrorValidationconst { routes } = await SwapKitApi.getSwapQuote({ sellAsset: 'ETH.ETH', sellAmount: '1000000000000000000', buyAsset: 'BTC.BTC', sourceAddress: '0x...', destinationAddress: 'bc1q...', slippage: 3, providers: ['THORCHAIN', 'CHAINFLIP', 'UNISWAP_V3'], affiliate: 'your-affiliate-id', affiliateFee: 100, prioritizeBy: 'output', isStreaming: false, streamingInterval: 10, streamingQuantity: 5, refundAddress: '0x...', maxSlippage: 5});
{ routes: [{ providers: ['THORCHAIN'], sellAsset: 'ETH.ETH', sellAmount: '1000000000000000000', buyAsset: 'BTC.BTC', expectedBuyAmount: '62500000', expectedBuyAmountMaxSlippage: '60625000', sourceAddress: '0x...', destinationAddress: 'bc1q...', targetAddress: '0x...', memo: 'SWAP:BTC.BTC:bc1q...', expiration: '2024-01-01T00:00:00Z', priceImpact: 0.15, fee: { asset: 'ETH.ETH', networkFee: '5000000000000000', protocolFee: '3000000000000000', affiliateFee: '10000000000000000', totalFee: '18000000000000000' }, estimatedTime: { inbound: 600, outbound: 600, total: 1200 }, warnings: [], isStreaming: false, streamingMeta: null, legs: [ { provider: 'THORCHAIN', sellAsset: 'ETH.ETH', buyAsset: 'BTC.BTC', sellAmount: '1000000000000000000', buyAmount: '62500000', priceImpact: 0.15 } ] }], meta: { quoteId: 'quote_123456', timestamp: 1704067200, validFor: 300, totalProviders: 15, failedProviders: [] }}
Price Data
Section titled “Price Data”getPrice
Section titled “getPrice”Get current asset prices:
// @noErrorValidation
const priceData = await SwapKitApi.getPrice({ identifier: "ETH.ETH", currency: "USD",});
const prices = await SwapKitApi.getPrice({ identifiers: ["ETH.ETH", "BTC.BTC", "AVAX.AVAX"], currency: "USD",});
const tokenPrice = await SwapKitApi.getPrice({ identifier: "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",});
Balance Operations
Section titled “Balance Operations”getChainBalance
Section titled “getChainBalance”Get all token balances for an address on a specific chain with scam filtering:
// @noErrorValidationconst balances = await SwapKitApi.getChainBalance({ chain: "ETH", address: "0x742d35Cc6634C0532925a3b844Bc9e7595f6E321", scamFilter: true,});
[ { identifier: "ETH.ETH", value: "1500000000000000000", decimal: 18, }, { identifier: "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", value: "1000000000", decimal: 6, },];
Gas Rates
Section titled “Gas Rates”getGasRate
Section titled “getGasRate”Get current gas rates for supported chains:
// @noErrorValidation
const gasRates = await SwapKitApi.getGasRate();
{ ETH: { low: '12', average: '18', high: '25' }, BTC: { low: '8', average: '15', high: '25' }, AVAX: { low: '25', average: '30', high: '40' }}
Token Lists
Section titled “Token Lists”getTokenList
Section titled “getTokenList”Get comprehensive token metadata from a specific provider:
// @noErrorValidation
const tokens = await SwapKitApi.getTokenList('UNISWAP_V2');
[ { chain: 'ETH', symbol: 'USDC', ticker: 'USDC', identifier: 'ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', decimals: 6, logoURL: 'https: name: 'USD Coin' }]
getTokenListProviders
Section titled “getTokenListProviders”Get list of available token list providers:
// @noErrorValidationconst providers = await SwapKitApi.getTokenListProviders();
[ { name: '1inch', url: 'https: { name: 'coingecko', url: 'https: { name: 'uniswap', url: 'https:]
Transaction Tracking
Section titled “Transaction Tracking”getTrackerDetails
Section titled “getTrackerDetails”Track transaction status and progress:
// @noErrorValidationconst status = await SwapKitApi.getTrackerDetails({ txHash: '0x123...', chain: 'ETH', provider: 'thorchain', actionId: 'swap_123'});
{ status: 'completed', startTime: 1234567890, endTime: 1234568490, legs: [{ chain: 'ETH', hash: '0x123...', status: 'completed', inAmount: '1000000000000000000', outAmount: '62500000' }]}
Static Asset Data
Section titled “Static Asset Data”getStaticTokenList
Section titled “getStaticTokenList”Get token list from static CDN:
// @noErrorValidation
const tokens = await SwapKitApi.getStaticTokenList('UNISWAP_V2');
[ { chain: 'ETH', symbol: 'USDC', ticker: 'USDC', identifier: 'ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', decimals: 6, logoURL: 'https: name: 'USD Coin' }]
getLogoForAsset
Section titled “getLogoForAsset”Get logo URL for any asset:
// @noErrorValidation
const logoUrl = SwapKitApi.getLogoForAsset( "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
const ethLogo = SwapKitApi.getLogoForAsset("ETH.ETH");
getChainLogoForAsset
Section titled “getChainLogoForAsset”Get chain logo for any asset:
// @noErrorValidation
const chainLogo = SwapKitApi.getChainLogoForAsset( "ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
getProviderLogo
Section titled “getProviderLogo”Get logo URL for token list providers:
// @noErrorValidationconst providerLogo = await SwapKitApi.getProviderLogo("1inch");
New Provider Support
Section titled “New Provider Support”getProviders
Section titled “getProviders”Get list of all supported swap providers with their capabilities:
// @noErrorValidationconst providers = await SwapKitApi.getProviders();
[ { name: 'CHAINFLIP', provider: 'CHAINFLIP', count: 45, logoURI: 'https: url: 'https: keywords: ['defi', 'cross-chain', 'swap'], enabledChainIds: ['1', '43114', '137', 'bitcoin', 'polkadot'], supportedChainIds: ['1', '43114', '137', 'bitcoin', 'polkadot'], supportedActions: ['swap'] }, { name: 'THORCHAIN', provider: 'THORCHAIN', count: 128, logoURI: 'https: url: 'https: keywords: ['defi', 'thorchain', 'native-swap'], enabledChainIds: ['1', '43114', '56', 'bitcoin', 'thorchain-1'], supportedChainIds: ['1', '43114', '56', 'bitcoin', 'thorchain-1'], supportedActions: ['swap', 'addLiquidity', 'withdrawLiquidity', 'addSavers', 'withdrawSavers'] }
]
Enhanced getTokenList
Section titled “Enhanced getTokenList”The token list API now supports provider-specific filtering:
// @noErrorValidation
const chainflipTokens = await SwapKitApi.getTokenList('CHAINFLIP');const jupiterTokens = await SwapKitApi.getTokenList('JUPITER');
{ provider: 'CHAINFLIP', chainId: '1', name: 'Chainflip Token List', timestamp: '2024-01-01T00:00:00Z', version: { major: 1, minor: 0, patch: 0 }, keywords: ['chainflip', 'defi'], count: 45, tokens: [ { chain: 'ETH', address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', chainId: '1', ticker: 'USDC', identifier: 'ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', symbol: 'USDC', name: 'USD Coin', decimals: 6, logoURI: 'https: extensions: {}, shortCode: 'USDC', coingeckoId: 'usd-coin' } ]}
Transaction Tracking
Section titled “Transaction Tracking”trackTransaction
Section titled “trackTransaction”Track any transaction across all supported providers and chains:
// @noErrorValidation
const status = await SwapKitApi.trackTransaction({ hash: '0x123...', chain: 'ETH'});
const detailedStatus = await SwapKitApi.trackTransaction({ hash: '0x123...', chain: 'ETH', provider: 'THORCHAIN', actionType: 'swap', fromAddress: '0xabc...', toAddress: 'bc1q...'});
{ status: 'completed', progress: { current: 3, total: 3, percentage: 100 }, startTime: 1704067200, endTime: 1704067800, estimatedDuration: 600, legs: [ { chain: 'ETH', hash: '0x123...', status: 'completed', blockHeight: 18900000, confirmations: 12, inAmount: '1000000000000000000', outAmount: '0', gasUsed: '21000', gasPrice: '20000000000', timestamp: 1704067200 }, { chain: 'BTC', hash: 'abc123...', status: 'completed', blockHeight: 820000, confirmations: 2, inAmount: '0', outAmount: '6250000', timestamp: 1704067800 } ], fees: { networkFees: [ { chain: 'ETH', amount: '420000000000000', asset: 'ETH.ETH' }, { chain: 'BTC', amount: '1000', asset: 'BTC.BTC' } ], protocolFees: [ { amount: '3000000000000000', asset: 'ETH.ETH', type: 'liquidity' } ], affiliateFees: [ { amount: '1000000000000000', asset: 'ETH.ETH', recipient: 'your-affiliate' } ] }, errors: []}
Address Screening
Section titled “Address Screening”screenAddress
Section titled “screenAddress”Screen addresses for compliance and risk assessment:
// @noErrorValidation
const screening = await SwapKitApi.screenAddress({ address: '0x123...', chain: 'ETH'});
const detailedScreening = await SwapKitApi.screenAddress({ address: '0x123...', chain: 'ETH', amount: '1000000000000000000', asset: 'ETH.ETH', action: 'swap', userCountry: 'US'});
{ address: '0x123...', chain: 'ETH', riskScore: 0.15, riskLevel: 'low', sanctions: { isBlocked: false, lists: [], lastUpdated: '2024-01-01T00:00:00Z' }, categories: [ { name: 'exchange', confidence: 0.95, source: 'chainalysis' } ], labels: [ { name: 'Binance Hot Wallet', confidence: 0.92, source: 'elliptic' } ], compliance: { kyc: { required: false, level: 0 }, jurisdiction: { allowed: true, restrictions: [] } }, recommendation: 'proceed', lastUpdated: '2024-01-01T00:00:00Z'}
Gas History
Section titled “Gas History”getGasHistory
Section titled “getGasHistory”Retrieve historical gas price data for better fee estimation:
// @noErrorValidation
const gasHistory = await SwapKitApi.getGasHistory({ chain: 'ETH', period: '24h'});
const customHistory = await SwapKitApi.getGasHistory({ chain: 'ETH', startTime: 1704067200, endTime: 1704153600, interval: '1h'});
{ chain: 'ETH', period: '24h', interval: '1h', unit: 'gwei', data: [ { timestamp: 1704067200, low: 18.5, average: 22.1, high: 28.7, percentile95: 35.2, volume: 145623, utilization: 0.65 }
], statistics: { min: 12.3, max: 89.1, mean: 24.7, median: 21.8, volatility: 0.23 }, recommendations: { slow: 19.5, standard: 22.1, fast: 28.7, instant: 35.2 }}
NEAR Integration
Section titled “NEAR Integration”createNearChannel
Section titled “createNearChannel”Create deposit channels for NEAR-based swaps:
// @noErrorValidationconst nearChannel = await SwapKitApi.createNearChannel({ sellAsset: 'NEAR.NEAR', buyAsset: 'ETH.ETH', sellAmount: '10000000000000000000000000', destinationAddress: '0x...', slippage: 3, affiliateAddress: 'your-near-account.near', affiliateFee: 100});
{ channelId: 'near_channel_123', depositAddress: 'swap.near', functionCall: { contractId: 'swap.near', methodName: 'swap', args: { destination_address: '0x...', min_amount_out: '1450000000000000000' }, gas: '50000000000000', deposit: '10000000000000000000000001' }, estimatedOutput: '1500000000000000000', estimatedOutputWithSlippage: '1455000000000000000', estimatedTime: 120, expiresAt: 1704067800, fees: { protocolFee: '100000000000000000000000', affiliateFee: '100000000000000000000000', networkFee: '50000000000000000000000' }}
Microgard API
Section titled “Microgard API”Access THORChain microgard services:
// @noErrorValidation
const thorname = await SwapKitApi.microgard.getTHORNameDetails("myname");
const names = await SwapKitApi.microgard.getTHORNamesByOwner("thor1...");
const names = await SwapKitApi.microgard.getTHORNamesByAddress("0x...");
const pools = await SwapKitApi.microgard.getTHORChainPools("7d");
const positions = await SwapKitApi.microgard.getLiquidityPositions([ "thor1...", "thor2...",]);
const address = await SwapKitApi.microgard.getTNSChainAddress({ chain: "ETH", tns: "myname",});
THORNode API
Section titled “THORNode API”Direct access to THORChain node data:
// @noErrorValidation
const lastBlock = await SwapKitApi.thornode.getLastBlock("thorchain");
const queue = await SwapKitApi.thornode.getThorchainQueue();
const nodes = await SwapKitApi.thornode.getNodes();
const mimir = await SwapKitApi.thornode.getMimirInfo();
const inboundAddresses = await SwapKitApi.thornode.getInboundAddresses();
const tnsDetails = await SwapKitApi.thornode.getTHORNodeTNSDetails({ name: "myname", type: "thorchain",});
const preferredAsset = await SwapKitApi.thornode.getTNSPreferredAsset({ tns: "myname", type: "thorchain",});
const runePool = await SwapKitApi.thornode.getRunePoolInfo();
const providerInfo = await SwapKitApi.thornode.getRunePoolProviderInfo({ thorAddress: "thor1...",});
Midgard APIs
Section titled “Midgard APIs”Access THORChain and Maya midgard data:
// @noErrorValidation
const thorLiquidity = await SwapKitApi.thorchainMidgard.getLiquidityPosition( "thor1...");
const thorName = await SwapKitApi.thorchainMidgard.getNameDetails("myname");
const namesByAddress = await SwapKitApi.thorchainMidgard.getNamesByAddress( "0x...");
const namesByOwner = await SwapKitApi.thorchainMidgard.getNamesByOwner( "thor1...");
const mayaLiquidity = await SwapKitApi.mayachainMidgard.getLiquidityPosition( "maya1...");const mayaName = await SwapKitApi.mayachainMidgard.getNameDetails("myname");
Chainflip
Section titled “Chainflip”Create deposit channels for Chainflip swaps:
// @noErrorValidationconst channel = await SwapKitApi.getChainflipDepositChannel({ sellAsset: { chain: 'ETH', asset: 'ETH' }, buyAsset: { chain: 'BTC', asset: 'BTC' }, destinationAddress: 'bc1q...', brokerCommissionBps: 100, affiliateFees: [ { brokerAddress: '0x...', feeBps: 50 } ], channelMetadata: { cfParameters: '...', gasBudget: '1000000', message: 'Swap via SwapKit' }, refundParameters: { minPrice: '0.01', refundAddress: '0x...', retryDuration: 3600 }, dcaParameters: { numberOfChunks: 10, chunkInterval: 600 }, maxBoostFeeBps: 200});
{ depositChannelId: '123456', depositAddress: '0x...', brokerCommissionBps: 100, estimatedExpiryTime: 1234567890, expiryBlock: 123456, issuedBlock: 123400, sourceChainExpiryBlock: 234567}
Rate Limits
Section titled “Rate Limits”The SwapKit API has rate limits that vary by endpoint:
- Without API key: 10 requests per minute
- With API key: 100 requests per minute
Configure your API key in Configuration:
// @noErrorValidationimport { createSwapKit } from "@swapkit/sdk";
const swapKit = createSwapKit({ config: { apiKeys: { swapKit: "your-api-key", }, },});
Error Handling
Section titled “Error Handling”All API methods can throw errors that should be handled:
// @noErrorValidationimport { SwapKitError } from '@swapkit/sdk';
try { const quote = await SwapKitApi.getSwapQuote({...});} catch (error) { if (error instanceof SwapKitError) {
console.error('API Error:', error.message);
if (error.code === 'api_rate_limit') {
} }}
Common Patterns
Section titled “Common Patterns”Best Route Selection
Section titled “Best Route Selection”When getting swap quotes, the first route is typically the best:
// @noErrorValidationimport { AssetValue } from '@swapkit/sdk';
const { routes } = await SwapKitApi.getSwapQuote({...});
if (routes.length > 0) { const bestRoute = routes[0];
const minOutput = AssetValue.from({ asset: bestRoute.buyAsset, value: bestRoute.expectedBuyAmountMaxSlippage, fromBaseDecimal: true });
if (minOutput.gte(requiredAmount)) { await swapKit.swap({ route: bestRoute }); }}
Price Impact Calculation
Section titled “Price Impact Calculation”Calculate price impact for large swaps:
// @noErrorValidationconst quote = await SwapKitApi.getSwapQuote({...});const route = quote.routes[0];
const sellPrice = await SwapKitApi.getPrice(route.sellAsset);const buyPrice = await SwapKitApi.getPrice(route.buyAsset);
const sellValue = Number(route.sellAmount) * sellPrice;const buyValue = Number(route.expectedBuyAmount) * buyPrice;
const priceImpact = ((sellValue - buyValue) / sellValue) * 100;console.log(`Price impact: ${priceImpact.toFixed(2)}%`);
Token Validation
Section titled “Token Validation”Validate tokens before swapping:
// @noErrorValidationasync function validateToken(identifier: string) { try { const token = await SwapKitApi.getTokenList(identifier); return { valid: true, decimals: token.decimals, name: token.name, logo: token.logoURL, }; } catch { return { valid: false }; }}
Configuration Management
Section titled “Configuration Management”SKConfig API
Section titled “SKConfig API”The SKConfig
API provides methods to manage SwapKit’s configuration at runtime. This includes RPC URLs, API keys, custom headers, and environment settings:
Core Methods
Section titled “Core Methods”// @noErrorValidationimport { SKConfig } from '@swapkit/sdk';
const rpcUrls = SKConfig.get('rpcUrls');const apiKeys = SKConfig.get('apiKeys');const midgardUrls = SKConfig.get('midgardUrls');const apiHeaders = SKConfig.get('apiHeaders');
SKConfig.set({ rpcUrls: { ETH: 'https://eth-mainnet.g.alchemy.com/v2/your-key', apiKeys: { swapKit: 'new-key' }, midgardUrls: { THOR: 'https: apiHeaders: { midgard: { 'X-API-Key': 'secret' } }});
API Keys
Section titled “API Keys”// @noErrorValidation
SKConfig.setApiKey("swapKit", "your-swapkit-key");SKConfig.setApiKey("blockchair", "your-blockchair-key");SKConfig.setApiKey("walletConnectProjectId", "your-wc-id");
RPC URLs
Section titled “RPC URLs”// @noErrorValidationimport { Chain } from '@swapkit/sdk';
SKConfig.setRpcUrl(Chain.Ethereum, 'https:SKConfig.setRpcUrl(Chain.Avalanche, 'https:
Midgard URLs
Section titled “Midgard URLs”// @noErrorValidationimport { Chain } from '@swapkit/sdk';
SKConfig.setMidgardUrl(Chain.THORChain, 'https:SKConfig.setMidgardUrl(Chain.Maya, 'https:
API Headers
Section titled “API Headers”// @noErrorValidation
SKConfig.setApiHeaders("midgard", { "X-Client-ID": "your-client-id",});
SKConfig.setApiHeaders("thornode", { "X-Client-ID": "your-client-id",});
SKConfig.setApiHeaders("swapkitApi", { "X-API-Key": "additional-api-key",});
Environment Settings
Section titled “Environment Settings”// @noErrorValidation
SKConfig.setEnv('isDev', true);SKConfig.setEnv('isStagenet', true);
SKConfig.setEnv('apiUrl', 'https:SKConfig.setEnv('devApiUrl', 'https:
Integration Configurations
Section titled “Integration Configurations”// @noErrorValidation
SKConfig.setIntegrationConfig('radix', { dAppDefinitionAddress: 'account_rdx...', applicationName: 'My dApp', applicationVersion: '1.0.0', network: { networkId: 1, networkName: 'mainnet', dashboardBase: 'https: }});
SKConfig.setIntegrationConfig('chainflip', { useSDKBroker: true, brokerUrl: 'https:});
Explorer URLs
Section titled “Explorer URLs”// @noErrorValidation
SKConfig.setExplorerUrl(Chain.Ethereum, 'https:SKConfig.setExplorerUrl(Chain.Bitcoin, 'https:
Complete Example
Section titled “Complete Example”// @noErrorValidationimport { SKConfig, Chain, StagenetChain } from '@swapkit/sdk';
SKConfig.set({ apiKeys: { swapKit: process.env.SWAPKIT_API_KEY, blockchair: process.env.BLOCKCHAIR_API_KEY }, rpcUrls: { [Chain.Ethereum]: 'https: [Chain.Polygon]: 'https: }, midgardUrls: { [Chain.THORChain]: 'https: [StagenetChain.THORChain]: 'https: }, apiHeaders: { midgard: { 'X-Client-ID': process.env.CLIENT_ID }, thornode: { 'X-Client-ID': process.env.CLIENT_ID } }, envs: { isDev: process.env.NODE_ENV === 'development', isStagenet: false }});
if (userPrefersTestnet) { SKConfig.setEnv('isStagenet', true);
}
Fee Multiplier System
Section titled “Fee Multiplier System”SwapKit provides a unified fee multiplier system across all chains:
// @noErrorValidationimport { FeeOption, getFeeMultiplier } from "@swapkit/sdk";
const slowMultiplier = getFeeMultiplier(FeeOption.Slow);const avgMultiplier = getFeeMultiplier(FeeOption.Average);const fastMultiplier = getFeeMultiplier(FeeOption.Fast);const fastestMultiplier = getFeeMultiplier(FeeOption.Fastest);
const baseFee = 1000000;const fastFee = Math.floor(baseFee * getFeeMultiplier(FeeOption.Fast));
await wallet.transfer({ recipient: "0x...", assetValue: AssetValue.from({ chain: Chain.Ethereum, value: "1" }), feeOptionKey: FeeOption.Fast,});
Key Features
Section titled “Key Features”- Automatic Stagenet Support: When
isStagenet
is true, appropriate stagenet URLs are used automatically - Custom Headers: Set authentication headers for Midgard, THORNode, and SwapKit APIs
- Runtime Updates: All configuration can be updated dynamically without recreating SwapKit instances
- Environment-Based Config: Easily switch between development, staging, and production environments
- Unified Fee System: Consistent fee multipliers across all supported chains
TypeScript Type Definitions
Section titled “TypeScript Type Definitions”All SwapKit API methods are fully typed. Here are the comprehensive type definitions:
// @noErrorValidation
interface SwapQuoteRequest { sellAsset: string; sellAmount: string; buyAsset: string; sourceAddress: string; destinationAddress: string; slippage?: number; providers?: ProviderName[]; affiliate?: string; affiliateFee?: number; prioritizeBy?: "output" | "time" | "fees"; isStreaming?: boolean; streamingInterval?: number; streamingQuantity?: number; refundAddress?: string; maxSlippage?: number;}
interface SwapQuoteResponse { routes: SwapRoute[]; meta: QuoteMeta;}
interface SwapRoute { providers: ProviderName[]; sellAsset: string; sellAmount: string; buyAsset: string; expectedBuyAmount: string; expectedBuyAmountMaxSlippage: string; sourceAddress: string; destinationAddress: string; targetAddress: string; memo: string; expiration: string; priceImpact: number; fee: RouteFees; estimatedTime: TimeEstimate; warnings: string[]; isStreaming: boolean; streamingMeta?: StreamingMeta; legs: RouteLeg[];}
interface RouteFees { asset: string; networkFee: string; protocolFee: string; affiliateFee: string; totalFee: string;}
interface TimeEstimate { inbound: number; outbound: number; total: number;}
type ProviderName = | "THORCHAIN" | "THORCHAIN_STREAMING" | "CHAINFLIP" | "CHAINFLIP_STREAMING" | "MAYACHAIN" | "MAYACHAIN_STREAMING" | "UNISWAP_V2" | "UNISWAP_V3" | "SUSHISWAP_V2" | "PANCAKESWAP" | "TRADERJOE_V2" | "PANGOLIN_V1" | "CAMELOT_V3" | "CAVIAR_V1" | "OCISWAP_V1" | "OPENOCEAN_V2" | "JUPITER" | "ONEINCH" | "OKX" | "NEAR";
interface Provider { name: ProviderName; provider: ProviderName; count: number; logoURI?: string; url?: string; keywords: string[]; enabledChainIds: ChainId[]; supportedChainIds: ChainId[]; supportedActions: ProviderAction[];}
type ProviderAction = | "swap" | "aggregation" | "addLiquidity" | "withdrawLiquidity" | "addSavers" | "withdrawSavers" | "borrow" | "repay" | "name" | "donate" | "claim" | "stake" | "unstake";
type ChainId = | "1" | "0x1" | "56" | "0x38" | "137" | "0x89" | "43114" | "0xa86a" | "42161" | "0xa4b1" | "10" | "0xa" | "8453" | "0x2105" | "100" | "0x64" | "bitcoin" | "litecoin" | "bitcoincash" | "dogecoin" | "dash" | "thorchain-1" | "thorchain-stagenet-v2" | "mayachain-mainnet-v1" | "mayachain-stagenet-v1" | "cosmoshub-4" | "noble-1" | "kaiyo-1" | "solana" | "near" | "ripple" | "polkadot" | "radix-mainnet" | "728126428" | "0x2b6653dc" | "zcash" | "chainflip" | "fiat";
interface TokenInfo { chain: string; address?: string; chainId: ChainId; ticker: string; identifier: string; symbol: string; name?: string; decimals: number; logoURI?: string; extensions?: Record<string, any>; shortCode?: string; coingeckoId?: string;}
interface TrackTransactionRequest { hash: string; chain: string; provider?: ProviderName; actionType?: string; fromAddress?: string; toAddress?: string;}
interface TransactionStatus { status: "pending" | "processing" | "completed" | "failed"; progress: { current: number; total: number; percentage: number; }; startTime: number; endTime?: number; estimatedDuration?: number; legs: TransactionLeg[]; fees: TransactionFees; errors: TransactionError[];}
interface TransactionLeg { chain: string; hash: string; status: string; blockHeight?: number; confirmations?: number; inAmount: string; outAmount: string; gasUsed?: string; gasPrice?: string; timestamp: number;}
interface ScreenAddressRequest { address: string; chain: string; amount?: string; asset?: string; action?: string; userCountry?: string;}
interface AddressScreeningResult { address: string; chain: string; riskScore: number; riskLevel: "low" | "medium" | "high" | "blocked"; sanctions: SanctionsInfo; categories: RiskCategory[]; labels: AddressLabel[]; compliance: ComplianceInfo; recommendation: "proceed" | "review" | "block"; lastUpdated: string;}
interface SanctionsInfo { isBlocked: boolean; lists: string[]; lastUpdated: string;}
interface GasHistoryRequest { chain: string; period?: "1h" | "6h" | "24h" | "7d" | "30d"; startTime?: number; endTime?: number; interval?: "5m" | "15m" | "1h" | "4h" | "1d";}
interface GasHistoryResponse { chain: string; period: string; interval: string; unit: string; data: GasDataPoint[]; statistics: GasStatistics; recommendations: GasRecommendations;}
interface GasDataPoint { timestamp: number; low: number; average: number; high: number; percentile95: number; volume: number; utilization: number;}
interface CreateNearChannelRequest { sellAsset: string; buyAsset: string; sellAmount: string; destinationAddress: string; slippage?: number; affiliateAddress?: string; affiliateFee?: number;}
interface NearChannelResponse { channelId: string; depositAddress: string; functionCall: NearFunctionCall; estimatedOutput: string; estimatedOutputWithSlippage: string; estimatedTime: number; expiresAt: number; fees: NearChannelFees;}
interface ChainBalance { identifier: string; value: string; decimal: number;}
interface PriceRequest { identifier?: string; identifiers?: string[]; currency?: string;}
interface PriceData { identifier: string; price: number;}
interface SwapKitApiError { error: string; message: string; data?: any;}
Next Steps
Section titled “Next Steps”- Implement Cross-Chain Swaps using the quote API
- Set up Transaction Tracking for better UX
- Explore THORChain Features for advanced DeFi