Avalanche SDK for TypeScript is a modular suite for building on the Avalanche ecosystem. It covers:
- Direct chain access (RPC, wallets, transactions)
- Indexed data + metrics (Glacier Data API & Metrics API)
- Interchain messaging (ICM/Teleporter for cross–L1 apps)
This monorepo includes multiple specialized SDKs, each designed for specific use cases while maintaining consistency and interoperability.
⚠️ Developer Preview: This suite of SDKs is currently in beta and is subject to change. We'd love to hear about your experience! Please share your feedback here. Use in production at your own risk.
SDK | Description |
---|---|
@avalanche-sdk/client |
Direct blockchain interaction - transactions, wallets, RPC calls |
@avalanche-sdk/chainkit |
Complete suite: Data, Metrics and Webhooks API |
@avalanche-sdk/interchain |
Send messages between Avalanche L1s using ICM/Teleporter |
The main Avalanche client SDK for interacting with Avalanche nodes and building blockchain applications.
Features:
- Complete API coverage for P-Chain, X-Chain, and C-Chain
- Full viem compatibility - anything you can do with viem works here
- TypeScript-first design with full type safety
- Abstractions over the JSON-RPC API to make your life easier
- Wallet integration and transaction management
- First-class APIs for interacting with Smart Contracts
- Retrieve balances and UTXOs for addresses
- Build, sign, and issue transactions to any chain
- Perform cross-chain transfers between X, P and C chains
- Add validators and delegators
- Create subnets and blockchains, convert subnets to L1s
Combined SDK with full typed coverage of Avalanche Data (Glacier) and Metrics APIs.
Features:
- Full endpoint coverage for Glacier Data API and Metrics API
- Glacier API: https://glacier-api.avax.network/api
- Metrics API: https://metrics.avax.network/api
- Strongly-typed models, pagination helpers, and automatic retries/backoff
- High-level helpers for transactions, blocks, addresses, tokens, NFTs, and logs
- Metrics: network health, validator stats, throughput, latency, and block production analytics
- Webhooks-compatible payload shapes and utilities for signature verification
- Configurable base URL and API key authentication
- Request logging and middleware hooks for observability
SDK for building cross-L1 applications and bridges.
Features:
- Type-safe ICM client for sending cross-chain messages
- Works seamlessly with wallet clients
- Built-in support for Avalanche C-Chain and custom subnets
- Node.js 20+
- npm, yarn, or pnpm
- TypeScript 5.0+ (recommended)
# Install only what you need
npm install @avalanche-sdk/client # Core RPC functionality
npm install @avalanche-sdk/interchain # Cross-chain messaging
npm install @avalanche-sdk/chainkit # Indexed data, metrics, and webhooks
import { createAvalancheClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http"
}
})
// Get account balance
const balance = await client.getBalance({
address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
View more Client SDK examples →
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
chainId: "43114",
});
async function run() {
const result = await avalanche.data.evm.address.balances.listErc20({
address: "0x8ae323046633A07FB162043f28Cea39FFc23B50A",
});
console.log(JSON.stringify(result, null, 2));
}
run();
View more ChainKit SDK examples →
import { createWalletClient, http } from "viem";
import { createICMClient } from "@avalanche-sdk/interchain";
import { privateKeyToAccount } from "viem/accounts";
import * as dotenv from 'dotenv';
// Load environment variables
dotenv.config();
// these will be made available in a separate SDK soon
import { avalancheFuji, dispatch } from "@avalanche-sdk/interchain/chains";
// Get private key from environment
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error("PRIVATE_KEY not found in environment variables");
}
// Load your signer/account
const account = privateKeyToAccount(privateKey as `0x${string}`);
// Create a viem wallet client connected to Avalanche Fuji
const wallet = createWalletClient({
transport: http('https://api.avax-test.network/ext/bc/C/rpc'),
account,
});
// Initialize the ICM client
const icmClient = createICMClient(wallet);
// Send a message across chains
async function main() {
try {
const hash = await icmClient.sendMsg({
sourceChain: avalancheFuji,
destinationChain: dispatch,
message: 'Hello from Avalanche Fuji to Dispatch Fuji!',
});
console.log('Message sent with hash:', hash);
} catch (error) {
console.error('Error sending message:', error);
process.exit(1);
}
}
main();
View more Interchain SDK examples →
- Custom RPC endpoints and API gateways
- Transaction broadcasting services
- Multi-chain wallet backends
- Account management systems
- Portfolio tracking applications
- Transaction history explorers
- Token balance dashboards
- Network health monitoring tools
- Validator performance trackers
- Price alert systems
- Transaction notification services
- Smart contract event monitors
- Blockchain activity feeds
- ICM message relayers
- Cross-L1 notification systems
- Interchain data synchronization
- Multi-chain coordination tools
- Smart contract debugging interfaces
- Transaction simulation tools
- Network testing utilities
- Blockchain data indexers
Each SDK includes comprehensive documentation:
- Client SDK Documentation - Complete API reference and usage examples
- ChainKit SDK Documentation - Development utilities guide
- Interchain SDK Documentation - Cross-chain development guide
Each SDK includes practical examples demonstrating common use cases:
- Client SDK Examples - View Examples
- ChainKit SDK Examples - View Examples
- Interchain SDK Examples - View Examples
The Avalanche SDK TypeScript suite is designed with modularity in mind:
avalanche-sdk-typescript/
├── client/ # Main client SDK
├── chainkit/ # Development tools
└── interchain/ # Cross-chain SDK
Each SDK is:
- Independent - Can be used standalone
- Modular - Import only what you need
- Type-safe - Full TypeScript support
- Well-documented - Comprehensive guides and examples
- Use the unified SDK for better tree-shaking when using multiple features
- Enable request batching for bulk operations
- Implement proper error handling and retries
- Cache frequently accessed data
- Use WebSocket connections for real-time data
- Never expose private keys in client-side code
- Use environment variables for sensitive data
- Validate all inputs before blockchain interactions
- Implement proper access controls
- Follow security best practices
Issue | Solution |
---|---|
Module not found errors |
Ensure you're using Node.js 20+ and have installed dependencies |
TypeScript errors | Update to TypeScript 5.0+ and check tsconfig.json |
Connection timeouts | Check network settings and RPC endpoint availability |
Transaction failures | Verify gas settings and account balance |
Type mismatches | Ensure all SDKs are on compatible versions |
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/ava-labs/avalanche-sdk-typescript.git
cd avalanche-sdk-typescript
# Move to the SDK directory you want to work on
cd client
# Install dependencies
npm install
# Run tests
npm test
# Build all packages
npm run build
Check out our good first issues to get started!
- Technical Issues: GitHub Issues
- Security Issues: [email protected]
- General Inquiries: [email protected]
See CHANGELOG.md for a detailed version history.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Website • Documentation • Blog • GitHub