85 lines
2.4 KiB
Python
85 lines
2.4 KiB
Python
from fastapi import APIRouter, Cookie
|
|
|
|
from app.db.onchain_db import (
|
|
get_onchain_overview,
|
|
get_onchain_provider_status,
|
|
get_onchain_token_detail,
|
|
list_onchain_events,
|
|
list_onchain_raw_events,
|
|
list_onchain_tokens,
|
|
)
|
|
from app.web.shared import require_api_user_with_subscription
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/api/onchain/overview")
|
|
async def api_onchain_overview(hours: int = 24, altcoin_session: str = Cookie(default="")):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return get_onchain_overview(hours=hours)
|
|
|
|
|
|
@router.get("/api/onchain/provider-status")
|
|
async def api_onchain_provider_status(hours: int = 24, altcoin_session: str = Cookie(default="")):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return get_onchain_provider_status(hours=hours)
|
|
|
|
|
|
@router.get("/api/onchain/tokens")
|
|
async def api_onchain_tokens(
|
|
limit: int = 30,
|
|
offset: int = 0,
|
|
chain: str = "",
|
|
signal: str = "",
|
|
hours: int = 24,
|
|
altcoin_session: str = Cookie(default=""),
|
|
):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return list_onchain_tokens(limit=limit, offset=offset, chain=chain, signal=signal, hours=hours)
|
|
|
|
|
|
@router.get("/api/onchain/tokens/{symbol:path}")
|
|
async def api_onchain_token_detail(symbol: str, hours: int = 72, altcoin_session: str = Cookie(default="")):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return get_onchain_token_detail(symbol=symbol, hours=hours)
|
|
|
|
|
|
@router.get("/api/onchain/events")
|
|
async def api_onchain_events(
|
|
limit: int = 50,
|
|
offset: int = 0,
|
|
chain: str = "",
|
|
signal: str = "",
|
|
status: str = "",
|
|
hours: int = 24,
|
|
altcoin_session: str = Cookie(default=""),
|
|
):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return list_onchain_events(limit=limit, offset=offset, chain=chain, signal=signal, status=status, hours=hours)
|
|
|
|
|
|
@router.get("/api/onchain/raw-events")
|
|
async def api_onchain_raw_events(
|
|
limit: int = 50,
|
|
offset: int = 0,
|
|
chain: str = "",
|
|
source: str = "",
|
|
event_type: str = "",
|
|
mapping_status: str = "",
|
|
priority: str = "",
|
|
hours: int = 24,
|
|
altcoin_session: str = Cookie(default=""),
|
|
):
|
|
require_api_user_with_subscription(altcoin_session)
|
|
return list_onchain_raw_events(
|
|
limit=limit,
|
|
offset=offset,
|
|
chain=chain,
|
|
source=source,
|
|
event_type=event_type,
|
|
mapping_status=mapping_status,
|
|
priority=priority,
|
|
hours=hours,
|
|
)
|