Earn Withdraw with SDK
1
Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.2
Load Keypair and Initialize Vault
Load the keypair from file, initialize RPC connections, and create the vault instance.3
Build Withdraw Instructions
Generate withdraw instructions for the specified amount, including optional unstaking.The SDK’s
withdrawIxs method generates all the necessary instructions to withdraw assets from the vault, including automatic unstaking if needed. The amount represents vault shares to redeem.4
Build and Sign Transaction
Fetch the latest blockhash and construct the transaction message using the functional pipe pattern.5
Send and Confirm Transaction
Submit the signed transaction to the Solana network and wait for confirmation.Your withdrawal is complete! The SDK handled all the complexity of building the transaction, and your vault shares have been redeemed for the underlying assets.