Skip to content

Commit

Permalink
feat: make commitmentKey non-hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWhite2357 committed Nov 21, 2024
1 parent 1741382 commit f10a02a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions chainlink-functions/example/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion chainlink-functions/source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion chainlink-functions/source/index_tail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f10a02a

Please sign in to comment.