You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: dev-docs/CHANGELOG.md
+2
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
### Docs
19
19
20
20
- Removed the "gas-expensive" badge from `checkSignature()` and `checkDataSignature()` functions and added a caution note when they do become expensive (from 11th call): PR [#2380](https://github.com/tact-lang/tact/pull/2380)
21
+
- Fixed descriptions of `Slice.asString()` and `String.asSlice()` functions: PR [#2391](https://github.com/tact-lang/tact/pull/2391)
22
+
- Split Core libraries in the reference: `core-common` and `core-advanced` were removed, and their contents distributed across other libraries; `core-crypto`, `core-contextstate`, `core-send`, `core-gas`, and `core-addresses` were introduced: PR [#2391](https://github.com/tact-lang/tact/pull/2391)
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/assembly-functions.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -426,7 +426,7 @@ The [TVM][tvm] places a couple of values onto its stack upon initialization, and
426
426
427
427
:::
428
428
429
-
Therefore, to access details such as the amount of [nanoToncoins](/book/integers#nanotoncoin) in a message or the [`Address{:tact}`][p] of the sender, it's strongly recommended to call the [`context(){:tact}`](/ref/core-common#context) or [`sender(){:tact}`](/ref/core-common#sender) functions instead of attempting to look for those values on the stack.
429
+
Therefore, to access details such as the amount of [nanoToncoins](/book/integers#nanotoncoin) in a message or the [`Address{:tact}`][p] of the sender, it's strongly recommended to call the [`context(){:tact}`](/ref/core-contextstate#context) or [`sender(){:tact}`](/ref/core-contextstate#sender) functions instead of attempting to look for those values on the stack.
430
430
431
431
### Don't rely on the order of fields in structures in the standard library {#caveats-stdlib-structures}
A [global static function](/book/functions#global-static-functions)[`emit(){:tact}`](/ref/core-common#emit) sends a message to the outer world — it doesn't have a specific recipient.
633
+
A [global static function](/book/functions#global-static-functions)[`emit(){:tact}`](/ref/core-send#emit) sends a message to the outer world — it doesn't have a specific recipient.
634
634
635
635
This function is very handy for logging and analyzing data off-chain — one just has to look at [external messages](/book/external) produced by the contract.
636
636
637
637
### Logs in local Sandbox tests {#logging-local}
638
638
639
-
When deploying in the [Sandbox][sb], you may call [`emit(){:tact}`](/ref/core-common#emit) from a [receiver function](/book/contracts#receiver-functions) and then observe the list of sent [external messages](/book/external):
639
+
When deploying in the [Sandbox][sb], you may call [`emit(){:tact}`](/ref/core-send#emit) from a [receiver function](/book/contracts#receiver-functions) and then observe the list of sent [external messages](/book/external):
640
640
641
641
```typescript {9-10}
642
642
it('emits', async () => {
@@ -656,7 +656,7 @@ it('emits', async () => {
656
656
657
657
Every transaction on TON Blockchain [contains `out_msgs`](https://docs.ton.org/develop/data-formats/transaction-layout#transaction) — a dictionary that holds the list of outgoing messages created during the transaction execution.
658
658
659
-
To see logs from [`emit(){:tact}`](/ref/core-common#emit) in that dictionary, look for external messages without a recipient. In various TON Blockchain explorers, such transactions will be marked as `external-out` with the destination specified as `-` or `empty`.
659
+
To see logs from [`emit(){:tact}`](/ref/core-send#emit) in that dictionary, look for external messages without a recipient. In various TON Blockchain explorers, such transactions will be marked as `external-out` with the destination specified as `-` or `empty`.
660
660
661
661
Note that some explorers deserialize the message body sent for you, while others don't. However, you can always [parse it yourself](#logging-parsing) locally.
662
662
@@ -697,7 +697,7 @@ it('emits', async () => {
697
697
});
698
698
```
699
699
700
-
Here, the `res` object would contain the list of sent [external messages](/book/external) as its `externals` field. Let's access it to parse the first message sent via a call to [`emit(){:tact}`](/ref/core-common#emit) in Tact code (or _emitted_ for short):
700
+
Here, the `res` object would contain the list of sent [external messages](/book/external) as its `externals` field. Let's access it to parse the first message sent via a call to [`emit(){:tact}`](/ref/core-send#emit) in Tact code (or _emitted_ for short):
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/exit-codes.mdx
+2-2
Original file line number
Diff line number
Diff line change
@@ -617,7 +617,7 @@ Here are some of the functions in Tact which can throw an error with this exit c
617
617
618
618
1.[`Int.toFloatString(digits){:tact}`](/ref/core-strings#inttofloatstring): if `digits` is not in the interval $0 < digits < 78$.
619
619
620
-
2.[`String.fromBase64(){:tact}`](/ref/core-strings#stringfrombase64) and [`Slice.fromBase64(){:tact}`](/ref/core-strings#slicefrombase64): if the given [`String{:tact}`][p] or [`Slice{:tact}`][slice] contains non-Base64 characters.
620
+
2.[`String.fromBase64(){:tact}`](/ref/core-strings#stringfrombase64) and [`Slice.fromBase64(){:tact}`](/ref/core-cells#slicefrombase64): if the given [`String{:tact}`][p] or [`Slice{:tact}`][slice] contains non-Base64 characters.
621
621
622
622
```tact
623
623
try {
@@ -680,7 +680,7 @@ try {
680
680
681
681
The value of type [`Address{:tact}`][p] belongs to a basechain, when its [chain ID](https://docs.ton.org/learn/overviews/addresses#workchain-id) is equal to 0.
682
682
683
-
Such check is currently only performed in the [`forceBasechain(){:tact}`](/ref/core-advanced#forcebasechain) function. If the address does not belong to a basechain, i.e., its chain ID isn't 0, the function throws an error with exit code 138: `Not a basechain address`.
683
+
Such check is currently only performed in the [`forceBasechain(){:tact}`](/ref/core-addresses#forcebasechain) function. If the address does not belong to a basechain, i.e., its chain ID isn't 0, the function throws an error with exit code 138: `Not a basechain address`.
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/expressions.mdx
+3-3
Original file line number
Diff line number
Diff line change
@@ -282,7 +282,7 @@ Field | Type | Description
282
282
283
283
:::note
284
284
285
-
For workchain 0, the [`Address{:tact}`][p] of the current contract obtained by calling the [`myAddress(){:tact}`](/ref/core-common#myaddress) function is identical to the one that can be obtained by calling the [`contractAddress(){:tact}`](/ref/core-common#contractaddress) function with the initial state of the current contract computed via `initOf{:tact}`:
285
+
For workchain 0, the [`Address{:tact}`][p] of the current contract obtained by calling the [`myAddress(){:tact}`](/ref/core-contextstate#myaddress) function is identical to the one that can be obtained by calling the [`contractAddress(){:tact}`](/ref/core-addresses#contractaddress) function with the initial state of the current contract computed via `initOf{:tact}`:
286
286
287
287
```tact {6}
288
288
contract TheKingPrawn {
@@ -295,7 +295,7 @@ Field | Type | Description
295
295
}
296
296
```
297
297
298
-
However, if you only need the address of the current contract at runtime and not its `StateInit{:tact}`, use the [`myAddress(){:tact}`](/ref/core-common#myaddress) function, as it consumes **significantly** less gas.
298
+
However, if you only need the address of the current contract at runtime and not its `StateInit{:tact}`, use the [`myAddress(){:tact}`](/ref/core-contextstate#myaddress) function, as it consumes **significantly** less gas.
299
299
300
300
:::
301
301
@@ -314,7 +314,7 @@ codeOf ExampleContract; // a Cell with ExampleContract code
314
314
// name of the contract
315
315
```
316
316
317
-
If `codeOf{:tact}` is used for the current contract, its result is equivalent to calling [`myCode(){:tact}`](/ref/core-advanced#mycode).
317
+
If `codeOf{:tact}` is used for the current contract, its result is equivalent to calling [`myCode(){:tact}`](/ref/core-contextstate#mycode).
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/gas-best-practices.mdx
+6-6
Original file line number
Diff line number
Diff line change
@@ -161,9 +161,9 @@ If your contract method does not access any of its persistent state variables, m
161
161
162
162
### Use `sender()` over `context().sender`
163
163
164
-
When you receive an internal message, you can obtain the address of the contract that has sent it. This can be done by calling the [`sender()`](/ref/core-common#sender) function or by accessing the `.sender` field of the `Context{:tact}`[struct][struct] after calling the [`context()`](/ref/core-common#context) function.
164
+
When you receive an internal message, you can obtain the address of the contract that has sent it. This can be done by calling the [`sender()`](/ref/core-contextstate#sender) function or by accessing the `.sender` field of the `Context{:tact}`[struct][struct] after calling the [`context()`](/ref/core-contextstate#context) function.
165
165
166
-
If you only need the sender's address and no additional context on the incoming message that is contained in the `Context{:tact}` struct, then use the [`sender()`](/ref/core-common#sender) function as it is less gas-consuming.
166
+
If you only need the sender's address and no additional context on the incoming message that is contained in the `Context{:tact}` struct, then use the [`sender()`](/ref/core-contextstate#sender) function as it is less gas-consuming.
167
167
168
168
```tact /sender\\(\\)/
169
169
message(MessageParameters{
@@ -194,9 +194,9 @@ fun example() {
194
194
195
195
Every [contract](/book/contracts) in Tact implicitly [inherits](/book/contracts#traits) the `BaseTrait{:tact}` trait, which contains a number of [internal functions](/book/contracts#internal-functions) for any contract. Those internal functions are gas-expensive for the same reasons as stated earlier.
196
196
197
-
Calls to `self.forward(){:tact}`, `self.reply(){:tact}` and `self.notify(){:tact}` can be replaced with respective calls to the [`send(){:tact}`](/ref/core-common#send) or [`message(){:tact}`](/ref/core-common#message) functions with suitable values.
197
+
Calls to `self.forward(){:tact}`, `self.reply(){:tact}` and `self.notify(){:tact}` can be replaced with respective calls to the [`send(){:tact}`](/ref/core-send#send) or [`message(){:tact}`](/ref/core-send#message) functions with suitable values.
198
198
199
-
Moreover, if all you want is to forward the remaining value back to the sender, it is best to use the [`cashback(){:tact}`](/ref/core-common#cashback) function instead of `self.notify(){:tact}` function.
199
+
Moreover, if all you want is to forward the remaining value back to the sender, it is best to use the [`cashback(){:tact}`](/ref/core-send#cashback) function instead of `self.notify(){:tact}` function.
200
200
201
201
```tact
202
202
// This
@@ -234,7 +234,7 @@ cashback(sender());
234
234
235
235
### Use `deploy()` function for on-chain deployments
236
236
237
-
There are many [message-sending functions](/book/send#message-sending-functions), and the [`deploy(){:tact}`](/ref/core-common#deploy) function is optimized for cheaper on-chain deployments compared to the [`send(){:tact}`](/ref/core-common#send) function.
237
+
There are many [message-sending functions](/book/send#message-sending-functions), and the [`deploy(){:tact}`](/ref/core-send#deploy) function is optimized for cheaper on-chain deployments compared to the [`send(){:tact}`](/ref/core-send#send) function.
238
238
239
239
```tact
240
240
deploy(DeployParameters{
@@ -247,7 +247,7 @@ deploy(DeployParameters{
247
247
248
248
### Use `message()` function for non-deployment messages
249
249
250
-
There are many [message-sending functions](/book/send#message-sending-functions), and the [`message(){:tact}`](/ref/core-common#message) function is optimized for cheaper non-deployment regular messages compared to the [`send(){:tact}`](/ref/core-common#send) function.
250
+
There are many [message-sending functions](/book/send#message-sending-functions), and the [`message(){:tact}`](/ref/core-send#message) function is optimized for cheaper non-deployment regular messages compared to the [`send(){:tact}`](/ref/core-send#send) function.
As previously mentioned, messages sent via the [`send(){:tact}`](/ref/core-common#send) function utilize the `mode` parameter of the `SendParameters{:tact}` structure. The `mode` is an [`Int{:tact}`][int] value, which is combined from base modes and optional flags, which are also [`Int{:tact}`][int] values.
8
+
As previously mentioned, messages sent via the [`send(){:tact}`](/ref/core-send#send) function utilize the `mode` parameter of the `SendParameters{:tact}` structure. The `mode` is an [`Int{:tact}`][int] value, which is combined from base modes and optional flags, which are also [`Int{:tact}`][int] values.
9
9
10
10
It's possible to use raw [`Int{:tact}`][int] values and manually provide them for the `mode`, but for your convenience there is a set of constants you may use to easily construct the compound `mode`. Take a look at the following tables for more information on base modes and optional flags.
11
11
@@ -68,7 +68,7 @@ Note that there can be only **one** [base mode](#base-modes), but the number of
68
68
69
69
Some [message-sending functions](/book/send#message-sending-functions) do not allow setting a mode by passing an argument. This is because their internal logic requires a specific fixed set of modes to be used instead:
70
70
71
-
*[`emit(){:tact}`](/ref/core-common#emit) sends a message with the `SendDefaultMode{:tact}` ($0$).
71
+
*[`emit(){:tact}`](/ref/core-send#emit) sends a message with the `SendDefaultMode{:tact}` ($0$).
72
72
*[`self.reply(){:tact}`](/ref/core-base#self-reply), [`self.notify(){:tact}`](/ref/core-base#self-notify), and [`self.forward(){:tact}`](/ref/core-base#self-forward) all use the `SendRemainingValue{:tact}` mode unless the [`self.storageReserve{:tact}`](/ref/core-base#self-storagereserve) constant is overridden to be greater than $0$, in which case they attempt to use the `SendRemainingBalance{:tact}` mode.
Copy file name to clipboardexpand all lines: docs/src/content/docs/book/security-best-practices.mdx
+2-2
Original file line number
Diff line number
Diff line change
@@ -299,7 +299,7 @@ A message cascade can be processed over many blocks. Assume that while one messa
299
299
300
300
## Handle/Send bounced messages
301
301
302
-
Send messages with the bounce flag set to `true{:tact}`, which is the default for the [`send(){:tact}`](/ref/core-common#send) function. Messages bounce when the execution of a contract fails. You may want to handle this by rolling back the state of the contract using [`try...catch{:tact}`](/book/statements#try-catch) statements and performing additional processing depending on your logic.
302
+
Send messages with the bounce flag set to `true{:tact}`, which is the default for the [`send(){:tact}`](/ref/core-send#send) function. Messages bounce when the execution of a contract fails. You may want to handle this by rolling back the state of the contract using [`try...catch{:tact}`](/book/statements#try-catch) statements and performing additional processing depending on your logic.
303
303
304
304
##### Do's ✅
305
305
@@ -356,7 +356,7 @@ From the [Sending messages page](/book/send#outbound-message-processing) of the
356
356
357
357
> Each transaction on TON Blockchain consists of multiple phases. Outbound messages are evaluated in the compute phase but are **not** sent in that phase. Instead, they're queued in order of appearance for the action phase, where all actions listed in the compute phase, such as outbound messages or reserve requests, are executed.
358
358
359
-
Hence, if the compute phase fails, [registers](https://docs.ton.org/v3/documentation/tvm/tvm-overview#control-registers)`c4` (persistent data) and `c5` (actions) won't be updated. However, it is possible to manually save their state using the [`commit(){:tact}`](/ref/core-advanced/#commit) function.
359
+
Hence, if the compute phase fails, [registers](https://docs.ton.org/v3/documentation/tvm/tvm-overview#control-registers)`c4` (persistent data) and `c5` (actions) won't be updated. However, it is possible to manually save their state using the [`commit(){:tact}`](/ref/core-contextstate#commit) function.
0 commit comments