diff --git a/chainlink-functions/example/source.js b/chainlink-functions/example/source.js index d9d1405..93b25fc 100644 --- a/chainlink-functions/example/source.js +++ b/chainlink-functions/example/source.js @@ -6,9 +6,6 @@ const SxTSDK = await import( // Define test parameters const queryString = "SELECT SUM(BLOCK_NUMBER), COUNT(*) FROM ETHEREUM.BLOCKS"; const table = "ETHEREUM.BLOCKS"; -// TODO: This is currently hardcoded. But, we need to make it dynamic. -const commitmentKey = - "0xca407206ec1ab726b2636c4b145ac28749505e273536fae35330b966dac69e86a4832a125c0464e066dd20add960efb518424c4f434b5320455448455245554d4a9e6f9b8d43f6ad008f8c291929dee201"; if (!secrets.apiKey) { throw Error("Missing secret: apiKey"); @@ -24,7 +21,7 @@ const proof = new SxTSDK.SxTClient( try { // Kick off the proof and await execution - const result = await proof.queryAndVerify(queryString, table, commitmentKey); + const result = await proof.queryAndVerify(queryString, table); console.log("Workflow completed successfully:", result); return Functions.encodeString("Verified"); } catch (error) { diff --git a/chainlink-functions/source/index.js b/chainlink-functions/source/index.js index ad13e05..a5f3ea5 100644 --- a/chainlink-functions/source/index.js +++ b/chainlink-functions/source/index.js @@ -473,7 +473,8 @@ export class SxTClient { return proverResponse.json(); } - async queryAndVerify(queryString, table, commitmentKey) { + async queryAndVerify(queryString, table) { + const commitmentKey = "0x" + commitment_storage_key_dory(table); const authResponse = await this.#getAccessToken(); const accessToken = authResponse.accessToken; const commitmentResponse = await this.#getCommitment(commitmentKey); diff --git a/chainlink-functions/source/index_tail.js b/chainlink-functions/source/index_tail.js index 99dd861..07f8c8b 100644 --- a/chainlink-functions/source/index_tail.js +++ b/chainlink-functions/source/index_tail.js @@ -66,7 +66,8 @@ export class SxTClient { return proverResponse.json(); } - async queryAndVerify(queryString, table, commitmentKey) { + async queryAndVerify(queryString, table) { + const commitmentKey = "0x" + commitment_storage_key_dory(table); const authResponse = await this.#getAccessToken(); const accessToken = authResponse.accessToken; const commitmentResponse = await this.#getCommitment(commitmentKey);