The Graph Integration
Leet Lotto has partnered with The Graph protocol to introduce a decentralized indexing solution for our platform.
Every ticket, draw and prize moves through a dedicated subgraph for fast, queryable data.
Data Flow
Smart Contracts emit events (
TicketBought
,WinnerDeclared
).Subgraph Mapping ingests events and writes to indexed entities.
Frontend uses
@tanstack/react-query
to hit the GraphQL endpoint and cache results.
// â ī¸ Simplified example
export const useActiveLottos = () =>
useQuery({
queryKey: ["lottos", "active"],
queryFn: getActiveLottos() // Graph query function
refetchInterval: 30000, // 30 s
});
Benefits
<30 s dashboard refresh
Zero over-fetching â only pull the fields you need
Seamless optimistic updates on ticket purchase
Last updated