@noir-lang/acvm_js 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/nodejs/acvm_js.d.ts +141 -0
- package/nodejs/acvm_js.js +1077 -0
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +24 -0
- package/package.json +24 -0
- package/web/acvm_js.d.ts +189 -0
- package/web/acvm_js.js +1055 -0
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +24 -0
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function buildInfo(): number;
|
|
5
|
+
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
6
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function createBlackBoxSolver(): number;
|
|
8
|
+
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
9
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
10
|
+
export function compressWitness(a: number, b: number): void;
|
|
11
|
+
export function initLogLevel(a: number): void;
|
|
12
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
13
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
14
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
15
|
+
export function __wbg_trap_free(a: number): void;
|
|
16
|
+
export function trap___wbgd_downcast_token(): number;
|
|
17
|
+
export function __wbindgen_malloc(a: number, b: number): number;
|
|
18
|
+
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
|
|
19
|
+
export const __wbindgen_export_2: WebAssembly.Table;
|
|
20
|
+
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fdacd768a9ff6b4(a: number, b: number, c: number): void;
|
|
21
|
+
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
22
|
+
export function __wbindgen_free(a: number, b: number, c: number): void;
|
|
23
|
+
export function __wbindgen_exn_store(a: number): void;
|
|
24
|
+
export function wasm_bindgen__convert__closures__invoke2_mut__h2def3b115f9d10e4(a: number, b: number, c: number, d: number): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@noir-lang/acvm_js",
|
|
3
|
+
"version": "0.26.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/noir-lang/acvm.git"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"collaborators": [
|
|
12
|
+
"The Noir Team <team@noir-lang.org>"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"main": "./nodejs/acvm_js.js",
|
|
16
|
+
"types": "./web/acvm_js.d.ts",
|
|
17
|
+
"module": "./web/acvm_js.js",
|
|
18
|
+
"files": [
|
|
19
|
+
"nodejs",
|
|
20
|
+
"web",
|
|
21
|
+
"package.json"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false
|
|
24
|
+
}
|
package/web/acvm_js.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
|
+
*
|
|
11
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
12
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
14
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
15
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
|
+
*/
|
|
17
|
+
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
|
+
/**
|
|
19
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
20
|
+
*
|
|
21
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
22
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
23
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
24
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
25
|
+
*/
|
|
26
|
+
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
27
|
+
/**
|
|
28
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
29
|
+
*/
|
|
30
|
+
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
31
|
+
/**
|
|
32
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
33
|
+
*
|
|
34
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
35
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
36
|
+
*/
|
|
37
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
38
|
+
/**
|
|
39
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
40
|
+
*
|
|
41
|
+
* @param {Uint8Array} compressed_witness - A witness map.
|
|
42
|
+
* @returns {WitnessMap} A compressed witness map
|
|
43
|
+
*/
|
|
44
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the package's logging level.
|
|
47
|
+
*
|
|
48
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
49
|
+
*/
|
|
50
|
+
export function initLogLevel(level: LogLevel): void;
|
|
51
|
+
/**
|
|
52
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
53
|
+
*
|
|
54
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
55
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
56
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
57
|
+
* @param {Uint8Array} circuit
|
|
58
|
+
* @param {WitnessMap} solved_witness
|
|
59
|
+
* @returns {WitnessMap}
|
|
60
|
+
*/
|
|
61
|
+
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
62
|
+
/**
|
|
63
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
64
|
+
*
|
|
65
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
66
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
67
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
68
|
+
* @param {Uint8Array} circuit
|
|
69
|
+
* @param {WitnessMap} solved_witness
|
|
70
|
+
* @returns {WitnessMap}
|
|
71
|
+
*/
|
|
72
|
+
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
73
|
+
/**
|
|
74
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
75
|
+
*
|
|
76
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
77
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
78
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
79
|
+
* @param {Uint8Array} circuit
|
|
80
|
+
* @param {WitnessMap} witness_map
|
|
81
|
+
* @returns {WitnessMap}
|
|
82
|
+
*/
|
|
83
|
+
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
84
|
+
|
|
85
|
+
export type ForeignCallInput = string[]
|
|
86
|
+
export type ForeignCallOutput = string | string[]
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A callback which performs an foreign call and returns the response.
|
|
90
|
+
* @callback ForeignCallHandler
|
|
91
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
92
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
93
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
94
|
+
*/
|
|
95
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
101
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
102
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
103
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
104
|
+
*/
|
|
105
|
+
export type BuildInfo = {
|
|
106
|
+
gitHash: string;
|
|
107
|
+
version: string;
|
|
108
|
+
dirty: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
export type ExecutionError = Error & {
|
|
114
|
+
callStack?: string[];
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE";
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// Map from witness index to hex string value of witness.
|
|
124
|
+
export type WitnessMap = Map<number, string>;
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A struct representing a Trap
|
|
129
|
+
*/
|
|
130
|
+
export class Trap {
|
|
131
|
+
free(): void;
|
|
132
|
+
/**
|
|
133
|
+
* @returns {Symbol}
|
|
134
|
+
*/
|
|
135
|
+
static __wbgd_downcast_token(): Symbol;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
*/
|
|
139
|
+
export class WasmBlackBoxFunctionSolver {
|
|
140
|
+
free(): void;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
144
|
+
|
|
145
|
+
export interface InitOutput {
|
|
146
|
+
readonly memory: WebAssembly.Memory;
|
|
147
|
+
readonly buildInfo: () => number;
|
|
148
|
+
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
149
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
150
|
+
readonly createBlackBoxSolver: () => number;
|
|
151
|
+
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
|
|
152
|
+
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
153
|
+
readonly compressWitness: (a: number, b: number) => void;
|
|
154
|
+
readonly initLogLevel: (a: number) => void;
|
|
155
|
+
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
156
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
157
|
+
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
158
|
+
readonly __wbg_trap_free: (a: number) => void;
|
|
159
|
+
readonly trap___wbgd_downcast_token: () => number;
|
|
160
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
161
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
162
|
+
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
163
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8fdacd768a9ff6b4: (a: number, b: number, c: number) => void;
|
|
164
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
165
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
166
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
167
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h2def3b115f9d10e4: (a: number, b: number, c: number, d: number) => void;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
171
|
+
/**
|
|
172
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
173
|
+
* a precompiled `WebAssembly.Module`.
|
|
174
|
+
*
|
|
175
|
+
* @param {SyncInitInput} module
|
|
176
|
+
*
|
|
177
|
+
* @returns {InitOutput}
|
|
178
|
+
*/
|
|
179
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
183
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
184
|
+
*
|
|
185
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
186
|
+
*
|
|
187
|
+
* @returns {Promise<InitOutput>}
|
|
188
|
+
*/
|
|
189
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|