Call read-only function
Calls a read-only public function on a given smart contract.
Path Parameters
contract_addressstring
Stacks address
contract_namestring
Contract name
function_namestring
Function name
Query Parameters
tip?string
The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).
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.
senderstring
The simulated tx-sender
argumentsarray<string>
An array of hex serialized Clarity values
Response Body
curl -X POST "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string" \
-H "Content-Type: application/json" \
-d '{
"sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
"arguments": [
"0x0011...",
"0x00231..."
]
}'
const body = JSON.stringify({
"sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
"arguments": [
"0x0011...",
"0x00231..."
]
})
fetch("http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string"
body := strings.NewReader(`{
"sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
"arguments": [
"0x0011...",
"0x00231..."
]
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string"
body = {
"sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
"arguments": [
"0x0011...",
"0x00231..."
]
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)
{
"okay": true,
"result": "0x111..."
}