UNPKG

@axiom-crypto/halo2-wasm

Version:

Halo2 wasm bindings

74 lines (73 loc) 4.82 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CircuitScaffold = exports.getHalo2LibWasm = exports.getHalo2Wasm = exports.Secp256k1AffinePoint = exports.JsCircuitValue256 = exports.JsCircuitSecp256k1Affine = exports.JsCircuitBn254G2Affine = exports.JsCircuitBn254G1Affine = exports.JsCircuitBn254Fq2 = exports.Bn254G2AffinePoint = exports.Bn254G1AffinePoint = exports.Bn254FqPoint = exports.getKzgParams = exports.Halo2LibWasm = exports.Halo2Wasm = exports.DEFAULT_CIRCUIT_CONFIG = void 0; var halo2_wasm_1 = require("./halo2_wasm"); Object.defineProperty(exports, "Halo2Wasm", { enumerable: true, get: function () { return halo2_wasm_1.Halo2Wasm; } }); Object.defineProperty(exports, "Halo2LibWasm", { enumerable: true, get: function () { return halo2_wasm_1.Halo2LibWasm; } }); Object.defineProperty(exports, "Bn254FqPoint", { enumerable: true, get: function () { return halo2_wasm_1.Bn254FqPoint; } }); Object.defineProperty(exports, "Bn254G1AffinePoint", { enumerable: true, get: function () { return halo2_wasm_1.Bn254G1AffinePoint; } }); Object.defineProperty(exports, "Bn254G2AffinePoint", { enumerable: true, get: function () { return halo2_wasm_1.Bn254G2AffinePoint; } }); Object.defineProperty(exports, "JsCircuitBn254Fq2", { enumerable: true, get: function () { return halo2_wasm_1.JsCircuitBn254Fq2; } }); Object.defineProperty(exports, "JsCircuitBn254G1Affine", { enumerable: true, get: function () { return halo2_wasm_1.JsCircuitBn254G1Affine; } }); Object.defineProperty(exports, "JsCircuitBn254G2Affine", { enumerable: true, get: function () { return halo2_wasm_1.JsCircuitBn254G2Affine; } }); Object.defineProperty(exports, "JsCircuitSecp256k1Affine", { enumerable: true, get: function () { return halo2_wasm_1.JsCircuitSecp256k1Affine; } }); Object.defineProperty(exports, "JsCircuitValue256", { enumerable: true, get: function () { return halo2_wasm_1.JsCircuitValue256; } }); Object.defineProperty(exports, "Secp256k1AffinePoint", { enumerable: true, get: function () { return halo2_wasm_1.Secp256k1AffinePoint; } }); var kzg_1 = require("./kzg"); Object.defineProperty(exports, "getKzgParams", { enumerable: true, get: function () { return kzg_1.getKzgParams; } }); var shared_1 = require("../shared"); Object.defineProperty(exports, "DEFAULT_CIRCUIT_CONFIG", { enumerable: true, get: function () { return shared_1.DEFAULT_CIRCUIT_CONFIG; } }); var scaffold_1 = require("../shared/scaffold"); var getHalo2Wasm = function () { (0, halo2_wasm_1.initPanicHook)(); var halo2wasm = new halo2_wasm_1.Halo2Wasm(); return halo2wasm; }; exports.getHalo2Wasm = getHalo2Wasm; var getHalo2LibWasm = function (halo2wasm) { var halo2libwasm = new halo2_wasm_1.Halo2LibWasm(halo2wasm); return halo2libwasm; }; exports.getHalo2LibWasm = getHalo2LibWasm; var CircuitScaffold = /** @class */ (function (_super) { __extends(CircuitScaffold, _super); function CircuitScaffold(options) { var _a, _b; var _this = _super.call(this) || this; _this.halo2wasm = (0, exports.getHalo2Wasm)(); _this.config = (_a = options === null || options === void 0 ? void 0 : options.config) !== null && _a !== void 0 ? _a : __assign({}, shared_1.DEFAULT_CIRCUIT_CONFIG); _this.shouldTime = (_b = options === null || options === void 0 ? void 0 : options.shouldTime) !== null && _b !== void 0 ? _b : false; _this.loadedVk = false; _this.halo2wasm.config(_this.config); _this.setContext({ getKzgParams: kzg_1.getKzgParams }); return _this; } return CircuitScaffold; }(scaffold_1.BaseCircuitScaffold)); exports.CircuitScaffold = CircuitScaffold;