encode_message method
Allows to encode deploy and function call messages, both signed and unsigned.
Use cases include messages of any possible type:
- deploy with initial function call (i.e.
constructoror any other function that is used for some kind of initialization); - deploy without initial function call;
- signed/unsigned + data for signing.
Signer defines how the message should or shouldn't be signed:
Signer::None creates an unsigned message. This may be needed in case of some public methods,
that do not require authorization by pubkey.
Signer::External takes public key and returns data_to_sign for later signing.
Use attach_signature method with the result signature to get the signed message.
Signer::Keys creates a signed message with provided key pair.
SOON Signer::SigningBox Allows using a special interface to implement signing
without private key disclosure to SDK. For instance, in case of using a cold wallet or HSM,
when application calls some API to sign data.
There is an optional public key can be provided in deploy set in order to substitute one in TVM file.
Public key resolving priority:
- Public key from deploy set.
- Public key, specified in TVM file.
- Public key, provided by signer.
Implementation
Future<ResultOfEncodeMessage> encode_message(
ParamsOfEncodeMessage params) async {
final res =
await _tonCore.request('abi.encode_message', params.toString());
return ResultOfEncodeMessage.fromMap(res);
}