dabit3 / polygon-ethereum-nextjs-marketplace

A full stack digital marketplace running on Ethereum with Polygon & Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jorgehenriquezd opened this issue · comments

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

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

same here, did you figure that out yet?

I have the same problem ..

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 .

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?

I am having the same issue!