Skip to main content

Earn Deposit with API

1

Import Dependencies

Import the required packages for Solana RPC communication, transaction handling, and Kamino SDK utilities.
2

Configure and Initialize

Set up the configuration and initialize RPC connections.
3

Call Kamino API

Make a POST request to the Kamino API to build the deposit transaction.
The API returns a pre-built transaction encoded in base64 format. This transaction includes Address Lookup Tables (ALTs) for efficiency.
4

Decode Transaction

Decode the base64-encoded transaction and extract the message bytes.
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 deposit is complete! The API built the transaction, you signed it locally (keeping your keys secure), and it was successfully submitted to the network.