From 9137be7d351c4e9aa9141e2d79c20f56303921a1 Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Mon, 11 Mar 2024 22:50:32 -0400 Subject: [PATCH] fix blocks SQL --- sql/blocks.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/blocks.ts b/sql/blocks.ts index 1e21fcb..de485d4 100644 --- a/sql/blocks.ts +++ b/sql/blocks.ts @@ -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[];