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)


review_contracts

evm_api.utils.review_contracts()

Review contracts as spam or not spam

Example

from moralis import evm_api

api_key = "YOUR_API_KEY"
params = {
    "chain": "eth", 
}
body = {
    "contracts": [{'contract_address': '0xa4991609c508b6d4fb7156426db0bd49fe298bd8', 'report_type': 'spam', 'contract_type': 'ERC20', 'reason': 'The contract contains shady code'}], 
}

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

print(result)

Parameters

Name Type Description Required Default Example
chain enum[str]:
- “eth”
- “0x1”
- “sepolia”
- “0xaa36a7”
- “polygon”
- “0x89”
- “bsc”
- “0x38”
- “bsc testnet”
- “0x61”
- “avalanche”
- “0xa86a”
- “fantom”
- “0xfa”
- “palm”
- “0x2a15c308d”
- “cronos”
- “0x19”
- “arbitrum”
- “0xa4b1”
- “chiliz”
- “0x15b38”
- “chiliz testnet”
- “0x15b32”
- “gnosis”
- “0x64”
- “gnosis testnet”
- “0x27d8”
- “base”
- “0x2105”
- “base sepolia”
- “0x14a34”
- “optimism”
- “0xa”
- “holesky”
- “0x4268”
- “polygon amoy”
- “0x13882”
- “linea”
- “0xe708”
- “moonbeam”
- “0x504”
- “moonriver”
- “0x505”
- “moonbase”
- “0x507”
- “linea sepolia”
- “0xe705”
The chain to query   “eth” “eth”

Body

Object with the properties:

Name Type Description Required Default Example
contracts List of object:
- contract_address: str
- reason: str
- report_type: enum[str]:
- “spam”
- “not_spam”
- contract_type: enum[str]:
- “ERC20”
- “NFT”
The contracts to be reported Yes   [{‘contract_address’: ‘0xa4991609c508b6d4fb7156426db0bd49fe298bd8’, ‘report_type’: ‘spam’, ‘contract_type’: ‘ERC20’, ‘reason’: ‘The contract contains shady code’}]

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”
- “sepolia”
- “0xaa36a7”
- “polygon”
- “0x89”
- “bsc”
- “0x38”
- “bsc testnet”
- “0x61”
- “avalanche”
- “0xa86a”
- “fantom”
- “0xfa”
- “palm”
- “0x2a15c308d”
- “cronos”
- “0x19”
- “arbitrum”
- “0xa4b1”
- “chiliz”
- “0x15b38”
- “chiliz testnet”
- “0x15b32”
- “gnosis”
- “0x64”
- “gnosis testnet”
- “0x27d8”
- “base”
- “0x2105”
- “base sepolia”
- “0x14a34”
- “optimism”
- “0xa”
- “holesky”
- “0x4268”
- “polygon amoy”
- “0x13882”
- “linea”
- “0xe708”
- “moonbeam”
- “0x504”
- “moonriver”
- “0x505”
- “moonbase”
- “0x507”
- “linea sepolia”
- “0xe705”
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)