Skip to content

Commit

Permalink
Merge pull request #124 from pinax-network/fix/blocks
Browse files Browse the repository at this point in the history
fix blocks SQL
  • Loading branch information
DenisCarriere authored Mar 12, 2024
2 parents 62936b9 + 9137be7 commit 6b1ab56
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 6b1ab56

Please sign in to comment.