Skip to main content
Phantom, Solflare, Backpack and most current Solana wallets register themselves through Wallet Standard. createCloak drives these wallets through their byte-level solana:signMessage and solana:signTransaction features, so you need no @solana/web3.js and no wallet adapter.

Prerequisites

  • A browser app with a bundler (Next.js, Vite).
  • @cloak.dev/sdk 0.2.20 and @wallet-standard/app.
  • A mainnet RPC URL. See Network and RPC.

1. Find the wallet

Show installed as a picker in a real app. Each entry has a name and an icon.

2. Open the account

If the wallet is not connected yet, the SDK asks it to connect first. Then the wallet shows the Cloak account message:
The first time a wallet opens an account on a device, it signs this message twice, so the SDK can check that it signs the same way each time. Later sessions sign once. Tell users to expect it.

3. Shield, send and withdraw

Only the shield prompts the wallet. Private sends and withdrawals are signed by a key derived from the account, need no SOL in the wallet, and do not show the user’s wallet as the sender.

With @solana/wallet-adapter-react

If your app already uses the wallet adapter, pass useWallet() instead. A Wallet Standard wallet behind the adapter is still driven through its standard features:
The full adapter setup, including legacy adapters and the low-level API, is in Solana wallet adapter.

Transaction format and wallet changes

  • Shields are v0 versioned transactions with address lookup tables. A wallet that can only sign legacy transactions cannot shield.
  • Some wallets add instructions (compute budget, guard instructions) to what they sign. The SDK submits the transaction the wallet returns. A SOL shield is close to Solana’s 1,232-byte packet limit, so additions can push it over. If users of one wallet hit a size error when shielding, the low-level API’s transactionVersion: 1 builds a Transaction V1 with a 4,096-byte limit, for wallets whose solana:signTransaction feature lists version 1. See Low-level API.
  • The SDK submits. It never calls the wallet’s sign-and-send feature, so the transaction goes through your RPC.

Errors you will see

The full list is in Error codes.