SPLTokenProgram.uiAmountToAmount constructor

SPLTokenProgram.uiAmountToAmount({
  1. required SPLTokenUiAmountToAmountLayout layout,
  2. required SolAddress mint,
  3. SolAddress programId = SPLTokenProgramConst.tokenProgramId,
})

Convert a UiAmount of tokens to a little-endian u64 raw Amount, using the given mint. In this version of the program, the mint can only specify the number of decimals.

Implementation

factory SPLTokenProgram.uiAmountToAmount(
    {required SPLTokenUiAmountToAmountLayout layout,
    required SolAddress mint,
    SolAddress programId = SPLTokenProgramConst.tokenProgramId}) {
  return SPLTokenProgram(
      layout: layout, keys: [mint.toReadOnly()], programId: programId);
}