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