Skip to content

Commit

Permalink
Merge pull request #154 from spacescan-io/sabari
Browse files Browse the repository at this point in the history
Added cat circulating and total supply
  • Loading branch information
natsabari authored Oct 30, 2024
2 parents 31fd1e5 + b09fa1e commit 6e0b8ce
Show file tree
Hide file tree
Showing 3 changed files with 330 additions and 0 deletions.
164 changes: 164 additions & 0 deletions api/cat/circulating-supply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
sidebar_position: 8
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import ApiCallExample from '@site/src/components/ApiCallExample';

# Get CAT Circulating Supply

This endpoint allows you to fetch the current circulating supply of a Chia Asset Token (CAT). Monitor the actual number of tokens actively circulating in the market, excluding locked, reserved, or unvested tokens. This data is essential for accurate market cap calculations, liquidity analysis, and understanding the true market dynamics of CAT tokens.

### Endpoint

<Tabs>
<TabItem value="mainnet" label="Mainnet">

```
GET https://api.spacescan.io/token/circulating-supply/{asset_id}
```

</TabItem>
<TabItem value="testnet" label="Testnet">

```
GET https://api-testnet11.spacescan.io/token/circulating-supply/{asset_id}
```

</TabItem>
</Tabs>

### Parameters

| Parameter | Type | Description |
|-----------|--------|-------------------------------------------------|
| asset_id | string | The unique identifier (TAIL hash) of the CAT |

:::info Free API
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
:::

:::tip Pro API
Use `pro-api.spacescan.io` with your API key in the `x-api-key` header. See our [API Plans](https://spacescan.io/apis#plans) for details.

```bash
curl -X GET "https://pro-api.spacescan.io/token/circulating-supply/{asset_id}" \
-H "x-api-key: YOUR_API_KEY"
```
:::

### Live API Test

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<a href="https://api.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
<TabItem value="testnet" label="Testnet">
<a href="https://api-testnet11.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
</Tabs>

### Request Example

<Tabs>
<TabItem value="curl" label="cURL">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="bash">
curl -X GET "https://api.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="bash">
curl -X GET "https://api-testnet11.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="python" label="Python">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="python">
import requests

asset_id = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
url = f"https://api.spacescan.io/token/circulating-supply/{asset_id}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="python">
import requests

asset_id = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
url = f"https://api-testnet11.spacescan.io/token/circulating-supply/{asset_id}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="javascript" label="JavaScript">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="javascript">
const assetId = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105";
const url = `https://api.spacescan.io/token/circulating-supply/${assetId}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="javascript">
const assetId = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105";
const url = `https://api-testnet11.spacescan.io/token/circulating-supply/${assetId}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
</Tabs>

### Response

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<ApiCallExample endpoint="https://api.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" />
</TabItem>
<TabItem value="testnet" label="Testnet">
<ApiCallExample endpoint="https://api-testnet11.spacescan.io/token/circulating-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" />
</TabItem>
</Tabs>

### Response Schema

| Field | Type | Description |
|--------------------|---------|-------------------------------------------------------|
| circulating_supply | number | The current circulating supply of the CAT token |

### Error Responses

| HTTP Status Code | Meaning |
|------------------|-------------------------------------------------------------------------------------------|
| 400 | Bad Request -- Your request is invalid |
| 404 | Not Found -- The specified CAT could not be found |
| 429 | Too Many Requests -- You're requesting too many times! Slow down! |
| 500 | Internal Server Error -- We had a problem with our server. Try again later |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later |
164 changes: 164 additions & 0 deletions api/cat/total-supply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
sidebar_position: 7
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import ApiCallExample from '@site/src/components/ApiCallExample';

# Get CAT Total Supply

This endpoint allows you to fetch the total supply of a Chia Asset Token (CAT). Track the maximum available tokens for any CAT in the Chia ecosystem. This information is crucial for understanding token economics, market capitalization calculations, and overall token distribution metrics.

### Endpoint

<Tabs>
<TabItem value="mainnet" label="Mainnet">

```
GET https://api.spacescan.io/token/total-supply/{asset_id}
```

</TabItem>
<TabItem value="testnet" label="Testnet">

```
GET https://api-testnet11.spacescan.io/token/total-supply/{asset_id}
```

</TabItem>
</Tabs>

### Parameters

| Parameter | Type | Description |
|-----------|--------|-------------------------------------------------|
| asset_id | string | The unique identifier (TAIL hash) of the CAT |

:::info Free API
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
:::

:::tip Pro API
Use `pro-api.spacescan.io` with your API key in the `x-api-key` header. See our [API Plans](https://spacescan.io/apis#plans) for details.

```bash
curl -X GET "https://pro-api.spacescan.io/token/total-supply/{asset_id}" \
-H "x-api-key: YOUR_API_KEY"
```
:::

### Live API Test

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<a href="https://api.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
<TabItem value="testnet" label="Testnet">
<a href="https://api-testnet11.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
</Tabs>

### Request Example

<Tabs>
<TabItem value="curl" label="cURL">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="bash">
curl -X GET "https://api.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="bash">
curl -X GET "https://api-testnet11.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="python" label="Python">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="python">
import requests

asset_id = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
url = f"https://api.spacescan.io/token/total-supply/{asset_id}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="python">
import requests

asset_id = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105"
url = f"https://api-testnet11.spacescan.io/token/total-supply/{asset_id}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="javascript" label="JavaScript">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="javascript">
const assetId = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105";
const url = `https://api.spacescan.io/token/total-supply/${assetId}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="javascript">
const assetId = "b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105";
const url = `https://api-testnet11.spacescan.io/token/total-supply/${assetId}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
</Tabs>

### Response

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<ApiCallExample endpoint="https://api.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" />
</TabItem>
<TabItem value="testnet" label="Testnet">
<ApiCallExample endpoint="https://api-testnet11.spacescan.io/token/total-supply/b8edcc6a7cf3738a3806fdbadb1bbcfc2540ec37f6732ab3a6a4bbcd2dbec105" />
</TabItem>
</Tabs>

### Response Schema

| Field | Type | Description |
|--------------|---------|--------------------------------------------------|
| total_supply | number | The total supply of the CAT token |

### Error Responses

| HTTP Status Code | Meaning |
|------------------|-------------------------------------------------------------------------------------------|
| 400 | Bad Request -- Your request is invalid |
| 404 | Not Found -- The specified CAT could not be found |
| 429 | Too Many Requests -- You're requesting too many times! Slow down! |
| 500 | Internal Server Error -- We had a problem with our server. Try again later |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later |
2 changes: 2 additions & 0 deletions apisidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const sidebars = {
'cat/transactions',
'cat/price',
'cat/update',
'cat/total-supply',
'cat/circulating-supply',
],
},

Expand Down

0 comments on commit 6e0b8ce

Please sign in to comment.