Skip to main content
Deposit to Kamino Earn vaults using Privy embedded wallets. This integration allows users to deposit without managing their own private keys.

Earn Deposit from Privy

1

Import Dependencies

Import the required packages for Privy client, Solana RPC communication, and Kamino SDK operations.
2

Configure Privy and Initialize Client

Set up your Privy credentials and initialize the Privy client and RPC connection.
Update the configuration values with your Privy app credentials and user details. This example uses the Steakhouse USDC Vault.
3

Create Privy User and Wallet

Create a Privy user account and generate an embedded Solana wallet.
Before proceeding, fund the wallet with SOL (for transaction fees) and USDC (for deposit). The wallet cannot submit transactions without sufficient funds.
4

Load the Vault

Initialize the vault and load its state, reserves, and farm state once. The deposit instructions need all three.
5

Build Deposit Instructions

Generate the deposit instructions using a noop signer, with slippage protection on the minted shares.
A noop signer is used to build instructions without requiring the actual private key. Privy will handle signing later. Use the same noopSigner as the fee payer in the next steps, since two signer objects for one address cause a “Multiple distinct signers” error.
6

Load the Vault’s Lookup Table

Fetch the vault’s address lookup table to keep the transaction small.
7

Build Transaction Message

Fetch the latest blockhash and construct the compressed transaction message.
8

Sign Transaction with Privy

Compile the transaction, serialize it, and sign using Privy’s wallet API.
Privy handles the signing securely using the embedded wallet. The private key never leaves Privy’s infrastructure.
9

Send and Confirm Transaction

Decode the transaction Privy signed, then send it and wait for confirmation.
Privy returns the signed transaction as a base64 string. Decoding it and adding the blockhash lifetime from the compiled transaction lets sendAndConfirmTransactionFactory send it and wait until it is confirmed or its blockhash expires.
Your deposit is complete! The user’s funds are now deposited in the Kamino Earn vault using their Privy embedded wallet.