Skip to content

Commit 99163eb

Browse files
committed
Writerside docs
Signed-off-by: andreypfau <[email protected]>
1 parent 015556f commit 99163eb

File tree

7 files changed

+338
-0
lines changed

7 files changed

+338
-0
lines changed

.github/workflows/docs.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Build documentation
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'Writerside/**'
8+
- '.github/workflows/docs.yml'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
pages: write
15+
16+
env:
17+
INSTANCE: 'Writerside/hi'
18+
DOCKER_VERSION: 'XXX.YYYYY'
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }}
25+
artifact: ${{ steps.define-ids.outputs.artifact }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Define instance id and artifacts
33+
id: define-ids
34+
run: |
35+
INSTANCE=${INSTANCE#*/}
36+
INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]')
37+
ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip"
38+
ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip"
39+
40+
# Print the values
41+
echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER"
42+
echo "ARTIFACT: $ARTIFACT"
43+
echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT"
44+
45+
# Set the environment variables and outputs
46+
echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV
47+
echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV
48+
echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV
49+
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT
50+
echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT
51+
52+
- name: Build docs using Writerside Docker builder
53+
uses: JetBrains/writerside-github-action@v4
54+
with:
55+
instance: ${{ env.INSTANCE }}
56+
docker-version: ${{ env.DOCKER_VERSION }}
57+
58+
- name: Save artifact with build results
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: docs
62+
path: |
63+
artifacts/${{ steps.define-ids.outputs.artifact }}
64+
artifacts/report.json
65+
artifacts/${{ steps.define-ids.outputs.algolia_artifact }}
66+
retention-days: 7
67+
test:
68+
needs: build
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Download artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: docs
75+
path: artifacts
76+
77+
- name: Test documentation
78+
uses: JetBrains/writerside-checker-action@v1
79+
with:
80+
instance: ${{ env.INSTANCE }}
81+
deploy:
82+
environment:
83+
name: github-pages
84+
url: ${{ steps.deployment.outputs.page_url }}
85+
needs: [ build, test ]
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Download artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: docs
92+
path: artifacts
93+
94+
- name: Unzip artifact
95+
run: unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.artifact }}" -d dir
96+
97+
- name: Setup Pages
98+
uses: actions/configure-pages@v4
99+
100+
- name: Package and upload Pages artifact
101+
uses: actions/upload-pages-artifact@v3
102+
with:
103+
path: dir
104+
105+
- name: Deploy to GitHub Pages
106+
id: deployment
107+
uses: actions/deploy-pages@v4

Writerside/c.list

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE categories
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
4+
<categories>
5+
<category id="wrs" name="Writerside documentation" order="1"/>
6+
</categories>

Writerside/cfg/buildprofiles.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE buildprofiles SYSTEM "https://resources.jetbrains.com/writerside/1.0/build-profiles.dtd">
3+
<buildprofiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd">
5+
6+
<variables></variables>
7+
<build-profile instance="hi">
8+
<variables>
9+
<noindex-content>false</noindex-content>
10+
</variables>
11+
</build-profile>
12+
13+
</buildprofiles>

Writerside/hi.tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE instance-profile
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
4+
5+
<instance-profile id="hi"
6+
name="Help instance"
7+
start-page="Overview.md">
8+
9+
<toc-element topic="Overview.md"/>
10+
</instance-profile>

Writerside/topics/Overview.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# TON SDK — Overview
2+
3+
TON SDK is a modular SDK for building applications on The Open Network (TON). It offers first‑class support for Kotlin
4+
and Java on the JVM/Android, and can be consumed from Swift on iOS via Kotlin Multiplatform. It provides the core data
5+
structures (Cells/BOC), TL‑B codecs, crypto primitives, networking stacks (ADNL/RLDP), and high‑level APIs (contracts,
6+
lite client) so you can integrate TON from server, desktop, Android, or iOS with one codebase.
7+
8+
This document explains the SDK at a high level: what it is, how it is organized, and when to use each module. For
9+
hands‑on guides and API details, see the other topics in this documentation set.
10+
11+
## What is TON SDK?
12+
13+
A collection of modular libraries published on Maven Central under the `org.ton.kotlin` group. Each module focuses on a
14+
well‑defined layer of the TON stack, from low‑level binary formats up to ready‑to‑use APIs.
15+
16+
### Key features
17+
18+
- Kotlin Multiplatform first: shared code for JVM, Android, and other targets.
19+
- Zero‑dependency core for critical primitives (Cells, BOC, TL‑B).
20+
- TL‑B serialization/deserialization with code‑generated schemas for blockchain objects.
21+
- Networking layers for TON (ADNL, RLDP) and a Lite Client API.
22+
- Contract utilities to work with smart‑contracts from Kotlin.
23+
- Carefully tested with cross‑platform test suites.
24+
25+
## Module map (current)
26+
27+
- ton-sdk-blockchain — Core blockchain primitives such as Address, BlockId, Transaction, Message, etc.
28+
- ton-sdk-crypto — ED25519, SHA, CRC, and related crypto utilities.
29+
- ton-sdk-tl — Type Language (TL) serializer for kotlinx-serialization used in network protocols and more.
30+
- ton-sdk-cell — The fundamental immutable binary structure in TON used by TVM; also includes the BOC (Bag of Cells)
31+
container format.
32+
- ton-sdk-liteapi-client — LiteAPI (LiteClient) for RPC, requests unindexed data from blockchain nodes via LiteServer.
33+
- ton-sdk-toncenter-client — HTTP RPC client for TonCenter V3 (Indexed) and TonCenter V2 (Unindexed).
34+
- ton-sdk-dict — TVM Dictionary built on top of Cells.
35+
- ton-sdk-bitstring — Small module for BitStrings (used by Cells and for byte-level serialization).
36+
- ton-sdk-bigint — Cross‑platform big integer; on JVM it aliases java.math.BigInteger, with platform implementations
37+
elsewhere.
38+
39+
Note: Artifact coordinates in Maven Central may use org.ton.kotlin with module names like ton-kotlin-*. Refer to the
40+
README for the latest coordinates and versions.
41+
42+
## Typical use cases
43+
44+
- Indexers and backends that need to parse blocks/transactions and verify proofs.
45+
- Wallets and apps that compose and serialize messages and contracts.
46+
- Services querying blockchain data via the Lite Client.
47+
- Tooling and middleware that rely on TL‑B codecs and BOC manipulation.
48+
49+
## Installation
50+
51+
Add TON SDK modules from Maven Central. Use the coordinates under the org.ton.kotlin group. Keep module versions
52+
aligned (e.g., 0.5.0).
53+
54+
Gradle (Kotlin DSL):
55+
56+
```kotlin
57+
val tonVersion = "0.5.0"
58+
59+
dependencies {
60+
implementation("org.ton.kotlin:ton-kotlin-tvm:$tonVersion") // Cells/BOC
61+
implementation("org.ton.kotlin:ton-kotlin-crypto:$tonVersion") // Crypto
62+
implementation("org.ton.kotlin:ton-kotlin-tlb:$tonVersion") // TL-B codec
63+
implementation("org.ton.kotlin:ton-kotlin-liteclient:$tonVersion") // Lite client API
64+
// Optional:
65+
implementation("org.ton.kotlin:ton-kotlin-contract:$tonVersion") // Contracts helpers
66+
implementation("org.ton.kotlin:ton-kotlin-adnl:$tonVersion") // ADNL transport
67+
}
68+
```
69+
70+
Gradle (Groovy DSL):
71+
72+
```groovy
73+
def tonVersion = '0.5.0'
74+
75+
dependencies {
76+
implementation "org.ton.kotlin:ton-kotlin-tvm:$tonVersion"
77+
implementation "org.ton.kotlin:ton-kotlin-crypto:$tonVersion"
78+
implementation "org.ton.kotlin:ton-kotlin-tlb:$tonVersion"
79+
implementation "org.ton.kotlin:ton-kotlin-liteclient:$tonVersion"
80+
// Optional:
81+
implementation "org.ton.kotlin:ton-kotlin-contract:$tonVersion"
82+
implementation "org.ton.kotlin:ton-kotlin-adnl:$tonVersion"
83+
}
84+
```
85+
86+
Maven:
87+
88+
```xml
89+
90+
<dependencies>
91+
<dependency>
92+
<groupId>org.ton.kotlin</groupId>
93+
<artifactId>ton-kotlin-tvm</artifactId>
94+
<version>0.5.0</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.ton.kotlin</groupId>
98+
<artifactId>ton-kotlin-crypto</artifactId>
99+
<version>0.5.0</version>
100+
</dependency>
101+
<dependency>
102+
<groupId>org.ton.kotlin</groupId>
103+
<artifactId>ton-kotlin-tlb</artifactId>
104+
<version>0.5.0</version>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.ton.kotlin</groupId>
108+
<artifactId>ton-kotlin-liteclient</artifactId>
109+
<version>0.5.0</version>
110+
</dependency>
111+
<!-- Optional -->
112+
<dependency>
113+
<groupId>org.ton.kotlin</groupId>
114+
<artifactId>ton-kotlin-contract</artifactId>
115+
<version>0.5.0</version>
116+
</dependency>
117+
<dependency>
118+
<groupId>org.ton.kotlin</groupId>
119+
<artifactId>ton-kotlin-adnl</artifactId>
120+
<version>0.5.0</version>
121+
</dependency>
122+
</dependencies>
123+
```
124+
125+
## Quick start
126+
127+
Add the artifacts you need from Maven Central and start from the level that fits your use case.
128+
129+
### Kotlin (JVM/Android)
130+
131+
Creating a Cell and serializing to BOC:
132+
133+
```kotlin
134+
val cell = org.ton.cell.buildCell {
135+
storeUInt(0xDEADBEEFu, 32)
136+
}
137+
val boc: ByteArray = org.ton.boc.BagOfCells.of(cell).toByteArray()
138+
```
139+
140+
Decoding a TL‑B object (schema provided by block‑tlb module):
141+
142+
```kotlin
143+
val block = org.ton.tlb.loadTlb<Block>(boc)
144+
```
145+
146+
### Java (JVM)
147+
148+
Creating a Cell and serializing to BOC:
149+
150+
```java
151+
public class Example {
152+
static void main(String[] args) {
153+
var builder = org.ton.cell.CellBuilderKt.beginCell();
154+
builder.storeUInt(0xDEADBEEF, 32);
155+
org.ton.cell.Cell cell = builder.endCell();
156+
byte[] boc = org.ton.boc.BagOfCells.Companion.of(new org.ton.cell.Cell[]{cell}).toByteArray();
157+
}
158+
}
159+
```
160+
161+
See examples/ and tests in the repository for more scenarios.
162+
163+
## Supported platforms
164+
165+
- JVM / AndroidKotlin and Java (first‑class)
166+
- iOS — Swift via Kotlin Multiplatform bindings (availability may vary by module)
167+
- Desktop/ServerJVM
168+
- Other Kotlin targets may be available per‑module; check each module’s README or Gradle metadata.
169+
170+
## Versioning and compatibility
171+
172+
- Semantic‑like versioning across modules. Prefer matching versions (e.g., 0.5.x) for best compatibility.
173+
- Wire formats (BOC, TLB) follow TON specifications; backwards compatibility is preserved unless TON protocol changes.
174+
175+
## Where to go next
176+
177+
- Project README: architecture, badges, and links
178+
- Wiki/Docs: deeper guides and API references
179+
- Examples directory: runnable samples
180+
- Telegram chat: community support and announcements
181+
182+
## Glossary
183+
184+
- CellThe fundamental immutable binary structure in TON used by TVM.
185+
- BOC (Bag of Cells) — A container format for serializing graphs of Cells.
186+
- TLBType language for describing binary data structures in TON.
187+
- ADNLAbstract Datagram Network Layer, a TON network transport.
188+
- RLDPReliable Link over Datagram Protocol used over ADNL.
189+
- Lite ClientA client that queries TON blockchain data without running a full node.

Writerside/v.list

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE vars SYSTEM "https://resources.jetbrains.com/writerside/1.0/vars.dtd">
3+
<vars>
4+
<var name="product" value="Writerside"/>
5+
</vars>

Writerside/writerside.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE ihp SYSTEM "https://resources.jetbrains.com/writerside/1.0/ihp.dtd">
3+
4+
<ihp version="2.0">
5+
<topics dir="topics" web-path="topics"/>
6+
<images dir="images" web-path="images"/>
7+
<instance src="hi.tree"/>
8+
</ihp>

0 commit comments

Comments
 (0)