decodeAndValidateStruct static method
Decodes and validates Borsh serialized bytes.
layout
: The layout representing the structure of the program.bytes
: The bytes to decode.instruction
(optional): The expected instruction index.discriminator
(optional): The expected discriminator.
Implementation
static Map<String, dynamic> decodeAndValidateStruct({
required StructLayout layout,
required List<int> bytes,
required List<int> instruction,
}) {
return LayoutSerializable.decode(
bytes: bytes, layout: layout, validator: {"instruction": instruction});
}