Skip to content

Commit ccf60f1

Browse files
committed
docs: add get_clarity_mark_value and get_clarity_metadata documentation
1 parent 931f315 commit ccf60f1

File tree

6 files changed

+156
-3
lines changed

6 files changed

+156
-3
lines changed

docs/rpc-endpoints.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,35 @@ Where data is the hex serialization of the variable value.
172172
This endpoint also accepts a querystring parameter `?proof=` which when supplied `0`, will return the
173173
JSON object _without_ the `proof` field.
174174

175+
### GET /v2/clarity_marf_value/[Clarity MARF Key]
176+
Attempt to fetch the value of a MARF key. The key is identified with [Clarity MARF Key].
177+
178+
Returns JSON data in the form:
179+
180+
```json
181+
{
182+
"data": "0x01ce...",
183+
"proof": "0x01ab...",
184+
}
185+
```
186+
187+
Where data is the hex serialization of the value.
188+
189+
### GET /v2/clarity_metadata/[Stacks Address]/[Contract Name]/[Clarity Metadata Key]
190+
Attempt to fetch the metadata of a contract.
191+
The contract is identified with [Stacks Address] and [Contract Name] in the URL path.
192+
The metadata key is identified with [Clarity Metadata Key].
193+
194+
Returns JSON data in the form:
195+
196+
```json
197+
{
198+
"data": "'{\"contract_identifier\":{...}'",
199+
}
200+
```
201+
202+
Where data is the metadata formatted as a JSON string.
203+
175204
### GET /v2/constant_val/[Stacks Address]/[Contract Name]/[Constant Name]
176205
Attempt to fetch a constant from a contract. The contract is identified with [Stacks Address] and
177206
[Contract Name] in the URL path. The constant is identified with [Constant Name].
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"data": "0x0a0c000000010a6d6f6e737465722d69640100000000000000000000000000000001",
3+
"proof": "0x123..."
4+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "Response of get Clarity MARF value request",
4+
"title": "ClarityMARFValueResponse",
5+
"type": "object",
6+
"required": ["data"],
7+
"properties": {
8+
"data": {
9+
"type": "string",
10+
"description": "Hex-encoded string"
11+
},
12+
"proof": {
13+
"type": "string",
14+
"description": "Hex-encoded string of the MARF proof for the data"
15+
}
16+
}
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"data": "'{\"contract_identifier\":{...}, \"private_function_types\":{...}'"
3+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "Response of get clarity metadata request",
4+
"title": "ClarityMetadataResponse",
5+
"type": "object",
6+
"required": ["data"],
7+
"properties": {
8+
"data": {
9+
"type": "string",
10+
"description": "Metadata value formatted as a JSON string"
11+
}
12+
}
13+
}

docs/rpc/openapi.yaml

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,94 @@ paths:
519519
description: |
520520
The Stacks chain tip to query from.
521521
If tip == "latest", the query will be run from the latest known tip (includes unconfirmed state).
522-
If the tip is left unspecified, the stacks chain tip will be selected (only includes confirmed state).
522+
If the tip is left unspecified, the stacks chain tip will be selected (only includes confirmed state).
523+
524+
/v2/clarity_marf_value/{clarity_marf_key}:
525+
post:
526+
summary: Get the MARF value for a given key
527+
tags:
528+
- Smart Contracts
529+
operationId: get_clarity_marf_value
530+
description: |
531+
Attempt to fetch the value of a MARF key. The key is identified with [Clarity MARF Key].
532+
533+
In the response, `data` is the hex serialization of the value.
534+
responses:
535+
200:
536+
description: Success
537+
content:
538+
application/json:
539+
schema:
540+
$ref: ./api/core-node/get-clarity-marf-value.schema.json
541+
example:
542+
$ref: ./api/core-node/get-clarity-marf-value.example.json
543+
400:
544+
description: Failed to retrieve MARF key
545+
parameters:
546+
- name: clarity_marf_key
547+
in: path
548+
required: true
549+
description: MARF key
550+
schema:
551+
type: string
552+
- name: proof
553+
in: query
554+
description: Returns object without the proof field when set to 0
555+
schema:
556+
type: integer
557+
- name: tip
558+
in: query
559+
schema:
560+
type: string
561+
description: The Stacks chain tip to query from. If tip == latest, the query will be run from the latest
562+
known tip (includes unconfirmed state).
563+
564+
/v2/clarity_metadata/{contract_address}/{contract_name}/{clarity_metadata_key}:
565+
post:
566+
summary: Get the contract metadata for the metadata key
567+
tags:
568+
- Smart Contracts
569+
operationId: get_clarity_metadata_key
570+
description: |
571+
Attempt to fetch the metadata of a contract. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The metadata key is identified with [Clarity Metadata Key].
572+
573+
In the response, `data` is formatted as JSON.
574+
responses:
575+
200:
576+
description: Success
577+
content:
578+
application/json:
579+
schema:
580+
$ref: ./api/core-node/get-clarity-metadata.schema.json
581+
example:
582+
$ref: ./api/core-node/get-clarity-metadata.example.json
583+
400:
584+
description: Failed to retrieve constant value from contract
585+
parameters:
586+
- name: contract_address
587+
in: path
588+
required: true
589+
description: Stacks address
590+
schema:
591+
type: string
592+
- name: contract_name
593+
in: path
594+
required: true
595+
description: Contract name
596+
schema:
597+
type: string
598+
- name: clarity_metadata_key
599+
in: path
600+
required: true
601+
description: Metadata key
602+
schema:
603+
type: string
604+
- name: tip
605+
in: query
606+
schema:
607+
type: string
608+
description: The Stacks chain tip to query from. If tip == latest, the query will be run from the latest
609+
known tip (includes unconfirmed state).
523610

524611
/v2/constant_val/{contract_address}/{contract_name}/{constant_name}:
525612
post:
@@ -633,7 +720,7 @@ paths:
633720

634721
/v3/blocks/{block_id}:
635722
get:
636-
summary: Fetch a Nakamoto block
723+
summary: Fetch a Nakamoto block
637724
tags:
638725
- Blocks
639726
operationId: get_block_v3
@@ -674,7 +761,7 @@ paths:
674761
application/json:
675762
example:
676763
$ref: ./api/core-node/get_tenure_info.json
677-
764+
678765
/v3/tenures/{block_id}:
679766
get:
680767
summary: Fetch a sequence of Nakamoto blocks in a tenure

0 commit comments

Comments
 (0)