The SDK provides utility classes for common operations. This page summarizes the available classes and constants.
Represents a Zenon address.
import { Address } from 'znn-typescript-sdk';
// Parse from string
const address = Address.parse('z1qr...');
// Get string representation
console.log(address.toString());
// Get bytes
console.log(address.getBytes());Represents a hash (block hash, transaction hash, etc.).
import { Hash } from 'znn-typescript-sdk';
// Parse from hex string
const hash = Hash.parse('abc123...');
// Get string representation
console.log(hash.toString());
// Get bytes
console.log(hash.getBytes());Represents a Zenon token standard (ZTS).
import { TokenStandard } from 'znn-typescript-sdk';
// Parse from string
const zts = TokenStandard.parse('zts1...');
// Get string representation
console.log(zts.toString());
// Get bytes
console.log(zts.getBytes());Create transaction block templates.
Create a send block.
import { AccountBlockTemplate, ZNN_ZTS, extractNumberDecimals } from 'znn-typescript-sdk';
const block = AccountBlockTemplate.send(
recipientAddress,
ZNN_ZTS,
extractNumberDecimals(1, 8)
);Create a receive block.
const receiveBlock = AccountBlockTemplate.receive(sendBlockHash);import {
EMPTY_ADDRESS,
ACCELERATOR_ADDRESS,
BRIDGE_ADDRESS,
HTLC_ADDRESS,
LIQUIDITY_ADDRESS,
PILLAR_ADDRESS,
PLASMA_ADDRESS,
SENTINEL_ADDRESS,
SPORK_ADDRESS,
STAKE_ADDRESS,
SWAP_ADDRESS,
TOKEN_ADDRESS,
} from 'znn-typescript-sdk';
console.log('Burn address:', EMPTY_ADDRESS.toString());
console.log('Plasma address:', PLASMA_ADDRESS.toString());
// etc.import { EMPTY_ZTS, ZNN_ZTS, QSR_ZTS } from 'znn-typescript-sdk';
console.log('Empty token:', EMPTY_ZTS.toString());
console.log('ZNN token:', ZNN_ZTS.toString());
console.log('QSR token:', QSR_ZTS.toString());import { EMPTY_HASH } from 'znn-typescript-sdk';
console.log('Empty hash:', EMPTY_HASH.toString());- ZNN: 8 decimals
- QSR: 8 decimals
import { extractNumberDecimals, addNumberDecimals } from 'znn-typescript-sdk';
// Converts humand readable number to non-fractional number
const znnAmount = extractNumberDecimals(1, 8);
// Converts non-fractional number to humand readable number
const dispplayValue = addNumberDecimals(100000000, 8);- Examples – Complete working examples
- API Overview – All API methods & Embedded Contract Calls
- CLI Tool - Command-line interface
- Wallet Management – Creating and managing wallets
- Building WASM – Rebuilding the PoW module from source