Docssdk
Circle SDK & Adapters Reference
Comprehensive setup references for developers integrating Circle App Kit, Unified Balance Kit, and Developer-Controlled Wallets.
1. Circle App Kit (`@circle-fin/app-kit`)
The primary entry point. Integrates swaps, sends, and bridges. Setup does not require an API kit key for standard bridge operations.
import { AppKit } from '@circle-fin/app-kit';
import { createViemAdapterFromProvider } from '@circle-fin/adapter-viem-v2';
// 1. Initialize core App Kit client
export const appKit = new AppKit();
// 2. Wrap connected Web3 provider with Viem adapter
export async function getViemAdapter(provider: any) {
return createViemAdapterFromProvider({
provider,
capabilities: {
addressContext: 'user-controlled',
supportedChains: ['Ethereum_Sepolia', 'Base_Sepolia', 'Arc_Testnet'],
},
});
}2. Unified Balance Kit
Allows checking stablecoin balances across multiple chains simultaneously. It aggregates confirmed and pending balances natively.
// Request aggregated USDC positions
const balances = await appKit.unifiedBalance.getBalances({
token: 'USDC',
sources: {
address: '0x32A78... (EOA Address)',
chains: ['Ethereum_Sepolia', 'Base_Sepolia', 'Arc_Testnet']
},
includePending: true,
networkType: 'testnet'
});
console.log("Total aggregated balance:", balances.totalConfirmedBalance);3. Swap Kit (`@circle-fin/swap-kit`)
Used server-side to calculate rate estimations and execute stablecoin swaps. Requires a backend API key.
import { SwapKit } from '@circle-fin/swap-kit';
const swapKit = new SwapKit({
apiKey: process.env.CIRCLE_API_KEY,
kitKey: process.env.CIRCLE_KIT_KEY
});
// Fetch estimation
const rate = await swapKit.estimateSwap({
chain: 'Arc_Testnet',
tokenIn: 'USDC',
tokenOut: 'EURC',
amountIn: '10.00'
});
// Execute transaction
const swapTx = await swapKit.swap({
chain: 'Arc_Testnet',
tokenIn: 'USDC',
tokenOut: 'EURC',
amountIn: '10.00',
slippageBps: 100, // 1%
recipientAddress: '0xClientAddress...'
});