The ZNN TypeScript SDK includes a command-line interface for common operations and scripting.
npm install -g znn-typescript-sdkAfter installation, the znn-cli command will be available globally:
znn-cli --helpGet help for a specific command:
znn-cli <command> --helpYou can run the CLI without installing it globally:
npx znn-cli --helpManage your wallets with the following commands.
List all wallets in the wallet directory.
znn-cli wallet listOptions:
--wallet-path <path>- Custom wallet directory
Example:
znn-cli wallet list \
--wallet-path /path/to/custom/walletsCreate a new wallet in the default wallet directory.
znn-cli wallet create -p <password>Options:
-p, --password <password>(required) - Wallet password-n, --name <name>- Custom wallet name--wallet-path <path>- Custom wallet directory
Example:
znn-cli wallet create \
-p myPassword \
-n my-walletImport a wallet from a mnemonic phrase.
znn-cli wallet import -m "<word1 word2>" -p <password> Options:
-m, --mnemonic <mnemonic>(required) - 12 or 24-word mnemonic phrase-p, --password <password>(required) - Wallet password-n, --name <name>- Custom wallet name--wallet-path <path>- Custom wallet directory
Example:
znn-cli wallet import \
-m "word1 word2 ... word24" \
-p myPassword \
-n imported-walletExport the mnemonic from a wallet.
znn-cli wallet export <keyFileName> -p <password>Options:
-p, --password <password>(required) - Wallet password--wallet-path <path>- Custom wallet directory
Example:
Export the mnemonic for a wallet named z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7:
znn-cli wallet export z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPasswordDerive addresses by index range from a wallet.
znn-cli wallet derive <keyFileName> <start> <end> -p <password>Options:
-p, --password <password>(required) - Wallet password--wallet-path <path>- Custom wallet directory
Example:
Derive addresses starting from index 0 and ending at index 5:
znn-cli wallet derive z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 0 5 \
-p myPasswordCopy a wallet file to a custom location.
znn-cli wallet copy <keyFileName> <newPath>Options:
--wallet-path <path>- Source wallet directory
Example:
Copy a wallet in the default wallet directory to a new location:
znn-cli wallet copy z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 /path/to/new/location/Permanently delete a wallet keyfile.
znn-cli wallet delete <keyFileName>Options:
-f, --force- Skip confirmation prompt--wallet-path <path>- Custom wallet directory
Example:
Force delete a wallet without the confirmation prompt:
znn-cli wallet delete z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 -fManage transactions on the Zenon Network.
Send tokens to an address.
znn-cli tx send <recipientAddress> <amount> <tokenStandard> -w <keyFileName> -p <password>Options:
-w, --wallet <keyFileName>(required) - Sender wallet key file name-p, --password <password>(required) - Wallet password-n, --node <url>- Node URL (default: wss://node.zenonhub.io:35998)-i, --index <index>- Address derivation index (default: 0)-d, --decimals <decimals>- Token decimals (default: 8)--wallet-path <path>- Custom wallet directory
Note: You can use znn or qsr shortcuts instead of full token standards.
Example:
Send 10 ZNN to an address:
znn-cli tx send z1qq9n7fpaqd8lpcljandzmx4xtku9w4ftwyg0mq 10 znn \
-w z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPasswordSend 10 PP to an address:
znn-cli tx send z1qq9n7fpaqd8lpcljandzmx4xtku9w4ftwyg0mq 10 zts1hz3ys62vnc8tdajnwrz6pp \
-w z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPassword \
-d 0Receive a transaction by hash.
znn-cli tx receive <txHash> -w <keyFileName> -p <password>Options:
-w, --wallet <keyFileName>(required) - Recipient wallet key file wallet name-p, --password <password>(required) - Wallet password-n, --node <url>- Node URL (default: wss://node.zenonhub.io:35998)-i, --index <index>- Address derivation index (default: 0)--wallet-path <path>- Custom wallet directory
Example:
znn-cli tx receive 1990034500b60df73def488aa341ef4f65ce65b3fd489ea9cd3f07ed031d3c8a \
-w z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPasswordReceive all pending transactions for an address.
znn-cli tx receiveAll -w <keyFileName> -p <password>Options:
-w, --wallet <keyFileName>(required) - Recipient wallet key file wallet name-p, --password <password>(required) - Wallet password-n, --node <url>- Node URL (default: wss://node.zenonhub.io:35998)-i, --index <index>- Address derivation index (default: 0)--wallet-path <path>- Custom wallet directory
Example:
znn-cli tx receiveAll \
-w z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPasswordAutomatically receive all incoming transactions as they are broadcast.
znn-cli tx autoReceive -w <keyFileName> -p <password>Options:
-w, --wallet <keyFileName>(required) - Recipient wallet key file wallet name-p, --password <password>(required) - Wallet password-n, --node <url>- Node URL (default: wss://node.zenonhub.io:35998)-i, --index <index>- Address derivation index (default: 0)--wallet-path <path>- Custom wallet directory
Example:
znn-cli tx autoReceive \
-w z1qqjnwjjpnue8xmmpanz6csze6tcmtzzdtfsww7 \
-p myPasswordIf you're developing the SDK and want to test the CLI:
# Clone the repository
git clone https://github.com/digitalSloth/znn-typescript-sdk.git
cd znn-typescript-sdk
# Install dependencies
npm install
# Now you can use znn-cli via the dev command
npm run cli:dev -- --helpIf znn-cli is not found after global installation:
- Check if npm global bin is in your PATH:
npm config get prefix- Add npm global bin to PATH (if needed):
# Add to ~/.bashrc or ~/.zshrc
export PATH="$PATH:$(npm config get prefix)/bin"- Verify installation:
which znn-cliOn Unix systems, you may need to use sudo:
sudo npm install -g znn-typescript-sdkOr configure npm to install globally without sudo:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc- Examples – Complete working examples
- API Overview – All API methods & Embedded Contract Calls
- Utilities – Utilities and constants for common tasks
- Wallet Management – Creating and managing wallets
- Building WASM – Rebuilding the PoW module from source