From c48df91609c1805714b6d93ed3c42a0cd780c257 Mon Sep 17 00:00:00 2001 From: NatSabari Date: Wed, 30 Oct 2024 01:33:23 -0400 Subject: [PATCH 1/2] Added the new changes --- api/cat/list.md | 178 +++++++++++++++++++++++++++++++++++++ api/cat/price.md | 171 ++++++++++++++++++++++++++++++++++++ api/cat/transactions.md | 189 ++++++++++++++++++++++++++++++++++++++++ api/cat/update.md | 139 +++++++++++++++++++++++++++++ 4 files changed, 677 insertions(+) create mode 100644 api/cat/list.md create mode 100644 api/cat/price.md create mode 100644 api/cat/transactions.md create mode 100644 api/cat/update.md diff --git a/api/cat/list.md b/api/cat/list.md new file mode 100644 index 00000000..400c5f46 --- /dev/null +++ b/api/cat/list.md @@ -0,0 +1,178 @@ +--- +sidebar_position: 3 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import ApiCallExample from '@site/src/components/ApiCallExample'; + +# List All CATs + +This endpoint allows you to fetch a comprehensive list of all Chia Asset Tokens (CATs) in the Chia ecosystem. CATs are fungible tokens built on the Chia blockchain that enable users to create and trade custom assets, representing everything from wrapped cryptocurrencies to gaming tokens and platform utilities. + +### Endpoint + + + + +``` +GET https://api.spacescan.io/cats +``` + + + + +``` +GET https://api-testnet11.spacescan.io/cats +``` + + + + +### Parameters + +This endpoint doesn't require any parameters. + +:::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/cats" \ + -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/cats" + + + + + curl -X GET "https://api-testnet11.spacescan.io/cats" + + + + + + + + + import requests + + url = "https://api.spacescan.io/cats" + + response = requests.get(url) + data = response.json() + print(data) + + + + + import requests + + url = "https://api-testnet11.spacescan.io/cats" + + response = requests.get(url) + data = response.json() + print(data) + + + + + + + + + const url = "https://api.spacescan.io/cats"; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + const url = "https://api-testnet11.spacescan.io/cats"; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + + +### Response + + + + + + + + + + +### Response Schema + +| Field | Type | Description | +|------------------|---------|-------------------------------------------------------| +| status | string | The status of the API request | +| data | array | Array of CAT information objects | + +#### CAT Information Object + +Each object in the data array contains: + +| Field | Type | Description | +|------------------|---------|-------------------------------------------------------| +| id | string | The unique identifier of the CAT | +| name | string | The name of the CAT | +| symbol | string | The trading symbol of the CAT | +| description | string | Description of the CAT and its purpose | +| type | string | Type of the CAT (e.g., "CAT2") | +| created_time | string | Timestamp when the CAT was created | +| social | object | Social media and website links | +| social.discord | string | Discord server link | +| social.twitter | string | Twitter profile link | +| social.website | string | Official website URL | +| social.verified | boolean | Verification status of the CAT | +| tags | string | Category tags for the CAT | +| preview_url | string | URL to the CAT's logo or preview image | +| multiplier | string | Token multiplier value | + +### Error Responses + +| HTTP Status Code | Meaning | +|------------------|-------------------------------------------------------------------------------------------| +| 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/api/cat/price.md b/api/cat/price.md new file mode 100644 index 00000000..b3bdf43a --- /dev/null +++ b/api/cat/price.md @@ -0,0 +1,171 @@ +--- +sidebar_position: 5 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import ApiCallExample from '@site/src/components/ApiCallExample'; + +# Get CAT Price + +This endpoint allows you to fetch real-time price information for Chia Asset Tokens (CATs) in various currencies. Track current market prices, exchange rates, and fiat valuations for any CAT in the Chia ecosystem. This data is essential for portfolio tracking, trading decisions, and financial applications built on the Chia blockchain. + +### Endpoint + + + + +``` +GET https://api.spacescan.io/cat/catprice/{asset_id}?currency={currency_code} +``` + + + + +``` +GET https://api-testnet11.spacescan.io/cat/catprice/{asset_id}?currency={currency_code} +``` + + + + +### Parameters + +| Parameter | Type | Description | Required | +|--------------|--------|-------------------------------------------------|----------| +| asset_id | string | The unique identifier (TAIL hash) of the CAT | Yes | +| currency | string | Currency code (e.g., USD, EUR, INR, etc.) | No | + +:::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/cat/catprice/{asset_id}?currency=INR" \ + -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/cat/catprice/db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20?currency=INR" + + + + + curl -X GET "https://api-testnet11.spacescan.io/cat/catprice/db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20?currency=INR" + + + + + + + + + import requests + + asset_id = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + currency = "INR" + url = f"https://api.spacescan.io/cat/catprice/{asset_id}?currency={currency}" + + response = requests.get(url) + data = response.json() + print(data) + + + + + import requests + + asset_id = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + currency = "INR" + url = f"https://api-testnet11.spacescan.io/cat/catprice/{asset_id}?currency={currency}" + + response = requests.get(url) + data = response.json() + print(data) + + + + + + + + + const assetId = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20"; + const currency = "INR"; + const url = `https://api.spacescan.io/cat/catprice/${assetId}?currency=${currency}`; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + const assetId = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20"; + const currency = "INR"; + const url = `https://api-testnet11.spacescan.io/cat/catprice/${assetId}?currency=${currency}`; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + + +### Response + + + + + + + + + + +### Response Schema + +| Field | Type | Description | +|--------------|---------|-------------------------------------------------------| +| status | string | The status of the API request | +| amount_price | number | Current price in the requested currency | +| xch_price | string | Current price in XCH | + +### Error Responses + +| HTTP Status Code | Meaning | +|------------------|-------------------------------------------------------------------------------------------| +| 400 | Bad Request -- Your request is invalid or unsupported currency. | +| 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. | \ No newline at end of file diff --git a/api/cat/transactions.md b/api/cat/transactions.md new file mode 100644 index 00000000..438990eb --- /dev/null +++ b/api/cat/transactions.md @@ -0,0 +1,189 @@ +--- +sidebar_position: 4 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import ApiCallExample from '@site/src/components/ApiCallExample'; + +# Get CAT Transactions + +This endpoint allows you to fetch transaction history for a specific Chia Asset Token (CAT). Track transfers, trades, and movements of any CAT in the Chia ecosystem, providing valuable insights into token circulation and trading patterns. This is particularly useful for token analytics, market analysis, and tracking token distribution. + +### Endpoint + + + + +``` +GET https://api.spacescan.io/cat/transactions/{asset_id} +``` + + + + +``` +GET https://api-testnet11.spacescan.io/cat/transactions/{asset_id} +``` + + + + +### 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/cat/transactions/{asset_id}" \ + -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/cat/transactions/db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + + + + + curl -X GET "https://api-testnet11.spacescan.io/cat/transactions/db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + + + + + + + + + import requests + + asset_id = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + url = f"https://api.spacescan.io/cat/transactions/{asset_id}" + + response = requests.get(url) + data = response.json() + print(data) + + + + + import requests + + asset_id = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20" + url = f"https://api-testnet11.spacescan.io/cat/transactions/{asset_id}" + + response = requests.get(url) + data = response.json() + print(data) + + + + + + + + + const assetId = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20"; + const url = `https://api.spacescan.io/cat/transactions/${assetId}`; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + const assetId = "db1a9020d48d9d4ad22631b66ab4b9ebd3637ef7758ad38881348c5d24c38f20"; + const url = `https://api-testnet11.spacescan.io/cat/transactions/${assetId}`; + + fetch(url) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error('Error:', error)); + + + + + + +### Response + + + + + + + + + + +### Response Schema + +| Field | Type | Description | +|------------------|---------|-------------------------------------------------------| +| status | string | The status of the API request | +| data | array | Array of transaction objects | + +#### Transaction Object + +Each transaction in the data array contains: + +| Field | Type | Description | +|-------------------|---------|-------------------------------------------------------| +| coin_name | string | Unique identifier for the transaction | +| coin_parent | string | Parent coin identifier | +| amount | string | Amount of CAT tokens transferred | +| type | string | Transaction type (e.g., "CAT2") | +| timestamp | number | Unix timestamp of the transaction | +| confirmed_time | string | ISO timestamp of confirmation | +| spend_time | string | ISO timestamp when spent (null if unspent) | +| confirmed_txn_type| number | Type of confirmation transaction | +| sender | object | Information about the sender | +| sender.address | string | Sender's address | +| receiver | object | Information about the receiver | +| receiver.address | string | Receiver's address | +| cat | object | Information about the CAT | +| cat.id | string | CAT identifier (TAIL hash) | +| cat.name | string | Name of the CAT | +| cat.symbol | string | Symbol/ticker of the CAT | +| cat.description | string | Description of the CAT | + +### 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. | \ No newline at end of file diff --git a/api/cat/update.md b/api/cat/update.md new file mode 100644 index 00000000..11981f36 --- /dev/null +++ b/api/cat/update.md @@ -0,0 +1,139 @@ +--- +sidebar_position: 6 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; +import ApiCallExample from '@site/src/components/ApiCallExample'; + +# Update CAT Information + +This endpoint allows CAT creators and authorized parties to update metadata for their Chia Asset Tokens (CATs). Maintain accurate and up-to-date token information including name, symbol, description, and branding assets. The endpoint requires cryptographic proof of ownership through Chia wallet signatures to ensure secure and authenticated updates. + +### Endpoint + + + + +``` +POST https://api.spacescan.io/cat/info/updatecat +``` + + + + +``` +POST https://api-testnet11.spacescan.io/cat/info/updatecat +``` + + + + +### Request Body + +```json +{ + "pubkey": "a9cbfe25bf5cb4f94d948575a9c0b9792d0ee6086cdc339665555c5559f7b499535d2e4f021d19d752ebd254ac0b46ec", + "signature": "83e88836cc456901c01fd5f382ea8405650471a95e9743821f53b483e3e7ae42b5821ad65d5df081fcba5f695f5c4054021a20de22d09c79497fe093ed3ddf04eabfc24dc0ecd97f11a44e8672190616dafeabb2624eb1ee2e4a5cc98bea070f", + "signing_mode": "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_AUG:CHIP-0002_", + "message": "Confirm Sign in to import Tokens from spacescan.io", + "address": "xch18fs0vesvarufn82f7nr0lvvtxcha5mmyaj39pdcpftas898k6juse2z5rq", + "asset_id": "0172b814964c80a5c9f58f955f7f54b6f80dada38645f0835450daad4adfe041", + "asset_name": "Space Test CAT", + "description": "tes1t", + "cat_symbol": "SPACE", + "image_url": "https://spacescan.io/images/spacescan-logo-192.png" +} +``` + +### Parameters + +| Parameter | Type | Description | +|--------------|--------|------------------------------------------------------------| +| pubkey | string | Public key used for signing | +| signature | string | BLS signature of the message | +| signing_mode | string | Signature scheme used (typically BLS) | +| message | string | Message that was signed | +| address | string | EVE coin puzzle hash/minter address | +| asset_id | string | The unique identifier (TAIL hash) of the CAT | +| asset_name | string | New name for the CAT | +| description | string | New description for the CAT | +| cat_symbol | string | New trading symbol for the CAT | +| image_url | string | New URL for the CAT's logo/image | + +:::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. +::: + +### Request Example + + + + + curl -X POST "https://api.spacescan.io/cat/info/updatecat" \ + -H "Content-Type: application/json" \ + -d "@request.json" + + + + + import requests + import json + + url = "https://api.spacescan.io/cat/info/updatecat" + + with open('request.json') as f: + data = json.load(f) + + response = requests.post(url, headers=headers, json=data) + print(response.json()) + + + + + const fs = require('fs'); + const url = "https://api.spacescan.io/cat/info/updatecat"; + const headers = { "Content-Type": "application/json"}; + + const data = JSON.parse(fs.readFileSync('request.json')); + + fetch(url, { + method: "POST", + headers: headers, + body: JSON.stringify(data) + }) + .then(response => response.json()) + .then(data => console.log(data)) + .catch(error => console.error("Error:", error)); + + + + +### Response Schema + +| Field | Type | Description | +|---------|---------|------------------------------------------------| +| status | string | The status of the API request | +| message | string | Success or error message | + +### Error Responses + +| HTTP Status Code | Meaning | +|------------------|-------------------------------------------------------------------------------------------| +| 400 | Bad Request -- Invalid request body or signature | +| 401 | Unauthorized -- Invalid signature or address doesn't match CAT minter | +| 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 | + +### Notes + +- The signature must be generated using the Chia wallet +- The address must match the EVE coin puzzle hash or minter address of the CAT +- The message must be exactly "Confirm Sign in to import Tokens from spacescan.io" +- Image URLs should be publicly accessible and contain appropriate image formats (PNG, JPG, etc.) \ No newline at end of file From 9569474c3e98ad495e3db8b9917a9c4a368473b6 Mon Sep 17 00:00:00 2001 From: NatSabari Date: Wed, 30 Oct 2024 01:33:39 -0400 Subject: [PATCH 2/2] Added more changes --- apisidebars.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apisidebars.js b/apisidebars.js index 98ca68a6..e27da1bb 100644 --- a/apisidebars.js +++ b/apisidebars.js @@ -34,6 +34,10 @@ const sidebars = { items: [ 'cat/info', 'cat/holders', + 'cat/list', + 'cat/transactions', + 'cat/price', + 'cat/update', ], },