Read a contract
Endpoint that allows you to read contract functions.
This function is only available for EVM-based chains.
Request Endpoint: reference
This endpoint allows you to read contract functions. This function is only available for EVM-based chains.
HTTP
POST /api/contracts/read
secretType
Body
On which blockchain the contract exists
String
✅
contractAddress
Body
The contract address that you want to read
String
✅
functionName
Body
The contract function that you want to call
String
✅
inputs
Body
TArray of inputs needed to call the function
Array
✅
inputs.type
Body
Type of the input parameter (ex. uint256)
String
✅
inputs.value
Body
Value of the input parameter. This needs to be passed as a string value
Object
✅
outputs
Body
An array of expected outputs
Array
✅
outputs.type
Body
Type of output
String
✅
Examples
1. Get balance of
This example will get the balance of a certain NFT for a specific wallet.
HTTP
POST https://api-wallet.venly.io/api/contracts/read
Request Body:
JSON
{
"secretType": "MATIC",
"walletAddress": "0x0000000000000000000000000000000000000000",
"contractAddress": "0xE80F3baA739c18fd4eBf97716529a4b85BE464Dd",
"functionName": "balanceOf",
"inputs": [
{
"type": "address",
"value": "0x427d0addaa77d8bb871dbea3458dea4b5198730c"
},
{
"type": "uint256",
"value": "202"
}
],
"outputs": [
{
"type": "uint256"
}
]
}
Response Body:
JSON
{
"success": true,
"result": [
{
"type": "uint256",
"value": 1
}
]
}
2. Get Mint Number
This example will get the mint number for a specific NFT.
HTTP
POST https://api-wallet.venly.io/api/contracts/read
Request Body:
JSON
{
"secretType": "MATIC",
"walletAddress": "0x0000000000000000000000000000000000000000",
"contractAddress": "0xf86013ac3a23d26efb3337b4d63de6e6ec2a9861",
"functionName": "mintNumber",
"inputs": [
{
"type": "uint256",
"value": "51"
}
],
"outputs": [
{
"type": "uint256"
}
]
}
Response Body:
JSON
{
"success": true,
"result": [
{
"type": "uint256",
"value": 2
}
]
}
3. Get Contract URI
This example will fetch the contract URI, which contains the metadata, for a specific contract.
HTTP
POST https://api-wallet.venly.io/api/contracts/read
Request Body:
JSON
{
"secretType": "MATIC",
"walletAddress": "0x0000000000000000000000000000000000000000",
"contractAddress": "0x8c53de6a889cf0a3151168c3e84263c982d09a2f",
"functionName": "contractURI",
"outputs": [
{
"type": "string"
}
]
}
Response Body:
JSON
{
"success": true,
"result": [
{
"type": "string",
"value": "https://metadata.arkane.network/api/apps/0ed3a778-4f11-4cdf-b3cc-45f3225a9065/contracts/76/metadata"
}
]
}
Last updated