@algorandfoundation/algokit-client-generator 6.0.1 → 7.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/client/app-client-context.d.ts +122 -0
  2. package/client/deploy-types.d.ts +1 -11
  3. package/client/generate.d.ts +1 -1
  4. package/client/generator-context.d.ts +3 -5
  5. package/client/helpers/contains-non-void-method.d.ts +2 -2
  6. package/client/helpers/get-equivalent-type.d.ts +3 -5
  7. package/client/imports.d.ts +1 -2
  8. package/package.json +2 -3
  9. package/schema/load.d.ts +1 -1
  10. package/src/cli.js.map +1 -0
  11. package/src/cli.mjs.map +1 -0
  12. package/src/client/app-client-context.js +211 -0
  13. package/src/client/app-client-context.js.map +1 -0
  14. package/src/client/app-client-context.mjs +208 -0
  15. package/src/client/app-client-context.mjs.map +1 -0
  16. package/{client → src/client}/app-client.js +29 -51
  17. package/src/client/app-client.js.map +1 -0
  18. package/{client → src/client}/app-client.mjs +29 -51
  19. package/src/client/app-client.mjs.map +1 -0
  20. package/{client → src/client}/app-factory.js +23 -27
  21. package/src/client/app-factory.js.map +1 -0
  22. package/{client → src/client}/app-factory.mjs +23 -27
  23. package/src/client/app-factory.mjs.map +1 -0
  24. package/{client → src/client}/app-types.js +31 -60
  25. package/src/client/app-types.js.map +1 -0
  26. package/{client → src/client}/app-types.mjs +32 -61
  27. package/src/client/app-types.mjs.map +1 -0
  28. package/{client → src/client}/call-composer-types.js +31 -34
  29. package/src/client/call-composer-types.js.map +1 -0
  30. package/{client → src/client}/call-composer-types.mjs +31 -34
  31. package/src/client/call-composer-types.mjs.map +1 -0
  32. package/{client → src/client}/call-composer.js +24 -31
  33. package/src/client/call-composer.js.map +1 -0
  34. package/{client → src/client}/call-composer.mjs +24 -31
  35. package/src/client/call-composer.mjs.map +1 -0
  36. package/{client → src/client}/deploy-types.js +28 -53
  37. package/src/client/deploy-types.js.map +1 -0
  38. package/{client → src/client}/deploy-types.mjs +29 -52
  39. package/src/client/deploy-types.mjs.map +1 -0
  40. package/{client → src/client}/generate.js +2 -2
  41. package/src/client/generate.js.map +1 -0
  42. package/{client → src/client}/generate.mjs +2 -2
  43. package/src/client/generate.mjs.map +1 -0
  44. package/src/client/generator-context.js +24 -0
  45. package/src/client/generator-context.js.map +1 -0
  46. package/src/client/generator-context.mjs +21 -0
  47. package/src/client/generator-context.mjs.map +1 -0
  48. package/{client → src/client}/helpers/contains-non-void-method.js +3 -2
  49. package/src/client/helpers/contains-non-void-method.js.map +1 -0
  50. package/{client → src/client}/helpers/contains-non-void-method.mjs +3 -2
  51. package/src/client/helpers/contains-non-void-method.mjs.map +1 -0
  52. package/src/client/helpers/get-equivalent-type.js +80 -0
  53. package/src/client/helpers/get-equivalent-type.js.map +1 -0
  54. package/src/client/helpers/get-equivalent-type.mjs +77 -0
  55. package/src/client/helpers/get-equivalent-type.mjs.map +1 -0
  56. package/src/client/imports.js +18 -0
  57. package/src/client/imports.js.map +1 -0
  58. package/src/client/imports.mjs +16 -0
  59. package/src/client/imports.mjs.map +1 -0
  60. package/src/client/params-factory.js +125 -0
  61. package/src/client/params-factory.js.map +1 -0
  62. package/src/client/params-factory.mjs +123 -0
  63. package/src/client/params-factory.mjs.map +1 -0
  64. package/src/client/utility-types.js.map +1 -0
  65. package/src/client/utility-types.mjs.map +1 -0
  66. package/src/output/writer.js.map +1 -0
  67. package/src/output/writer.mjs.map +1 -0
  68. package/src/schema/load.js.map +1 -0
  69. package/src/schema/load.mjs.map +1 -0
  70. package/src/util/boom.js.map +1 -0
  71. package/src/util/boom.mjs.map +1 -0
  72. package/src/util/color-console.js.map +1 -0
  73. package/src/util/color-console.mjs.map +1 -0
  74. package/src/util/sanitization.js.map +1 -0
  75. package/src/util/sanitization.mjs.map +1 -0
  76. package/cli.js.map +0 -1
  77. package/cli.mjs.map +0 -1
  78. package/client/app-client.js.map +0 -1
  79. package/client/app-client.mjs.map +0 -1
  80. package/client/app-factory.js.map +0 -1
  81. package/client/app-factory.mjs.map +0 -1
  82. package/client/app-types.js.map +0 -1
  83. package/client/app-types.mjs.map +0 -1
  84. package/client/call-composer-types.js.map +0 -1
  85. package/client/call-composer-types.mjs.map +0 -1
  86. package/client/call-composer.js.map +0 -1
  87. package/client/call-composer.mjs.map +0 -1
  88. package/client/deploy-types.js.map +0 -1
  89. package/client/deploy-types.mjs.map +0 -1
  90. package/client/generate.js.map +0 -1
  91. package/client/generate.mjs.map +0 -1
  92. package/client/generator-context.js +0 -30
  93. package/client/generator-context.js.map +0 -1
  94. package/client/generator-context.mjs +0 -27
  95. package/client/generator-context.mjs.map +0 -1
  96. package/client/helpers/contains-non-void-method.js.map +0 -1
  97. package/client/helpers/contains-non-void-method.mjs.map +0 -1
  98. package/client/helpers/get-call-config-summary.d.ts +0 -19
  99. package/client/helpers/get-call-config-summary.js +0 -60
  100. package/client/helpers/get-call-config-summary.js.map +0 -1
  101. package/client/helpers/get-call-config-summary.mjs +0 -57
  102. package/client/helpers/get-call-config-summary.mjs.map +0 -1
  103. package/client/helpers/get-equivalent-type.js +0 -81
  104. package/client/helpers/get-equivalent-type.js.map +0 -1
  105. package/client/helpers/get-equivalent-type.mjs +0 -79
  106. package/client/helpers/get-equivalent-type.mjs.map +0 -1
  107. package/client/imports.js +0 -27
  108. package/client/imports.js.map +0 -1
  109. package/client/imports.mjs +0 -25
  110. package/client/imports.mjs.map +0 -1
  111. package/client/params-factory.js +0 -128
  112. package/client/params-factory.js.map +0 -1
  113. package/client/params-factory.mjs +0 -126
  114. package/client/params-factory.mjs.map +0 -1
  115. package/client/utility-types.js.map +0 -1
  116. package/client/utility-types.mjs.map +0 -1
  117. package/output/writer.js.map +0 -1
  118. package/output/writer.mjs.map +0 -1
  119. package/schema/load.js.map +0 -1
  120. package/schema/load.mjs.map +0 -1
  121. package/util/boom.js.map +0 -1
  122. package/util/boom.mjs.map +0 -1
  123. package/util/color-console.js.map +0 -1
  124. package/util/color-console.mjs.map +0 -1
  125. package/util/sanitization.js.map +0 -1
  126. package/util/sanitization.mjs.map +0 -1
  127. /package/{cli.js → src/cli.js} +0 -0
  128. /package/{cli.mjs → src/cli.mjs} +0 -0
  129. /package/{client → src/client}/utility-types.js +0 -0
  130. /package/{client → src/client}/utility-types.mjs +0 -0
  131. /package/{index.js → src/index.js} +0 -0
  132. /package/{index.js.map → src/index.js.map} +0 -0
  133. /package/{index.mjs → src/index.mjs} +0 -0
  134. /package/{index.mjs.map → src/index.mjs.map} +0 -0
  135. /package/{output → src/output}/writer.js +0 -0
  136. /package/{output → src/output}/writer.mjs +0 -0
  137. /package/{schema → src/schema}/application.schema.json.js +0 -0
  138. /package/{schema → src/schema}/application.schema.json.js.map +0 -0
  139. /package/{schema → src/schema}/application.schema.json.mjs +0 -0
  140. /package/{schema → src/schema}/application.schema.json.mjs.map +0 -0
  141. /package/{schema → src/schema}/arc56.schema.json.js +0 -0
  142. /package/{schema → src/schema}/arc56.schema.json.js.map +0 -0
  143. /package/{schema → src/schema}/arc56.schema.json.mjs +0 -0
  144. /package/{schema → src/schema}/arc56.schema.json.mjs.map +0 -0
  145. /package/{schema → src/schema}/contract.schema.json.js +0 -0
  146. /package/{schema → src/schema}/contract.schema.json.js.map +0 -0
  147. /package/{schema → src/schema}/contract.schema.json.mjs +0 -0
  148. /package/{schema → src/schema}/contract.schema.json.mjs.map +0 -0
  149. /package/{schema → src/schema}/load.js +0 -0
  150. /package/{schema → src/schema}/load.mjs +0 -0
  151. /package/{util → src/util}/boom.js +0 -0
  152. /package/{util → src/util}/boom.mjs +0 -0
  153. /package/{util → src/util}/color-console.js +0 -0
  154. /package/{util → src/util}/color-console.mjs +0 -0
  155. /package/{util → src/util}/sanitization.js +0 -0
  156. /package/{util → src/util}/sanitization.mjs +0 -0
@@ -1,10 +1,6 @@
1
1
  import { jsDoc, IncIndent, NewLine, DecIndentAndCloseBlock, indent, DecIndent } from '../output/writer.mjs';
2
- import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
3
- import { getCallOnCompleteOptions, getCreateOnCompleteOptions } from './deploy-types.mjs';
4
2
  import { composeMethod } from './call-composer.mjs';
5
- import { ABIMethod } from 'algosdk';
6
- import { getEquivalentType } from './helpers/get-equivalent-type.mjs';
7
- import { containsNonVoidMethod } from './helpers/contains-non-void-method.mjs';
3
+ import { isAbiMethod } from './app-client-context.mjs';
8
4
 
9
5
  function* appClient(ctx) {
10
6
  const { app, name } = ctx;
@@ -33,16 +29,6 @@ function* appClient(ctx) {
33
29
  appSpec: APP_SPEC,
34
30
  })
35
31
  }`;
36
- if (containsNonVoidMethod(app.methods)) {
37
- yield `
38
- /**
39
- * Checks for decode errors on the given return value and maps the return value to the return type for the given method
40
- * @returns The typed return value or undefined if there was no value
41
- */
42
- decodeReturnValue<TSignature extends ${name}NonVoidMethodSignatures>(method: TSignature, returnValue: ABIReturn | undefined) {
43
- return returnValue !== undefined ? getArc56ReturnValue<MethodReturn<TSignature>>(returnValue, this.appClient.getABIMethod(method), APP_SPEC.structs) : undefined
44
- }`;
45
- }
46
32
  yield `
47
33
  /**
48
34
  * Returns a new \`${name}Client\` client, resolving the app by creator address and name
@@ -135,16 +121,16 @@ function* send(ctx) {
135
121
  yield NewLine;
136
122
  }
137
123
  function* opMethods(ctx, type) {
138
- const { app, callConfig } = ctx;
124
+ const { app } = ctx;
139
125
  if (ctx.mode === 'full') {
140
- yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'update', type, true);
141
- yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'delete', type);
126
+ yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, app.updateMethods, 'update', type, true);
127
+ yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, app.deleteMethods, 'delete', type);
142
128
  }
143
- yield* operationMethods(ctx, `Opts the user into an existing instance of the ${app.name} smart contract`, callConfig.optInMethods, 'optIn', type);
144
- yield* operationMethods(ctx, `Makes a close out call to an existing instance of the ${app.name} smart contract`, callConfig.closeOutMethods, 'closeOut', type);
129
+ yield* operationMethods(ctx, `Opts the user into an existing instance of the ${app.name} smart contract`, app.optInMethods, 'optIn', type);
130
+ yield* operationMethods(ctx, `Makes a close out call to an existing instance of the ${app.name} smart contract`, app.closeOutMethods, 'closeOut', type);
145
131
  }
146
132
  function* bareMethodCall({ generator: { app }, name, description, verb, type, includeCompilation, }) {
147
- const onComplete = verb === 'create' ? getCreateOnCompleteOptions(BARE_CALL, app) : verb === 'call' ? getCallOnCompleteOptions(BARE_CALL, app) : undefined;
133
+ const onComplete = verb === 'create' ? app.bareMethod.createActions.inputType : verb === 'call' ? app.bareMethod.callActions.inputType : undefined;
148
134
  yield* jsDoc({
149
135
  description: `${description}.`,
150
136
  params: {
@@ -152,18 +138,14 @@ function* bareMethodCall({ generator: { app }, name, description, verb, type, in
152
138
  },
153
139
  returns: `The ${verb} result`,
154
140
  });
155
- yield `${name}: (params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
141
+ yield `${name}: (params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}>) => {`;
156
142
  yield* indent(`return this.appClient.${type}.bare.${verb}(params)`);
157
143
  yield '},';
158
144
  }
159
- function* abiMethodCall({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, readonly, }) {
160
- const methodSig = new ABIMethod(method).getSignature();
161
- const uniqueName = methodSignatureToUniqueName[methodSig];
162
- const onComplete = verb === 'create'
163
- ? getCreateOnCompleteOptions(methodSig, app)
164
- : verb === 'call' && !readonly
165
- ? getCallOnCompleteOptions(methodSig, app)
166
- : undefined;
145
+ function* abiMethodCall({ generator: { sanitizer, name }, method, description, verb, type, includeCompilation, readonly, }) {
146
+ const methodSig = method.signature;
147
+ const uniqueName = method.uniqueName.original;
148
+ const onComplete = verb === 'create' ? method.createActions.inputType : method.callActions.inputType;
167
149
  yield* jsDoc({
168
150
  description: verb === 'call' && method.readonly
169
151
  ? [
@@ -181,7 +163,7 @@ function* abiMethodCall({ generator: { app, methodSignatureToUniqueName, name, s
181
163
  const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
182
164
  const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
183
165
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
184
- yield `${!readonly ? `${methodName}: ` : ''}${type === 'send' ? 'async ' : ''}${readonly ? `${methodName}` : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' && !readonly ? ' & SendParams' : ''}${onComplete?.type && !readonly ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''})${!readonly ? ' =>' : ''} {`;
166
+ yield `${!readonly ? `${methodName}: ` : ''}${type === 'send' ? 'async ' : ''}${readonly ? `${methodName}` : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' && !readonly ? ' & SendParams' : ''}${onComplete?.typeLiteral && !readonly ? ` & ${onComplete.typeLiteral}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''})${!readonly ? ' =>' : ''} {`;
185
167
  if (type === 'send') {
186
168
  yield* indent(`const result = await this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`, readonly
187
169
  ? `return result.return as unknown as ${name}Returns['${methodSigSafe}']`
@@ -198,8 +180,8 @@ function* operationMethods(generator, description, methods, verb, type, includeC
198
180
  yield* jsDoc(`Gets available ${verb} methods`);
199
181
  yield `${verb}: {`;
200
182
  yield IncIndent;
201
- for (const methodSig of methods) {
202
- if (methodSig === BARE_CALL) {
183
+ for (const method of methods) {
184
+ if (!isAbiMethod(method)) {
203
185
  yield* bareMethodCall({
204
186
  generator,
205
187
  name: 'bare',
@@ -210,7 +192,6 @@ function* operationMethods(generator, description, methods, verb, type, includeC
210
192
  });
211
193
  }
212
194
  else {
213
- const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig);
214
195
  yield* abiMethodCall({
215
196
  generator,
216
197
  method,
@@ -237,7 +218,7 @@ function* clearState(generator, type) {
237
218
  yield NewLine;
238
219
  }
239
220
  function* call(generator, type) {
240
- if (generator.callConfig.callMethods.includes(BARE_CALL)) {
221
+ if (generator.app.bareMethod.callActions.noOp) {
241
222
  yield* bareMethodCall({
242
223
  generator,
243
224
  name: 'bare',
@@ -249,11 +230,10 @@ function* call(generator, type) {
249
230
  }
250
231
  }
251
232
  function* readonlyMethods(generator) {
252
- const { app, callConfig } = generator;
253
- for (const method of app.methods) {
254
- const methodSignature = new ABIMethod(method).getSignature();
233
+ const { app } = generator;
234
+ for (const method of app.abiMethods) {
255
235
  // Skip non readonly methods
256
- if (!callConfig.callMethods.includes(methodSignature) || !method.readonly)
236
+ if (!method.readonly)
257
237
  continue;
258
238
  yield* abiMethodCall({
259
239
  generator,
@@ -267,11 +247,9 @@ function* readonlyMethods(generator) {
267
247
  }
268
248
  }
269
249
  function* noopMethods(generator, type) {
270
- const { app, callConfig } = generator;
271
- for (const method of app.methods) {
272
- const methodSignature = new ABIMethod(method).getSignature();
273
- // Skip methods which don't support a no_op call config
274
- if (!callConfig.callMethods.includes(methodSignature))
250
+ const { app } = generator;
251
+ for (const method of app.noOpMethods) {
252
+ if (!isAbiMethod(method))
275
253
  continue;
276
254
  yield* abiMethodCall({
277
255
  generator,
@@ -306,14 +284,14 @@ function* getStateMethods({ app, sanitizer }) {
306
284
  yield* jsDoc(`Get all current keyed values from ${storageType} state`);
307
285
  yield `getAll: async (): Promise<Partial<Expand<${storageType[0].toUpperCase()}${storageType.substring(1)}KeysState>>> => {`;
308
286
  yield* indent(`const result = await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getAll()`, `return {`, ...Object.keys(app.state.keys[storageType]).map((n) => {
309
- return ` ${sanitizer.makeSafePropertyIdentifier(n)}: ${app.state.keys[storageType][n].valueType === 'AVMBytes' ? `new BinaryStateValue(result${sanitizer.getSafeMemberAccessor(n)})` : `result${sanitizer.getSafeMemberAccessor(n)}`},`;
287
+ return ` ${sanitizer.makeSafePropertyIdentifier(n)}: ${app.state.keys[storageType][n].valueType.isAvmBytes ? `new BinaryStateValue(result${sanitizer.getSafeMemberAccessor(n)})` : `result${sanitizer.getSafeMemberAccessor(n)}`},`;
310
288
  }), `}`);
311
289
  yield `},`;
312
290
  for (const n of Object.keys(app.state.keys[storageType])) {
313
291
  const name = sanitizer.makeSafePropertyIdentifier(n);
314
292
  const k = app.state.keys[storageType][n];
315
293
  yield* jsDoc(`Get the current value of the ${n} key in ${storageType} state`);
316
- yield `${name}: async (): Promise<${k.valueType === 'AVMBytes' ? 'BinaryState' : `${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | undefined`}> => { return ${k.valueType === 'AVMBytes' ? 'new BinaryStateValue(' : ''}(await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getValue("${sanitizer.makeSafeStringTypeLiteral(n)}"))${k.valueType === 'AVMBytes' ? ' as Uint8Array | undefined)' : ` as ${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | undefined`} },`;
294
+ yield `${name}: async (): Promise<${k.valueType.isAvmBytes ? 'BinaryState' : `${k.valueType.tsOutType} | undefined`}> => { return ${k.valueType.isAvmBytes ? 'new BinaryStateValue(' : ''}(await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getValue("${sanitizer.makeSafeStringTypeLiteral(n)}"))${k.valueType.isAvmBytes ? ' as Uint8Array | undefined)' : ` as ${k.valueType.tsOutType} | undefined`} },`;
317
295
  }
318
296
  for (const n of Object.keys(app.state.maps[storageType])) {
319
297
  const name = sanitizer.makeSafePropertyIdentifier(app.state.keys[storageType][n] ? `${n}Map` : n);
@@ -322,9 +300,9 @@ function* getStateMethods({ app, sanitizer }) {
322
300
  yield `${name}: {`;
323
301
  yield IncIndent;
324
302
  yield* jsDoc(`Get all current values of the ${n} map in ${storageType} state`);
325
- yield `getMap: async (): Promise<Map<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}>> => { return (await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMap("${sanitizer.makeSafeStringTypeLiteral(n)}")) as Map<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}> },`;
303
+ yield `getMap: async (): Promise<Map<${m.keyType.tsOutType}, ${m.valueType.tsOutType}>> => { return (await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMap("${sanitizer.makeSafeStringTypeLiteral(n)}")) as Map<${m.keyType.tsOutType}, ${m.valueType.tsOutType}> },`;
326
304
  yield* jsDoc(`Get a current value of the ${n} map by key from ${storageType} state`);
327
- yield `value: async (key: ${getEquivalentType(m.keyType, 'input', { app, sanitizer })}): Promise<${getEquivalentType(m.valueType, 'output', { app, sanitizer })} | undefined> => { return await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMapValue("${sanitizer.makeSafeStringTypeLiteral(n)}", key) as ${getEquivalentType(m.valueType, 'output', { app, sanitizer })} | undefined },`;
305
+ yield `value: async (key: ${m.keyType.tsInType}): Promise<${m.valueType.tsOutType} | undefined> => { return await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMapValue("${sanitizer.makeSafeStringTypeLiteral(n)}", key) as ${m.valueType.tsOutType} | undefined },`;
328
306
  yield DecIndent;
329
307
  yield `},`;
330
308
  }
@@ -338,17 +316,17 @@ function* getStateMethods({ app, sanitizer }) {
338
316
  yield DecIndentAndCloseBlock;
339
317
  yield NewLine;
340
318
  }
341
- function* cloneMethod({ name }) {
319
+ function* cloneMethod({ app }) {
342
320
  yield* jsDoc({
343
321
  description: 'Clone this app client with different params',
344
322
  params: {
345
- params: 'The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.',
323
+ params: 'The params to use for the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.',
346
324
  },
347
325
  returns: 'A new app client with the altered params',
348
326
  });
349
327
  yield `public clone(params: CloneAppClientParams) {`;
350
328
  yield IncIndent;
351
- yield `return new ${name}Client(this.appClient.clone(params))`;
329
+ yield `return new ${app.name.makeSafeTypeIdentifier}Client(this.appClient.clone(params))`;
352
330
  yield DecIndentAndCloseBlock;
353
331
  yield NewLine;
354
332
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-client.mjs","sources":["../../../src/client/app-client.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { composeMethod } from './call-composer'\n\nimport { AppClientMethodContext, AbiMethodClientContext, isAbiMethod } from './app-client-context'\n\nexport function* appClient(ctx: GeneratorContext): DocumentParts {\n const { app, name } = ctx\n\n yield* jsDoc(`A client to make calls to the ${app.name} smart contract`)\n yield `export class ${name}Client {`\n yield IncIndent\n yield* jsDoc(`The underlying \\`AppClient\\` for when you want to have more flexibility`)\n yield 'public readonly appClient: _AppClient'\n yield NewLine\n\n yield `\n /**\n * Creates a new instance of \\`${name}Client\\`\n *\n * @param appClient An \\`AppClient\\` instance which has been created with the ${name} app spec\n */\n constructor(appClient: _AppClient)\n /**\n * Creates a new instance of \\`${name}Client\\`\n *\n * @param params The parameters to initialise the app client with\n */\n constructor(params: Omit<AppClientParams, 'appSpec'>)\n constructor(appClientOrParams: _AppClient | Omit<AppClientParams, 'appSpec'>) {\n this.appClient = appClientOrParams instanceof _AppClient ? appClientOrParams : new _AppClient({\n ...appClientOrParams,\n appSpec: APP_SPEC,\n })\n }`\n\n yield `\n /**\n * Returns a new \\`${name}Client\\` client, resolving the app by creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n * @param params The parameters to create the app client\n */\n public static async fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<${name}Client> {\n return new ${name}Client(await _AppClient.fromCreatorAndName({...params, appSpec: APP_SPEC}))\n }\n\n /**\n * Returns an \\`${name}Client\\` instance for the current network based on\n * pre-determined network-specific app IDs specified in the ARC-56 app spec.\n *\n * If no IDs are in the app spec or the network isn't recognised, an error is thrown.\n * @param params The parameters to create the app client\n */\n static async fromNetwork(\n params: Omit<ResolveAppClientByNetwork, 'appSpec'>\n ): Promise<${name}Client> {\n return new ${name}Client(await _AppClient.fromNetwork({...params, appSpec: APP_SPEC}))\n }\n\n /** The ID of the app instance this client is linked to. */\n public get appId() {\n return this.appClient.appId\n }\n\n /** The app address of the app instance this client is linked to. */\n public get appAddress() {\n return this.appClient.appAddress\n }\n\n /** The name of the app. */\n public get appName() {\n return this.appClient.appName\n }\n\n /** The ARC-56 app spec being used */\n public get appSpec() {\n return this.appClient.appSpec\n }\n\n /** A reference to the underlying \\`AlgorandClient\\` this app client is using. */\n public get algorand(): AlgorandClient {\n return this.appClient.algorand\n }\n\n `\n\n yield* params(ctx)\n yield* createTransaction(ctx)\n yield* send(ctx)\n yield* cloneMethod(ctx)\n yield* readonlyMethods(ctx)\n yield* getStateMethods(ctx)\n yield* composeMethod(ctx)\n yield DecIndentAndCloseBlock\n}\n\nfunction* params(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(\n `Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`,\n )\n yield `readonly params = {`\n yield IncIndent\n yield* opMethods(ctx, 'params')\n yield* clearState(ctx, 'params')\n yield* call(ctx, 'params')\n yield* noopMethods(ctx, 'params')\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* createTransaction(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Create transactions for the current app`)\n yield `readonly createTransaction = {`\n yield IncIndent\n yield* opMethods(ctx, 'createTransaction')\n yield* clearState(ctx, 'createTransaction')\n yield* call(ctx, 'createTransaction')\n yield* noopMethods(ctx, 'createTransaction')\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* send(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Send calls to the current app`)\n yield `readonly send = {`\n yield IncIndent\n yield* opMethods(ctx, 'send')\n yield* clearState(ctx, 'send')\n yield* call(ctx, 'send')\n yield* noopMethods(ctx, 'send')\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* opMethods(ctx: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n const { app } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, app.updateMethods, 'update', type, true)\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, app.deleteMethods, 'delete', type)\n }\n yield* operationMethods(ctx, `Opts the user into an existing instance of the ${app.name} smart contract`, app.optInMethods, 'optIn', type)\n yield* operationMethods(\n ctx,\n `Makes a close out call to an existing instance of the ${app.name} smart contract`,\n app.closeOutMethods,\n 'closeOut',\n type,\n )\n}\n\nfunction* bareMethodCall({\n generator: { app },\n name,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n name: string\n description: string\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete' | 'clearState' | 'call'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}): DocumentParts {\n const onComplete =\n verb === 'create' ? app.bareMethod.createActions.inputType : verb === 'call' ? app.bareMethod.callActions.inputType : undefined\n yield* jsDoc({\n description: `${description}.`,\n params: {\n params: `The params for the bare (raw) call`,\n },\n returns: `The ${verb} result`,\n })\n yield `${name}: (params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}>) => {`\n yield* indent(`return this.appClient.${type}.bare.${verb}(params)`)\n yield '},'\n}\n\nfunction* abiMethodCall({\n generator: { sanitizer, name },\n method,\n description,\n verb,\n type,\n includeCompilation,\n readonly,\n}: {\n generator: GeneratorContext\n method: AbiMethodClientContext\n description: string\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete' | 'call'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n readonly?: boolean\n}) {\n const methodSig = method.signature\n const uniqueName = method.uniqueName.original\n const onComplete = verb === 'create' ? method.createActions.inputType : method.callActions.inputType\n yield* jsDoc({\n description:\n verb === 'call' && method.readonly\n ? [\n `${description} using the \\`${methodSig}\\` ABI method.`,\n '',\n 'This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.',\n ]\n : `${description} using the \\`${methodSig}\\` ABI method.`,\n abiDescription: method?.desc,\n params: {\n params: `The params for the smart contract call`,\n },\n returns: `The ${verb} ${type === 'params' ? 'params' : type === 'createTransaction' ? 'transaction' : 'result'}${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,\n })\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${!readonly ? `${methodName}: ` : ''}${type === 'send' ? 'async ' : ''}${readonly ? `${methodName}` : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' && !readonly ? ' & SendParams' : ''}${onComplete?.typeLiteral && !readonly ? ` & ${onComplete.typeLiteral}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''})${!readonly ? ' =>' : ''} {`\n if (type === 'send') {\n yield* indent(\n `const result = await this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`,\n readonly\n ? `return result.return as unknown as ${name}Returns['${methodSigSafe}']`\n : `return {...result, return: result.return as unknown as (undefined | ${name}Returns['${methodSigSafe}'])}`,\n )\n } else {\n yield* indent(\n `return this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`,\n )\n }\n yield `}${!readonly ? ',' : ''}`\n yield NewLine\n}\n\nfunction* operationMethods(\n generator: GeneratorContext,\n description: string,\n methods: AppClientMethodContext[],\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n type: 'params' | 'createTransaction' | 'send',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `${verb}: {`\n yield IncIndent\n for (const method of methods) {\n if (!isAbiMethod(method)) {\n yield* bareMethodCall({\n generator,\n name: 'bare',\n description: `${description} using a bare call`,\n verb,\n type,\n includeCompilation,\n })\n } else {\n yield* abiMethodCall({\n generator,\n method,\n description,\n verb,\n type,\n includeCompilation,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* clearState(generator: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n yield* bareMethodCall({\n generator,\n name: 'clearState',\n description: `Makes a clear_state call to an existing instance of the ${generator.app.name} smart contract`,\n verb: 'clearState',\n type,\n })\n yield NewLine\n}\n\nfunction* call(generator: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n if (generator.app.bareMethod.callActions.noOp) {\n yield* bareMethodCall({\n generator,\n name: 'bare',\n description: `Makes a call to the ${generator.app.name} smart contract using a bare call`,\n verb: 'call',\n type,\n })\n yield NewLine\n }\n}\n\nfunction* readonlyMethods(generator: GeneratorContext): DocumentParts {\n const { app } = generator\n for (const method of app.abiMethods) {\n // Skip non readonly methods\n if (!method.readonly) continue\n\n yield* abiMethodCall({\n generator,\n description: `Makes a readonly (simulated) call to the ${generator.app.name} smart contract`,\n method,\n verb: 'call',\n type: 'send',\n includeCompilation: false,\n readonly: true,\n })\n }\n}\n\nfunction* noopMethods(generator: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n const { app } = generator\n for (const method of app.noOpMethods) {\n if (!isAbiMethod(method)) continue\n yield* abiMethodCall({\n generator,\n description: `Makes a call to the ${generator.app.name} smart contract`,\n method,\n verb: 'call',\n type,\n includeCompilation: false,\n })\n }\n}\n\nfunction* getStateMethods({ app, sanitizer }: GeneratorContext): DocumentParts {\n if (Object.keys(app.state).length === 0) return\n\n yield* jsDoc(`Methods to access state for the current ${app.name} app`)\n yield 'state = {'\n yield IncIndent\n\n const storageTypes = ['global', 'local', 'box'] as const\n\n for (const storageType of storageTypes) {\n const hasKeys = Object.keys(app.state.keys[storageType]).length > 0\n const hasMaps = Object.keys(app.state.maps[storageType]).length > 0\n if (!hasKeys && !hasMaps) continue\n\n yield* jsDoc(`Methods to access ${storageType} state for the current ${app.name} app`)\n yield `${storageType}${storageType === 'local' ? ': (address: string | Address) => {' : ': {'}`\n yield IncIndent\n if (storageType === 'local') {\n yield \"const encodedAddress = typeof address === 'string' ? address : encodeAddress(address.publicKey)\"\n yield 'return {'\n yield IncIndent\n }\n\n yield* jsDoc(`Get all current keyed values from ${storageType} state`)\n yield `getAll: async (): Promise<Partial<Expand<${storageType[0].toUpperCase()}${storageType.substring(1)}KeysState>>> => {`\n yield* indent(\n `const result = await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getAll()`,\n `return {`,\n ...Object.keys(app.state.keys[storageType]).map((n) => {\n return ` ${sanitizer.makeSafePropertyIdentifier(n)}: ${app.state.keys[storageType][n].valueType.isAvmBytes ? `new BinaryStateValue(result${sanitizer.getSafeMemberAccessor(n)})` : `result${sanitizer.getSafeMemberAccessor(n)}`},`\n }),\n `}`,\n )\n yield `},`\n\n for (const n of Object.keys(app.state.keys[storageType])) {\n const name = sanitizer.makeSafePropertyIdentifier(n)\n const k = app.state.keys[storageType][n]\n yield* jsDoc(`Get the current value of the ${n} key in ${storageType} state`)\n yield `${name}: async (): Promise<${k.valueType.isAvmBytes ? 'BinaryState' : `${k.valueType.tsOutType} | undefined`}> => { return ${k.valueType.isAvmBytes ? 'new BinaryStateValue(' : ''}(await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getValue(\"${sanitizer.makeSafeStringTypeLiteral(n)}\"))${k.valueType.isAvmBytes ? ' as Uint8Array | undefined)' : ` as ${k.valueType.tsOutType} | undefined`} },`\n }\n\n for (const n of Object.keys(app.state.maps[storageType])) {\n const name = sanitizer.makeSafePropertyIdentifier(app.state.keys[storageType][n] ? `${n}Map` : n)\n const m = app.state.maps[storageType][n]\n yield* jsDoc(`Get values from the ${n} map in ${storageType} state`)\n yield `${name}: {`\n yield IncIndent\n\n yield* jsDoc(`Get all current values of the ${n} map in ${storageType} state`)\n yield `getMap: async (): Promise<Map<${m.keyType.tsOutType}, ${m.valueType.tsOutType}>> => { return (await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMap(\"${sanitizer.makeSafeStringTypeLiteral(n)}\")) as Map<${m.keyType.tsOutType}, ${m.valueType.tsOutType}> },`\n\n yield* jsDoc(`Get a current value of the ${n} map by key from ${storageType} state`)\n yield `value: async (key: ${m.keyType.tsInType}): Promise<${m.valueType.tsOutType} | undefined> => { return await this.appClient.state.${storageType}${storageType === 'local' ? '(encodedAddress)' : ''}.getMapValue(\"${sanitizer.makeSafeStringTypeLiteral(n)}\", key) as ${m.valueType.tsOutType} | undefined },`\n\n yield DecIndent\n yield `},`\n }\n\n yield DecIndent\n if (storageType === 'local') {\n yield '}'\n yield DecIndent\n }\n yield '},'\n }\n\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* cloneMethod({ app }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: 'Clone this app client with different params',\n params: {\n params:\n 'The params to use for the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.',\n },\n returns: 'A new app client with the altered params',\n })\n yield `public clone(params: CloneAppClientParams) {`\n yield IncIndent\n yield `return new ${app.name.makeSafeTypeIdentifier}Client(this.appClient.clone(params))`\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n"],"names":[],"mappings":";;;;AAMM,UAAW,SAAS,CAAC,GAAqB,EAAA;AAC9C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG;IAEzB,OAAO,KAAK,CAAC,CAAA,8BAAA,EAAiC,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,CAAC;IACxE,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,QAAA,CAAU;AACpC,IAAA,MAAM,SAAS;AACf,IAAA,OAAO,KAAK,CAAC,CAAA,uEAAA,CAAyE,CAAC;AACvF,IAAA,MAAM,uCAAuC;AAC7C,IAAA,MAAM,OAAO;IAEb,MAAM;;qCAE6B,IAAI,CAAA;;oFAE2C,IAAI,CAAA;;;;qCAInD,IAAI,CAAA;;;;;;;;;;MAUnC;IAEJ,MAAM;;yBAEiB,IAAI,CAAA;;;;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;AACpD,KAAA,CAAC;AACF,IAAA,MAAM,8CAA8C;AACpD,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,sBAAsB,sCAAsC;AACzF,IAAA,MAAM,sBAAsB;AAC5B,IAAA,MAAM,OAAO;AACf;;;;"}
@@ -1,9 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var writer = require('../output/writer.js');
4
- var getCallConfigSummary = require('./helpers/get-call-config-summary.js');
5
- var deployTypes = require('./deploy-types.js');
6
- var algosdk = require('algosdk');
4
+ var appClientContext = require('./app-client-context.js');
7
5
 
8
6
  function* appFactory(ctx) {
9
7
  const { app, name } = ctx;
@@ -101,12 +99,12 @@ function* send(ctx) {
101
99
  }
102
100
  function* createMethods(generator) {
103
101
  const { app } = generator;
104
- if (generator.callConfig.createMethods.length) {
102
+ if (app.createMethods.length) {
105
103
  yield* writer.jsDoc(`Gets available create methods`);
106
104
  yield `create: {`;
107
105
  yield writer.IncIndent;
108
- for (const methodSig of generator.callConfig.createMethods) {
109
- if (methodSig === getCallConfigSummary.BARE_CALL) {
106
+ for (const method of generator.app.createMethods) {
107
+ if (!appClientContext.isAbiMethod(method)) {
110
108
  yield* bareMethodCallParams({
111
109
  generator,
112
110
  name: 'bare',
@@ -117,7 +115,6 @@ function* createMethods(generator) {
117
115
  });
118
116
  }
119
117
  else {
120
- const method = generator.app.methods.find((m) => new algosdk.ABIMethod(m).getSignature() === methodSig);
121
118
  yield* abiMethodCallParams({
122
119
  generator,
123
120
  method,
@@ -134,17 +131,17 @@ function* createMethods(generator) {
134
131
  }
135
132
  }
136
133
  function* paramMethods(ctx) {
137
- const { app, callConfig } = ctx;
138
- yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'params', true);
139
- yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', 'params', true);
140
- yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete', 'params');
134
+ const { app } = ctx;
135
+ yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, app.createMethods, 'create', 'params', true);
136
+ yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, app.updateMethods, 'deployUpdate', 'params', true);
137
+ yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, app.deleteMethods, 'deployDelete', 'params');
141
138
  }
142
139
  function* createTransactionMethods(ctx) {
143
- const { app, callConfig } = ctx;
144
- yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'createTransaction', true);
140
+ const { app } = ctx;
141
+ yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, app.createMethods, 'create', 'createTransaction', true);
145
142
  }
146
143
  function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
147
- const onComplete = verb === 'create' ? deployTypes.getCreateOnCompleteOptions(getCallConfigSummary.BARE_CALL, app) : undefined;
144
+ const onComplete = verb === 'create' ? app.bareMethod.createActions.inputType : undefined;
148
145
  yield* writer.jsDoc({
149
146
  description: `${description}.`,
150
147
  params: {
@@ -154,7 +151,7 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
154
151
  ? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
155
152
  : `The ${verb} result`,
156
153
  });
157
- yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
154
+ yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}>) => {`;
158
155
  if (type === 'params' || type === 'createTransaction') {
159
156
  yield* writer.indent(`return this.appFactory.${type}.bare.${verb}(params)`);
160
157
  }
@@ -163,10 +160,10 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
163
160
  }
164
161
  yield '},';
165
162
  }
166
- function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, }) {
167
- const methodSig = new algosdk.ABIMethod(method).getSignature();
168
- const uniqueName = methodSignatureToUniqueName[methodSig];
169
- const onComplete = verb === 'create' ? deployTypes.getCreateOnCompleteOptions(methodSig, app) : undefined;
163
+ function* abiMethodCallParams({ generator: { name, sanitizer }, method, description, verb, type, includeCompilation, }) {
164
+ const methodSig = method.signature;
165
+ const uniqueName = method.uniqueName.original;
166
+ const onComplete = verb === 'create' ? method.createActions.inputType : undefined;
170
167
  yield* writer.jsDoc({
171
168
  description: `${description} using the ${methodSig} ABI method.`,
172
169
  abiDescription: method?.desc,
@@ -178,7 +175,7 @@ function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, n
178
175
  const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
179
176
  const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
180
177
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
181
- yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
178
+ yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
182
179
  if (type === 'params' || type === 'createTransaction') {
183
180
  yield* writer.indent(`return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
184
181
  }
@@ -192,8 +189,8 @@ function* operationMethods(generator, description, methods, verb, type, includeC
192
189
  yield* writer.jsDoc(`Gets available ${verb} methods`);
193
190
  yield `${verb}: {`;
194
191
  yield writer.IncIndent;
195
- for (const methodSig of methods) {
196
- if (methodSig === getCallConfigSummary.BARE_CALL) {
192
+ for (const method of methods) {
193
+ if (!appClientContext.isAbiMethod(method)) {
197
194
  yield* bareMethodCallParams({
198
195
  generator,
199
196
  name: 'bare',
@@ -204,7 +201,6 @@ function* operationMethods(generator, description, methods, verb, type, includeC
204
201
  });
205
202
  }
206
203
  else {
207
- const method = generator.app.methods.find((m) => new algosdk.ABIMethod(m).getSignature() === methodSig);
208
204
  yield* abiMethodCallParams({
209
205
  generator,
210
206
  method,
@@ -221,7 +217,7 @@ function* operationMethods(generator, description, methods, verb, type, includeC
221
217
  }
222
218
  }
223
219
  function* deployMethod(ctx) {
224
- const { app, callConfig, name } = ctx;
220
+ const { app, name } = ctx;
225
221
  yield* writer.jsDoc({
226
222
  description: `Idempotently deploys the ${app.name} smart contract.`,
227
223
  params: {
@@ -234,13 +230,13 @@ function* deployMethod(ctx) {
234
230
  yield `const result = await this.appFactory.deploy({`;
235
231
  yield writer.IncIndent;
236
232
  yield `...params,`;
237
- if (callConfig.createMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
233
+ if (app.createMethods.some((m) => !m.isBare)) {
238
234
  yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams ? params.createParams as (${name}CreateCallParams & { args: Uint8Array[] }) : undefined,`;
239
235
  }
240
- if (callConfig.updateMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
236
+ if (app.updateMethods.some((m) => !m.isBare)) {
241
237
  yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams ? params.updateParams as (${name}UpdateCallParams & { args: Uint8Array[] }) : undefined,`;
242
238
  }
243
- if (callConfig.deleteMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
239
+ if (app.deleteMethods.some((m) => !m.isBare)) {
244
240
  yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams ? params.deleteParams as (${name}DeleteCallParams & { args: Uint8Array[] }) : undefined,`;
245
241
  }
246
242
  yield writer.DecIndent;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-factory.js","sources":["../../../src/client/app-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\n\nimport { GeneratorContext } from './generator-context'\n\nimport { AppClientMethodContext, AbiMethodClientContext, isAbiMethod } from './app-client-context'\n\nexport function* appFactory(ctx: GeneratorContext): DocumentParts {\n const { app, name } = ctx\n\n yield* jsDoc(\n `A factory to create and deploy one or more instance of the ${app.name} smart contract and to create one or more app clients to interact with those (or other) app instances`,\n )\n yield `export class ${name}Factory {`\n yield IncIndent\n yield* jsDoc(`The underlying \\`AppFactory\\` for when you want to have more flexibility`)\n yield 'public readonly appFactory: _AppFactory'\n yield NewLine\n\n yield* jsDoc({\n description: `Creates a new instance of \\`${name}Factory\\``,\n params: {\n params: 'The parameters to initialise the app factory with',\n },\n })\n\n yield `\n constructor(params: Omit<AppFactoryParams, 'appSpec'>) {\n this.appFactory = new _AppFactory({\n ...params,\n appSpec: APP_SPEC,\n })\n }\n\n /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */\n public get appName() {\n return this.appFactory.appName\n }\n\n /** The ARC-56 app spec being used */\n get appSpec() {\n return APP_SPEC\n }\n\n /** A reference to the underlying \\`AlgorandClient\\` this app factory is using. */\n public get algorand(): AlgorandClient {\n return this.appFactory.algorand\n }\n\n /**\n * Returns a new \\`AppClient\\` client for an app instance of the given ID.\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The \\`AppClient\\`\n */\n public getAppClientById(params: AppFactoryAppClientParams) {\n return new ${name}Client(this.appFactory.getAppClientById(params))\n }\n\n /**\n * Returns a new \\`AppClient\\` client, resolving the app by creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The \\`AppClient\\`\n */\n public async getAppClientByCreatorAndName(\n params: AppFactoryResolveAppClientByCreatorAndNameParams,\n ) {\n return new ${name}Client(await this.appFactory.getAppClientByCreatorAndName(params))\n }\n `\n\n yield* deployMethod(ctx)\n yield* params(ctx)\n yield* createTransaction(ctx)\n yield* send(ctx)\n yield DecIndentAndCloseBlock\n}\n\nfunction* params(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(\n `Get parameters to create transactions (create and deploy related calls) for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`,\n )\n yield `readonly params = {`\n yield IncIndent\n yield* paramMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* createTransaction(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Create transactions for the current app`)\n yield `readonly createTransaction = {`\n yield IncIndent\n yield* createTransactionMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* send(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Send calls to the current app`)\n yield `readonly send = {`\n yield IncIndent\n yield* createMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* createMethods(generator: GeneratorContext): DocumentParts {\n const { app } = generator\n if (app.createMethods.length) {\n yield* jsDoc(`Gets available create methods`)\n yield `create: {`\n yield IncIndent\n for (const method of generator.app.createMethods) {\n if (!isAbiMethod(method)) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `Creates a new instance of the ${app.name} smart contract using a bare call`,\n verb: 'create',\n type: 'send',\n includeCompilation: true,\n })\n } else {\n yield* abiMethodCallParams({\n generator,\n method,\n description: `Creates a new instance of the ${app.name} smart contract using an ABI method call`,\n verb: 'create',\n type: 'send',\n includeCompilation: true,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* paramMethods(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, app.createMethods, 'create', 'params', true)\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n app.updateMethods,\n 'deployUpdate',\n 'params',\n true,\n )\n yield* operationMethods(\n ctx,\n `Deletes an existing instance of the ${app.name} smart contract`,\n app.deleteMethods,\n 'deployDelete',\n 'params',\n )\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n\n yield* operationMethods(\n ctx,\n `Creates a new instance of the ${app.name} smart contract`,\n app.createMethods,\n 'create',\n 'createTransaction',\n true,\n )\n}\n\nfunction* bareMethodCallParams({\n generator: { app, name: clientName },\n name,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n name: string\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}): DocumentParts {\n const onComplete = verb === 'create' ? app.bareMethod.createActions.inputType : undefined\n yield* jsDoc({\n description: `${description}.`,\n params: {\n params: `The params for the bare (raw) call`,\n },\n returns:\n type === 'params' || type === 'createTransaction'\n ? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`\n : `The ${verb} result`,\n })\n yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}>) => {`\n if (type === 'params' || type === 'createTransaction') {\n yield* indent(`return this.appFactory.${type}.bare.${verb}(params)`)\n } else {\n yield* indent(\n `const result = await this.appFactory.send.bare.create(params)`,\n `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`,\n )\n }\n yield '},'\n}\n\nfunction* abiMethodCallParams({\n generator: { name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n method: AbiMethodClientContext\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}) {\n const methodSig = method.signature\n const uniqueName = method.uniqueName.original\n const onComplete = verb === 'create' ? method.createActions.inputType : undefined\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n abiDescription: method?.desc,\n params: {\n params: `The params for the smart contract call`,\n },\n returns: `The ${verb} ${type === 'params' ? 'params' : type === 'createTransaction' ? 'transaction' : 'result'}${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,\n })\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`\n if (type === 'params' || type === 'createTransaction') {\n yield* indent(\n `return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`,\n )\n } else {\n yield* indent(\n `const result = await this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`,\n `return { result: { ...result.result, return: result.result.return as unknown as (undefined | ${name}Returns['${methodSigSafe}']) }, appClient: new ${name}Client(result.appClient) }`,\n )\n }\n yield '},'\n}\n\nfunction* operationMethods(\n generator: GeneratorContext,\n description: string,\n methods: AppClientMethodContext[],\n verb: 'create' | 'deployUpdate' | 'deployDelete',\n type: 'params' | 'createTransaction',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `${verb}: {`\n yield IncIndent\n for (const method of methods) {\n if (!isAbiMethod(method)) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `${description} using a bare call`,\n verb,\n type,\n includeCompilation,\n })\n } else {\n yield* abiMethodCallParams({\n generator,\n method,\n description,\n verb,\n type,\n includeCompilation,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* deployMethod(ctx: GeneratorContext): DocumentParts {\n const { app, name } = ctx\n yield* jsDoc({\n description: `Idempotently deploys the ${app.name} smart contract.`,\n params: {\n params: 'The arguments for the contract calls and any additional parameters for the call',\n },\n returns: 'The deployment result',\n })\n yield `public async deploy(params: ${name}DeployParams = {}) {`\n yield IncIndent\n\n yield `const result = await this.appFactory.deploy({`\n yield IncIndent\n yield `...params,`\n if (app.createMethods.some((m) => !m.isBare)) {\n yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams ? params.createParams as (${name}CreateCallParams & { args: Uint8Array[] }) : undefined,`\n }\n if (app.updateMethods.some((m) => !m.isBare)) {\n yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams ? params.updateParams as (${name}UpdateCallParams & { args: Uint8Array[] }) : undefined,`\n }\n if (app.deleteMethods.some((m) => !m.isBare)) {\n yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams ? params.deleteParams as (${name}DeleteCallParams & { args: Uint8Array[] }) : undefined,`\n }\n yield DecIndent\n yield `})`\n yield `return { result: result.result, appClient: new ${name}Client(result.appClient) }`\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n"],"names":["jsDoc","IncIndent","NewLine","DecIndentAndCloseBlock","isAbiMethod","DecIndent","indent"],"mappings":";;;;;AAMM,UAAW,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG;IAEzB,OAAOA,YAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAA,qGAAA,CAAuG,CAC9K;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW;AACrC,IAAA,MAAMC,gBAAS;AACf,IAAA,OAAOD,YAAK,CAAC,CAAA,wEAAA,CAA0E,CAAC;AACxF,IAAA,MAAM,yCAAyC;AAC/C,IAAA,MAAME,cAAO;IAEb,OAAOF,YAAK,CAAC;QACX,WAAW,EAAE,CAAA,4BAAA,EAA+B,IAAI,CAAA,SAAA,CAAW;AAC3D,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,mDAAmD;AAC5D,SAAA;AACF,KAAA,CAAC;IAEF,MAAM;;;;;;;;;;;;;;;;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}
@@ -1,7 +1,5 @@
1
1
  import { jsDoc, IncIndent, NewLine, DecIndentAndCloseBlock, DecIndent, indent } from '../output/writer.mjs';
2
- import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
3
- import { getCreateOnCompleteOptions } from './deploy-types.mjs';
4
- import { ABIMethod } from 'algosdk';
2
+ import { isAbiMethod } from './app-client-context.mjs';
5
3
 
6
4
  function* appFactory(ctx) {
7
5
  const { app, name } = ctx;
@@ -99,12 +97,12 @@ function* send(ctx) {
99
97
  }
100
98
  function* createMethods(generator) {
101
99
  const { app } = generator;
102
- if (generator.callConfig.createMethods.length) {
100
+ if (app.createMethods.length) {
103
101
  yield* jsDoc(`Gets available create methods`);
104
102
  yield `create: {`;
105
103
  yield IncIndent;
106
- for (const methodSig of generator.callConfig.createMethods) {
107
- if (methodSig === BARE_CALL) {
104
+ for (const method of generator.app.createMethods) {
105
+ if (!isAbiMethod(method)) {
108
106
  yield* bareMethodCallParams({
109
107
  generator,
110
108
  name: 'bare',
@@ -115,7 +113,6 @@ function* createMethods(generator) {
115
113
  });
116
114
  }
117
115
  else {
118
- const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig);
119
116
  yield* abiMethodCallParams({
120
117
  generator,
121
118
  method,
@@ -132,17 +129,17 @@ function* createMethods(generator) {
132
129
  }
133
130
  }
134
131
  function* paramMethods(ctx) {
135
- const { app, callConfig } = ctx;
136
- yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'params', true);
137
- yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', 'params', true);
138
- yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete', 'params');
132
+ const { app } = ctx;
133
+ yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, app.createMethods, 'create', 'params', true);
134
+ yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, app.updateMethods, 'deployUpdate', 'params', true);
135
+ yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, app.deleteMethods, 'deployDelete', 'params');
139
136
  }
140
137
  function* createTransactionMethods(ctx) {
141
- const { app, callConfig } = ctx;
142
- yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'createTransaction', true);
138
+ const { app } = ctx;
139
+ yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, app.createMethods, 'create', 'createTransaction', true);
143
140
  }
144
141
  function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
145
- const onComplete = verb === 'create' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined;
142
+ const onComplete = verb === 'create' ? app.bareMethod.createActions.inputType : undefined;
146
143
  yield* jsDoc({
147
144
  description: `${description}.`,
148
145
  params: {
@@ -152,7 +149,7 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
152
149
  ? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
153
150
  : `The ${verb} result`,
154
151
  });
155
- yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
152
+ yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}>) => {`;
156
153
  if (type === 'params' || type === 'createTransaction') {
157
154
  yield* indent(`return this.appFactory.${type}.bare.${verb}(params)`);
158
155
  }
@@ -161,10 +158,10 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
161
158
  }
162
159
  yield '},';
163
160
  }
164
- function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, }) {
165
- const methodSig = new ABIMethod(method).getSignature();
166
- const uniqueName = methodSignatureToUniqueName[methodSig];
167
- const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined;
161
+ function* abiMethodCallParams({ generator: { name, sanitizer }, method, description, verb, type, includeCompilation, }) {
162
+ const methodSig = method.signature;
163
+ const uniqueName = method.uniqueName.original;
164
+ const onComplete = verb === 'create' ? method.createActions.inputType : undefined;
168
165
  yield* jsDoc({
169
166
  description: `${description} using the ${methodSig} ABI method.`,
170
167
  abiDescription: method?.desc,
@@ -176,7 +173,7 @@ function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, n
176
173
  const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
177
174
  const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
178
175
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
179
- yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
176
+ yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
180
177
  if (type === 'params' || type === 'createTransaction') {
181
178
  yield* indent(`return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
182
179
  }
@@ -190,8 +187,8 @@ function* operationMethods(generator, description, methods, verb, type, includeC
190
187
  yield* jsDoc(`Gets available ${verb} methods`);
191
188
  yield `${verb}: {`;
192
189
  yield IncIndent;
193
- for (const methodSig of methods) {
194
- if (methodSig === BARE_CALL) {
190
+ for (const method of methods) {
191
+ if (!isAbiMethod(method)) {
195
192
  yield* bareMethodCallParams({
196
193
  generator,
197
194
  name: 'bare',
@@ -202,7 +199,6 @@ function* operationMethods(generator, description, methods, verb, type, includeC
202
199
  });
203
200
  }
204
201
  else {
205
- const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig);
206
202
  yield* abiMethodCallParams({
207
203
  generator,
208
204
  method,
@@ -219,7 +215,7 @@ function* operationMethods(generator, description, methods, verb, type, includeC
219
215
  }
220
216
  }
221
217
  function* deployMethod(ctx) {
222
- const { app, callConfig, name } = ctx;
218
+ const { app, name } = ctx;
223
219
  yield* jsDoc({
224
220
  description: `Idempotently deploys the ${app.name} smart contract.`,
225
221
  params: {
@@ -232,13 +228,13 @@ function* deployMethod(ctx) {
232
228
  yield `const result = await this.appFactory.deploy({`;
233
229
  yield IncIndent;
234
230
  yield `...params,`;
235
- if (callConfig.createMethods.filter((m) => m !== BARE_CALL).length) {
231
+ if (app.createMethods.some((m) => !m.isBare)) {
236
232
  yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams ? params.createParams as (${name}CreateCallParams & { args: Uint8Array[] }) : undefined,`;
237
233
  }
238
- if (callConfig.updateMethods.filter((m) => m !== BARE_CALL).length) {
234
+ if (app.updateMethods.some((m) => !m.isBare)) {
239
235
  yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams ? params.updateParams as (${name}UpdateCallParams & { args: Uint8Array[] }) : undefined,`;
240
236
  }
241
- if (callConfig.deleteMethods.filter((m) => m !== BARE_CALL).length) {
237
+ if (app.deleteMethods.some((m) => !m.isBare)) {
242
238
  yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams ? params.deleteParams as (${name}DeleteCallParams & { args: Uint8Array[] }) : undefined,`;
243
239
  }
244
240
  yield DecIndent;