Skip to main content

Run contract function

POSThttps://deep-index.moralis.io/api/v2/:address/function

Run a given function of a contract ABI and retrieve readonly data. Try it with Swagger.

PATH PARAMS
addressstringrequired
The address of the contract
QUERY PARAMS
chainstring
The chain to query
function_namestringrequired
The function name of the contract
BODY PARAM
abiarray
The contract ABI
paramsjson
The params for the given function
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.utils.runContractFunction({
"chain": "0x1"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
Empty