Skip to content

feat(api): add tonlib types page#1882

Draft
laviniat1996 wants to merge 3 commits intomainfrom
tonlib-types
Draft

feat(api): add tonlib types page#1882
laviniat1996 wants to merge 3 commits intomainfrom
tonlib-types

Conversation

@laviniat1996
Copy link
Collaborator

@laviniat1996 laviniat1996 commented Feb 28, 2026

closes #1870

Add a new page with details about tonlib types.

TonLib types are the low level data structures defined by TON’s core client library (TonLib) that describe how blockchain entities like accounts, transactions, messages, and cells are represented and transmitted.

@laviniat1996 laviniat1996 self-assigned this Feb 28, 2026
@laviniat1996 laviniat1996 added the scope: api OpenAPI specs and relevant sub-directories in the /ecosystem/api/toncenter folder label Feb 28, 2026
@laviniat1996 laviniat1996 marked this pull request as draft February 28, 2026 01:16
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No documentation issues detected.

reveloper
reveloper previously approved these changes Mar 5, 2026
@reveloper reveloper marked this pull request as ready for review March 5, 2026 04:21
@reveloper reveloper requested a review from aigerimu March 5, 2026 04:22
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed TonLib reference work; in ecosystem/api/toncenter/v2-tonlib-types.mdx there is one inline suggestion to align the schema link and tone with the style guide—please apply the inline suggestion.

Comment on lines +10 to +11
- **TonLib types** (e.g. `raw.fullAccountState`, `tvm.cell`) come from the [TonLib TL schema](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl), the type definition language used by the C++ library powering this API.
- **Extended types** (prefixed with `ext.`) are added by TON Center to provide parsed, developer-friendly representations not available in the base TonLib schema.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Non-permalink TL schema reference and marketing-style language

The overview bullet links to the TonLib TL schema using the moving master branch (https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl) on a normative reference page. The style guide’s stable permalink rule requires versioned or permanent URLs for normative code references and forbids moving targets like master or main when a versioned URL exists. The adjacent bullet also describes extended types as “developer-friendly representations”, which is a subjective, marketing-style adjective banned by the style guide in technical sections. Together, these issues reduce reproducibility and undermine the neutral, factual tone expected for reference documentation.

Suggested change
- **TonLib types** (e.g. `raw.fullAccountState`, `tvm.cell`) come from the [TonLib TL schema](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl), the type definition language used by the C++ library powering this API.
- **Extended types** (prefixed with `ext.`) are added by TON Center to provide parsed, developer-friendly representations not available in the base TonLib schema.

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

To fix the formatting issues:

  1. Install necessary dependencises: npm ci
  2. Then, run this command:
    npm run fmt:some -- ecosystem/api/toncenter/v2-tonlib-types.mdx

Alternatively, a maintainer can comment /fmt in this PR to auto-apply fixes in a new commit from the bot.

@aigerimu
Copy link
Contributor

aigerimu commented Mar 5, 2026

/review

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates; on ecosystem/api/toncenter/v2-tonlib-types.mdx: I left several suggestions, so please apply the inline suggestions.

Comment on lines +5 to +7
## Overview

Every object returned by API v2 includes a `@type` field that identifies the object's structure. These values originate from two sources:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Reference heading starts at H2 instead of H3

This reference page’s first in-body heading is ## Overview, which renders as an H2 directly under the template-provided H1 from frontmatter. For reference-type pages, section content under the site-managed H1 should not introduce an additional umbrella “Overview” heading at the same level, as this creates a redundant top-level section and flattens the hierarchy. Keeping the first visible section as a descriptive H3 beneath the implicit H1 improves document structure, navigation, and adherence to the site’s heading-level rules (see https://github.com/ton-org/docs/blob/main/contribute/style-guide-extended.mdx?plain=1#L254-L272).

Suggested change
## Overview
Every object returned by API v2 includes a `@type` field that identifies the object's structure. These values originate from two sources:
### Type discriminator field
Every object returned by API v2 includes a `@type` field that identifies the object's structure. These values originate from two sources:

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!


Every object returned by API v2 includes a `@type` field that identifies the object's structure. These values originate from two sources:

1. Tonlib types such as `raw.fullAccountState` and `tvm.cell`, come from the [tonlib TL schema](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl), the type definition language used by the C++ library powering this API.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Non-versioned GitHub link for normative TL schema

The link to the tonlib TL schema on line 9 points at the moving master branch on GitHub while serving as a normative reference for type identifiers. The style guide’s external reference rules require a versioned or permanent URL for precision‑critical references and forbid linking to moving targets like main, HEAD, or master when a versioned URL exists (see contribute/style-guide-extended.mdx:783-793). If the schema changes on master, this documentation could silently drift away from the behavior it describes, confusing readers and invalidating examples. Pinning the link to a specific commit preserves the intended meaning over time.

Suggested change
1. Tonlib types such as `raw.fullAccountState` and `tvm.cell`, come from the [tonlib TL schema](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl), the type definition language used by the C++ library powering this API.
1. Tonlib types such as `raw.fullAccountState` and `tvm.cell`, come from the [tonlib TL schema](https://github.com/ton-blockchain/ton/blob/<COMMIT_SHA>/tl/generate/scheme/tonlib_api.tl), the type definition language used by the C++ library powering this API.

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Comment on lines +181 to +186
```
msg.dataRaw body:bytes init_state:bytes = msg.Data;
msg.dataText text:bytes = msg.Data;
msg.dataDecryptedText text:bytes = msg.Data;
msg.dataEncryptedText text:bytes = msg.Data;
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Fenced code block missing language identifier

The msg.data* TL snippet at lines 181–186 is a bare fenced code block (```) without a language identifier. The style guide explicitly requires every fenced block to specify a language (see contribute/style-guide-extended.mdx:563-570) so that syntax highlighting and tooling work correctly. Leaving the language unspecified makes this example harder to read and reduces editor and documentation tooling support. Marking the block as tl keeps it consistent with other TL examples and satisfies the mandatory rule.

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

@aigerimu aigerimu marked this pull request as draft March 5, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: api OpenAPI specs and relevant sub-directories in the /ecosystem/api/toncenter folder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ecosystem > API > TON Center > API v2 > Tonlib Types]

3 participants