Skip to content

Commit

Permalink
Simplify queries for /tokens and default transfers (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h authored Jun 13, 2024
1 parent 0904087 commit c80a126
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use
} else if (endpoint == "/head") {
query += `SELECT MAX(block_num) as block_num FROM cursors ${filters} GROUP BY id`;
} else if (endpoint == "/transfers/{trx_id}") {
query += `SELECT * FROM transfer_events FINAL ${filters}`;
} else {
query += `SELECT DISTINCT *, updated_at_block_num AS block_num FROM eos_tokens_v1.token_supplies FINAL ${filters}`;
query += `SELECT * FROM transfer_events ${filters}`;
} else if (endpoint == "/tokens") {
query += `SELECT *, updated_at_block_num AS block_num FROM eos_tokens_v1.token_supplies FINAL ${filters}`;
}

query += endpoint == "/holders" ? " ORDER BY value DESC" : " ORDER BY block_num DESC";
Expand Down

0 comments on commit c80a126

Please sign in to comment.