SPLTokenSwapSwapLayout.fromBuffer constructor

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

Constructs a SPLTokenSwapSwapLayout instance from the given byte array.

Implementation

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

  return SPLTokenSwapSwapLayout(
    amountIn: decode["amountIn"],
    minimumAmountOut: decode["minimumAmountOut"],
  );
}