Getting Started
Sona provides cryptographically attested Solana transactions through a simple JavaScript SDK. This guide will get you up and running in minutes.
Installation
Install the Sona kit package:
npm install @sonabuild/kit
Basic Usage
Here's a complete example of creating an attested deposit transaction:
import { Sona } from '@sonabuild/kit';
// Initialize the client
const sona = new Sona({
wallet: userPublicKey // Solana wallet address as string
});
// Create an attested deposit intent
// Note: amount is in base units (100 USDC = 100_000_000 with 6 decimals)
const intent = await sona.solend.deposit({
amount: 100_000_000, // 100 USDC (6 decimals)
includeAttestation: true // Optional: include full attestation document
});
// Verify the attestation signature
const isValid = await intent.verify();
console.log('Attestation valid:', isValid);
// Use the confirm() method to sign and send
await intent.confirm(async (intents) => {
// Your sign and send logic here
// See examples below
});
Key Concepts
Intent
An Intent is Sona's core abstraction. When you call a protocol method (like sona.solend.deposit()), you receive an Intent object containing:
transaction- The base64-encoded Solana transactionattestation.signature- Ed25519 signature from the enclaveintegrityPubkeyB64- Public key for verificationverify()- Method to verify the attestation
Attestation
Every transaction built by Sona includes a cryptographic attestation proving it was generated inside a secure AWS Nitro Enclave. This protects against supply chain attacks and malicious code injection.
Dynamic Routing
Sona uses a Proxy-based API that automatically maps method calls to API routes:
sona.solend.deposit({ ... }) // → POST /solend/deposit
sona.solend.withdraw({ ... }) // → POST /solend/withdraw
sona.jupiter.swap({ ... }) // → POST /jupiter/swap
sona.wallet.transfer({ ... }) // → POST /wallet/transfer
Next Steps
- Client Configuration - Learn about all configuration options
- Intents - Deep dive into Intent objects
- Protocol Guide - Explore supported protocols
- API Reference - Complete API endpoint documentation