SPLTokenReallocateLayout.fromBuffer constructor

SPLTokenReallocateLayout.fromBuffer(
  1. List<int> bytes
)

Constructs an SPLTokenReallocateLayout instance from buffer.

Implementation

factory SPLTokenReallocateLayout.fromBuffer(List<int> bytes) {
  final length = (bytes.length - 1) ~/ 2;
  final decode = ProgramLayout.decodeAndValidateStruct(
      layout: _layout(length: length),
      bytes: bytes,
      instruction: SPLTokenProgramInstruction.reallocate.insturction);

  return SPLTokenReallocateLayout(
      extensionTypes: (decode["extensionTypes"] as List)
          .map((e) => ExtensionType.fromValue(e))
          .toList());
}