@taqueria/plugin-contract-types 0.0.0-pr-91-a8fa7172
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/Readme.md +212 -0
- package/example/contracts/example-contract-1.tz +1409 -0
- package/example/contracts/example-contract-2.tz +798 -0
- package/example/contracts/example-contract-3.json +7080 -0
- package/example/contracts/example-contract-4.tz +1374 -0
- package/example/contracts/example-contract-5.tz +1424 -0
- package/example/contracts/example-contract-6.tz +675 -0
- package/example/contracts/example-contract-7.tz +384 -0
- package/example/contracts/example-contract-8.tz +28 -0
- package/example/contracts/example-contract-9.tz +1010 -0
- package/example/example-usage-type-utilities.ts +35 -0
- package/example/example-usage.ts +410 -0
- package/example/types-file/example-contract-1.code.ts +6 -0
- package/example/types-file/example-contract-1.types.ts +87 -0
- package/example/types-file/example-contract-2.code.ts +6 -0
- package/example/types-file/example-contract-2.types.ts +122 -0
- package/example/types-file/example-contract-4.code.ts +6 -0
- package/example/types-file/example-contract-4.types.ts +97 -0
- package/example/types-file/example-contract-5.code.ts +6 -0
- package/example/types-file/example-contract-5.types.ts +173 -0
- package/example/types-file/example-contract-6.code.ts +6 -0
- package/example/types-file/example-contract-6.types.ts +122 -0
- package/example/types-file/example-contract-7.code.ts +6 -0
- package/example/types-file/example-contract-7.types.ts +78 -0
- package/example/types-file/example-contract-8.code.ts +6 -0
- package/example/types-file/example-contract-8.types.ts +86 -0
- package/example/types-file/example-contract-9.code.ts +6 -0
- package/example/types-file/example-contract-9.types.ts +29 -0
- package/example/types-file/type-aliases.ts +81 -0
- package/example/types-file/type-utils.ts +36 -0
- package/index.js +969 -0
- package/index.js.map +1 -0
- package/index.ts +32 -0
- package/package.json +55 -0
- package/run.ts +3 -0
- package/src/cli-process.ts +111 -0
- package/src/cli.ts +34 -0
- package/src/generator/common.ts +21 -0
- package/src/generator/contract-name.ts +6 -0
- package/src/generator/contract-parser.ts +358 -0
- package/src/generator/process.ts +66 -0
- package/src/generator/schema-output.ts +54 -0
- package/src/generator/typescript-output.ts +239 -0
- package/src/taquito-contract-type-generator.ts +4 -0
- package/src/type-aliases-file-content.ts +83 -0
- package/src/type-aliases.ts +80 -0
- package/src/type-utils-file-content.ts +38 -0
- package/src/type-utils.ts +35 -0
- package/tasks.ts +127 -0
- package/test/generator.spec.ts +69 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
{ parameter
|
|
2
|
+
(or (or (or %admin (or (unit %confirm_admin) (bool %pause)) (address %set_admin))
|
|
3
|
+
(pair %buy
|
|
4
|
+
(address %sale_seller)
|
|
5
|
+
(pair %tokens
|
|
6
|
+
(address %token_for_sale_address)
|
|
7
|
+
(pair (nat %token_for_sale_token_id)
|
|
8
|
+
(pair (address %money_token_address) (nat %money_token_token_id))))))
|
|
9
|
+
(or (list %mint
|
|
10
|
+
(pair (pair %token_metadata (nat %token_id) (map %token_info string bytes))
|
|
11
|
+
(address %owner)))
|
|
12
|
+
(pair %sell
|
|
13
|
+
(nat %sale_price)
|
|
14
|
+
(pair %sale_tokens_param
|
|
15
|
+
(address %token_for_sale_address)
|
|
16
|
+
(pair (nat %token_for_sale_token_id)
|
|
17
|
+
(pair (address %money_token_address) (nat %money_token_token_id))))))) ;
|
|
18
|
+
storage
|
|
19
|
+
(pair (option %admin
|
|
20
|
+
(pair (pair (address %admin) (bool %paused)) (option %pending_admin address)))
|
|
21
|
+
(big_map %sales
|
|
22
|
+
(pair (address %sale_seller)
|
|
23
|
+
(pair %tokens
|
|
24
|
+
(address %token_for_sale_address)
|
|
25
|
+
(pair (nat %token_for_sale_token_id)
|
|
26
|
+
(pair (address %money_token_address) (nat %money_token_token_id)))))
|
|
27
|
+
nat)) ;
|
|
28
|
+
code { LAMBDA
|
|
29
|
+
(option (pair (pair address bool) (option address)))
|
|
30
|
+
unit
|
|
31
|
+
{ IF_NONE
|
|
32
|
+
{ UNIT }
|
|
33
|
+
{ CAR ;
|
|
34
|
+
CAR ;
|
|
35
|
+
SENDER ;
|
|
36
|
+
COMPARE ;
|
|
37
|
+
NEQ ;
|
|
38
|
+
IF { PUSH string "NOT_AN_ADMIN" ; FAILWITH } { UNIT } } } ;
|
|
39
|
+
LAMBDA
|
|
40
|
+
(option (pair (pair address bool) (option address)))
|
|
41
|
+
unit
|
|
42
|
+
{ IF_NONE
|
|
43
|
+
{ UNIT }
|
|
44
|
+
{ CAR ; CDR ; IF { PUSH string "PAUSED" ; FAILWITH } { UNIT } } } ;
|
|
45
|
+
LAMBDA
|
|
46
|
+
(pair (pair address nat) (pair address address))
|
|
47
|
+
operation
|
|
48
|
+
{ UNPAIR ;
|
|
49
|
+
UNPAIR ;
|
|
50
|
+
DIG 2 ;
|
|
51
|
+
UNPAIR ;
|
|
52
|
+
DIG 2 ;
|
|
53
|
+
CONTRACT %transfer
|
|
54
|
+
(list (pair (address %from_)
|
|
55
|
+
(list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount)))))) ;
|
|
56
|
+
IF_NONE
|
|
57
|
+
{ DROP 3 ; PUSH string "CANNOT_INVOKE_FA2_TRANSFER" ; FAILWITH }
|
|
58
|
+
{ PUSH mutez 0 ;
|
|
59
|
+
NIL (pair address (list (pair address (pair nat nat)))) ;
|
|
60
|
+
NIL (pair address (pair nat nat)) ;
|
|
61
|
+
PUSH nat 1 ;
|
|
62
|
+
DIG 7 ;
|
|
63
|
+
PAIR ;
|
|
64
|
+
DIG 6 ;
|
|
65
|
+
PAIR ;
|
|
66
|
+
CONS ;
|
|
67
|
+
DIG 4 ;
|
|
68
|
+
PAIR ;
|
|
69
|
+
CONS ;
|
|
70
|
+
TRANSFER_TOKENS } } ;
|
|
71
|
+
LAMBDA
|
|
72
|
+
(pair (pair (pair address nat) (pair nat address)) address)
|
|
73
|
+
operation
|
|
74
|
+
{ UNPAIR ;
|
|
75
|
+
UNPAIR ;
|
|
76
|
+
UNPAIR ;
|
|
77
|
+
DIG 2 ;
|
|
78
|
+
UNPAIR ;
|
|
79
|
+
DIG 2 ;
|
|
80
|
+
CONTRACT %transfer
|
|
81
|
+
(list (pair (address %from_)
|
|
82
|
+
(list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount)))))) ;
|
|
83
|
+
IF_NONE
|
|
84
|
+
{ DROP 4 ; PUSH string "CANNOT_INVOKE_MONEY_FA2" ; FAILWITH }
|
|
85
|
+
{ PUSH mutez 0 ;
|
|
86
|
+
NIL (pair address (list (pair address (pair nat nat)))) ;
|
|
87
|
+
NIL (pair address (pair nat nat)) ;
|
|
88
|
+
DIG 4 ;
|
|
89
|
+
DIG 6 ;
|
|
90
|
+
PAIR ;
|
|
91
|
+
DIG 6 ;
|
|
92
|
+
PAIR ;
|
|
93
|
+
CONS ;
|
|
94
|
+
DIG 4 ;
|
|
95
|
+
PAIR ;
|
|
96
|
+
CONS ;
|
|
97
|
+
TRANSFER_TOKENS } } ;
|
|
98
|
+
DIG 4 ;
|
|
99
|
+
UNPAIR ;
|
|
100
|
+
IF_LEFT
|
|
101
|
+
{ IF_LEFT
|
|
102
|
+
{ DIG 2 ;
|
|
103
|
+
DROP ;
|
|
104
|
+
DIG 2 ;
|
|
105
|
+
DROP ;
|
|
106
|
+
DIG 2 ;
|
|
107
|
+
DROP ;
|
|
108
|
+
SWAP ;
|
|
109
|
+
DUP ;
|
|
110
|
+
DUG 2 ;
|
|
111
|
+
CAR ;
|
|
112
|
+
SWAP ;
|
|
113
|
+
IF_LEFT
|
|
114
|
+
{ IF_LEFT
|
|
115
|
+
{ DROP ;
|
|
116
|
+
DIG 2 ;
|
|
117
|
+
DROP ;
|
|
118
|
+
IF_NONE
|
|
119
|
+
{ PUSH string "NO_ADMIN_CAPABILITIES_CONFIGURED" ; FAILWITH }
|
|
120
|
+
{ DUP ;
|
|
121
|
+
CDR ;
|
|
122
|
+
IF_NONE
|
|
123
|
+
{ DROP ; PUSH string "NO_PENDING_ADMIN" ; FAILWITH }
|
|
124
|
+
{ SENDER ;
|
|
125
|
+
COMPARE ;
|
|
126
|
+
EQ ;
|
|
127
|
+
IF { NONE address ; SWAP ; CAR ; CDR ; SENDER ; PAIR ; PAIR ; SOME }
|
|
128
|
+
{ DROP ; PUSH string "NOT_A_PENDING_ADMIN" ; FAILWITH } } } ;
|
|
129
|
+
NIL operation ;
|
|
130
|
+
PAIR }
|
|
131
|
+
{ SWAP ;
|
|
132
|
+
DUP ;
|
|
133
|
+
DUG 2 ;
|
|
134
|
+
DIG 4 ;
|
|
135
|
+
SWAP ;
|
|
136
|
+
EXEC ;
|
|
137
|
+
DROP ;
|
|
138
|
+
SWAP ;
|
|
139
|
+
IF_NONE
|
|
140
|
+
{ DROP ; PUSH string "NO_ADMIN_CAPABILITIES_CONFIGURED" ; FAILWITH }
|
|
141
|
+
{ DUP ; CDR ; DUG 2 ; CAR ; CAR ; PAIR ; PAIR ; SOME } ;
|
|
142
|
+
NIL operation ;
|
|
143
|
+
PAIR } }
|
|
144
|
+
{ SWAP ;
|
|
145
|
+
DUP ;
|
|
146
|
+
DUG 2 ;
|
|
147
|
+
DIG 4 ;
|
|
148
|
+
SWAP ;
|
|
149
|
+
EXEC ;
|
|
150
|
+
DROP ;
|
|
151
|
+
SWAP ;
|
|
152
|
+
IF_NONE
|
|
153
|
+
{ DROP ; PUSH string "NO_ADMIN_CAPABILITIES_CONFIGURED" ; FAILWITH }
|
|
154
|
+
{ SWAP ; SOME ; SWAP ; CAR ; PAIR ; SOME } ;
|
|
155
|
+
NIL operation ;
|
|
156
|
+
PAIR } ;
|
|
157
|
+
UNPAIR ;
|
|
158
|
+
DIG 2 ;
|
|
159
|
+
CDR ;
|
|
160
|
+
DIG 2 ;
|
|
161
|
+
PAIR ;
|
|
162
|
+
SWAP ;
|
|
163
|
+
PAIR }
|
|
164
|
+
{ DIG 5 ;
|
|
165
|
+
DROP ;
|
|
166
|
+
SWAP ;
|
|
167
|
+
DUP ;
|
|
168
|
+
DUG 2 ;
|
|
169
|
+
CAR ;
|
|
170
|
+
DIG 5 ;
|
|
171
|
+
SWAP ;
|
|
172
|
+
EXEC ;
|
|
173
|
+
DROP ;
|
|
174
|
+
SWAP ;
|
|
175
|
+
DUP ;
|
|
176
|
+
DUG 2 ;
|
|
177
|
+
CDR ;
|
|
178
|
+
SWAP ;
|
|
179
|
+
DUP ;
|
|
180
|
+
DUG 2 ;
|
|
181
|
+
GET ;
|
|
182
|
+
IF_NONE { PUSH string "NO_SALE" ; FAILWITH } {} ;
|
|
183
|
+
SELF_ADDRESS ;
|
|
184
|
+
SENDER ;
|
|
185
|
+
DUP 3 ;
|
|
186
|
+
PAIR ;
|
|
187
|
+
DUP 4 ;
|
|
188
|
+
CDR ;
|
|
189
|
+
CDR ;
|
|
190
|
+
CDR ;
|
|
191
|
+
CDR ;
|
|
192
|
+
DUP 5 ;
|
|
193
|
+
CDR ;
|
|
194
|
+
CDR ;
|
|
195
|
+
CDR ;
|
|
196
|
+
CAR ;
|
|
197
|
+
PAIR ;
|
|
198
|
+
PAIR ;
|
|
199
|
+
PAIR ;
|
|
200
|
+
DUP 5 ;
|
|
201
|
+
SWAP ;
|
|
202
|
+
EXEC ;
|
|
203
|
+
DUP 3 ;
|
|
204
|
+
CAR ;
|
|
205
|
+
SELF_ADDRESS ;
|
|
206
|
+
DIG 3 ;
|
|
207
|
+
PAIR ;
|
|
208
|
+
DUP 4 ;
|
|
209
|
+
CDR ;
|
|
210
|
+
CDR ;
|
|
211
|
+
CDR ;
|
|
212
|
+
CDR ;
|
|
213
|
+
DUP 5 ;
|
|
214
|
+
CDR ;
|
|
215
|
+
CDR ;
|
|
216
|
+
CDR ;
|
|
217
|
+
CAR ;
|
|
218
|
+
PAIR ;
|
|
219
|
+
PAIR ;
|
|
220
|
+
PAIR ;
|
|
221
|
+
DIG 4 ;
|
|
222
|
+
SWAP ;
|
|
223
|
+
EXEC ;
|
|
224
|
+
SENDER ;
|
|
225
|
+
SELF_ADDRESS ;
|
|
226
|
+
PAIR ;
|
|
227
|
+
DUP 4 ;
|
|
228
|
+
CDR ;
|
|
229
|
+
CDR ;
|
|
230
|
+
CAR ;
|
|
231
|
+
DUP 5 ;
|
|
232
|
+
CDR ;
|
|
233
|
+
CAR ;
|
|
234
|
+
PAIR ;
|
|
235
|
+
PAIR ;
|
|
236
|
+
DIG 5 ;
|
|
237
|
+
SWAP ;
|
|
238
|
+
EXEC ;
|
|
239
|
+
DUP 5 ;
|
|
240
|
+
CDR ;
|
|
241
|
+
DIG 4 ;
|
|
242
|
+
NONE nat ;
|
|
243
|
+
SWAP ;
|
|
244
|
+
UPDATE ;
|
|
245
|
+
DIG 4 ;
|
|
246
|
+
CAR ;
|
|
247
|
+
PAIR ;
|
|
248
|
+
NIL operation ;
|
|
249
|
+
DIG 2 ;
|
|
250
|
+
CONS ;
|
|
251
|
+
DIG 2 ;
|
|
252
|
+
CONS ;
|
|
253
|
+
DIG 2 ;
|
|
254
|
+
CONS ;
|
|
255
|
+
PAIR } }
|
|
256
|
+
{ DIG 2 ;
|
|
257
|
+
DROP ;
|
|
258
|
+
DIG 4 ;
|
|
259
|
+
DROP ;
|
|
260
|
+
IF_LEFT
|
|
261
|
+
{ DUP ;
|
|
262
|
+
CAR ;
|
|
263
|
+
SENDER ;
|
|
264
|
+
COMPARE ;
|
|
265
|
+
EQ ;
|
|
266
|
+
IF { PUSH unit Unit }
|
|
267
|
+
{ PUSH string "OR A SELLER" ;
|
|
268
|
+
DUP 3 ;
|
|
269
|
+
CAR ;
|
|
270
|
+
IF_NONE
|
|
271
|
+
{ DROP ; UNIT }
|
|
272
|
+
{ CAR ;
|
|
273
|
+
CAR ;
|
|
274
|
+
SENDER ;
|
|
275
|
+
COMPARE ;
|
|
276
|
+
NEQ ;
|
|
277
|
+
IF { PUSH string " " ; CONCAT ; PUSH string "NOT_AN_ADMIN" ; CONCAT ; FAILWITH }
|
|
278
|
+
{ DROP ; UNIT } } } ;
|
|
279
|
+
DROP ;
|
|
280
|
+
SWAP ;
|
|
281
|
+
DUP ;
|
|
282
|
+
DUG 2 ;
|
|
283
|
+
CAR ;
|
|
284
|
+
DIG 4 ;
|
|
285
|
+
SWAP ;
|
|
286
|
+
EXEC ;
|
|
287
|
+
DROP ;
|
|
288
|
+
SWAP ;
|
|
289
|
+
DUP ;
|
|
290
|
+
DUG 2 ;
|
|
291
|
+
CDR ;
|
|
292
|
+
SWAP ;
|
|
293
|
+
DUP ;
|
|
294
|
+
DUG 2 ;
|
|
295
|
+
GET ;
|
|
296
|
+
IF_NONE
|
|
297
|
+
{ DROP 3 ; PUSH string "NO_SALE" ; FAILWITH }
|
|
298
|
+
{ DROP ;
|
|
299
|
+
SENDER ;
|
|
300
|
+
SWAP ;
|
|
301
|
+
DUP ;
|
|
302
|
+
DUG 2 ;
|
|
303
|
+
CAR ;
|
|
304
|
+
COMPARE ;
|
|
305
|
+
EQ ;
|
|
306
|
+
IF { SENDER ;
|
|
307
|
+
SELF_ADDRESS ;
|
|
308
|
+
PAIR ;
|
|
309
|
+
SWAP ;
|
|
310
|
+
DUP ;
|
|
311
|
+
DUG 2 ;
|
|
312
|
+
CDR ;
|
|
313
|
+
CDR ;
|
|
314
|
+
CAR ;
|
|
315
|
+
DUP 3 ;
|
|
316
|
+
CDR ;
|
|
317
|
+
CAR ;
|
|
318
|
+
PAIR ;
|
|
319
|
+
PAIR ;
|
|
320
|
+
DIG 3 ;
|
|
321
|
+
SWAP ;
|
|
322
|
+
EXEC ;
|
|
323
|
+
DUP 3 ;
|
|
324
|
+
CDR ;
|
|
325
|
+
DIG 2 ;
|
|
326
|
+
NONE nat ;
|
|
327
|
+
SWAP ;
|
|
328
|
+
UPDATE ;
|
|
329
|
+
DIG 2 ;
|
|
330
|
+
CAR ;
|
|
331
|
+
PAIR ;
|
|
332
|
+
NIL operation ;
|
|
333
|
+
DIG 2 ;
|
|
334
|
+
CONS ;
|
|
335
|
+
PAIR }
|
|
336
|
+
{ DROP 3 ; PUSH string "NOT_OWNER" ; FAILWITH } } }
|
|
337
|
+
{ SWAP ;
|
|
338
|
+
DUP ;
|
|
339
|
+
DUG 2 ;
|
|
340
|
+
CAR ;
|
|
341
|
+
DIG 4 ;
|
|
342
|
+
SWAP ;
|
|
343
|
+
EXEC ;
|
|
344
|
+
DROP ;
|
|
345
|
+
SELF_ADDRESS ;
|
|
346
|
+
SENDER ;
|
|
347
|
+
PAIR ;
|
|
348
|
+
SWAP ;
|
|
349
|
+
DUP ;
|
|
350
|
+
DUG 2 ;
|
|
351
|
+
CDR ;
|
|
352
|
+
CDR ;
|
|
353
|
+
CAR ;
|
|
354
|
+
DUP 3 ;
|
|
355
|
+
CDR ;
|
|
356
|
+
CAR ;
|
|
357
|
+
PAIR ;
|
|
358
|
+
PAIR ;
|
|
359
|
+
DIG 3 ;
|
|
360
|
+
SWAP ;
|
|
361
|
+
EXEC ;
|
|
362
|
+
SWAP ;
|
|
363
|
+
DUP ;
|
|
364
|
+
DUG 2 ;
|
|
365
|
+
CDR ;
|
|
366
|
+
SENDER ;
|
|
367
|
+
PAIR ;
|
|
368
|
+
DUP 4 ;
|
|
369
|
+
CDR ;
|
|
370
|
+
DIG 3 ;
|
|
371
|
+
CAR ;
|
|
372
|
+
DIG 2 ;
|
|
373
|
+
SWAP ;
|
|
374
|
+
SOME ;
|
|
375
|
+
SWAP ;
|
|
376
|
+
UPDATE ;
|
|
377
|
+
DIG 2 ;
|
|
378
|
+
CAR ;
|
|
379
|
+
PAIR ;
|
|
380
|
+
NIL operation ;
|
|
381
|
+
DIG 2 ;
|
|
382
|
+
CONS ;
|
|
383
|
+
PAIR } } } }
|
|
384
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{ parameter
|
|
2
|
+
(or (pair %make
|
|
3
|
+
(nat %id)
|
|
4
|
+
(pair (address %p1) (pair (mutez %fee) (option %otherFee mutez))))
|
|
5
|
+
(or (nat %join)
|
|
6
|
+
(or (pair %register2 (nat %id) (address %p2))
|
|
7
|
+
(or (pair %accept
|
|
8
|
+
(nat %id)
|
|
9
|
+
(or %result (unit %result1) (or (unit %result2) (unit %ok))))
|
|
10
|
+
(or (nat %cancel)
|
|
11
|
+
(or (address %setAuth)
|
|
12
|
+
(or (unit %confirmAuth) (or (address %setCollector) (unit %free))))))))) ;
|
|
13
|
+
storage
|
|
14
|
+
(pair (big_map %entries
|
|
15
|
+
nat
|
|
16
|
+
(or %progress
|
|
17
|
+
(unit %waiting01)
|
|
18
|
+
(or (unit %waiting02)
|
|
19
|
+
(or (address %p1)
|
|
20
|
+
(or (address %p2)
|
|
21
|
+
(or (pair %finished
|
|
22
|
+
(address %bob)
|
|
23
|
+
(or %result (unit %result1) (or (unit %result2) (unit %ok))))
|
|
24
|
+
(option %cancelled address)))))))
|
|
25
|
+
(pair (address %alice)
|
|
26
|
+
(pair (address %caleb)
|
|
27
|
+
(pair (address %dodge) (pair (nat %count) (bool %free)))))) ;
|
|
28
|
+
code { PUSH string "XTZ_RECEIVED" }; }
|