Skip to content

Commit

Permalink
Merge pull request #761 from hirosystems/chore/api-updates
Browse files Browse the repository at this point in the history
api updates
  • Loading branch information
ryanwaits authored Oct 1, 2024
2 parents c5494a9 + 675e2d3 commit 1321aba
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 31 deletions.
4 changes: 4 additions & 0 deletions content/docs/stacks/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The Stacks Blockchain API expands the intentionally minimal RPC endpoints availa

## Popular endpoints

<Callout title="RPC endpoints" type="info">
Use our `/v2` route to access the Stacks API node endpoints. For more information, see the [Stacks Node RPC API](https://docs.stacks.co/reference/api#stacks-node-rpc-api-endpoints) documentation.
</Callout>

<Cards>
<SecondaryCard
href="/stacks/api/transactions/recent-transactions"
Expand Down
16 changes: 8 additions & 8 deletions content/docs/stacks/api/info/core-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ GET request that core node information

```json
{
"peer_version": 0,
"peer_version": 402653194,
"pox_consensus": "string",
"burn_block_height": 0,
"burn_block_height": 863576,
"stable_pox_consensus": "string",
"stable_burn_block_height": 0,
"stable_burn_block_height": 863569,
"server_version": "string",
"network_id": 0,
"parent_network_id": 0,
"stacks_tip_height": 0,
"network_id": 1,
"parent_network_id": 3652501241,
"stacks_tip_height": 167976,
"stacks_tip": "string",
"stacks_tip_consensus_hash": "string",
"unanchored_tip": "string",
"exit_at_block_height": 0
"unanchored_tip": null,
"exit_at_block_height": null
}
```

Expand Down
27 changes: 14 additions & 13 deletions content/docs/stacks/api/info/total-and-unlocked-stx-supply.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@ import {

## Get total and unlocked STX supply

Retrieves the total and unlocked STX supply. More information on Stacking can be found [here] (https://docs.stacks.co/understand-stacks/stacking).

<Callout>
This uses the estimated future total supply for the year 2050.
</Callout>
Retrieves the total and unlocked STX supply.

### Query Parameters

<Property name={"height"} type={"number"} required={false} deprecated={false}>
<Property name={"height"} type={"Block height"} required={false} deprecated={false}>

Supply details are queried from specified block height. If the block height is not specified, the latest block height is taken as default value. Note that the `block height` is referred to the stacks blockchain.

<span>Example: `200`</span>
<span>Minimum: `0`</span>

</Property>

| Status code | Description |
| :------ | :------ |
| `200` | Success |
| :----------- | :----------- |
| `200` | GET request that returns total and unlocked STX supply |

<APIPlayground authorization={undefined} method={"GET"} route={"/extended/v1/stx_supply"} path={[]} query={[{"name":"height","type":"number","defaultValue":200,"isRequired":false}]} header={[]} body={undefined} schemas={{}}>
<APIPlayground authorization={undefined} method={"GET"} route={"/extended/v1/stx_supply/"} path={[]} query={[{"name":"height","type":"number","defaultValue":"","isRequired":false,"description":"Block height"}]} header={[]} body={undefined} schemas={{}}>

</APIPlayground>

Expand All @@ -61,15 +57,15 @@ Supply details are queried from specified block height. If the block height is n
<Request value={"cURL"}>

```bash
curl -X GET "https://api.hiro.so/extended/v1/stx_supply?height=200"
curl -X GET "https://api.hiro.so/extended/v1/stx_supply"
```

</Request>

<Request value={"JavaScript"}>

```js
fetch("https://api.hiro.so/extended/v1/stx_supply?height=200", {
fetch("https://api.hiro.so/extended/v1/stx_supply", {
method: "GET"
});
```
Expand All @@ -92,6 +88,7 @@ GET request that returns network target block times
{
"unlocked_percent": "string",
"total_stx": "string",
"total_stx_year_2050": "string",
"unlocked_stx": "string",
"block_height": 0
}
Expand All @@ -111,9 +108,13 @@ export interface GetStxSupplyResponse {
*/
unlocked_percent: string;
/**
* String quoted decimal number of the total possible number of STX
* String quoted decimal number of the total circulating number of STX (at the input block height if provided, otherwise the current block height)
*/
total_stx: string;
/**
* String quoted decimal number of total circulating STX supply in year 2050. STX supply grows approx 0.3% annually thereafter in perpetuity.
*/
total_stx_year_2050: string;
/**
* String quoted decimal number of the STX that have been mined or unlocked
*/
Expand Down
4 changes: 3 additions & 1 deletion content/docs/stacks/api/smart-contracts/interface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ GET request to get contract interface
],
"non_fungible_tokens": [
{}
]
],
"epoch": "string",
"clarity_version": "string"
}
```

Expand Down
8 changes: 4 additions & 4 deletions content/docs/stacks/api/stacking-pool/members.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {

<API>

<APIInfo method={"GET"} route={"/extended/v1/pox3/{pool_principal}/delegations"}>
<APIInfo method={"GET"} route={"/extended/v1/pox4/{pool_principal}/delegations"}>

## Stacking pool members

Expand Down Expand Up @@ -80,7 +80,7 @@ number of items to skip
| :------ | :------ |
| `200` | Success |

<APIPlayground authorization={undefined} method={"GET"} route={"/extended/v1/pox3/{pool_principal}/delegations"} path={[{"name":"pool_principal","type":"string","defaultValue":"SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP","isRequired":true}]} query={[{"name":"after_block","type":"number","defaultValue":"","isRequired":false},{"name":"unanchored","type":"boolean","defaultValue":false,"isRequired":false},{"name":"limit","type":"number","defaultValue":3,"isRequired":false},{"name":"offset","type":"number","defaultValue":0,"isRequired":false}]} header={[]} body={undefined} schemas={{}}>
<APIPlayground authorization={undefined} method={"GET"} route={"/extended/v1/pox4/{pool_principal}/delegations"} path={[{"name":"pool_principal","type":"string","defaultValue":"SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP","isRequired":true}]} query={[{"name":"after_block","type":"number","defaultValue":"","isRequired":false},{"name":"unanchored","type":"boolean","defaultValue":false,"isRequired":false},{"name":"limit","type":"number","defaultValue":3,"isRequired":false},{"name":"offset","type":"number","defaultValue":0,"isRequired":false}]} header={[]} body={undefined} schemas={{}}>

</APIPlayground>

Expand All @@ -93,15 +93,15 @@ number of items to skip
<Request value={"cURL"}>

```bash
curl -X GET "https://api.hiro.so/extended/v1/pox3/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?unanchored=false&limit=5"
curl -X GET "https://api.hiro.so/extended/v1/pox4/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?unanchored=false&limit=5"
```

</Request>

<Request value={"JavaScript"}>

```js
fetch("https://api.hiro.so/extended/v1/pox3/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?after_block=0&unanchored=true&limit=100&offset=300", {
fetch("https://api.hiro.so/extended/v1/pox4/SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP/delegations?after_block=0&unanchored=true&limit=100&offset=300", {
method: "GET"
});
```
Expand Down
6 changes: 3 additions & 3 deletions content/docs/stacks/api/transactions/get-transaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ Transaction ID
<Request value={"cURL"}>

```bash
curl -X GET "https://api.hiro.so/extended/v1/tx/%7Btx_id%7D"
curl -X GET "https://api.hiro.so/extended/v1/tx/{tx_id}"
```

</Request>

<Request value={"JavaScript"}>

```js
fetch("https://api.hiro.so/extended/v1/tx/%7Btx_id%7D", {
fetch("https://api.hiro.so/extended/v1/tx/{tx_id}", {
method: "GET"
});
```
Expand All @@ -81,7 +81,7 @@ fetch("https://api.hiro.so/extended/v1/tx/%7Btx_id%7D", {

<Response value={"200"}>

Describes all transaction types on Stacks 2.0 blockchain
Fetches transaction details for a given transaction ID

<ResponseTypes>

Expand Down
4 changes: 2 additions & 2 deletions content/docs/stacks/api/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://api.mainnet.hiro.so
To make a request to the Stacks API, you can paste the `curl` command below in your terminal.

```bash title="Terminal"
curl -L 'https://api.hiro.so/v2/info' \
curl -L 'https://api.hiro.so/extended' \
-H 'Accept: application/json'
```

Expand All @@ -25,7 +25,7 @@ curl -L 'https://api.hiro.so/v2/info' \
If you are using an `api-key`, you will need to replace `$HIRO_API_KEY` with your secret API key.

```bash title="Terminal"
curl -L 'https://api.hiro.so/v2/info' \
curl -L 'https://api.hiro.so/extended' \
-H 'Accept: application/json' \
-H 'X-API-Key: $HIRO_API_KEY' # [!code highlight]
```
Expand Down

0 comments on commit 1321aba

Please sign in to comment.