I meant image
could be a type like string, number, etc. Not the actual any
type. Why do you need to change this use of Image
or are you talking about something else?
Found the error . . .
it’s called image_url and not just image (Y)
So that works now . . .
I’m getting this error: Expected 1-2 arguments, but got 3.
I can’t find what that means in documents . . . Is it defined somewhere that params should only be 2 instances and not the 3 I’m asking for?
That should be axios.post
, not axios.get
. Also depending on axios
version, you may need capital letters - Content-Type
instead of content-type
.
Is something down with the API?
Upon launching my DApp it now throws a 500 error . . . .
Didn’t change anything since it worked saturday . . .
Should that affect my ability to connect to metamask at all (From the DApp - Not in general)
No, that should not affect authentication. Can you create a new topic in forum with more details on the error which you are receiving
hi everyone! just started using the boilerplate and it seems great but when trying to connect my wallet on localhost, it throws an error “request failed with status code 500”
Hey @heyhey,
thanks for reaching out and hope you had a great day~
can you check the console or network tab what error message that you get from trying to connect the wallet? I suspect it has something to do with the Auth API
Hi @heyhey,
Can you remove # replace for production text
from the env variable and try again?
hi, thanks for your help it works now!
So i was trying to make a call to a contract on the mumbai testnet, not sure why i’m getting this as i can connect wallet and access erc20 or NFT data using moralis api
didn’t touch this part either
env should be correctly setup?
Hi @heyhey
It seems like you are using Morlais runContractFunction in your frontend react client component.
However, the API key that is set using the MoralisNextApi
is only accessible on next js server component.
Try using the useEvmRunContractFunction()
hook from @moralisweb3.next
package. That should work.
Here is an example code
const { fetch, data } = useEvmRunContractFunction();
useEffect(() => {
data && console.log(data);
}, [data]);
//...
// Call the fetch function through a button click or through a function.
<button
onClick={async () => {
const data = await fetch({
abi: [
{
inputs: [],
name: "getPrice",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
],
address: "0x1A92f7381B9F03921564a437210bB9396471050C",
functionName: "getPrice",
chain: 1,
});
console.log(data);
}}
>
fetch contract data
</button>
what i’m trying to do is call a function from the smart contract to write data to it, it seems like useEvmRunContractFunction()
is for read only. any suggestions?
Hi @heyhey
The API only supports calling read-only contract functions. For calling the write function I would recommend using web3.js or ether.js directly as it requires interaction with the wallet. You can also use other libraries like wagmi which uses ether.js internally and provides react hooks to call smart contract functions. You can find more about it here.
I hope this helps😃
How do i change the logo and displayed tab name? i don’t want ‘boilerplate’ in the tab name
I would also like to change the logo in the nav bar
Hello all,
This might be a total newbie question, but I am completely new to programming, Next.js and Moralis. Trying to learn.
I successfully installed the boilerplate and everything seems to be working fine. Because the boilerplate automatically runs Moralis I thought that I can now use Moralis where I have previously used ethers to connect to my smart contract.
In my old code I had
const { ethers } = require(“ethers”);
export async function displayContract() {
const contractAddress = “…”
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const deal = new ethers.Contract(contractAddress, Abi, signer);
}
And I was expecting that I could now replace this bit by:
import { useMoralis, useMoralisWeb3Api, useMoralisWeb3 } from “@moralis/next”;
export async function displayContract() {
const { Moralis, web3 } = useMoralis();
const { accounts } = useWeb3();
const contractAddress = “…”
const deal = useWeb3Contract(contractAddress, Abi);
}
However, this doesn’t work… at least not out of the box. I’ve tried react-moralis too. What should I do to get the moralis functionality in the ethereum-boilerplate?
Thank you for helping a newcomer