Skip to main content
Withdraw collateral from Kamino reserve using the API. The API builds the transaction, and you sign it locally keeping your keys secure.

Withdraw via the 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 the Kamino API

Make a POST request to the Kamino API to build the withdraw transaction.
The API returns a pre-built transaction encoded in base64 format ready for signing.
4

Decode Transaction

Decode the base64-encoded transaction and extract the message bytes.
5

Resolve Address Lookup Tables and Sign

Fetch the latest blockhash, decompile the transaction to resolve Address Lookup Tables, and sign.
decompileTransactionMessageFetchingLookupTables fetches the lookup table data from the blockchain and resolves all address references. This is required for transactions that use ALTs.
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.