Osmosis (OSMO)

SDK functions on OSMOSIS Cosmos protocol

We require the wallet compressed pubkey in transaction crafting methods. This pubkey is different from your wallet address, you wallet address is actually derived from the pubkey. To retrieve the pubkey, you can use our sdk as follow:

const vault = {
    provider: 'fireblocks',
    fireblocksApiKey: 'YOUR_FIREBLOCKS_API_KEY',
const pubkey = await k.fireblocks.getPubkey(vault, 'OSMO');


Craft a delegation transaction to the validator address provided.

It also links your stake to the kiln account id provided.

The amount to stake is in OSMO.

const tx = await k.osmo.craftStakeTx('account_id', 'wallet_pubkey', 'validator_address',  1);

Withdraw rewards

Craft a withdraw rewards transaction. Your available rewards are then transferred to your wallet instantaneously.

const tx = await k.osmo.craftWithdrawRewardsTx('wallet_pubkey', 'validator_address');


Craft an undelegate transaction. Your stake then enters a 14 days unbonding period.

The amount to undelegate is optional and in OSMO. If no amount is specified, your whole staked balance will be unstaked.

const tx = await k.osmo.craftUnstakeTx('wallet_pubkey', 'validator_address', 1);


Craft a redelegate transaction from a validator to a new validator. This allows you to skip the 14 days unbonding period.

The amount to redelegate is optional and in OSMO. If no amount is specified, your whole staked balance will be redelegated.

const tx = await k.osmo.craftRedelegateTx(


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.osmo.sign(vault, tx);


Broadcast a signed transaction.

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

Get transaction status

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

const status = await k.osmo.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.osmo.decodeTx('tx_serialized');

Get stakes

Cosmos mainnet network is used in our testnet environment when retrieving data from our API so you won't be able to retrieve testnet stakes.

Get stakes real time data. You can get stakes by Kiln accounts or by delegators and by validators.

const stakes = await k.osmo.getStakesByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const stakes = await k.osmo.getStakesByDelegatorsAndValidators(['delegator_address'], ['validator_address']);

Get rewards

Get historical rewards data by day. You can get rewards aggregated by Kiln accounts or by delegators and validators.

const rewards = await k.osmo.getRewardsByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const rewards = await k.osmo.getRewardsByDelegatorsAndValidators(['delegator_address'], ['validator_address']);

Last updated