Get contract interface
Retrieves a list of functions, variables, maps, fungible tokens and non-fungible tokens for a given smart contract.
Path Parameters
contract_addressstring
Stacks address
contract_namestring
Contract 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).
Response Body
curl -X GET "http://localhost:20443/v2/contracts/interface/string/string?tip=string"
fetch("http://localhost:20443/v2/contracts/interface/string/string?tip=string")
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "http://localhost:20443/v2/contracts/interface/string/string?tip=string"
req, _ := http.NewRequest("GET", url, nil)
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/interface/string/string?tip=string"
response = requests.request("GET", url)
print(response.text)
{
"functions": [
{
"name": "get-value",
"access": "public",
"args": [
{
"name": "key",
"type": {
"buffer": {
"length": 32
}
}
}
],
"outputs": {
"type": {
"response": {
"ok": {
"buffer": {
"length": 32
}
},
"error": "int128"
}
}
}
},
{
"name": "set-value",
"access": "public",
"args": [
{
"name": "key",
"type": {
"buffer": {
"length": 32
}
}
},
{
"name": "value",
"type": {
"buffer": {
"length": 32
}
}
}
],
"outputs": {
"type": {
"response": {
"ok": "uint128",
"error": "none"
}
}
}
},
{
"name": "test-emit-event",
"access": "public",
"args": [],
"outputs": {
"type": {
"response": {
"ok": "uint128",
"error": "none"
}
}
}
},
{
"name": "test-event-types",
"access": "public",
"args": [],
"outputs": {
"type": {
"response": {
"ok": "uint128",
"error": "none"
}
}
}
}
],
"variables": [
{
"name": "recipient",
"type": "principal",
"access": "constant"
},
{
"name": "sender",
"type": "principal",
"access": "constant"
}
],
"maps": [
{
"name": "store",
"key": [
{
"name": "key",
"type": {
"buffer": {
"length": 32
}
}
}
],
"value": [
{
"name": "value",
"type": {
"buffer": {
"length": 32
}
}
}
]
}
],
"fungible_tokens": [
{
"name": "novel-token-19"
}
],
"non_fungible_tokens": [
{
"name": "hello-nft",
"type": "uint128"
}
]
}