I want the amount of tokens to be a decimal number. but i heard that toBn is not supported decimals number.
When I put in a decimal number, I faced the following error: while converting number 0.15 to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance
How can I send a decimals amount of tokens to my wallet? I am a beginner and save me. plz help!
i used code:
const val = 0.15; // this guy
let decimals = web3.utils.toBN(info.decimal);
let amount = web3.utils.toHex(web3.utils.toBN(val).mul(web3.utils.toBN(10).pow(decimals)));
BN
supports only integer values! – goodvibration Aug 21 '19 at 11:03