Kiln docs
Search…
⌃K

Near (NEAR): Stake NEAR with Kiln Connect

Stake NEAR programmatically with Kiln Connect SDK.

Stake

Create a staking transaction to delegate any amount of NEAR to a staking pool.
// optional, only for specific setups
const options = {
// use an other pool than Kiln's
stakePoolId: '...';
};
/* async craftStakeTx(accountId: string, walletId: string, amountNear: number, options?: NearStakeOptions): Promise<Transaction> */
const tx = await k.near.craftStakeTx(account.id, WALLET_PUBKEY, 12.3, options);

Unstake

Unstake any amount of NEAR from a staking pool.
/* async craftUnstakeTx(walletId: string, stakePoolId: string, amountNear?: number): Promise<Transaction> */
const tx = await k.near.craftUnstakeTx(WALLET_PUBKEY, poolId, 12.3);

Sign

Sign Near transactions by specifying the integration name and the crafted transaction.
/* async sign(integration: string, transaction: Transaction, note?: string): Promise<SignedTransaction> */
const signed = await k.near.sign('vault-1', tx);

Broadcast

Broadcast and get the status of a broadcasted transaction. If you specified a custom RPC url for Near in the SDK configuration, it will be used instead of the default one.
/* async broadcast(transaction: SignedTransaction): Promise<string | undefined> */
const hash = await k.near.broadcast(signed);
/* async getTxStatus(transactionHash: string): Promise<NearTxStatus> */
const status = await k.near.getTxStatus(hash);