Calling contract function using HttpProvider

Hi,
I want to call a read-only function from my smart contract. Based on official docs, I have to do something like this:

await Moralis.enableWeb3();
const message = await Moralis.executeFunction({
contractAddress: "0xe...56",
functionName: "message",
abi: ABI
})

Running this code will popup Metamask and request for connecting Metamask to my website. But I don’t want to use Metamask, I want to use other node-providers (infura, alchemy, …) for calling my smart contract function.

Question: How can I use HttpProvider (exp: https://mainnet.infura.io/v3/*****) for calling smart contract function?

hi, you don’t have to use metamask for a read only function, you can use runContractFunction
https://docs.moralis.io/moralis-dapp/web3-api/native#runcontractfunction

1 Like

:+1: :+1: :pray: :pray: