zkverifyjs
Version:
Submit proofs to zkVerify and query proof state with ease using our npm package.
45 lines (44 loc) • 2.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RpcManager = void 0;
const rpc_1 = require("../../../api/rpc");
class RpcManager {
/**
* Creates an instance of RpcManager.
* @param {ConnectionManager} connectionManager - The connection manager instance.
*/
constructor(connectionManager) {
this.connectionManager = connectionManager;
}
/**
* Retrieves the aggregate statement path from the blockchain via the custom RPC method.
*
* @async
* @function getAggregateStatementPath
* @param {string} at - The block hash at which to perform the query. Must be a non-empty string.
* @param {number} domainId - The domain ID for which the aggregation statement path is requested. Must be >= 0.
* @param {number} aggregationId - The aggregation ID associated with the requested statement path. Must be >= 0.
* @param {string} statement - The statement hash to query for. Must be a non-empty string.
* @returns {Promise<AggregateStatementPathResult>} A promise that resolves to the AggregateStatementPathResult.
* @throws {Error} If any of the inputs are invalid or if the RPC call fails.
*/
async getAggregateStatementPath(at, domainId, aggregationId, statement) {
const api = this.connectionManager.connectionDetails.api;
return (0, rpc_1.getAggregateStatementPath)(api, at, domainId, aggregationId, statement);
}
/**
* Retrieves the VK hash for the given proof type and verification key.
*
* @async
* @function getVkHash
* @param {ProofOptions} proofOptions - Proof specific options.
* @param {string} vk - The verification key string.
* @returns {Promise<string>} - The resulting VK hash.
* @throws {Error} If the proof type is unsupported or the RPC call fails.
*/
async getVkHash(proofOptions, vk) {
const api = this.connectionManager.connectionDetails.api;
return (0, rpc_1.getVkHash)(api, proofOptions, vk);
}
}
exports.RpcManager = RpcManager;