diff --git a/api/nft/stats.md b/api/nft/stats.md new file mode 100644 index 00000000..59b9a1bd --- /dev/null +++ b/api/nft/stats.md @@ -0,0 +1,167 @@ +--- +sidebar_position: 2 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import ApiCallExample from '@site/src/components/ApiCallExample'; + +# Get NFT Statistics + +This endpoint provides global statistics about NFTs on the Chia blockchain, including collection counts, total NFTs, trade volumes, and royalty information. + +### Endpoint + + + + +``` +GET https://api.spacescan.io/nft/stats +``` + + + + +``` +GET https://api-testnet11.spacescan.io/nft/stats +``` + + + + +:::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/nft/stats" \ + -H "x-api-key: YOUR_API_KEY" +``` +::: + +### Live API Test + + + + + 🚀 Test API in Browser + + + + + 🚀 Test API in Browser + + + + +### Request Example + + + + + + + curl -X GET "https://api.spacescan.io/nft/stats" + + + + + curl -X GET "https://api-testnet11.spacescan.io/nft/stats" + + + + + + + + + import requests + + url = "https://api.spacescan.io/nft/stats" + + response = requests.get(url) + data = response.json() + print(data) + + + + + import requests + + url = "https://api-testnet11.spacescan.io/nft/stats" + + response = requests.get(url) + data = response.json() + print(data) + + + + + + + + + const url = "https://api.spacescan.io/nft/stats"; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + const url = "https://api-testnet11.spacescan.io/nft/stats"; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + + +### Response Example + +```json +{ + "status": "success", + "data": { + "collections_count": 4547, + "nft_count": 1637021, + "trades_count": 104329, + "traded_amount_xch": 4.680786556872335e-8, + "royalty_amount_xch": 2.202437563733082e-9, + "traded_amount_fiat": 9.77022e-7, + "royalty_amount_fiat": 4.5972e-8 + } +} +``` + +### Response Schema + +| Field | Type | Description | +|---------------------|---------|-------------------------------------------------------| +| status | string | The status of the API request | +| data | object | Object containing NFT statistics | +| collections_count | number | Total number of NFT collections | +| nft_count | number | Total number of NFTs | +| trades_count | number | Total number of NFT trades | +| traded_amount_xch | number | Total amount of XCH traded for NFTs | +| royalty_amount_xch | number | Total amount of XCH collected as royalties | +| traded_amount_fiat | number | Total amount traded in fiat currency | +| royalty_amount_fiat| number | Total amount of royalties in fiat currency | + +### Error Responses + +| HTTP Status Code | Meaning | +|------------------|-------------------------------------------------------------------------------------------| +| 400 | Bad Request -- Your request is invalid. | +| 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. | \ No newline at end of file diff --git a/apisidebars.js b/apisidebars.js index 08890ff7..520ae6f9 100644 --- a/apisidebars.js +++ b/apisidebars.js @@ -51,6 +51,7 @@ const sidebars = { label: 'NFT', items: [ 'nft/info', + 'nft/stats', ], }, { diff --git a/docs/guide/exchange_integration/exchange_integration.md b/docs/guide/exchange_integration/exchange_integration.md index d1a6d32e..9e76b89c 100644 --- a/docs/guide/exchange_integration/exchange_integration.md +++ b/docs/guide/exchange_integration/exchange_integration.md @@ -79,6 +79,80 @@ The block explorer shows: - Transactions in the block - Block weight and other metadata +## Token Explorer Integration + +To link to token details, you can use either the token symbol or token ID: + +``` +https://www.spacescan.io/token/{token_symbol_or_id} +``` + +### Examples +``` +// Using token symbol +https://www.spacescan.io/token/SBX + +// Using token ID +https://www.spacescan.io/token/a628c1c2c6fcb74d53746157e438e108eab5c0bb3e5c80ff9b1910b3e4832913 +``` + +![Token Explorer](token-explorer.png) + +The token explorer shows: +- Token name and symbol +- Market cap and volume +- Total and circulating supply +- Number of holders +- Recent trades and transfers +- Price charts and market data + +### Token API Integration + +For exchanges requiring programmatic access to token data, Spacescan.io provides comprehensive APIs: + +#### 1. Get Token Information +```javascript +// Fetch basic token information, price, and supply +GET https://api.spacescan.io/token/info/{token_id} + +// Example Response +{ + "status": "success", + "info": { + "asset_id": "token_id", + "name": "Token Name", + "symbol": "SYMBOL", + "description": "Token description...", + "type": "CAT2" + } +} +``` + +#### 2. Get Total Supply +```javascript +GET https://api.spacescan.io/token/total-supply/{token_id} + +// Example Response +{ + "total_supply": 1000000000 +} +``` + +#### 3. Get Circulating Supply +```javascript +GET https://api.spacescan.io/token/circulating-supply/{token_id} + +// Example Response +{ + "circulating_supply": 999999999 +} +``` + +For detailed API documentation, implementation examples, and advanced usage, please refer to: +- [Token Info API Documentation](https://docs.spacescan.io/api/cat/info) +- [Total Supply API Documentation](https://docs.spacescan.io/api/cat/total-supply) +- [Circulating Supply API Documentation](https://docs.spacescan.io/api/cat/circulating-supply) + ## Implementation Examples ### HTML Link diff --git a/docs/guide/exchange_integration/token-explorer.png b/docs/guide/exchange_integration/token-explorer.png new file mode 100644 index 00000000..40240d25 Binary files /dev/null and b/docs/guide/exchange_integration/token-explorer.png differ