Skip to content

Commit

Permalink
update to new Table format (block,timestamp)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Lefebvre committed Nov 8, 2023
1 parent 0b6a68d commit 88c8b30
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
9 changes: 0 additions & 9 deletions src/queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ test("getContracts", () => {
formatSQL(`SELECT * FROM Contracts`)
);

expect(formatSQL(getContracts(parameter))).toContain(
formatSQL(`JOIN blocks ON blocks.block_id = Contracts.block_id`)
);

expect(formatSQL(getContracts(parameter))).toContain(
formatSQL(`WHERE (chain == '${chain}' AND address == '${address}')`)
Expand Down Expand Up @@ -107,9 +104,6 @@ test("getTotalSupply", () => {
formatSQL(`FROM TotalSupply`)
);

expect(formatSQL(getTotalSupply(parameters))).toContain(
formatSQL(`JOIN blocks ON blocks.block_id = TotalSupply.block_id`)
);

expect(formatSQL(getTotalSupply(parameters))).toContain(
formatSQL(`LEFT JOIN Contracts ON Contracts.address = TotalSupply.address`)
Expand Down Expand Up @@ -167,9 +161,6 @@ test("getBalanceChabge", () => {
formatSQL(`FROM balance_changes`)
);

expect(formatSQL(getBalanceChanges(parameters))).toContain(
formatSQL(`JOIN blocks ON blocks.block_id = balance_changes.block_id`)
);

expect(formatSQL(getBalanceChanges(parameters))).toContain(
formatSQL(
Expand Down
7 changes: 1 addition & 6 deletions src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export function getTotalSupply(searchParams: URLSearchParams, example?: boolean)
FROM ${table} `;


// JOIN block table
query += ` JOIN blocks ON blocks.block_id = ${table}.block_id`;
// JOIN Contracts table
query += ` LEFT JOIN Contracts ON ${contractTable}.address = ${table}.address`;
if (!example) {
// WHERE statements
Expand Down Expand Up @@ -86,8 +85,6 @@ export function getContracts(searchParams: URLSearchParams, example?: boolean) {
let query = `SELECT * FROM ${table} `


// JOIN block table
query += ` JOIN blocks ON blocks.block_id = ${table}.block_id`;
if (!example) {
// WHERE statements
const where = [];
Expand Down Expand Up @@ -136,8 +133,6 @@ export function getBalanceChanges(searchParams: URLSearchParams, example?: boole
timestamp
FROM ${table} `;

// JOIN block table
query += ` JOIN blocks ON blocks.block_id = ${table}.block_id`;
query += ` LEFT JOIN Contracts ON ${contractTable}.address = ${table}.contract`;

if (!example) {
Expand Down

0 comments on commit 88c8b30

Please sign in to comment.