-
this is the part when I am asking Moralis SDK to ask make the transaction with metamask const { runContractFunction: updateListing } = useWeb3Contract({
abi: nftMarketplaceAbi,
contractAddress: marketplaceAddress,
functionName: "updateListing",
params: {
nftAddress: nftAddress,
tokenId: tokenId,
newPrice: ethers.utils.parseEther(priceToUpdateListingWith || "0"),
},
}) when metamask popup appears it shows error in "Data" tab when I click on "Confirm" button, the transaction failed. this error appears on hardhat node console
I am sure that I spell the name of the function correct function updateListing(
address nftAddress,
uint256 tokenId,
uint256 newPrice
) external isListed(nftAddress, tokenId) isOwner(nftAddress, tokenId, msg.sender) {
s_listings[nftAddress][tokenId].price = newPrice;
emit ItemListed(msg.sender, nftAddress, tokenId, newPrice);
} I tried to explicitly write chainId const { runContractFunction: updateListing } = useWeb3Contract({
chainId:31337,
abi: nftMarketplaceAbi,
contractAddress: marketplaceAddress,
functionName: "updateListing",
params: {
nftAddress: nftAddress,
tokenId: tokenId,
newPrice: ethers.utils.parseEther(priceToUpdateListingWith || "0"),
},
}) Code on Githubhttps://github.com/abdoMous/hardhat-nft-marketplace-fcc |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Push to GitHub; I will look into it. |
Beta Was this translation helpful? Give feedback.
-
The problem is solved by changing Chain ID on MetaMask |
Beta Was this translation helpful? Give feedback.
The problem is solved by changing Chain ID on MetaMask
https://stackoverflow.com/a/73195229/1232368