Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit e9dc22a

Browse files
committed
Update content and fix some typo
1 parent 64e3950 commit e9dc22a

File tree

6 files changed

+77
-49
lines changed

6 files changed

+77
-49
lines changed

pages/index.mdx

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# Tact Documentation
22

3-
Tact is a new programming language for TON blockchain that is focused on efficiency and simplicity. It is designed to be easy to learn and use, and to be a good fit for smart contracts. Tact is a statically typed language with a simple syntax and a powerful type system.
3+
![Banner](public/banner.jpeg)
44

5-
* [Getting Started](/start)
6-
* [Language and stdlib documentation](/language/guides/types)
7-
* [Tools](/tools/typescript)
5+
**Tact is a new programming language for TON blockchain that is focused on efficiency and simplicity.**
6+
7+
**It is designed to be easy to learn and use, and to be a good fit for smart contracts. Tact is a statically typed language with a simple syntax and a powerful type system.**
8+
9+
### Content
10+
11+
- [Getting Started](/start)
12+
- [Language and stdlib documentation](/language/guides/types)
13+
- [Tools](/tools/typescript)
14+
15+
### Community
16+
17+
- [✈️ Telegram Group](https://t.me/tactlang)
18+
- [🐦 Twitter](https://twitter.com/tact_language)

pages/start/deploy.mdx

+22-18
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,41 @@ Template project provides a handy way to deploy contracts, but you can do it you
44

55
## Deploying with typescript and deploy link
66

7-
To deploy a smart contract in TON you need to send a message with `init` data attached to it. The easiest way to get an `init` for your contract is using a generated typescript bindings that would help to call an init function.
7+
To deploy a smart contract in TON you need to send a message with `init` data attached to it. The easiest way to get an `init` for your contract is using a generated typescript bindings that would help to call an init function.
88

99
```typescript
10-
import base64url from 'base64url';
11-
import qs from 'qs';
12-
import { Address, beginCell, storeStateInit } from 'ton';
13-
import { Counter } from './output/sample_Counter';
10+
import base64url from "base64url";
11+
import qs from "qs";
12+
import { Address, beginCell, storeStateInit } from "ton";
13+
import { Counter } from "./output/sample_Counter";
1414

1515
// Forming an init package
16-
let owner = Address.parse('some-address');
16+
let owner = Address.parse("some-address");
1717
let init = await Counter.init(owner);
1818
let testnet = true;
1919

2020
// Contract address
2121
let address = contractAddress(0, init);
2222

2323
// Amount of TONs to attach to a deploy message
24-
let deployAmount = toNano('0.5');
24+
let deployAmount = toNano("0.5");
2525

2626
// Create string representation of an init package
27-
let initStr = base64url(beginCell()
28-
.store(storeStateInit(init))
29-
.endCell()
30-
.toBoc({ idx: false }));
27+
let initStr = base64url(
28+
beginCell().store(storeStateInit(init)).endCell().toBoc({ idx: false })
29+
);
3130

3231
// Create a deploy link
33-
console.log(`ton://transfer/` + address.toString({ testOnly: testnet }) + "?" + qs.stringify({
34-
text: 'Deploy',
35-
amount: deployAmount.toString(10),
36-
init: initStr
37-
}));
32+
console.log(
33+
`ton://transfer/` +
34+
address.toString({ testOnly: testnet }) +
35+
"?" +
36+
qs.stringify({
37+
text: "Deploy",
38+
amount: deployAmount.toString(10),
39+
init: initStr,
40+
})
41+
);
3842
```
39-
40-
After running this code you will get a link that you can open in your favorite TON wallet. It will open a transfer page with a deploy message already filled in. You can change the amount of TONs to attach to a deploy message and click on the `Send` button. After a few seconds your contract will be deployed and you will see a transaction in your wallet.
43+
44+
After running this code you will get a link that you can open in your favorite TON wallet. It will open a transfer page with a deploy message already filled in. You can change the amount of TONs to attach to a deploy message and click on the `Send` button. After a few seconds your contract will be deployed and you will see a transaction in your wallet.

pages/start/first.mdx

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
TON contract is an isolated object that have state and code, can send and receive messages and export get-methods for off-chain reading of a contract state.
44

55
The code of the contract dictates how:
6-
* it manipulates it's own state
7-
* it reacts to incoming messages
8-
* exposes it's state to off-chain world
6+
7+
- it manipulates it's own state
8+
- it reacts to incoming messages
9+
- exposes it's state to off-chain world
910

1011
## Contract example
1112

@@ -47,14 +48,14 @@ This contract has two state variables that persisted between contract calls: `ow
4748
Notation `receive("increment")` means declaration of a `receiver` function that will be called when a text with value `"increment"` is sent to the contract. The function body can modify the state of the contract and send messages to other contracts. It is impossbile to call `receiver` directly. If you need to reuse some logic you can declare a function and call it from `receiver`.
4849

4950
There are several receiver functions. All receiver functions are processed in the order they are listed below:
50-
* `receive()` - called when an empty message is sent to the contract
51-
* `receive("message")` - called when a text message with a specific comment is sent to the contract
52-
* `receive(str: String)` - called when an arbitrary text message is sent to the contract
53-
* `receive(msg: MyMessage)` - called when binary message of type `MyMessage` is sent to the contract
54-
* `receive(msg: Slice)` - called when binary message of unknown type is sent to the contract
55-
* `bounced(msg: Slice)` - called when outgoing message bounced
5651

52+
- `receive()` - called when an empty message is sent to the contract
53+
- `receive("message")` - called when a text message with a specific comment is sent to the contract
54+
- `receive(str: String)` - called when an arbitrary text message is sent to the contract
55+
- `receive(msg: MyMessage)` - called when binary message of type `MyMessage` is sent to the contract
56+
- `receive(msg: Slice)` - called when binary message of unknown type is sent to the contract
57+
- `bounced(msg: Slice)` - called when outgoing message bounced
5758

5859
## Getters
5960

60-
There are two getters in this contract `counter` and `owner` that returns current counter value and `owner` of a contract. Getters are **not accessible from other contracts** and exported only to off-chain world.
61+
There are two getters in this contract `counter` and `owner` that returns current counter value and `owner` of a contract. Getters are **not accessible from other contracts** and exported only to off-chain world.

pages/start/index.mdx

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Welcome to Tact
22

3-
There are two ways to start with tact: using template and starting from scratch. We recommend using template as it contains a simple contract that can be deployed to the TON blockchain, example of implementing unit tests and helper functions for contract deployment.
3+
There are two ways to start with Tact: using a template or starting from scratch.
4+
5+
We recommend using a template, as it contains a **simple contract** that can be deployed to the TON blockchain, along with examples of implementing unit tests and helper functions for contract deployment.
46

57
## Getting started from template
68

7-
To get started, you can use the template project. It contains a simple contract that can be deployed to the TON blockchain, example of implementing unit tests and helper functions for contract deployment.
9+
To get started, you can use the template project. It contains a simple contract that can be deployed to the TON blockchain, as well as examples of implementing unit tests and helper functions for contract deployment.
810

9-
To create a project from template, just create a new repository from the template project: https://github.com/tact-lang/tact-template.
11+
> To create a project from the template, simply create a new repository from the template project: https://github.com/tact-lang/tact-template.
1012
1113
## Getting started from scratch
1214

13-
Tact is distributed via `npm` package manager and is meant to be installed to typescript/javascript projects:
15+
Tact is distributed via `npm` package manager and is meant to be installed to TypeScript/JavaScript projects:
1416

1517
```bash
1618
yarn add @tact-lang/compiler
@@ -20,11 +22,13 @@ Then you need to create a `tact.config.json` file in the root of your project. I
2022

2123
```json
2224
{
23-
"projects": [{
24-
"name": "sample",
25-
"path": "./sources/contract.tact",
26-
"output": "./sources/output"
27-
}]
25+
"projects": [
26+
{
27+
"name": "sample",
28+
"path": "./sources/contract.tact",
29+
"output": "./sources/output"
30+
}
31+
]
2832
}
2933
```
3034

@@ -48,11 +52,11 @@ contract SampleTactContract with Deployable {
4852
}
4953
5054
fun add(v: Int) {
51-
55+
5256
// Check sender
5357
let ctx: Context = context();
5458
require(ctx.sender == self.owner, "Invalid sender");
55-
59+
5660
// Update counter
5761
self.counter = (self.counter + v);
5862
}
@@ -75,11 +79,10 @@ Add a build script to `package.json`:
7579

7680
```json
7781
{
78-
"scripts": {
79-
"build": "tact --config ./tact.config.json",
80-
}
82+
"scripts": {
83+
"build": "tact --config ./tact.config.json"
84+
}
8185
}
8286
```
8387

8488
Now you can run `yarn build` and get the compiled contract in `./sources/output` folder.
85-

public/banner.jpeg

53 KB
Loading

theme.config.jsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,17 @@ export default {
5656
content="Language reference and guides for Tact"
5757
/>
5858

59-
<meta name="twitter:card" content="summary_large_image" />
60-
<meta name="twitter:site" content="@tact_language"></meta>
59+
<meta
60+
name="twitter:card"
61+
content="summary_large_image"
62+
/>
63+
64+
<meta
65+
name="twitter:site"
66+
content="@tact_language
67+
">
68+
69+
</meta>
6170

6271
<meta name="apple-mobile-web-app-title" content="Tact" />
6372

0 commit comments

Comments
 (0)