dabit3 / polygon-ethereum-nextjs-marketplace

A full stack digital marketplace running on Ethereum with Polygon & Next.js
MIT License
1.3k stars 878 forks source link

Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.5.0) #39

Open jorgehenriquezd opened 2 years ago

jorgehenriquezd commented 2 years ago

When i click buy nft I got this error, what can I do?

appleyapple commented 2 years ago

also encountered this problem, it works fine in testing but once I try it on the app it gives this error.

it seems to come from these lines const price = ethers.utils.parseUnits(nft.price.toString(), 'ether') const transaction = await contract.createMarketSale(nftaddress, nft.itemId, {value: price})

price constant prints as expected: BigNumber {_hex: '0x29a2241af62c0000', _isBigNumber: true} _hex: "0x29a2241af62c0000" _isBigNumber: true

if relevant I am on ethers 5.5.4, ipfs-http-client 50.1.2, web3modal 1.9.5, hardhat 2.8.4

p0sidonz commented 2 years ago

same here, did you figure that out yet?

jamesbayy commented 2 years ago

I have the same problem ..

jamesbayy commented 2 years ago

now,i solved the problem.the nft.tokenid need to match the item tokenid const transaction = await contract.createMarketSale(nftaddress,nft.tokenid, { value: price }) let item = { price, tokenid:i.tokenid.toNumber(), seller: i.seller, owner: i.owner, image: meta.data.image, name: meta.data.name, description: meta.data.description }

if there is nft.tokenId. tokenId is undefined .

DannyIscra commented 2 years ago

Having the same issue but with the new code.

I believe it is coming from this section:

Error: invalid decimal value (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.6.2)

Here is the code for that section:

const price = ethers.utils.parseUnits(formInput.price, 'ether') let contract = new ethers.Contract(marketplaceAddress, NFTMarketplace.abi, signer) let listingPrice = await contract.getListingPrice()

listingPrice = listingPrice.toString()
let transaction = await contract.createToken(url, price, { value: listingPrice })

await transaction.wait()

No coding experience, can anyone step by step come up with a solution as to why this may be?

Banksy-said-hi commented 1 year ago

I am having the same issue!