'i am trying to pass userbalance to another function

 const WENLAMBOAddress = "myaddress"; //token to migrate 
 const BALANCEInterface = [ "function balanceOf(address account) public view override returns 
 (uint256)", // balance contract function ];
 const balanceFunction = async () => {
 await ethereum.request({ method: "eth_requestAccounts" });
 await ethereum.request({
  method: "wallet_switchEthereumChain",
  params: [{ chainId: "0x61" }],
});
provider = new ethers.providers.Web3Provider(window.ethereum);
signer = provider.getSigner();
signerAddress = await signer.getAddress();
BALANCEContract = await new ethers.Contract(
  WENLAMBOAddress,
  BALANCEInterface,
);
};
balanceFunction();

async function readBalance(signerAddress) {
BALANCEContract.balanceOf(signerAddress)
}  
let balance = readBalance()

async function migration() {
MIGRATIONContract.migrateToV2(balance);
}

as you can see i am trying to pass the balance to the other function but i get the following error message:

index.js:228 Uncaught (in promise) Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.5.0)

any suggestion?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source