ton-api-v4
Описание
TON HTTP API v4
Языки
- TypeScript99,2%
- JavaScript0,4%
- Dockerfile0,3%
- Остальные0,1%
TON API v4
Scallable and CDN-friendly HTTP API for TON blockchain.
API Endpoints
There are two public endpoints for this API:
- https://mainnet-v4.tonhubapi.commainnet- https://sandbox-v4.tonhubapi.comsandbox
Selfhosting
Easiest way to selfhost is to use docker:
Methods
Get latest block
GET /block/latest
Get full block
GET /block/<seqno>
Get block by unix time
GET /block/utime/<unix time>
Get account state at block
GET /block/<seqno>/<address>
Detect if account was changed
GET /block/<seqno>/<address>/changed/<since_lt>
Run get method of account at block
NOTE: To pass arguments you need to serialize them into url-safe base64 serialization of BOC with stack. You can find implementation in library.
GET /block/<seqno>/<address>/run/<method>/<args?>
Watch for new blocks
Open a WebSocket connection to . And you will get notifications about current , block time and server time. Server immediatelly sends current known block after opening a connection.
NOTE: This API doesn't guarantee that seqno always sequental. There are could be holes in sequences and apps have to adjust for them.
Example:
Watch for new blocks (extended)
Open a WebSocket connection to to get stream of new blocks. This endpoint behaves same way as a previous one.
Example:
Get config at block
GET /block/<seqno>/config/:ids
NOTE: you need to manually parse cell into dict with 32 bit integer keys.
Get account transactions
GET /account/<address>/tx/:lt/:hash
NOTE: This method always returns at most 20 results. Example
License
MIT