@algorandfoundation/algokit-client-generator 4.0.0-beta.2 → 4.0.0-beta.4
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/client/app-client.js +34 -19
- package/client/app-client.js.map +1 -1
- package/client/app-client.mjs +34 -19
- package/client/app-client.mjs.map +1 -1
- package/client/app-factory.js +34 -17
- package/client/app-factory.js.map +1 -1
- package/client/app-factory.mjs +34 -17
- package/client/app-factory.mjs.map +1 -1
- package/client/app-types.js +11 -7
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs +11 -7
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js +2 -2
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs +2 -2
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js +16 -14
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs +16 -14
- package/client/call-composer.mjs.map +1 -1
- package/client/generate.js +4 -4
- package/client/generate.js.map +1 -1
- package/client/generate.mjs +4 -4
- package/client/generate.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.js +7 -3
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs +7 -3
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.js +3 -2
- package/client/imports.js.map +1 -1
- package/client/imports.mjs +3 -2
- package/client/imports.mjs.map +1 -1
- package/package.json +4 -3
- package/schema/arc56.schema.json.js +106 -55
- package/schema/arc56.schema.json.js.map +1 -1
- package/schema/arc56.schema.json.mjs +106 -55
- package/schema/arc56.schema.json.mjs.map +1 -1
- package/schema/load.js +7 -1
- package/schema/load.js.map +1 -1
- package/schema/load.mjs +7 -1
- package/schema/load.mjs.map +1 -1
|
@@ -6,12 +6,35 @@ var definitions = {
|
|
|
6
6
|
type: "string"
|
|
7
7
|
},
|
|
8
8
|
AVMBytes: {
|
|
9
|
-
"const": "
|
|
9
|
+
"const": "AVMBytes",
|
|
10
10
|
description: "Raw byteslice without the length prefixed that is specified in ARC-4",
|
|
11
11
|
type: "string"
|
|
12
12
|
},
|
|
13
|
+
AVMString: {
|
|
14
|
+
"const": "AVMString",
|
|
15
|
+
description: "A utf-8 string without the length prefix that is specified in ARC-4",
|
|
16
|
+
type: "string"
|
|
17
|
+
},
|
|
18
|
+
AVMType: {
|
|
19
|
+
anyOf: [
|
|
20
|
+
{
|
|
21
|
+
$ref: "#/definitions/AVMBytes"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
$ref: "#/definitions/AVMString"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
$ref: "#/definitions/AVMUint64"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
description: "A native AVM type"
|
|
31
|
+
},
|
|
32
|
+
AVMUint64: {
|
|
33
|
+
"const": "AVMUint64",
|
|
34
|
+
description: "A 64-bit unsigned integer",
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
13
37
|
Arc56Contract: {
|
|
14
|
-
additionalProperties: false,
|
|
15
38
|
description: "Describes the entire contract. This interface is an extension of the interface described in ARC-4",
|
|
16
39
|
properties: {
|
|
17
40
|
arcs: {
|
|
@@ -22,7 +45,6 @@ var definitions = {
|
|
|
22
45
|
type: "array"
|
|
23
46
|
},
|
|
24
47
|
bareActions: {
|
|
25
|
-
additionalProperties: false,
|
|
26
48
|
description: "Supported bare actions for the contract. An action is a combination of call/create and an OnComplete",
|
|
27
49
|
properties: {
|
|
28
50
|
call: {
|
|
@@ -60,7 +82,6 @@ var definitions = {
|
|
|
60
82
|
type: "object"
|
|
61
83
|
},
|
|
62
84
|
byteCode: {
|
|
63
|
-
additionalProperties: false,
|
|
64
85
|
description: "The compiled bytecode for the application. MUST be omitted if included as part of ARC23",
|
|
65
86
|
properties: {
|
|
66
87
|
approval: {
|
|
@@ -79,7 +100,6 @@ var definitions = {
|
|
|
79
100
|
type: "object"
|
|
80
101
|
},
|
|
81
102
|
compilerInfo: {
|
|
82
|
-
additionalProperties: false,
|
|
83
103
|
description: "Information used to get the given byteCode and/or PC values in sourceInfo. MUST be given if byteCode or PC values are present",
|
|
84
104
|
properties: {
|
|
85
105
|
compiler: {
|
|
@@ -91,10 +111,9 @@ var definitions = {
|
|
|
91
111
|
type: "string"
|
|
92
112
|
},
|
|
93
113
|
compilerVersion: {
|
|
94
|
-
additionalProperties: false,
|
|
95
114
|
description: "Compiler version information",
|
|
96
115
|
properties: {
|
|
97
|
-
|
|
116
|
+
commitHash: {
|
|
98
117
|
type: "string"
|
|
99
118
|
},
|
|
100
119
|
major: {
|
|
@@ -145,8 +164,6 @@ var definitions = {
|
|
|
145
164
|
},
|
|
146
165
|
networks: {
|
|
147
166
|
additionalProperties: {
|
|
148
|
-
additionalProperties: false,
|
|
149
|
-
description: "The key is the base64 genesis hash of the network, and the value contains information about the deployed contract in the network indicated by the key. A key containing the human-readable name of the network MAY be included, but the corresponding genesis hash key MUST also be defined",
|
|
150
167
|
properties: {
|
|
151
168
|
appID: {
|
|
152
169
|
description: "The app ID of the deployed contract in this network",
|
|
@@ -158,12 +175,11 @@ var definitions = {
|
|
|
158
175
|
],
|
|
159
176
|
type: "object"
|
|
160
177
|
},
|
|
161
|
-
description: "Optional object listing the contract instances across different networks",
|
|
178
|
+
description: "Optional object listing the contract instances across different networks. The key is the base64 genesis hash of the network, and the value contains information about the deployed contract in the network indicated by the key. A key containing the human-readable name of the network MAY be included, but the corresponding genesis hash key MUST also be define",
|
|
162
179
|
type: "object"
|
|
163
180
|
},
|
|
164
181
|
scratchVariables: {
|
|
165
182
|
additionalProperties: {
|
|
166
|
-
additionalProperties: false,
|
|
167
183
|
properties: {
|
|
168
184
|
slot: {
|
|
169
185
|
type: "number"
|
|
@@ -174,7 +190,7 @@ var definitions = {
|
|
|
174
190
|
$ref: "#/definitions/ABIType"
|
|
175
191
|
},
|
|
176
192
|
{
|
|
177
|
-
$ref: "#/definitions/
|
|
193
|
+
$ref: "#/definitions/AVMType"
|
|
178
194
|
},
|
|
179
195
|
{
|
|
180
196
|
$ref: "#/definitions/StructName"
|
|
@@ -192,7 +208,6 @@ var definitions = {
|
|
|
192
208
|
type: "object"
|
|
193
209
|
},
|
|
194
210
|
source: {
|
|
195
|
-
additionalProperties: false,
|
|
196
211
|
description: "The pre-compiled TEAL that may contain template variables. MUST be omitted if included as part of ARC23",
|
|
197
212
|
properties: {
|
|
198
213
|
approval: {
|
|
@@ -211,7 +226,6 @@ var definitions = {
|
|
|
211
226
|
type: "object"
|
|
212
227
|
},
|
|
213
228
|
sourceInfo: {
|
|
214
|
-
additionalProperties: false,
|
|
215
229
|
description: "Information about the TEAL programs",
|
|
216
230
|
properties: {
|
|
217
231
|
approval: {
|
|
@@ -236,10 +250,8 @@ var definitions = {
|
|
|
236
250
|
type: "object"
|
|
237
251
|
},
|
|
238
252
|
state: {
|
|
239
|
-
additionalProperties: false,
|
|
240
253
|
properties: {
|
|
241
254
|
keys: {
|
|
242
|
-
additionalProperties: false,
|
|
243
255
|
description: "Mapping of human-readable names to StorageKey objects",
|
|
244
256
|
properties: {
|
|
245
257
|
box: {
|
|
@@ -269,7 +281,6 @@ var definitions = {
|
|
|
269
281
|
type: "object"
|
|
270
282
|
},
|
|
271
283
|
maps: {
|
|
272
|
-
additionalProperties: false,
|
|
273
284
|
description: "Mapping of human-readable names to StorageMap objects",
|
|
274
285
|
properties: {
|
|
275
286
|
box: {
|
|
@@ -299,11 +310,9 @@ var definitions = {
|
|
|
299
310
|
type: "object"
|
|
300
311
|
},
|
|
301
312
|
schema: {
|
|
302
|
-
additionalProperties: false,
|
|
303
313
|
description: "Defines the values that should be used for GlobalNumUint, GlobalNumByteSlice, LocalNumUint, and LocalNumByteSlice when creating the application",
|
|
304
314
|
properties: {
|
|
305
315
|
global: {
|
|
306
|
-
additionalProperties: false,
|
|
307
316
|
properties: {
|
|
308
317
|
bytes: {
|
|
309
318
|
type: "number"
|
|
@@ -319,7 +328,6 @@ var definitions = {
|
|
|
319
328
|
type: "object"
|
|
320
329
|
},
|
|
321
330
|
local: {
|
|
322
|
-
additionalProperties: false,
|
|
323
331
|
properties: {
|
|
324
332
|
bytes: {
|
|
325
333
|
type: "number"
|
|
@@ -351,14 +359,16 @@ var definitions = {
|
|
|
351
359
|
},
|
|
352
360
|
structs: {
|
|
353
361
|
additionalProperties: {
|
|
354
|
-
|
|
362
|
+
items: {
|
|
363
|
+
$ref: "#/definitions/StructField"
|
|
364
|
+
},
|
|
365
|
+
type: "array"
|
|
355
366
|
},
|
|
356
|
-
description: "Named structs use by the application",
|
|
367
|
+
description: "Named structs use by the application. Each struct field appears in the same order as ABI encoding.",
|
|
357
368
|
type: "object"
|
|
358
369
|
},
|
|
359
370
|
templateVariables: {
|
|
360
371
|
additionalProperties: {
|
|
361
|
-
additionalProperties: false,
|
|
362
372
|
properties: {
|
|
363
373
|
type: {
|
|
364
374
|
anyOf: [
|
|
@@ -366,7 +376,7 @@ var definitions = {
|
|
|
366
376
|
$ref: "#/definitions/ABIType"
|
|
367
377
|
},
|
|
368
378
|
{
|
|
369
|
-
$ref: "#/definitions/
|
|
379
|
+
$ref: "#/definitions/AVMType"
|
|
370
380
|
},
|
|
371
381
|
{
|
|
372
382
|
$ref: "#/definitions/StructName"
|
|
@@ -399,13 +409,11 @@ var definitions = {
|
|
|
399
409
|
type: "object"
|
|
400
410
|
},
|
|
401
411
|
Event: {
|
|
402
|
-
additionalProperties: false,
|
|
403
412
|
description: "ARC-28 event",
|
|
404
413
|
properties: {
|
|
405
414
|
args: {
|
|
406
415
|
description: "The arguments of the event, in order",
|
|
407
416
|
items: {
|
|
408
|
-
additionalProperties: false,
|
|
409
417
|
properties: {
|
|
410
418
|
desc: {
|
|
411
419
|
description: "Optional, user-friendly description for the argument",
|
|
@@ -421,7 +429,7 @@ var definitions = {
|
|
|
421
429
|
},
|
|
422
430
|
type: {
|
|
423
431
|
$ref: "#/definitions/ABIType",
|
|
424
|
-
description: "The type of the argument"
|
|
432
|
+
description: "The type of the argument. The `struct` field should also be checked to determine if this return value is a struct."
|
|
425
433
|
}
|
|
426
434
|
},
|
|
427
435
|
required: [
|
|
@@ -447,11 +455,9 @@ var definitions = {
|
|
|
447
455
|
type: "object"
|
|
448
456
|
},
|
|
449
457
|
Method: {
|
|
450
|
-
additionalProperties: false,
|
|
451
458
|
description: "Describes a method in the contract. This interface is an extension of the interface described in ARC-4",
|
|
452
459
|
properties: {
|
|
453
460
|
actions: {
|
|
454
|
-
additionalProperties: false,
|
|
455
461
|
description: "an action is a combination of call/create and an OnComplete",
|
|
456
462
|
properties: {
|
|
457
463
|
call: {
|
|
@@ -491,11 +497,45 @@ var definitions = {
|
|
|
491
497
|
args: {
|
|
492
498
|
description: "The arguments of the method, in order",
|
|
493
499
|
items: {
|
|
494
|
-
additionalProperties: false,
|
|
495
500
|
properties: {
|
|
496
501
|
defaultValue: {
|
|
497
|
-
description: "The default value that clients should use.
|
|
498
|
-
|
|
502
|
+
description: "The default value that clients should use.",
|
|
503
|
+
properties: {
|
|
504
|
+
data: {
|
|
505
|
+
description: "Base64 encoded bytes or uint64",
|
|
506
|
+
type: [
|
|
507
|
+
"string",
|
|
508
|
+
"number"
|
|
509
|
+
]
|
|
510
|
+
},
|
|
511
|
+
source: {
|
|
512
|
+
description: "Where the default value is coming from\n- box: The data key signifies the box key to read the value from\n- global: The data key signifies the global state key to read the value from\n- local: The data key signifies the local state key to read the value from (for the sender)\n- literal: the value is a literal and should be passed directly as the argument",
|
|
513
|
+
"enum": [
|
|
514
|
+
"box",
|
|
515
|
+
"global",
|
|
516
|
+
"local",
|
|
517
|
+
"literal"
|
|
518
|
+
],
|
|
519
|
+
type: "string"
|
|
520
|
+
},
|
|
521
|
+
type: {
|
|
522
|
+
anyOf: [
|
|
523
|
+
{
|
|
524
|
+
$ref: "#/definitions/ABIType"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
$ref: "#/definitions/AVMType"
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
description: "How the data is encoded. This is the encoding for the data provided here, not the arg type"
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
required: [
|
|
534
|
+
"data",
|
|
535
|
+
"type",
|
|
536
|
+
"source"
|
|
537
|
+
],
|
|
538
|
+
type: "object"
|
|
499
539
|
},
|
|
500
540
|
desc: {
|
|
501
541
|
description: "Optional, user-friendly description for the argument",
|
|
@@ -511,7 +551,7 @@ var definitions = {
|
|
|
511
551
|
},
|
|
512
552
|
type: {
|
|
513
553
|
$ref: "#/definitions/ABIType",
|
|
514
|
-
description: "The type of the argument"
|
|
554
|
+
description: "The type of the argument. The `struct` field should also be checked to determine if this arg is a struct."
|
|
515
555
|
}
|
|
516
556
|
},
|
|
517
557
|
required: [
|
|
@@ -541,7 +581,6 @@ var definitions = {
|
|
|
541
581
|
type: "boolean"
|
|
542
582
|
},
|
|
543
583
|
recommendations: {
|
|
544
|
-
additionalProperties: false,
|
|
545
584
|
description: "Information that clients can use when calling the method",
|
|
546
585
|
properties: {
|
|
547
586
|
accounts: {
|
|
@@ -566,7 +605,6 @@ var definitions = {
|
|
|
566
605
|
type: "array"
|
|
567
606
|
},
|
|
568
607
|
boxes: {
|
|
569
|
-
additionalProperties: false,
|
|
570
608
|
description: "Recommended box references to include",
|
|
571
609
|
properties: {
|
|
572
610
|
app: {
|
|
@@ -601,7 +639,6 @@ var definitions = {
|
|
|
601
639
|
type: "object"
|
|
602
640
|
},
|
|
603
641
|
returns: {
|
|
604
|
-
additionalProperties: false,
|
|
605
642
|
description: "Information about the method's return value",
|
|
606
643
|
properties: {
|
|
607
644
|
desc: {
|
|
@@ -614,7 +651,7 @@ var definitions = {
|
|
|
614
651
|
},
|
|
615
652
|
type: {
|
|
616
653
|
$ref: "#/definitions/ABIType",
|
|
617
|
-
description: "The type of the return value, or \"void\" to indicate no return value."
|
|
654
|
+
description: "The type of the return value, or \"void\" to indicate no return value. The `struct` field should also be checked to determine if this return value is a struct."
|
|
618
655
|
}
|
|
619
656
|
},
|
|
620
657
|
required: [
|
|
@@ -632,7 +669,6 @@ var definitions = {
|
|
|
632
669
|
type: "object"
|
|
633
670
|
},
|
|
634
671
|
SourceInfo: {
|
|
635
|
-
additionalProperties: true,
|
|
636
672
|
properties: {
|
|
637
673
|
disassembledTeal: {
|
|
638
674
|
description: "The line of the dissasembled TEAL this line of pre-compiled TEAL corresponds to",
|
|
@@ -657,7 +693,6 @@ var definitions = {
|
|
|
657
693
|
type: "object"
|
|
658
694
|
},
|
|
659
695
|
StorageKey: {
|
|
660
|
-
additionalProperties: false,
|
|
661
696
|
description: "Describes a single key in app storage",
|
|
662
697
|
properties: {
|
|
663
698
|
desc: {
|
|
@@ -674,7 +709,7 @@ var definitions = {
|
|
|
674
709
|
$ref: "#/definitions/ABIType"
|
|
675
710
|
},
|
|
676
711
|
{
|
|
677
|
-
$ref: "#/definitions/
|
|
712
|
+
$ref: "#/definitions/AVMType"
|
|
678
713
|
},
|
|
679
714
|
{
|
|
680
715
|
$ref: "#/definitions/StructName"
|
|
@@ -688,7 +723,7 @@ var definitions = {
|
|
|
688
723
|
$ref: "#/definitions/ABIType"
|
|
689
724
|
},
|
|
690
725
|
{
|
|
691
|
-
$ref: "#/definitions/
|
|
726
|
+
$ref: "#/definitions/AVMType"
|
|
692
727
|
},
|
|
693
728
|
{
|
|
694
729
|
$ref: "#/definitions/StructName"
|
|
@@ -705,7 +740,6 @@ var definitions = {
|
|
|
705
740
|
type: "object"
|
|
706
741
|
},
|
|
707
742
|
StorageMap: {
|
|
708
|
-
additionalProperties: false,
|
|
709
743
|
description: "Describes a mapping of key-value pairs in storage",
|
|
710
744
|
properties: {
|
|
711
745
|
desc: {
|
|
@@ -718,7 +752,7 @@ var definitions = {
|
|
|
718
752
|
$ref: "#/definitions/ABIType"
|
|
719
753
|
},
|
|
720
754
|
{
|
|
721
|
-
$ref: "#/definitions/
|
|
755
|
+
$ref: "#/definitions/AVMType"
|
|
722
756
|
},
|
|
723
757
|
{
|
|
724
758
|
$ref: "#/definitions/StructName"
|
|
@@ -736,7 +770,7 @@ var definitions = {
|
|
|
736
770
|
$ref: "#/definitions/ABIType"
|
|
737
771
|
},
|
|
738
772
|
{
|
|
739
|
-
$ref: "#/definitions/
|
|
773
|
+
$ref: "#/definitions/AVMType"
|
|
740
774
|
},
|
|
741
775
|
{
|
|
742
776
|
$ref: "#/definitions/StructName"
|
|
@@ -751,18 +785,35 @@ var definitions = {
|
|
|
751
785
|
],
|
|
752
786
|
type: "object"
|
|
753
787
|
},
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
788
|
+
StructField: {
|
|
789
|
+
description: "Information about a single field in a struct",
|
|
790
|
+
properties: {
|
|
791
|
+
name: {
|
|
792
|
+
description: "The name of the struct field",
|
|
793
|
+
type: "string"
|
|
794
|
+
},
|
|
795
|
+
type: {
|
|
796
|
+
anyOf: [
|
|
797
|
+
{
|
|
798
|
+
$ref: "#/definitions/ABIType"
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
$ref: "#/definitions/StructName"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
items: {
|
|
805
|
+
$ref: "#/definitions/StructField"
|
|
806
|
+
},
|
|
807
|
+
type: "array"
|
|
808
|
+
}
|
|
809
|
+
],
|
|
810
|
+
description: "The type of the struct field's value"
|
|
811
|
+
}
|
|
764
812
|
},
|
|
765
|
-
|
|
813
|
+
required: [
|
|
814
|
+
"name",
|
|
815
|
+
"type"
|
|
816
|
+
],
|
|
766
817
|
type: "object"
|
|
767
818
|
},
|
|
768
819
|
StructName: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc56.schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arc56.schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/schema/load.js
CHANGED
|
@@ -11,7 +11,13 @@ async function loadApplicationJson(appJsonPath) {
|
|
|
11
11
|
const fs = await import('fs');
|
|
12
12
|
if (!fs.existsSync(appJsonPath))
|
|
13
13
|
boom.boom(`Could not find application.json file at ${appJsonPath}`);
|
|
14
|
-
|
|
14
|
+
let jsonText = fs.readFileSync(appJsonPath, 'utf-8');
|
|
15
|
+
let file = JSON.parse(jsonText);
|
|
16
|
+
// Temporary to get backwards compatibility with TEALScript draft ARC-56
|
|
17
|
+
if (!('contract' in file) /* ARC-56 */) {
|
|
18
|
+
jsonText = jsonText.replace(/ype":\s*"bytes"/g, 'ype":"AVMBytes"').replace(/import\(.+?\)\./g, '');
|
|
19
|
+
file = JSON.parse(jsonText);
|
|
20
|
+
}
|
|
15
21
|
return validateApplicationJson(file, appJsonPath);
|
|
16
22
|
}
|
|
17
23
|
function validateApplicationJson(json, appJsonPath) {
|
package/schema/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n
|
|
1
|
+
{"version":3,"file":"load.js","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n let jsonText = fs.readFileSync(appJsonPath, 'utf-8')\n let file = JSON.parse(jsonText)\n // Temporary to get backwards compatibility with TEALScript draft ARC-56\n if (!('contract' in file) /* ARC-56 */) {\n jsonText = jsonText.replace(/ype\":\\s*\"bytes\"/g, 'ype\":\"AVMBytes\"').replace(/import\\(.+?\\)\\./g, '')\n file = JSON.parse(jsonText)\n }\n\n return validateApplicationJson(file, appJsonPath)\n}\n\nexport function validateApplicationJson(json: unknown, appJsonPath: string): Arc56Contract {\n if (typeof json !== 'object') boom(`Could not parse ${appJsonPath} as JSON object`)\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n if ('contract' in (json as any)) {\n // ARC-32\n const arc32Validator = new Validator()\n arc32Validator.addSchema(contractSchema, '/contract.schema.json')\n const arc32Result = arc32Validator.validate(json, arc32Schema as unknown as Schema)\n if (!arc32Result.valid) boom(`Could not parse ${appJsonPath} as ARC-32.\\n${arc32Result}`)\n return arc32ToArc56(json as AppSpec)\n }\n // ARC-56\n const arc56Validator = new Validator()\n const arc56Result = arc56Validator.validate(json, arc56Schema as unknown as Schema)\n if (!arc56Result.valid) boom(`Could not parse ${appJsonPath} as ARC-56.\\n${arc56Result}`)\n return json as Arc56Contract\n}\n"],"names":["boom","Validator","contractSchema","arc32Schema","arc32ToArc56","arc56Schema"],"mappings":";;;;;;;;;AAQO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC,CAAA;AAC7B,IAAA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,QAAAA,SAAI,CAAC,CAAA,wCAAA,EAA2C,WAAW,CAAA,CAAE,CAAC,CAAA;IAE/F,IAAI,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IACpD,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;;IAE/B,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC,e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@@ -9,7 +9,13 @@ async function loadApplicationJson(appJsonPath) {
|
|
|
9
9
|
const fs = await import('fs');
|
|
10
10
|
if (!fs.existsSync(appJsonPath))
|
|
11
11
|
boom(`Could not find application.json file at ${appJsonPath}`);
|
|
12
|
-
|
|
12
|
+
let jsonText = fs.readFileSync(appJsonPath, 'utf-8');
|
|
13
|
+
let file = JSON.parse(jsonText);
|
|
14
|
+
// Temporary to get backwards compatibility with TEALScript draft ARC-56
|
|
15
|
+
if (!('contract' in file) /* ARC-56 */) {
|
|
16
|
+
jsonText = jsonText.replace(/ype":\s*"bytes"/g, 'ype":"AVMBytes"').replace(/import\(.+?\)\./g, '');
|
|
17
|
+
file = JSON.parse(jsonText);
|
|
18
|
+
}
|
|
13
19
|
return validateApplicationJson(file, appJsonPath);
|
|
14
20
|
}
|
|
15
21
|
function validateApplicationJson(json, appJsonPath) {
|
package/schema/load.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.mjs","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n
|
|
1
|
+
{"version":3,"file":"load.mjs","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n let jsonText = fs.readFileSync(appJsonPath, 'utf-8')\n let file = JSON.parse(jsonText)\n // Temporary to get backwards compatibility with TEALScript draft ARC-56\n if (!('contract' in file) /* ARC-56 */) {\n jsonText = jsonText.replace(/ype\":\\s*\"bytes\"/g, 'ype\":\"AVMBytes\"').replace(/import\\(.+?\\)\\./g, '')\n file = JSON.parse(jsonText)\n }\n\n return validateApplicationJson(file, appJsonPath)\n}\n\nexport function validateApplicationJson(json: unknown, appJsonPath: string): Arc56Contract {\n if (typeof json !== 'object') boom(`Could not parse ${appJsonPath} as JSON object`)\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n if ('contract' in (json as any)) {\n // ARC-32\n const arc32Validator = new Validator()\n arc32Validator.addSchema(contractSchema, '/contract.schema.json')\n const arc32Result = arc32Validator.validate(json, arc32Schema as unknown as Schema)\n if (!arc32Result.valid) boom(`Could not parse ${appJsonPath} as ARC-32.\\n${arc32Result}`)\n return arc32ToArc56(json as AppSpec)\n }\n // ARC-56\n const arc56Validator = new Validator()\n const arc56Result = arc56Validator.validate(json, arc56Schema as unknown as Schema)\n if (!arc56Result.valid) boom(`Could not parse ${appJsonPath} as ARC-56.\\n${arc56Result}`)\n return json as Arc56Contract\n}\n"],"names":[],"mappings":";;;;;;;AAQO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC,CAAA;AAC7B,IAAA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,QAAA,IAAI,CAAC,CAAA,wCAAA,EAA2C,WAAW,CAAA,CAAE,CAAC,CAAA;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