The Open Network (TON)

SDK functions on The Open Network protocol

Stake to a single nominator pool

Craft a stake transaction to a single nominator pool.

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

The amount to stake is in TON.

const tx = await k.ton.craftStakeSingleNominationPoolTx('account_id', 'wallet', 'pool_address',  1);

Unstake from a single nominator pool

Craft an unstake transaction from a single nominator pool.

The amount to unstake is in TON. If not provided, the whole pool balance will be unstaked.

const tx = await k.ton.craftUnstakeSingleNominationPoolTx('wallet', 'pool_address',  1);

Stake from a vesting contract

If you are owner of a vesting contract, you have the ability to stake your locked TON from the contract to a single nominator pool. The conditions for this to be possible are:

  • You must be the owner of the vesting contract

  • The single nomination pool owner must be the vesting contract address

  • The single nomination pool address must be whitelisted on the contract. This is to be done by the vesting contract sender (the wallet that created the contract)

const tx = await k.tia.craftStakeFromVestingContractTx('account_id', 'wallet', 'vesting_contract_address', 'pool_address', 1);

Unstake from a vesting contract

Craft a transaction to unstake from a single nomination pool back to your vesting contract.

const tx = await k.tia.craftUnstakeFromVestingContractTx('wallet', 'vesting_contract_address', 'pool_address', 1);

Whitelist an address on a vesting contract

If you are the sender of a vesting contract, you can whitelist addresses to it. For example you wouild need to whitelist the address of the single nominator pool in order for the vesting contract owner to stake his TON to it.

const tx = await k.tia.craftWhitelistVestingContractTx('wallet', 'vesting_contract_address', ['address_to_whitelist']);


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


Broadcast a signed transaction.

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

Get transaction status

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

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

Last updated