npm create ton@latest, it generates the following file:
counter.tolk
Smart contract data
First, we declare the storage structure. It corresponds exactly to the format used when deploying from the TypeScript clientwrappers/Counter.ts.
Handling incoming messages
When a client sends a message — for example, using thesendIncrease function in wrappers/Counter.ts— the contract processes it using this function:
sendIncrease function in TypeScript, which constructs a message containing OP_INCREASE, queryId, and increaseBy.
The corresponding struct in counter.tolk defines the format of this incoming message:
Sending messages
This contract doesn’t send any messages. To learn how message construction works in Tolk, see the Create message article.Handling internal bounced messages
Bounced messages are messages that you send, but the receiver fails to process — so they are returned to you.IncreaseCounter and ResetCounter and doesn’t send any, you can leave this function empty or remove it entirely.
GET methods
GET methods, also called contract getters, run off-chain and typically return data from the storage.getCounter function in wrappers/Counter.ts calls this exact getter from counter.tolk.