Kiln docs
Search
K

XTZ

SDK functions on Tezos protocol

Stake

Craft a delegation transaction to the baker address provided. A tezos delegation takes ~23 days before becoming active.
JavaScript
const tx = await k.xtz.craftStakeTx('account_id', 'wallet_address', 'baker_address');

Unstake

Craft an undelegate transaction.
JavaScript
const tx = await k.xtz.craftUnstakeTx('wallet_address');

Sign

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

Broadcast

Broadcast a signed transaction.
JavaScript
const txHash = await k.xtz.broadcast(txSigned);

Get transaction status

Get the transaction status of a broadcasted transaction by providing its block number and transaction hash.
JavaScript
const status = await k.xtz.getTxStatus(blockNumber, 'tx_hash');

Get stakes

Get stakes real time data. You can get stakes by Kiln accounts or by wallets.
JavaScript
const stakes = await k.xtz.getStakesByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const stakes = await k.xtz.getStakesByWallets(['tz1QQZKGt3ouyd7x8JUDwcvRyxzsmD7CFbMd']);

Get rewards

Get historical rewards data by day. You can get rewards aggregated by Kiln accounts or by wallets.
JavaScript
const rewards = await k.xtz.getRewardsByAccounts(['771254de-ac5a-4911-afdf-1d5b7e802dc9']);
const rewards = await k.xtz.getRewardsByWallets(['tz1QQZKGt3ouyd7x8JUDwcvRyxzsmD7CFbMd']);

Get network stats

Get some network stats.
JavaScript
const stats = await k.xtz.getNetworkStats();