Add return types

This commit is contained in:
dancoffman 2022-11-03 21:54:59 -07:00
parent 0a99015789
commit 83bed363d2
No known key found for this signature in database
GPG Key ID: 47B1F53E36A9B3CC
1 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ export const BYTES_PER_FIELD = kzg.BYTES_PER_FIELD;
// Stored as internal state
let setupHandle: SetupHandle | undefined;
export function loadTrustedSetup(filePath: string) {
export function loadTrustedSetup(filePath: string): void {
if (setupHandle) {
throw new Error(
"Call freeTrustedSetup before loading a new trusted setup."
@ -63,7 +63,7 @@ export function loadTrustedSetup(filePath: string) {
setupHandle = kzg.loadTrustedSetup(filePath);
}
export function freeTrustedSetup() {
export function freeTrustedSetup(): void {
if (!setupHandle) {
throw new Error("You must call loadTrustedSetup before freeTrustedSetup.");
}
@ -71,14 +71,14 @@ export function freeTrustedSetup() {
setupHandle = undefined;
}
export function blobToKzgCommitment(blob: Blob) {
export function blobToKzgCommitment(blob: Blob): KZGCommitment {
if (!setupHandle) {
throw new Error("You must call loadTrustedSetup to initialize KZG.");
}
return kzg.blobToKzgCommitment(blob, setupHandle);
}
export function computeAggregateKzgProof(blobs: Blob[]) {
export function computeAggregateKzgProof(blobs: Blob[]): KZGProof {
if (!setupHandle) {
throw new Error("You must call loadTrustedSetup to initialize KZG.");
}
@ -89,7 +89,7 @@ export function verifyAggregateKzgProof(
blobs: Blob[],
expectedKzgCommitments: KZGCommitment[],
kzgAggregatedProof: KZGProof
) {
): boolean {
if (!setupHandle) {
throw new Error("You must call loadTrustedSetup to initialize KZG.");
}