I’ve been working on nftMarketplace. But every time I try to buy an nft it gives out the error.
I’m using react-moralis and its hooks to integrate the buying functionality.
Here is how I implemented my useWeb3Contract() hook to call buyItems function on marketplace.
const { runContractFunction: buyItem } = useWeb3Contract({
abi: NftMarketPlaceABI,
contractAddress: marketplaceAddress,
functionName: 'buyItem',
msgValue: price,
params: {
nftAddress: nftAddress,
tokenId: tokenId,
amount: 1,
},
});
Is this some issue with how I’m implementing the hook or something else. Because my wallet is connected to the front end while this function is called.