@aztec/foundation 0.62.0 → 0.63.1
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/dest/abi/abi.d.ts +708 -228
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +92 -8
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +4 -1
- package/dest/abi/event_selector.d.ts +4 -0
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/event_selector.js +7 -1
- package/dest/aztec-address/index.d.ts +19 -3
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +43 -14
- package/dest/buffer/buffer32.d.ts +1 -0
- package/dest/buffer/buffer32.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +4 -1
- package/dest/config/env_var.d.ts +1 -1
- package/dest/config/env_var.d.ts.map +1 -1
- package/dest/crypto/index.d.ts +1 -0
- package/dest/crypto/index.d.ts.map +1 -1
- package/dest/crypto/index.js +2 -1
- package/dest/crypto/keys/index.d.ts +5 -0
- package/dest/crypto/keys/index.d.ts.map +1 -0
- package/dest/crypto/keys/index.js +8 -0
- package/dest/eth-address/index.d.ts +2 -6
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-address/index.js +3 -7
- package/dest/eth-signature/eth_signature.d.ts +2 -0
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/eth-signature/eth_signature.js +7 -1
- package/dest/fields/fields.d.ts +1 -3
- package/dest/fields/fields.d.ts.map +1 -1
- package/dest/fields/fields.js +2 -1
- package/dest/json-rpc/client/fetch.d.ts +21 -0
- package/dest/json-rpc/client/fetch.d.ts.map +1 -0
- package/dest/json-rpc/client/fetch.js +66 -0
- package/dest/json-rpc/client/index.d.ts +2 -1
- package/dest/json-rpc/client/index.d.ts.map +1 -1
- package/dest/json-rpc/client/index.js +3 -2
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +13 -0
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -0
- package/dest/json-rpc/client/safe_json_rpc_client.js +45 -0
- package/dest/json-rpc/convert.d.ts +11 -19
- package/dest/json-rpc/convert.d.ts.map +1 -1
- package/dest/json-rpc/convert.js +30 -123
- package/dest/json-rpc/fixtures/test_state.d.ts +45 -3
- package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/test_state.js +58 -2
- package/dest/json-rpc/index.d.ts +1 -2
- package/dest/json-rpc/index.d.ts.map +1 -1
- package/dest/json-rpc/index.js +2 -3
- package/dest/json-rpc/js_utils.d.ts.map +1 -1
- package/dest/json-rpc/js_utils.js +2 -1
- package/dest/json-rpc/server/index.d.ts +1 -2
- package/dest/json-rpc/server/index.d.ts.map +1 -1
- package/dest/json-rpc/server/index.js +2 -3
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +112 -0
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -0
- package/dest/json-rpc/server/safe_json_rpc_server.js +275 -0
- package/dest/json-rpc/test/index.d.ts +2 -0
- package/dest/json-rpc/test/index.d.ts.map +1 -0
- package/dest/json-rpc/test/index.js +2 -0
- package/dest/json-rpc/test/integration.d.ts +13 -0
- package/dest/json-rpc/test/integration.d.ts.map +1 -0
- package/dest/json-rpc/test/integration.js +12 -0
- package/dest/log/logger.d.ts.map +1 -1
- package/dest/log/logger.js +2 -2
- package/dest/schemas/api.d.ts +21 -0
- package/dest/schemas/api.d.ts.map +1 -0
- package/dest/schemas/api.js +8 -0
- package/dest/schemas/index.d.ts +6 -0
- package/dest/schemas/index.d.ts.map +1 -0
- package/dest/schemas/index.js +6 -0
- package/dest/schemas/parse.d.ts +9 -0
- package/dest/schemas/parse.d.ts.map +1 -0
- package/dest/schemas/parse.js +26 -0
- package/dest/schemas/schemas.d.ts +79 -0
- package/dest/schemas/schemas.d.ts.map +1 -0
- package/dest/schemas/schemas.js +87 -0
- package/dest/schemas/types.d.ts +3 -0
- package/dest/schemas/types.d.ts.map +1 -0
- package/dest/schemas/types.js +2 -0
- package/dest/schemas/utils.d.ts +40 -0
- package/dest/schemas/utils.d.ts.map +1 -0
- package/dest/schemas/utils.js +56 -0
- package/dest/string/index.d.ts +7 -0
- package/dest/string/index.d.ts.map +1 -0
- package/dest/string/index.js +13 -0
- package/dest/types/index.d.ts +2 -0
- package/dest/types/index.d.ts.map +1 -1
- package/dest/validation/index.d.ts +6 -0
- package/dest/validation/index.d.ts.map +1 -1
- package/dest/validation/index.js +11 -1
- package/package.json +7 -4
- package/src/abi/abi.ts +203 -233
- package/src/abi/encoder.ts +2 -0
- package/src/abi/event_selector.ts +7 -0
- package/src/aztec-address/index.ts +64 -18
- package/src/buffer/buffer32.ts +5 -0
- package/src/config/env_var.ts +18 -8
- package/src/crypto/index.ts +1 -0
- package/src/crypto/keys/index.ts +9 -0
- package/src/eth-address/index.ts +2 -6
- package/src/eth-signature/eth_signature.ts +8 -0
- package/src/fields/fields.ts +2 -3
- package/src/json-rpc/client/fetch.ts +81 -0
- package/src/json-rpc/client/index.ts +2 -1
- package/src/json-rpc/client/safe_json_rpc_client.ts +61 -0
- package/src/json-rpc/convert.ts +29 -142
- package/src/json-rpc/fixtures/test_state.ts +87 -3
- package/src/json-rpc/index.ts +1 -8
- package/src/json-rpc/js_utils.ts +1 -0
- package/src/json-rpc/server/index.ts +1 -2
- package/src/json-rpc/server/safe_json_rpc_server.ts +336 -0
- package/src/json-rpc/test/index.ts +1 -0
- package/src/json-rpc/test/integration.ts +24 -0
- package/src/log/logger.ts +2 -1
- package/src/schemas/api.ts +47 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/parse.ts +29 -0
- package/src/schemas/schemas.ts +111 -0
- package/src/schemas/types.ts +3 -0
- package/src/schemas/utils.ts +85 -0
- package/src/string/index.ts +15 -0
- package/src/types/index.ts +3 -0
- package/src/validation/index.ts +11 -0
- package/dest/json-rpc/class_converter.d.ts +0 -144
- package/dest/json-rpc/class_converter.d.ts.map +0 -1
- package/dest/json-rpc/class_converter.js +0 -102
- package/dest/json-rpc/client/json_rpc_client.d.ts +0 -35
- package/dest/json-rpc/client/json_rpc_client.d.ts.map +0 -1
- package/dest/json-rpc/client/json_rpc_client.js +0 -117
- package/dest/json-rpc/server/json_proxy.d.ts +0 -30
- package/dest/json-rpc/server/json_proxy.d.ts.map +0 -1
- package/dest/json-rpc/server/json_proxy.js +0 -46
- package/dest/json-rpc/server/json_rpc_server.d.ts +0 -102
- package/dest/json-rpc/server/json_rpc_server.d.ts.map +0 -1
- package/dest/json-rpc/server/json_rpc_server.js +0 -265
- package/src/json-rpc/class_converter.ts +0 -213
- package/src/json-rpc/client/json_rpc_client.ts +0 -148
- package/src/json-rpc/server/json_proxy.ts +0 -60
- package/src/json-rpc/server/json_rpc_server.ts +0 -332
package/dest/abi/abi.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import { z } from 'zod';
|
|
3
4
|
import { type Fr } from '../fields/fields.js';
|
|
5
|
+
import { type ZodFor } from '../schemas/types.js';
|
|
4
6
|
import { type FunctionSelector } from './function_selector.js';
|
|
5
7
|
import { type NoteSelector } from './note_selector.js';
|
|
6
|
-
/**
|
|
7
|
-
* A basic value.
|
|
8
|
-
*/
|
|
8
|
+
/** A basic value. */
|
|
9
9
|
export interface BasicValue<T extends string, V> {
|
|
10
|
-
/**
|
|
11
|
-
* The kind of the value.
|
|
12
|
-
*/
|
|
10
|
+
/** The kind of the value. */
|
|
13
11
|
kind: T;
|
|
14
12
|
value: V;
|
|
15
13
|
}
|
|
16
|
-
/**
|
|
17
|
-
* An exported value.
|
|
18
|
-
*/
|
|
14
|
+
/** An exported value. */
|
|
19
15
|
export type AbiValue = BasicValue<'boolean', boolean> | BasicValue<'string', string> | BasicValue<'array', AbiValue[]> | TupleValue | IntegerValue | StructValue;
|
|
16
|
+
export declare const AbiValueSchema: z.ZodType<AbiValue>;
|
|
20
17
|
export type TypedStructFieldValue<T> = {
|
|
21
18
|
name: string;
|
|
22
19
|
value: T;
|
|
@@ -32,185 +29,684 @@ export interface TupleValue {
|
|
|
32
29
|
export interface IntegerValue extends BasicValue<'integer', string> {
|
|
33
30
|
sign: boolean;
|
|
34
31
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
* The name of the variable.
|
|
41
|
-
*/
|
|
42
|
-
name: string;
|
|
43
|
-
/**
|
|
44
|
-
* The type of the variable.
|
|
45
|
-
*/
|
|
46
|
-
type: AbiType;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Indicates whether a parameter is public or secret/private.
|
|
50
|
-
*/
|
|
51
|
-
export type ABIParameterVisibility = 'public' | 'private' | 'databus';
|
|
52
|
-
/**
|
|
53
|
-
* A function parameter.
|
|
54
|
-
*/
|
|
55
|
-
export interface ABIParameter extends ABIVariable {
|
|
56
|
-
/**
|
|
57
|
-
* Indicates whether a parameter is public or secret/private.
|
|
58
|
-
*/
|
|
59
|
-
visibility: ABIParameterVisibility;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* A basic type.
|
|
63
|
-
*/
|
|
32
|
+
/** Indicates whether a parameter is public or secret/private. */
|
|
33
|
+
export declare const ABIParameterVisibility: readonly ["public", "private", "databus"];
|
|
34
|
+
/** Indicates whether a parameter is public or secret/private. */
|
|
35
|
+
export type ABIParameterVisibility = (typeof ABIParameterVisibility)[number];
|
|
36
|
+
/** A basic type. */
|
|
64
37
|
export interface BasicType<T extends string> {
|
|
65
|
-
/**
|
|
66
|
-
* The kind of the type.
|
|
67
|
-
*/
|
|
38
|
+
/** The kind of the type. */
|
|
68
39
|
kind: T;
|
|
69
40
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
41
|
+
/** Sign for numeric types. */
|
|
42
|
+
declare const Sign: readonly ["unsigned", "signed"];
|
|
43
|
+
type Sign = (typeof Sign)[number];
|
|
44
|
+
/** A variable type. */
|
|
73
45
|
export type AbiType = BasicType<'field'> | BasicType<'boolean'> | IntegerType | ArrayType | StringType | StructType | TupleType;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
*/
|
|
46
|
+
export declare const AbiTypeSchema: z.ZodType<AbiType>;
|
|
47
|
+
/** A named type. */
|
|
48
|
+
export declare const ABIVariableSchema: z.ZodObject<{
|
|
49
|
+
/** The name of the variable. */
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
/** The type of the variable. */
|
|
52
|
+
type: z.ZodType<AbiType, z.ZodTypeDef, AbiType>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
type: AbiType;
|
|
55
|
+
name: string;
|
|
56
|
+
}, {
|
|
57
|
+
type: AbiType;
|
|
58
|
+
name: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** A named type. */
|
|
61
|
+
export type ABIVariable = z.infer<typeof ABIVariableSchema>;
|
|
62
|
+
/** A function parameter. */
|
|
63
|
+
export declare const ABIParameterSchema: z.ZodIntersection<z.ZodObject<{
|
|
64
|
+
/** The name of the variable. */
|
|
65
|
+
name: z.ZodString;
|
|
66
|
+
/** The type of the variable. */
|
|
67
|
+
type: z.ZodType<AbiType, z.ZodTypeDef, AbiType>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
type: AbiType;
|
|
70
|
+
name: string;
|
|
71
|
+
}, {
|
|
72
|
+
type: AbiType;
|
|
73
|
+
name: string;
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
/** Visibility of the parameter in the function. */
|
|
76
|
+
visibility: z.ZodEnum<["public", "private", "databus"]>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
visibility: "public" | "private" | "databus";
|
|
79
|
+
}, {
|
|
80
|
+
visibility: "public" | "private" | "databus";
|
|
81
|
+
}>>;
|
|
82
|
+
/** A function parameter. */
|
|
83
|
+
export type ABIParameter = z.infer<typeof ABIParameterSchema>;
|
|
84
|
+
/** An integer type. */
|
|
78
85
|
export interface IntegerType extends BasicType<'integer'> {
|
|
79
|
-
/**
|
|
80
|
-
* The sign of the integer.
|
|
81
|
-
*/
|
|
86
|
+
/** The sign of the integer. */
|
|
82
87
|
sign: Sign;
|
|
83
|
-
/**
|
|
84
|
-
* The width of the integer in bits.
|
|
85
|
-
*/
|
|
88
|
+
/** The width of the integer in bits. */
|
|
86
89
|
width: number;
|
|
87
90
|
}
|
|
88
|
-
/**
|
|
89
|
-
* An array type.
|
|
90
|
-
*/
|
|
91
|
+
/** An array type. */
|
|
91
92
|
export interface ArrayType extends BasicType<'array'> {
|
|
92
|
-
/**
|
|
93
|
-
* The length of the array.
|
|
94
|
-
*/
|
|
93
|
+
/** The length of the array. */
|
|
95
94
|
length: number;
|
|
96
|
-
/**
|
|
97
|
-
* The type of the array elements.
|
|
98
|
-
*/
|
|
95
|
+
/** The type of the array elements. */
|
|
99
96
|
type: AbiType;
|
|
100
97
|
}
|
|
101
|
-
/**
|
|
102
|
-
* A tuple type.
|
|
103
|
-
*/
|
|
98
|
+
/** A tuple type. */
|
|
104
99
|
export interface TupleType extends BasicType<'tuple'> {
|
|
105
|
-
/**
|
|
106
|
-
* The types of the tuple elements.
|
|
107
|
-
*/
|
|
100
|
+
/** The types of the tuple elements. */
|
|
108
101
|
fields: AbiType[];
|
|
109
102
|
}
|
|
110
|
-
/**
|
|
111
|
-
* A string type.
|
|
112
|
-
*/
|
|
103
|
+
/** A string type. */
|
|
113
104
|
export interface StringType extends BasicType<'string'> {
|
|
114
|
-
/**
|
|
115
|
-
* The length of the string.
|
|
116
|
-
*/
|
|
105
|
+
/** The length of the string. */
|
|
117
106
|
length: number;
|
|
118
107
|
}
|
|
119
|
-
/**
|
|
120
|
-
* A struct type.
|
|
121
|
-
*/
|
|
108
|
+
/** A struct type. */
|
|
122
109
|
export interface StructType extends BasicType<'struct'> {
|
|
123
|
-
/**
|
|
124
|
-
* The fields of the struct.
|
|
125
|
-
*/
|
|
110
|
+
/** The fields of the struct. */
|
|
126
111
|
fields: ABIVariable[];
|
|
127
|
-
/**
|
|
128
|
-
* Fully qualified name of the struct.
|
|
129
|
-
*/
|
|
112
|
+
/** Fully qualified name of the struct. */
|
|
130
113
|
path: string;
|
|
131
114
|
}
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
/** An error could be a custom error of any regular type or a string error. */
|
|
116
|
+
export type AbiErrorType = {
|
|
117
|
+
error_kind: 'string';
|
|
118
|
+
string: string;
|
|
119
|
+
} | {
|
|
120
|
+
error_kind: 'fmtstring';
|
|
121
|
+
length: number;
|
|
122
|
+
item_types: AbiType[];
|
|
123
|
+
} | ({
|
|
124
|
+
error_kind: 'custom';
|
|
125
|
+
} & AbiType);
|
|
126
|
+
/** Aztec.nr function types. */
|
|
135
127
|
export declare enum FunctionType {
|
|
136
128
|
PRIVATE = "private",
|
|
137
129
|
PUBLIC = "public",
|
|
138
130
|
UNCONSTRAINED = "unconstrained"
|
|
139
131
|
}
|
|
140
|
-
/**
|
|
141
|
-
* The abi entry of a function.
|
|
142
|
-
*/
|
|
132
|
+
/** The abi entry of a function. */
|
|
143
133
|
export interface FunctionAbi {
|
|
144
|
-
/**
|
|
145
|
-
* The name of the function.
|
|
146
|
-
*/
|
|
134
|
+
/** The name of the function. */
|
|
147
135
|
name: string;
|
|
148
|
-
/**
|
|
149
|
-
* Whether the function is secret.
|
|
150
|
-
*/
|
|
136
|
+
/** Whether the function is secret. */
|
|
151
137
|
functionType: FunctionType;
|
|
152
|
-
/**
|
|
153
|
-
* Whether the function is internal.
|
|
154
|
-
*/
|
|
138
|
+
/** Whether the function is internal. */
|
|
155
139
|
isInternal: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Whether the function can alter state or not
|
|
158
|
-
*/
|
|
140
|
+
/** Whether the function can alter state or not */
|
|
159
141
|
isStatic: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Function parameters.
|
|
162
|
-
*/
|
|
142
|
+
/** Function parameters. */
|
|
163
143
|
parameters: ABIParameter[];
|
|
164
|
-
/**
|
|
165
|
-
* The types of the return values.
|
|
166
|
-
*/
|
|
144
|
+
/** The types of the return values. */
|
|
167
145
|
returnTypes: AbiType[];
|
|
168
|
-
/**
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
/** The types of the errors that the function can throw. */
|
|
147
|
+
errorTypes: Partial<Record<string, AbiErrorType>>;
|
|
148
|
+
/** Whether the function is flagged as an initializer. */
|
|
171
149
|
isInitializer: boolean;
|
|
172
150
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
export declare const FunctionAbiSchema: z.ZodObject<{
|
|
152
|
+
name: z.ZodString;
|
|
153
|
+
functionType: z.ZodNativeEnum<typeof FunctionType>;
|
|
154
|
+
isInternal: z.ZodBoolean;
|
|
155
|
+
isStatic: z.ZodBoolean;
|
|
156
|
+
isInitializer: z.ZodBoolean;
|
|
157
|
+
parameters: z.ZodArray<z.ZodObject<{
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
type: z.ZodType<AbiType, z.ZodTypeDef, AbiType>;
|
|
160
|
+
visibility: z.ZodEnum<["public", "private", "databus"]>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
type: AbiType;
|
|
163
|
+
name: string;
|
|
164
|
+
visibility: "public" | "private" | "databus";
|
|
165
|
+
}, {
|
|
166
|
+
type: AbiType;
|
|
167
|
+
name: string;
|
|
168
|
+
visibility: "public" | "private" | "databus";
|
|
169
|
+
}>, "many">;
|
|
170
|
+
returnTypes: z.ZodArray<z.ZodType<AbiType, z.ZodTypeDef, AbiType>, "many">;
|
|
171
|
+
errorTypes: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
172
|
+
error_kind: z.ZodLiteral<"string">;
|
|
173
|
+
string: z.ZodString;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
string: string;
|
|
176
|
+
error_kind: "string";
|
|
177
|
+
}, {
|
|
178
|
+
string: string;
|
|
179
|
+
error_kind: "string";
|
|
180
|
+
}>, z.ZodObject<{
|
|
181
|
+
error_kind: z.ZodLiteral<"fmtstring">;
|
|
182
|
+
length: z.ZodNumber;
|
|
183
|
+
item_types: z.ZodArray<z.ZodType<AbiType, z.ZodTypeDef, AbiType>, "many">;
|
|
184
|
+
}, "strip", z.ZodTypeAny, {
|
|
185
|
+
length: number;
|
|
186
|
+
error_kind: "fmtstring";
|
|
187
|
+
item_types: AbiType[];
|
|
188
|
+
}, {
|
|
189
|
+
length: number;
|
|
190
|
+
error_kind: "fmtstring";
|
|
191
|
+
item_types: AbiType[];
|
|
192
|
+
}>, z.ZodIntersection<z.ZodObject<{
|
|
193
|
+
error_kind: z.ZodLiteral<"custom">;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
error_kind: "custom";
|
|
196
|
+
}, {
|
|
197
|
+
error_kind: "custom";
|
|
198
|
+
}>, z.ZodType<AbiType, z.ZodTypeDef, AbiType>>]>>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
name: string;
|
|
201
|
+
parameters: {
|
|
202
|
+
type: AbiType;
|
|
203
|
+
name: string;
|
|
204
|
+
visibility: "public" | "private" | "databus";
|
|
205
|
+
}[];
|
|
206
|
+
functionType: FunctionType;
|
|
207
|
+
isInternal: boolean;
|
|
208
|
+
isStatic: boolean;
|
|
209
|
+
isInitializer: boolean;
|
|
210
|
+
returnTypes: AbiType[];
|
|
211
|
+
errorTypes: Record<string, {
|
|
212
|
+
string: string;
|
|
213
|
+
error_kind: "string";
|
|
214
|
+
} | {
|
|
215
|
+
length: number;
|
|
216
|
+
error_kind: "fmtstring";
|
|
217
|
+
item_types: AbiType[];
|
|
218
|
+
} | ({
|
|
219
|
+
error_kind: "custom";
|
|
220
|
+
} & AbiType)>;
|
|
221
|
+
}, {
|
|
222
|
+
name: string;
|
|
223
|
+
parameters: {
|
|
224
|
+
type: AbiType;
|
|
225
|
+
name: string;
|
|
226
|
+
visibility: "public" | "private" | "databus";
|
|
227
|
+
}[];
|
|
228
|
+
functionType: FunctionType;
|
|
229
|
+
isInternal: boolean;
|
|
230
|
+
isStatic: boolean;
|
|
231
|
+
isInitializer: boolean;
|
|
232
|
+
returnTypes: AbiType[];
|
|
233
|
+
errorTypes: Record<string, {
|
|
234
|
+
string: string;
|
|
235
|
+
error_kind: "string";
|
|
236
|
+
} | {
|
|
237
|
+
length: number;
|
|
238
|
+
error_kind: "fmtstring";
|
|
239
|
+
item_types: AbiType[];
|
|
240
|
+
} | ({
|
|
241
|
+
error_kind: "custom";
|
|
242
|
+
} & AbiType)>;
|
|
243
|
+
}>;
|
|
244
|
+
/** Debug metadata for a function. */
|
|
245
|
+
export interface FunctionDebugMetadata {
|
|
246
|
+
/** Maps opcodes to source code pointers */
|
|
247
|
+
debugSymbols: DebugInfo;
|
|
248
|
+
/** Maps the file IDs to the file contents to resolve pointers */
|
|
249
|
+
files: DebugFileMap;
|
|
250
|
+
}
|
|
251
|
+
export declare const FunctionDebugMetadataSchema: z.ZodObject<{
|
|
252
|
+
debugSymbols: z.ZodObject<{
|
|
253
|
+
locations: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
254
|
+
span: z.ZodObject<{
|
|
255
|
+
start: z.ZodNumber;
|
|
256
|
+
end: z.ZodNumber;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
start: number;
|
|
259
|
+
end: number;
|
|
260
|
+
}, {
|
|
261
|
+
start: number;
|
|
262
|
+
end: number;
|
|
263
|
+
}>;
|
|
264
|
+
file: z.ZodNumber;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
span: {
|
|
267
|
+
start: number;
|
|
268
|
+
end: number;
|
|
269
|
+
};
|
|
270
|
+
file: number;
|
|
271
|
+
}, {
|
|
272
|
+
span: {
|
|
273
|
+
start: number;
|
|
274
|
+
end: number;
|
|
275
|
+
};
|
|
276
|
+
file: number;
|
|
277
|
+
}>, "many">>;
|
|
278
|
+
brillig_locations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
279
|
+
span: z.ZodObject<{
|
|
280
|
+
start: z.ZodNumber;
|
|
281
|
+
end: z.ZodNumber;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
start: number;
|
|
284
|
+
end: number;
|
|
285
|
+
}, {
|
|
286
|
+
start: number;
|
|
287
|
+
end: number;
|
|
288
|
+
}>;
|
|
289
|
+
file: z.ZodNumber;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
span: {
|
|
292
|
+
start: number;
|
|
293
|
+
end: number;
|
|
294
|
+
};
|
|
295
|
+
file: number;
|
|
296
|
+
}, {
|
|
297
|
+
span: {
|
|
298
|
+
start: number;
|
|
299
|
+
end: number;
|
|
300
|
+
};
|
|
301
|
+
file: number;
|
|
302
|
+
}>, "many">>>;
|
|
303
|
+
}, "strip", z.ZodTypeAny, {
|
|
304
|
+
locations: Record<string, {
|
|
305
|
+
span: {
|
|
306
|
+
start: number;
|
|
307
|
+
end: number;
|
|
308
|
+
};
|
|
309
|
+
file: number;
|
|
310
|
+
}[]>;
|
|
311
|
+
brillig_locations: Record<string, Record<string, {
|
|
312
|
+
span: {
|
|
313
|
+
start: number;
|
|
314
|
+
end: number;
|
|
315
|
+
};
|
|
316
|
+
file: number;
|
|
317
|
+
}[]>>;
|
|
318
|
+
}, {
|
|
319
|
+
locations: Record<string, {
|
|
320
|
+
span: {
|
|
321
|
+
start: number;
|
|
322
|
+
end: number;
|
|
323
|
+
};
|
|
324
|
+
file: number;
|
|
325
|
+
}[]>;
|
|
326
|
+
brillig_locations: Record<string, Record<string, {
|
|
327
|
+
span: {
|
|
328
|
+
start: number;
|
|
329
|
+
end: number;
|
|
330
|
+
};
|
|
331
|
+
file: number;
|
|
332
|
+
}[]>>;
|
|
333
|
+
}>;
|
|
334
|
+
files: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
335
|
+
source: z.ZodString;
|
|
336
|
+
path: z.ZodString;
|
|
337
|
+
}, "strip", z.ZodTypeAny, {
|
|
338
|
+
path: string;
|
|
339
|
+
source: string;
|
|
340
|
+
}, {
|
|
341
|
+
path: string;
|
|
342
|
+
source: string;
|
|
343
|
+
}>>;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
debugSymbols: {
|
|
346
|
+
locations: Record<string, {
|
|
347
|
+
span: {
|
|
348
|
+
start: number;
|
|
349
|
+
end: number;
|
|
350
|
+
};
|
|
351
|
+
file: number;
|
|
352
|
+
}[]>;
|
|
353
|
+
brillig_locations: Record<string, Record<string, {
|
|
354
|
+
span: {
|
|
355
|
+
start: number;
|
|
356
|
+
end: number;
|
|
357
|
+
};
|
|
358
|
+
file: number;
|
|
359
|
+
}[]>>;
|
|
360
|
+
};
|
|
361
|
+
files: Record<string, {
|
|
362
|
+
path: string;
|
|
363
|
+
source: string;
|
|
364
|
+
}>;
|
|
365
|
+
}, {
|
|
366
|
+
debugSymbols: {
|
|
367
|
+
locations: Record<string, {
|
|
368
|
+
span: {
|
|
369
|
+
start: number;
|
|
370
|
+
end: number;
|
|
371
|
+
};
|
|
372
|
+
file: number;
|
|
373
|
+
}[]>;
|
|
374
|
+
brillig_locations: Record<string, Record<string, {
|
|
375
|
+
span: {
|
|
376
|
+
start: number;
|
|
377
|
+
end: number;
|
|
378
|
+
};
|
|
379
|
+
file: number;
|
|
380
|
+
}[]>>;
|
|
381
|
+
};
|
|
382
|
+
files: Record<string, {
|
|
383
|
+
path: string;
|
|
384
|
+
source: string;
|
|
385
|
+
}>;
|
|
386
|
+
}>;
|
|
387
|
+
/** The artifact entry of a function. */
|
|
176
388
|
export interface FunctionArtifact extends FunctionAbi {
|
|
177
389
|
/** The ACIR bytecode of the function. */
|
|
178
390
|
bytecode: Buffer;
|
|
179
|
-
/** The verification key of the function. */
|
|
391
|
+
/** The verification key of the function, base64 encoded, if it's a private fn. */
|
|
180
392
|
verificationKey?: string;
|
|
181
393
|
/** Maps opcodes to source code pointers */
|
|
182
394
|
debugSymbols: string;
|
|
183
|
-
/**
|
|
184
|
-
* Public functions store their static assertion messages externally to the bytecode.
|
|
185
|
-
*/
|
|
186
|
-
assertMessages?: Record<number, string>;
|
|
187
395
|
/** Debug metadata for the function. */
|
|
188
396
|
debug?: FunctionDebugMetadata;
|
|
189
397
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
398
|
+
export declare const FunctionArtifactSchema: z.ZodIntersection<z.ZodObject<{
|
|
399
|
+
name: z.ZodString;
|
|
400
|
+
functionType: z.ZodNativeEnum<typeof FunctionType>;
|
|
401
|
+
isInternal: z.ZodBoolean;
|
|
402
|
+
isStatic: z.ZodBoolean;
|
|
403
|
+
isInitializer: z.ZodBoolean;
|
|
404
|
+
parameters: z.ZodArray<z.ZodObject<{
|
|
405
|
+
name: z.ZodString;
|
|
406
|
+
type: z.ZodType<AbiType, z.ZodTypeDef, AbiType>;
|
|
407
|
+
visibility: z.ZodEnum<["public", "private", "databus"]>;
|
|
408
|
+
}, "strip", z.ZodTypeAny, {
|
|
409
|
+
type: AbiType;
|
|
410
|
+
name: string;
|
|
411
|
+
visibility: "public" | "private" | "databus";
|
|
412
|
+
}, {
|
|
413
|
+
type: AbiType;
|
|
414
|
+
name: string;
|
|
415
|
+
visibility: "public" | "private" | "databus";
|
|
416
|
+
}>, "many">;
|
|
417
|
+
returnTypes: z.ZodArray<z.ZodType<AbiType, z.ZodTypeDef, AbiType>, "many">;
|
|
418
|
+
errorTypes: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
419
|
+
error_kind: z.ZodLiteral<"string">;
|
|
420
|
+
string: z.ZodString;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
string: string;
|
|
423
|
+
error_kind: "string";
|
|
424
|
+
}, {
|
|
425
|
+
string: string;
|
|
426
|
+
error_kind: "string";
|
|
427
|
+
}>, z.ZodObject<{
|
|
428
|
+
error_kind: z.ZodLiteral<"fmtstring">;
|
|
429
|
+
length: z.ZodNumber;
|
|
430
|
+
item_types: z.ZodArray<z.ZodType<AbiType, z.ZodTypeDef, AbiType>, "many">;
|
|
431
|
+
}, "strip", z.ZodTypeAny, {
|
|
432
|
+
length: number;
|
|
433
|
+
error_kind: "fmtstring";
|
|
434
|
+
item_types: AbiType[];
|
|
435
|
+
}, {
|
|
436
|
+
length: number;
|
|
437
|
+
error_kind: "fmtstring";
|
|
438
|
+
item_types: AbiType[];
|
|
439
|
+
}>, z.ZodIntersection<z.ZodObject<{
|
|
440
|
+
error_kind: z.ZodLiteral<"custom">;
|
|
441
|
+
}, "strip", z.ZodTypeAny, {
|
|
442
|
+
error_kind: "custom";
|
|
443
|
+
}, {
|
|
444
|
+
error_kind: "custom";
|
|
445
|
+
}>, z.ZodType<AbiType, z.ZodTypeDef, AbiType>>]>>;
|
|
446
|
+
}, "strip", z.ZodTypeAny, {
|
|
447
|
+
name: string;
|
|
448
|
+
parameters: {
|
|
449
|
+
type: AbiType;
|
|
450
|
+
name: string;
|
|
451
|
+
visibility: "public" | "private" | "databus";
|
|
452
|
+
}[];
|
|
453
|
+
functionType: FunctionType;
|
|
454
|
+
isInternal: boolean;
|
|
455
|
+
isStatic: boolean;
|
|
456
|
+
isInitializer: boolean;
|
|
457
|
+
returnTypes: AbiType[];
|
|
458
|
+
errorTypes: Record<string, {
|
|
459
|
+
string: string;
|
|
460
|
+
error_kind: "string";
|
|
461
|
+
} | {
|
|
462
|
+
length: number;
|
|
463
|
+
error_kind: "fmtstring";
|
|
464
|
+
item_types: AbiType[];
|
|
465
|
+
} | ({
|
|
466
|
+
error_kind: "custom";
|
|
467
|
+
} & AbiType)>;
|
|
468
|
+
}, {
|
|
469
|
+
name: string;
|
|
470
|
+
parameters: {
|
|
471
|
+
type: AbiType;
|
|
472
|
+
name: string;
|
|
473
|
+
visibility: "public" | "private" | "databus";
|
|
474
|
+
}[];
|
|
475
|
+
functionType: FunctionType;
|
|
476
|
+
isInternal: boolean;
|
|
477
|
+
isStatic: boolean;
|
|
478
|
+
isInitializer: boolean;
|
|
479
|
+
returnTypes: AbiType[];
|
|
480
|
+
errorTypes: Record<string, {
|
|
481
|
+
string: string;
|
|
482
|
+
error_kind: "string";
|
|
483
|
+
} | {
|
|
484
|
+
length: number;
|
|
485
|
+
error_kind: "fmtstring";
|
|
486
|
+
item_types: AbiType[];
|
|
487
|
+
} | ({
|
|
488
|
+
error_kind: "custom";
|
|
489
|
+
} & AbiType)>;
|
|
490
|
+
}>, z.ZodObject<{
|
|
491
|
+
bytecode: z.ZodUnion<[z.ZodEffects<z.ZodString, Buffer, string>, z.ZodEffects<z.ZodObject<{
|
|
492
|
+
type: z.ZodLiteral<"Buffer">;
|
|
493
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
494
|
+
}, "strip", z.ZodTypeAny, {
|
|
495
|
+
type: "Buffer";
|
|
496
|
+
data: number[];
|
|
497
|
+
}, {
|
|
498
|
+
type: "Buffer";
|
|
499
|
+
data: number[];
|
|
500
|
+
}>, Buffer, {
|
|
501
|
+
type: "Buffer";
|
|
502
|
+
data: number[];
|
|
503
|
+
}>]>;
|
|
504
|
+
verificationKey: z.ZodOptional<z.ZodString>;
|
|
505
|
+
debugSymbols: z.ZodString;
|
|
506
|
+
debug: z.ZodOptional<z.ZodObject<{
|
|
507
|
+
debugSymbols: z.ZodObject<{
|
|
508
|
+
locations: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
509
|
+
span: z.ZodObject<{
|
|
510
|
+
start: z.ZodNumber;
|
|
511
|
+
end: z.ZodNumber;
|
|
512
|
+
}, "strip", z.ZodTypeAny, {
|
|
513
|
+
start: number;
|
|
514
|
+
end: number;
|
|
515
|
+
}, {
|
|
516
|
+
start: number;
|
|
517
|
+
end: number;
|
|
518
|
+
}>;
|
|
519
|
+
file: z.ZodNumber;
|
|
520
|
+
}, "strip", z.ZodTypeAny, {
|
|
521
|
+
span: {
|
|
522
|
+
start: number;
|
|
523
|
+
end: number;
|
|
524
|
+
};
|
|
525
|
+
file: number;
|
|
526
|
+
}, {
|
|
527
|
+
span: {
|
|
528
|
+
start: number;
|
|
529
|
+
end: number;
|
|
530
|
+
};
|
|
531
|
+
file: number;
|
|
532
|
+
}>, "many">>;
|
|
533
|
+
brillig_locations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
534
|
+
span: z.ZodObject<{
|
|
535
|
+
start: z.ZodNumber;
|
|
536
|
+
end: z.ZodNumber;
|
|
537
|
+
}, "strip", z.ZodTypeAny, {
|
|
538
|
+
start: number;
|
|
539
|
+
end: number;
|
|
540
|
+
}, {
|
|
541
|
+
start: number;
|
|
542
|
+
end: number;
|
|
543
|
+
}>;
|
|
544
|
+
file: z.ZodNumber;
|
|
545
|
+
}, "strip", z.ZodTypeAny, {
|
|
546
|
+
span: {
|
|
547
|
+
start: number;
|
|
548
|
+
end: number;
|
|
549
|
+
};
|
|
550
|
+
file: number;
|
|
551
|
+
}, {
|
|
552
|
+
span: {
|
|
553
|
+
start: number;
|
|
554
|
+
end: number;
|
|
555
|
+
};
|
|
556
|
+
file: number;
|
|
557
|
+
}>, "many">>>;
|
|
558
|
+
}, "strip", z.ZodTypeAny, {
|
|
559
|
+
locations: Record<string, {
|
|
560
|
+
span: {
|
|
561
|
+
start: number;
|
|
562
|
+
end: number;
|
|
563
|
+
};
|
|
564
|
+
file: number;
|
|
565
|
+
}[]>;
|
|
566
|
+
brillig_locations: Record<string, Record<string, {
|
|
567
|
+
span: {
|
|
568
|
+
start: number;
|
|
569
|
+
end: number;
|
|
570
|
+
};
|
|
571
|
+
file: number;
|
|
572
|
+
}[]>>;
|
|
573
|
+
}, {
|
|
574
|
+
locations: Record<string, {
|
|
575
|
+
span: {
|
|
576
|
+
start: number;
|
|
577
|
+
end: number;
|
|
578
|
+
};
|
|
579
|
+
file: number;
|
|
580
|
+
}[]>;
|
|
581
|
+
brillig_locations: Record<string, Record<string, {
|
|
582
|
+
span: {
|
|
583
|
+
start: number;
|
|
584
|
+
end: number;
|
|
585
|
+
};
|
|
586
|
+
file: number;
|
|
587
|
+
}[]>>;
|
|
588
|
+
}>;
|
|
589
|
+
files: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
590
|
+
source: z.ZodString;
|
|
591
|
+
path: z.ZodString;
|
|
592
|
+
}, "strip", z.ZodTypeAny, {
|
|
593
|
+
path: string;
|
|
594
|
+
source: string;
|
|
595
|
+
}, {
|
|
596
|
+
path: string;
|
|
597
|
+
source: string;
|
|
598
|
+
}>>;
|
|
599
|
+
}, "strip", z.ZodTypeAny, {
|
|
600
|
+
debugSymbols: {
|
|
601
|
+
locations: Record<string, {
|
|
602
|
+
span: {
|
|
603
|
+
start: number;
|
|
604
|
+
end: number;
|
|
605
|
+
};
|
|
606
|
+
file: number;
|
|
607
|
+
}[]>;
|
|
608
|
+
brillig_locations: Record<string, Record<string, {
|
|
609
|
+
span: {
|
|
610
|
+
start: number;
|
|
611
|
+
end: number;
|
|
612
|
+
};
|
|
613
|
+
file: number;
|
|
614
|
+
}[]>>;
|
|
615
|
+
};
|
|
616
|
+
files: Record<string, {
|
|
617
|
+
path: string;
|
|
618
|
+
source: string;
|
|
619
|
+
}>;
|
|
620
|
+
}, {
|
|
621
|
+
debugSymbols: {
|
|
622
|
+
locations: Record<string, {
|
|
623
|
+
span: {
|
|
624
|
+
start: number;
|
|
625
|
+
end: number;
|
|
626
|
+
};
|
|
627
|
+
file: number;
|
|
628
|
+
}[]>;
|
|
629
|
+
brillig_locations: Record<string, Record<string, {
|
|
630
|
+
span: {
|
|
631
|
+
start: number;
|
|
632
|
+
end: number;
|
|
633
|
+
};
|
|
634
|
+
file: number;
|
|
635
|
+
}[]>>;
|
|
636
|
+
};
|
|
637
|
+
files: Record<string, {
|
|
638
|
+
path: string;
|
|
639
|
+
source: string;
|
|
640
|
+
}>;
|
|
641
|
+
}>>;
|
|
642
|
+
}, "strip", z.ZodTypeAny, {
|
|
643
|
+
debugSymbols: string;
|
|
644
|
+
bytecode: Buffer;
|
|
645
|
+
debug?: {
|
|
646
|
+
debugSymbols: {
|
|
647
|
+
locations: Record<string, {
|
|
648
|
+
span: {
|
|
649
|
+
start: number;
|
|
650
|
+
end: number;
|
|
651
|
+
};
|
|
652
|
+
file: number;
|
|
653
|
+
}[]>;
|
|
654
|
+
brillig_locations: Record<string, Record<string, {
|
|
655
|
+
span: {
|
|
656
|
+
start: number;
|
|
657
|
+
end: number;
|
|
658
|
+
};
|
|
659
|
+
file: number;
|
|
660
|
+
}[]>>;
|
|
661
|
+
};
|
|
662
|
+
files: Record<string, {
|
|
663
|
+
path: string;
|
|
664
|
+
source: string;
|
|
665
|
+
}>;
|
|
666
|
+
} | undefined;
|
|
667
|
+
verificationKey?: string | undefined;
|
|
668
|
+
}, {
|
|
669
|
+
debugSymbols: string;
|
|
670
|
+
bytecode: string | {
|
|
671
|
+
type: "Buffer";
|
|
672
|
+
data: number[];
|
|
673
|
+
};
|
|
674
|
+
debug?: {
|
|
675
|
+
debugSymbols: {
|
|
676
|
+
locations: Record<string, {
|
|
677
|
+
span: {
|
|
678
|
+
start: number;
|
|
679
|
+
end: number;
|
|
680
|
+
};
|
|
681
|
+
file: number;
|
|
682
|
+
}[]>;
|
|
683
|
+
brillig_locations: Record<string, Record<string, {
|
|
684
|
+
span: {
|
|
685
|
+
start: number;
|
|
686
|
+
end: number;
|
|
687
|
+
};
|
|
688
|
+
file: number;
|
|
689
|
+
}[]>>;
|
|
690
|
+
};
|
|
691
|
+
files: Record<string, {
|
|
692
|
+
path: string;
|
|
693
|
+
source: string;
|
|
694
|
+
}>;
|
|
695
|
+
} | undefined;
|
|
696
|
+
verificationKey?: string | undefined;
|
|
697
|
+
}>>;
|
|
698
|
+
/** A file ID. It's assigned during compilation. */
|
|
193
699
|
export type FileId = number;
|
|
194
|
-
/**
|
|
195
|
-
* A pointer to a specific section of the source code.
|
|
196
|
-
*/
|
|
700
|
+
/** A pointer to a specific section of the source code. */
|
|
197
701
|
export interface SourceCodeLocation {
|
|
198
|
-
/**
|
|
199
|
-
* The section of the source code.
|
|
200
|
-
*/
|
|
702
|
+
/** The section of the source code. */
|
|
201
703
|
span: {
|
|
202
|
-
/**
|
|
203
|
-
* The byte where the section starts.
|
|
204
|
-
*/
|
|
704
|
+
/** The byte where the section starts. */
|
|
205
705
|
start: number;
|
|
206
|
-
/**
|
|
207
|
-
* The byte where the section ends.
|
|
208
|
-
*/
|
|
706
|
+
/** The byte where the section ends. */
|
|
209
707
|
end: number;
|
|
210
708
|
};
|
|
211
|
-
/**
|
|
212
|
-
* The source code file pointed to.
|
|
213
|
-
*/
|
|
709
|
+
/** The source code file pointed to. */
|
|
214
710
|
file: FileId;
|
|
215
711
|
}
|
|
216
712
|
/**
|
|
@@ -220,58 +716,25 @@ export interface SourceCodeLocation {
|
|
|
220
716
|
export type OpcodeLocation = string;
|
|
221
717
|
export type BrilligFunctionId = number;
|
|
222
718
|
export type OpcodeToLocationsMap = Record<OpcodeLocation, SourceCodeLocation[]>;
|
|
223
|
-
/**
|
|
224
|
-
* The debug information for a given function.
|
|
225
|
-
*/
|
|
719
|
+
/** The debug information for a given function. */
|
|
226
720
|
export interface DebugInfo {
|
|
227
|
-
/**
|
|
228
|
-
* A map of the opcode location to the source code location.
|
|
229
|
-
*/
|
|
721
|
+
/** A map of the opcode location to the source code location. */
|
|
230
722
|
locations: OpcodeToLocationsMap;
|
|
231
|
-
/**
|
|
232
|
-
* For each Brillig function, we have a map of the opcode location to the source code location.
|
|
233
|
-
*/
|
|
723
|
+
/** For each Brillig function, we have a map of the opcode location to the source code location. */
|
|
234
724
|
brillig_locations: Record<BrilligFunctionId, OpcodeToLocationsMap>;
|
|
235
725
|
}
|
|
236
|
-
/**
|
|
237
|
-
* The debug information for a given program (a collection of functions)
|
|
238
|
-
*/
|
|
726
|
+
/** The debug information for a given program (a collection of functions) */
|
|
239
727
|
export interface ProgramDebugInfo {
|
|
240
|
-
/**
|
|
241
|
-
* A list of debug information that matches with each function in a program
|
|
242
|
-
*/
|
|
728
|
+
/** A list of debug information that matches with each function in a program */
|
|
243
729
|
debug_infos: Array<DebugInfo>;
|
|
244
730
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Maps a file ID to its metadata for debugging purposes.
|
|
247
|
-
*/
|
|
731
|
+
/** Maps a file ID to its metadata for debugging purposes. */
|
|
248
732
|
export type DebugFileMap = Record<FileId, {
|
|
249
|
-
/**
|
|
250
|
-
* The source code of the file.
|
|
251
|
-
*/
|
|
733
|
+
/** The source code of the file. */
|
|
252
734
|
source: string;
|
|
253
|
-
/**
|
|
254
|
-
* The path of the file.
|
|
255
|
-
*/
|
|
735
|
+
/** The path of the file. */
|
|
256
736
|
path: string;
|
|
257
737
|
}>;
|
|
258
|
-
/**
|
|
259
|
-
* Type representing a note in use in the contract.
|
|
260
|
-
*/
|
|
261
|
-
export type ContractNote = {
|
|
262
|
-
/**
|
|
263
|
-
* Note identifier
|
|
264
|
-
*/
|
|
265
|
-
id: NoteSelector;
|
|
266
|
-
/**
|
|
267
|
-
* Type of the note (e.g., 'TransparentNote')
|
|
268
|
-
*/
|
|
269
|
-
typ: string;
|
|
270
|
-
/**
|
|
271
|
-
* Fields of the note.
|
|
272
|
-
*/
|
|
273
|
-
fields: NoteField[];
|
|
274
|
-
};
|
|
275
738
|
/** Type representing a field of a note (e.g. `amount` in `TokenNote`). */
|
|
276
739
|
export type NoteField = {
|
|
277
740
|
/** Name of the field (e.g. `amount`). */
|
|
@@ -281,71 +744,88 @@ export type NoteField = {
|
|
|
281
744
|
/** Whether the field can be unset when creating the note (in the partial notes flow). */
|
|
282
745
|
nullable: boolean;
|
|
283
746
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
747
|
+
export declare const NoteFieldSchema: z.ZodObject<{
|
|
748
|
+
name: z.ZodString;
|
|
749
|
+
index: z.ZodNumber;
|
|
750
|
+
nullable: z.ZodBoolean;
|
|
751
|
+
}, "strip", z.ZodTypeAny, {
|
|
752
|
+
name: string;
|
|
753
|
+
nullable: boolean;
|
|
754
|
+
index: number;
|
|
755
|
+
}, {
|
|
756
|
+
name: string;
|
|
757
|
+
nullable: boolean;
|
|
758
|
+
index: number;
|
|
759
|
+
}>;
|
|
760
|
+
/** Type representing a note in use in the contract. */
|
|
761
|
+
export type ContractNote = {
|
|
762
|
+
/** Note identifier */
|
|
763
|
+
id: NoteSelector;
|
|
764
|
+
/** Type of the note (e.g., 'TransparentNote') */
|
|
765
|
+
typ: string;
|
|
766
|
+
/** Fields of the note. */
|
|
767
|
+
fields: NoteField[];
|
|
768
|
+
};
|
|
769
|
+
export declare const ContractNoteSchema: z.ZodObject<{
|
|
770
|
+
id: ZodFor<NoteSelector>;
|
|
771
|
+
typ: z.ZodString;
|
|
772
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
773
|
+
name: z.ZodString;
|
|
774
|
+
index: z.ZodNumber;
|
|
775
|
+
nullable: z.ZodBoolean;
|
|
776
|
+
}, "strip", z.ZodTypeAny, {
|
|
777
|
+
name: string;
|
|
778
|
+
nullable: boolean;
|
|
779
|
+
index: number;
|
|
780
|
+
}, {
|
|
781
|
+
name: string;
|
|
782
|
+
nullable: boolean;
|
|
783
|
+
index: number;
|
|
784
|
+
}>, "many">;
|
|
785
|
+
}, "strip", z.ZodTypeAny, {
|
|
786
|
+
fields: {
|
|
787
|
+
name: string;
|
|
788
|
+
nullable: boolean;
|
|
789
|
+
index: number;
|
|
790
|
+
}[];
|
|
791
|
+
id: NoteSelector;
|
|
792
|
+
typ: string;
|
|
793
|
+
}, {
|
|
794
|
+
fields: {
|
|
795
|
+
name: string;
|
|
796
|
+
nullable: boolean;
|
|
797
|
+
index: number;
|
|
798
|
+
}[];
|
|
799
|
+
typ: string;
|
|
800
|
+
id?: any;
|
|
801
|
+
}>;
|
|
802
|
+
/** Type representing a field layout in the storage of a contract. */
|
|
287
803
|
export type FieldLayout = {
|
|
288
|
-
/**
|
|
289
|
-
* Slot in which the field is stored.
|
|
290
|
-
*/
|
|
804
|
+
/** Slot in which the field is stored. */
|
|
291
805
|
slot: Fr;
|
|
292
806
|
};
|
|
293
|
-
/**
|
|
294
|
-
* Defines artifact of a contract.
|
|
295
|
-
*/
|
|
807
|
+
/** Defines artifact of a contract. */
|
|
296
808
|
export interface ContractArtifact {
|
|
297
|
-
/**
|
|
298
|
-
* The name of the contract.
|
|
299
|
-
*/
|
|
809
|
+
/** The name of the contract. */
|
|
300
810
|
name: string;
|
|
301
|
-
/**
|
|
302
|
-
* The version of compiler used to create this artifact
|
|
303
|
-
*/
|
|
811
|
+
/** The version of compiler used to create this artifact */
|
|
304
812
|
aztecNrVersion?: string;
|
|
305
|
-
/**
|
|
306
|
-
* The functions of the contract.
|
|
307
|
-
*/
|
|
813
|
+
/** The functions of the contract. */
|
|
308
814
|
functions: FunctionArtifact[];
|
|
309
|
-
/**
|
|
310
|
-
* The outputs of the contract.
|
|
311
|
-
*/
|
|
815
|
+
/** The outputs of the contract. */
|
|
312
816
|
outputs: {
|
|
313
817
|
structs: Record<string, AbiType[]>;
|
|
314
818
|
globals: Record<string, AbiValue[]>;
|
|
315
819
|
};
|
|
316
|
-
/**
|
|
317
|
-
* Storage layout
|
|
318
|
-
*/
|
|
820
|
+
/** Storage layout */
|
|
319
821
|
storageLayout: Record<string, FieldLayout>;
|
|
320
|
-
/**
|
|
321
|
-
* The notes used in the contract.
|
|
322
|
-
*/
|
|
822
|
+
/** The notes used in the contract. */
|
|
323
823
|
notes: Record<string, ContractNote>;
|
|
324
|
-
/**
|
|
325
|
-
* The map of file ID to the source code and path of the file.
|
|
326
|
-
*/
|
|
824
|
+
/** The map of file ID to the source code and path of the file. */
|
|
327
825
|
fileMap: DebugFileMap;
|
|
328
826
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
*/
|
|
332
|
-
export interface FunctionDebugMetadata {
|
|
333
|
-
/**
|
|
334
|
-
* Maps opcodes to source code pointers
|
|
335
|
-
*/
|
|
336
|
-
debugSymbols: DebugInfo;
|
|
337
|
-
/**
|
|
338
|
-
* Maps the file IDs to the file contents to resolve pointers
|
|
339
|
-
*/
|
|
340
|
-
files: DebugFileMap;
|
|
341
|
-
/**
|
|
342
|
-
* Public functions store their static assertion messages externally to the bytecode.
|
|
343
|
-
*/
|
|
344
|
-
assertMessages?: Record<number, string>;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Gets a function artifact including debug metadata given its name or selector.
|
|
348
|
-
*/
|
|
827
|
+
export declare const ContractArtifactSchema: ZodFor<ContractArtifact>;
|
|
828
|
+
/** Gets a function artifact including debug metadata given its name or selector. */
|
|
349
829
|
export declare function getFunctionArtifact(artifact: ContractArtifact, functionNameOrSelector: string | FunctionSelector): FunctionArtifact;
|
|
350
830
|
/**
|
|
351
831
|
* Gets the debug metadata of a given function from the contract artifact
|