diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6818740..5aecb5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,9 +120,6 @@ jobs: - cluster: prod-ams network_name: mainnet network_version: v2 - - cluster: prod-ams - network_name: sejong - network_version: v2 - cluster: prod-ams network_name: lisbon network_version: v2 diff --git a/icon_stats/api/v1/endpoints/openapi.py b/icon_stats/api/v1/endpoints/openapi.py new file mode 100644 index 0000000..8c86313 --- /dev/null +++ b/icon_stats/api/v1/endpoints/openapi.py @@ -0,0 +1,57 @@ +from datetime import datetime +from typing import Dict, Optional, Any, List +from fastapi import APIRouter +from icon_stats.config import config +from icon_stats.openapi.operations import FetchSchema, ResolveRefs, ValidateParams +from icon_stats.openapi.processor import OpenAPIProcessor + +router = APIRouter() + +_cache: Dict[str, Optional[Any]] = { + "data": None, + "last_updated": None, + "title": "ICON" +} + + +@router.get("/openapi") +async def get_merged_openapi_spec() -> dict: + """Combine the openapi specs from multiple data sources by using a cache.""" + now = datetime.now() + if _cache["data"] is not None and _cache["last_updated"] is not None: + elapsed_time = (now - _cache["last_updated"]).total_seconds() + if elapsed_time < config.CACHE_DURATION: + return _cache["data"] + + endpoints_suffixes = [ + 'api/v1/docs/doc.json', + 'api/v1/governance/docs/openapi.json', + 'api/v1/contracts/docs/openapi.json', + 'api/v1/statistics/docs/openapi.json', + ] + + schema_urls = get_openapi_urls(endpoint_suffixes=endpoints_suffixes, + base_url=config.OPENAPI_ENDPOINT_PREFIX) + + output = get_merged_openapi(schema_urls=schema_urls) + + # Update the cache + _cache["data"] = output + _cache["last_updated"] = now + + return output + + +def get_openapi_urls(endpoint_suffixes: List[str], base_url: str) -> List[str]: + return [f"{base_url}/{suffix}" for suffix in endpoint_suffixes] + + +def get_merged_openapi(schema_urls: List[str], title: str = _cache['title']) -> Dict: + schema_processor = OpenAPIProcessor( + fetch_schema=FetchSchema(), + resolve_schema_refs=ResolveRefs(), + validate_params=ValidateParams() + ) + schemas = schema_processor.process(schema_urls=schema_urls, title=title) + + return schemas.model_dump(by_alias=True, exclude_none=True) diff --git a/icon_stats/api/v1/router.py b/icon_stats/api/v1/router.py index 9ffabb5..827a0db 100644 --- a/icon_stats/api/v1/router.py +++ b/icon_stats/api/v1/router.py @@ -1,7 +1,8 @@ from fastapi import APIRouter -from icon_stats.api.v1.endpoints import exchanges_legacy, token_stats +from icon_stats.api.v1.endpoints import exchanges_legacy, token_stats, openapi api_router = APIRouter(prefix="/statistics") api_router.include_router(token_stats.router) api_router.include_router(exchanges_legacy.router) +api_router.include_router(openapi.router) diff --git a/icon_stats/config.py b/icon_stats/config.py index 972c78e..8411b14 100644 --- a/icon_stats/config.py +++ b/icon_stats/config.py @@ -71,6 +71,10 @@ class Settings(BaseSettings): LOG_INCLUDE_FIELDS: list[str] = ["timestamp", "message"] LOG_EXCLUDE_FIELDS: list[str] = [] + # OpenAPI Merger + CACHE_DURATION: int = 300 # In seconds - 5 min + OPENAPI_ENDPOINT_PREFIX: str = "https://tracker.icon.community" + model_config = SettingsConfigDict( case_sensitive=False, ) diff --git a/icon_stats/openapi/__init__.py b/icon_stats/openapi/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/icon_stats/openapi/operations.py b/icon_stats/openapi/operations.py new file mode 100644 index 0000000..dc5ce9e --- /dev/null +++ b/icon_stats/openapi/operations.py @@ -0,0 +1,71 @@ +from typing import Any, Dict +import requests +from pydantic import BaseModel + + +class OpenAPIOperation(BaseModel): + def execute(self, *args, **kwargs) -> Any: + pass + + +class FetchSchema(OpenAPIOperation): + def execute(self, url: str) -> Dict[str, Any]: + response = requests.get(url=url) + if response.status_code == 200: + return response.json() + else: + raise Exception( + f"Failed to Fetch URL : {url} with status code {response.status_code}") + + +class ResolveRefs(OpenAPIOperation): + def execute(self, openapi_json: Dict[str, Any], base_url: str) -> Dict[str, Any]: + def _resolve(obj, url): + if isinstance(obj, dict): + if '$ref' in obj: + ref_path = obj['$ref'] + if not ref_path.startswith('#'): + # external reference + ref_url = f"{url}/{ref_path}" + ref_response = requests.get(ref_url) + if ref_response.status_code == 200: + ref_obj = ref_response.json() + else: + raise Exception(f"Reference url={ref_url} not found.") + return _resolve(ref_obj, url) + else: + # internal reference + ref_path = ref_path.lstrip('#/') + ref_parts = ref_path.split('/') + ref_obj = openapi_json + for part in ref_parts: + ref_obj = ref_obj.get(part) + if ref_obj is None: + raise KeyError(f"Reference path not found: {ref_path}") + return _resolve(ref_obj, url) + else: + for key, value in obj.items(): + obj[key] = _resolve(value, url) + elif isinstance(obj, list): + return [_resolve(item, url) for item in obj] + return obj + + return _resolve(openapi_json, base_url) + + +class ValidateParams(OpenAPIOperation): + def execute(self, openapi_json: Dict[str, Any]) -> Dict[str, Any]: + def _validate(obj): + if isinstance(obj, dict): + if 'parameters' in obj: + for param in obj['parameters']: + if 'content' not in param and 'schema' not in param: + param['schema'] = {"type": "string"} # Default schema type + for key, value in obj.items(): + _validate(value) + elif isinstance(obj, list): + for item in obj: + _validate(item) + + _validate(openapi_json) + return openapi_json diff --git a/icon_stats/openapi/processor.py b/icon_stats/openapi/processor.py new file mode 100644 index 0000000..e6cfac0 --- /dev/null +++ b/icon_stats/openapi/processor.py @@ -0,0 +1,66 @@ +from typing import List, Dict, Any + +import requests +from pydantic import BaseModel +from openapi_pydantic import OpenAPI, Info, PathItem +from .operations import FetchSchema, ResolveRefs, ValidateParams + +IGNORED_PATHS = [ + "/health", + "/ready", + "/metadata", + "/version", +] + +SWAGGER_CONVERT = "https://converter.swagger.io/api/convert" + + +class OpenAPIProcessor(BaseModel): + fetch_schema: FetchSchema + resolve_schema_refs: ResolveRefs + validate_params: ValidateParams + + def process(self, schema_urls: List[str], title: str) -> OpenAPI: + output = OpenAPI( + info=Info( + title=title, + version="v0.0.1", + ), + paths={}, + ) + + for url in schema_urls: + base_url = url.rsplit('/', 1)[0] + openapi_json = self.fetch_schema.execute(url) + openapi_json = check_openapi_version_and_convert(schema_json=openapi_json) + openapi_json = self.resolve_schema_refs.execute( + openapi_json=openapi_json, base_url=base_url + ) + openapi_json = self.validate_params.execute(openapi_json=openapi_json) + + for path_name, operations in openapi_json['paths'].items(): + if path_name in IGNORED_PATHS: + continue + if path_name in output.paths: + raise Exception( + f"Overlapping paths not supported (TODO) - {path_name}") + output.paths[path_name] = PathItem(**operations) + + return output + + +def check_openapi_version_and_convert(schema_json: Dict[str, Any]) -> Dict: + version = schema_json.get('openapi') or schema_json.get('swagger') + if not version: + raise ValueError("The schema does not have a valid OpenAPI or Swagger version.") + + major_version = int(version.split('.')[0]) + if major_version < 3: + print(f"Converting OpenAPI version {version} to OpenAPI 3.x.x") + + response = requests.post(url=SWAGGER_CONVERT, json=schema_json) + if response.status_code == 200: + return response.json() + + else: + return schema_json diff --git a/requirements-api.txt b/requirements-api.txt index 7e225d2..8b44354 100644 --- a/requirements-api.txt +++ b/requirements-api.txt @@ -4,4 +4,6 @@ uvicorn==0.23.2 fastapi_health brotli-asgi~=1.1.0 #starlette~=0.14.2 -#starlette \ No newline at end of file +#starlette + +openapi_pydantic diff --git a/tests/conftest.py b/tests/conftest.py index 6378865..e15690d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -79,13 +79,14 @@ def get_env(self, filepath): def _set_env_from_file(self, filepath) -> list[tuple[str, str]]: """Get list of tuples from an env file to temporarily set them on tests.""" env_vars = [] - with open(filepath, "r") as f: - for line in f: - line = line.strip() # Remove leading and trailing whitespace - if line and not line.startswith("#"): # Ignore empty lines and comments - key, value = line.split("=", 1) - value = value.strip().strip('"').strip("'") - env_vars.append((key, value)) + if os.path.isfile(filepath): + with open(filepath, "r") as f: + for line in f: + line = line.strip() # Remove leading and trailing whitespace + if line and not line.startswith("#"): # Ignore empty lines and comments + key, value = line.split("=", 1) + value = value.strip().strip('"').strip("'") + env_vars.append((key, value)) return env_vars diff --git a/tests/integration/api/test_api_markets.py b/tests/integration/api/test_api_markets.py index 5f4dfc1..4980c49 100644 --- a/tests/integration/api/test_api_markets.py +++ b/tests/integration/api/test_api_markets.py @@ -4,7 +4,7 @@ def test_api_get_markets(client: TestClient): - response = client.get(f"{config.API_REST_PREFIX}/stats/exchanges/legacy") + response = client.get(f"{config.API_REST_PREFIX}/statistics/exchanges/legacy") assert response.status_code == 200 assert response.json()['data']['marketCap'] > 10000000 diff --git a/tests/openapi/icon-out.json b/tests/openapi/icon-out.json new file mode 100644 index 0000000..75a7a03 --- /dev/null +++ b/tests/openapi/icon-out.json @@ -0,0 +1,6603 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "Icon", + "version": "v0.0.1" + }, + "servers": [ + { + "url": "/" + } + ], + "paths": { + "/api/v1/governance/preps": { + "get": { + "summary": "Get Preps", + "description": "Return list of preps which is limitted to 150 records so no skip.", + "operationId": "get_preps_api_v1_governance_preps_get", + "parameters": [ + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Penalties" + }, + "name": "penalties", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Failure Count" + }, + "name": "failure_count", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Include Unregistered", + "default": false + }, + "name": "include_unregistered", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Has Public Key" + }, + "name": "has_public_key", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "In Jail" + }, + "name": "in_jail", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Sort" + }, + "name": "sort", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "name": { + "type": "string", + "title": "Name" + }, + "country": { + "type": "string", + "title": "Country" + }, + "city": { + "type": "string", + "title": "City" + }, + "email": { + "type": "string", + "title": "Email" + }, + "website": { + "type": "string", + "title": "Website" + }, + "details": { + "type": "string", + "title": "Details" + }, + "node_address": { + "type": "string", + "title": "Node Address" + }, + "public_key": { + "type": "string", + "title": "Public Key" + }, + "node_state": { + "type": "string", + "title": "Node State" + }, + "status": { + "type": "string", + "title": "Status" + }, + "penalty": { + "type": "string", + "title": "Penalty" + }, + "grade": { + "type": "string", + "title": "Grade" + }, + "last_updated_block": { + "type": "integer", + "title": "Last Updated Block" + }, + "last_updated_timestamp": { + "type": "integer", + "title": "Last Updated Timestamp" + }, + "created_block": { + "type": "integer", + "title": "Created Block" + }, + "created_timestamp": { + "type": "integer", + "title": "Created Timestamp" + }, + "logo_256": { + "type": "string", + "title": "Logo 256" + }, + "logo_1024": { + "type": "string", + "title": "Logo 1024" + }, + "logo_svg": { + "type": "string", + "title": "Logo Svg" + }, + "steemit": { + "type": "string", + "title": "Steemit" + }, + "twitter": { + "type": "string", + "title": "Twitter" + }, + "youtube": { + "type": "string", + "title": "Youtube" + }, + "facebook": { + "type": "string", + "title": "Facebook" + }, + "github": { + "type": "string", + "title": "Github" + }, + "reddit": { + "type": "string", + "title": "Reddit" + }, + "keybase": { + "type": "string", + "title": "Keybase" + }, + "telegram": { + "type": "string", + "title": "Telegram" + }, + "wechat": { + "type": "string", + "title": "Wechat" + }, + "api_endpoint": { + "type": "string", + "title": "Api Endpoint" + }, + "metrics_endpoint": { + "type": "string", + "title": "Metrics Endpoint" + }, + "p2p_endpoint": { + "type": "string", + "title": "P2P Endpoint" + }, + "server_country": { + "type": "string", + "title": "Server Country" + }, + "server_city": { + "type": "string", + "title": "Server City" + }, + "server_type": { + "type": "string", + "title": "Server Type" + }, + "voted": { + "type": "number", + "title": "Voted" + }, + "voting_power": { + "type": "number", + "title": "Voting Power" + }, + "delegated": { + "type": "number", + "title": "Delegated" + }, + "stake": { + "type": "number", + "title": "Stake" + }, + "irep": { + "type": "number", + "title": "Irep" + }, + "irep_updated_block_height": { + "type": "number", + "title": "Irep Updated Block Height" + }, + "total_blocks": { + "type": "number", + "title": "Total Blocks" + }, + "validated_blocks": { + "type": "number", + "title": "Validated Blocks" + }, + "unvalidated_sequence_blocks": { + "type": "number", + "title": "Unvalidated Sequence Blocks" + }, + "bonded": { + "type": "number", + "title": "Bonded" + }, + "bond_percent": { + "type": "number", + "title": "Bond Percent" + }, + "power": { + "type": "number", + "title": "Power" + }, + "sponsored_cps_grants": { + "type": "integer", + "title": "Sponsored Cps Grants" + }, + "cps_governance": { + "type": "boolean", + "title": "Cps Governance", + "default": false + }, + "failure_count": { + "type": "integer", + "title": "Failure Count" + }, + "penalties": { + "type": "integer", + "title": "Penalties" + }, + "reward_monthly": { + "type": "number", + "title": "Reward Monthly" + }, + "reward_monthly_usd": { + "type": "number", + "title": "Reward Monthly Usd" + }, + "reward_daily": { + "type": "number", + "title": "Reward Daily" + }, + "reward_daily_usd": { + "type": "number", + "title": "Reward Daily Usd" + }, + "stakers": { + "type": "integer", + "title": "Stakers" + }, + "bonders": { + "type": "integer", + "title": "Bonders" + }, + "jail_flags": { + "type": "string", + "title": "Jail Flags" + }, + "unjail_request_height": { + "type": "integer", + "title": "Unjail Request Height" + }, + "max_commission_change_rate": { + "type": "number", + "title": "Max Commission Change Rate" + }, + "max_commission_rate": { + "type": "number", + "title": "Max Commission Rate" + }, + "commission_rate": { + "type": "number", + "title": "Commission Rate" + }, + "min_double_sign_height": { + "type": "integer", + "title": "Min Double Sign Height" + }, + "has_public_key": { + "type": "boolean", + "title": "Has Public Key" + } + }, + "type": "object", + "required": [ + "address" + ], + "title": "Prep" + }, + "type": "array", + "title": "Response Get Preps Api V1 Governance Preps Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/preps/{address}": { + "get": { + "summary": "Get Prep", + "description": "Return a single prep.", + "operationId": "get_prep_api_v1_governance_preps__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "name": { + "type": "string", + "title": "Name" + }, + "country": { + "type": "string", + "title": "Country" + }, + "city": { + "type": "string", + "title": "City" + }, + "email": { + "type": "string", + "title": "Email" + }, + "website": { + "type": "string", + "title": "Website" + }, + "details": { + "type": "string", + "title": "Details" + }, + "node_address": { + "type": "string", + "title": "Node Address" + }, + "public_key": { + "type": "string", + "title": "Public Key" + }, + "node_state": { + "type": "string", + "title": "Node State" + }, + "status": { + "type": "string", + "title": "Status" + }, + "penalty": { + "type": "string", + "title": "Penalty" + }, + "grade": { + "type": "string", + "title": "Grade" + }, + "last_updated_block": { + "type": "integer", + "title": "Last Updated Block" + }, + "last_updated_timestamp": { + "type": "integer", + "title": "Last Updated Timestamp" + }, + "created_block": { + "type": "integer", + "title": "Created Block" + }, + "created_timestamp": { + "type": "integer", + "title": "Created Timestamp" + }, + "logo_256": { + "type": "string", + "title": "Logo 256" + }, + "logo_1024": { + "type": "string", + "title": "Logo 1024" + }, + "logo_svg": { + "type": "string", + "title": "Logo Svg" + }, + "steemit": { + "type": "string", + "title": "Steemit" + }, + "twitter": { + "type": "string", + "title": "Twitter" + }, + "youtube": { + "type": "string", + "title": "Youtube" + }, + "facebook": { + "type": "string", + "title": "Facebook" + }, + "github": { + "type": "string", + "title": "Github" + }, + "reddit": { + "type": "string", + "title": "Reddit" + }, + "keybase": { + "type": "string", + "title": "Keybase" + }, + "telegram": { + "type": "string", + "title": "Telegram" + }, + "wechat": { + "type": "string", + "title": "Wechat" + }, + "api_endpoint": { + "type": "string", + "title": "Api Endpoint" + }, + "metrics_endpoint": { + "type": "string", + "title": "Metrics Endpoint" + }, + "p2p_endpoint": { + "type": "string", + "title": "P2P Endpoint" + }, + "server_country": { + "type": "string", + "title": "Server Country" + }, + "server_city": { + "type": "string", + "title": "Server City" + }, + "server_type": { + "type": "string", + "title": "Server Type" + }, + "voted": { + "type": "number", + "title": "Voted" + }, + "voting_power": { + "type": "number", + "title": "Voting Power" + }, + "delegated": { + "type": "number", + "title": "Delegated" + }, + "stake": { + "type": "number", + "title": "Stake" + }, + "irep": { + "type": "number", + "title": "Irep" + }, + "irep_updated_block_height": { + "type": "number", + "title": "Irep Updated Block Height" + }, + "total_blocks": { + "type": "number", + "title": "Total Blocks" + }, + "validated_blocks": { + "type": "number", + "title": "Validated Blocks" + }, + "unvalidated_sequence_blocks": { + "type": "number", + "title": "Unvalidated Sequence Blocks" + }, + "bonded": { + "type": "number", + "title": "Bonded" + }, + "bond_percent": { + "type": "number", + "title": "Bond Percent" + }, + "power": { + "type": "number", + "title": "Power" + }, + "sponsored_cps_grants": { + "type": "integer", + "title": "Sponsored Cps Grants" + }, + "cps_governance": { + "type": "boolean", + "title": "Cps Governance", + "default": false + }, + "failure_count": { + "type": "integer", + "title": "Failure Count" + }, + "penalties": { + "type": "integer", + "title": "Penalties" + }, + "reward_monthly": { + "type": "number", + "title": "Reward Monthly" + }, + "reward_monthly_usd": { + "type": "number", + "title": "Reward Monthly Usd" + }, + "reward_daily": { + "type": "number", + "title": "Reward Daily" + }, + "reward_daily_usd": { + "type": "number", + "title": "Reward Daily Usd" + }, + "stakers": { + "type": "integer", + "title": "Stakers" + }, + "bonders": { + "type": "integer", + "title": "Bonders" + }, + "jail_flags": { + "type": "string", + "title": "Jail Flags" + }, + "unjail_request_height": { + "type": "integer", + "title": "Unjail Request Height" + }, + "max_commission_change_rate": { + "type": "number", + "title": "Max Commission Change Rate" + }, + "max_commission_rate": { + "type": "number", + "title": "Max Commission Rate" + }, + "commission_rate": { + "type": "number", + "title": "Commission Rate" + }, + "min_double_sign_height": { + "type": "integer", + "title": "Min Double Sign Height" + }, + "has_public_key": { + "type": "boolean", + "title": "Has Public Key" + } + }, + "type": "object", + "required": [ + "address" + ], + "title": "Prep" + }, + "type": "array", + "title": "Response Get Prep Api V1 Governance Preps Address Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/delegations/{address}": { + "get": { + "summary": "Get Delegations", + "description": "Return list of delegations.", + "operationId": "get_delegations_api_v1_governance_delegations__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 101.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 100 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "prep_address": { + "type": "string", + "title": "Prep Address" + }, + "value": { + "type": "number", + "title": "Value" + }, + "last_updated_block": { + "type": "integer", + "title": "Last Updated Block" + } + }, + "type": "object", + "required": [ + "address", + "prep_address", + "value" + ], + "title": "Delegation" + }, + "type": "array", + "title": "Response Get Delegations Api V1 Governance Delegations Address Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/votes/{address}": { + "get": { + "summary": "Get Delegations", + "description": "Return list of votes.", + "operationId": "get_delegations_api_v1_governance_votes__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 101.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 100 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "prep_address": { + "type": "string", + "title": "Prep Address" + }, + "value": { + "type": "number", + "title": "Value" + }, + "last_updated_block": { + "type": "integer", + "title": "Last Updated Block" + } + }, + "type": "object", + "required": [ + "address", + "prep_address", + "value" + ], + "title": "Delegation" + }, + "type": "array", + "title": "Response Get Delegations Api V1 Governance Votes Address Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/proposals": { + "get": { + "summary": "Get Proposals", + "description": "Return list of proposals", + "operationId": "get_proposals_api_v1_governance_proposals_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "id": { + "type": "integer", + "title": "Id" + }, + "proposer": { + "type": "string", + "title": "Proposer" + }, + "proposer_name": { + "type": "string", + "title": "Proposer Name" + }, + "status": { + "type": "string", + "title": "Status" + }, + "start_block_height": { + "type": "integer", + "title": "Start Block Height" + }, + "end_block_height": { + "type": "integer", + "title": "End Block Height" + }, + "contents_json": { + "type": "object", + "title": "Contents Json" + }, + "title": { + "type": "string", + "title": "Title" + }, + "description": { + "type": "string", + "title": "Description" + }, + "type": { + "type": "string", + "title": "Type" + }, + "agree_count": { + "type": "string", + "title": "Agree Count" + }, + "agree_amount": { + "type": "string", + "title": "Agree Amount" + }, + "disagree_count": { + "type": "string", + "title": "Disagree Count" + }, + "disagree_amount": { + "type": "string", + "title": "Disagree Amount" + }, + "no_vote_count": { + "type": "string", + "title": "No Vote Count" + }, + "no_vote_amount": { + "type": "string", + "title": "No Vote Amount" + } + }, + "type": "object", + "title": "Proposal" + }, + "type": "array", + "title": "Response Get Proposals Api V1 Governance Proposals Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/rewards/{address}": { + "get": { + "summary": "Get Delegations", + "description": "Return list of delegations.", + "operationId": "get_delegations_api_v1_governance_rewards__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 101.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 100 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "tx_hash": { + "type": "string", + "title": "Tx Hash" + }, + "address": { + "type": "string", + "title": "Address" + }, + "block": { + "type": "integer", + "title": "Block" + }, + "timestamp": { + "type": "integer", + "title": "Timestamp" + }, + "value": { + "type": "number", + "title": "Value" + }, + "iscore": { + "type": "number", + "title": "Iscore" + } + }, + "type": "object", + "required": [ + "address" + ], + "title": "Reward" + }, + "type": "array", + "title": "Response Get Delegations Api V1 Governance Rewards Address Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/stats/apy/time": { + "get": { + "summary": "Get Apy Over Time", + "description": "Return a time series of APY over time along with other governance stats like total\n delegation / stake and the governance variables needed derive APY.", + "operationId": "get_apy_over_time_api_v1_governance_stats_apy_time_get", + "parameters": [ + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Start Timestamp" + }, + "name": "start_timestamp", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "End Timestamp" + }, + "name": "end_timestamp", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 101.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 100 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "timestamp": { + "type": "integer", + "title": "Timestamp" + }, + "height": { + "type": "integer", + "title": "Height" + }, + "i_global": { + "type": "number", + "title": "I Global" + }, + "i_prep": { + "type": "number", + "title": "I Prep" + }, + "i_cps": { + "type": "number", + "title": "I Cps" + }, + "i_relay": { + "type": "number", + "title": "I Relay" + }, + "i_voter": { + "type": "number", + "title": "I Voter" + }, + "i_wage": { + "type": "number", + "title": "I Wage" + }, + "staking_apy": { + "type": "number", + "title": "Staking Apy" + }, + "prep_apy": { + "type": "number", + "title": "Prep Apy" + }, + "total_delegated": { + "type": "number", + "title": "Total Delegated" + }, + "total_stake": { + "type": "number", + "title": "Total Stake" + }, + "total_bonded": { + "type": "number", + "title": "Total Bonded" + }, + "total_power": { + "type": "number", + "title": "Total Power" + }, + "total_wage": { + "type": "number", + "title": "Total Wage" + }, + "active_preps": { + "type": "integer", + "title": "Active Preps" + } + }, + "type": "object", + "required": [ + "timestamp", + "height", + "i_global", + "i_prep", + "i_cps", + "i_relay", + "staking_apy", + "prep_apy", + "total_delegated", + "total_stake", + "total_bonded", + "total_power", + "total_wage", + "active_preps" + ], + "title": "ApyTime" + }, + "type": "array", + "title": "Response Get Apy Over Time Api V1 Governance Stats Apy Time Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/stats/commission/time": { + "get": { + "summary": "Get Commission Over Time", + "description": "Return a time series of commission statistics over time.", + "operationId": "get_commission_over_time_api_v1_governance_stats_commission_time_get", + "parameters": [ + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Start Timestamp" + }, + "name": "start_timestamp", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "End Timestamp" + }, + "name": "end_timestamp", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 1001.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 1000 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "timestamp": { + "type": "integer", + "title": "Timestamp" + }, + "height": { + "type": "integer", + "title": "Height" + }, + "commission_rate_average": { + "type": "number", + "title": "Commission Rate Average" + }, + "commission_rate_weighted_average": { + "type": "number", + "title": "Commission Rate Weighted Average" + }, + "commission_rate_median": { + "type": "number", + "title": "Commission Rate Median" + }, + "commission_rate_max": { + "type": "number", + "title": "Commission Rate Max" + }, + "commission_rate_min": { + "type": "number", + "title": "Commission Rate Min" + }, + "commission_rate_stdev": { + "type": "number", + "title": "Commission Rate Stdev" + }, + "commission_rate_weighted_stdev": { + "type": "number", + "title": "Commission Rate Weighted Stdev" + }, + "max_commission_change_rate_average": { + "type": "number", + "title": "Max Commission Change Rate Average" + }, + "max_commission_change_rate_weighted_average": { + "type": "number", + "title": "Max Commission Change Rate Weighted Average" + }, + "max_commission_change_rate_median": { + "type": "number", + "title": "Max Commission Change Rate Median" + }, + "max_commission_change_rate_max": { + "type": "number", + "title": "Max Commission Change Rate Max" + }, + "max_commission_change_rate_min": { + "type": "number", + "title": "Max Commission Change Rate Min" + }, + "max_commission_change_rate_stdev": { + "type": "number", + "title": "Max Commission Change Rate Stdev" + }, + "max_commission_change_rate_weighted_stdev": { + "type": "number", + "title": "Max Commission Change Rate Weighted Stdev" + }, + "max_commission_rate_average": { + "type": "number", + "title": "Max Commission Rate Average" + }, + "max_commission_rate_weighted_average": { + "type": "number", + "title": "Max Commission Rate Weighted Average" + }, + "max_commission_rate_median": { + "type": "number", + "title": "Max Commission Rate Median" + }, + "max_commission_rate_max": { + "type": "number", + "title": "Max Commission Rate Max" + }, + "max_commission_rate_min": { + "type": "number", + "title": "Max Commission Rate Min" + }, + "max_commission_rate_stdev": { + "type": "number", + "title": "Max Commission Rate Stdev" + }, + "max_commission_rate_weighted_stdev": { + "type": "number", + "title": "Max Commission Rate Weighted Stdev" + } + }, + "type": "object", + "required": [ + "timestamp", + "height", + "commission_rate_average", + "commission_rate_weighted_average", + "commission_rate_median", + "commission_rate_max", + "commission_rate_min", + "commission_rate_stdev", + "commission_rate_weighted_stdev", + "max_commission_change_rate_average", + "max_commission_change_rate_weighted_average", + "max_commission_change_rate_median", + "max_commission_change_rate_max", + "max_commission_change_rate_min", + "max_commission_change_rate_stdev", + "max_commission_change_rate_weighted_stdev", + "max_commission_rate_average", + "max_commission_rate_weighted_average", + "max_commission_rate_median", + "max_commission_rate_max", + "max_commission_rate_min", + "max_commission_rate_stdev", + "max_commission_rate_weighted_stdev" + ], + "title": "CommissionTime" + }, + "type": "array", + "title": "Response Get Commission Over Time Api V1 Governance Stats Commission Time Get" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/governance/stats": { + "get": { + "summary": "Get Governance Stats", + "description": "Get stats - single entry json.", + "operationId": "get_governance_stats_api_v1_governance_stats_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "timestamp": { + "type": "integer", + "title": "Timestamp" + }, + "stakers": { + "type": "integer", + "title": "Stakers" + }, + "bonders": { + "type": "integer", + "title": "Bonders" + } + }, + "type": "object", + "required": [ + "timestamp", + "stakers", + "bonders" + ], + "title": "Stats" + }, + "type": "array", + "title": "Response Get Governance Stats Api V1 Governance Stats Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/contracts": { + "get": { + "summary": "Get Contracts", + "description": "Return list of contracts", + "operationId": "get_contracts_api_v1_contracts_get", + "parameters": [ + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "title": "Skip", + "default": 0 + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer", + "exclusiveMaximum": 101.0, + "exclusiveMinimum": 0.0, + "title": "Limit", + "default": 100 + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Contract Type" + }, + "name": "contract_type", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Is Token" + }, + "name": "is_token", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean", + "title": "Is Nft" + }, + "name": "is_nft", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Token Standard" + }, + "name": "token_standard", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Status" + }, + "name": "status", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/contracts/{address}": { + "get": { + "summary": "Get Contract", + "description": "Return list of contracts", + "operationId": "get_contract_api_v1_contracts__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/contracts/social-media/{address}": { + "get": { + "summary": "Get Contract Social Media", + "description": "Return list of contracts", + "operationId": "get_contract_social_media_api_v1_contracts_social_media__address__get", + "parameters": [ + { + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string", + "title": "Address" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": {} + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "properties": { + "detail": { + "items": { + "properties": { + "loc": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Location" + }, + "msg": { + "type": "string", + "title": "Message" + }, + "type": { + "type": "string", + "title": "Error Type" + } + }, + "type": "object", + "required": [ + "loc", + "msg", + "type" + ], + "title": "ValidationError" + }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/statistics/ecosystem": { + "get": { + "summary": "Get Ecosystem Stats", + "description": "Return list of ecosystem stats.", + "operationId": "get_ecosystem_stats_api_v1_statistics_ecosystem_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "id": { + "type": "integer", + "title": "Id" + }, + "transactions_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H" + }, + "transactions_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D" + }, + "transactions_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D" + }, + "transactions_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H Prev" + }, + "transactions_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D Prev" + }, + "transactions_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D Prev" + }, + "fees_burned_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H" + }, + "fees_burned_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D" + }, + "fees_burned_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D" + }, + "fees_burned_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H Prev" + }, + "fees_burned_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D Prev" + }, + "fees_burned_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D Prev" + }, + "transaction_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 24H" + }, + "transaction_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 7D" + }, + "transaction_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 30D" + }, + "transaction_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 24H Prev" + }, + "transaction_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 7D Prev" + }, + "transaction_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 30D Prev" + }, + "token_transfers_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H" + }, + "token_transfers_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D" + }, + "token_transfers_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D" + }, + "token_transfers_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H Prev" + }, + "token_transfers_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D Prev" + }, + "token_transfers_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D Prev" + }, + "token_transfer_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 24H" + }, + "token_transfer_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 7D" + }, + "token_transfer_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 30D" + }, + "token_transfer_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 24H Prev" + }, + "token_transfer_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 7D Prev" + }, + "token_transfer_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 30D Prev" + }, + "last_updated_timestamp": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Last Updated Timestamp" + } + }, + "type": "object", + "title": "Ecosystem" + }, + "type": "array", + "title": "Response Get Ecosystem Stats Api V1 Statistics Ecosystem Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/statistics/applications": { + "get": { + "summary": "Get Application Stats", + "description": "Return list of application stats.", + "operationId": "get_application_stats_api_v1_statistics_applications_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description" + }, + "url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Url" + }, + "logo": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Logo" + }, + "transactions_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H" + }, + "transactions_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D" + }, + "transactions_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D" + }, + "transactions_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H Prev" + }, + "transactions_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D Prev" + }, + "transactions_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D Prev" + }, + "fees_burned_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H" + }, + "fees_burned_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D" + }, + "fees_burned_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D" + }, + "fees_burned_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H Prev" + }, + "fees_burned_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D Prev" + }, + "fees_burned_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D Prev" + }, + "transaction_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 24H" + }, + "transaction_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 7D" + }, + "transaction_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 30D" + }, + "transaction_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 24H Prev" + }, + "transaction_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 7D Prev" + }, + "transaction_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transaction Addresses 30D Prev" + }, + "token_transfers_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H" + }, + "token_transfers_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D" + }, + "token_transfers_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D" + }, + "token_transfers_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H Prev" + }, + "token_transfers_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D Prev" + }, + "token_transfers_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D Prev" + }, + "volume_24h": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 24H" + }, + "volume_7d": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 7D" + }, + "volume_30d": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 30D" + }, + "volume_24h_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 24H Prev" + }, + "volume_7d_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 7D Prev" + }, + "volume_30d_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 30D Prev" + }, + "token_transfer_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 24H" + }, + "token_transfer_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 7D" + }, + "token_transfer_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 30D" + }, + "token_transfer_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 24H Prev" + }, + "token_transfer_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 7D Prev" + }, + "token_transfer_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfer Addresses 30D Prev" + }, + "last_updated_timestamp": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Last Updated Timestamp" + } + }, + "type": "object", + "title": "Application" + }, + "type": "array", + "title": "Response Get Application Stats Api V1 Statistics Applications Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/statistics/contracts": { + "get": { + "summary": "Get Contract Stats", + "description": "Return list of contract stats.", + "operationId": "get_contract_stats_api_v1_statistics_contracts_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "application_id": { + "type": "string", + "title": "Application Id" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "transactions_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H" + }, + "transactions_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D" + }, + "transactions_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D" + }, + "transactions_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 24H Prev" + }, + "transactions_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 7D Prev" + }, + "transactions_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Transactions 30D Prev" + }, + "fees_burned_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H" + }, + "fees_burned_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D" + }, + "fees_burned_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D" + }, + "fees_burned_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H Prev" + }, + "fees_burned_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D Prev" + }, + "fees_burned_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D Prev" + }, + "unique_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 24H" + }, + "unique_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 7D" + }, + "unique_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 30D" + }, + "unique_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 24H Prev" + }, + "unique_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 7D Prev" + }, + "unique_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 30D Prev" + }, + "last_updated_timestamp": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Last Updated Timestamp" + } + }, + "type": "object", + "title": "Contract" + }, + "type": "array", + "title": "Response Get Contract Stats Api V1 Statistics Contracts Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/statistics/tokens": { + "get": { + "summary": "Get Token Stats", + "description": "Return list of token stats.", + "operationId": "get_token_stats_api_v1_statistics_tokens_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string", + "title": "Address" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "symbol": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Symbol" + }, + "decimals": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Decimals" + }, + "is_nft": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Is Nft" + }, + "contract_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Contract Type" + }, + "volume_24h": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 24H", + "default": 0 + }, + "volume_7d": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 7D", + "default": 0 + }, + "volume_30d": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 30D", + "default": 0 + }, + "volume_24h_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 24H Prev", + "default": 0 + }, + "volume_7d_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 7D Prev", + "default": 0 + }, + "volume_30d_prev": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Volume 30D Prev", + "default": 0 + }, + "token_transfers_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H" + }, + "token_transfers_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D" + }, + "token_transfers_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D" + }, + "token_transfers_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 24H Prev" + }, + "token_transfers_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 7D Prev" + }, + "token_transfers_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Token Transfers 30D Prev" + }, + "fees_burned_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H" + }, + "fees_burned_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D" + }, + "fees_burned_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D" + }, + "fees_burned_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 24H Prev" + }, + "fees_burned_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 7D Prev" + }, + "fees_burned_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Fees Burned 30D Prev" + }, + "unique_addresses_24h": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 24H" + }, + "unique_addresses_7d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 7D" + }, + "unique_addresses_30d": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 30D" + }, + "unique_addresses_24h_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 24H Prev" + }, + "unique_addresses_7d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 7D Prev" + }, + "unique_addresses_30d_prev": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Unique Addresses 30D Prev" + }, + "last_updated_timestamp": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Last Updated Timestamp" + } + }, + "type": "object", + "title": "Token" + }, + "type": "array", + "title": "Response Get Token Stats Api V1 Statistics Tokens Get" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/statistics/exchanges/legacy": { + "get": { + "summary": "Get Exchange Prices", + "description": "Return list of delegations.", + "operationId": "get_exchange_prices_api_v1_statistics_exchanges_legacy_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "properties": { + "result": { + "type": "integer", + "title": "Result", + "default": 200 + }, + "description": { + "type": "string", + "title": "Description", + "default": "" + }, + "totalData": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Totaldata" + }, + "data": { + "properties": { + "marketName": { + "type": "string", + "title": "Marketname" + }, + "tradeName": { + "type": "string", + "title": "Tradename" + }, + "createDate": { + "type": "string", + "format": "date-time", + "title": "Createdate" + }, + "price": { + "type": "number", + "title": "Price" + }, + "prePrice": { + "type": "number", + "title": "Preprice" + }, + "dailyRate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Dailyrate" + }, + "volume": { + "type": "number", + "title": "Volume" + }, + "marketCap": { + "type": "number", + "title": "Marketcap" + } + }, + "type": "object", + "required": [ + "marketName", + "tradeName", + "createDate", + "price", + "prePrice", + "dailyRate", + "volume", + "marketCap" + ], + "title": "ExchangesLegacyResponseData" + } + }, + "type": "object", + "required": [ + "data" + ], + "title": "ExchangesLegacyResponse" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/addresses": { + "get": { + "tags": [ + "Addresses" + ], + "summary": "Get Addresses", + "description": "get list of addresses", + "parameters": [ + { + "description": "Amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Find by address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Contract addresses only", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean" + }, + "name": "is_contract", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Token addresses only", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean" + }, + "name": "is_token", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "NFT addresses only", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean" + }, + "name": "is_nft", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Token standard, either irc2, irc3, irc31", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "token_standard", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Field to sort by. name, balance, transaction_count, transaction_internal_count, token_transfer_count. Use leading `-` (ie -balance) for sort direction or omit for descending.", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "sort", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string" + }, + "balance": { + "type": "number" + }, + "is_contract": { + "type": "boolean" + }, + "is_nft": { + "type": "boolean" + }, + "is_token": { + "type": "boolean" + }, + "token_standard": { + "type": "string" + }, + "transaction_count": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/addresses/contracts": { + "get": { + "tags": [ + "Addresses" + ], + "summary": "Get contracts", + "description": "get list of contracts", + "parameters": [ + { + "description": "contract name search", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "search", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "tokens only", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean" + }, + "name": "is_token", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "NFTs only", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "boolean" + }, + "name": "is_nft", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "token standard, one of irc2,irc3,irc31", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "token_standard", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "contract status, one of active, rejected, or pending", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "status", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "Field to sort by. name, balance, transaction_count, transaction_internal_count, token_transfer_count. Use leading `-` (ie -balance) for sort direction or omit for descending.", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "sort", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string" + }, + "balance": { + "type": "number" + }, + "created_timestamp": { + "type": "integer" + }, + "is_token": { + "type": "boolean" + }, + "log_count": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "token_standard": { + "type": "string" + }, + "transaction_count": { + "type": "integer" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/addresses/details/{address}": { + "get": { + "tags": [ + "Addresses" + ], + "summary": "Get Address Details", + "description": "get details of an address", + "parameters": [ + { + "description": "find by address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "address": { + "type": "string" + }, + "audit_tx_hash": { + "type": "string" + }, + "balance": { + "type": "number" + }, + "code_hash": { + "type": "string" + }, + "contract_type": { + "type": "string" + }, + "contract_updated_block": { + "type": "integer" + }, + "created_timestamp": { + "type": "integer" + }, + "deploy_tx_hash": { + "type": "string" + }, + "is_contract": { + "type": "boolean" + }, + "is_nft": { + "type": "boolean" + }, + "is_prep": { + "type": "boolean" + }, + "is_token": { + "type": "boolean" + }, + "log_count": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "status": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "token_standard": { + "type": "string" + }, + "token_transfer_count": { + "type": "integer" + }, + "transaction_count": { + "type": "integer" + }, + "transaction_internal_count": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/addresses/token-addresses/{address}": { + "get": { + "tags": [ + "Addresses" + ], + "summary": "Get Token Addresses", + "description": "get list of token contracts by address", + "parameters": [ + { + "description": "address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "type": "string" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/blocks": { + "get": { + "tags": [ + "Blocks" + ], + "summary": "Get Blocks", + "description": "get historical blocks", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "range by start block number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "start_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "range by end block number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "end_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block hash", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "hash", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block creator", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "created_by", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "desc or asc", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "sort", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "hash": { + "type": "string" + }, + "number": { + "type": "integer" + }, + "peer_id": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "transaction_amount": { + "type": "string" + }, + "transaction_count": { + "type": "integer" + }, + "transaction_fees": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/blocks/timestamp/{timestamp}": { + "get": { + "tags": [ + "Blocks" + ], + "summary": "Get Block Details By Nearest Timestamp", + "description": "get details of a block based on timestamp in millisecond epoch time", + "parameters": [ + { + "description": "timestamp", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "timestamp", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "block_time": { + "type": "integer" + }, + "failed_transaction_count": { + "type": "integer" + }, + "hash": { + "type": "string" + }, + "internal_transaction_amount": { + "type": "string" + }, + "internal_transaction_count": { + "type": "integer" + }, + "item_id": { + "type": "string" + }, + "item_timestamp": { + "type": "string" + }, + "merkle_root_hash": { + "type": "string" + }, + "next_leader": { + "type": "string" + }, + "number": { + "type": "integer" + }, + "parent_hash": { + "type": "string" + }, + "peer_id": { + "type": "string" + }, + "signature": { + "type": "string", + "description": "Base" + }, + "timestamp": { + "type": "integer" + }, + "transaction_amount": { + "type": "string" + }, + "transaction_count": { + "type": "integer" + }, + "transaction_fees": { + "type": "string" + }, + "type": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/blocks/{number}": { + "get": { + "tags": [ + "Blocks" + ], + "summary": "Get Block Details", + "description": "get details of a block", + "parameters": [ + { + "description": "block number", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "number", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "block_time": { + "type": "integer" + }, + "failed_transaction_count": { + "type": "integer" + }, + "hash": { + "type": "string" + }, + "internal_transaction_amount": { + "type": "string" + }, + "internal_transaction_count": { + "type": "integer" + }, + "item_id": { + "type": "string" + }, + "item_timestamp": { + "type": "string" + }, + "merkle_root_hash": { + "type": "string" + }, + "next_leader": { + "type": "string" + }, + "number": { + "type": "integer" + }, + "parent_hash": { + "type": "string" + }, + "peer_id": { + "type": "string" + }, + "signature": { + "type": "string", + "description": "Base" + }, + "timestamp": { + "type": "integer" + }, + "transaction_amount": { + "type": "string" + }, + "transaction_count": { + "type": "integer" + }, + "transaction_fees": { + "type": "string" + }, + "type": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/logs": { + "get": { + "tags": [ + "Logs" + ], + "summary": "Get Logs", + "description": "get historical logs", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a block", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "For block range queries, a start block. Invalid with block_number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "block_start", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "For block range queries, an end block. Invalid with block_number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "block_end", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by transaction hash", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "transaction_hash", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by method", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "method", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "indexed": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "method": { + "type": "string" + }, + "transaction_hash": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/stats": { + "get": { + "tags": [ + "Stats" + ], + "summary": "Get Stats", + "description": "get json with a summary of stats", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/stats/circulating-supply": { + "get": { + "tags": [ + "Stats" + ], + "summary": "Get Stats", + "description": "get circulating supply (total supply - burn wallet balance)", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/stats/market-cap": { + "get": { + "tags": [ + "Stats" + ], + "summary": "Get Stats", + "description": "get mkt cap (Coin Gecko Price * circulating supply)", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/stats/total-supply": { + "get": { + "tags": [ + "Stats" + ], + "summary": "Get Stats", + "description": "get total supply", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/supplies": { + "get": { + "tags": [ + "Supplies" + ], + "summary": "Get Supplies", + "description": "get json with a summary of stats", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/supplies/circulating-supply": { + "get": { + "tags": [ + "Supplies" + ], + "summary": "Get Supplies", + "description": "get circulating supply (total supply - burn wallet balance)", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/supplies/market-cap": { + "get": { + "tags": [ + "Supplies" + ], + "summary": "Get Supplies", + "description": "get mkt cap (Coin Gecko Price * circulating supply)", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/supplies/total-supply": { + "get": { + "tags": [ + "Supplies" + ], + "summary": "Get Supplies", + "description": "get total supply", + "responses": { + "200": { + "description": "OK", + "content": { + "*/*": { + "schema": { + "type": "number" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "*/*": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get Transactions", + "description": "get historical transactions", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by from address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "from", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by to address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "to", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by type", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "type", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number range", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "start_block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number range", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "end_block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by method", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "method", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "desc or asc", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "sort", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "CSV Response", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/address/{address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get Transactions by address", + "description": "get transactions by address", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "method": { + "type": "string" + }, + "status": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_type": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/block-number/{block_number}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get Transactions by block_number", + "description": "get transactions by block_number", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "block_number", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "block_number", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "method": { + "type": "string" + }, + "status": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_type": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/details/{hash}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get Transaction", + "description": "get details of a transaction", + "parameters": [ + { + "description": "transaction hash", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "hash", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "properties": { + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "cumulative_step_used": { + "type": "string" + }, + "data": { + "type": "string" + }, + "data_type": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "log_count": { + "type": "integer" + }, + "log_index": { + "type": "integer" + }, + "logs_bloom": { + "type": "string" + }, + "method": { + "type": "string" + }, + "nid": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "score_address": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "status": { + "type": "string" + }, + "step_limit": { + "type": "string" + }, + "step_price": { + "type": "string" + }, + "step_used": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "to_address": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + }, + "version": { + "type": "string" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/icx/{address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get ICX Transactions by Address", + "description": "get ICX transactions to or from an address", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "cumulative_step_used": { + "type": "string" + }, + "data": { + "type": "string" + }, + "data_type": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "log_count": { + "type": "integer" + }, + "log_index": { + "type": "integer" + }, + "logs_bloom": { + "type": "string" + }, + "method": { + "type": "string" + }, + "nid": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "score_address": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "status": { + "type": "string" + }, + "step_limit": { + "type": "string" + }, + "step_price": { + "type": "string" + }, + "step_used": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "to_address": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + }, + "version": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/internal/address/{address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get internal transactions by address", + "description": "Get internal transactions by address", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "method": { + "type": "string" + }, + "status": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/internal/block-number/{block_number}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get internal transactions by block number", + "description": "Get internal transactions by block number", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "block_number", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "block_number", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "method": { + "type": "string" + }, + "status": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/internal/{hash}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get internal transactions by hash", + "description": "Get internal transactions by hash", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by hash", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "hash", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_hash": { + "type": "string" + }, + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "data": { + "type": "string" + }, + "from_address": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "method": { + "type": "string" + }, + "status": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/token-holders/token-contract/{token_contract_address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get token holders by token contract", + "description": "get token holders", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by token contract address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "token_contract_address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "address": { + "type": "string" + }, + "balance": { + "type": "number" + }, + "token_contract_address": { + "type": "string" + }, + "token_standard": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/token-transfers": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get token transfers", + "description": "get historical token transfers", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by from address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "from", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by to address", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "to", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number range", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "start_block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by block number range", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "end_block_number", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by token contract", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "token_contract_address", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by transaction hash", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "transaction_hash", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "from_address": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "nft_id": { + "type": "integer" + }, + "to_address": { + "type": "string" + }, + "token_contract_address": { + "type": "string" + }, + "token_contract_name": { + "type": "string" + }, + "token_contract_symbol": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_hash": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/token-transfers/address/{address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get token transfer by address", + "description": "get historical token transfers by address", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "from_address": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "nft_id": { + "type": "integer" + }, + "to_address": { + "type": "string" + }, + "token_contract_address": { + "type": "string" + }, + "token_contract_name": { + "type": "string" + }, + "token_contract_symbol": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_hash": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + }, + "/api/v1/transactions/token-transfers/token-contract/{token_contract_address}": { + "get": { + "tags": [ + "Transactions" + ], + "summary": "Get token transfers by token contract", + "description": "get historical token transfers by token contract", + "parameters": [ + { + "description": "amount of records", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "limit", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "skip to a record", + "required": false, + "deprecated": false, + "explode": false, + "schema": { + "type": "integer" + }, + "name": "skip", + "in": "query", + "allowEmptyValue": false, + "allowReserved": false + }, + { + "description": "find by token contract address", + "required": true, + "deprecated": false, + "explode": false, + "schema": { + "type": "string" + }, + "name": "token_contract_address", + "in": "path", + "allowEmptyValue": false, + "allowReserved": false + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "items": { + "properties": { + "block_number": { + "type": "integer" + }, + "block_timestamp": { + "type": "integer" + }, + "from_address": { + "type": "string" + }, + "log_index": { + "type": "integer" + }, + "nft_id": { + "type": "integer" + }, + "to_address": { + "type": "string" + }, + "token_contract_address": { + "type": "string" + }, + "token_contract_name": { + "type": "string" + }, + "token_contract_symbol": { + "type": "string" + }, + "transaction_fee": { + "type": "string" + }, + "transaction_hash": { + "type": "string" + }, + "transaction_index": { + "type": "integer" + }, + "value": { + "type": "string" + }, + "value_decimal": { + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "additionalProperties": true, + "type": "object" + } + } + } + } + }, + "deprecated": false + } + } + } +} \ No newline at end of file diff --git a/tests/openapi/test_openapi_merger.py b/tests/openapi/test_openapi_merger.py new file mode 100644 index 0000000..ffe695b --- /dev/null +++ b/tests/openapi/test_openapi_merger.py @@ -0,0 +1,112 @@ +import pytest +import json + +from unittest.mock import patch, Mock + +from icon_stats.api.v1.endpoints.openapi import get_merged_openapi +from icon_stats.openapi.operations import FetchSchema, ResolveRefs, ValidateParams +from icon_stats.openapi.processor import OpenAPIProcessor + + +def test_fetch_schema(): + with patch("requests.get") as mock_get: + mock_get.return_value.status_code = 200 + mock_get.return_value.json.return_value = {"openapi": "3.0.0"} + + fetch_schema = FetchSchema() + result = fetch_schema.execute("http://example.com/schema.json") + + assert result == {"openapi": "3.0.0"} + mock_get.assert_called_once_with(url="http://example.com/schema.json") + + +def test_fetch_schema_error(): + with patch("requests.get") as mock_get: + mock_get.return_value.status_code = 404 + + fetch_schema = FetchSchema() + with pytest.raises(Exception, match="Failed to Fetch URL"): + fetch_schema.execute("http://example.com/schema.json") + + +def test_resolve_refs(): + mock_schema = { + "components": {"schemas": {"Test": {"type": "object"}}}, + "paths": { + "/test": { + "get": { + "responses": { + "200": { + "content": { + "application/json": { + "schema": {"$ref": "#/components/schemas/Test"} + } + } + } + } + } + } + }, + } + + resolve_refs = ResolveRefs() + result = resolve_refs.execute(mock_schema, "http://example.com") + + assert result["paths"]["/test"]["get"]["responses"]["200"]["content"][ + "application/json" + ]["schema"] == {"type": "object"} + + +def test_validate_params(): + mock_schema = { + "paths": {"/test": {"get": {"parameters": [{"name": "param", "in": "query"}]}}} + } + + validate_params = ValidateParams() + result = validate_params.execute(mock_schema) + + assert result["paths"]["/test"]["get"]["parameters"][0]["schema"] == { + "type": "string" + } + + +def test_openapi_processor(): + with patch("requests.get") as mock_get, patch("requests.post") as mock_post: + mock_get.return_value.status_code = 200 + mock_get.return_value.json.return_value = { + "openapi": "3.0.0", + "info": {"title": "Test API", "version": "1.0.0"}, + "paths": { + "/test": { + "get": { + "summary": "Test endpoint", + "responses": {"200": {"description": "Successful response"}}, + } + } + }, + } + + processor = OpenAPIProcessor( + fetch_schema=FetchSchema(), + resolve_schema_refs=ResolveRefs(), + validate_params=ValidateParams(), + ) + + result = processor.process(["http://example.com/schema.json"], "Combined API") + + assert result.info.title == "Combined API" + assert "/test" in result.paths + assert result.paths["/test"].get.summary == "Test endpoint" + + +def test_generate_output(): + schema_urls = [ + "https://tracker.icon.community/api/v1/governance/docs/openapi.json", + "https://tracker.icon.community/api/v1/contracts/docs/openapi.json", + "https://tracker.icon.community/api/v1/statistics/docs/openapi.json", + "https://tracker.icon.community/api/v1/docs/doc.json", + ] + schema_json_openapi = get_merged_openapi(schema_urls, title="Icon") + + with open("icon-out.json", "w") as f: + json.dump(schema_json_openapi, f, indent=2) \ No newline at end of file