Solana (SOL)

SDK functions on Solana protocol


On Solana, a wallet can create multiple stake accounts. This stake action creates a new stake account and delegates funds to the chosen validator vote account address. The stake account will earn rewards after an activation period of one epoch (~2.5 days).

You can retrieve the address of the created stake account by using getRewardsByWallets after broadcasting your transaction.

The amount to stake is in SOL.

You can also pass an optional memo message that will be included in the transaction.

const tx = await k.sol.craftStakeTx('account_id', 'wallet_address', 'vote_account_address', 1, 'optional memo message');

Deactivate stake

Craft a deactivate stake transaction. It takes one full epoch (~2 to 3 days) to deactivate a stake.

const tx = await k.sol.craftDeactivateStakeTx('stake_account_address', 'wallet_address');

Withdraw stake

Craft a withdraw stake transaction. You can specify the amount to withdraw, if not specified, the whole stake balance will be withdrawn. Your stake must be deactivated before you can withdraw funds from it.

const tx = await k.sol.craftWithdrawStakeTx('stake_account_address', 'wallet_address');

Split stake

Craft a split stake transaction. This allows you to split your stake in two stakes.

This is useful when you want to withdraw only a portion of your stake without deactivating it entirely. You would then split it into two stakes with the new stake containing the amount you wish to withdraw - a stake that you can then deactivate and withdraw.

The amount to transfer to the new stake is in SOL.

const tx = await k.sol.craftSplitStakeTx('account_id', 'stake_account_address', 'wallet_address', 1);

Merge stakes

Craft a merge stakes transaction. This allows you to merge two stakes into one on certain conditions. See

const tx = await k.sol.craftMergeStakesTx('stake_account_source', 'stake_account_destination', 'wallet_address');


Sign a transaction by specifying the integration and the crafted transaction.

Here is an example showing how to sign a transaction with a fireblocks vault.

Checkout the setup fireblocks documentation to setup your vault.

import { Integration } from "@kilnfi/sdk/lib/types/integrations";
const fs = require('fs');
const apiSecret = fs.readFileSync(__dirname + '/fireblocks_secret.key', 'utf8');

const vault: Integration = {
      provider: 'fireblocks',
      fireblocksApiKey: 'YOUR_API_USER_KEY', // your fireblocks API user key
      fireblocksSecretKey: apiSecret, // your fireblocks private key (generated with your CSR file and your API user)
      vaultId: 7 // your fireblocks vault id
const txSigned = await k.sol.sign(vault, tx);


Broadcast a signed transaction.

const txHash = await k.sol.broadcast(txSigned);

Get transaction status

Get the transaction status of a broadcasted transaction by providing its transaction hash.

const status = await k.sol.getTxStatus('tx_hash');

Decode transaction

Decode a serialized transaction previously crafted. You can use this to get more information about a transaction prior to broadcast it such as the gas fees used, the function parameters etc.

const decodedTx = await k.sol.decodeTx('tx_serialized');

Get stakes

Get stakes real time data. You can get stakes by Kiln accounts, by stake accounts or by wallets.

const stakes = await k.sol.getStakesByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const stakes = await k.sol.getStakesByStakeAccounts(['H1JADXwA94AfMa6tbzhyALDHeawPcWShsvrV3uHGXEWc']);
const stakes = await k.sol.getStakesByWallets(['4icse2mPXNgyxxn11tVM7sTnSqDqwJSEzdnaCQnRzvA9']);

Get rewards

Get historical rewards data by day. You can get rewards aggregated by Kiln accounts, by stake accounts or by wallets.

const rewards = await k.sol.getRewardsByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const rewards = await k.sol.getRewardsByStakeAccounts(['H1JADXwA94AfMa6tbzhyALDHeawPcWShsvrV3uHGXEWc']);
const rewards = await k.sol.getRewardsByWallets(['4icse2mPXNgyxxn11tVM7sTnSqDqwJSEzdnaCQnRzvA9']);

Get network stats

Get some network stats.

const stats = await k.sol.getNetworkStats();

Last updated