Перейти до вмісту

Indexer API

Цей контент ще не доступний вашою мовою.

The indexer reads every contract event into a database and serves it over HTTP. Use it for anything that needs history: charts, activity feeds, claims of an address, past draws.

https://api.tako.wtf
  • API reference: every route with its parameters and response schema, generated from the indexer’s code.

  • Playground: send requests from the browser and see live responses.

  • OpenAPI document: import it into Postman, Insomnia or a client generator. The API also serves it at /openapi.json.

  • All amounts are nanoGram as strings, times are unix seconds, addresses are user-friendly.

  • Every response is cached for 5 seconds and sends a matching Cache-Control.

  • Lists are newest first. Page with before: pass the lt of the last item you got.

Route Returns
GET /health time of the last snapshot and the last event
GET /v1/pool rate, supply, TVL, queued claims, lent, insurance, bad debt, APR and APY over 7 and 30 days
GET /v1/pool/history?days=30 one point per day: rate, TVL, lent
GET /v1/reserves assets, liabilities to holders and claims, reserved collateral and insurance, surplus, and whether liabilities are covered
GET /v1/defillama/tvl TVL in Gram
GET /openapi.json the OpenAPI 3.1 document
Route Returns
GET /v1/events?name=&before=&limit= every event; filter by name
GET /v1/accounts/:address/events events of one address
GET /v1/accounts/:address/claims that address’s claims with status and payout
GET /v1/claims/:index one claim

Event names: deposit, unstake, redeem, profit, round_decided, loan_requested, loan_funded, loan_settled, keeper_paid, vault_deposit, vault_withdraw, prize, draw_closed, draw_revealed, migration_started, migrated, migration_refunded, migration_stranded, proposal_scheduled, proposal_executed, proposal_cancelled, proposal_bounced.

Route Returns
GET /v1/rounds?before=&limit= validation rounds: bids, funded loans, lent, what the pool earned
GET /v1/rounds/:round one round with every bid and loan and its status
GET /v1/accounts/:address/loans loans of one validator
Route Returns
GET /v1/vaults every prize vault with its latest state
GET /v1/draws?vault=&limit= draws with the drand round, randomness, tickets and prize totals
GET /v1/vaults/:address/draws/:id one draw with every prize
GET /v1/prizes prize events

GET /v1/stream sends every new event as Server-Sent Events, oldest first. Filter with name (comma separated), owner or account.

const events = new EventSource('https://api.tako.wtf/v1/stream?name=prize');
events.addEventListener('prize', (e) => {
const prize = JSON.parse(e.data); // the same object as in /v1/events
console.log(prize.owner, prize.data.shares);
});

Each message has event: <name>, id: <lt>:<index> and the event in data. After a dropped connection the browser reconnects with the last id, and the stream resends what was missed, up to 1,000 events; clients without EventSource pass after=<lt>:<index>. A comment line every 15 seconds keeps the connection open through proxies.

Route Returns
GET /v1/proposals timelock proposals with the call they make and their status
Terminal window
curl -s https://api.tako.wtf/v1/pool | jq '{rate, tvl, apr}'