Skip to main content
Delegated vs Non-Delegated FarmsDifferent farm types use different delegation patterns. For the correct delegatees for your specific farm, check the user farm state returned by getAllFarmsForUser in the “Calculate Claimable User Rewards” tutorial.

Claim User Rewards

Claim all pending rewards from a user’s farm position.
1

Import Dependencies

Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.
2

Load Signer and Initialize RPC

Load your keypair from a file and initialize RPC connections.
3

Load Market and Get Obligation

Load the Kamino market and get the user’s obligation address.
4

Build Claim Instructions

Use the Farms SDK to build claim instructions for all rewards on the farm.
The delegatees array values depend on your specific farm position. To find the correct delegatee addresses for your farm, use the “Calculate Claimable User Rewards” tutorial - it shows the actual delegatee in the user farm state.
5

Build and Sign Transaction

Use Kit’s functional pipe pattern to build and sign the transaction with a fresh blockhash.
6

Send and Confirm Transaction

Send the transaction to the network and wait for confirmation.
The rewards have been claimed and transferred to your wallet. You can verify the transaction using the signature on a Solana explorer.