SPLTokenSwapWithdrawSingleTokenLayout.fromBuffer constructor

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

Constructs a SPLTokenSwapWithdrawSingleTokenLayout instance from the given byte array.

Implementation

factory SPLTokenSwapWithdrawSingleTokenLayout.fromBuffer(List<int> bytes) {
  final decode = ProgramLayout.decodeAndValidateStruct(
    layout: _layout,
    bytes: bytes,
    instruction:
        SPLTokenSwapProgramInstruction.withdrawSingleToken.insturction,
  );

  return SPLTokenSwapWithdrawSingleTokenLayout(
    destinationTokenAmount: decode["destinationTokenAmount"],
    maximumPoolTokenAmount: decode["maximumPoolTokenAmount"],
  );
}