Skip to main content
Version: 2.0

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.

DEPRECATED ENDPOINT
This API will be deprecated on 4th September 2023. Please subscribe to the Changelog page for further announcements.
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
No items in the array
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