Skip to content

Commit

Permalink
Merge pull request #168 from spacescan-io/Dev-nandha
Browse files Browse the repository at this point in the history
Cat info changes
  • Loading branch information
nandhakumar2002 authored Dec 31, 2024
2 parents 053e984 + 1fe2c89 commit de8f2fd
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 192 deletions.
64 changes: 23 additions & 41 deletions api/cat/holders.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import ApiCallExample from '@site/src/components/ApiCallExample';

# Get CAT Holders
# Get Token Holders

This endpoint allows you to fetch the list of holders for a specific CAT (Chia Asset Token).

Expand All @@ -16,14 +16,14 @@ This endpoint allows you to fetch the list of holders for a specific CAT (Chia A
<TabItem value="mainnet" label="Mainnet">

```
GET https://api.spacescan.io/cat/holders/{asset_id}
GET https://api.spacescan.io/token/holders/{asset_id}
```

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

```
GET https://api-testnet11.spacescan.io/cat/holders/{asset_id}
GET https://api-testnet11.spacescan.io/token/holders/{asset_id}
```

</TabItem>
Expand All @@ -35,6 +35,7 @@ GET https://api-testnet11.spacescan.io/cat/holders/{asset_id}
|-----------|--------|-------------------------------------------------|
| asset_id | string | The unique identifier 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.
:::
Expand All @@ -43,7 +44,7 @@ Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacesc
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/cat/holders/{asset_id}" \
curl -X GET "https://pro-api.spacescan.io/token/holders/{asset_id}" \
-H "x-api-key: YOUR_API_KEY"
```
:::
Expand All @@ -52,12 +53,12 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<a href="https://api.spacescan.io/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" target="_blank" rel="noopener noreferrer" className="api-test-button">
<a href="https://api.spacescan.io/token/holders/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365" 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/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" target="_blank" rel="noopener noreferrer" className="api-test-button">
<a href="https://api-testnet11.spacescan.io/token/holders/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
Expand All @@ -70,12 +71,12 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="bash">
curl -X GET "https://api.spacescan.io/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
curl -X GET "https://api.spacescan.io/token/holders/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="bash">
curl -X GET "https://api-testnet11.spacescan.io/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
curl -X GET "https://api-testnet11.spacescan.io/token/holders/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"
</CodeBlock>
</TabItem>
</Tabs>
Expand All @@ -86,8 +87,8 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \
<CodeBlock language="python">
import requests

asset_id = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
url = f"https://api.spacescan.io/cat/holders/{asset_id}"
asset_id = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"
url = f"https://api.spacescan.io/token/holders/{asset_id}"

response = requests.get(url)
data = response.json()
Expand All @@ -98,8 +99,8 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \
<CodeBlock language="python">
import requests

asset_id = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589"
url = f"https://api-testnet11.spacescan.io/cat/holders/{asset_id}"
asset_id = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"
url = f"https://api-testnet11.spacescan.io/token/holders/{asset_id}"

response = requests.get(url)
data = response.json()
Expand All @@ -112,8 +113,8 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="javascript">
const assetId = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589";
const url = `https://api.spacescan.io/cat/holders/${assetId}`;
const assetId = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365";
const url = `https://api.spacescan.io/token/holders/${assetId}`;

fetch(url)
.then(response => response.json())
Expand All @@ -123,8 +124,8 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="javascript">
const assetId = "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589";
const url = `https://api-testnet11.spacescan.io/cat/holders/${assetId}`;
const assetId = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365";
const url = `https://api-testnet11.spacescan.io/token/holders/${assetId}`;

fetch(url)
.then(response => response.json())
Expand All @@ -138,41 +139,22 @@ curl -X GET "https://pro-api.spacescan.io/cat/holders/{asset_id}" \

### Response

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<ApiCallExample endpoint="https://api.spacescan.io/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" />
</TabItem>
<TabItem value="testnet" label="Testnet">
<ApiCallExample endpoint="https://api-testnet11.spacescan.io/cat/holders/6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589" />
</TabItem>
</Tabs>
<ApiCallExample endpoint="https://api.spacescan.io/token/holders/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365" />

### Response Schema

| Field | Type | Description |
|------------------|---------|-------------------------------------------------------|
| status | string | The status of the API request |
| holders | array | List of CAT holders |
| total_holders | number | Total number of unique holders |
| total_supply | string | Total supply of the CAT |
| tokens | array | List of CAT holders |
| next_cursor | number | Pagination cursor for the next page |
| total_count | string | Total holders count |

#### Holder Object

Each holder in the `holders` array contains:
Each holder in the `tokens` array contains:

| Field | Type | Description |
|------------------|---------|-------------------------------------------------------|
| address | string | The holder's address |
| balance | string | The amount of CAT tokens held |
| percentage | number | Percentage of total supply held by this address |
| last_updated | string | Timestamp of last balance update |

### 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. |
| amount | string | The amount of CAT tokens held |
104 changes: 46 additions & 58 deletions api/cat/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ curl -X GET "https://pro-api.spacescan.io/token/info/{token_id}?include_price=tr

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<a href="https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495" target="_blank" rel="noopener noreferrer" className="api-test-button">
<a href="https://api.spacescan.io/token/info/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365?include_price=true&include_supply=true&currency=USD" 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/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495" target="_blank" rel="noopener noreferrer" className="api-test-button">
<a href="https://api-testnet11.spacescan.io/token/info/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
Expand All @@ -75,10 +75,10 @@ curl -X GET "https://pro-api.spacescan.io/token/info/{token_id}?include_price=tr

```bash
# Basic info
curl -X GET "https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495"
curl -X GET "https://api.spacescan.io/token/info/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"

# With price and supply info
curl -X GET "https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495?include_price=true&include_supply=true&currency=USD"
curl -X GET "https://api.spacescan.io/token/info/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365?include_price=true&include_supply=true&currency=USD"
```

</TabItem>
Expand All @@ -89,7 +89,7 @@ curl -X GET "https://api.spacescan.io/token/info/14b40962dfef81d954ac0d92b51ec21
```python
import requests

token_id = "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495"
token_id = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365"
params = {
"include_price": "true",
"include_supply": "true",
Expand All @@ -106,7 +106,7 @@ print(data)
<TabItem value="javascript" label="JavaScript">

```javascript
const tokenId = "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495";
const tokenId = "8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365";
const url = `https://api.spacescan.io/token/info/${tokenId}?include_price=true&include_supply=true&currency=USD`;

fetch(url)
Expand All @@ -118,59 +118,47 @@ fetch(url)
</TabItem>
</Tabs>

### Response

<ApiCallExample endpoint="https://api.spacescan.io/token/info/8c77de1427156b98fb15cce77d908f79bd69f6b4b8e3a60d8e051dac481b5365?include_price=true&include_supply=true&currency=USD" />

### Response Schema

| Field | Type | Description |
|-------|------|-------------|
| status | string | Success or failure status |
| info | object | Basic token information |
| info.asset_id | string | The unique identifier of the CAT |
| info.token_id | string | Token ID in tkn format |
| info.name | string | The name of the CAT |
| info.description | string | Description of the CAT |
| info.symbol | string | Trading symbol of the CAT |
| info.preview_url | string | URL to the CAT's logo image |
| info.tags | string | Category tags |
| info.twitter | string | Twitter profile URL (null if not set) |
| info.discord | string | Discord server URL (null if not set) |
| info.website | string | Official website URL (null if not set) |
| info.type | string | Token type (e.g., "CAT2") |
| price | object | Price information (if requested) |
| price.price_[currency] | number | Price in specified currency |
| price.price_xch | number | Price in XCH |
| supply | object | Supply information (if requested) |
| supply.total_supply | number | Total token supply |
| supply.burned | number | Number of tokens burned |
| supply.melted | number | Number of tokens melted |
| supply.circulating_supply | number | Current circulating supply |

### Example Response

```json
{
"status": "success",
"info": {
"asset_id": "14b40962dfef81d954ac0d92b51ec21ce7acd8c62dd9fef9303aa51c615cb495",
"token_id": "tkn1zj6qjckla7qaj49vpkft28kzrnn6ekxx9hvla7fs82j3cc2ukj2ssa84km",
"name": "LLC Burn Token",
"description": "LLC Burn Token can only be acquired by burning a Little Lambo Coin...",
"symbol": "LLBT",
"preview_url": "https://assets.spacescan.io/cat/f5cd9dccc98c1fd4f32b599324b6dd938c793c0e50af7581195aee603277bad8.webp",
"tags": "meme",
"twitter": "https://twitter.com/LittleLamboCoin",
"discord": "https://discord.gg/Ew96DzCxc7",
"website": "https://littlelambocoin.com/llc-burn-token",
"type": "CAT2"
},
"price": {
"price_usd": 0.02624364935709997,
"price_xch": 0.001225206519248
},
"supply": {
"total_supply": 1000000000,
"burned": 1,
"melted": 0,
"circulating_supply": 999999999
}
}
```
| status | string | The status of the API request |
| info | object | Token information object |
| price | object | Price information object |
| supply | object | Supply information object |

#### Info Object

| Field | Type | Description |
|-------|------|-------------|
| asset_id | string | The unique identifier of the CAT |
| token_id | string | Token ID in tkn format |
| name | string | The name of the CAT |
| description | string | Description of the CAT |
| symbol | string | Trading symbol of the CAT |
| preview_url | string | URL to the CAT's logo image |
| tags | string | Category tags |
| twitter | string | Twitter profile URL (null if not set) |
| discord | string | Discord server URL (null if not set) |
| website | string | Official website URL (null if not set) |
| type | string | Token type (e.g., "CAT2") |

#### Price Object (if requested)

| Field | Type | Description |
|-------|------|-------------|
| [currency] | string | Price in specified currency (e.g., "usd": 0.02624364935709997) |
| xch | string | Price in XCH |

#### Supply Object (if requested)

| Field | Type | Description |
|-------|------|-------------|
| total_supply | number | Total token supply |
| burned | number | Number of tokens burned |
| melted | number | Number of tokens melted |
| circulating_supply | number | Current circulating supply |
Loading

0 comments on commit de8f2fd

Please sign in to comment.