The @axionax/sdk provides a comprehensive TypeScript toolkit for building decentralized applications on the Axionax Protocol. It handles RPC communication, wallet management, and complex DeAI escrow logic natively.
Installation
pnpm add @axionax/sdk # or npm install @axionax/sdkCore Features
1. Creating a Client
The client is the primary entry point for blockchain interactions.
import { createClient, AXIONAX_TESTNET_CONFIG } from '@axionax/sdk'; import { ethers } from 'ethers'; // Read-only client const client = createClient(AXIONAX_TESTNET_CONFIG); // Client with Signer (for transactions) const provider = new ethers.BrowserProvider(window.ethereum); const signer = await provider.getSigner(); const activeClient = createClient({ ...AXIONAX_TESTNET_CONFIG, provider, signer });2. Escrow Management (Marketplace)
Interact with compute workers using built-in escrow logic.
// Deposit 5 AXX for a compute job const amount = BigInt(5 * 1e18); // 5 AXX in wei await activeClient.depositEscrow('job-123', amount); // Check status const status = await activeClient.getEscrowStatus('job-123'); console.log('Escrow Status:', status.status); // 'Deposited', 'Released', etc. // Release funds when job is done await activeClient.releaseEscrow('job-123');3. Network Utils
const balance = await client.getBalance('0x...'); const chainId = await client.getChainId();Integration in React/Next.js
We recommend initializing the SDK within a React Context or a custom hook (e.g., useAxionax()) to maintain a single instance of the client across your dApp.
