Earn Withdraw with API
1
Import Dependencies
Import the required packages for Solana RPC communication, transaction handling, and Kamino SDK utilities.2
3
Call Kamino API
Make a POST request to the Kamino API to build the withdrawal transaction.The API returns a pre-built transaction encoded in base64 format. This transaction includes Address Lookup Tables (ALTs) for efficiency.
4
5
Resolve Address Lookup Tables
Fetch and resolve the Address Lookup Tables from the blockchain.decompileTransactionMessageFetchingLookupTables fetches the lookup table data from the blockchain and resolves all address references. This is required for transactions that use ALTs.A fresh blockhash is fetched and set to ensure the transaction remains valid.
6
Send and Confirm Transaction
Submit the signed transaction to the Solana network.Your withdrawal is complete! The API built the transaction, you signed it locally (keeping your keys secure), and it was successfully submitted to the network.