Skip to main content
Privy handles user authentication and wallet management. You build transactions with tokens (SOL, SPL or compressed) and Privy signs them client-side:
  1. Authenticate with Privy
  2. Build unsigned transaction
  3. Sign transaction using Privy’s wallet provider
  4. Send signed transaction to RPC

What you will implement

SPLCompressed
Get BalancegetAccount()getCompressedTokenAccountsByOwner()
TransfertransferChecked()transfer()
CompressN/Acompress()
DecompressN/Adecompress()
Transaction HistorygetSignaturesForAddress()getCompressionSignaturesForOwner()
1

Prerequisites

Connect to an RPC endpoint that supports ZK Compression (Helius, Triton)
Before we can compress or decompresss, we need:
  • An SPL mint with an interface PDA for compression. This interface PDA can be created for new SPL mints via createMint() or added to existing SPL mints via createTokenPool().
  • For compress() SPL tokens in an Associated Token Account, or
  • For decompress() compressed token accounts with sufficient balance.
2

Full Code Examples

Find a complete example on Github: privy/nodejs-privy-compressed.
Send compressed tokens to another recipient, similar to SPL token transfers:
  1. Fetch compressed token accounts with getCompressedTokenAccountsByOwner
  2. Select sender accounts with selectMinCompressedTokenAccountsForTransfer
  3. Fetch a validity proof from your RPC provider to prove the account’s state correctness
  4. Build the transfer instruction and transaction
  5. Sign with Privy and send transaction

Get balances

Fetch SPL and compressed token balances.

Get transaction history

Fetch compressed token transaction history for an owner, with optional detailed compression information.