Skip to content

Commit a10ac03

Browse files
docs: added examples for Rosetta API's - AccountIdentifier, Hash and Construction (#1288)
* Added examples for construction, account and hash API's * docs: cleaned up OpenAPI.yaml for consistency with all the examples (#1282) * Added examples for missing API's * fix the hash example for v1/block/{hash} * Fixed examples for string types * Updated examples to follow yaml syntax * Examples for Rosetta and Smart contracts * Reframed a sentence
1 parent a640eb1 commit a10ac03

9 files changed

+136
-14
lines changed

docs/api/rosetta/rosetta-account-identifier-request-body.example.json renamed to docs/api/rosetta/rosetta-account-identifier-publickey-request-body.example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"network": "mainnet"
55
},
66
"public_key": {
7-
"hex_bytes": "022d82baea2d041ac281bebafab11571f45db4f163a9e3f8640b1c804a4ac6f662",
7+
"hex_bytes": "025c13b2fc2261956d8a4ad07d481b1a3b2cbf93a24f992249a61c3a1c4de79c51",
88
"curve_type": "secp256k1"
99
},
1010
"metadata": {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"network_identifier": {
3+
"blockchain": "stacks",
4+
"network": "mainnet"
5+
},
6+
"options": {
7+
"sender_address": "SP3Y0BBCCCBFAMYCYN3F35CX9MH1J2GATP53JX3FA",
8+
"type": "stack_stx",
9+
"status": "success",
10+
"token_transfer_recipient_address": "string",
11+
"amount": "500000",
12+
"symbol": "STX",
13+
"decimals": 6,
14+
"gas_limit": 0,
15+
"gas_price": 0,
16+
"suggested_fee_multiplier": 0,
17+
"max_fee": "12380898",
18+
"fee": "fee",
19+
"size": 260,
20+
"memo": "test.memo",
21+
"number_of_cycles": 0,
22+
"contract_address": "SP112T7BYCNEDCZ9TCYXCXFNJG9WXX5Q5SG6DSBAM",
23+
"contract_name": "STX transfer",
24+
"burn_block_height": 0,
25+
"delegate_to": "cb3df38053d132895220b9ce471f6b676db5b9bf0b4adefb55f2118ece2478df01.STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6",
26+
"pox_addr": "1Xik14zRm29UsyS6DjhYg4iZeZqsDa8D3"
27+
},
28+
"public_keys": [
29+
{
30+
"hex_bytes": "publicKey",
31+
"curve_type": "secp256k1"
32+
}
33+
]
34+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"network_identifier": {
3+
"blockchain": "stacks",
4+
"network": "mainnet"
5+
},
6+
"signed_transaction": "0x80800000000400539886f96611ba3ba6cef9618f8c78118b37c5be000000000000000000000000000000b400017a33a91515ef48608a99c6adecd2eb258e11534a1acf66348f5678c8e2c8f83d243555ed67a0019d3500df98563ca31321c1a675b43ef79f146e322fe08df75103020000000000051a1ae3f911d8f1d46d7416bfbe4b593fd41eac19cb000000000007a12000000000000000000000000000000000000000000000000000000000000000000000"
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"network_identifier": {
3+
"blockchain": "stacks",
4+
"network": "mainnet"
5+
},
6+
"unsigned_transaction": "00000000010400539886f96611ba3ba6cef9618f8c78118b37c5be0000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003020000000000051ab71a091b4b8b7661a661c620966ab6573bc2dcd3000000000007a12074657374207472616e73616374696f6e000000000000000000000000000000000000",
7+
"signatures": [
8+
{
9+
"signing_payload": {
10+
"address": "string",
11+
"account_identifier": {
12+
"address": "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6",
13+
"metadata": {}
14+
},
15+
"hex_bytes": "string",
16+
"signature_type": "ecdsa"
17+
},
18+
"public_key": {
19+
"hex_bytes": "025c13b2fc2261956d8a4ad07d481b1a3b2cbf93a24f992249a61c3a1c4de79c51",
20+
"curve_type": "secp256k1"
21+
},
22+
"signature_type": "ecdsa",
23+
"hex_bytes": "string"
24+
}
25+
]
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"network_identifier": {
3+
"blockchain": "stacks",
4+
"network": "mainnet"
5+
},
6+
"signed_transaction": "0x80800000000400539886f96611ba3ba6cef9618f8c78118b37c5be000000000000000000000000000000b400017a33a91515ef48608a99c6adecd2eb258e11534a1acf66348f5678c8e2c8f83d243555ed67a0019d3500df98563ca31321c1a675b43ef79f146e322fe08df75103020000000000051a1ae3f911d8f1d46d7416bfbe4b593fd41eac19cb000000000007a12000000000000000000000000000000000000000000000000000000000000000000000"
7+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"network_identifier": {
3+
"blockchain": "stacks",
4+
"network": "mainnet"
5+
},
6+
"operations": [
7+
{
8+
"operation_identifier": {
9+
"index": 0,
10+
"network_index": 0
11+
},
12+
"related_operations": [
13+
{
14+
"index": 0,
15+
"network_index": 0
16+
}
17+
],
18+
"type": "stack_stx",
19+
"status": "success",
20+
"account": {
21+
"address": "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6",
22+
"metadata": {}
23+
}
24+
25+
}
26+
]
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"0x0100000000000000000000000000000095"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sender": "STM9EQRAB3QAKF8NKTP15WJT7VHH4EWG3DJB4W29",
3+
"arguments": [
4+
"0x0100000000000000000000000000000095"
5+
]
6+
}

docs/openapi.yaml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,9 @@ paths:
601601
in: query
602602
description: index of first block to fetch
603603
required: false
604-
example: 42000
605604
schema:
606605
type: integer
606+
example: 42000
607607
responses:
608608
200:
609609
description: List of blocks
@@ -1085,20 +1085,21 @@ paths:
10851085
description: Stacks address
10861086
schema:
10871087
type: string
1088-
example: "SP6P4EJF0VG8V0RB3TQQKJBHDQKEF6NVRD1KZE3C"
1088+
example: "SPSCWDV3RKV5ZRN1FQD84YE1NQFEDJ9R1F4DYQ11"
10891089
- name: contract_name
10901090
in: path
10911091
required: true
10921092
description: Contract name
10931093
schema:
10941094
type: string
1095-
example: satoshibles
1095+
example: newyorkcitycoin-core-v2
10961096
- name: map_name
10971097
in: path
10981098
required: true
10991099
description: Map name
11001100
schema:
11011101
type: string
1102+
example: approved-contracts
11021103
- name: proof
11031104
in: query
11041105
description: Returns object without the proof field when set to 0
@@ -1117,6 +1118,8 @@ paths:
11171118
application/json:
11181119
schema:
11191120
type: string
1121+
example:
1122+
$ref: ./entities/contracts/get-specific-data-map-inside-contract.example.json
11201123

11211124
/v2/contracts/source/{contract_address}/{contract_name}:
11221125
get:
@@ -1192,20 +1195,21 @@ paths:
11921195
description: Stacks address
11931196
schema:
11941197
type: string
1195-
example: "SP6P4EJF0VG8V0RB3TQQKJBHDQKEF6NVRD1KZE3C"
1198+
example: "SP187Y7NRSG3T9Z9WTSWNEN3XRV1YSJWS81C7JKV7"
11961199
- name: contract_name
11971200
in: path
11981201
required: true
11991202
description: Contract name
12001203
schema:
12011204
type: string
1202-
example: satoshibles
1205+
example: imaginary-friends-zebras
12031206
- name: function_name
12041207
in: path
12051208
required: true
12061209
description: Function name
12071210
schema:
12081211
type: string
1212+
example: get-token-uri
12091213
- name: tip
12101214
in: query
12111215
schema:
@@ -1219,11 +1223,8 @@ paths:
12191223
application/json:
12201224
schema:
12211225
$ref: './entities/contracts/read-only-function-args.schema.json'
1222-
example:
1223-
sender: 'SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info'
1224-
arguments:
1225-
- '0x0011...'
1226-
- '0x00231...'
1226+
example:
1227+
$ref: './entities/contracts/read-only-function-args-request-body.example.json'
12271228

12281229
/extended/v1/address/{principal}/balances:
12291230
get:
@@ -2205,6 +2206,8 @@ paths:
22052206
application/json:
22062207
schema:
22072208
$ref: ./api/rosetta/rosetta-construction-derive-request.schema.json
2209+
example:
2210+
$ref: ./api/rosetta/rosetta-account-identifier-publickey-request-body.example.json
22082211

22092212
/rosetta/v1/construction/hash:
22102213
post:
@@ -2232,6 +2235,8 @@ paths:
22322235
application/json:
22332236
schema:
22342237
$ref: ./api/rosetta/rosetta-construction-hash-request.schema.json
2238+
example:
2239+
$ref: ./api/rosetta/rosetta-hash-signed-transaction-request-schema-body.example.json
22352240

22362241
/rosetta/v1/construction/metadata:
22372242
post:
@@ -2259,6 +2264,8 @@ paths:
22592264
application/json:
22602265
schema:
22612266
$ref: ./api/rosetta/rosetta-construction-metadata-request.schema.json
2267+
example:
2268+
$ref: ./api/rosetta/rosetta-construction-metadata-request-schema-body.example.json
22622269

22632270
/rosetta/v1/construction/parse:
22642271
post:
@@ -2321,7 +2328,7 @@ paths:
23212328
- Rosetta
23222329
summary: Submit a Signed Transaction
23232330
operationId: rosetta_construction_submit
2324-
description: Submit a pre-signed transaction to the node.
2331+
description: Submit a pre-signed transaction to the node. The examples below are illustrative only. You'll need to use your wallet to generate actual values to use them in the request payload.
23252332
responses:
23262333
200:
23272334
description: Success
@@ -2341,14 +2348,16 @@ paths:
23412348
application/json:
23422349
schema:
23432350
$ref: ./api/rosetta/rosetta-construction-submit-request.schema.json
2351+
example:
2352+
$ref: ./api/rosetta/rosetta-submit-signed-transaction-request.example.json
23442353

23452354
/rosetta/v1/construction/payloads:
23462355
post:
23472356
tags:
23482357
- Rosetta
23492358
summary: Generate an Unsigned Transaction and Signing Payloads
23502359
operationId: rosetta_construction_payloads
2351-
description: Generate and unsigned transaction from operations and metadata
2360+
description: Generate an unsigned transaction from operations and metadata. The examples below are illustrative only. You'll need to use your wallet to generate actual values to use them in the request payload.
23522361
responses:
23532362
200:
23542363
description: Success
@@ -2368,14 +2377,16 @@ paths:
23682377
application/json:
23692378
schema:
23702379
$ref: ./api/rosetta/rosetta-construction-payloads-request.schema.json
2380+
example:
2381+
$ref: ./api/rosetta/rosetta-submit-unsigned-transaction-unsigned-payloads-request.example.json
23712382

23722383
/rosetta/v1/construction/combine:
23732384
post:
23742385
tags:
23752386
- Rosetta
23762387
summary: Create Network Transaction from Signatures
23772388
operationId: rosetta_construction_combine
2378-
description: Take unsigned transaction and signature, combine both and return signed transaction
2389+
description: Take unsigned transaction and signature, combine both and return signed transaction. The examples below are illustrative only. You'll need to use your wallet to generate actual values to use them in the request payload.
23792390
responses:
23802391
200:
23812392
description: Success
@@ -2395,6 +2406,8 @@ paths:
23952406
application/json:
23962407
schema:
23972408
$ref: ./api/rosetta/rosetta-construction-combine-request.schema.json
2409+
example:
2410+
$ref: ./api/rosetta/rosetta-network-transaction-from-signarures-request.example.json
23982411

23992412
/v2/prices/namespaces/{tld}:
24002413
get:
@@ -3210,6 +3223,7 @@ paths:
32103223
get:
32113224
operationId: get_contract_nft_metadata
32123225
summary: Non fungible tokens metadata for contract ID
3226+
deprecated: true
32133227
description: Retrieves metadata for non fungible tokens for a given contract id. More information on Non-Fungible Tokens on the Stacks blockchain can be found [here](https://docs.stacks.co/write-smart-contracts/tokens#non-fungible-tokens-nfts).
32143228
tags:
32153229
- Non-Fungible Tokens

0 commit comments

Comments
 (0)