@nucypher/taco 0.7.0-alpha.10 → 0.7.0-alpha.12
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/dist/cjs/conditions/const.d.ts +1 -0
- package/dist/cjs/conditions/const.js +2 -1
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.js +2 -0
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/schemas/context-variable.d.ts +93 -33
- package/dist/cjs/conditions/schemas/contract.d.ts +121 -49
- package/dist/cjs/conditions/schemas/json-api.d.ts +121 -49
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +121 -49
- package/dist/cjs/conditions/schemas/json.d.ts +95 -35
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +156 -60
- package/dist/cjs/conditions/schemas/rpc.d.ts +97 -37
- package/dist/cjs/conditions/schemas/signing.js +60 -31
- package/dist/cjs/conditions/schemas/signing.js.map +1 -1
- package/dist/cjs/conditions/schemas/time.d.ts +94 -34
- package/dist/cjs/conditions/schemas/variable-operation.d.ts +67 -19
- package/dist/cjs/conditions/schemas/variable-operation.js +27 -3
- package/dist/cjs/conditions/schemas/variable-operation.js.map +1 -1
- package/dist/es/conditions/const.d.ts +1 -0
- package/dist/es/conditions/const.js +1 -0
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.js +3 -1
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/schemas/context-variable.d.ts +95 -35
- package/dist/es/conditions/schemas/contract.d.ts +121 -49
- package/dist/es/conditions/schemas/json-api.d.ts +121 -49
- package/dist/es/conditions/schemas/json-rpc.d.ts +121 -49
- package/dist/es/conditions/schemas/json.d.ts +95 -35
- package/dist/es/conditions/schemas/return-value-test.d.ts +156 -60
- package/dist/es/conditions/schemas/rpc.d.ts +97 -37
- package/dist/es/conditions/schemas/signing.js +60 -31
- package/dist/es/conditions/schemas/signing.js.map +1 -1
- package/dist/es/conditions/schemas/time.d.ts +94 -34
- package/dist/es/conditions/schemas/variable-operation.d.ts +67 -19
- package/dist/es/conditions/schemas/variable-operation.js +28 -4
- package/dist/es/conditions/schemas/variable-operation.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -2,122 +2,218 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const returnValueTestSchema: z.ZodEffects<z.ZodObject<{
|
|
3
3
|
index: z.ZodOptional<z.ZodNumber>;
|
|
4
4
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
5
|
-
operations: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
6
|
-
operation: z.ZodEnum<[
|
|
5
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodObject<{} & {
|
|
6
|
+
operation: z.ZodEnum<[string, ...string[]]>;
|
|
7
7
|
value: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
operation:
|
|
9
|
+
operation: string;
|
|
10
10
|
value?: any;
|
|
11
11
|
}, {
|
|
12
|
-
operation:
|
|
12
|
+
operation: string;
|
|
13
13
|
value?: any;
|
|
14
14
|
}>, {
|
|
15
|
-
operation:
|
|
15
|
+
operation: string;
|
|
16
16
|
value?: any;
|
|
17
17
|
}, {
|
|
18
|
-
operation:
|
|
18
|
+
operation: string;
|
|
19
19
|
value?: any;
|
|
20
20
|
}>, {
|
|
21
|
-
operation:
|
|
21
|
+
operation: string;
|
|
22
22
|
value?: any;
|
|
23
23
|
}, {
|
|
24
|
-
operation:
|
|
25
|
-
value?: any;
|
|
26
|
-
}>,
|
|
24
|
+
operation: string;
|
|
25
|
+
value?: any;
|
|
26
|
+
}>, z.ZodObject<{} & {
|
|
27
|
+
operation: z.ZodLiteral<"create2">;
|
|
28
|
+
value: z.ZodObject<{
|
|
29
|
+
deployerAddress: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
30
|
+
bytecodeHash: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
deployerAddress: string;
|
|
33
|
+
bytecodeHash: string;
|
|
34
|
+
}, {
|
|
35
|
+
deployerAddress: string;
|
|
36
|
+
bytecodeHash: string;
|
|
37
|
+
}>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
value: {
|
|
40
|
+
deployerAddress: string;
|
|
41
|
+
bytecodeHash: string;
|
|
42
|
+
};
|
|
43
|
+
operation: "create2";
|
|
44
|
+
}, {
|
|
45
|
+
value: {
|
|
46
|
+
deployerAddress: string;
|
|
47
|
+
bytecodeHash: string;
|
|
48
|
+
};
|
|
49
|
+
operation: "create2";
|
|
50
|
+
}>]>, "many">>;
|
|
27
51
|
} & {
|
|
28
52
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
29
53
|
}, "strip", z.ZodTypeAny, {
|
|
30
54
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
31
|
-
index?: number | undefined;
|
|
32
55
|
value?: any;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
index?: number | undefined;
|
|
57
|
+
operations?: ({
|
|
58
|
+
operation: string;
|
|
59
|
+
value?: any;
|
|
60
|
+
} | {
|
|
61
|
+
value: {
|
|
62
|
+
deployerAddress: string;
|
|
63
|
+
bytecodeHash: string;
|
|
64
|
+
};
|
|
65
|
+
operation: "create2";
|
|
66
|
+
})[] | undefined;
|
|
37
67
|
}, {
|
|
38
68
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
39
|
-
index?: number | undefined;
|
|
40
69
|
value?: any;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
index?: number | undefined;
|
|
71
|
+
operations?: ({
|
|
72
|
+
operation: string;
|
|
73
|
+
value?: any;
|
|
74
|
+
} | {
|
|
75
|
+
value: {
|
|
76
|
+
deployerAddress: string;
|
|
77
|
+
bytecodeHash: string;
|
|
78
|
+
};
|
|
79
|
+
operation: "create2";
|
|
80
|
+
})[] | undefined;
|
|
45
81
|
}>, {
|
|
46
82
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
47
|
-
index?: number | undefined;
|
|
48
83
|
value?: any;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
84
|
+
index?: number | undefined;
|
|
85
|
+
operations?: ({
|
|
86
|
+
operation: string;
|
|
87
|
+
value?: any;
|
|
88
|
+
} | {
|
|
89
|
+
value: {
|
|
90
|
+
deployerAddress: string;
|
|
91
|
+
bytecodeHash: string;
|
|
92
|
+
};
|
|
93
|
+
operation: "create2";
|
|
94
|
+
})[] | undefined;
|
|
53
95
|
}, {
|
|
54
96
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
55
|
-
index?: number | undefined;
|
|
56
97
|
value?: any;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
98
|
+
index?: number | undefined;
|
|
99
|
+
operations?: ({
|
|
100
|
+
operation: string;
|
|
101
|
+
value?: any;
|
|
102
|
+
} | {
|
|
103
|
+
value: {
|
|
104
|
+
deployerAddress: string;
|
|
105
|
+
bytecodeHash: string;
|
|
106
|
+
};
|
|
107
|
+
operation: "create2";
|
|
108
|
+
})[] | undefined;
|
|
61
109
|
}>;
|
|
62
110
|
export declare const blockchainReturnValueTestSchema: z.ZodEffects<z.ZodObject<{
|
|
63
111
|
index: z.ZodOptional<z.ZodNumber>;
|
|
64
112
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
65
|
-
operations: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
66
|
-
operation: z.ZodEnum<[
|
|
113
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodObject<{} & {
|
|
114
|
+
operation: z.ZodEnum<[string, ...string[]]>;
|
|
67
115
|
value: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
68
116
|
}, "strip", z.ZodTypeAny, {
|
|
69
|
-
operation:
|
|
117
|
+
operation: string;
|
|
70
118
|
value?: any;
|
|
71
119
|
}, {
|
|
72
|
-
operation:
|
|
120
|
+
operation: string;
|
|
73
121
|
value?: any;
|
|
74
122
|
}>, {
|
|
75
|
-
operation:
|
|
123
|
+
operation: string;
|
|
76
124
|
value?: any;
|
|
77
125
|
}, {
|
|
78
|
-
operation:
|
|
126
|
+
operation: string;
|
|
79
127
|
value?: any;
|
|
80
128
|
}>, {
|
|
81
|
-
operation:
|
|
129
|
+
operation: string;
|
|
82
130
|
value?: any;
|
|
83
131
|
}, {
|
|
84
|
-
operation:
|
|
85
|
-
value?: any;
|
|
86
|
-
}>,
|
|
132
|
+
operation: string;
|
|
133
|
+
value?: any;
|
|
134
|
+
}>, z.ZodObject<{} & {
|
|
135
|
+
operation: z.ZodLiteral<"create2">;
|
|
136
|
+
value: z.ZodObject<{
|
|
137
|
+
deployerAddress: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
138
|
+
bytecodeHash: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
deployerAddress: string;
|
|
141
|
+
bytecodeHash: string;
|
|
142
|
+
}, {
|
|
143
|
+
deployerAddress: string;
|
|
144
|
+
bytecodeHash: string;
|
|
145
|
+
}>;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
value: {
|
|
148
|
+
deployerAddress: string;
|
|
149
|
+
bytecodeHash: string;
|
|
150
|
+
};
|
|
151
|
+
operation: "create2";
|
|
152
|
+
}, {
|
|
153
|
+
value: {
|
|
154
|
+
deployerAddress: string;
|
|
155
|
+
bytecodeHash: string;
|
|
156
|
+
};
|
|
157
|
+
operation: "create2";
|
|
158
|
+
}>]>, "many">>;
|
|
87
159
|
} & {
|
|
88
160
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
89
161
|
}, "strip", z.ZodTypeAny, {
|
|
90
162
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
91
|
-
index?: number | undefined;
|
|
92
163
|
value?: any;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
164
|
+
index?: number | undefined;
|
|
165
|
+
operations?: ({
|
|
166
|
+
operation: string;
|
|
167
|
+
value?: any;
|
|
168
|
+
} | {
|
|
169
|
+
value: {
|
|
170
|
+
deployerAddress: string;
|
|
171
|
+
bytecodeHash: string;
|
|
172
|
+
};
|
|
173
|
+
operation: "create2";
|
|
174
|
+
})[] | undefined;
|
|
97
175
|
}, {
|
|
98
176
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
99
|
-
index?: number | undefined;
|
|
100
177
|
value?: any;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
178
|
+
index?: number | undefined;
|
|
179
|
+
operations?: ({
|
|
180
|
+
operation: string;
|
|
181
|
+
value?: any;
|
|
182
|
+
} | {
|
|
183
|
+
value: {
|
|
184
|
+
deployerAddress: string;
|
|
185
|
+
bytecodeHash: string;
|
|
186
|
+
};
|
|
187
|
+
operation: "create2";
|
|
188
|
+
})[] | undefined;
|
|
105
189
|
}>, {
|
|
106
190
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
107
|
-
index?: number | undefined;
|
|
108
191
|
value?: any;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
192
|
+
index?: number | undefined;
|
|
193
|
+
operations?: ({
|
|
194
|
+
operation: string;
|
|
195
|
+
value?: any;
|
|
196
|
+
} | {
|
|
197
|
+
value: {
|
|
198
|
+
deployerAddress: string;
|
|
199
|
+
bytecodeHash: string;
|
|
200
|
+
};
|
|
201
|
+
operation: "create2";
|
|
202
|
+
})[] | undefined;
|
|
113
203
|
}, {
|
|
114
204
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
115
|
-
index?: number | undefined;
|
|
116
205
|
value?: any;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
206
|
+
index?: number | undefined;
|
|
207
|
+
operations?: ({
|
|
208
|
+
operation: string;
|
|
209
|
+
value?: any;
|
|
210
|
+
} | {
|
|
211
|
+
value: {
|
|
212
|
+
deployerAddress: string;
|
|
213
|
+
bytecodeHash: string;
|
|
214
|
+
};
|
|
215
|
+
operation: "create2";
|
|
216
|
+
})[] | undefined;
|
|
121
217
|
}>;
|
|
122
218
|
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
123
219
|
export type BlockchainReturnValueTestProps = z.infer<typeof blockchainReturnValueTestSchema>;
|
|
@@ -8,90 +8,150 @@ export declare const rpcConditionSchema: z.ZodObject<{} & {
|
|
|
8
8
|
returnValueTest: z.ZodEffects<z.ZodObject<{
|
|
9
9
|
index: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
11
|
-
operations: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
12
|
-
operation: z.ZodEnum<[
|
|
11
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodObject<{} & {
|
|
12
|
+
operation: z.ZodEnum<[string, ...string[]]>;
|
|
13
13
|
value: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
operation:
|
|
15
|
+
operation: string;
|
|
16
16
|
value?: any;
|
|
17
17
|
}, {
|
|
18
|
-
operation:
|
|
18
|
+
operation: string;
|
|
19
19
|
value?: any;
|
|
20
20
|
}>, {
|
|
21
|
-
operation:
|
|
21
|
+
operation: string;
|
|
22
22
|
value?: any;
|
|
23
23
|
}, {
|
|
24
|
-
operation:
|
|
24
|
+
operation: string;
|
|
25
25
|
value?: any;
|
|
26
26
|
}>, {
|
|
27
|
-
operation:
|
|
27
|
+
operation: string;
|
|
28
28
|
value?: any;
|
|
29
29
|
}, {
|
|
30
|
-
operation:
|
|
30
|
+
operation: string;
|
|
31
31
|
value?: any;
|
|
32
|
-
}>,
|
|
32
|
+
}>, z.ZodObject<{} & {
|
|
33
|
+
operation: z.ZodLiteral<"create2">;
|
|
34
|
+
value: z.ZodObject<{
|
|
35
|
+
deployerAddress: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
36
|
+
bytecodeHash: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
deployerAddress: string;
|
|
39
|
+
bytecodeHash: string;
|
|
40
|
+
}, {
|
|
41
|
+
deployerAddress: string;
|
|
42
|
+
bytecodeHash: string;
|
|
43
|
+
}>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
value: {
|
|
46
|
+
deployerAddress: string;
|
|
47
|
+
bytecodeHash: string;
|
|
48
|
+
};
|
|
49
|
+
operation: "create2";
|
|
50
|
+
}, {
|
|
51
|
+
value: {
|
|
52
|
+
deployerAddress: string;
|
|
53
|
+
bytecodeHash: string;
|
|
54
|
+
};
|
|
55
|
+
operation: "create2";
|
|
56
|
+
}>]>, "many">>;
|
|
33
57
|
} & {
|
|
34
58
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
35
59
|
}, "strip", z.ZodTypeAny, {
|
|
36
60
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
37
|
-
index?: number | undefined;
|
|
38
61
|
value?: any;
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
index?: number | undefined;
|
|
63
|
+
operations?: ({
|
|
64
|
+
operation: string;
|
|
41
65
|
value?: any;
|
|
42
|
-
}
|
|
66
|
+
} | {
|
|
67
|
+
value: {
|
|
68
|
+
deployerAddress: string;
|
|
69
|
+
bytecodeHash: string;
|
|
70
|
+
};
|
|
71
|
+
operation: "create2";
|
|
72
|
+
})[] | undefined;
|
|
43
73
|
}, {
|
|
44
74
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
45
|
-
index?: number | undefined;
|
|
46
75
|
value?: any;
|
|
47
|
-
|
|
48
|
-
|
|
76
|
+
index?: number | undefined;
|
|
77
|
+
operations?: ({
|
|
78
|
+
operation: string;
|
|
49
79
|
value?: any;
|
|
50
|
-
}
|
|
80
|
+
} | {
|
|
81
|
+
value: {
|
|
82
|
+
deployerAddress: string;
|
|
83
|
+
bytecodeHash: string;
|
|
84
|
+
};
|
|
85
|
+
operation: "create2";
|
|
86
|
+
})[] | undefined;
|
|
51
87
|
}>, {
|
|
52
88
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
53
|
-
index?: number | undefined;
|
|
54
89
|
value?: any;
|
|
55
|
-
|
|
56
|
-
|
|
90
|
+
index?: number | undefined;
|
|
91
|
+
operations?: ({
|
|
92
|
+
operation: string;
|
|
57
93
|
value?: any;
|
|
58
|
-
}
|
|
94
|
+
} | {
|
|
95
|
+
value: {
|
|
96
|
+
deployerAddress: string;
|
|
97
|
+
bytecodeHash: string;
|
|
98
|
+
};
|
|
99
|
+
operation: "create2";
|
|
100
|
+
})[] | undefined;
|
|
59
101
|
}, {
|
|
60
102
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
61
|
-
index?: number | undefined;
|
|
62
103
|
value?: any;
|
|
63
|
-
|
|
64
|
-
|
|
104
|
+
index?: number | undefined;
|
|
105
|
+
operations?: ({
|
|
106
|
+
operation: string;
|
|
65
107
|
value?: any;
|
|
66
|
-
}
|
|
108
|
+
} | {
|
|
109
|
+
value: {
|
|
110
|
+
deployerAddress: string;
|
|
111
|
+
bytecodeHash: string;
|
|
112
|
+
};
|
|
113
|
+
operation: "create2";
|
|
114
|
+
})[] | undefined;
|
|
67
115
|
}>;
|
|
68
116
|
}, "strip", z.ZodTypeAny, {
|
|
69
117
|
conditionType: "rpc";
|
|
70
|
-
method: "eth_getBalance";
|
|
71
118
|
returnValueTest: {
|
|
72
119
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
73
|
-
index?: number | undefined;
|
|
74
120
|
value?: any;
|
|
75
|
-
|
|
76
|
-
|
|
121
|
+
index?: number | undefined;
|
|
122
|
+
operations?: ({
|
|
123
|
+
operation: string;
|
|
77
124
|
value?: any;
|
|
78
|
-
}
|
|
125
|
+
} | {
|
|
126
|
+
value: {
|
|
127
|
+
deployerAddress: string;
|
|
128
|
+
bytecodeHash: string;
|
|
129
|
+
};
|
|
130
|
+
operation: "create2";
|
|
131
|
+
})[] | undefined;
|
|
79
132
|
};
|
|
80
|
-
parameters: [string] | [string, string | number];
|
|
81
133
|
chain: number;
|
|
82
|
-
}, {
|
|
83
134
|
method: "eth_getBalance";
|
|
135
|
+
parameters: [string, string | number] | [string];
|
|
136
|
+
}, {
|
|
84
137
|
returnValueTest: {
|
|
85
138
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
86
|
-
index?: number | undefined;
|
|
87
139
|
value?: any;
|
|
88
|
-
|
|
89
|
-
|
|
140
|
+
index?: number | undefined;
|
|
141
|
+
operations?: ({
|
|
142
|
+
operation: string;
|
|
90
143
|
value?: any;
|
|
91
|
-
}
|
|
144
|
+
} | {
|
|
145
|
+
value: {
|
|
146
|
+
deployerAddress: string;
|
|
147
|
+
bytecodeHash: string;
|
|
148
|
+
};
|
|
149
|
+
operation: "create2";
|
|
150
|
+
})[] | undefined;
|
|
92
151
|
};
|
|
93
|
-
parameters: [string] | [string, string | number];
|
|
94
152
|
chain: number;
|
|
153
|
+
method: "eth_getBalance";
|
|
154
|
+
parameters: [string, string | number] | [string];
|
|
95
155
|
conditionType?: "rpc" | undefined;
|
|
96
156
|
}>;
|
|
97
157
|
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
@@ -29,12 +29,12 @@ export const abiParameterValidationSchema = z
|
|
|
29
29
|
.int()
|
|
30
30
|
.nonnegative()
|
|
31
31
|
.describe('Index of parameter to check within abi calldata.'),
|
|
32
|
-
|
|
33
|
-
.number()
|
|
34
|
-
.int()
|
|
35
|
-
.nonnegative()
|
|
32
|
+
subIndices: z
|
|
33
|
+
.array(z.number().int().nonnegative())
|
|
36
34
|
.optional()
|
|
37
|
-
.describe('
|
|
35
|
+
.describe('Sequential indices for navigating nested structures (arrays and tuples). ' +
|
|
36
|
+
'The ABI type determines interpretation at each step: array types consume an index ' +
|
|
37
|
+
'and access that element, tuple types consume an index and access that field.'),
|
|
38
38
|
returnValueTest: blockchainReturnValueTestSchema
|
|
39
39
|
.optional()
|
|
40
40
|
.describe('Comparison check for value within calldata'),
|
|
@@ -116,6 +116,49 @@ const humanAbiCallSignatureSchema = z
|
|
|
116
116
|
message: 'Invalid human readable ABI signature provided',
|
|
117
117
|
})
|
|
118
118
|
.describe('A human readable ABI signature, e.g. "transfer(address,uint256)"');
|
|
119
|
+
/**
|
|
120
|
+
* Resolves the final ParamType after applying subIndices navigation.
|
|
121
|
+
* Returns the resolved type or undefined if navigation fails (with errors added to ctx).
|
|
122
|
+
*
|
|
123
|
+
* @param ctx - The Zod refinement context.
|
|
124
|
+
* @param paramType - The starting ParamType to navigate from.
|
|
125
|
+
* @param subIndices - The array of indices to navigate through.
|
|
126
|
+
* @param signature - The ABI signature (for error messages).
|
|
127
|
+
* @param validationIndex - The index of the validation (for error paths).
|
|
128
|
+
* @returns The resolved ParamType or undefined if validation failed.
|
|
129
|
+
*/
|
|
130
|
+
function resolveTypeWithSubIndices(ctx, paramType, subIndices, signature, validationIndex) {
|
|
131
|
+
let currentType = paramType;
|
|
132
|
+
for (let i = 0; i < subIndices.length; i++) {
|
|
133
|
+
const idx = subIndices[i];
|
|
134
|
+
if (currentType.baseType === 'array') {
|
|
135
|
+
// Array type - navigate to element type (cannot validate bounds at schema time)
|
|
136
|
+
currentType = currentType.arrayChildren;
|
|
137
|
+
}
|
|
138
|
+
else if (currentType.baseType === 'tuple') {
|
|
139
|
+
// Tuple type - navigate to component at index
|
|
140
|
+
if (idx >= currentType.components.length) {
|
|
141
|
+
ctx.addIssue({
|
|
142
|
+
code: z.ZodIssueCode.custom,
|
|
143
|
+
message: `Index ${idx} at subIndices position ${i} is out of range for tuple with ${currentType.components.length} fields`,
|
|
144
|
+
path: ['allowedAbiCalls', signature, validationIndex, 'subIndices'],
|
|
145
|
+
});
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
currentType = currentType.components[idx];
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// Not an indexable type
|
|
152
|
+
ctx.addIssue({
|
|
153
|
+
code: z.ZodIssueCode.custom,
|
|
154
|
+
message: `Cannot apply index at subIndices position ${i}: type "${currentType.baseType}" is not indexable (not an array or tuple)`,
|
|
155
|
+
path: ['allowedAbiCalls', signature, validationIndex, 'subIndices'],
|
|
156
|
+
});
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return currentType;
|
|
161
|
+
}
|
|
119
162
|
/**
|
|
120
163
|
* Validates the allowed ABI calls against the provided signature and validations.
|
|
121
164
|
* This function is used in the superRefine method of the abiCallValidationSchema.
|
|
@@ -135,37 +178,23 @@ function validateAllowedAbiCall(ctx, signature, validations) {
|
|
|
135
178
|
message: `Parameter index, "${validation.parameterIndex}", is out of range`,
|
|
136
179
|
path: ['allowedAbiCalls', signature, index, 'parameterIndex'],
|
|
137
180
|
});
|
|
181
|
+
continue;
|
|
138
182
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
message: `Type at parameter index, "${validation.parameterIndex}", is not a tuple`,
|
|
146
|
-
path: ['allowedAbiCalls', signature, index, 'parameterIndex'],
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
else if (validation.indexWithinTuple >= paramType.components.length) {
|
|
150
|
-
// invalid index within tuple
|
|
151
|
-
ctx.addIssue({
|
|
152
|
-
code: z.ZodIssueCode.custom,
|
|
153
|
-
message: `Index within tuple, "${validation.indexWithinTuple}", is out of range`,
|
|
154
|
-
path: ['allowedAbiCalls', signature, index, 'indexWithinTuple'],
|
|
155
|
-
});
|
|
183
|
+
let finalType = fragment.inputs[validation.parameterIndex];
|
|
184
|
+
// Validate and resolve subIndices if present
|
|
185
|
+
if (validation.subIndices && validation.subIndices.length > 0) {
|
|
186
|
+
const resolvedType = resolveTypeWithSubIndices(ctx, finalType, validation.subIndices, signature, index);
|
|
187
|
+
if (resolvedType === undefined) {
|
|
188
|
+
continue; // Validation failed, errors already added
|
|
156
189
|
}
|
|
190
|
+
finalType = resolvedType;
|
|
157
191
|
}
|
|
158
192
|
if (validation.nestedAbiValidation) {
|
|
159
|
-
// if there is nested ABI validation, the type must be bytes
|
|
160
|
-
|
|
161
|
-
if (validation.indexWithinTuple !== undefined) {
|
|
162
|
-
// if there is an index within tuple, get the type of the component at that index
|
|
163
|
-
paramType = paramType.components[validation.indexWithinTuple];
|
|
164
|
-
}
|
|
165
|
-
if (paramType.baseType !== 'bytes') {
|
|
193
|
+
// if there is nested ABI validation, the final type must be bytes
|
|
194
|
+
if (finalType.baseType !== 'bytes') {
|
|
166
195
|
ctx.addIssue({
|
|
167
196
|
code: z.ZodIssueCode.custom,
|
|
168
|
-
message: `Invalid type for nested ABI validation, "${
|
|
197
|
+
message: `Invalid type for nested ABI validation, "${finalType.baseType}"; expected bytes`,
|
|
169
198
|
path: ['allowedAbiCalls', signature, index],
|
|
170
199
|
});
|
|
171
200
|
}
|
|
@@ -173,7 +202,7 @@ function validateAllowedAbiCall(ctx, signature, validations) {
|
|
|
173
202
|
}
|
|
174
203
|
}
|
|
175
204
|
catch {
|
|
176
|
-
// even though abi signatures are already validated by nested schema - zod uses
|
|
205
|
+
// even though abi signatures are already validated by nested schema - zod uses "greedy" (continuable) validation so all validations are run
|
|
177
206
|
// ignore invalid ABI signature
|
|
178
207
|
}
|
|
179
208
|
}
|