@algorandfoundation/algokit-client-generator 4.0.0-beta.3 → 4.0.0-beta.5

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 (59) hide show
  1. package/cli.d.ts +6 -0
  2. package/cli.js +47 -16
  3. package/cli.js.map +1 -1
  4. package/cli.mjs +47 -17
  5. package/cli.mjs.map +1 -1
  6. package/client/app-client.js +55 -28
  7. package/client/app-client.js.map +1 -1
  8. package/client/app-client.mjs +55 -28
  9. package/client/app-client.mjs.map +1 -1
  10. package/client/app-factory.js +26 -29
  11. package/client/app-factory.js.map +1 -1
  12. package/client/app-factory.mjs +26 -29
  13. package/client/app-factory.mjs.map +1 -1
  14. package/client/app-types.js +78 -28
  15. package/client/app-types.js.map +1 -1
  16. package/client/app-types.mjs +79 -29
  17. package/client/app-types.mjs.map +1 -1
  18. package/client/call-composer-types.js +6 -6
  19. package/client/call-composer-types.js.map +1 -1
  20. package/client/call-composer-types.mjs +6 -6
  21. package/client/call-composer-types.mjs.map +1 -1
  22. package/client/call-composer.js +11 -11
  23. package/client/call-composer.js.map +1 -1
  24. package/client/call-composer.mjs +11 -11
  25. package/client/call-composer.mjs.map +1 -1
  26. package/client/deploy-types.js +9 -9
  27. package/client/deploy-types.js.map +1 -1
  28. package/client/deploy-types.mjs +9 -9
  29. package/client/deploy-types.mjs.map +1 -1
  30. package/client/generate.js +1 -2
  31. package/client/generate.js.map +1 -1
  32. package/client/generate.mjs +1 -2
  33. package/client/generate.mjs.map +1 -1
  34. package/client/helpers/get-equivalent-type.js +2 -0
  35. package/client/helpers/get-equivalent-type.js.map +1 -1
  36. package/client/helpers/get-equivalent-type.mjs +2 -0
  37. package/client/helpers/get-equivalent-type.mjs.map +1 -1
  38. package/client/imports.js +2 -1
  39. package/client/imports.js.map +1 -1
  40. package/client/imports.mjs +2 -1
  41. package/client/imports.mjs.map +1 -1
  42. package/client/params-factory.js +11 -11
  43. package/client/params-factory.js.map +1 -1
  44. package/client/params-factory.mjs +11 -11
  45. package/client/params-factory.mjs.map +1 -1
  46. package/output/writer.d.ts +5 -5
  47. package/output/writer.js +9 -3
  48. package/output/writer.js.map +1 -1
  49. package/output/writer.mjs +9 -3
  50. package/output/writer.mjs.map +1 -1
  51. package/package.json +2 -2
  52. package/schema/load.js +7 -1
  53. package/schema/load.js.map +1 -1
  54. package/schema/load.mjs +7 -1
  55. package/schema/load.mjs.map +1 -1
  56. package/util/sanitization.js +1 -1
  57. package/util/sanitization.js.map +1 -1
  58. package/util/sanitization.mjs +1 -1
  59. package/util/sanitization.mjs.map +1 -1
@@ -78,57 +78,56 @@ function* appClient(ctx) {
78
78
  return this.appClient.appName
79
79
  }
80
80
 
81
+ /** The ARC-56 app spec being used */
82
+ public get appSpec() {
83
+ return this.appClient.appSpec
84
+ }
85
+
86
+ /** A reference to the underlying \`AlgorandClient\` this app client is using. */
87
+ public get algorand(): AlgorandClientInterface {
88
+ return this.appClient.algorand
89
+ }
90
+
81
91
  `;
82
92
  yield* params(ctx);
83
93
  yield* createTransaction(ctx);
84
94
  yield* send(ctx);
95
+ yield* readonlyMethods(ctx);
85
96
  yield* getStateMethods(ctx);
86
97
  yield* composeMethod(ctx);
87
98
  yield DecIndentAndCloseBlock;
88
99
  }
89
100
  function* params(ctx) {
90
101
  yield* jsDoc(`Get parameters to create transactions for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`);
91
- yield `readonly params = (($this) => {`;
92
- yield IncIndent;
93
- yield `return {`;
102
+ yield `readonly params = {`;
94
103
  yield IncIndent;
95
104
  yield* opMethods(ctx, 'params');
96
105
  yield* clearState(ctx, 'params');
97
106
  yield* call(ctx, 'params');
98
107
  yield* noopMethods(ctx, 'params');
99
108
  yield DecIndentAndCloseBlock;
100
- yield DecIndent;
101
- yield `})(this)`;
102
109
  yield NewLine;
103
110
  }
104
111
  function* createTransaction(ctx) {
105
112
  yield* jsDoc(`Create transactions for the current app`);
106
- yield `readonly createTransaction = (($this) => {`;
107
- yield IncIndent;
108
- yield `return {`;
113
+ yield `readonly createTransaction = {`;
109
114
  yield IncIndent;
110
115
  yield* opMethods(ctx, 'createTransaction');
111
116
  yield* clearState(ctx, 'createTransaction');
112
117
  yield* call(ctx, 'createTransaction');
113
118
  yield* noopMethods(ctx, 'createTransaction');
114
119
  yield DecIndentAndCloseBlock;
115
- yield DecIndent;
116
- yield `})(this)`;
117
120
  yield NewLine;
118
121
  }
119
122
  function* send(ctx) {
120
123
  yield* jsDoc(`Send calls to the current app`);
121
- yield `readonly send = (($this) => {`;
122
- yield IncIndent;
123
- yield `return {`;
124
+ yield `readonly send = {`;
124
125
  yield IncIndent;
125
126
  yield* opMethods(ctx, 'send');
126
127
  yield* clearState(ctx, 'send');
127
128
  yield* call(ctx, 'send');
128
129
  yield* noopMethods(ctx, 'send');
129
130
  yield DecIndentAndCloseBlock;
130
- yield DecIndent;
131
- yield `})(this)`;
132
131
  yield NewLine;
133
132
  }
134
133
  function* opMethods(ctx, type) {
@@ -147,16 +146,26 @@ function* bareMethodCall({ generator: { app }, name, description, verb, type, in
147
146
  },
148
147
  returns: `The ${verb} result`,
149
148
  });
150
- yield `${name}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) {`;
151
- yield* indent(`return $this.appClient.${type}.bare.${verb}(params)`);
149
+ yield `${name}: (params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
150
+ yield* indent(`return this.appClient.${type}.bare.${verb}(params)`);
152
151
  yield '},';
153
152
  }
154
- function* abiMethodCall({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, }) {
153
+ function* abiMethodCall({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, readonly, }) {
155
154
  const methodSig = new ABIMethod(method).getSignature();
156
155
  const uniqueName = methodSignatureToUniqueName[methodSig];
157
- const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : verb === 'call' ? getCallOnCompleteOptions(methodSig, app) : undefined;
156
+ const onComplete = verb === 'create'
157
+ ? getCreateOnCompleteOptions(methodSig, app)
158
+ : verb === 'call' && !readonly
159
+ ? getCallOnCompleteOptions(methodSig, app)
160
+ : undefined;
158
161
  yield* jsDoc({
159
- description: `${description} using the ${methodSig} ABI method.`,
162
+ description: verb === 'call' && method.readonly
163
+ ? [
164
+ `${description} using the \`${methodSig}\` ABI method.`,
165
+ '',
166
+ 'This method is a readonly method; calling it with onComplete of NoOp will result in a simulated transaction rather than a real transaction.',
167
+ ]
168
+ : `${description} using the \`${methodSig}\` ABI method.`,
160
169
  abiDescription: method?.desc,
161
170
  params: {
162
171
  params: `The params for the smart contract call`,
@@ -166,21 +175,22 @@ function* abiMethodCall({ generator: { app, methodSignatureToUniqueName, name, s
166
175
  const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
167
176
  const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
168
177
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
169
- yield `${type === 'send' ? 'async ' : ''}${methodName}(params: Expand<CallParams<'${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 `${!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 ? ' =>' : ''} {`;
170
179
  if (type === 'send') {
171
- yield* indent(`const result = await $this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`, `return {...result, return: result.return as undefined | MethodReturn<'${methodSigSafe}'>}`);
180
+ yield* indent(`const result = await this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`, readonly
181
+ ? `return result.return as ${name}Returns['${methodSigSafe}']`
182
+ : `return {...result, return: result.return as undefined | ${name}Returns['${methodSigSafe}']}`);
172
183
  }
173
184
  else {
174
- yield* indent(`return $this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`);
185
+ yield* indent(`return this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`);
175
186
  }
176
- yield '},';
187
+ yield `}${!readonly ? ',' : ''}`;
188
+ yield NewLine;
177
189
  }
178
190
  function* operationMethods(generator, description, methods, verb, type, includeCompilation) {
179
191
  if (methods.length) {
180
192
  yield* jsDoc(`Gets available ${verb} methods`);
181
- yield `get ${verb}() {`;
182
- yield IncIndent;
183
- yield `return {`;
193
+ yield `${verb}: {`;
184
194
  yield IncIndent;
185
195
  for (const methodSig of methods) {
186
196
  if (methodSig === BARE_CALL) {
@@ -205,7 +215,6 @@ function* operationMethods(generator, description, methods, verb, type, includeC
205
215
  });
206
216
  }
207
217
  }
208
- yield DecIndentAndCloseBlock;
209
218
  yield DecIndent;
210
219
  yield '},';
211
220
  yield NewLine;
@@ -233,6 +242,24 @@ function* call(generator, type) {
233
242
  yield NewLine;
234
243
  }
235
244
  }
245
+ function* readonlyMethods(generator) {
246
+ const { app, callConfig } = generator;
247
+ for (const method of app.methods) {
248
+ const methodSignature = new ABIMethod(method).getSignature();
249
+ // Skip non readonly methods
250
+ if (!callConfig.callMethods.includes(methodSignature) || !method.readonly)
251
+ continue;
252
+ yield* abiMethodCall({
253
+ generator,
254
+ description: `Makes a readonly (simulated) call to the ${generator.app.name} smart contract`,
255
+ method,
256
+ verb: 'call',
257
+ type: 'send',
258
+ includeCompilation: false,
259
+ readonly: true,
260
+ });
261
+ }
262
+ }
236
263
  function* noopMethods(generator, type) {
237
264
  const { app, callConfig } = generator;
238
265
  for (const method of app.methods) {
@@ -1 +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 { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCallOnCompleteOptions, getCreateOnCompleteOptions } from './deploy-types'\nimport { composeMethod } from './call-composer'\nimport { ABIMethod } from 'algosdk'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { getEquivalentType } from './helpers/get-equivalent-type'\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 /**\n * Checks for decode errors on the given return value and maps the return value to the return type for the given method\n * @returns The typed return value or undefined if there was no value\n */\n decodeReturnValue<TSignature extends ${name}NonVoidMethodSignatures>(method: TSignature, returnValue: ABIReturn | undefined) {\n return returnValue !== undefined ? getArc56ReturnValue<MethodReturn<TSignature>>(returnValue, this.appClient.getABIMethod(method), APP_SPEC.structs) : undefined\n }\n\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 `\n\n yield* params(ctx)\n yield* createTransaction(ctx)\n yield* send(ctx)\n\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 = (($this) => {`\n yield IncIndent\n yield `return {`\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 DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* createTransaction(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Create transactions for the current app`)\n yield `readonly createTransaction = (($this) => {`\n yield IncIndent\n yield `return {`\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 DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* send(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Send calls to the current app`)\n yield `readonly send = (($this) => {`\n yield IncIndent\n yield `return {`\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 DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* opMethods(ctx: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n type,\n true,\n )\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'delete', type)\n yield* operationMethods(\n ctx,\n `Opts the user into an existing instance of the ${app.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n type,\n )\n yield* operationMethods(\n ctx,\n `Makes a close out call to an existing instance of the ${app.name} smart contract`,\n callConfig.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' ? getCreateOnCompleteOptions(BARE_CALL, app) : verb === 'call' ? getCallOnCompleteOptions(BARE_CALL, app) : 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?.type ? ` & ${onComplete.type}` : ''}>) {`\n yield* indent(`return $this.appClient.${type}.bare.${verb}(params)`)\n yield '},'\n}\n\nfunction* abiMethodCall({\n generator: { app, methodSignatureToUniqueName, name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n method: Method\n description: string\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete' | 'call'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}) {\n const methodSig = new ABIMethod(method).getSignature()\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const onComplete =\n verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : verb === 'call' ? getCallOnCompleteOptions(methodSig, app) : 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 `${type === 'send' ? 'async ' : ''}${methodName}(params: Expand<CallParams<'${methodSigSafe}'>${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n verb === 'create' ? ' & CreateSchema' : ''\n }${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(', ')}]}` : ''}) {`\n if (type === 'send') {\n yield* indent(\n `const result = await $this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`,\n `return {...result, return: result.return as undefined | MethodReturn<'${methodSigSafe}'>}`,\n )\n } else {\n yield* indent(\n `return $this.appClient.${type}.${verb}(${name}ParamsFactory${verb !== 'call' ? `.${verb}` : ''}${methodNameAccessor}(params))`,\n )\n }\n yield '},'\n}\n\nfunction* operationMethods(\n generator: GeneratorContext,\n description: string,\n methods: MethodList,\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 `get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) {\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 const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n yield* abiMethodCall({\n generator,\n method,\n description,\n verb,\n type,\n includeCompilation,\n })\n }\n }\n yield DecIndentAndCloseBlock\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.callConfig.callMethods.includes(BARE_CALL)) {\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* noopMethods(generator: GeneratorContext, type: 'params' | 'createTransaction' | 'send'): DocumentParts {\n const { app, callConfig } = generator\n for (const method of app.methods) {\n const methodSignature = new ABIMethod(method).getSignature()\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\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) => ({' : ': {'}`\n yield IncIndent\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' ? '(address)' : ''}.getAll()`,\n `return {`,\n ...Object.keys(app.state.keys[storageType]).map((n) => {\n return ` ${sanitizer.makeSafePropertyIdentifier(n)}: ${app.state.keys[storageType][n].valueType === 'AVMBytes' ? `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 === 'AVMBytes' ? 'BinaryState' : `${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | undefined`}> => { return ${k.valueType === 'AVMBytes' ? 'new BinaryStateValue(' : ''}(await this.appClient.state.${storageType}${storageType === 'local' ? '(address)' : ''}.getValue(\"${name}\"))${k.valueType === 'AVMBytes' ? ' as Uint8Array | undefined)' : ` as ${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | 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<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}>> => { return (await this.appClient.state.${storageType}${storageType === 'local' ? '(address)' : ''}.getMap(\"${sanitizer.makeSafeStringTypeLiteral(n)}\")) as Map<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}> },`\n\n yield* jsDoc(`Get a current value of the ${n} map by key from ${storageType} state`)\n 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' ? '(address)' : ''}.getMapValue(\"${sanitizer.makeSafeStringTypeLiteral(n)}\", key) as ${getEquivalentType(m.valueType, 'output', { app, sanitizer })} | undefined },`\n\n yield DecIndent\n yield `},`\n }\n\n yield DecIndent\n yield `}${storageType === 'local' ? ')' : ''},`\n }\n\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n"],"names":[],"mappings":";;;;;;;AASe,UAAE,SAAS,CAAC,GAAqB,EAAA;AAC9C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAO,KAAK,CAAC,CAAA,8BAAA,EAAiC,GAAG,CAAC,IAAI,CAAiB,eAAA,CAAA,CAAC,CAAA;IACxE,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,QAAA,CAAU,CAAA;AACpC,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,OAAO,KAAK,CAAC,CAAA,uEAAA,CAAyE,CAAC,CAAA;AACvF,IAAA,MAAM,sCAAsC,CAAA;AAC5C,IAAA,MAAM,OAAO,CAAA;IAEb,MAAM,CAAA;;qCAE6B,IAAI,CAAA;;oFAE2C,IAAI,CAAA;;;;qCAInD,IAAI,CAAA;;;;;;;;;;;;;;;;2CAgBE,IAAI,CAAA;;;;;yBAKtB,IAAI,CAAA;;;;iHAIoF,IAAI,CAAA;mBAClG,IAAI,CAAA;;;;sBAID,IAAI,CAAA;;;;;;;;iBAQT,IAAI,CAAA;mBACF,IAAI,CAAA;;;;;;;;;;;;;;;;;;GAkBpB,CAAA;AAED,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;AAClB,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAA;AAC7B,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAEhB,IAAA,OAAO,eAAe,CAAC,GAAG,CAAC,CAAA;AAC3B,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;AACzB,IAAA,MAAM,sBAAsB,CAAA;AAC9B,CAAC;AAED,UAAU,MAAM,CAAC,GAAqB,EAAA;AACpC,IAAA,OAAO,KAAK,CACV,CAAA,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AAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAA,EAAA,EAAK,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,MAAM,CAAA;YAEzc,OAAO,KAAK,CAAC,CAAA,2BAAA,EAA8B,CAAC,CAAoB,iBAAA,EAAA,WAAW,CAAQ,MAAA,CAAA,CAAC,CAAA;AACpF,YAAA,MAAM,CAAsB,mBAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAc,WAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,wDAAwD,WAAW,CAAA,EAAG,WAAW,KAAK,OAAO,GAAG,WAAW,GAAG,EAAE,CAAiB,cAAA,EAAA,SAAS,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAc,WAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAA;AAEja,YAAA,MAAM,SAAS,CAAA;AACf,YAAA,MAAM,IAAI,CAAA;SACX;AAED,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,MAAM,CAAI,CAAA,EAAA,WAAW,KAAK,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,CAAA;KAChD;AAED,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,OAAO,CAAA;AACf;;;;"}
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 { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCallOnCompleteOptions, getCreateOnCompleteOptions } from './deploy-types'\nimport { composeMethod } from './call-composer'\nimport { ABIMethod } from 'algosdk'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { getEquivalentType } from './helpers/get-equivalent-type'\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 /**\n * Checks for decode errors on the given return value and maps the return value to the return type for the given method\n * @returns The typed return value or undefined if there was no value\n */\n decodeReturnValue<TSignature extends ${name}NonVoidMethodSignatures>(method: TSignature, returnValue: ABIReturn | undefined) {\n return returnValue !== undefined ? getArc56ReturnValue<MethodReturn<TSignature>>(returnValue, this.appClient.getABIMethod(method), APP_SPEC.structs) : undefined\n }\n\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(): AlgorandClientInterface {\n return this.appClient.algorand\n }\n\n `\n\n yield* params(ctx)\n yield* createTransaction(ctx)\n yield* send(ctx)\n yield* readonlyMethods(ctx)\n\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, callConfig } = ctx\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n type,\n true,\n )\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'delete', type)\n yield* operationMethods(\n ctx,\n `Opts the user into an existing instance of the ${app.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n type,\n )\n yield* operationMethods(\n ctx,\n `Makes a close out call to an existing instance of the ${app.name} smart contract`,\n callConfig.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' ? getCreateOnCompleteOptions(BARE_CALL, app) : verb === 'call' ? getCallOnCompleteOptions(BARE_CALL, app) : 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?.type ? ` & ${onComplete.type}` : ''}>) => {`\n yield* indent(`return this.appClient.${type}.bare.${verb}(params)`)\n yield '},'\n}\n\nfunction* abiMethodCall({\n generator: { app, methodSignatureToUniqueName, name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n readonly,\n}: {\n generator: GeneratorContext\n method: Method\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 = new ABIMethod(method).getSignature()\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const onComplete =\n verb === 'create'\n ? getCreateOnCompleteOptions(methodSig, app)\n : verb === 'call' && !readonly\n ? getCallOnCompleteOptions(methodSig, app)\n : undefined\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?.type && !readonly ? ` & ${onComplete.type}` : ''}${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 ${name}Returns['${methodSigSafe}']`\n : `return {...result, return: result.return 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: MethodList,\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 methodSig of methods) {\n if (methodSig === BARE_CALL) {\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 const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\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.callConfig.callMethods.includes(BARE_CALL)) {\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, callConfig } = generator\n for (const method of app.methods) {\n const methodSignature = new ABIMethod(method).getSignature()\n // Skip non readonly methods\n if (!callConfig.callMethods.includes(methodSignature) || !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, callConfig } = generator\n for (const method of app.methods) {\n const methodSignature = new ABIMethod(method).getSignature()\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\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) => ({' : ': {'}`\n yield IncIndent\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' ? '(address)' : ''}.getAll()`,\n `return {`,\n ...Object.keys(app.state.keys[storageType]).map((n) => {\n return ` ${sanitizer.makeSafePropertyIdentifier(n)}: ${app.state.keys[storageType][n].valueType === 'AVMBytes' ? `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 === 'AVMBytes' ? 'BinaryState' : `${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | undefined`}> => { return ${k.valueType === 'AVMBytes' ? 'new BinaryStateValue(' : ''}(await this.appClient.state.${storageType}${storageType === 'local' ? '(address)' : ''}.getValue(\"${name}\"))${k.valueType === 'AVMBytes' ? ' as Uint8Array | undefined)' : ` as ${getEquivalentType(k.valueType, 'output', { app, sanitizer })} | 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<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}>> => { return (await this.appClient.state.${storageType}${storageType === 'local' ? '(address)' : ''}.getMap(\"${sanitizer.makeSafeStringTypeLiteral(n)}\")) as Map<${getEquivalentType(m.keyType, 'output', { app, sanitizer })}, ${getEquivalentType(m.valueType, 'output', { app, sanitizer })}> },`\n\n yield* jsDoc(`Get a current value of the ${n} map by key from ${storageType} state`)\n 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' ? '(address)' : ''}.getMapValue(\"${sanitizer.makeSafeStringTypeLiteral(n)}\", key) as ${getEquivalentType(m.valueType, 'output', { app, sanitizer })} | undefined },`\n\n yield DecIndent\n yield `},`\n }\n\n yield DecIndent\n yield `}${storageType === 'local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AAA,MAAM,CAAsB,mBAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAc,WAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,wDAAwD,WAAW,CAAA,EAAG,WAAW,KAAK,OAAO,GAAG,WAAW,GAAG,EAAE,CAAiB,cAAA,EAAA,SAAS,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAc,WAAA,EAAA,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAA;AAEja,YAAA,MAAM,SAAS,CAAA;AACf,YAAA,MAAM,IAAI,CAAA;SACX;AAED,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,MAAM,CAAI,CAAA,EAAA,WAAW,KAAK,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,CAAA;KAChD;AAED,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,OAAO,CAAA;AACf;;;;"}
@@ -27,6 +27,21 @@ function* appFactory(ctx) {
27
27
  })
28
28
  }
29
29
 
30
+ /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
31
+ public get appName() {
32
+ return this.appFactory.appName
33
+ }
34
+
35
+ /** The ARC-56 app spec being used */
36
+ get appSpec() {
37
+ return APP_SPEC
38
+ }
39
+
40
+ /** A reference to the underlying \`AlgorandClient\` this app factory is using. */
41
+ public get algorand(): AlgorandClientInterface {
42
+ return this.appFactory.algorand
43
+ }
44
+
30
45
  /**
31
46
  * Returns a new \`AppClient\` client for an app instance of the given ID.
32
47
  *
@@ -62,47 +77,33 @@ function* appFactory(ctx) {
62
77
  }
63
78
  function* params(ctx) {
64
79
  yield* writer.jsDoc(`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.`);
65
- yield `readonly params = (($this) => {`;
66
- yield writer.IncIndent;
67
- yield `return {`;
80
+ yield `readonly params = {`;
68
81
  yield writer.IncIndent;
69
82
  yield* paramMethods(ctx);
70
83
  yield writer.DecIndentAndCloseBlock;
71
- yield writer.DecIndent;
72
- yield `})(this)`;
73
84
  yield writer.NewLine;
74
85
  }
75
86
  function* createTransaction(ctx) {
76
87
  yield* writer.jsDoc(`Create transactions for the current app`);
77
- yield `readonly createTransaction = (($this) => {`;
78
- yield writer.IncIndent;
79
- yield `return {`;
88
+ yield `readonly createTransaction = {`;
80
89
  yield writer.IncIndent;
81
90
  yield* createTransactionMethods(ctx);
82
91
  yield writer.DecIndentAndCloseBlock;
83
- yield writer.DecIndent;
84
- yield `})(this)`;
85
92
  yield writer.NewLine;
86
93
  }
87
94
  function* send(ctx) {
88
95
  yield* writer.jsDoc(`Send calls to the current app`);
89
- yield `readonly send = (($this) => {`;
90
- yield writer.IncIndent;
91
- yield `return {`;
96
+ yield `readonly send = {`;
92
97
  yield writer.IncIndent;
93
98
  yield* createMethods(ctx);
94
99
  yield writer.DecIndentAndCloseBlock;
95
- yield writer.DecIndent;
96
- yield `})(this)`;
97
100
  yield writer.NewLine;
98
101
  }
99
102
  function* createMethods(generator) {
100
103
  const { app } = generator;
101
104
  if (generator.callConfig.createMethods.length) {
102
105
  yield* writer.jsDoc(`Gets available create methods`);
103
- yield `get create() {`;
104
- yield writer.IncIndent;
105
- yield `return {`;
106
+ yield `create: {`;
106
107
  yield writer.IncIndent;
107
108
  for (const methodSig of generator.callConfig.createMethods) {
108
109
  if (methodSig === getCallConfigSummary.BARE_CALL) {
@@ -127,7 +128,6 @@ function* createMethods(generator) {
127
128
  });
128
129
  }
129
130
  }
130
- yield writer.DecIndentAndCloseBlock;
131
131
  yield writer.DecIndent;
132
132
  yield '},';
133
133
  yield writer.NewLine;
@@ -152,12 +152,12 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
152
152
  },
153
153
  returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,
154
154
  });
155
- yield `${type === 'send' ? 'async ' : ''}${name}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) {`;
155
+ yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
156
156
  if (type === 'params' || type === 'createTransaction') {
157
- yield* writer.indent(`return $this.appFactory.${type}.bare.${verb}(params)`);
157
+ yield* writer.indent(`return this.appFactory.${type}.bare.${verb}(params)`);
158
158
  }
159
159
  else {
160
- yield* writer.indent(`const result = await $this.appFactory.send.bare.create(params)`, `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`);
160
+ yield* writer.indent(`const result = await this.appFactory.send.bare.create(params)`, `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`);
161
161
  }
162
162
  yield '},';
163
163
  }
@@ -176,21 +176,19 @@ function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, n
176
176
  const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
177
177
  const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
178
178
  const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
179
- yield `${type === 'send' ? 'async ' : ''}${methodName}(params: Expand<CallParams<'${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(', ')}]}` : ''}) {`;
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(', ')}]}` : ''}) => {`;
180
180
  if (type === 'params' || type === 'createTransaction') {
181
- yield* writer.indent(`return $this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
181
+ yield* writer.indent(`return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
182
182
  }
183
183
  else {
184
- yield* writer.indent(`const result = await $this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`, `return { result: { ...result.result, return: result.result.return as undefined | MethodReturn<'${methodSigSafe}'> }, appClient: new ${name}Client(result.appClient) }`);
184
+ yield* writer.indent(`const result = await this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`, `return { result: { ...result.result, return: result.result.return as undefined | ${name}Returns['${methodSigSafe}'] }, appClient: new ${name}Client(result.appClient) }`);
185
185
  }
186
186
  yield '},';
187
187
  }
188
188
  function* operationMethods(generator, description, methods, verb, includeCompilation) {
189
189
  if (methods.length) {
190
190
  yield* writer.jsDoc(`Gets available ${verb} methods`);
191
- yield `get ${verb}() {`;
192
- yield writer.IncIndent;
193
- yield `return {`;
191
+ yield `${verb}: {`;
194
192
  yield writer.IncIndent;
195
193
  for (const methodSig of methods) {
196
194
  if (methodSig === getCallConfigSummary.BARE_CALL) {
@@ -215,7 +213,6 @@ function* operationMethods(generator, description, methods, verb, includeCompila
215
213
  });
216
214
  }
217
215
  }
218
- yield writer.DecIndentAndCloseBlock;
219
216
  yield writer.DecIndent;
220
217
  yield '},';
221
218
  yield writer.NewLine;
@@ -1 +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'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { ABIMethod } from 'algosdk'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\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 /**\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 = (($this) => {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield* paramMethods(ctx)\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* createTransaction(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Create transactions for the current app`)\n yield `readonly createTransaction = (($this) => {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield* createTransactionMethods(ctx)\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* send(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Send calls to the current app`)\n yield `readonly send = (($this) => {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield* createMethods(ctx)\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `})(this)`\n yield NewLine\n}\n\nfunction* createMethods(generator: GeneratorContext): DocumentParts {\n const { app } = generator\n if (generator.callConfig.createMethods.length) {\n yield* jsDoc(`Gets available create methods`)\n yield `get create() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n for (const methodSig of generator.callConfig.createMethods) {\n if (methodSig === BARE_CALL) {\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 const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\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 DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* paramMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'deployUpdate',\n true,\n )\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete')\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\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' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined\n yield* jsDoc({\n description: `${description}.`,\n params: {\n params: `The params for the bare (raw) call`,\n },\n returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,\n })\n yield `${type === 'send' ? 'async ' : ''}${name}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) {`\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: { app, methodSignatureToUniqueName, name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n method: Method\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}) {\n const methodSig = new ABIMethod(method).getSignature()\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : 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 `${type === 'send' ? 'async ' : ''}${methodName}(params: Expand<CallParams<'${methodSigSafe}'>${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n verb === 'create' ? ' & CreateSchema' : ''\n }${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(', ')}]}` : ''}) {`\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 undefined | MethodReturn<'${methodSigSafe}'> }, appClient: new ${name}Client(result.appClient) }`,\n )\n }\n yield '},'\n}\n\nfunction* operationMethods(\n generator: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'deployUpdate' | 'deployDelete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `${description} using a bare call`,\n verb,\n type: 'params',\n includeCompilation,\n })\n } else {\n const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n yield* abiMethodCallParams({\n generator,\n method,\n description,\n verb,\n type: 'params',\n includeCompilation,\n })\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* deployMethod(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig, 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 (callConfig.createMethods.filter((m) => m !== BARE_CALL).length) {\n yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams,`\n }\n if (callConfig.updateMethods.filter((m) => m !== BARE_CALL).length) {\n yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams,`\n }\n if (callConfig.deleteMethods.filter((m) => m !== BARE_CALL).length) {\n yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams,`\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","DecIndent","BARE_CALL","ABIMethod","getCreateOnCompleteOptions","indent"],"mappings":";;;;;;;AAOe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAOA,YAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAuG,qGAAA,CAAA,CAC9K,CAAA;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW,CAAA;AACrC,IAAA,MAAMC,gBAAS,CAAA;AACf,IAAA,OAAOD,YAAK,CAAC,CAAA,wEAAA,CAA0E,CAAC,CAAA;AACxF,IAAA,MAAM,wCAAwC,CAAA;AAC9C,IAAA,MAAME,cAAO,CAAA;IAEb,OAAOF,YAAK,CAAC;QACX,WAAW,EAAE,CAA+B,4BAAA,EAAA,IAAI,CAAW,SAAA,CAAA;AAC3D,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,mDAAmD;AAC5D,SAAA;AACF,KAAA,CAAC,CAAA;IAEF,MAAM,CAAA;;;;;;;;;;;;;;;;;mBAiBW,IAAI,CAAA;;;;;;;;;;;;;;;mBAeJ,IAAI,CAAA;;GAEpB,CAAA;AAED,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,CAAA;AACxB,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;AAClB,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAA;AAC7B,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAChB,IAAA,MAAMG,6BAAsB,CAAA;AAC9B,CAAC;AAED,UAAU,MAAM,CAAC,GAAqB,EAAA;AACpC,IAAA,OAAOH,YAAK,CACV,CAAA,6LAAA,CAA+L,CAChM,CAAA;AACD,IAAA,MAAM,iCAAiC,CAAA;AACvC,IAA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AC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAKI,8BAAS,CAAC,CAAC,MAAM,EAAE;QAClE,MAAM,CAAA,4CAAA,EAA+C,IAAI,CAAA,iFAAA,CAAmF,CAAA;KAC7I;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAKA,8BAAS,CAAC,CAAC,MAAM,EAAE;QAClE,MAAM,CAAA,4CAAA,EAA+C,IAAI,CAAA,iFAAA,CAAmF,CAAA;KAC7I;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAKA,8BAAS,CAAC,CAAC,MAAM,EAAE;QAClE,MAAM,CAAA,4CAAA,EAA+C,IAAI,CAAA,iFAAA,CAAmF,CAAA;KAC7I;AACD,IAAA,MAAMD,gBAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;IACV,MAAM,CAAA,+CAAA,EAAkD,IAAI,CAAA,0BAAA,CAA4B,CAAA;AACxF,IAAA,MAAMD,6BAAsB,CAAA;AAC5B,IAAA,MAAMD,cAAO,CAAA;AACf;;;;"}
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'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { ABIMethod } from 'algosdk'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\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(): AlgorandClientInterface {\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 (generator.callConfig.createMethods.length) {\n yield* jsDoc(`Gets available create methods`)\n yield `create: {`\n yield IncIndent\n for (const methodSig of generator.callConfig.createMethods) {\n if (methodSig === BARE_CALL) {\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 const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\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, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'deployUpdate',\n true,\n )\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete')\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\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' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined\n yield* jsDoc({\n description: `${description}.`,\n params: {\n params: `The params for the bare (raw) call`,\n },\n returns: type === 'params' ? `The params for a ${verb} call` : `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?.type ? ` & ${onComplete.type}` : ''}>) => {`\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: { app, methodSignatureToUniqueName, name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n method: Method\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}) {\n const methodSig = new ABIMethod(method).getSignature()\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : 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?.type ? ` & ${onComplete.type}` : ''}${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 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: MethodList,\n verb: 'create' | 'deployUpdate' | 'deployDelete',\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 methodSig of methods) {\n if (methodSig === BARE_CALL) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `${description} using a bare call`,\n verb,\n type: 'params',\n includeCompilation,\n })\n } else {\n const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n yield* abiMethodCallParams({\n generator,\n method,\n description,\n verb,\n type: 'params',\n includeCompilation,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* deployMethod(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig, 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 (callConfig.createMethods.filter((m) => m !== BARE_CALL).length) {\n yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams,`\n }\n if (callConfig.updateMethods.filter((m) => m !== BARE_CALL).length) {\n yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams,`\n }\n if (callConfig.deleteMethods.filter((m) => m !== BARE_CALL).length) {\n yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams,`\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","BARE_CALL","ABIMethod","DecIndent","getCreateOnCompleteOptions","indent"],"mappings":";;;;;;;AAOe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAOA,YAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAuG,qGAAA,CAAA,CAC9K,CAAA;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW,CAAA;AACrC,IAAA,MAAMC,gBAAS,CAAA;AACf,IAAA,OAAOD,YAAK,CAAC,CAAA,wEAAA,CAA0E,CAAC,CAAA;AACxF,IAAA,MAAM,wCAAwC,CAAA;AAC9C,IAAA,MAAME,cAAO,CAAA;IAEb,OAAOF,YAAK,CAAC;QACX,WAAW,EAAE,CAA+B,4BAAA,EAAA,I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