Back
Orvanta

TypeScript SDK

Full-featured SDK for Orvanta Protocol. Shield, unshield, and swap privately on Solana.

npm install @orvanta/sdk

Basic Shielding

import { OrvantaClient } from "@orvanta/sdk"

const client = new OrvantaClient()

// Shield 100 SOL to private balance
const result = await client.shield({
    amount: 100,
    token: "SOL",
    recipient: await client.generateStealthAddress()
})

console.log(result.txHash)        // Transaction signature
console.log(result.proof)         // ZK-SNARK proof
console.log(result.commitment)    // Note commitment
console.log(result.privacyScore)  // 98

Private Swap

import { OrvantaClient } from "@orvanta/sdk"

const client = new OrvantaClient()

// Swap SOL to USDC privately
const swapResult = await client.privateSwap({
    fromToken: "SOL",
    toToken: "USDC",
    amount: 10,
    slippage: 0.5
})

console.log(swapResult.outputAmount)  // 1,425.50
console.log(swapResult.proof)         // Valid ZK proof
console.log(swapResult.route)         // Jupiter (shielded)

Unshield with Relayer

import { OrvantaClient } from "@orvanta/sdk"

const client = new OrvantaClient()

// Unshield to public wallet via relayer (for gas)
const unshieldResult = await client.unshield({
    amount: 50,
    token: "SOL",
    recipient: "7xKXt...8mPq",
    useRelayer: true,     // Relayer pays gas
    delay: 5              // Wait 5 blocks for privacy
})

console.log(unshieldResult.estimatedTime)  // "~2 min"
console.log(unshieldResult.privacyBonus)   // +20%

API Reference

OrvantaClient

Core SDK client

shield(params)Shield tokens to private balance
unshield(params)Unshield tokens to public wallet
privateSwap(params)Execute private swap
generateStealthAddress()Create new stealth address
ShieldParams

Shield configuration

amountAmount to shield
tokenToken mint or 'SOL'
recipientStealth address
memo?Encrypted memo
ShieldResult

Shield operation result

.txHashTransaction signature
.proofZK-SNARK proof
.commitmentNote commitment
.privacyScorePrivacy score (0-100)

Try it in the Privacy Lab

Simulate shielding and calculate privacy scores

Open Lab