From 91a831dcf45370f6b1f92d87d7f5b62d93b193c3 Mon Sep 17 00:00:00 2001 From: Harman-singh-waraich Date: Thu, 30 May 2024 10:27:51 +0530 Subject: [PATCH] fix: add-headers-for-subgraph-fetch-query --- src/light-gtcr-execution.ts | 8 +++++++- src/light-gtcr-withdrawal.ts | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/light-gtcr-execution.ts b/src/light-gtcr-execution.ts index 6268627..0a2477a 100644 --- a/src/light-gtcr-execution.ts +++ b/src/light-gtcr-execution.ts @@ -29,6 +29,9 @@ async function run(signer: ethers.Wallet) { response = await fetch(process.env.GTCR_SUBGRAPH_URL, { method: "POST", body: JSON.stringify(subgraphQuery), + headers: { + "Content-Type": "application/json", + }, }); const parsed = await response.json(); @@ -76,7 +79,10 @@ async function run(signer: ethers.Wallet) { `Executing request for item ID ${request.item.itemID}`.green ); // pass gas requirement manually for arbitrum rinkeby compatibility - await tcr.executeRequest(request.item.itemID, { nonce, gasLimit: 2_100_000 }); + await tcr.executeRequest(request.item.itemID, { + nonce, + gasLimit: 2_100_000, + }); await delay(120 * 1000); // Wait 2 minutes to give time for the chain to sync/nonce handling. } catch (error) { console.error( diff --git a/src/light-gtcr-withdrawal.ts b/src/light-gtcr-withdrawal.ts index ec8eb8e..c27d87a 100644 --- a/src/light-gtcr-withdrawal.ts +++ b/src/light-gtcr-withdrawal.ts @@ -23,6 +23,9 @@ async function run(batchWithdraw: ethers.Contract, signer: ethers.Wallet) { response = await fetch(process.env.GTCR_SUBGRAPH_URL, { method: "POST", body: JSON.stringify(subgraphQuery), + headers: { + "Content-Type": "application/json", + }, }); const parsed = await response.json();