Creating a Vault
Initialize a new vault with custom configuration and prepare it for user deposits.1
Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.2
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.3
Configure Vault Parameters
Create a vault configuration with fee structures, deposit limits, and allocation settings.The configuration sets fee percentages, minimum amounts for deposits/withdrawals, and allocation parameters. Fees are collected by the vault admin, and the unallocated weight determines how funds are distributed across lending markets.
4
Generate Vault Creation Instructions
Pass the vault configuration to the Kamino manager to generate all required initialization instructions.The
createVaultIxs method takes the vault configuration from Step 3 and returns a vault signer (the vault’s address and keypair) plus instruction bundles for creating associated token accounts, initializing the vault, creating a lookup table (LUT), and initializing share token metadata.5
Build and Sign Transaction
Use Kit’s functional pipe pattern to build and sign the transaction with a fresh blockhash.Kit’s
pipe function enables functional composition of transaction building steps. The signTransactionMessageWithSigners automatically handles all required signers including the vault keypair embedded in the instructions.6
Send and Confirm Transaction
Send the transaction with built-in confirmation. Once confirmed, the vault is fully created and functional. The vault address is available fromvaultSigner.address.