Language
Reference
Message modes

Message modes

As you might've noticed, we send messages with mode param. To figure out the mode that best suits your needs, take a look at the following table:

NameModeDescription
SendPayGasSeparately1Pay transfer fees separately from the message value
SendIgnoreErrors2Ignore any errors arising while processing this message during the action phase
SendDestroyIfZero32Current account must be destroyed if its resulting balance is zero (often used with Mode 128)
SendRemainingValue64Carry all the remaining value of the inbound message in addition to the value initially indicated in the new message
SendRemainingBalance128Carry all the remaining balance of the current smart contract instead of the value originally indicated in the message

Combining modes

You can also join modes with flags (modes: 1, 2, 32) in one message, for example:

let to: Address = ...;
let value: Int = ton("1");
send(SendParameters{
    to: to,
    value: value,
    mode: SendRemainingValue + SendIgnoreErrors,
    bounce: true,
    body: "Hello, World!".asComment()
});

What to read next?

This article was inspired by the following materials: