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: docs/v3/guidelines/quick-start/developing-smart-contracts/tact-folder/tact-storage-and-get-methods.mdx
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,9 @@ message Add {
28
28
A **message** is a structure that sends data into a contract from another contract or outside the blockchain.
29
29
Tact simplifies working with messages by automatically serializing and deserializing them into [TVM cells](https://docs.ton.org/v3/documentation/data-formats/tlb/msg-tlb). You don’t need to write low-level serialization code or think about bit layout manually — Tact handles that for you.
30
30
31
-
For example, if you want to assign a fixed opcode to the message, which is useful when evolving message structures, you can define it like this:
31
+
Every message is assigned a unique 32-bit identifier called an **opcode** (short for operation code). This identifier is stored at the beginning of the serialized message and helps the contract understand what type of message it is *receiving*.
32
+
33
+
By default, Tact automatically assigns this identifier. However, you can also define it manually, for example, when evolving the structure of your messages over time:
32
34
33
35
```tact title="/contracts/hello_world.tact"
34
36
message(0x7e8764ef) Add {
@@ -234,12 +236,16 @@ Expected output should look like this:
234
236
235
237
## Step 2: update wrapper
236
238
237
-
[Wrappers](https://docs.tact-lang.org/book/compile/#wrap-ts) facilitate contract interaction from TypeScript. Unlike in FunC or Tolk, they are generated automatically during the build process:
239
+
After building your contract, Tact automatically generates a special wrapper file. This [wrapper]((https://docs.tact-lang.org/book/compile/#wrap-ts)) simplifies interaction with your contract from TypeScript, such as calling its methods or sending messages.
240
+
241
+
In the wrapper file, you'll find this line of code:
238
242
239
243
```typescript title="/wrappers/HelloWorld.ts"
240
244
export*from'../build/HelloWorld/tact_HelloWorld';
241
245
```
242
246
247
+
This code exports everything inside the `tact_HelloWorld.ts` file in the build folder, making it available for use in other files.
248
+
243
249
## Step 3: updating tests
244
250
245
251
Now let's ensure that our smart contract code fails when we try to send `add` message from non-owner:
0 commit comments