Decode Messages(Event)

How to decode messages with ABI

SDK can decode ABI-compatible External Inbound, External Outbound and Internal messages.

Types of messages

ABI-compatible contracts generate abi-compatible messages, or, to be exact, abi-compatible message bodies :)

So, if you have ABI on hands, you can decode these messages.

You can use both full message boc for decoding and only message body for decoding.

Let's decode!

Core SDK provides

  • decode_message method for full boc of message decoding

  • decode_message_body method for only message body decoding.


const decoded = (await client.abi.decode_message({
        abi: abiContract(HelloEventsContract.abi),
        message: boc,
switch (decoded.body_type) {
case MessageBodyType.Input:
    log_.push(`External inbound message, function "${}", fields: ${JSON.stringify(decoded.value)}` );
case MessageBodyType.Output:
    log_.push(`External outbound message (return) of function "${}", fields: ${JSON.stringify(decoded.value)}`);
case MessageBodyType.Event:
    log_.push(`External outbound message (event) "${}", fields: ${JSON.stringify(decoded.value)}`);

Sample source code



Last updated