chain

Generic Smart Contract Method

Executes read-only (view) functions on verified smart contracts, enabling queries like token balances or exchange rates without gas costs. The result includes on-chain data returned by the invoked function, facilitating up-to-date insights for decentralized applications.

💡 Compute Unit Value: 40 (Fixed)

post/defi/v1/chain/genericsmartcontractmethod

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/chain/genericsmartcontractmethod
  • Auth
    API key in header X-API-Key

Request body

chainId'1' | '56' | '43114' | '42161' | '10' | '324' | '137' | '8453'

The unique ID to direct queries or transactions to the correct blockchain. Find more here.

chainSymbolstring

The abbreviated chain name for queries or transactions.

contractAddressstring required

The address of the smart contract to perform the read operation on.

parametersstring

Array of parameters to pass to the read function.

abi''

ABI of the smart contract if unverified.

methodNamestring required

Name of the read function to be executed.

blockNumberstring

The block number to perform the query on. Defaults to the latest block.

Example request

{
  "chainId": "1",
  "chainSymbol": "ETH",
  "contractAddress": "0xfad57d2039c21811c8f2b5d5b65308aa99d31559",
  "parameters": "4515444785",
  "abi": "",
  "methodName": "getAmountsIn",
  "blockNumber": "100000"
}

Response

Successful response

statusinteger
msgstring
dataobject

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "getAmountsIn": [
      "2425265",
      "4515444785"
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.