@noir-lang/noir_wasm 0.22.0 → 0.23.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/build/cjs/package.json +15 -0
- package/build/esm/package.json +18 -0
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/main.js +12857 -0
- package/dist/node/main.js.map +1 -0
- package/dist/types/build/cjs/index.d.ts +93 -0
- package/dist/types/build/esm/index.d.ts +92 -0
- package/dist/types/src/index.d.cts +8 -0
- package/dist/types/src/index.d.mts +8 -0
- package/dist/types/src/noir/debug.d.ts +2 -0
- package/dist/types/src/noir/dependencies/dependency-manager.d.ts +48 -0
- package/dist/types/src/noir/dependencies/dependency-resolver.d.ts +22 -0
- package/dist/types/src/noir/dependencies/github-dependency-resolver.d.ts +29 -0
- package/dist/types/src/noir/dependencies/local-dependency-resolver.d.ts +12 -0
- package/dist/types/src/noir/file-manager/file-manager.d.ts +74 -0
- package/dist/types/src/noir/file-manager/memfs-file-manager.d.ts +8 -0
- package/dist/types/src/noir/file-manager/nodejs-file-manager.d.ts +7 -0
- package/dist/types/src/noir/noir-wasm-compiler.d.ts +31 -0
- package/dist/types/src/noir/package.d.ts +81 -0
- package/dist/types/src/types/noir_artifact.d.ts +173 -0
- package/dist/types/src/types/noir_package_config.d.ts +44 -0
- package/dist/types/src/utils.d.ts +5 -0
- package/dist/types/web-test-runner.config.d.mts +9 -0
- package/dist/types/webpack.config.d.ts +4 -0
- package/dist/web/index.html +9 -0
- package/dist/web/main.mjs +35340 -0
- package/dist/web/main.mjs.map +1 -0
- package/package.json +64 -19
- package/nodejs/noir_wasm.d.ts +0 -149
- package/nodejs/noir_wasm.js +0 -606
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +0 -25
- package/web/noir_wasm.d.ts +0 -198
- package/web/noir_wasm.js +0 -661
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +0 -25
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Abi, AbiType } from '@noir-lang/noirc_abi';
|
|
2
|
+
/**
|
|
3
|
+
* A named type.
|
|
4
|
+
*/
|
|
5
|
+
export interface ABIVariable {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the variable.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The type of the variable.
|
|
12
|
+
*/
|
|
13
|
+
type: AbiType;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A contract event.
|
|
17
|
+
*/
|
|
18
|
+
export interface EventAbi {
|
|
19
|
+
/**
|
|
20
|
+
* The event name.
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* Fully qualified name of the event.
|
|
25
|
+
*/
|
|
26
|
+
path: string;
|
|
27
|
+
/**
|
|
28
|
+
* The fields of the event.
|
|
29
|
+
*/
|
|
30
|
+
fields: ABIVariable[];
|
|
31
|
+
}
|
|
32
|
+
/** The Noir function types. */
|
|
33
|
+
export type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained';
|
|
34
|
+
/**
|
|
35
|
+
* The compilation result of an Noir function.
|
|
36
|
+
*/
|
|
37
|
+
export interface NoirFunctionEntry {
|
|
38
|
+
/** The name of the function. */
|
|
39
|
+
name: string;
|
|
40
|
+
/** The type of the function. */
|
|
41
|
+
function_type: NoirFunctionType;
|
|
42
|
+
/** Whether the function is internal. */
|
|
43
|
+
is_internal: boolean;
|
|
44
|
+
/** The ABI of the function. */
|
|
45
|
+
abi: Abi;
|
|
46
|
+
/** The bytecode of the function in base64. */
|
|
47
|
+
bytecode: string;
|
|
48
|
+
/** The debug information, compressed and base64 encoded. */
|
|
49
|
+
debug_symbols: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The compilation result of an Noir contract.
|
|
53
|
+
*/
|
|
54
|
+
export interface ContractArtifact {
|
|
55
|
+
/** The name of the contract. */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Version of noir used for the build. */
|
|
58
|
+
noir_version: string;
|
|
59
|
+
/** The functions of the contract. */
|
|
60
|
+
functions: NoirFunctionEntry[];
|
|
61
|
+
/** The events of the contract */
|
|
62
|
+
events: EventAbi[];
|
|
63
|
+
/** The map of file ID to the source code and path of the file. */
|
|
64
|
+
file_map: DebugFileMap;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The compilation result of an Noir contract.
|
|
68
|
+
*/
|
|
69
|
+
export interface ProgramArtifact {
|
|
70
|
+
/** The hash of the circuit. */
|
|
71
|
+
hash?: number;
|
|
72
|
+
/** * The ABI of the function. */
|
|
73
|
+
abi: Abi;
|
|
74
|
+
/** The bytecode of the circuit in base64. */
|
|
75
|
+
bytecode: string;
|
|
76
|
+
/** The debug information, compressed and base64 encoded. */
|
|
77
|
+
debug_symbols: string;
|
|
78
|
+
/** The map of file ID to the source code and path of the file. */
|
|
79
|
+
file_map: DebugFileMap;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A file ID. It's assigned during compilation.
|
|
83
|
+
*/
|
|
84
|
+
export type FileId = number;
|
|
85
|
+
/**
|
|
86
|
+
* A pointer to a specific section of the source code.
|
|
87
|
+
*/
|
|
88
|
+
export interface SourceCodeLocation {
|
|
89
|
+
/**
|
|
90
|
+
* The section of the source code.
|
|
91
|
+
*/
|
|
92
|
+
span: {
|
|
93
|
+
/**
|
|
94
|
+
* The byte where the section starts.
|
|
95
|
+
*/
|
|
96
|
+
start: number;
|
|
97
|
+
/**
|
|
98
|
+
* The byte where the section ends.
|
|
99
|
+
*/
|
|
100
|
+
end: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The source code file pointed to.
|
|
104
|
+
*/
|
|
105
|
+
file: FileId;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The location of an opcode in the bytecode.
|
|
109
|
+
* It's a string of the form `{acirIndex}` or `{acirIndex}:{brilligIndex}`.
|
|
110
|
+
*/
|
|
111
|
+
export type OpcodeLocation = string;
|
|
112
|
+
/**
|
|
113
|
+
* The debug information for a given function.
|
|
114
|
+
*/
|
|
115
|
+
export interface DebugInfo {
|
|
116
|
+
/**
|
|
117
|
+
* A map of the opcode location to the source code location.
|
|
118
|
+
*/
|
|
119
|
+
locations: Record<OpcodeLocation, SourceCodeLocation[]>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Maps a file ID to its metadata for debugging purposes.
|
|
123
|
+
*/
|
|
124
|
+
export type DebugFileMap = Record<FileId, {
|
|
125
|
+
/**
|
|
126
|
+
* The source code of the file.
|
|
127
|
+
*/
|
|
128
|
+
source: string;
|
|
129
|
+
/**
|
|
130
|
+
* The path of the file.
|
|
131
|
+
*/
|
|
132
|
+
path: string;
|
|
133
|
+
}>;
|
|
134
|
+
/** Compilation warning */
|
|
135
|
+
export type Warning = unknown;
|
|
136
|
+
/**
|
|
137
|
+
* The compilation artifacts of a given contract.
|
|
138
|
+
*/
|
|
139
|
+
export interface ContractCompilationArtifacts {
|
|
140
|
+
/**
|
|
141
|
+
* The compiled contract.
|
|
142
|
+
*/
|
|
143
|
+
contract: ContractArtifact;
|
|
144
|
+
/** Compilation warnings. */
|
|
145
|
+
warnings: Warning[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The compilation artifacts of a given program.
|
|
149
|
+
*/
|
|
150
|
+
export interface ProgramCompilationArtifacts {
|
|
151
|
+
/**
|
|
152
|
+
* not part of the compilation output, injected later
|
|
153
|
+
*/
|
|
154
|
+
name: string;
|
|
155
|
+
/**
|
|
156
|
+
* The compiled contract.
|
|
157
|
+
*/
|
|
158
|
+
program: ProgramArtifact;
|
|
159
|
+
/** Compilation warnings. */
|
|
160
|
+
warnings: Warning[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* output of Noir Wasm compilation, can be for a contract or lib/binary
|
|
164
|
+
*/
|
|
165
|
+
export type CompilationResult = ContractCompilationArtifacts | ProgramCompilationArtifacts;
|
|
166
|
+
/**
|
|
167
|
+
* Check if it has Contract unique property
|
|
168
|
+
*/
|
|
169
|
+
export declare function isContractCompilationArtifacts(artifact: CompilationResult): artifact is ContractCompilationArtifacts;
|
|
170
|
+
/**
|
|
171
|
+
* Check if it has Contract unique property
|
|
172
|
+
*/
|
|
173
|
+
export declare function isProgramCompilationArtifacts(artifact: CompilationResult): artifact is ProgramCompilationArtifacts;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type NoirGitDependencySchema = {
|
|
2
|
+
git: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
directory?: string;
|
|
5
|
+
};
|
|
6
|
+
type NoirLocalDependencySchema = {
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
type NoirPackageType = 'lib' | 'contract' | 'bin';
|
|
10
|
+
type NoirPackageConfigSchema = {
|
|
11
|
+
package: {
|
|
12
|
+
name: string;
|
|
13
|
+
type: NoirPackageType;
|
|
14
|
+
entry?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
authors?: string[];
|
|
17
|
+
compiler_version?: string;
|
|
18
|
+
backend?: string;
|
|
19
|
+
license?: string;
|
|
20
|
+
};
|
|
21
|
+
dependencies: Record<string, GitDependencyConfig | LocalDependencyConfig>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Noir package configuration.
|
|
25
|
+
*/
|
|
26
|
+
export type PackageConfig = NoirPackageConfigSchema;
|
|
27
|
+
/**
|
|
28
|
+
* A remote package dependency.
|
|
29
|
+
*/
|
|
30
|
+
export type GitDependencyConfig = NoirGitDependencySchema;
|
|
31
|
+
/**
|
|
32
|
+
* A local package dependency.
|
|
33
|
+
*/
|
|
34
|
+
export type LocalDependencyConfig = NoirLocalDependencySchema;
|
|
35
|
+
/**
|
|
36
|
+
* A package dependency.
|
|
37
|
+
*/
|
|
38
|
+
export type DependencyConfig = GitDependencyConfig | LocalDependencyConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Checks that an object is a package configuration.
|
|
41
|
+
* @param config - Config to check
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseNoirPackageConfig(config: any): PackageConfig;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Structured log data to include with the message. */
|
|
2
|
+
export type LogData = Record<string, string | number | bigint | boolean>;
|
|
3
|
+
/** A callable logger instance. */
|
|
4
|
+
export type LogFn = (msg: string, data?: LogData) => void;
|
|
5
|
+
export declare function fileURLToPath(uri: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let browsers: import("@web/test-runner-playwright").PlaywrightLauncher[];
|
|
3
|
+
let plugins: import("@web/dev-server-core").Plugin[];
|
|
4
|
+
let files: string[];
|
|
5
|
+
let nodeResolve: boolean;
|
|
6
|
+
let rootDir: string;
|
|
7
|
+
let reporters: import("@web/test-runner").Reporter[];
|
|
8
|
+
}
|
|
9
|
+
export default _default;
|