Skip to main content
Deposit vault tokens into a Kamino Vault and redeem the resulting shares when you want to withdraw.

Configure the policy

Use a loaded vault, connection, and manager Keypair. Set kaminoVault to the Kamino Vault address you selected in Kamino Earn. Read its deposit and share mints from the account:
Install policyConfig using Configure policies. Both filters must match. Omitting a filter or passing an empty list removes that restriction.

Prepare share valuation

The Exponent team must configure a Kamino Vault price source for sharesMint, valued in depositMint, plus a price path from the deposit mint to your vault’s accounting denomination. fetchKaminoVaultPriceContext(connection, kaminoVault) supplies the current vault/reserve interface accounts and lookup table for that price source. The transaction builder uses the registered source to prepare share tracking and required refreshes. It also creates the shares ATA before a deposit. For the sync example, first create the shares ATA owned by vault.state.squadsVault, track the underlying token, and register the shares using TrackKaminoVaultShares with its deposit mint and price-interface account. Submit the position update, refresh AUM, and reload the vault before constructing the deposit. Shares must not already be registered as an ordinary token entry.

Deposit and withdraw

amount is measured in the deposit token’s smallest units. This deposits 1_000_000 units; it is one token only when that mint has six decimals.
build() returns an execution plan: ordered transactionSets containing instructions, additional signers, and lookup table addresses. The builder schedules supported setup and refreshes; send() simulates and submits the sequence.

Redeem shares

Replace the deposit action with a withdrawal. sharesAmount is in share-mint units, rather than units of the underlying token:
Use withdrawalActions in the chosen execution path. Omit reserve to let the SDK plan the withdrawal across the Kamino Vault’s allocated lending reserves. Supply a specific reserve address only when you want to select that underlying reserve leg. The builder and plural sync helper can return several sequential transactions for an omitted-reserve withdrawal. Execute all returned results in order. createVaultSyncTransaction requires exactly one result and throws when the plan needs more; the plural helper does not split arbitrary oversized actions. To stake these shares, use Kamino Farms.