Documentation
Everything you need to build with Kuberna Labs.
npm install @kuberna/sdkQuick Start
Get started with Kuberna in just a few minutes. Install the SDK, initialize the client, and start building.
1. Initialize the client
import { KubernaClient } from '@kuberna/sdk';
const client = new KubernaClient({
baseUrl: 'https://api.kuberna.com',
});2. Parse a natural language intent
const intent = await client.ai.parseIntent(
'swap 1 ETH for USDC on Solana'
);
console.log(intent);
// { sourceChain: 'ethereum', sourceToken: 'ETH',
// sourceAmount: '1.0', destChain: 'solana',
// destToken: 'USDC', confidence: 0.95 }3. Create a cross-chain payment
const payment = await client.payment.createIntent({
sourceChain: 'ethereum',
sourceToken: 'ETH',
sourceAmount: '1.0',
destChain: 'solana',
destToken: 'USDC',
minDestAmount: '4500',
timeoutSeconds: 3600,
});Cross-Chain Intents
Parse natural language into structured cross-chain intents using local AI.
Parse Intent
const intent = await client.ai.parseIntent(
'bridge 500 USDC from Ethereum to Arbitrum'
);Get Agent Decision
const decision = await client.ai.getDecision(
'agent-id-123',
{ strategies: ['arbitrage', 'yield'] }
);Market Analysis
const analysis = await client.ai.analyze('ETH', {
indicators: ['price', 'volume', 'volatility'],
});Payments
Create and manage cross-chain payment intents.
Create Payment Intent
const payment = await client.payment.createIntent({
sourceChain: 'ethereum',
sourceToken: 'USDC',
sourceAmount: '500',
destChain: 'arbitrum',
destToken: 'USDC',
minDestAmount: '499',
timeoutSeconds: 3600,
});Check Status
const status = await client.payment.getStatus(payment.id);
// { status: 'pending' | 'filled' | 'settled' | 'expired' }Release & Refund
// Release funds (seller)
await client.payment.release(payment.id);
// Refund funds (buyer)
await client.payment.refund(payment.id);TEE Deployment
Deploy agents in Trusted Execution Environments for secure, verifiable execution.
Create Enclave
const enclave = await client.tee.createEnclave({
name: 'trading-bot-1',
image: 'kuberna/agent:latest',
env: { STRATEGY: 'arbitrage', MAX_POSITION: '1000' },
});Verify Attestation
const attestation = await client.tee.verifyAttestation(enclave.id);List & Destroy
// List all enclaves
const enclaves = await client.tee.listEnclaves();
// Destroy an enclave
await client.tee.destroyEnclave(enclave.id);Certificates
Mint and verify NFT course completion certificates.
Mint Certificate
const cert = await client.certificate.mint({
courseId: 'defi-101',
recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18',
metadata: { title: 'DeFi Fundamentals', grade: 'A' },
});Verify & Query
// Verify a certificate
const isValid = await client.certificate.verify(cert.tokenId);
// Get certificates for a user
const myCerts = await client.certificate.getByUser('0x...');
// Get certificates for a course
const courseCerts = await client.certificate.getByCourse('defi-101');Error Handling
All SDK errors are typed for precise handling.
import {
KubernaError,
AuthenticationError,
ValidationError,
NotFoundError,
NetworkError,
} from '@kuberna/sdk';
try {
await client.payment.getStatus('invalid-id');
} catch (error) {
if (error instanceof ValidationError) {
console.error('Invalid input:', error.details);
} else if (error instanceof AuthenticationError) {
console.error('Auth failed:', error.message);
} else if (error instanceof NetworkError) {
console.error('Network issue:', error.message);
} else if (error instanceof KubernaError) {
console.error('SDK error:', error.code, error.message);
}
}