SPLTokenProgram.amountToUiAmount constructor

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

Convert an Amount of tokens to a UiAmount string, using the given mint. In this version of the program, the mint can only specify the number of decimals.

Implementation

factory SPLTokenProgram.amountToUiAmount(
    {required SPLTokenAmountToUiAmountLayout layout,

    /// The mint to calculate for
    required SolAddress mint,
    SolAddress programId = SPLTokenProgramConst.tokenProgramId}) {
  return SPLTokenProgram(
      layout: layout, keys: [mint.toReadOnly()], programId: programId);
}