TONNode — TON blockchain access
v0.9.2TON liteservers over ADNL: balances, history, get-methods, non-custodial DEX and cross-chain swaps
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_masterchain_info Masterchain info
Latest TON masterchain block: workchain, shard, seqno and block hashes. Use when: checking that the network (or your endpoint) is alive and synced, or when you need the current block height. Returns: workchain, shard, seqno, rootHash/fileHash in base64. Tip: masterchain produces a block roughly every 3 seconds — if seqno does not grow between calls, the liteserver is lagging.
get_balance GRAM balance
Native GRAM coin balance of a TON address (GRAM is the renamed Toncoin; the network is still called TON). Use when: the question is about the native coin only. For token balances (USDT and other jettons) use get_jetton_balance; for deployment status, code flags and the last transaction use get_account_state. Returns: balance_gram (decimal string, e.g. "12.5"), balance_nano (string, 1 GRAM = 1e9 nano) and at_seqno — the masterchain block the reading is anchored to. Never-funded (uninitialized) addresses return 0 — that is not an error.
| Parameter | Type | Description |
|---|---|---|
address * | string | TON address in friendly (EQ…/UQ…) or raw (0:… / -1:…) form |
get_account_state Account state
Full account state of a TON address: status (active / frozen / uninit), GRAM balance, last-transaction pointer (lt + hash) and whether contract code/data are deployed. Use when: checking if a contract or wallet is deployed, diagnosing why an address does not respond, or before run_get_method (which needs status=active). Returns: status, balance_gram, last_transaction {lt (string), hash — 64-char hex}, has_code, has_data, at_seqno. Reading the result: status=uninit with a non-zero balance means funds arrived but the wallet contract is not deployed yet; the last_transaction pointer is the curs…
| Parameter | Type | Description |
|---|---|---|
address * | string | TON address in friendly (EQ…/UQ…) or raw (0:… / -1:…) form |
get_transactions Recent transactions
Recent transactions of a TON address, newest first. Use when: verifying that a payment arrived, listing latest wallet activity, or tracing what an address did recently. Returns an array of {hash, lt (string), unix_time, in_value_gram, in_from, out_messages, total_fees_gram} — in_value_gram/in_from describe the incoming message (null for outgoing-only transactions). Never-active addresses return an empty array (not an error); an undecodable transaction comes back as {hash, parse_error: true}. No pagination: each call reads from the account's newest transaction — at most the 30 most recent a…
| Parameter | Type | Description |
|---|---|---|
address * | string | TON address in friendly (EQ…/UQ…) or raw (0:… / -1:…) form |
limit | integer | How many transactions to return, 1–30 (default 10) |
run_get_method Run get-method
Execute a read-only get-method (no gas, no state change) on a smart contract: seqno, get_jetton_data, get_sale_data, get_collection_data and anything else the contract exposes. Use when: reading typed on-chain data from a specific contract. The contract must be active — check with get_account_state first if unsure. Args: only integer arguments are supported here (decimal strings); methods that need an address/slice argument have dedicated tools — e.g. use get_jetton_balance instead of calling get_wallet_address manually. Returns: exit_code (0 or 1 = success; 11 usually means the contract h…
| Parameter | Type | Description |
|---|---|---|
address * | string | TON address in friendly (EQ…/UQ…) or raw (0:… / -1:…) form |
method * | string | get-method name, e.g. "seqno" or "get_jetton_data" |
args | array | Integer arguments as decimal strings, e.g. ["0"] (most methods take none) |
get_jetton_balance Jetton balance
Jetton (TON token) balance of an owner address — USDT and every other TEP-74 token. Use when: the question is about token balances rather than the native GRAM coin (for GRAM use get_balance). Args: owner — the holder's address; jetton_master — the token's master contract address. How it works: derives the owner's jetton-wallet address from the master, then reads its balance on-chain. Returns: jetton_wallet (the derived address), balance in raw indivisible units (string), deployed — false means the owner never held this token, so the balance is 0 — and at_seqno. Raw units: divide by 1…
| Parameter | Type | Description |
|---|---|---|
jetton_master * | string | Jetton master contract address, e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs" |
owner * | string | Holder's TON address, friendly (EQ…/UQ…) or raw (0:… / -1:…) form |
get_jetton_info Jetton info / metadata
Metadata of a jetton master (token) contract: name, symbol, DECIMALS, total supply, mintable, admin. Use when: you need a token's decimals to convert raw indivisible units — swap quotes and balances are in raw units, so a human amount = raw / 10^decimals (USDT is 6, most jettons 9). Call this before get_swap_quote/build_swap_tx when you don't know the token's decimals. Args: jetton_master — the token's master contract address (e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"). Returns: name, symbol, decimals (a number, or null when the token stores metadata off-chain), descript…
| Parameter | Type | Description |
|---|---|---|
jetton_master * | string | Jetton master contract address, e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs" |
parse_address Parse address
Parse, validate and convert a TON address between all its formats — purely local, no network access. Use when: normalizing user input, comparing addresses that look different but may be the same account, or converting to the raw form that indexers and APIs expect. Accepts friendly (EQ…/UQ…, with or without URL-safe characters) and raw (workchain:hex) forms. Returns: raw, friendly_bounceable (EQ…), friendly_non_bounceable (UQ…), workchain and flags of the given input. Background: EQ… and UQ… encode the SAME account — EQ (bounceable) is conventional for contracts, UQ (non-bouncea…
| Parameter | Type | Description |
|---|---|---|
address * | string | TON address in any form: friendly (EQ…/UQ…) or raw (0:… / -1:…) |
get_swap_quote Swap quote
Firm swap quote for exchanging GRAM or any jetton into another asset on TON, via the Omniston protocol (STON.fi RFQ aggregation over STON.fi/DeDust liquidity). MAINNET only. Use when: an agent wants to know the current exchange terms, or as step 1 of an actual swap (step 2 is build_swap_tx with the returned quote_id). For swaps INTO another blockchain (ETH, Base, BNB…) use get_crosschain_quote instead. Amounts are raw indivisible units — GRAM has 9 decimals (1 GRAM = 1e9), USDT has 6; read a jetton's decimals via run_get_method get_jetton_data if unsure. Returns: quote_id (pass it to build…
| Parameter | Type | Description |
|---|---|---|
amount_units * | string | Amount in raw indivisible units of the "exact" side, e.g. "1000000000" = 1 GRAM |
from_asset * | string | "GRAM" for the native coin, or a jetton master address (e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs") |
to_asset * | string | "GRAM" for the native coin, or a jetton master address (e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs") |
exact | string | Which side amount_units fixes: input = spend exactly this much; output = target receiving this much after fees (the guaranteed on-chain floor is still min_output_units — top up amount_units or tight… |
slippage_bps | integer | Max price slippage in basis points (1 bps = 0.01%), 1–500, default 500 = 5%. Tighten for stronger price protection — below the floor the swap refunds instead of executing; the 5% cap is deliberate… |
build_swap_tx Build swap transaction
Build the UNSIGNED transaction for a swap quoted by get_swap_quote. Non-custodial: this returns TonConnect-ready messages — nothing is signed and nothing is sent; the wallet owner signs and broadcasts them (e.g. tonConnectUi.sendTransaction(result.tonconnect)). The messages MOVE REAL FUNDS once signed, so treat the output as an armed payment and show it to the wallet owner before sending. Use when: an agent (or the app driving it) actually wants to execute the swap after inspecting the quote. Args: quote_id from get_swap_quote (use it promptly — expired quotes fail and need a re-quote) and…
| Parameter | Type | Description |
|---|---|---|
quote_id * | string | Quote id returned by get_swap_quote |
wallet * | string | TON address that will sign and send the swap (also receives output and gas excess) |
use_recommended_slippage | boolean | true = build with Omniston's recommended slippage floor (recommended_min_output_units) instead of the floor from your quote request — it can be LOOSER than what you asked for |
get_crosschain_quote Cross-chain swap quote
Firm quote for swapping GRAM or a TON jetton into an asset on another blockchain (Ethereum, Arbitrum, Base, BNB, Polygon, Avalanche) via Omniston's atomic HTLC escrow settlement. MAINNET only. TON is always the source chain — the trade is initiated and funded by a TON wallet. Use when: an agent needs USDT/USDC/native coins delivered to an EVM address, paid from TON. Step 2 is build_crosschain_swap_tx with the returned quote_id. Amounts are raw indivisible units of each asset (TON USDT = 6 decimals, GRAM = 9, EVM tokens per their own decimals). Returns: quote_id (use PROMPTLY — quotes expir…
| Parameter | Type | Description |
|---|---|---|
amount_units * | string | Amount in raw indivisible units of the "exact" side |
from_asset * | string | Asset to pay on TON: "GRAM" or a jetton master address (e.g. USDT "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs") |
to_asset * | string | Asset to receive: "native" (ETH/BNB/POL/AVAX) or a 0x… ERC-20 contract address on the destination chain |
to_chain * | string | Destination blockchain |
exact | string | input = spend exactly this much of from_asset; output = target receiving this much of to_asset |
build_crosschain_swap_tx Build cross-chain swap transaction
Build the UNSIGNED TON escrow transaction for a cross-chain swap quoted by get_crosschain_quote, and generate the HTLC secret that later completes it. Non-custodial: nothing is signed or sent, and the server does NOT keep the secret — it exists only in this response. The messages MOVE REAL FUNDS once signed; treat the output as an armed payment. Treat htlc_secret like a payment authorization: anyone who sees it together with quote_id can trigger disclosure — keep this response out of logs and shared contexts. EVERY CALL GENERATES A NEW SECRET bound to THIS tonconnect payload — if you reb…
| Parameter | Type | Description |
|---|---|---|
destination_address * | string | 0x… wallet on the destination chain that receives the swap output |
hashing_function * | string | REQUIRED: copy htlc_hashing_function from the quote VERBATIM. A mismatched hash builds an escrow that can never settle. If the quote returned null here, do not proceed |
quote_id * | string | Quote id returned by get_crosschain_quote |
to_chain * | string | Destination blockchain (must match the quote) |
wallet * | string | TON address that signs the escrow transfer, owns the position and receives refunds/gas excess |
track_crosschain_swap Track cross-chain swap
Current status of a cross-chain swap: the escrow order created from a get_crosschain_quote quote, with per-execution lifecycle phases and HTLC time windows on both chains. Use when: after sending the escrow transaction built by build_crosschain_swap_tx — poll every ~10s. Reading the result: found=false means the escrow transaction has not landed yet (or was never sent); when an execution's dst_phase reaches ready_for_private_completion, call disclose_crosschain_secret promptly — do NOT disclose if now is close to that execution's output_position_timestamps.private_rollback_at (unix seconds…
| Parameter | Type | Description |
|---|---|---|
quote_id * | string | Quote id returned by get_crosschain_quote |
wallet * | string | The TON wallet that sent the escrow transaction |
disclose_crosschain_secret Disclose HTLC secret
Reveal the HTLC secret from build_crosschain_swap_tx to settle a cross-chain swap. This is the final, trade-committing step: once revealed the preimage is public and the resolver can claim the TON side — it CANNOT be taken back. Before revealing anything, the tool re-verifies live state and refuses unless ALL of these hold: the order exists on-chain, the destination position is at ready_for_private_completion or ready_for_public_completion, and the secret matches that execution's on-chain hash. Call it as soon as track_crosschain_swap shows dst_phase=ready_for_private_completion — a prompt…
| Parameter | Type | Description |
|---|---|---|
quote_id * | string | Quote id returned by get_crosschain_quote |
secret * | string | htlc_secret (64-char hex) returned by build_crosschain_swap_tx |
wallet * | string | The TON wallet that created the escrow position (used to locate and verify the order) |
execution_index | integer | Execution index from track_crosschain_swap (0 for single-fill trades — the default) |
build_crosschain_refund Build cross-chain refund
Build the UNSIGNED transaction that cancels a cross-chain escrow position and returns the funds to the owner wallet. Use when: a cross-chain swap did not settle — track_crosschain_swap shows cancellation_mode=onchain (before that the position cannot be cancelled by the trader). Non-custodial: returns TonConnect-ready messages for the SAME wallet that created the escrow; nothing is signed or sent here. After signing and sending, the escrowed input (and the security deposit) come back to the owner.
| Parameter | Type | Description |
|---|---|---|
quote_id * | string | Quote id returned by get_crosschain_quote |
wallet * | string | The TON wallet that created the escrow position (only it can cancel) |
generate_wallet Generate TON wallet
Create a brand-new TON wallet: a fresh 24-word mnemonic, its ed25519 keypair, and the wallet address for the chosen contract version. Use when an agent needs its own wallet to receive or send funds (e.g. before build_swap_tx). SECURITY — READ BEFORE USE: this returns SECRET key material (mnemonic + private key). Anyone who sees this response controls the wallet and any funds in it. In hosted mode the keys are generated on the server and returned over TLS, so treat the wallet as HOT: fine for programmatic/ephemeral use, but move any significant balance to a hardware or cold wallet, and keep t…
| Parameter | Type | Description |
|---|---|---|
subwallet_id | integer | highload_v3 only: subwallet id baked into the address (default 4269 / 0x10ad, the recommended value) |
timeout_sec | integer | highload_v3 only: message validity window in seconds, baked into the address (default 86400) |
version | string | Wallet contract version: v4 (recommended), v3r2 (legacy), v5r1 (W5, newest), highload_v3 (mass payouts) |
workchain | integer | 0 = basechain (normal wallets), -1 = masterchain (rarely what you want) |