@algorandfoundation/algokit-client-generator 1.0.1-beta.2

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.
Files changed (93) hide show
  1. package/README.md +1 -0
  2. package/bin/cli.js +3 -0
  3. package/cli.d.ts +2 -0
  4. package/cli.d.ts.map +1 -0
  5. package/cli.js +82 -0
  6. package/cli.js.map +1 -0
  7. package/client/app-types.d.ts +4 -0
  8. package/client/app-types.d.ts.map +1 -0
  9. package/client/app-types.js +135 -0
  10. package/client/app-types.js.map +1 -0
  11. package/client/call-client.d.ts +4 -0
  12. package/client/call-client.d.ts.map +1 -0
  13. package/client/call-client.js +278 -0
  14. package/client/call-client.js.map +1 -0
  15. package/client/call-factory.d.ts +4 -0
  16. package/client/call-factory.d.ts.map +1 -0
  17. package/client/call-factory.js +71 -0
  18. package/client/call-factory.js.map +1 -0
  19. package/client/deploy-types.d.ts +10 -0
  20. package/client/deploy-types.d.ts.map +1 -0
  21. package/client/deploy-types.js +79 -0
  22. package/client/deploy-types.js.map +1 -0
  23. package/client/generate.d.ts +4 -0
  24. package/client/generate.d.ts.map +1 -0
  25. package/client/generate.js +35 -0
  26. package/client/generate.js.map +1 -0
  27. package/client/generator-context.d.ts +15 -0
  28. package/client/generator-context.d.ts.map +1 -0
  29. package/client/generator-context.js +41 -0
  30. package/client/generator-context.js.map +1 -0
  31. package/client/helpers/extract-method-name-from-signature.d.ts +7 -0
  32. package/client/helpers/extract-method-name-from-signature.d.ts.map +1 -0
  33. package/client/helpers/extract-method-name-from-signature.js +13 -0
  34. package/client/helpers/extract-method-name-from-signature.js.map +1 -0
  35. package/client/helpers/get-call-config-summary.d.ts +15 -0
  36. package/client/helpers/get-call-config-summary.d.ts.map +1 -0
  37. package/client/helpers/get-call-config-summary.js +75 -0
  38. package/client/helpers/get-call-config-summary.js.map +1 -0
  39. package/client/helpers/get-create-methods.d.ts +3 -0
  40. package/client/helpers/get-create-methods.d.ts.map +1 -0
  41. package/client/helpers/get-create-methods.js +8 -0
  42. package/client/helpers/get-create-methods.js.map +1 -0
  43. package/client/helpers/get-equivalent-type.d.ts +2 -0
  44. package/client/helpers/get-equivalent-type.d.ts.map +1 -0
  45. package/client/helpers/get-equivalent-type.js +59 -0
  46. package/client/helpers/get-equivalent-type.js.map +1 -0
  47. package/client/imports.d.ts +3 -0
  48. package/client/imports.d.ts.map +1 -0
  49. package/client/imports.js +27 -0
  50. package/client/imports.js.map +1 -0
  51. package/client/return-types.d.ts +4 -0
  52. package/client/return-types.d.ts.map +1 -0
  53. package/client/return-types.js +48 -0
  54. package/client/return-types.js.map +1 -0
  55. package/client/utility-types.d.ts +10 -0
  56. package/client/utility-types.d.ts.map +1 -0
  57. package/client/utility-types.js +27 -0
  58. package/client/utility-types.js.map +1 -0
  59. package/index.d.ts +2 -0
  60. package/index.d.ts.map +1 -0
  61. package/index.js +5 -0
  62. package/index.js.map +1 -0
  63. package/output/writer.d.ts +22 -0
  64. package/output/writer.d.ts.map +1 -0
  65. package/output/writer.js +123 -0
  66. package/output/writer.js.map +1 -0
  67. package/package.json +24 -0
  68. package/schema/application.schema.json +255 -0
  69. package/schema/contract.schema.json +85 -0
  70. package/schema/load.d.ts +3 -0
  71. package/schema/load.d.ts.map +1 -0
  72. package/schema/load.js +47 -0
  73. package/schema/load.js.map +1 -0
  74. package/tests/approval-tests.spec.d.ts +2 -0
  75. package/tests/approval-tests.spec.d.ts.map +1 -0
  76. package/tests/approval-tests.spec.js +24 -0
  77. package/tests/approval-tests.spec.js.map +1 -0
  78. package/util/boom.d.ts +2 -0
  79. package/util/boom.d.ts.map +1 -0
  80. package/util/boom.js +8 -0
  81. package/util/boom.js.map +1 -0
  82. package/util/color-console.d.ts +7 -0
  83. package/util/color-console.d.ts.map +1 -0
  84. package/util/color-console.js +20 -0
  85. package/util/color-console.js.map +1 -0
  86. package/util/not-falsy.d.ts +2 -0
  87. package/util/not-falsy.d.ts.map +1 -0
  88. package/util/not-falsy.js +6 -0
  89. package/util/not-falsy.js.map +1 -0
  90. package/util/sanitization.d.ts +6 -0
  91. package/util/sanitization.d.ts.map +1 -0
  92. package/util/sanitization.js +17 -0
  93. package/util/sanitization.js.map +1 -0
@@ -0,0 +1,10 @@
1
+ import { DocumentParts } from '../output/writer';
2
+ export declare function utilityTypes(): DocumentParts;
3
+ export declare const OnCompleteCodeMap: {
4
+ no_op: string;
5
+ opt_in: string;
6
+ close_out: string;
7
+ delete_application: string;
8
+ update_application: string;
9
+ };
10
+ //# sourceMappingURL=utility-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility-types.d.ts","sourceRoot":"","sources":["../../src/client/utility-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAa,MAAM,kBAAkB,CAAA;AAEtE,wBAAiB,YAAY,IAAI,aAAa,CAe7C;AAED,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAA"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OnCompleteCodeMap = exports.utilityTypes = void 0;
4
+ const writer_1 = require("../output/writer");
5
+ function* utilityTypes() {
6
+ yield 'export type CallRequest<TSignature extends string, TArgs = undefined> = {';
7
+ yield writer_1.IncIndent;
8
+ yield 'method: TSignature';
9
+ yield 'methodArgs: TArgs';
10
+ yield writer_1.DecIndent;
11
+ yield '} & AppClientCallCoreParams & CoreAppCallArgs';
12
+ yield `export type BareCallArgs = Omit<RawAppCallArgs, keyof CoreAppCallArgs>`;
13
+ yield `export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC }`;
14
+ yield `export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC }`;
15
+ yield `export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC }`;
16
+ yield `export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC }`;
17
+ yield `export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC }`;
18
+ }
19
+ exports.utilityTypes = utilityTypes;
20
+ exports.OnCompleteCodeMap = {
21
+ no_op: 'OnCompleteNoOp',
22
+ opt_in: 'OnCompleteOptIn',
23
+ close_out: 'OnCompleteCloseOut',
24
+ delete_application: 'OnCompleteDelApp',
25
+ update_application: 'OnCompleteUpdApp',
26
+ };
27
+ //# sourceMappingURL=utility-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility-types.js","sourceRoot":"","sources":["../../src/client/utility-types.ts"],"names":[],"mappings":";;;AAAA,6CAAsE;AAEtE,QAAe,CAAC,CAAC,YAAY;IAC3B,MAAM,2EAA2E,CAAA;IACjF,MAAM,kBAAS,CAAA;IACf,MAAM,oBAAoB,CAAA;IAC1B,MAAM,mBAAmB,CAAA;IACzB,MAAM,kBAAS,CAAA;IACf,MAAM,+CAA+C,CAAA;IAErD,MAAM,wEAAwE,CAAA;IAE9E,MAAM,6FAA6F,CAAA;IACnG,MAAM,+FAA+F,CAAA;IACrG,MAAM,wGAAwG,CAAA;IAC9G,MAAM,wHAAwH,CAAA;IAC9H,MAAM,wHAAwH,CAAA;AAChI,CAAC;AAfD,oCAeC;AAEY,QAAA,iBAAiB,GAAG;IAC/B,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,oBAAoB;IAC/B,kBAAkB,EAAE,kBAAkB;IACtC,kBAAkB,EAAE,kBAAkB;CACvC,CAAA"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_1 = require("./cli");
4
+ (0, cli_1.cli)(process.cwd(), process.argv);
5
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,+BAA2B;AAC3B,IAAA,SAAG,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import type fs from 'fs';
3
+ export declare const IncIndent: unique symbol;
4
+ export declare const DecIndent: unique symbol;
5
+ export declare const DecIndentAndCloseBlock: unique symbol;
6
+ export declare const NewLineMode: unique symbol;
7
+ export declare const RestoreLineMode: unique symbol;
8
+ export declare const PropertyDelimiter: unique symbol;
9
+ export declare const InlineMode: unique symbol;
10
+ export declare const NewLine: unique symbol;
11
+ export type Part = string | typeof IncIndent | typeof DecIndent | typeof NewLineMode | typeof DecIndentAndCloseBlock | typeof InlineMode | typeof NewLine | typeof RestoreLineMode | typeof PropertyDelimiter;
12
+ export type DocumentParts = Generator<Part, void>;
13
+ export type WriteOptions = {
14
+ indent?: string;
15
+ disableEslint?: boolean;
16
+ header?: string;
17
+ };
18
+ export declare function writeDocumentPartsToStream(document: DocumentParts, stream: fs.WriteStream, options?: WriteOptions): void;
19
+ export declare function writeDocumentPartsToString(document: DocumentParts, options?: WriteOptions): string;
20
+ export declare function inline(...parts: Array<Part | DocumentParts>): Generator<Part, void, unknown>;
21
+ export declare function indent(...parts: Array<Part | DocumentParts>): Generator<Part, void, unknown>;
22
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/output/writer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB,eAAO,MAAM,SAAS,eAA4B,CAAA;AAClD,eAAO,MAAM,SAAS,eAA4B,CAAA;AAClD,eAAO,MAAM,sBAAsB,eAAsD,CAAA;AACzF,eAAO,MAAM,WAAW,eAA0B,CAAA;AAClD,eAAO,MAAM,eAAe,eAA8B,CAAA;AAC1D,eAAO,MAAM,iBAAiB,eAA+B,CAAA;AAC7D,eAAO,MAAM,UAAU,eAAwB,CAAA;AAC/C,eAAO,MAAM,OAAO,eAAqB,CAAA;AAEzC,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,OAAO,SAAS,GAChB,OAAO,SAAS,GAChB,OAAO,WAAW,GAClB,OAAO,sBAAsB,GAC7B,OAAO,UAAU,GACjB,OAAO,OAAO,GACd,OAAO,eAAe,GACtB,OAAO,iBAAiB,CAAA;AAC5B,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAOD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,GAAE,YAAiB,QAYrH;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,GAAE,YAAiB,UAiB7F;AAED,wBAAiB,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,kCAO5D;AAED,wBAAiB,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,kCAO5D"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.indent = exports.inline = exports.writeDocumentPartsToString = exports.writeDocumentPartsToStream = exports.NewLine = exports.InlineMode = exports.PropertyDelimiter = exports.RestoreLineMode = exports.NewLineMode = exports.DecIndentAndCloseBlock = exports.DecIndent = exports.IncIndent = void 0;
4
+ exports.IncIndent = Symbol('Increase Indent');
5
+ exports.DecIndent = Symbol('Decrease Indent');
6
+ exports.DecIndentAndCloseBlock = Symbol('Decrease Indent and write a closing brace');
7
+ exports.NewLineMode = Symbol('New Line Mode');
8
+ exports.RestoreLineMode = Symbol('Restore Line Mode');
9
+ exports.PropertyDelimiter = Symbol('Property Delimiter');
10
+ exports.InlineMode = Symbol('Inline Mode');
11
+ exports.NewLine = Symbol('New Line');
12
+ function writeDocumentPartsToStream(document, stream, options = {}) {
13
+ const writer = {
14
+ _last: '',
15
+ write(val) {
16
+ this._last = val;
17
+ stream.write(val);
18
+ },
19
+ get last() {
20
+ return this._last;
21
+ },
22
+ };
23
+ writeDocumentPartsTo(document, options, writer);
24
+ }
25
+ exports.writeDocumentPartsToStream = writeDocumentPartsToStream;
26
+ function writeDocumentPartsToString(document, options = {}) {
27
+ const writer = {
28
+ result: [],
29
+ _last: '',
30
+ write(val) {
31
+ this._last = val;
32
+ this.result.push(val);
33
+ },
34
+ get last() {
35
+ return this._last;
36
+ },
37
+ toString() {
38
+ return this.result.join('');
39
+ },
40
+ };
41
+ writeDocumentPartsTo(document, options, writer);
42
+ return writer.toString();
43
+ }
44
+ exports.writeDocumentPartsToString = writeDocumentPartsToString;
45
+ function* inline(...parts) {
46
+ yield exports.InlineMode;
47
+ for (const part of parts) {
48
+ if (typeof part === 'string' || typeof part === 'symbol')
49
+ yield part;
50
+ else
51
+ yield* part;
52
+ }
53
+ yield exports.RestoreLineMode;
54
+ }
55
+ exports.inline = inline;
56
+ function* indent(...parts) {
57
+ yield exports.IncIndent;
58
+ for (const part of parts) {
59
+ if (typeof part === 'string' || typeof part === 'symbol')
60
+ yield part;
61
+ else
62
+ yield* part;
63
+ }
64
+ yield exports.DecIndent;
65
+ }
66
+ exports.indent = indent;
67
+ function writeDocumentPartsTo(document, { indent = ' ', ...options }, writer) {
68
+ if (options.header)
69
+ writer.write(`${options.header}\n`);
70
+ if (options.disableEslint)
71
+ writer.write('/* eslint-disable */\n');
72
+ const lineModes = [exports.NewLineMode];
73
+ const currentLineMode = () => { var _a; return (_a = lineModes.at(-1)) !== null && _a !== void 0 ? _a : exports.NewLineMode; };
74
+ let curIndent = '';
75
+ for (const part of document) {
76
+ switch (part) {
77
+ case exports.IncIndent:
78
+ curIndent += indent;
79
+ break;
80
+ case exports.DecIndent:
81
+ curIndent = curIndent.slice(0, -indent.length);
82
+ break;
83
+ case exports.DecIndentAndCloseBlock:
84
+ curIndent = curIndent.slice(0, -indent.length);
85
+ writer.write(`${curIndent}}\n`);
86
+ break;
87
+ case exports.NewLineMode:
88
+ lineModes.push(exports.NewLineMode);
89
+ if (writer.last.slice(-1)[0] !== '\n') {
90
+ writer.write('\n');
91
+ }
92
+ break;
93
+ case exports.InlineMode:
94
+ lineModes.push(exports.InlineMode);
95
+ break;
96
+ case exports.RestoreLineMode:
97
+ lineModes.pop();
98
+ if (currentLineMode() === exports.NewLineMode && writer.last.slice(-1)[0] !== '\n') {
99
+ writer.write('\n');
100
+ }
101
+ break;
102
+ case exports.PropertyDelimiter:
103
+ if (currentLineMode() === exports.NewLineMode) {
104
+ writer.write('\n');
105
+ }
106
+ else {
107
+ writer.write(', ');
108
+ }
109
+ break;
110
+ case exports.NewLine:
111
+ writer.write('\n');
112
+ break;
113
+ default:
114
+ if (writer.last.slice(-1)[0] === '\n')
115
+ writer.write(curIndent);
116
+ writer.write(part);
117
+ if (currentLineMode() === exports.NewLineMode)
118
+ writer.write('\n');
119
+ break;
120
+ }
121
+ }
122
+ }
123
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/output/writer.ts"],"names":[],"mappings":";;;AAEa,QAAA,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;AACrC,QAAA,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;AACrC,QAAA,sBAAsB,GAAG,MAAM,CAAC,2CAA2C,CAAC,CAAA;AA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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;oBAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;gBAC9D,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBAClB,IAAI,eAAe,EAAE,KAAK,mBAAW;oBAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACzD,MAAK;SACR;KACF;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "main": "index.js",
3
+ "types": "index.d.ts",
4
+ "name": "@algorandfoundation/algokit-client-generator",
5
+ "version": "1.0.1-beta.2",
6
+ "description": "Generates a TypeScript client for interacting with, and deploying ARC-0032 smart contracts on the Algorand Blockchain.",
7
+ "private": false,
8
+ "bin": {
9
+ "@algorandfoundation/algokit-client-generator": "bin/cli.js",
10
+ "algokitgen": "bin/cli.js"
11
+ },
12
+ "author": "Algorand Foundation",
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "@algorandfoundation/algokit-utils": "^2.0.0-beta.9",
16
+ "chalk": "^4.1.2",
17
+ "change-case": "^4.1.2",
18
+ "commander": "^10.0.1",
19
+ "jsonschema": "^1.4.1"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }
@@ -0,0 +1,255 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "AlgoAppSpec",
4
+ "type": "object",
5
+ "required": ["contract", "schema", "source", "state"],
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "hints": {
9
+ "type": "object",
10
+ "additionalProperties": {
11
+ "$ref": "#/definitions/Hint"
12
+ }
13
+ },
14
+ "source": {
15
+ "$ref": "#/definitions/AppSources"
16
+ },
17
+ "contract": {
18
+ "$ref": "contract.schema.json"
19
+ },
20
+ "schema": {
21
+ "$ref": "#/definitions/SchemaSpec"
22
+ },
23
+ "state": {
24
+ "$ref": "#/definitions/StateSchemaSpec"
25
+ },
26
+ "bare_call_config": {
27
+ "$ref": "#/definitions/CallConfig"
28
+ }
29
+ },
30
+ "definitions": {
31
+ "AVMType": {
32
+ "enum": ["uint64", "bytes"]
33
+ },
34
+ "DeclaredSchemaValueSpec": {
35
+ "type": "object",
36
+ "required": ["type", "key"],
37
+ "additionalProperties": false,
38
+ "properties": {
39
+ "type": {
40
+ "description": "The type of the value",
41
+ "$ref": "#/definitions/AVMType"
42
+ },
43
+ "key": {
44
+ "description": "The name of the key",
45
+ "type": "string"
46
+ },
47
+ "descr": {
48
+ "description": "A description of the variable",
49
+ "type": "string"
50
+ },
51
+ "static": {
52
+ "description": "Whether the value is set statically (at create time only) or dynamically",
53
+ "type": "boolean"
54
+ }
55
+ }
56
+ },
57
+ "ReservedSchemaValueSpec": {
58
+ "type": "object",
59
+ "required": ["type"],
60
+ "properties": {
61
+ "type": {
62
+ "description": "The type of the value",
63
+ "$ref": "#/definitions/AVMType"
64
+ },
65
+ "descr": {
66
+ "description": "A description of the variable",
67
+ "type": "string"
68
+ },
69
+ "max_keys": {
70
+ "description": "The maximum number of slots to reserve",
71
+ "type": "integer"
72
+ }
73
+ }
74
+ },
75
+ "StateSchemaSpec": {
76
+ "type": "object",
77
+ "additionalProperties": false,
78
+ "required": ["global", "local"],
79
+ "properties": {
80
+ "global": {
81
+ "$ref": "#/definitions/StateSchema"
82
+ },
83
+ "local": {
84
+ "$ref": "#/definitions/StateSchema"
85
+ }
86
+ }
87
+ },
88
+ "StateSchema": {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": ["num_byte_slices", "num_uints"],
92
+ "properties": {
93
+ "num_uints": {
94
+ "type": "integer"
95
+ },
96
+ "num_byte_slices": {
97
+ "type": "integer"
98
+ }
99
+ }
100
+ },
101
+ "SchemaSpec": {
102
+ "description": "The schema for global and local storage",
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "properties": {
106
+ "global": {
107
+ "$ref": "#/definitions/Schema"
108
+ },
109
+ "local": {
110
+ "$ref": "#/definitions/Schema"
111
+ }
112
+ }
113
+ },
114
+ "Schema": {
115
+ "type": "object",
116
+ "additionalProperties": false,
117
+ "properties": {
118
+ "declared": {
119
+ "type": "object",
120
+ "additionalProperties": {
121
+ "$ref": "#/definitions/DeclaredSchemaValueSpec"
122
+ }
123
+ },
124
+ "reserved": {
125
+ "type": "object",
126
+ "additionalProperties": {
127
+ "$ref": "#/definitions/ReservedSchemaValueSpec"
128
+ }
129
+ }
130
+ }
131
+ },
132
+ "AppSources": {
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "properties": {
136
+ "approval": {
137
+ "type": "string"
138
+ },
139
+ "clear": {
140
+ "type": "string"
141
+ }
142
+ }
143
+ },
144
+ "Hint": {
145
+ "type": "object",
146
+ "additionalProperties": false,
147
+ "properties": {
148
+ "read_only": {
149
+ "type": "boolean"
150
+ },
151
+ "structs": {
152
+ "type": "object",
153
+ "properties": {
154
+ "output": {
155
+ "$ref": "#/definitions/Struct"
156
+ }
157
+ },
158
+ "additionalProperties": {
159
+ "$ref": "#/definitions/Struct"
160
+ }
161
+ },
162
+ "default_arguments": {
163
+ "additionalProperties": {
164
+ "$ref": "#/definitions/DefaultArgument"
165
+ }
166
+ },
167
+ "call_config": {
168
+ "$ref": "#/definitions/CallConfig"
169
+ }
170
+ }
171
+ },
172
+ "CallConfig": {
173
+ "type": "object",
174
+ "minProperties": 1,
175
+ "additionalProperties": false,
176
+ "properties": {
177
+ "no_op": {
178
+ "$ref": "#/definitions/CallConfigValue"
179
+ },
180
+ "opt_in": {
181
+ "$ref": "#/definitions/CallConfigValue"
182
+ },
183
+ "close_out": {
184
+ "$ref": "#/definitions/CallConfigValue"
185
+ },
186
+ "update_application": {
187
+ "$ref": "#/definitions/CallConfigValue"
188
+ },
189
+ "delete_application": {
190
+ "$ref": "#/definitions/CallConfigValue"
191
+ }
192
+ }
193
+ },
194
+ "CallConfigValue": {
195
+ "enum": ["NEVER", "CALL", "CREATE", "ALL"]
196
+ },
197
+ "Struct": {
198
+ "type": "object",
199
+ "additionalProperties": false,
200
+ "required": ["name", "elements"],
201
+ "properties": {
202
+ "name": {
203
+ "type": "string"
204
+ },
205
+ "elements": {
206
+ "type": "array",
207
+ "items": {
208
+ "$ref": "#/definitions/StructElement"
209
+ }
210
+ }
211
+ }
212
+ },
213
+ "FieldName": {
214
+ "type": "string"
215
+ },
216
+ "ABIType": {
217
+ "type": "string"
218
+ },
219
+ "StructElement": {
220
+ "type": "array",
221
+ "minItems": 2,
222
+ "items": [
223
+ {
224
+ "$ref": "#/definitions/FieldName"
225
+ },
226
+ {
227
+ "$ref": "#/definitions/ABIType"
228
+ }
229
+ ]
230
+ },
231
+ "DefaultArgument": {
232
+ "properties": {
233
+ "source": {
234
+ "$ref": "#/definitions/ArgumentSource"
235
+ },
236
+ "data": {
237
+ "oneOf": [
238
+ {
239
+ "type": "string"
240
+ },
241
+ {
242
+ "type": "number"
243
+ },
244
+ {
245
+ "type": "integer"
246
+ }
247
+ ]
248
+ }
249
+ }
250
+ },
251
+ "ArgumentSource": {
252
+ "enum": ["global-state", "local-state", "abi-method", "constant"]
253
+ }
254
+ }
255
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "AbiContract",
4
+ "type": "object",
5
+ "required": ["name", "methods"],
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "name": {
9
+ "type": "string"
10
+ },
11
+ "methods": {
12
+ "type": "array",
13
+ "items": {
14
+ "$ref": "#/definitions/ContractMethod"
15
+ }
16
+ },
17
+ "networks": {
18
+ "type": "object",
19
+ "additionalProperties": {
20
+ "type": "object",
21
+ "required": ["appID"],
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "appID": {
25
+ "type": "number"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ },
31
+ "definitions": {
32
+ "ContractMethod": {
33
+ "type": "object",
34
+ "additionalProperties": false,
35
+ "required": ["name", "args", "returns"],
36
+ "properties": {
37
+ "name": {
38
+ "type": "string"
39
+ },
40
+ "args": {
41
+ "type": "array",
42
+ "items": {
43
+ "$ref": "#/definitions/ContractMethodArg"
44
+ }
45
+ },
46
+ "desc": {
47
+ "type": "string"
48
+ },
49
+ "returns": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["type"],
53
+ "properties": {
54
+ "desc": {
55
+ "type": "string"
56
+ },
57
+ "type": {
58
+ "$ref": "#/definitions/ABIType"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "ContractMethodArg": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "required": ["name", "type"],
68
+ "properties": {
69
+ "desc": {
70
+ "type": "string"
71
+ },
72
+ "type": {
73
+ "$ref": "#/definitions/ABIType"
74
+ },
75
+ "name": {
76
+ "type": "string"
77
+ }
78
+ }
79
+ },
80
+ "ABIType": {
81
+ "description": "Catch all for fixed length arrays and tuples",
82
+ "type": "string"
83
+ }
84
+ }
85
+ }
@@ -0,0 +1,3 @@
1
+ import { AlgoAppSpec } from './application';
2
+ export declare function load(appJsonPath: string): AlgoAppSpec;
3
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/schema/load.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,wBAAgB,IAAI,CAAC,WAAW,EAAE,MAAM,eAWvC"}
package/schema/load.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.load = void 0;
30
+ const fs = __importStar(require("fs"));
31
+ const jsonschema_1 = require("jsonschema");
32
+ const boom_1 = require("../util/boom");
33
+ const application_schema_json_1 = __importDefault(require("./application.schema.json"));
34
+ const contract_schema_json_1 = __importDefault(require("./contract.schema.json"));
35
+ function load(appJsonPath) {
36
+ if (!fs.existsSync(appJsonPath))
37
+ (0, boom_1.boom)(`Could not find application.json file at ${appJsonPath}`);
38
+ const validator = new jsonschema_1.Validator();
39
+ validator.addSchema(contract_schema_json_1.default, '/contract.schema.json');
40
+ const file = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'));
41
+ const result = validator.validate(file, application_schema_json_1.default);
42
+ if (!result.valid)
43
+ (0, boom_1.boom)(result.toString());
44
+ return file;
45
+ }
46
+ exports.load = load;
47
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/schema/load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA8C;AAC9C,uCAAmC;AAEnC,wFAAqD;AACrD,kFAAmD;AAEnD,SAAgB,IAAI,CAAC,WAAmB;IACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,IAAA,WAAI,EAAC,2CAA2C,WAAW,EAAE,CAAC,CAAA;IAC/F,MAAM,SAAS,GAAG,IAAI,sBAAS,EAAE,CAAA;IACjC,SAAS,CAAC,SAAS,CAAC,8BAAc,EAAE,uBAAuB,CAAC,CAAA;IAE5D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;IAC9D,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,iCAAkC,CAAC,CAAA;IAE3E,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,IAAA,WAAI,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IAE1C,OAAO,IAAmB,CAAA;AAC5B,CAAC;AAXD,oBAWC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=approval-tests.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-tests.spec.d.ts","sourceRoot":"","sources":["../../src/tests/approval-tests.spec.ts"],"names":[],"mappings":""}