Build a live Astar NFT activity feed
GET /v1/activity returns the newest canonical events first. Filter by collection or event type when the product has a narrower purpose.
curl -sS \ -H "Authorization: Bearer $ARADIA_API_TOKEN" \ "https://api.aradia.app/v1/activity?limit=50&event_type=transfer"const seen = new Set();
async function pollActivity(token) { const response = await fetch("https://api.aradia.app/v1/activity?limit=50", { headers: { Authorization: `Bearer ${token}` }, }); if (!response.ok) throw new Error(`Activity failed: ${response.status}`); const page = await response.json(); return page.data.filter((event) => { const identity = `${event.transaction_hash}:${event.log_index}`; if (seen.has(identity)) return false; seen.add(identity); return true; });}import requests
seen = set()
def poll_activity(token): response = requests.get( "https://api.aradia.app/v1/activity", params={"limit": 50}, headers={"Authorization": f"Bearer {token}"}, timeout=30, ) response.raise_for_status() fresh = [] for event in response.json()["data"]: identity = (event["transaction_hash"], event["log_index"]) if identity not in seen: seen.add(identity) fresh.append(event) return freshPoll without wasting quota
Section titled “Poll without wasting quota”Start with a 12-second interval, close to Astar’s block time, and pause when the page is hidden. Keep a bounded set of recent transaction_hash plus log_index identities so every event is rendered once.
For older history, follow before_timestamp and before_id. For new events, request the first page again and deduplicate locally.
