TGViewer
TOLK lang TOLK lang @tolk_lang Β· 809 subscribers
Post #22 5.52K
🫧 Tolk v0.99: universal message composition

This update introduces a high-level, type-safe way to compose and send messages to other contracts.

No more manual beginCell().storeUint(...).storeRef(...) boilerplate. Just describe the message in a literal, and let the compiler do the rest.

βœ… Notable changes in Tolk v0.99:

1. Universal createMessage – control body, extra currency, stateInit, and more
2. Universal createExternalLogMessage β€” emit logs efficiently
3. Sharding β€” calculate addresses "close to another contract"

PR on GitHub with detailed info.

βœ” createMessage: short demo


val reply = createMessage({
bounce: false,
value: ton("0.05"),
dest: senderAddress,
body: RequestedInfo { ... }
});
reply.send(SEND_MODE_REGULAR);


Key features:

1. Supports extra currencies
2. Supports stateInit with automatic address computation
3. Supports different workchains
4. Supports sharding (formerly splitDepth)
5. Integrated with auto-serialization of body
6. Automatically detects "body ref or not"

βœ” Union types as the foundation

Almost every field is a union β€” flexible API while staying strictly typed:


// value: either tons, or tons + extra currencies
value: ton("1.5")
value: (ton("1.5"), extraDict)

// destination: various forms
dest: someAddress
dest: (workchain, hash)


βœ” Body: inline or ref?

Don't think about refs β€” the compiler does:
- small structs are inlined
- large ones are wrapped in a ref
- detected at compile-time β€” no runtime checks


// any serializable struct β€” no toCell!
body: RequestedInfo { ... }


Don't need body? Just leave it out.

βœ” Deployment: a variant of "destination"


dest: {
    workchain: BASECHAIN,
    stateInit: { code, data },
}


The beauty of TON is that it doesn't have a dedicated deployment mechanism. You just send a message to some void β€” and if this void doesn't exist, but you've attached a way to initialize it β€” it's initialized immediately, and accepts your message.

βœ” Sharding!

Built-in features to calculate an address "in the shard of contract B."


dest: {
...
toShard: {
fixedPrefixLength: 8,
closeTo: ownerAddress,
}
}


Perfect for optimized sharded jettons. All the hashing, StateInit packing, and bit-level work is done automatically.

βš™οΈ What about gas costs?

Even with all this flexibility, createMessage is not bloated. The compiler unfolds all union branches and constant conditions at compile time, producing flat, minimal code β€” often more optimal than hand-crafted cell composition.

❓ v0.99? So, what's next?

Yes, it's the last version before the final release. Tolk now covers the entire initial roadmap and is ready for real-world use. On top of that, we'll add several compiler optimizations and rewrite standard contracts from FunC to Tolk β€” to demonstrate how exactly everything ties together.
  • πŸ”₯ 25
  • ❀ 18
  • 🍾 11
  • 😱 3
  • πŸ†’ 3
More from @tolk_lang
  1. Jun 23, 2026🫧 Tolk v1.4.x: internal progress and maintenance Since the v1.4 release we've published T…
  2. May 11, 2026🫧 TON enters a new era of smart-contract development I promised this would happen in May.…
  3. Mar 27, 2026🫧 Tolk v1.3: moving toward a general-purpose language After the previous post, this relea…
  4. Mar 19, 2026🫧 Tolk v1.3... not released yet: what's happening inside I know it has been quiet. The la…
  5. Dec 5, 2025🫧 Tolk documentation β€” now complete and available for learning from scratch From now on,…
  6. Nov 14, 2025🫧 Tolk v1.2: rich bounced messages, cheap deployment, and a breaking change that you'll l…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’