@haichainsi/sdk
v6.2.1
Published
HAICHAIN: Mass-Consumer & Frontier AI Autonomous Agent Client SDK
Maintainers
Readme
@haichainsi/sdk
HAICHAIN: Universal Autonomous Machine Financial Operating System Client SDK for TypeScript / Node.js.
Official TypeScript SDK for interacting with the HAICHAIN Protocol on Solana. Provides high-level abstractions for autonomous AI agents, programmatic micro-escrow streams, x402 payment headers, SLA bonded providers, and cross-chain intent settlement.
📦 Installation
npm install @haichainsi/sdk @solana/web3.js @coral-xyz/anchorOr using yarn / pnpm:
pnpm add @haichainsi/sdk @solana/web3.js @coral-xyz/anchor🚀 Quick Start
1. Initialize Client
import { Connection, PublicKey } from "@solana/web3.js";
import { HaiChainClient } from "@haichainsi/sdk";
const connection = new Connection("https://api.devnet.solana.com", "confirmed");
const programId = new PublicKey("DK4QA3WK49SWR86GsqDRQSVNhoVRe1MMQGYZ7hKJw4xk");
const client = new HaiChainClient(connection, programId);
console.log("HAICHAIN SDK initialized successfully!");2. Create Fiat / Crypto Deposit Session
const session = await client.createUsdtDepositSession({
userUid: "user_agent_001",
amountUsdt: 5.0,
preferredRail: "apple_pay"
});
console.log("Deposit Address (Solana SPL):", session.depositAddressSolanaSpl);
console.log("Checkout URL:", session.checkoutUrlFiat);3. HTTP x402 Micropayment Header Generator
Easily integrate autonomous agent payments into API calls:
// Construct standard X-402 challenge headers
const paymentHeaders = {
"X-402-PayTo": "provider_ata_address_here",
"X-402-Amount": "1000", // 0.001 USDT (1 Action Credit)
"X-402-Nonce": "random_crypto_nonce"
};🏛️ Core Architectural Pillars
- SLA Staked Provider Bonds & Slashing Invariants: Cryptographic proof verification and penalty slashing for faulty data.
- Hybrid Web2 to DePIN Fallback Router: Seamless failover to decentralized compute/data when Web2 providers deplatform.
- Cross-Chain Intent-based Solver Mesh: Gasless, instant execution across Base/EVM and Solana with zero bridge delay.
- Dynamic Spot Tickets & Micro-Auctions: Real-time capacity pricing based on network saturation.
- Enterprise Rollup Invoicing: Big 4 audit-ready VAT/GST invoices backed by Merkle roots.
🔗 Resources
- Official Website: haichain.si
- Developer Documentation: haichain.si/dashboard?tab=mcp
- Model Context Protocol Server: @haichainsi/mcp-server
- Whitepaper: haichain.si/whitepaper.html
📄 License
Apache-2.0 © HAICHAIN Foundation
