Iโm trying to transfer an amount of a BEP20 token (testnet), but I keep getting this error:
*This only happens in production, works perfectly fine on localhost
Error: invalid BigNumber value (argument="value", value="50000000000000000000", code=INVALID_ARGUMENT, version=bignumber/5.5.0)
at h.makeError (_app-ca0a8f82dab99437.js:1:267207)
at h.throwError (_app-ca0a8f82dab99437.js:1:267327)
at h.throwArgumentError (_app-ca0a8f82dab99437.js:1:267382)
at Function.from (_app-ca0a8f82dab99437.js:1:215435)
at N.encode (_app-ca0a8f82dab99437.js:1:206057)
at _app-ca0a8f82dab99437.js:1:203470
at Array.forEach (<anonymous>)
at A (_app-ca0a8f82dab99437.js:1:203340)
at W.encode (_app-ca0a8f82dab99437.js:1:209030)
at J.encode (_app-ca0a8f82dab99437.js:1:210407)
Code:
const options = {
type: "erc20",
amount: Moralis.Units.Token(value, 18),
receiver: process.env.NEXT_PUBLIC_WALLET_ADDRESS,
contractAddress: process.env.NEXT_PUBLIC_CONTRACT_ADDRESS,
};
const transaction = await (Moralis as any).transfer(options);
const transactionResult = await transaction.wait();