Skip to content

Commit

Permalink
js fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dark64 committed Aug 1, 2023
1 parent 8c88527 commit b357269
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions zokrates_js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ declare module "zokrates-js" {

export type ResolveCallback = (
location: string,
path: string
path: string,
) => ResolverResult;

export interface CompileConfig {
Expand Down Expand Up @@ -78,12 +78,12 @@ declare module "zokrates-js" {
withOptions(options: Options): ZoKratesProvider;
compile(
source: string,
compileOptions?: CompileOptions
compileOptions?: CompileOptions,
): CompilationArtifacts;
computeWitness(
input: CompilationArtifacts | Uint8Array,
args: any[],
options?: ComputeOptions
options?: ComputeOptions,
): ComputationResult;
setup(program: Uint8Array, entropy?: string): SetupKeypair;
universalSetup(size: number, entropy?: string): Uint8Array;
Expand All @@ -92,7 +92,7 @@ declare module "zokrates-js" {
program: Uint8Array,
witness: Uint8Array,
provingKey: Uint8Array,
entropy?: string
entropy?: string,
): Proof;
verify(verificationKey: VerificationKey, proof: Proof): boolean;
exportSolidityVerifier(verificationKey: VerificationKey): string;
Expand Down
12 changes: 6 additions & 6 deletions zokrates_js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const initialize = async () => {
location,
resolveCallback,
config,
curve
curve,
);
const result = Object.assign(
{
program: ptr.program(),
abi: ptr.abi(),
constraintCount: ptr.constraint_count(),
},
snarkjs ? { snarkjs: { program: ptr.snarkjs_program() } } : {}
snarkjs ? { snarkjs: { program: ptr.snarkjs_program() } } : {},
);
ptr.free();
return result;
Expand All @@ -47,7 +47,7 @@ const initialize = async () => {
{
snarkjs: snarkjs,
},
logCallback
logCallback,
);

const result = Object.assign(
Expand All @@ -61,7 +61,7 @@ const initialize = async () => {
witness: ptr.snarkjs_witness(),
},
}
: {}
: {},
);

ptr.free();
Expand Down Expand Up @@ -94,7 +94,7 @@ const initialize = async () => {
witness,
provingKey,
entropy,
options
options,
);
},
verify: (vk, proof, options) => {
Expand Down Expand Up @@ -132,7 +132,7 @@ const initialize = async () => {
witness,
provingKey,
entropy,
options
options,
),
verify: (vk, proof) => defaultProvider.verify(vk, proof, options),
exportSolidityVerifier: (vk) =>
Expand Down
2 changes: 1 addition & 1 deletion zokrates_js/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pako from "pako";

(async function () {
const packageObject = JSON.parse(
await fs.readFile("pkg/package.json", { encoding: "utf-8" })
await fs.readFile("pkg/package.json", { encoding: "utf-8" }),
);
const wasmPath = packageObject.files.find((file) => file.endsWith(".wasm"));
const wasm = await fs.readFile(`pkg/${wasmPath}`);
Expand Down
20 changes: 10 additions & 10 deletions zokrates_js/tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("tests", () => {
describe("compilation", () => {
it("should compile", () => {
const artifacts = zokratesProvider.compile(
"def main() -> field { return 42; }"
"def main() -> field { return 42; }",
);
assert.ok(artifacts);
assert.ok(artifacts.snarkjs === undefined);
Expand All @@ -49,7 +49,7 @@ describe("tests", () => {
it("should compile with snarkjs output", () => {
const artifacts = zokratesProvider.compile(
"def main() -> field { return 42; }",
{ snarkjs: true }
{ snarkjs: true },
);
assert.ok(artifacts);
assert.ok(artifacts.snarkjs.program !== undefined);
Expand Down Expand Up @@ -167,7 +167,7 @@ describe("tests", () => {
["337", "113569"],
{
snarkjs: true,
}
},
);
});

Expand Down Expand Up @@ -214,7 +214,7 @@ describe("tests", () => {
return snarkjs.zKey.newZKey(
r1csPath,
"./tests/powersOfTau5_0000.ptau",
zkeyPath
zkeyPath,
);
});
});
Expand All @@ -231,7 +231,7 @@ describe("tests", () => {
proof = provider.generateProof(
artifacts.program,
computationResult.witness,
keypair.pk
keypair.pk,
);
assert.ok(proof !== undefined);
assert.equal(proof.inputs.length, 2);
Expand All @@ -240,7 +240,7 @@ describe("tests", () => {
let proof2 = provider.generateProof(
artifacts.program,
computationResult.witness,
keypair.pk
keypair.pk,
);
assert.notDeepEqual(proof, proof2);
});
Expand All @@ -251,7 +251,7 @@ describe("tests", () => {
artifacts.program,
computationResult.witness,
keypair.pk,
entropy
entropy,
);
assert.ok(proof !== undefined);
assert.equal(proof.inputs.length, 2);
Expand All @@ -261,7 +261,7 @@ describe("tests", () => {
artifacts.program,
computationResult.witness,
keypair.pk,
entropy
entropy,
);
assert.deepEqual(proof, proof2);
});
Expand Down Expand Up @@ -333,7 +333,7 @@ describe("tests", () => {

const fileSystemResolver = (from, to) => {
let parsedPath = path.parse(
path.resolve(path.dirname(path.resolve(from)), to)
path.resolve(path.dirname(path.resolve(from)), to),
);
const location = path.format({
...parsedPath,
Expand Down Expand Up @@ -368,7 +368,7 @@ describe("tests", () => {
try {
const result = specializedProvider.computeWitness(
input,
t.input.values
t.input.values,
);
const value = JSON.parse(result.output);
assert.deepEqual({ Ok: { value } }, t.output);
Expand Down
2 changes: 1 addition & 1 deletion zokrates_js/tests/umd/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("umd web tests", () => {
const page = await browser.newPage();

let response = await page.goto(
path.dirname(import.meta.url) + "/index.html"
path.dirname(import.meta.url) + "/index.html",
);
assert(response.ok());

Expand Down

0 comments on commit b357269

Please sign in to comment.