@algorandfoundation/algokit-client-generator 3.0.6 → 3.1.0-beta.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.
Files changed (159) hide show
  1. package/README.md +4 -2
  2. package/client/{call-factory.d.ts → app-client.d.ts} +1 -1
  3. package/client/{call-client.d.ts → app-factory.d.ts} +1 -1
  4. package/client/deploy-types.d.ts +8 -4
  5. package/client/generate.d.ts +2 -2
  6. package/client/generator-context.d.ts +4 -4
  7. package/client/helpers/get-call-config-summary.d.ts +8 -3
  8. package/client/helpers/get-equivalent-type.d.ts +6 -1
  9. package/client/params-factory.d.ts +3 -0
  10. package/client/utility-types.d.ts +0 -7
  11. package/package.json +4 -3
  12. package/schema/load.d.ts +3 -3
  13. package/{cli.js → src/cli.js} +1 -1
  14. package/src/cli.js.map +1 -0
  15. package/{cli.mjs → src/cli.mjs} +1 -1
  16. package/src/cli.mjs.map +1 -0
  17. package/src/client/app-client.js +288 -0
  18. package/src/client/app-client.js.map +1 -0
  19. package/src/client/app-client.mjs +286 -0
  20. package/src/client/app-client.mjs.map +1 -0
  21. package/src/client/app-factory.js +238 -0
  22. package/src/client/app-factory.js.map +1 -0
  23. package/src/client/app-factory.mjs +236 -0
  24. package/src/client/app-factory.mjs.map +1 -0
  25. package/src/client/app-types.js +263 -0
  26. package/src/client/app-types.js.map +1 -0
  27. package/src/client/app-types.mjs +261 -0
  28. package/src/client/app-types.mjs.map +1 -0
  29. package/{client → src/client}/call-composer-types.js +23 -53
  30. package/src/client/call-composer-types.js.map +1 -0
  31. package/{client → src/client}/call-composer-types.mjs +23 -34
  32. package/src/client/call-composer-types.mjs.map +1 -0
  33. package/src/client/call-composer.js +135 -0
  34. package/src/client/call-composer.js.map +1 -0
  35. package/src/client/call-composer.mjs +133 -0
  36. package/src/client/call-composer.mjs.map +1 -0
  37. package/src/client/deploy-types.js +115 -0
  38. package/src/client/deploy-types.js.map +1 -0
  39. package/src/client/deploy-types.mjs +111 -0
  40. package/src/client/deploy-types.mjs.map +1 -0
  41. package/{client → src/client}/generate.js +18 -6
  42. package/src/client/generate.js.map +1 -0
  43. package/{client → src/client}/generate.mjs +18 -6
  44. package/src/client/generate.mjs.map +1 -0
  45. package/src/client/generator-context.js +23 -0
  46. package/src/client/generator-context.js.map +1 -0
  47. package/{client → src/client}/generator-context.mjs +5 -5
  48. package/src/client/generator-context.mjs.map +1 -0
  49. package/src/client/helpers/get-call-config-summary.js +60 -0
  50. package/src/client/helpers/get-call-config-summary.js.map +1 -0
  51. package/src/client/helpers/get-call-config-summary.mjs +57 -0
  52. package/src/client/helpers/get-call-config-summary.mjs.map +1 -0
  53. package/{client → src/client}/helpers/get-equivalent-type.js +10 -6
  54. package/src/client/helpers/get-equivalent-type.js.map +1 -0
  55. package/{client → src/client}/helpers/get-equivalent-type.mjs +10 -6
  56. package/src/client/helpers/get-equivalent-type.mjs.map +1 -0
  57. package/src/client/imports.js +25 -0
  58. package/src/client/imports.js.map +1 -0
  59. package/src/client/imports.mjs +23 -0
  60. package/src/client/imports.mjs.map +1 -0
  61. package/src/client/params-factory.js +126 -0
  62. package/src/client/params-factory.js.map +1 -0
  63. package/src/client/params-factory.mjs +124 -0
  64. package/src/client/params-factory.mjs.map +1 -0
  65. package/src/client/utility-types.js +44 -0
  66. package/src/client/utility-types.js.map +1 -0
  67. package/src/client/utility-types.mjs +42 -0
  68. package/src/client/utility-types.mjs.map +1 -0
  69. package/{output → src/output}/writer.js +17 -3
  70. package/src/output/writer.js.map +1 -0
  71. package/{output → src/output}/writer.mjs +17 -3
  72. package/src/output/writer.mjs.map +1 -0
  73. package/{schema → src/schema}/application.schema.json.js +2 -2
  74. package/{schema → src/schema}/application.schema.json.mjs +2 -2
  75. package/src/schema/arc56.schema.json.js +787 -0
  76. package/src/schema/arc56.schema.json.js.map +1 -0
  77. package/src/schema/arc56.schema.json.mjs +780 -0
  78. package/src/schema/arc56.schema.json.mjs.map +1 -0
  79. package/src/schema/load.js +40 -0
  80. package/src/schema/load.js.map +1 -0
  81. package/src/schema/load.mjs +37 -0
  82. package/src/schema/load.mjs.map +1 -0
  83. package/src/util/boom.js.map +1 -0
  84. package/src/util/boom.mjs.map +1 -0
  85. package/src/util/color-console.js.map +1 -0
  86. package/src/util/color-console.mjs.map +1 -0
  87. package/src/util/sanitization.js.map +1 -0
  88. package/src/util/sanitization.mjs.map +1 -0
  89. package/cli.js.map +0 -1
  90. package/cli.mjs.map +0 -1
  91. package/client/app-types.js +0 -165
  92. package/client/app-types.js.map +0 -1
  93. package/client/app-types.mjs +0 -144
  94. package/client/app-types.mjs.map +0 -1
  95. package/client/call-client.js +0 -341
  96. package/client/call-client.js.map +0 -1
  97. package/client/call-client.mjs +0 -320
  98. package/client/call-client.mjs.map +0 -1
  99. package/client/call-composer-types.js.map +0 -1
  100. package/client/call-composer-types.mjs.map +0 -1
  101. package/client/call-composer.js +0 -149
  102. package/client/call-composer.js.map +0 -1
  103. package/client/call-composer.mjs +0 -128
  104. package/client/call-composer.mjs.map +0 -1
  105. package/client/call-factory.js +0 -142
  106. package/client/call-factory.js.map +0 -1
  107. package/client/call-factory.mjs +0 -121
  108. package/client/call-factory.mjs.map +0 -1
  109. package/client/deploy-types.js +0 -97
  110. package/client/deploy-types.js.map +0 -1
  111. package/client/deploy-types.mjs +0 -94
  112. package/client/deploy-types.mjs.map +0 -1
  113. package/client/generate.js.map +0 -1
  114. package/client/generate.mjs.map +0 -1
  115. package/client/generator-context.js +0 -42
  116. package/client/generator-context.js.map +0 -1
  117. package/client/generator-context.mjs.map +0 -1
  118. package/client/helpers/get-call-config-summary.js +0 -58
  119. package/client/helpers/get-call-config-summary.js.map +0 -1
  120. package/client/helpers/get-call-config-summary.mjs +0 -55
  121. package/client/helpers/get-call-config-summary.mjs.map +0 -1
  122. package/client/helpers/get-equivalent-type.js.map +0 -1
  123. package/client/helpers/get-equivalent-type.mjs.map +0 -1
  124. package/client/imports.js +0 -31
  125. package/client/imports.js.map +0 -1
  126. package/client/imports.mjs +0 -29
  127. package/client/imports.mjs.map +0 -1
  128. package/client/utility-types.js +0 -57
  129. package/client/utility-types.js.map +0 -1
  130. package/client/utility-types.mjs +0 -54
  131. package/client/utility-types.mjs.map +0 -1
  132. package/output/writer.js.map +0 -1
  133. package/output/writer.mjs.map +0 -1
  134. package/schema/load.js +0 -26
  135. package/schema/load.js.map +0 -1
  136. package/schema/load.mjs +0 -23
  137. package/schema/load.mjs.map +0 -1
  138. package/util/boom.js.map +0 -1
  139. package/util/boom.mjs.map +0 -1
  140. package/util/color-console.js.map +0 -1
  141. package/util/color-console.mjs.map +0 -1
  142. package/util/sanitization.js.map +0 -1
  143. package/util/sanitization.mjs.map +0 -1
  144. /package/{index.js → src/index.js} +0 -0
  145. /package/{index.js.map → src/index.js.map} +0 -0
  146. /package/{index.mjs → src/index.mjs} +0 -0
  147. /package/{index.mjs.map → src/index.mjs.map} +0 -0
  148. /package/{schema → src/schema}/application.schema.json.js.map +0 -0
  149. /package/{schema → src/schema}/application.schema.json.mjs.map +0 -0
  150. /package/{schema → src/schema}/contract.schema.json.js +0 -0
  151. /package/{schema → src/schema}/contract.schema.json.js.map +0 -0
  152. /package/{schema → src/schema}/contract.schema.json.mjs +0 -0
  153. /package/{schema → src/schema}/contract.schema.json.mjs.map +0 -0
  154. /package/{util → src/util}/boom.js +0 -0
  155. /package/{util → src/util}/boom.mjs +0 -0
  156. /package/{util → src/util}/color-console.js +0 -0
  157. /package/{util → src/util}/color-console.mjs +0 -0
  158. /package/{util → src/util}/sanitization.js +0 -0
  159. /package/{util → src/util}/sanitization.mjs +0 -0
@@ -0,0 +1,261 @@
1
+ import { jsDoc, IncIndent, DecIndentAndCloseBlock, inline, DecIndent, NewLine } from '../output/writer.mjs';
2
+ import { getEquivalentType } from './helpers/get-equivalent-type.mjs';
3
+ import { ABIMethod, ABITupleType } from 'algosdk';
4
+
5
+ function* appTypes(ctx) {
6
+ yield* abiTypes(ctx);
7
+ yield* structTypes(ctx);
8
+ yield* templateVariableTypes(ctx);
9
+ const { app, methodSignatureToUniqueName, name } = ctx;
10
+ yield* jsDoc(`Defines the types of available calls and state of the ${name} smart contract.`);
11
+ yield `export type ${name}Types = {`;
12
+ yield IncIndent;
13
+ yield* jsDoc('Maps method signatures / names to their argument and return types.');
14
+ if (app.methods.length == 0) {
15
+ yield 'methods: {}';
16
+ }
17
+ else {
18
+ yield 'methods:';
19
+ }
20
+ yield IncIndent;
21
+ for (const method of app.methods) {
22
+ const methodSig = new ABIMethod(method).getSignature();
23
+ const methodSigSafe = ctx.sanitizer.makeSafeStringTypeLiteral(methodSig);
24
+ const uniqueName = methodSignatureToUniqueName[methodSig];
25
+ const uniqueNameSafe = ctx.sanitizer.makeSafeStringTypeLiteral(uniqueName);
26
+ yield `& Record<'${methodSigSafe}'${methodSig !== uniqueName ? ` | '${uniqueNameSafe}'` : ''}, {`;
27
+ yield IncIndent;
28
+ yield `argsObj: {`;
29
+ yield IncIndent;
30
+ const argsMeta = method.args.map((arg, i) => ({
31
+ ...arg,
32
+ name: arg.name ?? `arg${i + 1}`,
33
+ hasDefault: !!arg.defaultValue,
34
+ tsType: getEquivalentType(arg.struct ?? arg.type, 'input', ctx),
35
+ }));
36
+ for (const arg of argsMeta) {
37
+ if (arg.desc)
38
+ yield* jsDoc(arg.desc);
39
+ yield `${ctx.sanitizer.makeSafePropertyIdentifier(arg.name)}${arg.hasDefault ? '?' : ''}: ${arg.tsType}`;
40
+ }
41
+ yield DecIndentAndCloseBlock;
42
+ yield* inline(`argsTuple: [`, argsMeta
43
+ .map((arg) => `${ctx.sanitizer.makeSafeVariableIdentifier(arg.name)}: ${arg.tsType}${arg.hasDefault ? ' | undefined' : ''}`)
44
+ .join(', '), ']');
45
+ if (method.returns.desc)
46
+ yield* jsDoc(method.returns.desc);
47
+ yield `returns: ${getEquivalentType(method.returns.struct ?? method.returns.type ?? 'void', 'output', ctx)}`;
48
+ yield DecIndent;
49
+ yield '}>';
50
+ }
51
+ yield DecIndent;
52
+ const hasLocal = (app.state.keys.local && Object.keys(app.state.keys.local).length > 0) ||
53
+ (app.state.maps.local && Object.keys(app.state.maps.local).length > 0);
54
+ const hasGlobal = (app.state.keys.global && Object.keys(app.state.keys.global).length > 0) ||
55
+ (app.state.maps.global && Object.keys(app.state.maps.global).length > 0);
56
+ const hasBox = (app.state.keys.box && Object.keys(app.state.keys.box).length > 0) || (app.state.maps.box && Object.keys(app.state.maps.box).length > 0);
57
+ yield* appState(ctx, { hasBox, hasGlobal, hasLocal });
58
+ yield DecIndentAndCloseBlock;
59
+ yield NewLine;
60
+ yield `
61
+ /**
62
+ * Defines the possible abi call signatures.
63
+ */
64
+ export type ${name}Signatures = keyof ${name}Types['methods']
65
+ /**
66
+ * Defines the possible abi call signatures for methods that return a non-void value.
67
+ */
68
+ export type ${name}NonVoidMethodSignatures = keyof ${name}Types['methods'] extends infer T ? T extends keyof ${name}Types['methods'] ? MethodReturn<T> extends void ? never : T : never : never
69
+ /**
70
+ * Defines an object containing all relevant parameters for a single call to the contract.
71
+ */
72
+ export type CallParams<TSignature extends ${name}Signatures> = Expand<
73
+ Omit<AppClientMethodCallParams, 'method' | 'args' | 'onComplete'> &
74
+ {
75
+ /** The args for the ABI method call, either as an ordered array or an object */
76
+ args: Expand<MethodArgs<TSignature>>
77
+ }
78
+ >
79
+ /**
80
+ * Maps a method signature from the ${name} smart contract to the method's arguments in either tuple or struct form
81
+ */
82
+ export type MethodArgs<TSignature extends ${name}Signatures> = ${name}Types['methods'][TSignature]['argsObj' | 'argsTuple']
83
+ /**
84
+ * Maps a method signature from the ${name} smart contract to the method's return type
85
+ */
86
+ export type MethodReturn<TSignature extends ${name}Signatures> = ${name}Types['methods'][TSignature]['returns']
87
+ `;
88
+ if (hasGlobal) {
89
+ yield `
90
+ /**
91
+ * Defines the shape of the keyed global state of the application.
92
+ */
93
+ export type GlobalKeysState = ${name}Types['state']['global']['keys']
94
+ `;
95
+ }
96
+ if (hasLocal) {
97
+ yield `
98
+ /**
99
+ * Defines the shape of the keyed local state of the application.
100
+ */
101
+ export type LocalKeysState = ${name}Types['state']['local']['keys']
102
+ `;
103
+ }
104
+ if (hasBox) {
105
+ yield `
106
+ /**
107
+ * Defines the shape of the keyed box state of the application.
108
+ */
109
+ export type BoxKeysState = ${name}Types['state']['box']['keys']
110
+ `;
111
+ }
112
+ yield NewLine;
113
+ }
114
+ function* abiTypes(ctx) {
115
+ const { app } = ctx;
116
+ const abiTypes = [];
117
+ const pushType = (type) => {
118
+ // If we already have this type, skip
119
+ if (abiTypes.includes(type))
120
+ return;
121
+ // void and string are the same types in TS
122
+ if (['void', 'string'].includes(type))
123
+ return;
124
+ // Skip structs
125
+ if (app.structs[type])
126
+ return;
127
+ // If this is an array type, push the base type
128
+ if (type.match(/\[\d*\]$/)) {
129
+ pushType(type.replace(/\[\d*\]$/, ''));
130
+ return;
131
+ }
132
+ if (type.startsWith('(')) {
133
+ const tupleType = ABITupleType.from(type);
134
+ tupleType.childTypes.forEach((t) => {
135
+ pushType(t.toString());
136
+ });
137
+ return;
138
+ }
139
+ abiTypes.push(type);
140
+ };
141
+ Object.values(app.templateVariables ?? {}).forEach((t) => {
142
+ pushType(t.type);
143
+ });
144
+ app.methods.forEach((m) => {
145
+ m.args.forEach((a) => {
146
+ pushType(a.type);
147
+ });
148
+ pushType(m.returns.type);
149
+ });
150
+ ['global', 'local', 'box'].forEach((storageType) => {
151
+ Object.values(app.state.keys[storageType]).forEach((k) => {
152
+ pushType(k.keyType);
153
+ pushType(k.valueType);
154
+ });
155
+ Object.values(app.state.maps[storageType]).forEach((m) => {
156
+ pushType(m.keyType);
157
+ pushType(m.valueType);
158
+ });
159
+ });
160
+ const pushStructFields = (fields) => {
161
+ Object.values(fields).forEach((sf) => {
162
+ if (typeof sf === 'string')
163
+ pushType(sf);
164
+ else
165
+ pushStructFields(sf);
166
+ });
167
+ };
168
+ Object.values(app.structs).forEach((sf) => {
169
+ pushStructFields(sf);
170
+ });
171
+ yield '// Aliases for non-encoded ABI values';
172
+ yield NewLine;
173
+ for (const t of abiTypes) {
174
+ yield `type ${t} = ${getEquivalentType(t, 'output', ctx)};`;
175
+ }
176
+ yield NewLine;
177
+ }
178
+ function* structTypes({ app, sanitizer }) {
179
+ if (Object.keys(app.structs).length === 0)
180
+ return;
181
+ yield '// Type definitions for ARC-56 structs';
182
+ yield NewLine;
183
+ for (const structName of Object.keys(app.structs)) {
184
+ yield `export type ${sanitizer.makeSafeTypeIdentifier(structName)} = ${JSON.stringify(app.structs[structName], null, 2)
185
+ .replace(/"/g, '')
186
+ .replaceAll('(', '[')
187
+ .replaceAll(')', ']')
188
+ .replace(/\[\d+\]/g, '[]')}`;
189
+ }
190
+ yield NewLine;
191
+ }
192
+ function* templateVariableTypes({ app }) {
193
+ if (Object.keys(app.templateVariables ?? {}).length === 0) {
194
+ return;
195
+ }
196
+ yield* jsDoc('Deploy-time template variables');
197
+ yield 'export type TemplateVariables = {';
198
+ yield IncIndent;
199
+ for (const name of Object.keys(app.templateVariables ?? {})) {
200
+ yield `${name}: ${app.templateVariables[name].type},`;
201
+ }
202
+ yield DecIndentAndCloseBlock;
203
+ }
204
+ function* keysAndMaps(app, sanitizer, keys, maps) {
205
+ if (keys && Object.keys(keys).length) {
206
+ yield 'keys: {';
207
+ yield IncIndent;
208
+ for (const name of Object.keys(keys)) {
209
+ const prop = keys[name];
210
+ if (prop.desc) {
211
+ yield* jsDoc(prop.desc);
212
+ }
213
+ const keySafe = sanitizer.makeSafePropertyIdentifier(name);
214
+ yield `${keySafe}: ${prop.valueType === 'bytes' ? 'BinaryState' : getEquivalentType(prop.valueType, 'output', { app, sanitizer })}`;
215
+ }
216
+ yield DecIndentAndCloseBlock;
217
+ }
218
+ if (maps && Object.keys(maps).length) {
219
+ yield 'maps: {';
220
+ yield IncIndent;
221
+ for (const name of Object.keys(maps)) {
222
+ const prop = maps[name];
223
+ if (prop.desc) {
224
+ yield* jsDoc(prop.desc);
225
+ }
226
+ const keySafe = sanitizer.makeSafePropertyIdentifier(name);
227
+ yield `${keySafe}: Map<${getEquivalentType(prop.keyType, 'input', { app, sanitizer })}, ${getEquivalentType(prop.valueType, 'output', { app, sanitizer })}>`;
228
+ }
229
+ yield DecIndentAndCloseBlock;
230
+ }
231
+ }
232
+ function* appState({ app, sanitizer }, stateFlags) {
233
+ const { hasBox, hasGlobal, hasLocal } = stateFlags;
234
+ if (hasLocal || hasGlobal) {
235
+ yield* jsDoc('Defines the shape of the state of the application.');
236
+ yield 'state: {';
237
+ yield IncIndent;
238
+ if (hasGlobal) {
239
+ yield 'global: {';
240
+ yield IncIndent;
241
+ yield* keysAndMaps(app, sanitizer, app.state.keys.global, app.state.maps.global);
242
+ yield DecIndentAndCloseBlock;
243
+ }
244
+ if (hasLocal) {
245
+ yield 'local: {';
246
+ yield IncIndent;
247
+ yield* keysAndMaps(app, sanitizer, app.state.keys.local, app.state.maps.local);
248
+ yield DecIndentAndCloseBlock;
249
+ }
250
+ if (hasBox) {
251
+ yield 'box: {';
252
+ yield IncIndent;
253
+ yield* keysAndMaps(app, sanitizer, app.state.keys.box, app.state.maps.box);
254
+ yield DecIndentAndCloseBlock;
255
+ }
256
+ yield DecIndentAndCloseBlock;
257
+ }
258
+ }
259
+
260
+ export { appTypes };
261
+ //# sourceMappingURL=app-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-types.mjs","sources":["../../../src/client/app-types.ts"],"sourcesContent":["import { GeneratorContext } from './generator-context'\nimport { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, inline, jsDoc, NewLine } from '../output/writer'\nimport { getEquivalentType } from './helpers/get-equivalent-type'\nimport { ABIMethod, ABITupleType } from 'algosdk'\nimport { Arc56Contract, StorageKey, StorageMap, StructFields } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { Sanitizer } from '../util/sanitization'\n\nexport function* appTypes(ctx: GeneratorContext): DocumentParts {\n yield* abiTypes(ctx)\n yield* structTypes(ctx)\n yield* templateVariableTypes(ctx)\n\n const { app, methodSignatureToUniqueName, name } = ctx\n yield* jsDoc(`Defines the types of available calls and state of the ${name} smart contract.`)\n yield `export type ${name}Types = {`\n yield IncIndent\n yield* jsDoc('Maps method signatures / names to their argument and return types.')\n if (app.methods.length == 0) {\n yield 'methods: {}'\n } else {\n yield 'methods:'\n }\n yield IncIndent\n for (const method of app.methods) {\n const methodSig = new ABIMethod(method).getSignature()\n const methodSigSafe = ctx.sanitizer.makeSafeStringTypeLiteral(methodSig)\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const uniqueNameSafe = ctx.sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `& Record<'${methodSigSafe}'${methodSig !== uniqueName ? ` | '${uniqueNameSafe}'` : ''}, {`\n yield IncIndent\n yield `argsObj: {`\n yield IncIndent\n\n const argsMeta = method.args.map((arg, i) => ({\n ...arg,\n name: arg.name ?? `arg${i + 1}`,\n hasDefault: !!arg.defaultValue,\n tsType: getEquivalentType(arg.struct ?? arg.type, 'input', ctx),\n }))\n\n for (const arg of argsMeta) {\n if (arg.desc) yield* jsDoc(arg.desc)\n yield `${ctx.sanitizer.makeSafePropertyIdentifier(arg.name)}${arg.hasDefault ? '?' : ''}: ${arg.tsType}`\n }\n yield DecIndentAndCloseBlock\n yield* inline(\n `argsTuple: [`,\n argsMeta\n .map((arg) => `${ctx.sanitizer.makeSafeVariableIdentifier(arg.name)}: ${arg.tsType}${arg.hasDefault ? ' | undefined' : ''}`)\n .join(', '),\n ']',\n )\n if (method.returns.desc) yield* jsDoc(method.returns.desc)\n yield `returns: ${getEquivalentType(method.returns.struct ?? method.returns.type ?? 'void', 'output', ctx)}`\n\n yield DecIndent\n yield '}>'\n }\n yield DecIndent\n\n const hasLocal =\n (app.state.keys.local && Object.keys(app.state.keys.local).length > 0) ||\n (app.state.maps.local && Object.keys(app.state.maps.local).length > 0)\n const hasGlobal =\n (app.state.keys.global && Object.keys(app.state.keys.global).length > 0) ||\n (app.state.maps.global && Object.keys(app.state.maps.global).length > 0)\n const hasBox =\n (app.state.keys.box && Object.keys(app.state.keys.box).length > 0) || (app.state.maps.box && Object.keys(app.state.maps.box).length > 0)\n yield* appState(ctx, { hasBox, hasGlobal, hasLocal })\n\n yield DecIndentAndCloseBlock\n yield NewLine\n\n yield `\n /**\n * Defines the possible abi call signatures.\n */\n export type ${name}Signatures = keyof ${name}Types['methods']\n /**\n * Defines the possible abi call signatures for methods that return a non-void value.\n */\n export type ${name}NonVoidMethodSignatures = keyof ${name}Types['methods'] extends infer T ? T extends keyof ${name}Types['methods'] ? MethodReturn<T> extends void ? never : T : never : never\n /**\n * Defines an object containing all relevant parameters for a single call to the contract.\n */\n export type CallParams<TSignature extends ${name}Signatures> = Expand<\n Omit<AppClientMethodCallParams, 'method' | 'args' | 'onComplete'> &\n {\n /** The args for the ABI method call, either as an ordered array or an object */\n args: Expand<MethodArgs<TSignature>>\n }\n >\n /**\n * Maps a method signature from the ${name} smart contract to the method's arguments in either tuple or struct form\n */\n export type MethodArgs<TSignature extends ${name}Signatures> = ${name}Types['methods'][TSignature]['argsObj' | 'argsTuple']\n /**\n * Maps a method signature from the ${name} smart contract to the method's return type\n */\n export type MethodReturn<TSignature extends ${name}Signatures> = ${name}Types['methods'][TSignature]['returns']\n `\n\n if (hasGlobal) {\n yield `\n /**\n * Defines the shape of the keyed global state of the application.\n */\n export type GlobalKeysState = ${name}Types['state']['global']['keys']\n `\n }\n\n if (hasLocal) {\n yield `\n /**\n * Defines the shape of the keyed local state of the application.\n */\n export type LocalKeysState = ${name}Types['state']['local']['keys']\n `\n }\n\n if (hasBox) {\n yield `\n /**\n * Defines the shape of the keyed box state of the application.\n */\n export type BoxKeysState = ${name}Types['state']['box']['keys']\n `\n }\n\n yield NewLine\n}\n\nfunction* abiTypes(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n const abiTypes: string[] = []\n\n const pushType = (type: string) => {\n // If we already have this type, skip\n if (abiTypes.includes(type)) return\n\n // void and string are the same types in TS\n if (['void', 'string'].includes(type)) return\n\n // Skip structs\n if (app.structs[type]) return\n\n // If this is an array type, push the base type\n if (type.match(/\\[\\d*\\]$/)) {\n pushType(type.replace(/\\[\\d*\\]$/, ''))\n return\n }\n\n if (type.startsWith('(')) {\n const tupleType = ABITupleType.from(type) as ABITupleType\n\n tupleType.childTypes.forEach((t) => {\n pushType(t.toString())\n })\n\n return\n }\n\n abiTypes.push(type)\n }\n\n Object.values(app.templateVariables ?? {}).forEach((t) => {\n pushType(t.type)\n })\n\n app.methods.forEach((m) => {\n m.args.forEach((a) => {\n pushType(a.type)\n })\n\n pushType(m.returns.type)\n })\n ;(['global', 'local', 'box'] as ['global', 'local', 'box']).forEach((storageType) => {\n Object.values(app.state.keys[storageType]).forEach((k) => {\n pushType(k.keyType)\n pushType(k.valueType)\n })\n\n Object.values(app.state.maps[storageType]).forEach((m) => {\n pushType(m.keyType)\n pushType(m.valueType)\n })\n })\n\n const pushStructFields = (fields: StructFields) => {\n Object.values(fields).forEach((sf) => {\n if (typeof sf === 'string') pushType(sf)\n else pushStructFields(sf)\n })\n }\n\n Object.values(app.structs).forEach((sf) => {\n pushStructFields(sf)\n })\n\n yield '// Aliases for non-encoded ABI values'\n yield NewLine\n for (const t of abiTypes) {\n yield `type ${t} = ${getEquivalentType(t, 'output', ctx)};`\n }\n yield NewLine\n}\n\nfunction* structTypes({ app, sanitizer }: GeneratorContext): DocumentParts {\n if (Object.keys(app.structs).length === 0) return\n\n yield '// Type definitions for ARC-56 structs'\n yield NewLine\n\n for (const structName of Object.keys(app.structs)) {\n yield `export type ${sanitizer.makeSafeTypeIdentifier(structName)} = ${JSON.stringify(app.structs[structName], null, 2)\n .replace(/\"/g, '')\n .replaceAll('(', '[')\n .replaceAll(')', ']')\n .replace(/\\[\\d+\\]/g, '[]')}`\n }\n\n yield NewLine\n}\n\nfunction* templateVariableTypes({ app }: GeneratorContext): DocumentParts {\n if (Object.keys(app.templateVariables ?? {}).length === 0) {\n return\n }\n\n yield* jsDoc('Deploy-time template variables')\n yield 'export type TemplateVariables = {'\n yield IncIndent\n\n for (const name of Object.keys(app.templateVariables ?? {})) {\n yield `${name}: ${app.templateVariables![name].type},`\n }\n\n yield DecIndentAndCloseBlock\n}\n\nfunction* keysAndMaps(\n app: Arc56Contract,\n sanitizer: Sanitizer,\n keys: {\n [name: string]: StorageKey\n },\n maps: {\n [name: string]: StorageMap\n },\n): DocumentParts {\n if (keys && Object.keys(keys).length) {\n yield 'keys: {'\n yield IncIndent\n for (const name of Object.keys(keys)) {\n const prop = keys[name]\n if (prop.desc) {\n yield* jsDoc(prop.desc)\n }\n const keySafe = sanitizer.makeSafePropertyIdentifier(name)\n\n yield `${keySafe}: ${prop.valueType === 'bytes' ? 'BinaryState' : getEquivalentType(prop.valueType, 'output', { app, sanitizer })}`\n }\n yield DecIndentAndCloseBlock\n }\n\n if (maps && Object.keys(maps).length) {\n yield 'maps: {'\n yield IncIndent\n for (const name of Object.keys(maps)) {\n const prop = maps[name]\n if (prop.desc) {\n yield* jsDoc(prop.desc)\n }\n const keySafe = sanitizer.makeSafePropertyIdentifier(name)\n\n yield `${keySafe}: Map<${getEquivalentType(prop.keyType, 'input', { app, sanitizer })}, ${getEquivalentType(prop.valueType, 'output', { app, sanitizer })}>`\n }\n yield DecIndentAndCloseBlock\n }\n}\n\nfunction* appState(\n { app, sanitizer }: GeneratorContext,\n stateFlags: { hasLocal: boolean; hasGlobal: boolean; hasBox: boolean },\n): DocumentParts {\n const { hasBox, hasGlobal, hasLocal } = stateFlags\n\n if (hasLocal || hasGlobal) {\n yield* jsDoc('Defines the shape of the state of the application.')\n yield 'state: {'\n yield IncIndent\n if (hasGlobal) {\n yield 'global: {'\n yield IncIndent\n yield* keysAndMaps(app, sanitizer, app.state.keys.global, app.state.maps.global)\n yield DecIndentAndCloseBlock\n }\n if (hasLocal) {\n yield 'local: {'\n yield IncIndent\n yield* keysAndMaps(app, sanitizer, app.state.keys.local, app.state.maps.local)\n yield DecIndentAndCloseBlock\n }\n if (hasBox) {\n yield 'box: {'\n yield IncIndent\n yield* keysAndMaps(app, sanitizer, app.state.keys.box, app.state.maps.box)\n yield DecIndentAndCloseBlock\n }\n yield DecIndentAndCloseBlock\n }\n}\n"],"names":[],"mappings":";;;;AAOe,UAAE,QAAQ,CAAC,GAAqB,EAAA;AAC7C,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;AACpB,IAAA,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;AACvB,IAAA,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAA;IAEjC,MAAM,EAAE,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IACtD,OAAO,KAAK,CAAC,yDAAyD,IAAI,CAAA,gBAAA,CAAkB,CAAC,CAAA;IAC7F,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,SAAA,CAAW,CAAA;AACpC,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,OAAO,KAAK,CAAC,oEAAoE,CAAC,CAAA;IAClF,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;AAC3B,QAAA,MAAM,aAAa,CAAA;KACpB;SAAM;AACL,QAAA,MAAM,UAAU,CAAA;KACjB;AACD,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE;QAChC,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;QACtD,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAA;AACxE,QAAA,MAAM,UAAU,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAA;QACzD,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAA;AAC1E,QAAA,MAAM,aAAa,aAAa,CAAA,CAAA,EAAI,SAAS,KAAK,UAAU,GAAG,CAAA,IAAA,EAAO,c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AAA,MAAM,sBAAsB,CAAA;SAC7B;QACD,IAAI,MAAM,EAAE;AACV,YAAA,MAAM,QAAQ,CAAA;AACd,YAAA,MAAM,SAAS,CAAA;YACf,OAAO,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1E,YAAA,MAAM,sBAAsB,CAAA;SAC7B;AACD,QAAA,MAAM,sBAAsB,CAAA;KAC7B;AACH;;;;"}
@@ -1,97 +1,67 @@
1
1
  'use strict';
2
2
 
3
3
  var writer = require('../output/writer.js');
4
- var algokit = require('@algorandfoundation/algokit-utils');
5
4
  var getCallConfigSummary = require('./helpers/get-call-config-summary.js');
6
5
  var deployTypes = require('./deploy-types.js');
7
-
8
- function _interopNamespaceDefault(e) {
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var algokit__namespace = /*#__PURE__*/_interopNamespaceDefault(algokit);
6
+ var algosdk = require('algosdk');
26
7
 
27
8
  function* callComposerType(ctx) {
28
9
  const { name, callConfig, app } = ctx;
29
10
  yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`;
30
11
  yield writer.IncIndent;
31
12
  yield* callComposerTypeNoops(ctx);
32
- yield* callComposerOperationMethodType(ctx, `Updates an existing instance of the ${app.contract.name} smart contract`, callConfig.updateMethods, 'update', true);
33
- yield* callComposerOperationMethodType(ctx, `Deletes an existing instance of the ${app.contract.name} smart contract`, callConfig.deleteMethods, 'delete');
34
- yield* callComposerOperationMethodType(ctx, `Opts the user into an existing instance of the ${app.contract.name} smart contract`, callConfig.optInMethods, 'optIn');
35
- yield* callComposerOperationMethodType(ctx, `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`, callConfig.closeOutMethods, 'closeOut');
13
+ yield* callComposerOperationMethodType(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'delete');
14
+ yield* callComposerOperationMethodType(ctx, `Opts the user into an existing instance of the ${app.name} smart contract`, callConfig.optInMethods, 'optIn');
15
+ yield* callComposerOperationMethodType(ctx, `Makes a close out call to an existing instance of the ${app.name} smart contract`, callConfig.closeOutMethods, 'closeOut');
36
16
  yield* callComposerTypeClearState(ctx);
37
17
  yield* writer.jsDoc({
38
18
  description: 'Adds a transaction to the composer',
39
19
  params: {
40
- txn: 'One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter)',
41
- defaultSender: 'The default sender to be used to obtain a signer where the object provided to the transaction parameter does not' +
42
- ' include a signer.',
20
+ txn: 'A transaction to add to the transaction group',
21
+ signer: 'The optional signer to use when signing this transaction.',
43
22
  },
44
23
  });
45
- yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom): ${name}Composer<TReturns>`;
24
+ yield `addTransaction(txn: Transaction, signer?: TransactionSigner): ${name}Composer<TReturns>`;
46
25
  yield* writer.jsDoc({
47
26
  description: 'Returns the underlying AtomicTransactionComposer instance',
48
27
  });
49
- yield `atc(): Promise<AtomicTransactionComposer>`;
28
+ yield `composer(): AlgoKitComposer`;
50
29
  yield* writer.jsDoc({
51
30
  description: 'Simulates the transaction group and returns the result',
52
31
  });
53
- yield `simulate(options?: SimulateOptions): Promise<${name}ComposerSimulateResult<TReturns>>`;
32
+ yield `simulate(options?: SimulateOptions): Promise<${name}ComposerResults<TReturns> & { simulateResponse: SimulateResponse }>`;
54
33
  yield* writer.jsDoc({
55
34
  description: 'Executes the transaction group and returns the results',
56
35
  });
57
- yield `execute(sendParams?: AppClientComposeExecuteParams): Promise<${name}ComposerResults<TReturns>>`;
58
- yield writer.DecIndentAndCloseBlock;
59
- yield `export type SimulateOptions = Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>`;
60
- yield `export type ${name}ComposerSimulateResult<TReturns extends [...any[]]> = {`;
61
- yield writer.IncIndent;
62
- yield `returns: TReturns`;
63
- yield `methodResults: ABIResult[]`;
64
- yield `simulateResponse: modelsv2.SimulateResponse`;
65
- yield writer.DecIndentAndCloseBlock;
66
- yield `export type ${name}ComposerResults<TReturns extends [...any[]]> = {`;
67
- yield writer.IncIndent;
68
- yield `returns: TReturns`;
69
- yield `groupId: string`;
70
- yield `txIds: string[]`;
71
- yield `transactions: Transaction[]`;
36
+ yield `execute(params?: ExecuteParams): Promise<${name}ComposerResults<TReturns>>`;
72
37
  yield writer.DecIndentAndCloseBlock;
38
+ yield `
39
+ export type ${name}ComposerResults<TReturns extends [...any[]]> = Expand<SendAtomicTransactionComposerResults & {
40
+ returns: TReturns
41
+ }>
42
+ `;
73
43
  }
74
44
  function* callComposerTypeClearState({ app, name }) {
75
45
  yield* writer.jsDoc({
76
- description: `Makes a clear_state call to an existing instance of the ${app.contract.name} smart contract.`,
46
+ description: `Makes a clear_state call to an existing instance of the ${app.name} smart contract.`,
77
47
  params: {
78
48
  args: `The arguments for the bare call`,
79
49
  },
80
50
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
81
51
  });
82
- yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`;
52
+ yield `clearState(params?: AppClientBareCallParams): ${name}Composer<[...TReturns, undefined]>`;
83
53
  yield writer.NewLine;
84
54
  }
85
55
  function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
86
- for (const method of app.contract.methods) {
87
- const methodSignature = algokit__namespace.getABIMethodSignature(method);
56
+ for (const method of app.methods) {
57
+ const methodSignature = new algosdk.ABIMethod(method).getSignature();
88
58
  const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
89
59
  const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
90
60
  // Skip methods which don't support a no_op call config
91
61
  if (!callConfig.callMethods.includes(methodSignature))
92
62
  continue;
93
63
  yield* writer.jsDoc({
94
- description: `Calls the ${algokit__namespace.getABIMethodSignature(method)} ABI method.`,
64
+ description: `Calls the ${new algosdk.ABIMethod(method).getSignature()} ABI method.`,
95
65
  abiDescription: method.desc,
96
66
  params: {
97
67
  args: `The arguments for the contract call`,
@@ -99,7 +69,7 @@ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUnique
99
69
  },
100
70
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
101
71
  });
102
- yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`;
72
+ yield `${methodName}(params?: CallParams<'${methodSignatureSafe}'>): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'> | undefined]>`;
103
73
  yield writer.NewLine;
104
74
  }
105
75
  }
@@ -118,7 +88,7 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
118
88
  },
119
89
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
120
90
  });
121
- yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, undefined]>`;
91
+ yield `bare(params${onComplete?.isOptional !== false ? '?' : ''}: AppClientBareCallParams ${''}): ${name}Composer<[...TReturns, undefined]>`;
122
92
  }
123
93
  else {
124
94
  const uniqueName = methodSignatureToUniqueName[methodSig];
@@ -131,7 +101,7 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
131
101
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
132
102
  });
133
103
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
134
- yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`;
104
+ yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(params${onComplete?.isOptional !== false ? '?' : ''}: CallParams<'${methodSigSafe}'>${''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'> | undefined]>`;
135
105
  }
136
106
  }
137
107
  yield writer.DecIndentAndCloseBlock;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer-types.js","sources":["../../../src/client/call-composer-types.ts"],"sourcesContent":["import { DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\n\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { ABIMethod } from 'algosdk'\n\nexport function* callComposerType(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig, app } = ctx\n yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`\n yield IncIndent\n\n yield* callComposerTypeNoops(ctx)\n yield* callComposerOperationMethodType(\n ctx,\n `Deletes an existing instance of the ${app.name} smart contract`,\n callConfig.deleteMethods,\n 'delete',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Opts the user into an existing instance of the ${app.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Makes a close out call to an existing instance of the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n\n yield* callComposerTypeClearState(ctx)\n\n yield* jsDoc({\n description: 'Adds a transaction to the composer',\n params: {\n txn: 'A transaction to add to the transaction group',\n signer: 'The optional signer to use when signing this transaction.',\n },\n })\n yield `addTransaction(txn: Transaction, signer?: TransactionSigner): ${name}Composer<TReturns>`\n\n yield* jsDoc({\n description: 'Returns the underlying AtomicTransactionComposer instance',\n })\n yield `composer(): AlgoKitComposer`\n\n yield* jsDoc({\n description: 'Simulates the transaction group and returns the result',\n })\n yield `simulate(options?: SimulateOptions): Promise<${name}ComposerResults<TReturns> & { simulateResponse: SimulateResponse }>`\n\n yield* jsDoc({\n description: 'Executes the transaction group and returns the results',\n })\n yield `execute(params?: ExecuteParams): Promise<${name}ComposerResults<TReturns>>`\n\n yield DecIndentAndCloseBlock\n\n yield `\n export type ${name}ComposerResults<TReturns extends [...any[]]> = Expand<SendAtomicTransactionComposerResults & {\n returns: TReturns\n }>\n `\n}\n\nfunction* callComposerTypeClearState({ app, name }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: `Makes a clear_state call to an existing instance of the ${app.name} smart contract.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `clearState(params?: AppClientBareCallParams): ${name}Composer<[...TReturns, undefined]>`\n yield NewLine\n}\n\nfunction* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.methods) {\n const methodSignature = new ABIMethod(method).getSignature()\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\n yield* jsDoc({\n description: `Calls the ${new ABIMethod(method).getSignature()} ABI method.`,\n abiDescription: method.desc,\n params: {\n args: `The arguments for the contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `${methodName}(params?: CallParams<'${methodSignatureSafe}'>): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'> | undefined]>`\n yield NewLine\n }\n}\n\nfunction* callComposerOperationMethodType(\n { app, methodSignatureToUniqueName, name, sanitizer }: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `readonly ${verb}: {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield* jsDoc({\n description: `${description} using a bare call.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `bare(params${onComplete?.isOptional !== false ? '?' : ''}: AppClientBareCallParams ${\n includeCompilation ? '& AppClientCompilationParams' : ''\n }): ${name}Composer<[...TReturns, undefined]>`\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n params: {\n args: `The arguments for the smart contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(params${\n onComplete?.isOptional !== false ? '?' : ''\n }: CallParams<'${methodSigSafe}'>${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'> | undefined]>`\n }\n }\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n"],"names":["IncIndent","jsDoc","DecIndentAndCloseBlock","NewLine","ABIMethod","getCreateOnCompleteOptions","BARE_CALL"],"mappings":";;;;;;;AAOe,UAAE,gBAAgB,CAAC,GAAqB,EAAA;IACrD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;IACrC,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,8CAAA,CAAgD,CAAA;AACzE,IAAA,MAAMA,gBAAS,CAAA;AAEf,IAAA,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAA;AACjC,IAAA,OAAO,+BAA+B,CACpC,GAAG,EACH,uCAAuC,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,EAChE,UAAU,CAAC,aAAa,EACxB,QAAQ,CACT,CAAA;AACD,IAAA,OAAO,+BAA+B,CACpC,GAAG,EACH,kDAAkD,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,EAC3E,UAAU,CAAC,YAAY,EACvB,OAAO,CACR,CAAA;AACD,IAAA,OAAO,+BAA+B,CACpC,GAAG,EACH,yDAAyD,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,EAClF,UAAU,CAAC,eAAe,EAC1B,UAAU,CACX,CAAA;AAED,IAAA,OAAO,0BAA0B,CAAC,GAAG,CAAC,CAAA;IAEtC,OAAOC,YAAK,CAAC;AACX,QAAA,WAAW,EAAE,oCAAoC;AACjD,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,+CAA+C;AACpD,YAAA,MAAM,EAAE,2DAA2D;AACpE,SAAA;AACF,KAAA,CAAC,CAAA;IACF,MAAM,CAAA,8DAAA,EAAiE,IAAI,CAAA,kBAAA,CAAoB,CAAA;IAE/F,OAAOA,YAAK,CAAC;AACX,QAAA,WAAW,EAAE,2DAA2D;AACzE,KAAA,CAAC,CAA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AA,MAAMC,cAAO,CAAA;KACd;AACH;;;;"}
@@ -1,76 +1,65 @@
1
1
  import { IncIndent, jsDoc, DecIndentAndCloseBlock, NewLine } from '../output/writer.mjs';
2
- import * as algokit from '@algorandfoundation/algokit-utils';
3
2
  import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
4
3
  import { getCreateOnCompleteOptions } from './deploy-types.mjs';
4
+ import { ABIMethod } from 'algosdk';
5
5
 
6
6
  function* callComposerType(ctx) {
7
7
  const { name, callConfig, app } = ctx;
8
8
  yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`;
9
9
  yield IncIndent;
10
10
  yield* callComposerTypeNoops(ctx);
11
- yield* callComposerOperationMethodType(ctx, `Updates an existing instance of the ${app.contract.name} smart contract`, callConfig.updateMethods, 'update', true);
12
- yield* callComposerOperationMethodType(ctx, `Deletes an existing instance of the ${app.contract.name} smart contract`, callConfig.deleteMethods, 'delete');
13
- yield* callComposerOperationMethodType(ctx, `Opts the user into an existing instance of the ${app.contract.name} smart contract`, callConfig.optInMethods, 'optIn');
14
- yield* callComposerOperationMethodType(ctx, `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`, callConfig.closeOutMethods, 'closeOut');
11
+ yield* callComposerOperationMethodType(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'delete');
12
+ yield* callComposerOperationMethodType(ctx, `Opts the user into an existing instance of the ${app.name} smart contract`, callConfig.optInMethods, 'optIn');
13
+ yield* callComposerOperationMethodType(ctx, `Makes a close out call to an existing instance of the ${app.name} smart contract`, callConfig.closeOutMethods, 'closeOut');
15
14
  yield* callComposerTypeClearState(ctx);
16
15
  yield* jsDoc({
17
16
  description: 'Adds a transaction to the composer',
18
17
  params: {
19
- txn: 'One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter)',
20
- defaultSender: 'The default sender to be used to obtain a signer where the object provided to the transaction parameter does not' +
21
- ' include a signer.',
18
+ txn: 'A transaction to add to the transaction group',
19
+ signer: 'The optional signer to use when signing this transaction.',
22
20
  },
23
21
  });
24
- yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom): ${name}Composer<TReturns>`;
22
+ yield `addTransaction(txn: Transaction, signer?: TransactionSigner): ${name}Composer<TReturns>`;
25
23
  yield* jsDoc({
26
24
  description: 'Returns the underlying AtomicTransactionComposer instance',
27
25
  });
28
- yield `atc(): Promise<AtomicTransactionComposer>`;
26
+ yield `composer(): AlgoKitComposer`;
29
27
  yield* jsDoc({
30
28
  description: 'Simulates the transaction group and returns the result',
31
29
  });
32
- yield `simulate(options?: SimulateOptions): Promise<${name}ComposerSimulateResult<TReturns>>`;
30
+ yield `simulate(options?: SimulateOptions): Promise<${name}ComposerResults<TReturns> & { simulateResponse: SimulateResponse }>`;
33
31
  yield* jsDoc({
34
32
  description: 'Executes the transaction group and returns the results',
35
33
  });
36
- yield `execute(sendParams?: AppClientComposeExecuteParams): Promise<${name}ComposerResults<TReturns>>`;
37
- yield DecIndentAndCloseBlock;
38
- yield `export type SimulateOptions = Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>`;
39
- yield `export type ${name}ComposerSimulateResult<TReturns extends [...any[]]> = {`;
40
- yield IncIndent;
41
- yield `returns: TReturns`;
42
- yield `methodResults: ABIResult[]`;
43
- yield `simulateResponse: modelsv2.SimulateResponse`;
44
- yield DecIndentAndCloseBlock;
45
- yield `export type ${name}ComposerResults<TReturns extends [...any[]]> = {`;
46
- yield IncIndent;
47
- yield `returns: TReturns`;
48
- yield `groupId: string`;
49
- yield `txIds: string[]`;
50
- yield `transactions: Transaction[]`;
34
+ yield `execute(params?: ExecuteParams): Promise<${name}ComposerResults<TReturns>>`;
51
35
  yield DecIndentAndCloseBlock;
36
+ yield `
37
+ export type ${name}ComposerResults<TReturns extends [...any[]]> = Expand<SendAtomicTransactionComposerResults & {
38
+ returns: TReturns
39
+ }>
40
+ `;
52
41
  }
53
42
  function* callComposerTypeClearState({ app, name }) {
54
43
  yield* jsDoc({
55
- description: `Makes a clear_state call to an existing instance of the ${app.contract.name} smart contract.`,
44
+ description: `Makes a clear_state call to an existing instance of the ${app.name} smart contract.`,
56
45
  params: {
57
46
  args: `The arguments for the bare call`,
58
47
  },
59
48
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
60
49
  });
61
- yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`;
50
+ yield `clearState(params?: AppClientBareCallParams): ${name}Composer<[...TReturns, undefined]>`;
62
51
  yield NewLine;
63
52
  }
64
53
  function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
65
- for (const method of app.contract.methods) {
66
- const methodSignature = algokit.getABIMethodSignature(method);
54
+ for (const method of app.methods) {
55
+ const methodSignature = new ABIMethod(method).getSignature();
67
56
  const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
68
57
  const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
69
58
  // Skip methods which don't support a no_op call config
70
59
  if (!callConfig.callMethods.includes(methodSignature))
71
60
  continue;
72
61
  yield* jsDoc({
73
- description: `Calls the ${algokit.getABIMethodSignature(method)} ABI method.`,
62
+ description: `Calls the ${new ABIMethod(method).getSignature()} ABI method.`,
74
63
  abiDescription: method.desc,
75
64
  params: {
76
65
  args: `The arguments for the contract call`,
@@ -78,7 +67,7 @@ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUnique
78
67
  },
79
68
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
80
69
  });
81
- yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`;
70
+ yield `${methodName}(params?: CallParams<'${methodSignatureSafe}'>): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'> | undefined]>`;
82
71
  yield NewLine;
83
72
  }
84
73
  }
@@ -97,7 +86,7 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
97
86
  },
98
87
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
99
88
  });
100
- yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, undefined]>`;
89
+ yield `bare(params${onComplete?.isOptional !== false ? '?' : ''}: AppClientBareCallParams ${''}): ${name}Composer<[...TReturns, undefined]>`;
101
90
  }
102
91
  else {
103
92
  const uniqueName = methodSignatureToUniqueName[methodSig];
@@ -110,7 +99,7 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
110
99
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
111
100
  });
112
101
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
113
- yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`;
102
+ yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(params${onComplete?.isOptional !== false ? '?' : ''}: CallParams<'${methodSigSafe}'>${''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'> | undefined]>`;
114
103
  }
115
104
  }
116
105
  yield DecIndentAndCloseBlock;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer-types.mjs","sources":["../../../src/client/call-composer-types.ts"],"sourcesContent":["import { DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\n\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { ABIMethod } from 'algosdk'\n\nexport function* callComposerType(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig, app } = ctx\n yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`\n yield IncIndent\n\n yield* callComposerTypeNoops(ctx)\n yield* callComposerOperationMethodType(\n ctx,\n `Deletes an existing instance of the ${app.name} smart contract`,\n callConfig.deleteMethods,\n 'delete',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Opts the user into an existing instance of the ${app.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Makes a close out call to an existing instance of the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n\n yield* callComposerTypeClearState(ctx)\n\n yield* jsDoc({\n description: 'Adds a transaction to the composer',\n params: {\n txn: 'A transaction to add to the transaction group',\n signer: 'The optional signer to use when signing this transaction.',\n },\n })\n yield `addTransaction(txn: Transaction, signer?: TransactionSigner): ${name}Composer<TReturns>`\n\n yield* jsDoc({\n description: 'Returns the underlying AtomicTransactionComposer instance',\n })\n yield `composer(): AlgoKitComposer`\n\n yield* jsDoc({\n description: 'Simulates the transaction group and returns the result',\n })\n yield `simulate(options?: SimulateOptions): Promise<${name}ComposerResults<TReturns> & { simulateResponse: SimulateResponse }>`\n\n yield* jsDoc({\n description: 'Executes the transaction group and returns the results',\n })\n yield `execute(params?: ExecuteParams): Promise<${name}ComposerResults<TReturns>>`\n\n yield DecIndentAndCloseBlock\n\n yield `\n export type ${name}ComposerResults<TReturns extends [...any[]]> = Expand<SendAtomicTransactionComposerResults & {\n returns: TReturns\n }>\n `\n}\n\nfunction* callComposerTypeClearState({ app, name }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: `Makes a clear_state call to an existing instance of the ${app.name} smart contract.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `clearState(params?: AppClientBareCallParams): ${name}Composer<[...TReturns, undefined]>`\n yield NewLine\n}\n\nfunction* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.methods) {\n const methodSignature = new ABIMethod(method).getSignature()\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\n yield* jsDoc({\n description: `Calls the ${new ABIMethod(method).getSignature()} ABI method.`,\n abiDescription: method.desc,\n params: {\n args: `The arguments for the contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `${methodName}(params?: CallParams<'${methodSignatureSafe}'>): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'> | undefined]>`\n yield NewLine\n }\n}\n\nfunction* callComposerOperationMethodType(\n { app, methodSignatureToUniqueName, name, sanitizer }: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `readonly ${verb}: {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield* jsDoc({\n description: `${description} using a bare call.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `bare(params${onComplete?.isOptional !== false ? '?' : ''}: AppClientBareCallParams ${\n includeCompilation ? '& AppClientCompilationParams' : ''\n }): ${name}Composer<[...TReturns, undefined]>`\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n params: {\n args: `The arguments for the smart contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(params${\n onComplete?.isOptional !== false ? '?' : ''\n }: CallParams<'${methodSigSafe}'>${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'> | undefined]>`\n }\n }\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n"],"names":[],"mappings":";;;;;AAOe,UAAE,gBAAgB,CAAC,GAAqB,EAAA;IACrD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;IACrC,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,8CAAA,CAAgD,CAAA;AACzE,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAA;AACjC,IAAA,OAAO,+BAA+B,CACpC,GAAG,EACH,uCAAuC,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,EAChE,UAAU,CAAC,aAAa,EACxB,QAAQ,CACT,CAAA;AACD,IAAA,OAAO,+BAA+B,CACpC,GAAG,EACH,kDAAkD,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,EAC3E,UAAU,CAAC,YAAY,EACvB,OAAO,CACR,CAAA;AACD,IAAA,OA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