@@ -388,7 +388,7 @@ fun Cell<T>.beginParse(self): slice
388388
389389/// Returns hash of a typed cell, same as [cell.hash].
390390@pure
391- fun Cell<T>.hash(self): slice
391+ fun Cell<T>.hash(self): uint256
392392 asm "HASHCU";
393393
394394/// RemainingBitsAndRefs is a special built-in type to get "all the rest" slice tail on reading.
@@ -458,20 +458,20 @@ fun stringToBase256(constString: slice): int
458458/// Computes the representation hash of a `cell` and returns it as a 256-bit unsigned integer `x`.
459459/// Useful for signing and checking signatures of arbitrary entities represented by a tree of cells.
460460@pure
461- fun cell.hash(self): int
461+ fun cell.hash(self): uint256
462462 asm "HASHCU";
463463
464464/// Computes the hash of a `slice` and returns it as a 256-bit unsigned integer `x`.
465465/// The result is the same as if an ordinary cell containing only data and references from `s` had been created
466466/// and its hash computed by [cell.hash].
467467@pure
468- fun slice.hash(self): int
468+ fun slice.hash(self): uint256
469469 asm "HASHSU";
470470
471471/// Computes sha256 of the data bits of a `slice`. If the bit length of `s` is not divisible by eight,
472472/// throws a cell underflow exception. The hash value is returned as a 256-bit unsigned integer `x`.
473473@pure
474- fun slice.bitsHash(self): int
474+ fun slice.bitsHash(self): uint256
475475 asm "SHA256U";
476476
477477/// Checks the Ed25519-`signature` of a `hash` (a 256-bit unsigned integer, usually computed as the hash of some data)
@@ -1119,7 +1119,7 @@ struct (0x00) ExtOutLogBucket {
11191119
11201120/// Options for creating an external outgoing message.
11211121/// Consider [createExternalLogMessage] for examples.
1122- struct createExternalLogMessageOptions <TBody = never> {
1122+ struct CreateExternalLogMessageOptions <TBody = never> {
11231123 /// destination is either an external address or a pattern to calculate it
11241124 dest: address | // either some valid external/none address (not internal!)
11251125 builder | // ... or a manually constructed builder with a valid external address
@@ -1143,7 +1143,7 @@ struct createExternalLogMessageOptions<TBody = never> {
11431143/// (if body is small, it will be inlined without an expensive cell creation)
11441144/// (if body is large, the compiler will automatically wrap it into a cell)
11451145@pure
1146- fun createExternalLogMessage<TBody>(options: createExternalLogMessageOptions <TBody>): OutMessage
1146+ fun createExternalLogMessage<TBody>(options: CreateExternalLogMessageOptions <TBody>): OutMessage
11471147 builtin;
11481148
11491149/// UnsafeBodyNoRef is used to prevent default behavior: when message body is potentially large,
@@ -1157,13 +1157,13 @@ fun createExternalLogMessage<TBody>(options: createExternalLogMessageOptions<TBo
11571157/// createMessage({
11581158/// // body: contents, // by default, it will be stored a ref (it's large)
11591159/// body: UnsafeBodyNoRef {
1160- /// bodyForceNoRef : contents, // but wrapping forces the compiler to inline it
1160+ /// forceInline : contents, // but wrapping forces the compiler to inline it
11611161/// }
11621162/// ```
11631163/// Another example: your body contains `builder` or `RemainingBitsAndRefs`: unpredictable size.
11641164/// If you guarantee it's small and refs won't clash with code/data, avoid creating a cell.
11651165struct UnsafeBodyNoRef<T> {
1166- bodyForceNoRef : T;
1166+ forceInline : T;
11671167}
11681168
11691169/// OutMessage is a result of [createMessage].
@@ -1202,6 +1202,13 @@ struct StateInit {
12021202}
12031203
12041204/// Calculates a hash of StateInit if only code+data are set.
1205+ /// Example:
1206+ /// ```
1207+ /// val addrHash = StateInit.calcHashCodeData(codeCell, dataCell);
1208+ /// createMessage({
1209+ /// dest: (workchain, addrHash),
1210+ /// ...
1211+ /// ```
12051212@pure
12061213fun StateInit.calcHashCodeData(code: cell, data: cell): uint256 asm
12071214""" // code data
@@ -1304,23 +1311,41 @@ fun sendRawMessage(msg: cell, mode: int): void
13041311 Receiving and handling messages.
13051312*/
13061313
1314+ /// Skip 0xFFFFFFFF prefix (when a message is bounced).
1315+ @pure
1316+ fun slice.skipBouncedPrefix(mutate self): self
1317+ asm "32 LDU" "NIP";
1318+
13071319/// Load msgFlags from incoming message body (4 bits).
13081320@pure
1321+ @deprecated("use `onInternalMessage(in: InMessage)` and `in.isBounced` instead of parsing msgCell manually")
13091322fun slice.loadMessageFlags(mutate self): int
13101323 asm( -> 1 0) "4 LDU";
13111324
1312- /// Skip 0xFFFFFFFF prefix (when a message is bounced).
1313- @pure
1314- fun slice.skipBouncedPrefix(mutate self): self
1315- asm "32 PUSHINT" "SDSKIPFIRST";
1316-
1317- /// The guideline recommends to start the body of an internal message with uint32 `op` and uint64 `queryId`.
1325+ /// Loads a message opcode (32-bit integer) when parsing message body manually.
13181326@pure
13191327fun slice.loadMessageOp(mutate self): int
13201328 asm( -> 1 0) "32 LDU";
13211329
1322- /// The guideline recommends that uint64 `queryId` should follow uint32 `op`.
1330+ /// Stores a message opcode (32-bit integer) when composing an output message manually.
1331+ @pure
1332+ @deprecated("use `createMessage` instead of composing messages manually")
1333+ fun builder.storeMessageOp(mutate self, op: int): self
1334+ asm(op self) "32 STU";
1335+
1336+ /// Loads a message queryId (64-bit integer, immediately following the opcode) when parsing message body manually.
13231337@pure
1338+ @deprecated("use structures and lazy match instead of parsing messages manually")
13241339fun slice.loadMessageQueryId(mutate self): int
13251340 asm( -> 1 0) "64 LDU";
13261341
1342+ @pure
1343+ @deprecated("use structures and lazy loading instead of parsing messages manually")
1344+ fun slice.skipMessageQueryId(mutate self): self
1345+ asm "64 LDU" "NIP";
1346+
1347+ @pure
1348+ @deprecated("use `createMessage` instead of composing messages manually")
1349+ fun builder.storeMessageQueryId(mutate self, queryId: int): self
1350+ asm(queryId self) "64 STU";
1351+
0 commit comments