0

I'm fetching a listing number for an item listed on a marketplace contract and then formatting it to ethers BigNumber. I'm getting error:

invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)

I'm using router.isReady to make sure listing ID is fetched before running the command. What else could be the issue?

    useEffect(() => {
      if (router.isReady) {
        setListingIdFormatted(BigNumber.from(listingId.listingid));
        console.log(listingId.listingid);
      }
    }, [router.isReady]);

    // load direct listing
    useEffect(() => {
        async function listingEvents() {
          if (listingIdFormatted) { // Check if nft is defined
            const nft = await marketplace?.directListings.getListing(listingIdFormatted);
            setNft(nft);
          }
        }
        listingEvents();
      }, [listingIdFormatted]);

1 Answer 1

0

This error:


invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)

Means that you are calling an function that receives an argument but this argument is undefined. Review your code based on this information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.