Skip to content

Commit 053e984

Browse files
authored
Merge pull request #167 from spacescan-io/sabari
Added more info for token integration
2 parents 5e7943d + cfa75cb commit 053e984

File tree

4 files changed

+242
-0
lines changed

4 files changed

+242
-0
lines changed

api/nft/stats.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
import Tabs from '@theme/Tabs';
5+
import TabItem from '@theme/TabItem';
6+
import CodeBlock from '@theme/CodeBlock';
7+
import ApiCallExample from '@site/src/components/ApiCallExample';
8+
9+
# Get NFT Statistics
10+
11+
This endpoint provides global statistics about NFTs on the Chia blockchain, including collection counts, total NFTs, trade volumes, and royalty information.
12+
13+
### Endpoint
14+
15+
<Tabs>
16+
<TabItem value="mainnet" label="Mainnet">
17+
18+
```
19+
GET https://api.spacescan.io/nft/stats
20+
```
21+
22+
</TabItem>
23+
<TabItem value="testnet" label="Testnet">
24+
25+
```
26+
GET https://api-testnet11.spacescan.io/nft/stats
27+
```
28+
29+
</TabItem>
30+
</Tabs>
31+
32+
:::info Free API
33+
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
34+
:::
35+
36+
:::tip Pro API
37+
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.
38+
39+
```bash
40+
curl -X GET "https://pro-api.spacescan.io/nft/stats" \
41+
-H "x-api-key: YOUR_API_KEY"
42+
```
43+
:::
44+
45+
### Live API Test
46+
47+
<Tabs>
48+
<TabItem value="mainnet" label="Mainnet">
49+
<a href="https://api.spacescan.io/nft/stats" target="_blank" rel="noopener noreferrer" className="api-test-button">
50+
🚀 Test API in Browser
51+
</a>
52+
</TabItem>
53+
<TabItem value="testnet" label="Testnet">
54+
<a href="https://api-testnet11.spacescan.io/nft/stats" target="_blank" rel="noopener noreferrer" className="api-test-button">
55+
🚀 Test API in Browser
56+
</a>
57+
</TabItem>
58+
</Tabs>
59+
60+
### Request Example
61+
62+
<Tabs>
63+
<TabItem value="curl" label="cURL">
64+
<Tabs>
65+
<TabItem value="mainnet" label="Mainnet">
66+
<CodeBlock language="bash">
67+
curl -X GET "https://api.spacescan.io/nft/stats"
68+
</CodeBlock>
69+
</TabItem>
70+
<TabItem value="testnet" label="Testnet">
71+
<CodeBlock language="bash">
72+
curl -X GET "https://api-testnet11.spacescan.io/nft/stats"
73+
</CodeBlock>
74+
</TabItem>
75+
</Tabs>
76+
</TabItem>
77+
<TabItem value="python" label="Python">
78+
<Tabs>
79+
<TabItem value="mainnet" label="Mainnet">
80+
<CodeBlock language="python">
81+
import requests
82+
83+
url = "https://api.spacescan.io/nft/stats"
84+
85+
response = requests.get(url)
86+
data = response.json()
87+
print(data)
88+
</CodeBlock>
89+
</TabItem>
90+
<TabItem value="testnet" label="Testnet">
91+
<CodeBlock language="python">
92+
import requests
93+
94+
url = "https://api-testnet11.spacescan.io/nft/stats"
95+
96+
response = requests.get(url)
97+
data = response.json()
98+
print(data)
99+
</CodeBlock>
100+
</TabItem>
101+
</Tabs>
102+
</TabItem>
103+
<TabItem value="javascript" label="JavaScript">
104+
<Tabs>
105+
<TabItem value="mainnet" label="Mainnet">
106+
<CodeBlock language="javascript">
107+
const url = "https://api.spacescan.io/nft/stats";
108+
109+
fetch(url)
110+
.then(response => response.json())
111+
.then(data => console.log(data))
112+
.catch(error => console.error('Error:', error));
113+
</CodeBlock>
114+
</TabItem>
115+
<TabItem value="testnet" label="Testnet">
116+
<CodeBlock language="javascript">
117+
const url = "https://api-testnet11.spacescan.io/nft/stats";
118+
119+
fetch(url)
120+
.then(response => response.json())
121+
.then(data => console.log(data))
122+
.catch(error => console.error('Error:', error));
123+
</CodeBlock>
124+
</TabItem>
125+
</Tabs>
126+
</TabItem>
127+
</Tabs>
128+
129+
### Response Example
130+
131+
```json
132+
{
133+
"status": "success",
134+
"data": {
135+
"collections_count": 4547,
136+
"nft_count": 1637021,
137+
"trades_count": 104329,
138+
"traded_amount_xch": 4.680786556872335e-8,
139+
"royalty_amount_xch": 2.202437563733082e-9,
140+
"traded_amount_fiat": 9.77022e-7,
141+
"royalty_amount_fiat": 4.5972e-8
142+
}
143+
}
144+
```
145+
146+
### Response Schema
147+
148+
| Field | Type | Description |
149+
|---------------------|---------|-------------------------------------------------------|
150+
| status | string | The status of the API request |
151+
| data | object | Object containing NFT statistics |
152+
| collections_count | number | Total number of NFT collections |
153+
| nft_count | number | Total number of NFTs |
154+
| trades_count | number | Total number of NFT trades |
155+
| traded_amount_xch | number | Total amount of XCH traded for NFTs |
156+
| royalty_amount_xch | number | Total amount of XCH collected as royalties |
157+
| traded_amount_fiat | number | Total amount traded in fiat currency |
158+
| royalty_amount_fiat| number | Total amount of royalties in fiat currency |
159+
160+
### Error Responses
161+
162+
| HTTP Status Code | Meaning |
163+
|------------------|-------------------------------------------------------------------------------------------|
164+
| 400 | Bad Request -- Your request is invalid. |
165+
| 429 | Too Many Requests -- You're requesting too many times! Slow down! |
166+
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
167+
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |

apisidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const sidebars = {
5151
label: 'NFT',
5252
items: [
5353
'nft/info',
54+
'nft/stats',
5455
],
5556
},
5657
{

docs/guide/exchange_integration/exchange_integration.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,80 @@ The block explorer shows:
7979
- Transactions in the block
8080
- Block weight and other metadata
8181

82+
## Token Explorer Integration
83+
84+
To link to token details, you can use either the token symbol or token ID:
85+
86+
```
87+
https://www.spacescan.io/token/{token_symbol_or_id}
88+
```
89+
90+
### Examples
91+
```
92+
// Using token symbol
93+
https://www.spacescan.io/token/SBX
94+
95+
// Using token ID
96+
https://www.spacescan.io/token/a628c1c2c6fcb74d53746157e438e108eab5c0bb3e5c80ff9b1910b3e4832913
97+
```
98+
99+
![Token Explorer](token-explorer.png)
100+
101+
The token explorer shows:
102+
- Token name and symbol
103+
- Market cap and volume
104+
- Total and circulating supply
105+
- Number of holders
106+
- Recent trades and transfers
107+
- Price charts and market data
108+
109+
### Token API Integration
110+
111+
For exchanges requiring programmatic access to token data, Spacescan.io provides comprehensive APIs:
112+
113+
#### 1. Get Token Information
114+
```javascript
115+
// Fetch basic token information, price, and supply
116+
GET https://api.spacescan.io/token/info/{token_id}
117+
118+
// Example Response
119+
{
120+
"status": "success",
121+
"info": {
122+
"asset_id": "token_id",
123+
"name": "Token Name",
124+
"symbol": "SYMBOL",
125+
"description": "Token description...",
126+
"type": "CAT2"
127+
}
128+
}
129+
```
130+
131+
#### 2. Get Total Supply
132+
```javascript
133+
GET https://api.spacescan.io/token/total-supply/{token_id}
134+
135+
// Example Response
136+
{
137+
"total_supply": 1000000000
138+
}
139+
```
140+
141+
#### 3. Get Circulating Supply
142+
```javascript
143+
GET https://api.spacescan.io/token/circulating-supply/{token_id}
144+
145+
// Example Response
146+
{
147+
"circulating_supply": 999999999
148+
}
149+
```
150+
151+
For detailed API documentation, implementation examples, and advanced usage, please refer to:
152+
- [Token Info API Documentation](https://docs.spacescan.io/api/cat/info)
153+
- [Total Supply API Documentation](https://docs.spacescan.io/api/cat/total-supply)
154+
- [Circulating Supply API Documentation](https://docs.spacescan.io/api/cat/circulating-supply)
155+
82156
## Implementation Examples
83157

84158
### HTML Link
Loading

0 commit comments

Comments
 (0)