Moralis-Python-SDK

utils API:

evm_api.utils


endpoint_weights

evm_api.utils.endpoint_weights()

Get the cost and rate limit for each API endpoint.

Example

from moralis import evm_api

api_key = "YOUR_API_KEY"

result = evm_api.utils.endpoint_weights(
    api_key=api_key,
)

print(result)


run_contract_function

evm_api.utils.run_contract_function()

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

Example

from moralis import evm_api

api_key = "YOUR_API_KEY"
params = {
    "address": "", 
    "function_name": "", 
    "chain": "eth", 
}
body = {
    "abi": [], 
    "params": {}, 
}

result = evm_api.utils.run_contract_function(
    api_key=api_key,
    params=params,
    body=body,
)

print(result)

Parameters

Name Type Description Required Default Example
address str The address of the contract Yes   ””
function_name str The function name of the contract Yes   ””
chain enum[str]:
- “eth”
- “0x1”
- “goerli”
- “0x5”
- “sepolia”
- “0xaa36a7”
- “polygon”
- “0x89”
- “mumbai”
- “0x13881”
- “bsc”
- “0x38”
- “bsc testnet”
- “0x61”
- “avalanche”
- “0xa86a”
- “avalanche testnet”
- “0xa869”
- “fantom”
- “0xfa”
- “palm”
- “0x2a15c308d”
- “cronos”
- “0x19”
- “cronos testnet”
- “0x152”
- “arbitrum”
- “0xa4b1”
The chain to query   “eth” “eth”

Body

Object with the properties:

Name Type Description Required Default Example
abi List of object The contract ABI Yes   []
params object The params for the given function Yes   {}

web3_api_version

evm_api.utils.web3_api_version()

Get the current version of the Moralis Web3 API.

Example

from moralis import evm_api

api_key = "YOUR_API_KEY"

result = evm_api.utils.web3_api_version(
    api_key=api_key,
)

print(result)