Reading state and sending transactions with the q_ client.
import { QuantovaClient } from "../src/client.js";
import { rpcUrl } from "../src/config.js";
const client = new QuantovaClient(rpcUrl());
const height = await client.blockNumber(); // number
const chainId = await client.chainId(); // used to prevent replay
const balance = await client.getBalanceQTOV("Q8f3c…a91b"); // QTOV (base units / 10^18)Notes:
- Account addresses are Q-format strings (Q-prefixed), never
0xEVM addresses. - Numeric results are
QUANTITYhex; the helpers convert them for you. - Block references are block-number
QUANTITYvalues — the named tag"latest"is not implemented, so the helpers resolve a height first.
The standard path is sign locally, then broadcast:
- Build the payload (value, nonce via
getNonce, fees, chain id; gas limit for the QVM). - Sign it with the account's post-quantum key using the
@quantovaSDK keyring (or Qmask.io). - Broadcast the signed payload with
sendRawTransaction, then poll for the receipt.
const nonce = await client.getNonce(myAddress);
// const signed = await account.signTransaction({ to, value, nonce, chainId, gas });
const txHash = await client.sendRawTransaction(signedTxHex);
const receipt = await client.waitForReceipt(txHash);A receipt means the transaction was included. Treat value as settled only after finality (~3 seconds, deterministic) — finalized blocks do not reorg. For anything that moves funds, wait for finality before showing success.
| Method | Returns |
|---|---|
q_blockNumber |
Latest block height (QUANTITY) |
q_getBalance |
QTOV balance in base units (QUANTITY) |
q_getTransactionCount |
Account nonce |
q_call |
Read-only contract return data |
q_estimateGas |
QGAS a call/deployment would consume |
q_sendRawTransaction |
Tx hash for a signed transaction |
q_getTransactionReceipt |
Receipt (status, QGAS used, logs) |
q_chainId |
Chain id (replay protection) |
The full reference is in the developer documentation.