Skip to content

Commit

Permalink
fix blocks SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Mar 12, 2024
1 parent 62936b9 commit 9137be7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sql/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ export async function blocks(req: Request) {
const chain = getChain(req, false);
const module_hash = getModuleHash(req, false);
const WHERE = [];
if ( chain ) WHERE.push(`chain = ${chain}`);
if ( module_hash ) WHERE.push(`module_hash = ${module_hash}`);
if ( chain ) WHERE.push(`chain = '${chain}'`);
if ( module_hash ) WHERE.push(`module_hash = '${module_hash}'`);
if ( WHERE.length ) query += " WHERE " + WHERE.join(" AND ");
query += "GROUP BY (chain, module_hash)";
query += "\nGROUP BY (chain, module_hash)";
console.log(query);

const response = await readOnlyClient.query({ query_params: {chain, module_hash}, query, format: "JSONEachRow" });
let data = await response.json() as BlockResponseSchema[];
Expand Down

0 comments on commit 9137be7

Please sign in to comment.