@nucypher/taco 0.5.0 → 0.6.0-alpha.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/dist/cjs/conditions/base/contract.d.ts +2 -428
- package/dist/cjs/conditions/base/contract.js +7 -80
- package/dist/cjs/conditions/base/contract.js.map +1 -1
- package/dist/cjs/conditions/base/index.d.ts +1 -0
- package/dist/cjs/conditions/base/index.js +2 -1
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/json-api.d.ts +7 -0
- package/dist/cjs/conditions/base/json-api.js +19 -0
- package/dist/cjs/conditions/base/json-api.js.map +1 -0
- package/dist/cjs/conditions/base/rpc.d.ts +2 -42
- package/dist/cjs/conditions/base/rpc.js +7 -22
- package/dist/cjs/conditions/base/rpc.js.map +1 -1
- package/dist/cjs/conditions/base/time.d.ts +2 -40
- package/dist/cjs/conditions/base/time.js +8 -15
- package/dist/cjs/conditions/base/time.js.map +1 -1
- package/dist/cjs/conditions/compound-condition.d.ts +2 -4
- package/dist/cjs/conditions/compound-condition.js +7 -38
- package/dist/cjs/conditions/compound-condition.js.map +1 -1
- package/dist/cjs/conditions/condition-factory.js +11 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/condition.d.ts +1 -1
- package/dist/cjs/conditions/condition.js +3 -1
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/const.d.ts +1 -0
- package/dist/cjs/conditions/const.js +5 -2
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.js +22 -1
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/context/providers.d.ts +16 -0
- package/dist/cjs/conditions/context/providers.js +111 -0
- package/dist/cjs/conditions/context/providers.js.map +1 -0
- package/dist/cjs/conditions/if-then-else-condition.d.ts +7 -0
- package/dist/cjs/conditions/if-then-else-condition.js +18 -0
- package/dist/cjs/conditions/if-then-else-condition.js.map +1 -0
- package/dist/cjs/conditions/index.d.ts +2 -0
- package/dist/cjs/conditions/index.js +3 -1
- package/dist/cjs/conditions/index.js.map +1 -1
- package/dist/cjs/conditions/multi-condition.d.ts +2 -0
- package/dist/cjs/conditions/multi-condition.js +35 -0
- package/dist/cjs/conditions/multi-condition.js.map +1 -0
- package/dist/cjs/conditions/schemas/common.d.ts +12 -0
- package/dist/cjs/conditions/schemas/common.js +36 -0
- package/dist/cjs/conditions/schemas/common.js.map +1 -0
- package/dist/cjs/conditions/schemas/compound.d.ts +4 -0
- package/dist/cjs/conditions/schemas/compound.js +36 -0
- package/dist/cjs/conditions/schemas/compound.js.map +1 -0
- package/dist/cjs/conditions/schemas/context.d.ts +3 -0
- package/dist/cjs/conditions/schemas/context.js +16 -0
- package/dist/cjs/conditions/schemas/context.js.map +1 -0
- package/dist/cjs/conditions/schemas/contract.d.ts +428 -0
- package/dist/cjs/conditions/schemas/contract.js +81 -0
- package/dist/cjs/conditions/schemas/contract.js.map +1 -0
- package/dist/cjs/conditions/schemas/if-then-else.d.ts +4 -0
- package/dist/cjs/conditions/schemas/if-then-else.js +40 -0
- package/dist/cjs/conditions/schemas/if-then-else.js.map +1 -0
- package/dist/cjs/conditions/schemas/json-api.d.ts +46 -0
- package/dist/cjs/conditions/schemas/json-api.js +37 -0
- package/dist/cjs/conditions/schemas/json-api.js.map +1 -0
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +15 -0
- package/dist/cjs/conditions/schemas/return-value-test.js +11 -0
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -0
- package/dist/cjs/conditions/schemas/rpc.d.ts +42 -0
- package/dist/cjs/conditions/schemas/rpc.js +58 -0
- package/dist/cjs/conditions/schemas/rpc.js.map +1 -0
- package/dist/cjs/conditions/schemas/sequential.d.ts +6 -0
- package/dist/cjs/conditions/schemas/sequential.js +39 -0
- package/dist/cjs/conditions/schemas/sequential.js.map +1 -0
- package/dist/cjs/conditions/schemas/time.d.ts +40 -0
- package/dist/cjs/conditions/schemas/time.js +16 -0
- package/dist/cjs/conditions/schemas/time.js.map +1 -0
- package/dist/cjs/conditions/schemas/utils.d.ts +2 -0
- package/dist/cjs/conditions/schemas/utils.js +21 -0
- package/dist/cjs/conditions/schemas/utils.js.map +1 -0
- package/dist/cjs/conditions/sequential.d.ts +7 -0
- package/dist/cjs/conditions/sequential.js +18 -0
- package/dist/cjs/conditions/sequential.js.map +1 -0
- package/dist/cjs/conditions/shared.d.ts +2 -19
- package/dist/cjs/conditions/shared.js +6 -32
- package/dist/cjs/conditions/shared.js.map +1 -1
- 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 +2 -428
- package/dist/es/conditions/base/contract.js +2 -77
- package/dist/es/conditions/base/contract.js.map +1 -1
- package/dist/es/conditions/base/index.d.ts +1 -0
- package/dist/es/conditions/base/index.js +1 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/json-api.d.ts +7 -0
- package/dist/es/conditions/base/json-api.js +12 -0
- package/dist/es/conditions/base/json-api.js.map +1 -0
- package/dist/es/conditions/base/rpc.d.ts +2 -42
- package/dist/es/conditions/base/rpc.js +2 -16
- package/dist/es/conditions/base/rpc.js.map +1 -1
- package/dist/es/conditions/base/time.d.ts +2 -40
- package/dist/es/conditions/base/time.js +2 -12
- package/dist/es/conditions/base/time.js.map +1 -1
- package/dist/es/conditions/compound-condition.d.ts +2 -4
- package/dist/es/conditions/compound-condition.js +2 -35
- package/dist/es/conditions/compound-condition.js.map +1 -1
- package/dist/es/conditions/condition-factory.js +11 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/condition.d.ts +1 -1
- package/dist/es/conditions/condition.js +1 -0
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/const.d.ts +1 -0
- package/dist/es/conditions/const.js +4 -1
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.js +23 -2
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/context/providers.d.ts +16 -0
- package/dist/es/conditions/context/providers.js +107 -0
- package/dist/es/conditions/context/providers.js.map +1 -0
- package/dist/es/conditions/if-then-else-condition.d.ts +7 -0
- package/dist/es/conditions/if-then-else-condition.js +12 -0
- package/dist/es/conditions/if-then-else-condition.js.map +1 -0
- package/dist/es/conditions/index.d.ts +2 -0
- package/dist/es/conditions/index.js +2 -0
- package/dist/es/conditions/index.js.map +1 -1
- package/dist/es/conditions/multi-condition.d.ts +2 -0
- package/dist/es/conditions/multi-condition.js +31 -0
- package/dist/es/conditions/multi-condition.js.map +1 -0
- package/dist/es/conditions/schemas/common.d.ts +12 -0
- package/dist/es/conditions/schemas/common.js +33 -0
- package/dist/es/conditions/schemas/common.js.map +1 -0
- package/dist/es/conditions/schemas/compound.d.ts +4 -0
- package/dist/es/conditions/schemas/compound.js +33 -0
- package/dist/es/conditions/schemas/compound.js.map +1 -0
- package/dist/es/conditions/schemas/context.d.ts +3 -0
- package/dist/es/conditions/schemas/context.js +13 -0
- package/dist/es/conditions/schemas/context.js.map +1 -0
- package/dist/es/conditions/schemas/contract.d.ts +428 -0
- package/dist/es/conditions/schemas/contract.js +78 -0
- package/dist/es/conditions/schemas/contract.js.map +1 -0
- package/dist/es/conditions/schemas/if-then-else.d.ts +4 -0
- package/dist/es/conditions/schemas/if-then-else.js +37 -0
- package/dist/es/conditions/schemas/if-then-else.js.map +1 -0
- package/dist/es/conditions/schemas/json-api.d.ts +46 -0
- package/dist/es/conditions/schemas/json-api.js +34 -0
- package/dist/es/conditions/schemas/json-api.js.map +1 -0
- package/dist/es/conditions/schemas/return-value-test.d.ts +15 -0
- package/dist/es/conditions/schemas/return-value-test.js +8 -0
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -0
- package/dist/es/conditions/schemas/rpc.d.ts +42 -0
- package/dist/es/conditions/schemas/rpc.js +32 -0
- package/dist/es/conditions/schemas/rpc.js.map +1 -0
- package/dist/es/conditions/schemas/sequential.d.ts +6 -0
- package/dist/es/conditions/schemas/sequential.js +36 -0
- package/dist/es/conditions/schemas/sequential.js.map +1 -0
- package/dist/es/conditions/schemas/time.d.ts +40 -0
- package/dist/es/conditions/schemas/time.js +13 -0
- package/dist/es/conditions/schemas/time.js.map +1 -0
- package/dist/es/conditions/schemas/utils.d.ts +2 -0
- package/dist/es/conditions/schemas/utils.js +18 -0
- package/dist/es/conditions/schemas/utils.js.map +1 -0
- package/dist/es/conditions/sequential.d.ts +7 -0
- package/dist/es/conditions/sequential.js +12 -0
- package/dist/es/conditions/sequential.js.map +1 -0
- package/dist/es/conditions/shared.d.ts +2 -19
- package/dist/es/conditions/shared.js +2 -31
- package/dist/es/conditions/shared.js.map +1 -1
- 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 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -1,433 +1,7 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { Condition } from '../condition';
|
|
2
|
+
import { ContractConditionProps } from '../schemas/contract';
|
|
3
3
|
import { OmitConditionType } from '../shared';
|
|
4
|
-
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
type: z.ZodLiteral<"function">;
|
|
7
|
-
inputs: z.ZodArray<z.ZodObject<{
|
|
8
|
-
name: z.ZodString;
|
|
9
|
-
type: z.ZodEnum<[string, ...string[]]>;
|
|
10
|
-
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
11
|
-
}, "strict", z.ZodTypeAny, {
|
|
12
|
-
type: string;
|
|
13
|
-
name: string;
|
|
14
|
-
internalType: string;
|
|
15
|
-
}, {
|
|
16
|
-
type: string;
|
|
17
|
-
name: string;
|
|
18
|
-
internalType: string;
|
|
19
|
-
}>, "many">;
|
|
20
|
-
outputs: z.ZodArray<z.ZodObject<{
|
|
21
|
-
name: z.ZodString;
|
|
22
|
-
type: z.ZodEnum<[string, ...string[]]>;
|
|
23
|
-
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
24
|
-
}, "strict", z.ZodTypeAny, {
|
|
25
|
-
type: string;
|
|
26
|
-
name: string;
|
|
27
|
-
internalType: string;
|
|
28
|
-
}, {
|
|
29
|
-
type: string;
|
|
30
|
-
name: string;
|
|
31
|
-
internalType: string;
|
|
32
|
-
}>, "atleastone">;
|
|
33
|
-
stateMutability: z.ZodUnion<[z.ZodLiteral<"view">, z.ZodLiteral<"pure">]>;
|
|
34
|
-
}, "strict", z.ZodTypeAny, {
|
|
35
|
-
type: "function";
|
|
36
|
-
name: string;
|
|
37
|
-
inputs: {
|
|
38
|
-
type: string;
|
|
39
|
-
name: string;
|
|
40
|
-
internalType: string;
|
|
41
|
-
}[];
|
|
42
|
-
outputs: [{
|
|
43
|
-
type: string;
|
|
44
|
-
name: string;
|
|
45
|
-
internalType: string;
|
|
46
|
-
}, ...{
|
|
47
|
-
type: string;
|
|
48
|
-
name: string;
|
|
49
|
-
internalType: string;
|
|
50
|
-
}[]];
|
|
51
|
-
stateMutability: "view" | "pure";
|
|
52
|
-
}, {
|
|
53
|
-
type: "function";
|
|
54
|
-
name: string;
|
|
55
|
-
inputs: {
|
|
56
|
-
type: string;
|
|
57
|
-
name: string;
|
|
58
|
-
internalType: string;
|
|
59
|
-
}[];
|
|
60
|
-
outputs: [{
|
|
61
|
-
type: string;
|
|
62
|
-
name: string;
|
|
63
|
-
internalType: string;
|
|
64
|
-
}, ...{
|
|
65
|
-
type: string;
|
|
66
|
-
name: string;
|
|
67
|
-
internalType: string;
|
|
68
|
-
}[]];
|
|
69
|
-
stateMutability: "view" | "pure";
|
|
70
|
-
}>, {
|
|
71
|
-
type: "function";
|
|
72
|
-
name: string;
|
|
73
|
-
inputs: {
|
|
74
|
-
type: string;
|
|
75
|
-
name: string;
|
|
76
|
-
internalType: string;
|
|
77
|
-
}[];
|
|
78
|
-
outputs: [{
|
|
79
|
-
type: string;
|
|
80
|
-
name: string;
|
|
81
|
-
internalType: string;
|
|
82
|
-
}, ...{
|
|
83
|
-
type: string;
|
|
84
|
-
name: string;
|
|
85
|
-
internalType: string;
|
|
86
|
-
}[]];
|
|
87
|
-
stateMutability: "view" | "pure";
|
|
88
|
-
}, {
|
|
89
|
-
type: "function";
|
|
90
|
-
name: string;
|
|
91
|
-
inputs: {
|
|
92
|
-
type: string;
|
|
93
|
-
name: string;
|
|
94
|
-
internalType: string;
|
|
95
|
-
}[];
|
|
96
|
-
outputs: [{
|
|
97
|
-
type: string;
|
|
98
|
-
name: string;
|
|
99
|
-
internalType: string;
|
|
100
|
-
}, ...{
|
|
101
|
-
type: string;
|
|
102
|
-
name: string;
|
|
103
|
-
internalType: string;
|
|
104
|
-
}[]];
|
|
105
|
-
stateMutability: "view" | "pure";
|
|
106
|
-
}>, {
|
|
107
|
-
type: "function";
|
|
108
|
-
name: string;
|
|
109
|
-
inputs: {
|
|
110
|
-
type: string;
|
|
111
|
-
name: string;
|
|
112
|
-
internalType: string;
|
|
113
|
-
}[];
|
|
114
|
-
outputs: [{
|
|
115
|
-
type: string;
|
|
116
|
-
name: string;
|
|
117
|
-
internalType: string;
|
|
118
|
-
}, ...{
|
|
119
|
-
type: string;
|
|
120
|
-
name: string;
|
|
121
|
-
internalType: string;
|
|
122
|
-
}[]];
|
|
123
|
-
stateMutability: "view" | "pure";
|
|
124
|
-
}, {
|
|
125
|
-
type: "function";
|
|
126
|
-
name: string;
|
|
127
|
-
inputs: {
|
|
128
|
-
type: string;
|
|
129
|
-
name: string;
|
|
130
|
-
internalType: string;
|
|
131
|
-
}[];
|
|
132
|
-
outputs: [{
|
|
133
|
-
type: string;
|
|
134
|
-
name: string;
|
|
135
|
-
internalType: string;
|
|
136
|
-
}, ...{
|
|
137
|
-
type: string;
|
|
138
|
-
name: string;
|
|
139
|
-
internalType: string;
|
|
140
|
-
}[]];
|
|
141
|
-
stateMutability: "view" | "pure";
|
|
142
|
-
}>;
|
|
143
|
-
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
144
|
-
export declare const ContractConditionType = "contract";
|
|
145
|
-
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
146
|
-
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
147
|
-
returnValueTest: z.ZodObject<{
|
|
148
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
149
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
150
|
-
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
151
|
-
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
153
|
-
index?: number | undefined;
|
|
154
|
-
value?: any;
|
|
155
|
-
}, {
|
|
156
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
157
|
-
index?: number | undefined;
|
|
158
|
-
value?: any;
|
|
159
|
-
}>;
|
|
160
|
-
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
161
|
-
contractAddress: z.ZodString;
|
|
162
|
-
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
163
|
-
method: z.ZodString;
|
|
164
|
-
functionAbi: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
165
|
-
name: z.ZodString;
|
|
166
|
-
type: z.ZodLiteral<"function">;
|
|
167
|
-
inputs: z.ZodArray<z.ZodObject<{
|
|
168
|
-
name: z.ZodString;
|
|
169
|
-
type: z.ZodEnum<[string, ...string[]]>;
|
|
170
|
-
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
171
|
-
}, "strict", z.ZodTypeAny, {
|
|
172
|
-
type: string;
|
|
173
|
-
name: string;
|
|
174
|
-
internalType: string;
|
|
175
|
-
}, {
|
|
176
|
-
type: string;
|
|
177
|
-
name: string;
|
|
178
|
-
internalType: string;
|
|
179
|
-
}>, "many">;
|
|
180
|
-
outputs: z.ZodArray<z.ZodObject<{
|
|
181
|
-
name: z.ZodString;
|
|
182
|
-
type: z.ZodEnum<[string, ...string[]]>;
|
|
183
|
-
internalType: z.ZodEnum<[string, ...string[]]>;
|
|
184
|
-
}, "strict", z.ZodTypeAny, {
|
|
185
|
-
type: string;
|
|
186
|
-
name: string;
|
|
187
|
-
internalType: string;
|
|
188
|
-
}, {
|
|
189
|
-
type: string;
|
|
190
|
-
name: string;
|
|
191
|
-
internalType: string;
|
|
192
|
-
}>, "atleastone">;
|
|
193
|
-
stateMutability: z.ZodUnion<[z.ZodLiteral<"view">, z.ZodLiteral<"pure">]>;
|
|
194
|
-
}, "strict", z.ZodTypeAny, {
|
|
195
|
-
type: "function";
|
|
196
|
-
name: string;
|
|
197
|
-
inputs: {
|
|
198
|
-
type: string;
|
|
199
|
-
name: string;
|
|
200
|
-
internalType: string;
|
|
201
|
-
}[];
|
|
202
|
-
outputs: [{
|
|
203
|
-
type: string;
|
|
204
|
-
name: string;
|
|
205
|
-
internalType: string;
|
|
206
|
-
}, ...{
|
|
207
|
-
type: string;
|
|
208
|
-
name: string;
|
|
209
|
-
internalType: string;
|
|
210
|
-
}[]];
|
|
211
|
-
stateMutability: "view" | "pure";
|
|
212
|
-
}, {
|
|
213
|
-
type: "function";
|
|
214
|
-
name: string;
|
|
215
|
-
inputs: {
|
|
216
|
-
type: string;
|
|
217
|
-
name: string;
|
|
218
|
-
internalType: string;
|
|
219
|
-
}[];
|
|
220
|
-
outputs: [{
|
|
221
|
-
type: string;
|
|
222
|
-
name: string;
|
|
223
|
-
internalType: string;
|
|
224
|
-
}, ...{
|
|
225
|
-
type: string;
|
|
226
|
-
name: string;
|
|
227
|
-
internalType: string;
|
|
228
|
-
}[]];
|
|
229
|
-
stateMutability: "view" | "pure";
|
|
230
|
-
}>, {
|
|
231
|
-
type: "function";
|
|
232
|
-
name: string;
|
|
233
|
-
inputs: {
|
|
234
|
-
type: string;
|
|
235
|
-
name: string;
|
|
236
|
-
internalType: string;
|
|
237
|
-
}[];
|
|
238
|
-
outputs: [{
|
|
239
|
-
type: string;
|
|
240
|
-
name: string;
|
|
241
|
-
internalType: string;
|
|
242
|
-
}, ...{
|
|
243
|
-
type: string;
|
|
244
|
-
name: string;
|
|
245
|
-
internalType: string;
|
|
246
|
-
}[]];
|
|
247
|
-
stateMutability: "view" | "pure";
|
|
248
|
-
}, {
|
|
249
|
-
type: "function";
|
|
250
|
-
name: string;
|
|
251
|
-
inputs: {
|
|
252
|
-
type: string;
|
|
253
|
-
name: string;
|
|
254
|
-
internalType: string;
|
|
255
|
-
}[];
|
|
256
|
-
outputs: [{
|
|
257
|
-
type: string;
|
|
258
|
-
name: string;
|
|
259
|
-
internalType: string;
|
|
260
|
-
}, ...{
|
|
261
|
-
type: string;
|
|
262
|
-
name: string;
|
|
263
|
-
internalType: string;
|
|
264
|
-
}[]];
|
|
265
|
-
stateMutability: "view" | "pure";
|
|
266
|
-
}>, {
|
|
267
|
-
type: "function";
|
|
268
|
-
name: string;
|
|
269
|
-
inputs: {
|
|
270
|
-
type: string;
|
|
271
|
-
name: string;
|
|
272
|
-
internalType: string;
|
|
273
|
-
}[];
|
|
274
|
-
outputs: [{
|
|
275
|
-
type: string;
|
|
276
|
-
name: string;
|
|
277
|
-
internalType: string;
|
|
278
|
-
}, ...{
|
|
279
|
-
type: string;
|
|
280
|
-
name: string;
|
|
281
|
-
internalType: string;
|
|
282
|
-
}[]];
|
|
283
|
-
stateMutability: "view" | "pure";
|
|
284
|
-
}, {
|
|
285
|
-
type: "function";
|
|
286
|
-
name: string;
|
|
287
|
-
inputs: {
|
|
288
|
-
type: string;
|
|
289
|
-
name: string;
|
|
290
|
-
internalType: string;
|
|
291
|
-
}[];
|
|
292
|
-
outputs: [{
|
|
293
|
-
type: string;
|
|
294
|
-
name: string;
|
|
295
|
-
internalType: string;
|
|
296
|
-
}, ...{
|
|
297
|
-
type: string;
|
|
298
|
-
name: string;
|
|
299
|
-
internalType: string;
|
|
300
|
-
}[]];
|
|
301
|
-
stateMutability: "view" | "pure";
|
|
302
|
-
}>>;
|
|
303
|
-
parameters: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
304
|
-
}, "strip", z.ZodTypeAny, {
|
|
305
|
-
conditionType: "contract";
|
|
306
|
-
method: string;
|
|
307
|
-
parameters: any[];
|
|
308
|
-
returnValueTest: {
|
|
309
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
310
|
-
index?: number | undefined;
|
|
311
|
-
value?: any;
|
|
312
|
-
};
|
|
313
|
-
contractAddress: string;
|
|
314
|
-
chain?: z.Primitive;
|
|
315
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
316
|
-
functionAbi?: {
|
|
317
|
-
type: "function";
|
|
318
|
-
name: string;
|
|
319
|
-
inputs: {
|
|
320
|
-
type: string;
|
|
321
|
-
name: string;
|
|
322
|
-
internalType: string;
|
|
323
|
-
}[];
|
|
324
|
-
outputs: [{
|
|
325
|
-
type: string;
|
|
326
|
-
name: string;
|
|
327
|
-
internalType: string;
|
|
328
|
-
}, ...{
|
|
329
|
-
type: string;
|
|
330
|
-
name: string;
|
|
331
|
-
internalType: string;
|
|
332
|
-
}[]];
|
|
333
|
-
stateMutability: "view" | "pure";
|
|
334
|
-
} | undefined;
|
|
335
|
-
}, {
|
|
336
|
-
method: string;
|
|
337
|
-
parameters: any[];
|
|
338
|
-
returnValueTest: {
|
|
339
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
340
|
-
index?: number | undefined;
|
|
341
|
-
value?: any;
|
|
342
|
-
};
|
|
343
|
-
contractAddress: string;
|
|
344
|
-
chain?: z.Primitive;
|
|
345
|
-
conditionType?: "contract" | undefined;
|
|
346
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
347
|
-
functionAbi?: {
|
|
348
|
-
type: "function";
|
|
349
|
-
name: string;
|
|
350
|
-
inputs: {
|
|
351
|
-
type: string;
|
|
352
|
-
name: string;
|
|
353
|
-
internalType: string;
|
|
354
|
-
}[];
|
|
355
|
-
outputs: [{
|
|
356
|
-
type: string;
|
|
357
|
-
name: string;
|
|
358
|
-
internalType: string;
|
|
359
|
-
}, ...{
|
|
360
|
-
type: string;
|
|
361
|
-
name: string;
|
|
362
|
-
internalType: string;
|
|
363
|
-
}[]];
|
|
364
|
-
stateMutability: "view" | "pure";
|
|
365
|
-
} | undefined;
|
|
366
|
-
}>, {
|
|
367
|
-
conditionType: "contract";
|
|
368
|
-
method: string;
|
|
369
|
-
parameters: any[];
|
|
370
|
-
returnValueTest: {
|
|
371
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
372
|
-
index?: number | undefined;
|
|
373
|
-
value?: any;
|
|
374
|
-
};
|
|
375
|
-
contractAddress: string;
|
|
376
|
-
chain?: z.Primitive;
|
|
377
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
378
|
-
functionAbi?: {
|
|
379
|
-
type: "function";
|
|
380
|
-
name: string;
|
|
381
|
-
inputs: {
|
|
382
|
-
type: string;
|
|
383
|
-
name: string;
|
|
384
|
-
internalType: string;
|
|
385
|
-
}[];
|
|
386
|
-
outputs: [{
|
|
387
|
-
type: string;
|
|
388
|
-
name: string;
|
|
389
|
-
internalType: string;
|
|
390
|
-
}, ...{
|
|
391
|
-
type: string;
|
|
392
|
-
name: string;
|
|
393
|
-
internalType: string;
|
|
394
|
-
}[]];
|
|
395
|
-
stateMutability: "view" | "pure";
|
|
396
|
-
} | undefined;
|
|
397
|
-
}, {
|
|
398
|
-
method: string;
|
|
399
|
-
parameters: any[];
|
|
400
|
-
returnValueTest: {
|
|
401
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
402
|
-
index?: number | undefined;
|
|
403
|
-
value?: any;
|
|
404
|
-
};
|
|
405
|
-
contractAddress: string;
|
|
406
|
-
chain?: z.Primitive;
|
|
407
|
-
conditionType?: "contract" | undefined;
|
|
408
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
409
|
-
functionAbi?: {
|
|
410
|
-
type: "function";
|
|
411
|
-
name: string;
|
|
412
|
-
inputs: {
|
|
413
|
-
type: string;
|
|
414
|
-
name: string;
|
|
415
|
-
internalType: string;
|
|
416
|
-
}[];
|
|
417
|
-
outputs: [{
|
|
418
|
-
type: string;
|
|
419
|
-
name: string;
|
|
420
|
-
internalType: string;
|
|
421
|
-
}, ...{
|
|
422
|
-
type: string;
|
|
423
|
-
name: string;
|
|
424
|
-
internalType: string;
|
|
425
|
-
}[]];
|
|
426
|
-
stateMutability: "view" | "pure";
|
|
427
|
-
} | undefined;
|
|
428
|
-
}>;
|
|
429
|
-
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
4
|
+
export { ContractConditionProps, contractConditionSchema, ContractConditionType, FunctionAbiProps, } from '../schemas/contract';
|
|
430
5
|
export declare class ContractCondition extends Condition {
|
|
431
6
|
constructor(value: OmitConditionType<ContractConditionProps>);
|
|
432
7
|
}
|
|
433
|
-
export {};
|
|
@@ -1,88 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContractCondition = exports.
|
|
4
|
-
const shared_1 = require("@nucypher/shared");
|
|
5
|
-
const ethers_1 = require("ethers");
|
|
6
|
-
const zod_1 = require("zod");
|
|
3
|
+
exports.ContractCondition = exports.ContractConditionType = exports.contractConditionSchema = void 0;
|
|
7
4
|
const condition_1 = require("../condition");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// Alternatively, find a TS Solidity type lib.
|
|
13
|
-
const EthBaseTypes = [
|
|
14
|
-
'bool',
|
|
15
|
-
'string',
|
|
16
|
-
'address',
|
|
17
|
-
'address payable',
|
|
18
|
-
...Array.from({ length: 32 }, (_v, i) => `bytes${i + 1}`), // bytes1 through bytes32
|
|
19
|
-
'bytes',
|
|
20
|
-
...Array.from({ length: 32 }, (_v, i) => `uint${8 * (i + 1)}`), // uint8 through uint256
|
|
21
|
-
...Array.from({ length: 32 }, (_v, i) => `int${8 * (i + 1)}`), // int8 through int256
|
|
22
|
-
];
|
|
23
|
-
const functionAbiVariableSchema = zod_1.z
|
|
24
|
-
.object({
|
|
25
|
-
name: zod_1.z.string(),
|
|
26
|
-
type: zod_1.z.enum(EthBaseTypes),
|
|
27
|
-
internalType: zod_1.z.enum(EthBaseTypes), // TODO: Do we need to validate this?
|
|
28
|
-
})
|
|
29
|
-
.strict();
|
|
30
|
-
const functionAbiSchema = zod_1.z
|
|
31
|
-
.object({
|
|
32
|
-
name: zod_1.z.string(),
|
|
33
|
-
type: zod_1.z.literal('function'),
|
|
34
|
-
inputs: zod_1.z.array(functionAbiVariableSchema).min(0),
|
|
35
|
-
outputs: zod_1.z.array(functionAbiVariableSchema).nonempty(),
|
|
36
|
-
stateMutability: zod_1.z.union([zod_1.z.literal('view'), zod_1.z.literal('pure')]),
|
|
37
|
-
})
|
|
38
|
-
.strict()
|
|
39
|
-
.refine((functionAbi) => {
|
|
40
|
-
let asInterface;
|
|
41
|
-
try {
|
|
42
|
-
// `stringify` here because ethers.utils.Interface doesn't accept a Zod schema
|
|
43
|
-
asInterface = new ethers_1.ethers.utils.Interface(JSON.stringify([functionAbi]));
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const functionsInAbi = Object.values(asInterface.functions || {});
|
|
49
|
-
return functionsInAbi.length === 1;
|
|
50
|
-
}, {
|
|
51
|
-
message: '"functionAbi" must contain a single function definition',
|
|
52
|
-
path: ['functionAbi'],
|
|
53
|
-
})
|
|
54
|
-
.refine((functionAbi) => {
|
|
55
|
-
const asInterface = new ethers_1.ethers.utils.Interface(JSON.stringify([functionAbi]));
|
|
56
|
-
const nrOfInputs = asInterface.fragments[0].inputs.length;
|
|
57
|
-
return functionAbi.inputs.length === nrOfInputs;
|
|
58
|
-
}, {
|
|
59
|
-
message: '"parameters" must have the same length as "functionAbi.inputs"',
|
|
60
|
-
path: ['parameters'],
|
|
61
|
-
});
|
|
62
|
-
exports.ContractConditionType = 'contract';
|
|
63
|
-
exports.contractConditionSchema = rpc_1.rpcConditionSchema
|
|
64
|
-
.extend({
|
|
65
|
-
conditionType: zod_1.z
|
|
66
|
-
.literal(exports.ContractConditionType)
|
|
67
|
-
.default(exports.ContractConditionType),
|
|
68
|
-
contractAddress: zod_1.z.string().regex(shared_1.ETH_ADDRESS_REGEXP).length(42),
|
|
69
|
-
standardContractType: zod_1.z.enum(['ERC20', 'ERC721']).optional(),
|
|
70
|
-
method: zod_1.z.string(),
|
|
71
|
-
functionAbi: functionAbiSchema.optional(),
|
|
72
|
-
parameters: zod_1.z.array(shared_2.paramOrContextParamSchema),
|
|
73
|
-
})
|
|
74
|
-
// Adding this custom logic causes the return type to be ZodEffects instead of ZodObject
|
|
75
|
-
// https://github.com/colinhacks/zod/issues/2474
|
|
76
|
-
.refine(
|
|
77
|
-
// A check to see if either 'standardContractType' or 'functionAbi' is set
|
|
78
|
-
(data) => Boolean(data.standardContractType) !== Boolean(data.functionAbi), {
|
|
79
|
-
message: "At most one of the fields 'standardContractType' and 'functionAbi' must be defined",
|
|
80
|
-
path: ['standardContractType'],
|
|
81
|
-
});
|
|
5
|
+
const contract_1 = require("../schemas/contract");
|
|
6
|
+
var contract_2 = require("../schemas/contract");
|
|
7
|
+
Object.defineProperty(exports, "contractConditionSchema", { enumerable: true, get: function () { return contract_2.contractConditionSchema; } });
|
|
8
|
+
Object.defineProperty(exports, "ContractConditionType", { enumerable: true, get: function () { return contract_2.ContractConditionType; } });
|
|
82
9
|
class ContractCondition extends condition_1.Condition {
|
|
83
10
|
constructor(value) {
|
|
84
|
-
super(
|
|
85
|
-
conditionType:
|
|
11
|
+
super(contract_1.contractConditionSchema, {
|
|
12
|
+
conditionType: contract_1.ContractConditionType,
|
|
86
13
|
...value,
|
|
87
14
|
});
|
|
88
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/base/contract.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/conditions/base/contract.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,kDAI6B;AAG7B,gDAK6B;AAH3B,mHAAA,uBAAuB,OAAA;AACvB,iHAAA,qBAAqB,OAAA;AAIvB,MAAa,iBAAkB,SAAQ,qBAAS;IAC9C,YAAY,KAAgD;QAC1D,KAAK,CAAC,kCAAuB,EAAE;YAC7B,aAAa,EAAE,gCAAqB;YACpC,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,8CAOC"}
|
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
return result;
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.time = exports.rpc = exports.contract = void 0;
|
|
28
|
+
exports.time = exports.rpc = exports.jsonApi = exports.contract = void 0;
|
|
29
29
|
exports.contract = __importStar(require("./contract"));
|
|
30
|
+
exports.jsonApi = __importStar(require("./json-api"));
|
|
30
31
|
exports.rpc = __importStar(require("./rpc"));
|
|
31
32
|
exports.time = __importStar(require("./time"));
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhD,uDAAuC;AACvC,6CAA6B;AAC7B,+CAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhD,uDAAuC;AACvC,sDAAsC;AACtC,6CAA6B;AAC7B,+CAA+B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { JsonApiConditionProps } from '../schemas/json-api';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { JsonApiConditionProps, jsonApiConditionSchema, JsonApiConditionType, jsonPathSchema, } from '../schemas/json-api';
|
|
5
|
+
export declare class JsonApiCondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<JsonApiConditionProps>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonApiCondition = exports.jsonPathSchema = exports.JsonApiConditionType = exports.jsonApiConditionSchema = void 0;
|
|
4
|
+
const condition_1 = require("../condition");
|
|
5
|
+
const json_api_1 = require("../schemas/json-api");
|
|
6
|
+
var json_api_2 = require("../schemas/json-api");
|
|
7
|
+
Object.defineProperty(exports, "jsonApiConditionSchema", { enumerable: true, get: function () { return json_api_2.jsonApiConditionSchema; } });
|
|
8
|
+
Object.defineProperty(exports, "JsonApiConditionType", { enumerable: true, get: function () { return json_api_2.JsonApiConditionType; } });
|
|
9
|
+
Object.defineProperty(exports, "jsonPathSchema", { enumerable: true, get: function () { return json_api_2.jsonPathSchema; } });
|
|
10
|
+
class JsonApiCondition extends condition_1.Condition {
|
|
11
|
+
constructor(value) {
|
|
12
|
+
super(json_api_1.jsonApiConditionSchema, {
|
|
13
|
+
conditionType: json_api_1.JsonApiConditionType,
|
|
14
|
+
...value,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.JsonApiCondition = JsonApiCondition;
|
|
19
|
+
//# sourceMappingURL=json-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-api.js","sourceRoot":"","sources":["../../../../src/conditions/base/json-api.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,kDAI6B;AAG7B,gDAK6B;AAH3B,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AACpB,0GAAA,cAAc,OAAA;AAGhB,MAAa,gBAAiB,SAAQ,qBAAS;IAC7C,YAAY,KAA+C;QACzD,KAAK,CAAC,iCAAsB,EAAE;YAC5B,aAAa,EAAE,+BAAoB;YACnC,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,4CAOC"}
|
|
@@ -1,47 +1,7 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { Condition } from '../condition';
|
|
2
|
+
import { RpcConditionProps } from '../schemas/rpc';
|
|
3
3
|
import { OmitConditionType } from '../shared';
|
|
4
|
-
export
|
|
5
|
-
export declare const rpcConditionSchema: z.ZodObject<{
|
|
6
|
-
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
7
|
-
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
8
|
-
method: z.ZodEnum<["eth_getBalance"]>;
|
|
9
|
-
parameters: z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>]>, "atleastone">, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>]>, z.ZodType<any, z.ZodTypeDef, any>], null>]>;
|
|
10
|
-
returnValueTest: z.ZodObject<{
|
|
11
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
12
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
13
|
-
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
16
|
-
index?: number | undefined;
|
|
17
|
-
value?: any;
|
|
18
|
-
}, {
|
|
19
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
20
|
-
index?: number | undefined;
|
|
21
|
-
value?: any;
|
|
22
|
-
}>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
conditionType: "rpc";
|
|
25
|
-
method: "eth_getBalance";
|
|
26
|
-
parameters: ([string, ...string[]] | [string, any]) & ([string, ...string[]] | [string, any] | undefined);
|
|
27
|
-
returnValueTest: {
|
|
28
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
29
|
-
index?: number | undefined;
|
|
30
|
-
value?: any;
|
|
31
|
-
};
|
|
32
|
-
chain?: z.Primitive;
|
|
33
|
-
}, {
|
|
34
|
-
method: "eth_getBalance";
|
|
35
|
-
parameters: ([string, ...string[]] | [string, any]) & ([string, ...string[]] | [string, any] | undefined);
|
|
36
|
-
returnValueTest: {
|
|
37
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
38
|
-
index?: number | undefined;
|
|
39
|
-
value?: any;
|
|
40
|
-
};
|
|
41
|
-
conditionType?: "rpc" | undefined;
|
|
42
|
-
chain?: z.Primitive;
|
|
43
|
-
}>;
|
|
44
|
-
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
4
|
+
export { RpcConditionProps, rpcConditionSchema, RpcConditionType, } from '../schemas/rpc';
|
|
45
5
|
export declare class RpcCondition extends Condition {
|
|
46
6
|
constructor(value: OmitConditionType<RpcConditionProps>);
|
|
47
7
|
}
|