Skip to content

Instantly share code, notes, and snippets.

@stanNthe5
stanNthe5 / sampleSwap.ts
Last active February 9, 2026 15:39
PrivacyCash SDK frontend usage sample codes
import { deposit, depositSPL, EncryptionService, getBalanceFromUtxos, getBalanceFromUtxosSPL, getUtxos, withdraw } from "privacycash/utils"
import { sha256 } from "@noble/hashes/sha2";
import { hkdf } from "@noble/hashes/hkdf";
import { Connection, Keypair, PublicKey, VersionedTransaction } from "@solana/web3.js";
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
let publicKey = new PublicKey('YourPublicKeyHere');
let connection = new Connection('https://api.mainnet-beta.solana.com');
// Assume walletProvider and signTransaction are initialized elsewhere