getSetAuthorityInstructionDataDecoder function

Decoder<SetAuthorityInstructionData> getSetAuthorityInstructionDataDecoder()

Implementation

Decoder<SetAuthorityInstructionData> getSetAuthorityInstructionDataDecoder() {
  final structDecoder = getStructDecoder(<(String, Decoder<Object?>)>[
    ('discriminator', getU8Decoder()),
    ('authorityType', getAuthorityTypeDecoder()),
    ('newAuthority', getNullableDecoder<Address>(getAddressDecoder())),
  ]);

  return transformDecoder(
    structDecoder,
    (Map<String, Object?> map, Uint8List bytes, int offset) =>
        SetAuthorityInstructionData(
          discriminator: map['discriminator']! as int,
          authorityType: map['authorityType']! as AuthorityType,
          newAuthority: map['newAuthority'] as Address?,
        ),
  );
}