Skip to content

Commit

Permalink
chore[demo-app]: Add better log messages when waiting. Writing submis…
Browse files Browse the repository at this point in the history
…sion data to file
  • Loading branch information
akileshtangella committed Nov 15, 2024
1 parent 3ce9c60 commit a9436ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/demo-app/core/src/submitOffchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const { loadWallet, upaFromInstanceFile } = config;
import * as ethers from "ethers";
import { command, number, option, optional, string } from "cmd-ts";
import { DemoApp__factory } from "../typechain-types";
import * as fs from "fs";

const {
OffChainClient,
Expand Down Expand Up @@ -174,18 +175,24 @@ export const submitOffchain = command({
wallet,
depositContract
);
console.log(`Sending submission: ${utils.JSONstringify(submission)}`);
console.log(`Sending submission: ${submissionId}`);
fs.writeFileSync(`${submissionId}.json`, utils.JSONstringify(submission));
console.log(`Full submission data written to ${submissionId}.json`);

const response = await client.submit(submission);
response as unknown;

// TODO: write response to file
console.log("Aggregator response:");
console.log(utils.JSONstringify(response));
console.log("Waiting for submission to be verified...");

// Wait for the submission to be verified
const upa = await upaFromInstanceFile(upaInstance, provider);
await waitForSubmissionVerified(upa, submission.submissionId);

console.log("Submission successfully aggregated!");

const demoApp = DemoApp__factory.connect(demoAppInstance.demoApp).connect(
wallet
);
Expand Down

0 comments on commit a9436ae

Please sign in to comment.