Account
TONAPI and TON Console

TONAPI and TON Console

Username
@tonconsole_com
Category
Cryptocurrencies
Subscribers11,619
Avg views per post, 7d—last 7 days
ERR—

Latest posts

#136Text
Views2,560
Forwards—
Reactions23
Comments—
#134Link preview

❗️`/v2/jettons/{addr}/holders` got pagination upgrade. offset parameter will be limited soon. GetJettonHolders method was always returning holders sorted by their balance (starting from the top). It also had offset parameter that users can use to traverse the top 10k holders. This approach has two problems: 1) inconsistency. Obviously, balances change constantly. So scanning data with limit+offset will get a lot of gaps due to volatile ordering 2) performance. Request time grows with the offset, because of how databases usually work We've just made optimization to speed this method ⚡️4x times! 🎚️Introducing cursor But O(n) is still O(n). So those who need real-time set of jetton holders can use new cursor-based pagination method, which has constant performance no matter what page it is. So similarly to /v2/jettons, we introduce two new parameters to the GetJettonHolders method: sort_by and last_account_id. Use /holders like before to get top holders (sort_by=balance is default). Offset can't be more than 9000. Use /holders?sort_by=address to scan through the whole holders set. Here is how it looks: # get first page % time curl -s 'https://tonapi.io/v2/jettons/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs/holders?sort_by=address' | jq -r '.addresses | last | .address' 0:9dfaaafbc46bad3c46d9362d8e5d99f993e953034212c5f34689cac419ea9d2c curl -s 0.02s user 0.02s system 5% cpu 0.670 total # get second page % time curl -s 'https://tonapi.io/v2/jettons/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs/holders?sort_by=address&last_account_id=0:9dfaaafbc46bad3c46d9362d8e5d99f993e953034212c5f34689cac419ea9d2c' | jq -r '.addresses | last | .address' 0:b6a096bdc189790abde43c11041f1f5a72daa92fa0ed24e918e7187515dce53b curl -s 0.01s user 0.01s system 4% cpu 0.533 total Have the set of holders of your jettons in real-time with these high-performance updates!

Open in Telegram
Views2,300
Forwards—
Reactions19
Comments—
#132Text

How to get all jettons? And what's changing in TONAPI? In a nutshell There are two main ways: TONAPI (the /v2/jettons method) and Tonconsole.com (CSV export). When using the /v2/jettons method for pagination, it's recommended to use the cursor — the last_account_id parameter, which is taken from the previous response. It looks something like this: % curl -s 'https://tonapi.io/v2/jettons?limit=10' | jq -r '.jettons | last | .metadata.address' 0:249936139b63719c0afc44f883f4d8c15fd53bc6f93b6244debcf92b3e6c3ce1 % curl -s 'https://tonapi.io/v2/jettons?limit=10&last_account_id=0:249936139b63719c0afc44f883f4d8c15fd53bc6f93b6244debcf92b3e6c3ce1' | jq -r '.jettons | last | .metadata.address' 0:31bb2214dca832dd8091d90adc313e9834782934263764810cb28fc7f8fb3878 In more detail 1. The /v2/jettons method allows you to get real-time data. At the moment there are almost 1 million jettons on TON. One request lets you get 1000 data rows. Theoretically, on the Lite tier (10 RPS), you could download all jettons in about a minute and a half. But this method had a problem — the offset parameter. Until recently, this method's execution time grew proportionally to the offset parameter. To maintain compatibility and ensure high performance, we carried out an optimization that uses a cached jetton list when offset is used. This list is updated once a day. At the same time, we've added a new parameter — last_account_id. It provides a more correct and efficient way to paginate to the most up-to-date data. 2. For large exports like this, it may be more convenient to use Tonconsole. For example, a query like SELECT d.account_id FROM getmethods.get_jetton_data d lets you get the full list of jettons. In Tonconsole you can enable scheduled export runs. The "Download CSV" link is stable, and you can quickly get a ready-made dataset with a single request from the backend (for the query above, that's 60 MB). Feel free to ask question in comments ✍️

Open in Telegram
Views1,760
Forwards—
Reactions6
Comments—
#131Link preview

Toncoin → Gram Following the approved network changes, TONAPI and Tonviewer now support the new currency naming: Gram. We have made every effort to preserve backward compatibility wherever possible. List of Changes 1. Both Variants Are Accepted in Input Parameters The /v2/rates/chart endpoint now supports a new currency value: * https://tonapi.io/v2/rates/chart?token=usdt&currency=ton&points_count=5 * https://tonapi.io/v2/rates/chart?token=usdt&currency=gram&points_count=5 The response returns the currency name exactly as specified in the request parameters. 2. New Fields for Gram Throughout the TONAPI response schema https://tonapi.io/api-v2, Gram support has been added to all fields that previously referenced TON. For example, in the GET /v2/multisig/{account_id} endpoint, the field orders[].risk.gram has been added alongside orders[].risk.ton. Similarly, corresponding Gram fields have been introduced across other endpoints, such as: * ton_balance + gram_balance * and other TON-related fields. 3. `token_name` Value Changes The token_name field now contains the value Gram instead of TON. 4. Other User-Facing Fields In structures where fields are primarily intended for user-facing display, references to Toncoin have been changed to Gram. For example, in the Action structure (used by endpoints such as /v2/accounts/{account_id}/events, /v2/gasless/estimate/{master_id}, and others): * simple_preview.name: "Ton Transfer" → "Gram Transfer" * simple_preview.description, prefix.simple_preview.value: "5 TON" → "5 Gram"

Open in Telegram
Views3,560
Forwards—
Reactions56
Comments—
#128Text
Views4,920
Forwards—
Reactions56
Comments—
#127Photo
Views5,500
Forwards—
Reactions35
Comments—

All posts

Connections