@nucypher/taco 0.1.0-rc.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/LICENSE +675 -0
- package/README.md +3 -0
- package/dist/cjs/conditions/base/contract.d.ts +428 -0
- package/dist/cjs/conditions/base/contract.js +76 -0
- package/dist/cjs/conditions/base/contract.js.map +1 -0
- package/dist/cjs/conditions/base/index.d.ts +21 -0
- package/dist/cjs/conditions/base/index.js +42 -0
- package/dist/cjs/conditions/base/index.js.map +1 -0
- package/dist/cjs/conditions/base/rpc.d.ts +42 -0
- package/dist/cjs/conditions/base/rpc.js +23 -0
- package/dist/cjs/conditions/base/rpc.js.map +1 -0
- package/dist/cjs/conditions/base/shared.d.ts +16 -0
- package/dist/cjs/conditions/base/shared.js +17 -0
- package/dist/cjs/conditions/base/shared.js.map +1 -0
- package/dist/cjs/conditions/base/time.d.ts +40 -0
- package/dist/cjs/conditions/base/time.js +16 -0
- package/dist/cjs/conditions/base/time.js.map +1 -0
- package/dist/cjs/conditions/compound-condition.d.ts +4 -0
- package/dist/cjs/conditions/compound-condition.js +23 -0
- package/dist/cjs/conditions/compound-condition.js.map +1 -0
- package/dist/cjs/conditions/condition-expr.d.ts +23 -0
- package/dist/cjs/conditions/condition-expr.js +62 -0
- package/dist/cjs/conditions/condition-expr.js.map +1 -0
- package/dist/cjs/conditions/condition.d.ts +17 -0
- package/dist/cjs/conditions/condition.js +61 -0
- package/dist/cjs/conditions/condition.js.map +1 -0
- package/dist/cjs/conditions/const.d.ts +4 -0
- package/dist/cjs/conditions/const.js +13 -0
- package/dist/cjs/conditions/const.js.map +1 -0
- package/dist/cjs/conditions/context/context.d.ts +24 -0
- package/dist/cjs/conditions/context/context.js +113 -0
- package/dist/cjs/conditions/context/context.js.map +1 -0
- package/dist/cjs/conditions/context/index.d.ts +1 -0
- package/dist/cjs/conditions/context/index.js +6 -0
- package/dist/cjs/conditions/context/index.js.map +1 -0
- package/dist/cjs/conditions/context/providers.d.ts +16 -0
- package/dist/cjs/conditions/context/providers.js +109 -0
- package/dist/cjs/conditions/context/providers.js.map +1 -0
- package/dist/cjs/conditions/index.d.ts +9 -0
- package/dist/cjs/conditions/index.js +44 -0
- package/dist/cjs/conditions/index.js.map +1 -0
- package/dist/cjs/conditions/predefined/erc721.d.ts +10 -0
- package/dist/cjs/conditions/predefined/erc721.js +39 -0
- package/dist/cjs/conditions/predefined/erc721.js.map +1 -0
- package/dist/cjs/conditions/predefined/index.d.ts +1 -0
- package/dist/cjs/conditions/predefined/index.js +7 -0
- package/dist/cjs/conditions/predefined/index.js.map +1 -0
- package/dist/cjs/conditions/zod.d.ts +3 -0
- package/dist/cjs/conditions/zod.js +19 -0
- package/dist/cjs/conditions/zod.js.map +1 -0
- package/dist/cjs/dkg.d.ts +27 -0
- package/dist/cjs/dkg.js +85 -0
- package/dist/cjs/dkg.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/porter.d.ts +4 -0
- package/dist/cjs/porter.js +22 -0
- package/dist/cjs/porter.js.map +1 -0
- package/dist/cjs/taco.d.ts +7 -0
- package/dist/cjs/taco.js +47 -0
- package/dist/cjs/taco.js.map +1 -0
- package/dist/cjs/tdec.d.ts +5 -0
- package/dist/cjs/tdec.js +61 -0
- package/dist/cjs/tdec.js.map +1 -0
- package/dist/cjs/web3.d.ts +33 -0
- package/dist/cjs/web3.js +3 -0
- package/dist/cjs/web3.js.map +1 -0
- package/dist/es/conditions/base/contract.d.ts +428 -0
- package/dist/es/conditions/base/contract.js +73 -0
- package/dist/es/conditions/base/contract.js.map +1 -0
- package/dist/es/conditions/base/index.d.ts +21 -0
- package/dist/es/conditions/base/index.js +31 -0
- package/dist/es/conditions/base/index.js.map +1 -0
- package/dist/es/conditions/base/rpc.d.ts +42 -0
- package/dist/es/conditions/base/rpc.js +17 -0
- package/dist/es/conditions/base/rpc.js.map +1 -0
- package/dist/es/conditions/base/shared.d.ts +16 -0
- package/dist/es/conditions/base/shared.js +14 -0
- package/dist/es/conditions/base/shared.js.map +1 -0
- package/dist/es/conditions/base/time.d.ts +40 -0
- package/dist/es/conditions/base/time.js +13 -0
- package/dist/es/conditions/base/time.js.map +1 -0
- package/dist/es/conditions/compound-condition.d.ts +4 -0
- package/dist/es/conditions/compound-condition.js +20 -0
- package/dist/es/conditions/compound-condition.js.map +1 -0
- package/dist/es/conditions/condition-expr.d.ts +23 -0
- package/dist/es/conditions/condition-expr.js +58 -0
- package/dist/es/conditions/condition-expr.js.map +1 -0
- package/dist/es/conditions/condition.d.ts +17 -0
- package/dist/es/conditions/condition.js +57 -0
- package/dist/es/conditions/condition.js.map +1 -0
- package/dist/es/conditions/const.d.ts +4 -0
- package/dist/es/conditions/const.js +10 -0
- package/dist/es/conditions/const.js.map +1 -0
- package/dist/es/conditions/context/context.d.ts +24 -0
- package/dist/es/conditions/context/context.js +109 -0
- package/dist/es/conditions/context/context.js.map +1 -0
- package/dist/es/conditions/context/index.d.ts +1 -0
- package/dist/es/conditions/context/index.js +2 -0
- package/dist/es/conditions/context/index.js.map +1 -0
- package/dist/es/conditions/context/providers.d.ts +16 -0
- package/dist/es/conditions/context/providers.js +105 -0
- package/dist/es/conditions/context/providers.js.map +1 -0
- package/dist/es/conditions/index.d.ts +9 -0
- package/dist/es/conditions/index.js +10 -0
- package/dist/es/conditions/index.js.map +1 -0
- package/dist/es/conditions/predefined/erc721.d.ts +10 -0
- package/dist/es/conditions/predefined/erc721.js +34 -0
- package/dist/es/conditions/predefined/erc721.js.map +1 -0
- package/dist/es/conditions/predefined/index.d.ts +1 -0
- package/dist/es/conditions/predefined/index.js +2 -0
- package/dist/es/conditions/predefined/index.js.map +1 -0
- package/dist/es/conditions/zod.d.ts +3 -0
- package/dist/es/conditions/zod.js +17 -0
- package/dist/es/conditions/zod.js.map +1 -0
- package/dist/es/dkg.d.ts +27 -0
- package/dist/es/dkg.js +80 -0
- package/dist/es/dkg.js.map +1 -0
- package/dist/es/index.d.ts +4 -0
- package/dist/es/index.js +5 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/porter.d.ts +4 -0
- package/dist/es/porter.js +14 -0
- package/dist/es/porter.js.map +1 -0
- package/dist/es/taco.d.ts +7 -0
- package/dist/es/taco.js +40 -0
- package/dist/es/taco.js.map +1 -0
- package/dist/es/tdec.d.ts +5 -0
- package/dist/es/tdec.js +56 -0
- package/dist/es/tdec.js.map +1 -0
- package/dist/es/web3.d.ts +33 -0
- package/dist/es/web3.js +2 -0
- package/dist/es/web3.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.es.tsbuildinfo +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodLiteral<"function">;
|
|
5
|
+
inputs: z.ZodArray<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
8
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
9
|
+
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
type: string;
|
|
11
|
+
name: string;
|
|
12
|
+
internalType: string;
|
|
13
|
+
}, {
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
internalType: string;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
21
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
22
|
+
}, "strict", z.ZodTypeAny, {
|
|
23
|
+
type: string;
|
|
24
|
+
name: string;
|
|
25
|
+
internalType: string;
|
|
26
|
+
}, {
|
|
27
|
+
type: string;
|
|
28
|
+
name: string;
|
|
29
|
+
internalType: string;
|
|
30
|
+
}>, "atleastone">;
|
|
31
|
+
stateMutability: z.ZodUnion<[z.ZodLiteral<"view">, z.ZodLiteral<"pure">]>;
|
|
32
|
+
}, "strict", z.ZodTypeAny, {
|
|
33
|
+
type: "function";
|
|
34
|
+
name: string;
|
|
35
|
+
inputs: {
|
|
36
|
+
type: string;
|
|
37
|
+
name: string;
|
|
38
|
+
internalType: string;
|
|
39
|
+
}[];
|
|
40
|
+
outputs: [{
|
|
41
|
+
type: string;
|
|
42
|
+
name: string;
|
|
43
|
+
internalType: string;
|
|
44
|
+
}, ...{
|
|
45
|
+
type: string;
|
|
46
|
+
name: string;
|
|
47
|
+
internalType: string;
|
|
48
|
+
}[]];
|
|
49
|
+
stateMutability: "view" | "pure";
|
|
50
|
+
}, {
|
|
51
|
+
type: "function";
|
|
52
|
+
name: string;
|
|
53
|
+
inputs: {
|
|
54
|
+
type: string;
|
|
55
|
+
name: string;
|
|
56
|
+
internalType: string;
|
|
57
|
+
}[];
|
|
58
|
+
outputs: [{
|
|
59
|
+
type: string;
|
|
60
|
+
name: string;
|
|
61
|
+
internalType: string;
|
|
62
|
+
}, ...{
|
|
63
|
+
type: string;
|
|
64
|
+
name: string;
|
|
65
|
+
internalType: string;
|
|
66
|
+
}[]];
|
|
67
|
+
stateMutability: "view" | "pure";
|
|
68
|
+
}>, {
|
|
69
|
+
type: "function";
|
|
70
|
+
name: string;
|
|
71
|
+
inputs: {
|
|
72
|
+
type: string;
|
|
73
|
+
name: string;
|
|
74
|
+
internalType: string;
|
|
75
|
+
}[];
|
|
76
|
+
outputs: [{
|
|
77
|
+
type: string;
|
|
78
|
+
name: string;
|
|
79
|
+
internalType: string;
|
|
80
|
+
}, ...{
|
|
81
|
+
type: string;
|
|
82
|
+
name: string;
|
|
83
|
+
internalType: string;
|
|
84
|
+
}[]];
|
|
85
|
+
stateMutability: "view" | "pure";
|
|
86
|
+
}, {
|
|
87
|
+
type: "function";
|
|
88
|
+
name: string;
|
|
89
|
+
inputs: {
|
|
90
|
+
type: string;
|
|
91
|
+
name: string;
|
|
92
|
+
internalType: string;
|
|
93
|
+
}[];
|
|
94
|
+
outputs: [{
|
|
95
|
+
type: string;
|
|
96
|
+
name: string;
|
|
97
|
+
internalType: string;
|
|
98
|
+
}, ...{
|
|
99
|
+
type: string;
|
|
100
|
+
name: string;
|
|
101
|
+
internalType: string;
|
|
102
|
+
}[]];
|
|
103
|
+
stateMutability: "view" | "pure";
|
|
104
|
+
}>, {
|
|
105
|
+
type: "function";
|
|
106
|
+
name: string;
|
|
107
|
+
inputs: {
|
|
108
|
+
type: string;
|
|
109
|
+
name: string;
|
|
110
|
+
internalType: string;
|
|
111
|
+
}[];
|
|
112
|
+
outputs: [{
|
|
113
|
+
type: string;
|
|
114
|
+
name: string;
|
|
115
|
+
internalType: string;
|
|
116
|
+
}, ...{
|
|
117
|
+
type: string;
|
|
118
|
+
name: string;
|
|
119
|
+
internalType: string;
|
|
120
|
+
}[]];
|
|
121
|
+
stateMutability: "view" | "pure";
|
|
122
|
+
}, {
|
|
123
|
+
type: "function";
|
|
124
|
+
name: string;
|
|
125
|
+
inputs: {
|
|
126
|
+
type: string;
|
|
127
|
+
name: string;
|
|
128
|
+
internalType: string;
|
|
129
|
+
}[];
|
|
130
|
+
outputs: [{
|
|
131
|
+
type: string;
|
|
132
|
+
name: string;
|
|
133
|
+
internalType: string;
|
|
134
|
+
}, ...{
|
|
135
|
+
type: string;
|
|
136
|
+
name: string;
|
|
137
|
+
internalType: string;
|
|
138
|
+
}[]];
|
|
139
|
+
stateMutability: "view" | "pure";
|
|
140
|
+
}>;
|
|
141
|
+
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
142
|
+
export declare const ContractConditionType = "contract";
|
|
143
|
+
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
144
|
+
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
145
|
+
returnValueTest: z.ZodObject<{
|
|
146
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
148
|
+
value: z.ZodUnknown;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
151
|
+
index?: number | undefined;
|
|
152
|
+
value?: unknown;
|
|
153
|
+
}, {
|
|
154
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
155
|
+
index?: number | undefined;
|
|
156
|
+
value?: unknown;
|
|
157
|
+
}>;
|
|
158
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
159
|
+
contractAddress: z.ZodString;
|
|
160
|
+
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
161
|
+
method: z.ZodString;
|
|
162
|
+
functionAbi: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
163
|
+
name: z.ZodString;
|
|
164
|
+
type: z.ZodLiteral<"function">;
|
|
165
|
+
inputs: z.ZodArray<z.ZodObject<{
|
|
166
|
+
name: z.ZodString;
|
|
167
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
168
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
169
|
+
}, "strict", z.ZodTypeAny, {
|
|
170
|
+
type: string;
|
|
171
|
+
name: string;
|
|
172
|
+
internalType: string;
|
|
173
|
+
}, {
|
|
174
|
+
type: string;
|
|
175
|
+
name: string;
|
|
176
|
+
internalType: string;
|
|
177
|
+
}>, "many">;
|
|
178
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
type: z.ZodEnum<[string, ...string[]]>;
|
|
181
|
+
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
182
|
+
}, "strict", z.ZodTypeAny, {
|
|
183
|
+
type: string;
|
|
184
|
+
name: string;
|
|
185
|
+
internalType: string;
|
|
186
|
+
}, {
|
|
187
|
+
type: string;
|
|
188
|
+
name: string;
|
|
189
|
+
internalType: string;
|
|
190
|
+
}>, "atleastone">;
|
|
191
|
+
stateMutability: z.ZodUnion<[z.ZodLiteral<"view">, z.ZodLiteral<"pure">]>;
|
|
192
|
+
}, "strict", z.ZodTypeAny, {
|
|
193
|
+
type: "function";
|
|
194
|
+
name: string;
|
|
195
|
+
inputs: {
|
|
196
|
+
type: string;
|
|
197
|
+
name: string;
|
|
198
|
+
internalType: string;
|
|
199
|
+
}[];
|
|
200
|
+
outputs: [{
|
|
201
|
+
type: string;
|
|
202
|
+
name: string;
|
|
203
|
+
internalType: string;
|
|
204
|
+
}, ...{
|
|
205
|
+
type: string;
|
|
206
|
+
name: string;
|
|
207
|
+
internalType: string;
|
|
208
|
+
}[]];
|
|
209
|
+
stateMutability: "view" | "pure";
|
|
210
|
+
}, {
|
|
211
|
+
type: "function";
|
|
212
|
+
name: string;
|
|
213
|
+
inputs: {
|
|
214
|
+
type: string;
|
|
215
|
+
name: string;
|
|
216
|
+
internalType: string;
|
|
217
|
+
}[];
|
|
218
|
+
outputs: [{
|
|
219
|
+
type: string;
|
|
220
|
+
name: string;
|
|
221
|
+
internalType: string;
|
|
222
|
+
}, ...{
|
|
223
|
+
type: string;
|
|
224
|
+
name: string;
|
|
225
|
+
internalType: string;
|
|
226
|
+
}[]];
|
|
227
|
+
stateMutability: "view" | "pure";
|
|
228
|
+
}>, {
|
|
229
|
+
type: "function";
|
|
230
|
+
name: string;
|
|
231
|
+
inputs: {
|
|
232
|
+
type: string;
|
|
233
|
+
name: string;
|
|
234
|
+
internalType: string;
|
|
235
|
+
}[];
|
|
236
|
+
outputs: [{
|
|
237
|
+
type: string;
|
|
238
|
+
name: string;
|
|
239
|
+
internalType: string;
|
|
240
|
+
}, ...{
|
|
241
|
+
type: string;
|
|
242
|
+
name: string;
|
|
243
|
+
internalType: string;
|
|
244
|
+
}[]];
|
|
245
|
+
stateMutability: "view" | "pure";
|
|
246
|
+
}, {
|
|
247
|
+
type: "function";
|
|
248
|
+
name: string;
|
|
249
|
+
inputs: {
|
|
250
|
+
type: string;
|
|
251
|
+
name: string;
|
|
252
|
+
internalType: string;
|
|
253
|
+
}[];
|
|
254
|
+
outputs: [{
|
|
255
|
+
type: string;
|
|
256
|
+
name: string;
|
|
257
|
+
internalType: string;
|
|
258
|
+
}, ...{
|
|
259
|
+
type: string;
|
|
260
|
+
name: string;
|
|
261
|
+
internalType: string;
|
|
262
|
+
}[]];
|
|
263
|
+
stateMutability: "view" | "pure";
|
|
264
|
+
}>, {
|
|
265
|
+
type: "function";
|
|
266
|
+
name: string;
|
|
267
|
+
inputs: {
|
|
268
|
+
type: string;
|
|
269
|
+
name: string;
|
|
270
|
+
internalType: string;
|
|
271
|
+
}[];
|
|
272
|
+
outputs: [{
|
|
273
|
+
type: string;
|
|
274
|
+
name: string;
|
|
275
|
+
internalType: string;
|
|
276
|
+
}, ...{
|
|
277
|
+
type: string;
|
|
278
|
+
name: string;
|
|
279
|
+
internalType: string;
|
|
280
|
+
}[]];
|
|
281
|
+
stateMutability: "view" | "pure";
|
|
282
|
+
}, {
|
|
283
|
+
type: "function";
|
|
284
|
+
name: string;
|
|
285
|
+
inputs: {
|
|
286
|
+
type: string;
|
|
287
|
+
name: string;
|
|
288
|
+
internalType: string;
|
|
289
|
+
}[];
|
|
290
|
+
outputs: [{
|
|
291
|
+
type: string;
|
|
292
|
+
name: string;
|
|
293
|
+
internalType: string;
|
|
294
|
+
}, ...{
|
|
295
|
+
type: string;
|
|
296
|
+
name: string;
|
|
297
|
+
internalType: string;
|
|
298
|
+
}[]];
|
|
299
|
+
stateMutability: "view" | "pure";
|
|
300
|
+
}>>;
|
|
301
|
+
parameters: z.ZodArray<z.ZodUnknown, "many">;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
conditionType: "contract";
|
|
304
|
+
method: string;
|
|
305
|
+
parameters: unknown[];
|
|
306
|
+
returnValueTest: {
|
|
307
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
308
|
+
index?: number | undefined;
|
|
309
|
+
value?: unknown;
|
|
310
|
+
};
|
|
311
|
+
contractAddress: string;
|
|
312
|
+
chain?: z.Primitive;
|
|
313
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
314
|
+
functionAbi?: {
|
|
315
|
+
type: "function";
|
|
316
|
+
name: string;
|
|
317
|
+
inputs: {
|
|
318
|
+
type: string;
|
|
319
|
+
name: string;
|
|
320
|
+
internalType: string;
|
|
321
|
+
}[];
|
|
322
|
+
outputs: [{
|
|
323
|
+
type: string;
|
|
324
|
+
name: string;
|
|
325
|
+
internalType: string;
|
|
326
|
+
}, ...{
|
|
327
|
+
type: string;
|
|
328
|
+
name: string;
|
|
329
|
+
internalType: string;
|
|
330
|
+
}[]];
|
|
331
|
+
stateMutability: "view" | "pure";
|
|
332
|
+
} | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
method: string;
|
|
335
|
+
parameters: unknown[];
|
|
336
|
+
returnValueTest: {
|
|
337
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
338
|
+
index?: number | undefined;
|
|
339
|
+
value?: unknown;
|
|
340
|
+
};
|
|
341
|
+
contractAddress: string;
|
|
342
|
+
chain?: z.Primitive;
|
|
343
|
+
conditionType?: "contract" | undefined;
|
|
344
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
345
|
+
functionAbi?: {
|
|
346
|
+
type: "function";
|
|
347
|
+
name: string;
|
|
348
|
+
inputs: {
|
|
349
|
+
type: string;
|
|
350
|
+
name: string;
|
|
351
|
+
internalType: string;
|
|
352
|
+
}[];
|
|
353
|
+
outputs: [{
|
|
354
|
+
type: string;
|
|
355
|
+
name: string;
|
|
356
|
+
internalType: string;
|
|
357
|
+
}, ...{
|
|
358
|
+
type: string;
|
|
359
|
+
name: string;
|
|
360
|
+
internalType: string;
|
|
361
|
+
}[]];
|
|
362
|
+
stateMutability: "view" | "pure";
|
|
363
|
+
} | undefined;
|
|
364
|
+
}>, {
|
|
365
|
+
conditionType: "contract";
|
|
366
|
+
method: string;
|
|
367
|
+
parameters: unknown[];
|
|
368
|
+
returnValueTest: {
|
|
369
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
370
|
+
index?: number | undefined;
|
|
371
|
+
value?: unknown;
|
|
372
|
+
};
|
|
373
|
+
contractAddress: string;
|
|
374
|
+
chain?: z.Primitive;
|
|
375
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
376
|
+
functionAbi?: {
|
|
377
|
+
type: "function";
|
|
378
|
+
name: string;
|
|
379
|
+
inputs: {
|
|
380
|
+
type: string;
|
|
381
|
+
name: string;
|
|
382
|
+
internalType: string;
|
|
383
|
+
}[];
|
|
384
|
+
outputs: [{
|
|
385
|
+
type: string;
|
|
386
|
+
name: string;
|
|
387
|
+
internalType: string;
|
|
388
|
+
}, ...{
|
|
389
|
+
type: string;
|
|
390
|
+
name: string;
|
|
391
|
+
internalType: string;
|
|
392
|
+
}[]];
|
|
393
|
+
stateMutability: "view" | "pure";
|
|
394
|
+
} | undefined;
|
|
395
|
+
}, {
|
|
396
|
+
method: string;
|
|
397
|
+
parameters: unknown[];
|
|
398
|
+
returnValueTest: {
|
|
399
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
400
|
+
index?: number | undefined;
|
|
401
|
+
value?: unknown;
|
|
402
|
+
};
|
|
403
|
+
contractAddress: string;
|
|
404
|
+
chain?: z.Primitive;
|
|
405
|
+
conditionType?: "contract" | undefined;
|
|
406
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
407
|
+
functionAbi?: {
|
|
408
|
+
type: "function";
|
|
409
|
+
name: string;
|
|
410
|
+
inputs: {
|
|
411
|
+
type: string;
|
|
412
|
+
name: string;
|
|
413
|
+
internalType: string;
|
|
414
|
+
}[];
|
|
415
|
+
outputs: [{
|
|
416
|
+
type: string;
|
|
417
|
+
name: string;
|
|
418
|
+
internalType: string;
|
|
419
|
+
}, ...{
|
|
420
|
+
type: string;
|
|
421
|
+
name: string;
|
|
422
|
+
internalType: string;
|
|
423
|
+
}[]];
|
|
424
|
+
stateMutability: "view" | "pure";
|
|
425
|
+
} | undefined;
|
|
426
|
+
}>;
|
|
427
|
+
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
428
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contractConditionSchema = exports.ContractConditionType = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const const_1 = require("../const");
|
|
7
|
+
const rpc_1 = require("./rpc");
|
|
8
|
+
// TODO: Consider replacing with `z.unknown`:
|
|
9
|
+
// Since Solidity types are tied to Solidity version, we may not be able to accurately represent them in Zod.
|
|
10
|
+
// Alternatively, find a TS Solidity type lib.
|
|
11
|
+
const EthBaseTypes = [
|
|
12
|
+
'bool',
|
|
13
|
+
'string',
|
|
14
|
+
'address',
|
|
15
|
+
...Array.from({ length: 32 }, (_v, i) => `bytes${i + 1}`),
|
|
16
|
+
'bytes',
|
|
17
|
+
...Array.from({ length: 32 }, (_v, i) => `uint${8 * (i + 1)}`),
|
|
18
|
+
...Array.from({ length: 32 }, (_v, i) => `int${8 * (i + 1)}`), // int8 through int256
|
|
19
|
+
];
|
|
20
|
+
const functionAbiVariableSchema = zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
name: zod_1.z.string(),
|
|
23
|
+
type: zod_1.z.enum(EthBaseTypes),
|
|
24
|
+
internalType: zod_1.z.enum(EthBaseTypes), // TODO: Do we need to validate this?
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
const functionAbiSchema = zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
name: zod_1.z.string(),
|
|
30
|
+
type: zod_1.z.literal('function'),
|
|
31
|
+
inputs: zod_1.z.array(functionAbiVariableSchema).min(0),
|
|
32
|
+
outputs: zod_1.z.array(functionAbiVariableSchema).nonempty(),
|
|
33
|
+
stateMutability: zod_1.z.union([zod_1.z.literal('view'), zod_1.z.literal('pure')]),
|
|
34
|
+
})
|
|
35
|
+
.strict()
|
|
36
|
+
.refine((functionAbi) => {
|
|
37
|
+
let asInterface;
|
|
38
|
+
try {
|
|
39
|
+
// `stringify` here because ethers.utils.Interface doesn't accept a Zod schema
|
|
40
|
+
asInterface = new ethers_1.ethers.utils.Interface(JSON.stringify([functionAbi]));
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const functionsInAbi = Object.values(asInterface.functions || {});
|
|
46
|
+
return functionsInAbi.length === 1;
|
|
47
|
+
}, {
|
|
48
|
+
message: '"functionAbi" must contain a single function definition',
|
|
49
|
+
})
|
|
50
|
+
.refine((functionAbi) => {
|
|
51
|
+
const asInterface = new ethers_1.ethers.utils.Interface(JSON.stringify([functionAbi]));
|
|
52
|
+
const nrOfInputs = asInterface.fragments[0].inputs.length;
|
|
53
|
+
return functionAbi.inputs.length === nrOfInputs;
|
|
54
|
+
}, {
|
|
55
|
+
message: '"parameters" must have the same length as "functionAbi.inputs"',
|
|
56
|
+
});
|
|
57
|
+
exports.ContractConditionType = 'contract';
|
|
58
|
+
exports.contractConditionSchema = rpc_1.rpcConditionSchema
|
|
59
|
+
.extend({
|
|
60
|
+
conditionType: zod_1.z
|
|
61
|
+
.literal(exports.ContractConditionType)
|
|
62
|
+
.default(exports.ContractConditionType),
|
|
63
|
+
contractAddress: zod_1.z.string().regex(const_1.ETH_ADDRESS_REGEXP),
|
|
64
|
+
standardContractType: zod_1.z.enum(['ERC20', 'ERC721']).optional(),
|
|
65
|
+
method: zod_1.z.string(),
|
|
66
|
+
functionAbi: functionAbiSchema.optional(),
|
|
67
|
+
parameters: zod_1.z.array(zod_1.z.unknown()),
|
|
68
|
+
})
|
|
69
|
+
// Adding this custom logic causes the return type to be ZodEffects instead of ZodObject
|
|
70
|
+
// https://github.com/colinhacks/zod/issues/2474
|
|
71
|
+
.refine(
|
|
72
|
+
// A check to see if either 'standardContractType' or 'functionAbi' is set
|
|
73
|
+
(data) => Boolean(data.standardContractType) !== Boolean(data.functionAbi), {
|
|
74
|
+
message: "At most one of the fields 'standardContractType' and 'functionAbi' must be defined",
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/base/contract.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CompoundConditionProps } from '../compound-condition';
|
|
2
|
+
import { Condition } from '../condition';
|
|
3
|
+
import { ContractConditionProps } from './contract';
|
|
4
|
+
import { RpcConditionProps } from './rpc';
|
|
5
|
+
import { TimeConditionProps } from './time';
|
|
6
|
+
export declare class CompoundCondition extends Condition {
|
|
7
|
+
constructor(value: CompoundConditionProps);
|
|
8
|
+
}
|
|
9
|
+
export declare class ContractCondition extends Condition {
|
|
10
|
+
constructor(value: ContractConditionProps);
|
|
11
|
+
}
|
|
12
|
+
export declare class RpcCondition extends Condition {
|
|
13
|
+
constructor(value: RpcConditionProps);
|
|
14
|
+
}
|
|
15
|
+
export declare class TimeCondition extends Condition {
|
|
16
|
+
constructor(value: TimeConditionProps);
|
|
17
|
+
}
|
|
18
|
+
export { ContractConditionType, FunctionAbiProps, type ContractConditionProps, } from './contract';
|
|
19
|
+
export { RpcConditionType, type RpcConditionProps } from './rpc';
|
|
20
|
+
export { ReturnValueTestProps } from './shared';
|
|
21
|
+
export { TimeConditionMethod, TimeConditionType, type TimeConditionProps, } from './time';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeConditionType = exports.TimeConditionMethod = exports.RpcConditionType = exports.ContractConditionType = exports.TimeCondition = exports.RpcCondition = exports.ContractCondition = exports.CompoundCondition = void 0;
|
|
4
|
+
const compound_condition_1 = require("../compound-condition");
|
|
5
|
+
const condition_1 = require("../condition");
|
|
6
|
+
const contract_1 = require("./contract");
|
|
7
|
+
const rpc_1 = require("./rpc");
|
|
8
|
+
const time_1 = require("./time");
|
|
9
|
+
// Exporting classes here instead of their respective schema files to
|
|
10
|
+
// avoid circular dependency on Condition class.
|
|
11
|
+
class CompoundCondition extends condition_1.Condition {
|
|
12
|
+
constructor(value) {
|
|
13
|
+
super(compound_condition_1.compoundConditionSchema, value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CompoundCondition = CompoundCondition;
|
|
17
|
+
class ContractCondition extends condition_1.Condition {
|
|
18
|
+
constructor(value) {
|
|
19
|
+
super(contract_1.contractConditionSchema, value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ContractCondition = ContractCondition;
|
|
23
|
+
class RpcCondition extends condition_1.Condition {
|
|
24
|
+
constructor(value) {
|
|
25
|
+
super(rpc_1.rpcConditionSchema, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.RpcCondition = RpcCondition;
|
|
29
|
+
class TimeCondition extends condition_1.Condition {
|
|
30
|
+
constructor(value) {
|
|
31
|
+
super(time_1.timeConditionSchema, value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.TimeCondition = TimeCondition;
|
|
35
|
+
var contract_2 = require("./contract");
|
|
36
|
+
Object.defineProperty(exports, "ContractConditionType", { enumerable: true, get: function () { return contract_2.ContractConditionType; } });
|
|
37
|
+
var rpc_2 = require("./rpc");
|
|
38
|
+
Object.defineProperty(exports, "RpcConditionType", { enumerable: true, get: function () { return rpc_2.RpcConditionType; } });
|
|
39
|
+
var time_2 = require("./time");
|
|
40
|
+
Object.defineProperty(exports, "TimeConditionMethod", { enumerable: true, get: function () { return time_2.TimeConditionMethod; } });
|
|
41
|
+
Object.defineProperty(exports, "TimeConditionType", { enumerable: true, get: function () { return time_2.TimeConditionType; } });
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":";;;AAAA,8DAG+B;AAC/B,4CAAyC;AAEzC,yCAA6E;AAC7E,+BAA8D;AAC9D,iCAAiE;AAEjE,qEAAqE;AACrE,gDAAgD;AAEhD,MAAa,iBAAkB,SAAQ,qBAAS;IAC9C,YAAY,KAA6B;QACvC,KAAK,CAAC,4CAAuB,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CACF;AAJD,8CAIC;AAED,MAAa,iBAAkB,SAAQ,qBAAS;IAC9C,YAAY,KAA6B;QACvC,KAAK,CAAC,kCAAuB,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CACF;AAJD,8CAIC;AAED,MAAa,YAAa,SAAQ,qBAAS;IACzC,YAAY,KAAwB;QAClC,KAAK,CAAC,wBAAkB,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;CACF;AAJD,oCAIC;AAED,MAAa,aAAc,SAAQ,qBAAS;IAC1C,YAAY,KAAyB;QACnC,KAAK,CAAC,0BAAmB,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACF;AAJD,sCAIC;AAED,uCAIoB;AAHlB,iHAAA,qBAAqB,OAAA;AAIvB,6BAAiE;AAAxD,uGAAA,gBAAgB,OAAA;AAEzB,+BAIgB;AAHd,2GAAA,mBAAmB,OAAA;AACnB,yGAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RpcConditionType = "rpc";
|
|
3
|
+
export declare const rpcConditionSchema: z.ZodObject<{
|
|
4
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
5
|
+
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
6
|
+
method: z.ZodEnum<["eth_getBalance", "balanceOf"]>;
|
|
7
|
+
parameters: z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<":userAddress">]>, "many">, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodLiteral<":userAddress">]>, z.ZodUnion<[z.ZodString, z.ZodNumber]>], null>]>;
|
|
8
|
+
returnValueTest: z.ZodObject<{
|
|
9
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
11
|
+
value: z.ZodUnknown;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
+
index?: number | undefined;
|
|
15
|
+
value?: unknown;
|
|
16
|
+
}, {
|
|
17
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
+
index?: number | undefined;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
conditionType: "rpc";
|
|
23
|
+
method: "eth_getBalance" | "balanceOf";
|
|
24
|
+
parameters: (string[] | [string, string | number]) & (string[] | [string, string | number] | undefined);
|
|
25
|
+
returnValueTest: {
|
|
26
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
27
|
+
index?: number | undefined;
|
|
28
|
+
value?: unknown;
|
|
29
|
+
};
|
|
30
|
+
chain?: z.Primitive;
|
|
31
|
+
}, {
|
|
32
|
+
method: "eth_getBalance" | "balanceOf";
|
|
33
|
+
parameters: (string[] | [string, string | number]) & (string[] | [string, string | number] | undefined);
|
|
34
|
+
returnValueTest: {
|
|
35
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
36
|
+
index?: number | undefined;
|
|
37
|
+
value?: unknown;
|
|
38
|
+
};
|
|
39
|
+
conditionType?: "rpc" | undefined;
|
|
40
|
+
chain?: z.Primitive;
|
|
41
|
+
}>;
|
|
42
|
+
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rpcConditionSchema = exports.RpcConditionType = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const const_1 = require("../const");
|
|
9
|
+
const zod_2 = __importDefault(require("../zod"));
|
|
10
|
+
const shared_1 = require("./shared");
|
|
11
|
+
exports.RpcConditionType = 'rpc';
|
|
12
|
+
exports.rpcConditionSchema = zod_1.z.object({
|
|
13
|
+
conditionType: zod_1.z.literal(exports.RpcConditionType).default(exports.RpcConditionType),
|
|
14
|
+
chain: (0, zod_2.default)(const_1.SUPPORTED_CHAIN_IDS),
|
|
15
|
+
method: zod_1.z.enum(['eth_getBalance', 'balanceOf']),
|
|
16
|
+
parameters: zod_1.z.union([
|
|
17
|
+
zod_1.z.array(shared_1.EthAddressOrUserAddressSchema).length(1),
|
|
18
|
+
// Using tuple here because ordering matters
|
|
19
|
+
zod_1.z.tuple([shared_1.EthAddressOrUserAddressSchema, zod_1.z.union([zod_1.z.string(), zod_1.z.number()])]),
|
|
20
|
+
]),
|
|
21
|
+
returnValueTest: shared_1.returnValueTestSchema,
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/conditions/base/rpc.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAwB;AAExB,oCAA+C;AAC/C,iDAAuC;AAEvC,qCAAgF;AAEnE,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEzB,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC;IACpE,KAAK,EAAE,IAAA,aAAiB,EAAC,2BAAmB,CAAC;IAC7C,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IAC/C,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC;QAClB,OAAC,CAAC,KAAK,CAAC,sCAA6B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAChD,4CAA4C;QAC5C,OAAC,CAAC,KAAK,CAAC,CAAC,sCAA6B,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;KAC5E,CAAC;IACF,eAAe,EAAE,8BAAqB;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const returnValueTestSchema: z.ZodObject<{
|
|
3
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
4
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
5
|
+
value: z.ZodUnknown;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
8
|
+
index?: number | undefined;
|
|
9
|
+
value?: unknown;
|
|
10
|
+
}, {
|
|
11
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
12
|
+
index?: number | undefined;
|
|
13
|
+
value?: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
16
|
+
export declare const EthAddressOrUserAddressSchema: z.ZodUnion<[z.ZodString, z.ZodLiteral<":userAddress">]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EthAddressOrUserAddressSchema = exports.returnValueTestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const const_1 = require("../const");
|
|
6
|
+
exports.returnValueTestSchema = zod_1.z.object({
|
|
7
|
+
index: zod_1.z.number().optional(),
|
|
8
|
+
comparator: zod_1.z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
9
|
+
value: zod_1.z.unknown(),
|
|
10
|
+
});
|
|
11
|
+
const EthAddressSchema = zod_1.z.string().regex(const_1.ETH_ADDRESS_REGEXP);
|
|
12
|
+
const UserAddressSchema = zod_1.z.literal(const_1.USER_ADDRESS_PARAM);
|
|
13
|
+
exports.EthAddressOrUserAddressSchema = zod_1.z.union([
|
|
14
|
+
EthAddressSchema,
|
|
15
|
+
UserAddressSchema,
|
|
16
|
+
]);
|
|
17
|
+
//# sourceMappingURL=shared.js.map
|