Use these instructions when your strategy vault should interact with a Kamino Farm user_state. The examples below assume the managed vault already holds the farm’s underlying token ATA.
delegatee defaults to the managed vault owner. stake, unstake, and withdrawUnstakedDeposits only support direct farms. harvestReward supports delegated farms, including obligation-owned farm entries.
These examples use createVaultSyncTransaction because each Kamino Farm action is a single low-level sync step. For chained flows such as Kamino Vault deposit-then-stake, use VaultTransactionBuilder.
Transaction structure
At the low level, each Kamino Farm action is built with createVaultSyncTransaction.
createVaultSyncTransaction defaults autoManagePositions to false. If you use that default and the farm user_state does not exist yet, initialize it first.
Initialize user
kaminoFarmAction.initializeUser creates the farm user_state PDA for the managed vault owner by default.
Parameters
For delegated farms, initializeUser only supports the managed vault owner path. The SDK rejects initialization for another delegatee on a delegated farm.
Stake
kaminoFarmAction.stake stakes the managed vault’s underlying token ATA into a direct Kamino Farm.
Parameters
stake rejects delegated farms. If the target farm is delegated, the SDK throws instead of building a direct stake instruction.
Unstake
kaminoFarmAction.unstake unstakes a scaled share amount from a direct Kamino Farm.
Parameters
unstake rejects delegated farms.
Withdraw unstaked deposits
kaminoFarmAction.withdrawUnstakedDeposits withdraws matured unstaked deposits from a direct Kamino Farm back into the managed vault ATA.
Parameters
withdrawUnstakedDeposits rejects delegated farms.
Harvest reward
kaminoFarmAction.harvestReward harvests one reward index into the managed vault reward ATA. This action supports delegated farms.
Parameters
The SDK adds an idempotent reward ATA creation instruction before the harvest runs.
Related pages