Back
TypeScript SDK
Full-featured SDK for Orvanta Protocol. Shield, unshield, and swap privately on Solana.
npm install @orvanta/sdkBasic 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) // 98Private 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
OrvantaClientCore SDK client
shield(params)Shield tokens to private balanceunshield(params)Unshield tokens to public walletprivateSwap(params)Execute private swapgenerateStealthAddress()Create new stealth addressShieldParamsShield configuration
amountAmount to shieldtokenToken mint or 'SOL'recipientStealth addressmemo?Encrypted memoShieldResultShield 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