API Examples To Maintain
This page defines examples that should exist in README, doctests, or examples/ once APIs stabilize.
LiteClient Connect
Expected flow:
- Resolve
TON_NETWORK, defaulting to mainnet. - Load
TON_GLOBAL_CONFIG_JSONor download the public network config. - Select
TON_LS_INDEX, defaulting to0. - Connect with ADNL TCP.
- Fetch masterchain info.
Network Config
Expected flow:
- Resolve
TON_NETWORK, defaulting to mainnet. - Load
TON_GLOBAL_CONFIG_JSONor download the public network config. - Parse liteserver entries.
- Print indexed socket addresses for follow-up examples.
Raw LiteAPI
Expected flow:
- Load config through the live-network defaults.
- Select one liteserver with
TON_LS_INDEX. - Use
TON_LITEAPI_REQUEST_HEXwhen provided. - Otherwise serialize
liteServer.getTime. - Send bytes with
query_rawand print raw response bytes as hex.
LiteBalancer
Expected flow:
- Build peer descriptors from config loaded through the live-network defaults.
- Connect or lazy-connect peers.
- Fetch version/time/masterchain info.
- Close background tasks.
Get-Method
Expected flow:
- Load config through the live-network defaults.
- Parse
TON_CONTRACT_ADDRESSor use the documented mainnet default. - When
TON_NETWORK=testnet, requireTON_CONTRACT_ADDRESSfor defaultseqnoget-method examples until a stable testnet contract is documented. - Fetch latest block context.
- Build TVM stack.
- Run method by name.
- Check exit code.
- Decode typed stack result.
Send Message
Expected flow:
- Build external message cell.
- Serialize BoC.
- Send via LiteAPI.
- Track message hash until transaction appears.
Mempool Stream
Future flow:
- Build scanner from overlay/DHT config.
- Subscribe to pending messages.
- Filter by account or shard.
- Deduplicate by message hash.
- Emit pending and finalized stages.