Learn how to create a Kamino vault with custom fee structures, deposit limits, and allocation strategies. The SDK manages vault initialization, metadata setup, and lookup table creation to optimize future transactions.
Creating a Vault
Initialize a new vault with custom configuration and prepare it for user deposits.Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.Load Admin Keypair and Initialize Manager
Load the admin keypair from file and initialize the Kamino manager with proper slot timing.parseKeypairFile loads an existing keypair from a JSON file that will become the vault admin. The slot duration is used for accurate vault timing calculations.Configure Vault
Create a vault configuration with the core identity and fee structure.The operational parameters above are optional — omit them to use the defaults. All parameters are editable post-creation using specialized update methods. Unallocated weight and cap are set post-creation only — see the Configure Vault Parameters step below.
Generate Vault Creation Instructions
Pass the vault configuration to the Kamino manager to generate all required initialization instructions.The
createVaultIxs method returns a vault signer plus instruction bundles for creating associated token accounts, initializing the vault, creating a lookup table (LUT), initializing share token metadata, and registering the Vault Farm and First Loss Capital Farm addresses on the vault. The farm accounts themselves are created in separate transactions — see the farm creation step below.Build, Send, and Confirm Transaction
Use Kit’s functional pipe pattern to build, sign, and send the transaction. We define a reusable helper since vault creation involves multiple transactions:Kit’s
pipe function enables functional composition of transaction building steps. signTransactionMessageWithSigners automatically handles all required signers including the vault keypair embedded in the instructions.Create and Attach Farms
ThecreateVaultIxs method generates instructions for the Vault Farm (reward distribution), First Loss Capital Farm (loss-absorbing capital), and Autocompound Farm. Each farm requires two sequential transactions: setup and update.Farm creation is ideally done during vault initialization. If skipped, farms can be created post-creation using
kaminoManager.createVaultFarmIxs(adminSigner, vault) to create the farm account, then registered on the vault using kaminoManager.updateVaultFarmIxs(vault, farm) for the Vault Farm or kaminoManager.updateVaultFirstLossCapitalFarmIxs(vault, farm) for the FLC Farm. See Farms & Rewards for the full post-creation flow.Configure Vault Parameters (Post-Creation)
After the vault is created, configure parameters that are only available post-creation (unallocated weight/cap), or update any parameter set during init. Each method returns{ updateVaultConfigIx } — send via buildAndSendTx.