Call read-only function
Calls a read-only public function on a given smart contract.
POST
/v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}
Call read-only function
Call a read-only public function on a given smart contract.
The smart contract and function are specified using the URL path. The arguments and the simulated tx-sender are supplied via the POST body in the following JSON format:
Request Body
map of arguments and the simulated tx-sender where sender is either a Contract identifier or a normal Stacks address, and arguments is an array of hex serialized Clarity values.
sender
Requiredstring
The simulated tx-sender
arguments
Requiredarray<string>
An array of hex serialized Clarity values
Path Parameters
contract_address
Requiredstring
Stacks address
Example:"SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335"
contract_name
Requiredstring
Contract name
Example:"mega"
function_name
Requiredstring
Function name
Example:"get-balance"
Query Parameters
tip
string
The Stacks chain tip to query from
Status code | Description |
---|---|
200 | Success |
curl -X POST "https://api.hiro.so/v2/contracts/call-read/SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335/mega/get-balance" \
-H "Content-Type: application/json" \
-d '{
"sender": "SP187Y7NRSG3T9Z9WTSWNEN3XRV1YSJWS81C7JKV7",
"arguments": [
"0x0516da6b6c4a62ece9fa5a652278baa014ec83df3644"
]
}'
GET request to get contract source
{
"okay": true,
"result": "string",
"cause": "string"
}