amountToBaseUnits

fun amountToBaseUnits(amount: String, decimals: Int): BigInteger

Converts a positive decimal amount string to its base-units value scaled by decimals decimal places.

Rejects scientific notation, empty or non-numeric strings, values less than or equal to zero, and values carrying more fractional digits than decimals allows.

Return

The base-units value as a BigInteger

Parameters

amount

Positive decimal amount string (e.g., "10", "100.5")

decimals

The token's decimal scale; must be in 0..MAX_TOKEN_DECIMALS. A value of 0 accepts only integer amounts.

Throws

if amount is invalid or decimals is out of range