Floor in Mint.toTokenAmount

This commit is contained in:
Jackson Jessup 2022-12-05 09:15:31 -05:00
parent 6bdf86d343
commit b463733901
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,8 @@ export class Mint {
toTokenAmount(amount: number): bigint {
const big = new Big(amount);
const tokenAmount = big.mul(new Big(10).pow(this.mint.decimals));
return BigInt(tokenAmount.toString());
// We need to fix tokenAmount to 0 decimal places because the amount in base units must be an integer.
return BigInt(tokenAmount.toFixed(0));
}
toTokenAmountBN(amount: number): BN {