Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kynesys.xyz/llms.txt

Use this file to discover all available pages before exploring further.

Validator Staking — SDK API

This page is the SDK reference. For the on-chain state machine, lock period, and persistence guarantees, see the protocol page:

Backend / Validator Lifecycle

State transitions, unstake lock, restake invariants

Connect

import { Demos, DemosTransactions } from "@kynesyslabs/demosdk/websdk"

const demos = new Demos()
await demos.connect("https://node.example.com")
await demos.connectWallet(mnemonic)

Builders

stake(amount, connectionUrl, demos)

Register a new validator or top up an existing one.
const tx = await DemosTransactions.stake(
    "1000000000000000000",                  // amount (bigint as string)
    "https://my-validator.example.com",      // public RPC URL
    demos,
)
await demos.confirm(tx)
The SDK validates amount as a positive bigint string and connectionUrl as a well-formed URL before signing — invalid input throws synchronously.

unstake(demos)

Arms the unstake lock. Validator continues participating in consensus during the lock window.
const tx = await DemosTransactions.unstake(demos)
await demos.confirm(tx)

validatorExit(demos)

Withdraws the stake. Only valid after the lock has elapsed.
const tx = await DemosTransactions.validatorExit(demos)
await demos.confirm(tx)

Read-side queries

// Single validator's current state
const info = await demos.getValidatorInfo(address)
// { address, status, staked_amount, connection_url,
//   first_seen, valid_at, unstake_requested_at, unstake_available_at }

// Active validator set at a specific block (defaults to chain head)
const validators = await demos.getValidators(blockNumber)

// Just the staked amount as a bigint string
const amount = await demos.getStakedAmount(address)