toApt static method

BigInt toApt(
  1. String aptos
)

Converts a string representing an Aptos amount to a BigInt in the smallest unit. This method multiplies the value by the scaling factor (10^8) to handle decimal precision.

Implementation

static BigInt toApt(String aptos) {
  try {
    final parse = BigRational.parseDecimal(aptos);
    return (parse * _decimal).toBigInt();
  } catch (e) {
    throw DartAptosPluginException("Invalid aptos amount provided.",
        details: {"amount": aptos});
  }
}