zkverifyjs
Version:
Submit proofs to zkVerify and query proof state with ease using our npm package.
40 lines (39 loc) • 1.34 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BatchOptimisticVerificationBuilder = void 0;
class BatchOptimisticVerificationBuilder {
constructor(executeBatchOptimisticVerify, proofOptions, accountAddress) {
this.executeBatchOptimisticVerify = executeBatchOptimisticVerify;
this.nonceSet = false;
this.registeredVkSet = false;
this.blockSet = false;
this.options = { proofOptions, accountAddress };
}
nonce(nonce) {
if (this.nonceSet) {
throw new Error('Nonce can only be set once.');
}
this.nonceSet = true;
this.options.nonce = nonce;
return this;
}
withRegisteredVk() {
if (this.registeredVkSet) {
throw new Error('withRegisteredVk can only be set once.');
}
this.registeredVkSet = true;
this.options.registeredVk = true;
return this;
}
atBlock(block) {
if (this.blockSet)
throw new Error('atBlock can only be set once.');
this.blockSet = true;
this.options.block = block;
return this;
}
async execute(input) {
return this.executeBatchOptimisticVerify(this.options, input);
}
}
exports.BatchOptimisticVerificationBuilder = BatchOptimisticVerificationBuilder;