I keep encountering this specific error on Hardhat. Each time I attempt to convert any BigInt to a number using .toNumber(), I consistently receive the error stating that toNumber() is not a function.

Jan 5, 2024, 9:38 AM
if you need it as Number, you can cast it directly
Number(var)
but by default you should be fine with BigInt with the newer version of hardhat
describe("Convert bigInt to Number", function () {
it(`Should convert to Number`, async function(){
const bigNumbah = BigInt(1);
const number = Number(bigNumbah);
expect(number).to.equal(1);
})
});
Jan 5, 2024, 10:38 AM
Thanks
I did bypass this
I was working on lottery contract, while I was creating the deploy.js script I didn’t add consumer to the script before deploying
Thanks
Jan 5, 2024, 6:05 PM

© 2024 Draquery.com All rights reserved.