T
TOLK lang
@tolk_lang
🫧 Tolk v0.13 (Release candidate): Auto-packing to/from cells
We've finally reached the point we've been working toward for the past six months: automatic (de)serialization of anything into cells. From simple structs to unions, generics, and even nested references — it just works.
The goal? To replace TL/B entirely with declarative, type-safe definitions. The compiler takes care of packing, loading, estimating, error handling, and more.
✅ Notable changes in Tolk v0.13:
1. Auto-packing to/from cells/slices/builders
2. Type
3. Lateinit variables, default parameters, and other minor features
PR on GitHub with detailed info.
✔ Auto-serialization: short demo
Key features:
* supports all types: unions, tensors, nullables, generics, atomics, ...
* allows to specify prefixes (particularly, opcodes)
* allows to manage cell references and when to load them
* lets you control error codes and other behavior
* unpacks data from a cell or a slice, mutate it or not
* packs data to a cell or a builder
* warns if data potentially exceeds 1023 bits
* more efficient than manual serialization
* will seamlessly integrate with message sending/receiving in Tolk v1.0
✔ Pack or unpack — anywhere
✔ Serialization prefixes and opcodes
They are not limited to 32 bits — you can describe any TL/B constructors:
✔ Typed cells
Typed cells give you full control over when content is unpacked — nothing is loaded unless you call .load() manually:
// Yes,
✔ Granular options
Accurately adjust serialization behaviour (for example, error codes):
✔ Built-in type `address`
* integrated with auto-serialization, while still a slice under the hood
* comparable:
* introspectable: isInternal(), getWorkchain(), etc.
✔ Some other features
Described in detail in the full changelog and mirrored in the documentation.
🌳 We're just a couple of steps away from Tolk v1.0 — with message sending and handling, gas optimizations, and one secret feature. There is still a lot of work ahead, but today we're closer to the release than ever before.
We've finally reached the point we've been working toward for the past six months: automatic (de)serialization of anything into cells. From simple structs to unions, generics, and even nested references — it just works.
The goal? To replace TL/B entirely with declarative, type-safe definitions. The compiler takes care of packing, loading, estimating, error handling, and more.
✅ Notable changes in Tolk v0.13:
1. Auto-packing to/from cells/slices/builders
2. Type
address3. Lateinit variables, default parameters, and other minor features
PR on GitHub with detailed info.
✔ Auto-serialization: short demo
struct Point {
x: int8;
y: int8;
}
var value: Point = { x: 10, y: 20 };
// makes a cell containing "0A14"
var c = value.toCell();
// back to { x: 10, y: 20 }
var p = Point.fromCell(c);
Key features:
* supports all types: unions, tensors, nullables, generics, atomics, ...
* allows to specify prefixes (particularly, opcodes)
* allows to manage cell references and when to load them
* lets you control error codes and other behavior
* unpacks data from a cell or a slice, mutate it or not
* packs data to a cell or a builder
* warns if data potentially exceeds 1023 bits
* more efficient than manual serialization
* will seamlessly integrate with message sending/receiving in Tolk v1.0
✔ Pack or unpack — anywhere
T.fromCell, T.fromSlice, slice.loadAny<T>, builder.storeAny<T>, and other methods give both high-level and low-level API.
// low-level is allowed:
beginCell()
.storeUint(1, 32) // mix manual
.storeAny(myStruct) // with auto
✔ Serialization prefixes and opcodes
struct (0x7362d09c) TransferNotification {
queryId: uint64;
...
}
They are not limited to 32 bits — you can describe any TL/B constructors:
struct (0b001) AssetSimple { ... }
struct (0b100) AssetBooking { ... }
type Asset = AssetSimple | AssetBooking | ...;
✔ Typed cells
struct A {
ref1: cell; // untyped ref
ref2: Cell<Inner>; // typed ref
ref3: Cell<int256>?; // maybe ref
}
Typed cells give you full control over when content is unpacked — nothing is loaded unless you call .load() manually:
a.ref2.field // error
a.ref2.load().field // ok
// Yes,
point.toCell() really gives you Cell<Point>✔ Granular options
Accurately adjust serialization behaviour (for example, error codes):
Point.fromSlice(s, {
assertEndAfterReading: false
})
✔ Built-in type `address`
struct Wallet {
owner: address;
}
* integrated with auto-serialization, while still a slice under the hood
* comparable:
if (senderAddress == wallet.owner)* introspectable: isInternal(), getWorkchain(), etc.
✔ Some other features
Described in detail in the full changelog and mirrored in the documentation.
🌳 We're just a couple of steps away from Tolk v1.0 — with message sending and handling, gas optimizations, and one secret feature. There is still a lot of work ahead, but today we're closer to the release than ever before.
🔥 13
❤🔥 5
🎉 3
🤔 1
16 5.3K
Обсуждение 0
Обсуждение не доступно в веб-версии. Чтобы написать комментарий, перейдите в приложение Telegram.
Обсудить в Telegram