message_formatter

val message_formatter: (gtv) -> text? = null(source)

A function that receives the the arguments of the operation and returns a message that should be signed if the signer that is authorizing is an EVM signer.

This text will thus appear on the EVM wallet of the user to approve the operation.

If null, a default message will be created by generate_operation_auth_message. It is suggested to only use the default messages in development environments.

An example function that could be used as a message formatter is:

operation send_chroma_tokens (amount: big_integer, account) { ... }

function message_formatter_for_send_chroma_tokens (gtv) {
val params = struct<send_chroma_tokens>.from_gtv(gtv);
return "Do you want to send %s CHR to account %s?".format(
params.amount,
params.account
);
}

The function can be as complex or simple as needed, and it can as well make no use of the gtv parameters by returning a default message in all cases - the message will have a nonce that prevents replay attacks.