Skip to main content
Deposit collateral, borrow, repay, and withdraw through the vault’s Kamino lending obligation.

Configure the policies

Use a loaded vault, connection, and manager Keypair. Select the market and reserve from the SDK’s published catalog. KaminoMarket.MAIN identifies Kamino’s SOL/BTC market in this SDK.
The market, reserve, and mint filters must all match when supplied. Despite its name, allowedDepositMints applies to all four actions. Omitting a filter or passing an empty list removes that restriction. Include every reserve/mint needed by your strategy. New lending accounts require a separate initialization policy. Build it with public constraint helpers:
Install both policies using Configure policies. Keep explicit initialization and lending actions in separate addActions steps or sync calls so each execution matches one policy. Leave policyPda omitted for automatic matching.

Prepare the lending accounts

The Squads owner needs Kamino user metadata and an obligation for the selected lending market. Initialize missing accounts once:
Execute this array through the initialization policy, separately from deposits. On a funded vault, use autoManagePositions: false for explicit initialization, then register the obligation through a proposal; default automatic registration requires zero AUM. The transaction builder can prepare missing accounts automatically when the corresponding policies are installed. Register the obligation before allocating to it, unless the zero-AUM automatic setup already registered it. The sync tab below shows registration for a newly initialized, empty obligation. New obligation registration on a funded vault requires a proposal. Pre-register intended reserve price/farm mappings with vault.ixRegisterKaminoObligationReserve({ authority: manager.publicKey, obligation, reserve: reserve.pubkey }). Confirm each update, refresh AUM, and reload before building the lending action. This avoids relying on first-use mapping updates during policy execution. Price paths must cover both collateral and debt; an existing obligation also needs mappings for its current reserves.

Deposit, borrow, and repay

This deposits 1 SOL as collateral. Amounts use the underlying token’s smallest units; the SDK resolves the collateral-token accounting.
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.

Withdraw collateral or manage debt

Use the chosen array in either execution path. Borrow only after the obligation has sufficient collateral. Refresh and reload after preceding executions before building a dependent borrow, repayment, or withdrawal. Discover asset keys with Object.keys(KAMINO_RESERVES[market]); choose the reserve from that market rather than reusing a key from another market. SOL uses the vault’s wrapped-SOL token account; arrange its funding before allocation and keep it tracked like other token accounts.