Smart Contract API

Endpoint Overview

TokenInfo.AI provides endpoints for retrieving the source code of a smart contract and auditing the smart contract. These endpoints are essential for developers and security auditors who want to verify and ensure the integrity of smart contracts deployed on various blockchain networks.

Endpoints

  1. Retrieve Contract Source Code

  2. Audit Smart Contract

Retrieve Contract Source Code

Endpoint

GET/contract/:chain/:address/source

Request Parameters

Parameters

  • address:

    • Type: String

    • Description: The address of the smart contract. This parameter is required.

  • chain:

    • Type: Number (optional)

    • Description: The network chain on which the smart contract is deployed. Defaults to 1 (Ethereum) if not provided. Use 900 for Solana.

Request Example

Here is an example of how to structure the request:

Response

The response from the endpoint will vary depending on the success or failure of the request.

Success Response

  • Status Code: 200 OK

  • Response Body:

Error Responses

  1. Missing Parameters

    • Status Code: 400 Bad Request

    • Response Body:

  2. Unsupported Chain

    • Status Code: 400 Bad Request

    • Response Body:

  3. Source Code Not Found

    • Status Code: 404 Not Found

    • Response Body:

  4. Internal Server Error

    • Status Code: 500 Internal Server Error

    • Response Body:

Audit Smart Contract

Endpoint

POST /contract/audit

Request Parameters

Body Parameters

  • sourceCode:

    • Type: String

    • Description: The source code of the smart contract. This parameter is required.

Request Example

Here is an example of how to structure the request:

Response

The response from the endpoint will vary depending on the success or failure of the request.

Success Response

  • Status Code: 200 OK

  • Response Body:

Error Responses

  1. Missing Parameters

    • Status Code: 400 Bad Request

    • Response Body:

  2. Internal Server Error

    • Status Code: 500 Internal Server Error

    • Response Body:

By utilizing the Contract Management Endpoints, developers and auditors can efficiently retrieve the source code of deployed smart contracts and perform audits to ensure their security and integrity within the TokenInfo.AI platform.

Last updated