Fixed snarkArgs type defs

This commit is contained in:
Tornado Contrib 2024-09-26 12:29:29 +00:00
parent 69faa7a974
commit c155649719
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
2 changed files with 20 additions and 3 deletions

10
dist/websnark.d.ts vendored

@ -11,9 +11,17 @@ export type snarkInputs = {
pathElements: Element[]; pathElements: Element[];
pathIndices: Element[]; pathIndices: Element[];
}; };
export type snarkArgs = [
_root: string,
_nullifierHash: string,
_recipient: string,
_relayer: string,
_fee: string,
_refund: string
];
export type snarkProofs = { export type snarkProofs = {
proof: string; proof: string;
args: string[]; args: snarkArgs;
}; };
export declare function initGroth16(): Promise<void>; export declare function initGroth16(): Promise<void>;
export declare function calculateSnarkProof(input: snarkInputs, circuit: object, provingKey: ArrayBuffer): Promise<snarkProofs>; export declare function calculateSnarkProof(input: snarkInputs, circuit: object, provingKey: ArrayBuffer): Promise<snarkProofs>;

@ -21,9 +21,18 @@ export type snarkInputs = {
pathIndices: Element[]; pathIndices: Element[];
}; };
export type snarkArgs = [
_root: string,
_nullifierHash: string,
_recipient: string,
_relayer: string,
_fee: string,
_refund: string,
];
export type snarkProofs = { export type snarkProofs = {
proof: string; proof: string;
args: string[]; args: snarkArgs;
}; };
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -71,7 +80,7 @@ export async function calculateSnarkProof(
input.relayer, input.relayer,
toFixedHex(input.fee, 32), toFixedHex(input.fee, 32),
toFixedHex(input.refund, 32), toFixedHex(input.refund, 32),
]; ] as snarkArgs;
return { proof, args }; return { proof, args };
} }