@algorandfoundation/algokit-client-generator 2.6.1-beta.1 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/{cli.cjs → cli.js} +8 -6
  2. package/cli.js.map +1 -0
  3. package/cli.mjs +4 -2
  4. package/cli.mjs.map +1 -0
  5. package/client/{app-types.cjs → app-types.js} +20 -16
  6. package/client/app-types.js.map +1 -0
  7. package/client/app-types.mjs +18 -14
  8. package/client/app-types.mjs.map +1 -0
  9. package/client/{call-client.cjs → call-client.js} +30 -21
  10. package/client/call-client.js.map +1 -0
  11. package/client/call-client.mjs +26 -17
  12. package/client/call-client.mjs.map +1 -0
  13. package/client/{call-composer-types.cjs → call-composer-types.js} +11 -9
  14. package/client/call-composer-types.js.map +1 -0
  15. package/client/call-composer-types.mjs +8 -6
  16. package/client/call-composer-types.mjs.map +1 -0
  17. package/client/{call-composer.cjs → call-composer.js} +16 -12
  18. package/client/call-composer.js.map +1 -0
  19. package/client/call-composer.mjs +13 -9
  20. package/client/call-composer.mjs.map +1 -0
  21. package/client/{call-factory.cjs → call-factory.js} +16 -12
  22. package/client/call-factory.js.map +1 -0
  23. package/client/call-factory.mjs +13 -9
  24. package/client/call-factory.mjs.map +1 -0
  25. package/client/deploy-types.d.ts +1 -1
  26. package/client/{deploy-types.cjs → deploy-types.js} +12 -9
  27. package/client/deploy-types.js.map +1 -0
  28. package/client/deploy-types.mjs +9 -6
  29. package/client/deploy-types.mjs.map +1 -0
  30. package/client/generate.d.ts +2 -1
  31. package/client/{generate.cjs → generate.js} +12 -11
  32. package/client/generate.js.map +1 -0
  33. package/client/generate.mjs +3 -2
  34. package/client/generate.mjs.map +1 -0
  35. package/client/generator-context.d.ts +7 -1
  36. package/client/{generator-context.cjs → generator-context.js} +17 -12
  37. package/client/generator-context.js.map +1 -0
  38. package/client/generator-context.mjs +16 -11
  39. package/client/generator-context.mjs.map +1 -0
  40. package/client/helpers/{get-call-config-summary.cjs → get-call-config-summary.js} +1 -0
  41. package/client/helpers/get-call-config-summary.js.map +1 -0
  42. package/client/helpers/get-call-config-summary.mjs +1 -0
  43. package/client/helpers/get-call-config-summary.mjs.map +1 -0
  44. package/client/helpers/{get-equivalent-type.cjs → get-equivalent-type.js} +1 -0
  45. package/client/helpers/get-equivalent-type.js.map +1 -0
  46. package/client/helpers/get-equivalent-type.mjs +1 -0
  47. package/client/helpers/get-equivalent-type.mjs.map +1 -0
  48. package/client/{imports.cjs → imports.js} +1 -0
  49. package/client/imports.js.map +1 -0
  50. package/client/imports.mjs +1 -0
  51. package/client/imports.mjs.map +1 -0
  52. package/client/{utility-types.cjs → utility-types.js} +2 -1
  53. package/client/utility-types.js.map +1 -0
  54. package/client/utility-types.mjs +1 -0
  55. package/client/utility-types.mjs.map +1 -0
  56. package/{index.cjs → index.js} +4 -3
  57. package/index.js.map +1 -0
  58. package/index.mjs +1 -0
  59. package/index.mjs.map +1 -0
  60. package/output/{writer.cjs → writer.js} +1 -0
  61. package/output/writer.js.map +1 -0
  62. package/output/writer.mjs +1 -0
  63. package/output/writer.mjs.map +1 -0
  64. package/package.json +4 -2
  65. package/schema/{application.schema.json.cjs → application.schema.json.js} +1 -0
  66. package/schema/application.schema.json.js.map +1 -0
  67. package/schema/application.schema.json.mjs +1 -0
  68. package/schema/application.schema.json.mjs.map +1 -0
  69. package/schema/{contract.schema.json.cjs → contract.schema.json.js} +1 -0
  70. package/schema/contract.schema.json.js.map +1 -0
  71. package/schema/contract.schema.json.mjs +1 -0
  72. package/schema/contract.schema.json.mjs.map +1 -0
  73. package/schema/{load.cjs → load.js} +4 -3
  74. package/schema/load.js.map +1 -0
  75. package/schema/load.mjs +1 -0
  76. package/schema/load.mjs.map +1 -0
  77. package/util/{boom.cjs → boom.js} +1 -0
  78. package/util/boom.js.map +1 -0
  79. package/util/boom.mjs +1 -0
  80. package/util/boom.mjs.map +1 -0
  81. package/util/{color-console.cjs → color-console.js} +1 -0
  82. package/util/color-console.js.map +1 -0
  83. package/util/color-console.mjs +1 -0
  84. package/util/color-console.mjs.map +1 -0
  85. package/util/sanitization.d.ts +12 -5
  86. package/util/sanitization.js +56 -0
  87. package/util/sanitization.js.map +1 -0
  88. package/util/sanitization.mjs +50 -7
  89. package/util/sanitization.mjs.map +1 -0
  90. package/util/sanitization.cjs +0 -17
@@ -1,6 +1,5 @@
1
1
  import * as algokit from '@algorandfoundation/algokit-utils';
2
2
  import { jsDoc, IncIndent, NewLine, indent, DecIndent, inline, DecIndentAndCloseBlock } from '../output/writer.mjs';
3
- import { makeSafeTypeIdentifier, makeSafeMethodIdentifier } from '../util/sanitization.mjs';
4
3
  import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
5
4
  import { getCreateOnCompleteOptions } from './deploy-types.mjs';
6
5
  import { composeMethod } from './call-composer.mjs';
@@ -8,7 +7,7 @@ import { composeMethod } from './call-composer.mjs';
8
7
  function* callClient(ctx) {
9
8
  const { app, name } = ctx;
10
9
  yield* jsDoc(`A client to make calls to the ${app.contract.name} smart contract`);
11
- yield `export class ${makeSafeTypeIdentifier(app.contract.name)}Client {`;
10
+ yield `export class ${ctx.sanitizer.makeSafeTypeIdentifier(app.contract.name)}Client {`;
12
11
  yield IncIndent;
13
12
  yield* jsDoc(`The underlying \`ApplicationClient\` for when you want to have more flexibility`);
14
13
  yield 'public readonly appClient: ApplicationClient';
@@ -16,7 +15,7 @@ function* callClient(ctx) {
16
15
  yield `private readonly sender: SendTransactionFrom | undefined`;
17
16
  yield NewLine;
18
17
  yield* jsDoc({
19
- description: `Creates a new instance of \`${makeSafeTypeIdentifier(app.contract.name)}Client\``,
18
+ description: `Creates a new instance of \`${ctx.sanitizer.makeSafeTypeIdentifier(app.contract.name)}Client\``,
20
19
  params: {
21
20
  appDetails: 'appDetails The details to identify the app to deploy',
22
21
  algod: 'An algod client instance',
@@ -110,7 +109,7 @@ function* opMethods(ctx) {
110
109
  yield* operationMethod(ctx, `Opts the user into an existing instance of the ${app.contract.name} smart contract`, callConfig.optInMethods, 'optIn');
111
110
  yield* operationMethod(ctx, `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`, callConfig.closeOutMethods, 'closeOut');
112
111
  }
113
- function* operationMethod({ app, methodSignatureToUniqueName, name }, description, methods, verb, includeCompilation) {
112
+ function* operationMethod({ app, methodSignatureToUniqueName, name, sanitizer }, description, methods, verb, includeCompilation) {
114
113
  let responseTypeGenericParam;
115
114
  switch (verb) {
116
115
  case 'create':
@@ -155,8 +154,11 @@ function* operationMethod({ app, methodSignatureToUniqueName, name }, descriptio
155
154
  },
156
155
  returns: `The ${verb} result${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,
157
156
  });
158
- yield `async ${makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSig}'>, params: AppClientCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false ? ' = {}' : ''}) {`;
159
- yield* indent(`return $this.mapReturnValue<MethodReturn<'${methodSig}'>${responseTypeGenericParam}>(await $this.appClient.${verb}(${name}CallFactory.${verb}.${makeSafeMethodIdentifier(uniqueName)}(args, params)))`);
157
+ const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
158
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
159
+ const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
160
+ yield `async ${methodName}(args: MethodArgs<'${methodSigSafe}'>, params: AppClientCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false ? ' = {}' : ''}) {`;
161
+ yield* indent(`return $this.mapReturnValue<MethodReturn<'${methodSigSafe}'>${responseTypeGenericParam}>(await $this.appClient.${verb}(${name}CallFactory.${verb}${methodNameAccessor}(args, params)))`);
160
162
  yield '},';
161
163
  }
162
164
  }
@@ -179,10 +181,11 @@ function* clearState({ app }) {
179
181
  yield DecIndentAndCloseBlock;
180
182
  yield NewLine;
181
183
  }
182
- function* noopMethods({ app, name, callConfig, methodSignatureToUniqueName }) {
184
+ function* noopMethods({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
183
185
  for (const method of app.contract.methods) {
184
186
  const methodSignature = algokit.getABIMethodSignature(method);
185
- const methodName = makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
187
+ const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
188
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
186
189
  // Skip methods which don't support a no_op call config
187
190
  if (!callConfig.callMethods.includes(methodSignature))
188
191
  continue;
@@ -195,16 +198,17 @@ function* noopMethods({ app, name, callConfig, methodSignatureToUniqueName }) {
195
198
  },
196
199
  returns: `The result of the call${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,
197
200
  });
198
- yield `public ${methodName}(args: MethodArgs<'${methodSignature}'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) {`;
201
+ const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
202
+ yield `public ${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) {`;
199
203
  yield IncIndent;
200
204
  const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name;
201
- yield `return this.call(${name}CallFactory.${methodName}(args, params)${outputTypeName === undefined ? '' : `, ${makeSafeTypeIdentifier(outputTypeName)}`})`;
205
+ yield `return this.call(${name}CallFactory${methodNameAccessor}(args, params)${outputTypeName === undefined ? '' : `, ${sanitizer.makeSafeTypeIdentifier(outputTypeName)}`})`;
202
206
  yield DecIndent;
203
207
  yield '}';
204
208
  yield NewLine;
205
209
  }
206
210
  }
207
- function* getStateMethods({ app, name }) {
211
+ function* getStateMethods({ app, name, sanitizer }) {
208
212
  const globalStateValues = app.schema.global?.declared && Object.values(app.schema.global?.declared);
209
213
  const localStateValues = app.schema.local?.declared && Object.values(app.schema.local?.declared);
210
214
  if (globalStateValues?.length || localStateValues?.length) {
@@ -267,12 +271,14 @@ function* getStateMethods({ app, name }) {
267
271
  yield `return {`;
268
272
  yield IncIndent;
269
273
  for (const stateValue of globalStateValues) {
270
- yield `get ${stateValue.key}() {`;
274
+ const stateKey = sanitizer.makeSafePropertyIdentifier(stateValue.key);
275
+ const stateKeyLiteral = sanitizer.makeSafeStringTypeLiteral(stateValue.key);
276
+ yield `get ${stateKey}() {`;
271
277
  if (stateValue.type === 'uint64') {
272
- yield* indent(`return ${name}Client.getIntegerState(state, '${stateValue.key}')`);
278
+ yield* indent(`return ${name}Client.getIntegerState(state, '${stateKeyLiteral}')`);
273
279
  }
274
280
  else {
275
- yield* indent(`return ${name}Client.getBinaryState(state, '${stateValue.key}')`);
281
+ yield* indent(`return ${name}Client.getBinaryState(state, '${stateKeyLiteral}')`);
276
282
  }
277
283
  yield '},';
278
284
  }
@@ -293,12 +299,14 @@ function* getStateMethods({ app, name }) {
293
299
  yield `return {`;
294
300
  yield IncIndent;
295
301
  for (const stateValue of localStateValues) {
296
- yield `get ${stateValue.key}() {`;
302
+ const stateKey = sanitizer.makeSafePropertyIdentifier(stateValue.key);
303
+ const stateKeyLiteral = sanitizer.makeSafeStringTypeLiteral(stateValue.key);
304
+ yield `get ${stateKey}() {`;
297
305
  if (stateValue.type === 'uint64') {
298
- yield* indent(`return ${name}Client.getIntegerState(state, '${stateValue.key}')`);
306
+ yield* indent(`return ${name}Client.getIntegerState(state, '${stateKeyLiteral}')`);
299
307
  }
300
308
  else {
301
- yield* indent(`return ${name}Client.getBinaryState(state, '${stateValue.key}')`);
309
+ yield* indent(`return ${name}Client.getBinaryState(state, '${stateKeyLiteral}')`);
302
310
  }
303
311
  yield '},';
304
312
  }
@@ -309,3 +317,4 @@ function* getStateMethods({ app, name }) {
309
317
  }
310
318
 
311
319
  export { callClient };
320
+ //# sourceMappingURL=call-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-client.mjs","sources":["../../src/client/call-client.ts"],"sourcesContent":["import * as algokit from '@algorandfoundation/algokit-utils'\nimport { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, inline, jsDoc, NewLine } from '../output/writer'\n\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { composeMethod } from './call-composer'\n\nexport function* callClient(ctx: GeneratorContext): DocumentParts {\n const { app, name } = ctx\n\n yield* jsDoc(`A client to make calls to the ${app.contract.name} smart contract`)\n yield `export class ${ctx.sanitizer.makeSafeTypeIdentifier(app.contract.name)}Client {`\n yield IncIndent\n yield* jsDoc(`The underlying \\`ApplicationClient\\` for when you want to have more flexibility`)\n yield 'public readonly appClient: ApplicationClient'\n yield NewLine\n yield `private readonly sender: SendTransactionFrom | undefined`\n yield NewLine\n\n yield* jsDoc({\n description: `Creates a new instance of \\`${ctx.sanitizer.makeSafeTypeIdentifier(app.contract.name)}Client\\``,\n params: {\n appDetails: 'appDetails The details to identify the app to deploy',\n algod: 'An algod client instance',\n },\n })\n\n yield `constructor(appDetails: AppDetails, private algod: Algodv2) {`\n yield IncIndent\n yield `this.sender = appDetails.sender`\n yield 'this.appClient = algokit.getAppClient({'\n yield* indent('...appDetails,', 'app: APP_SPEC')\n yield '}, algod)'\n yield DecIndent\n yield '}'\n yield NewLine\n\n yield* jsDoc({\n description: 'Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type',\n params: {\n result: 'The AppCallTransactionResult to be mapped',\n returnValueFormatter: 'An optional delegate to format the return value if required',\n },\n returns: 'The smart contract response with an updated return value',\n })\n yield* inline(\n `protected mapReturnValue<TReturn, TResult extends AppCallTransactionResult = AppCallTransactionResult>`,\n `(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): `,\n `AppCallTransactionResultOfType<TReturn> & TResult {`,\n )\n yield IncIndent\n yield `if(result.return?.decodeError) {`\n yield* indent(`throw result.return.decodeError`)\n yield `}`\n yield `const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined`\n yield IncIndent\n yield `? returnValueFormatter(result.return.returnValue)`\n yield `: result.return?.returnValue as TReturn | undefined`\n yield `return { ...result, return: returnValue } as AppCallTransactionResultOfType<TReturn> & TResult`\n yield DecIndent\n yield DecIndentAndCloseBlock\n yield NewLine\n\n yield* jsDoc({\n description: 'Calls the ABI method with the matching signature using an onCompletion code of NO_OP',\n params: {\n typedCallParams: 'An object containing the method signature, args, and any other relevant parameters',\n returnValueFormatter: 'An optional delegate which when provided will be used to map non-undefined return values to the target type',\n },\n returns: 'The result of the smart contract call',\n })\n yield `public async call<TSignature extends keyof ${name}['methods']>(typedCallParams: TypedCallParams<TSignature>, returnValueFormatter?: (value: any) => MethodReturn<TSignature>) {`\n yield IncIndent\n yield `return this.mapReturnValue<MethodReturn<TSignature>>(await this.appClient.call(typedCallParams), returnValueFormatter)`\n yield DecIndentAndCloseBlock\n yield NewLine\n\n yield* opMethods(ctx)\n yield* clearState(ctx)\n yield* noopMethods(ctx)\n yield* getStateMethods(ctx)\n yield* composeMethod(ctx)\n yield DecIndentAndCloseBlock\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig, name } = ctx\n\n yield* jsDoc({\n description: `Idempotently deploys the ${app.contract.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 deploy(params: ${name}DeployArgs & AppClientDeployCoreParams = {}): ReturnType<ApplicationClient['deploy']> {`\n yield IncIndent\n\n if (callConfig.createMethods.length) yield `const createArgs = params.createCall?.(${name}CallFactory.create)`\n if (callConfig.updateMethods.length) yield `const updateArgs = params.updateCall?.(${name}CallFactory.update)`\n if (callConfig.deleteMethods.length) yield `const deleteArgs = params.deleteCall?.(${name}CallFactory.delete)`\n\n yield `return this.appClient.deploy({`\n yield IncIndent\n yield `...params,`\n if (callConfig.updateMethods.length) yield 'updateArgs,'\n if (callConfig.deleteMethods.length) yield 'deleteArgs,'\n if (callConfig.createMethods.length) {\n yield 'createArgs,'\n yield `createOnCompleteAction: createArgs?.onCompleteAction,`\n }\n yield DecIndent\n yield `})`\n yield DecIndentAndCloseBlock\n yield NewLine\n yield* operationMethod(ctx, `Creates a new instance of the ${app.contract.name} smart contract`, callConfig.createMethods, 'create', true)\n yield* operationMethod(\n ctx,\n `Updates an existing instance of the ${app.contract.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* operationMethod(ctx, `Deletes an existing instance of the ${app.contract.name} smart contract`, callConfig.deleteMethods, 'delete')\n yield* operationMethod(\n ctx,\n `Opts the user into an existing instance of the ${app.contract.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n )\n yield* operationMethod(\n ctx,\n `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n}\n\nfunction* operationMethod(\n { app, methodSignatureToUniqueName, name, sanitizer }: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n let responseTypeGenericParam\n switch (verb) {\n case 'create':\n responseTypeGenericParam = ', AppCreateCallTransactionResult'\n break\n case 'update':\n responseTypeGenericParam = ', AppUpdateCallTransactionResult'\n break\n default:\n responseTypeGenericParam = ''\n break\n }\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `public get ${verb}() {`\n yield IncIndent\n yield `const $this = this`\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield* jsDoc({\n description: `${description} using a bare call.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The ${verb} result`,\n })\n yield `async bare(args: BareCallArgs & AppClientCallCoreParams ${\n includeCompilation ? '& AppClientCompilationParams ' : ''\n }& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false ? ' = {}' : ''}) {`\n yield* indent(`return $this.mapReturnValue<undefined${responseTypeGenericParam}>(await $this.appClient.${verb}(args))`)\n yield '},'\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const method = app.contract.methods.find((m) => algokit.getABIMethodSignature(m) === methodSig)\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n params: {\n args: `The arguments for the smart contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The ${verb} 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 `async ${methodName}(args: MethodArgs<'${methodSigSafe}'>, params: AppClientCallCoreParams${\n includeCompilation ? ' & AppClientCompilationParams' : ''\n }${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false ? ' = {}' : ''}) {`\n yield* indent(\n `return $this.mapReturnValue<MethodReturn<'${methodSigSafe}'>${responseTypeGenericParam}>(await $this.appClient.${verb}(${name}CallFactory.${verb}${methodNameAccessor}(args, params)))`,\n )\n yield '},'\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* clearState({ app }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: `Makes a clear_state call to an existing instance of the ${app.contract.name} smart contract.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The clear_state result`,\n })\n yield `public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) {`\n yield IncIndent\n yield `return this.appClient.clearState(args)`\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* noopMethods({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.contract.methods) {\n const methodSignature = algokit.getABIMethodSignature(method)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n yield* jsDoc({\n description: `Calls the ${algokit.getABIMethodSignature(method)} ABI method.`,\n abiDescription: method.desc,\n params: {\n args: `The arguments for the contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The result of the call${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,\n })\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n yield `public ${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) {`\n yield IncIndent\n const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name\n yield `return this.call(${name}CallFactory${methodNameAccessor}(args, params)${\n outputTypeName === undefined ? '' : `, ${sanitizer.makeSafeTypeIdentifier(outputTypeName)}`\n })`\n yield DecIndent\n yield '}'\n yield NewLine\n }\n}\n\nfunction* getStateMethods({ app, name, sanitizer }: GeneratorContext): DocumentParts {\n const globalStateValues = app.schema.global?.declared && Object.values(app.schema.global?.declared)\n const localStateValues = app.schema.local?.declared && Object.values(app.schema.local?.declared)\n if (globalStateValues?.length || localStateValues?.length) {\n yield* jsDoc({\n description: 'Extracts a binary state value out of an AppState dictionary',\n params: {\n state: 'The state dictionary containing the state value',\n key: 'The key of the state value',\n },\n returns: 'A BinaryState instance containing the state value, or undefined if the key was not found',\n })\n yield `private static getBinaryState(state: AppState, key: string): BinaryState | undefined {`\n yield IncIndent\n yield `const value = state[key]`\n yield `if (!value) return undefined`\n yield `if (!('valueRaw' in value))`\n yield* indent(`throw new Error(\\`Failed to parse state value for \\${key}; received an int when expected a byte array\\`)`)\n yield `return {`\n yield IncIndent\n yield `asString(): string {`\n yield* indent(`return value.value`)\n yield `},`\n yield `asByteArray(): Uint8Array {`\n yield* indent(`return value.valueRaw`)\n yield `}`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n\n yield* jsDoc({\n description: 'Extracts a integer state value out of an AppState dictionary',\n params: {\n state: 'The state dictionary containing the state value',\n key: 'The key of the state value',\n },\n returns: 'An IntegerState instance containing the state value, or undefined if the key was not found',\n })\n yield `private static getIntegerState(state: AppState, key: string): IntegerState | undefined {`\n yield IncIndent\n yield `const value = state[key]`\n yield `if (!value) return undefined`\n yield `if ('valueRaw' in value)`\n yield* indent(`throw new Error(\\`Failed to parse state value for \\${key}; received a byte array when expected a number\\`)`)\n yield `return {`\n yield IncIndent\n yield `asBigInt() {`\n yield* indent(`return typeof value.value === 'bigint' ? value.value : BigInt(value.value)`)\n yield `},`\n yield `asNumber(): number {`\n yield* indent(`return typeof value.value === 'bigint' ? Number(value.value) : value.value`)\n yield `},`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n\n if (globalStateValues?.length) {\n yield* jsDoc(`Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value`)\n yield `public async getGlobalState(): Promise<${name}['state']['global']> {`\n yield IncIndent\n yield `const state = await this.appClient.getGlobalState()`\n yield `return {`\n yield IncIndent\n for (const stateValue of globalStateValues) {\n const stateKey = sanitizer.makeSafePropertyIdentifier(stateValue.key)\n const stateKeyLiteral = sanitizer.makeSafeStringTypeLiteral(stateValue.key)\n yield `get ${stateKey}() {`\n if (stateValue.type === 'uint64') {\n yield* indent(`return ${name}Client.getIntegerState(state, '${stateKeyLiteral}')`)\n } else {\n yield* indent(`return ${name}Client.getBinaryState(state, '${stateKeyLiteral}')`)\n }\n yield '},'\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n\n if (localStateValues?.length) {\n yield* jsDoc({\n description: `Returns the smart contract's local state wrapped in a strongly typed accessor with options to format the stored value`,\n params: {\n account: `The address of the account for which to read local state from`,\n },\n })\n yield `public async getLocalState(account: string | SendTransactionFrom): Promise<${name}['state']['local']> {`\n yield IncIndent\n yield `const state = await this.appClient.getLocalState(account)`\n yield `return {`\n yield IncIndent\n for (const stateValue of localStateValues) {\n const stateKey = sanitizer.makeSafePropertyIdentifier(stateValue.key)\n const stateKeyLiteral = sanitizer.makeSafeStringTypeLiteral(stateValue.key)\n yield `get ${stateKey}() {`\n if (stateValue.type === 'uint64') {\n yield* indent(`return ${name}Client.getIntegerState(state, '${stateKeyLiteral}')`)\n } else {\n yield* indent(`return ${name}Client.getBinaryState(state, '${stateKeyLiteral}')`)\n }\n yield '},'\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n"],"names":[],"mappings":";;;;;;AAQe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;AAEzB,IAAA,OAAO,KAAK,CAAC,CAAiC,8BAAA,EAAA,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAiB,eAAA,CAAA,CAAC,CAAA;AACjF,IAAA,MAAM,CAAgB,aAAA,EAAA,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAA;AACvF,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,OAAO,KAAK,CAAC,CAAA,+EAAA,CAAiF,CAAC,CAAA;AAC/F,IAAA,MAAM,8CAA8C,CAAA;AACpD,IAAA,MAAM,OAAO,CAAA;AACb,IAAA,MAAM,0DAA0D,CAAA;AAChE,IAAA,MAAM,OAAO,CAAA;IAEb,OAAO,KAAK,CAAC;AACX,QAAA,WAAW,EAAE,CAAA,4BAAA,EAA+B,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAU,QAAA,CAAA;AAC7G,QAAA,MAAM,EAAE;AACN,YAAA,UA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AAC/G,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,MAAM,2DAA2D,CAAA;AACjE,QAAA,MAAM,UAAU,CAAA;AAChB,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE;YACzC,MAAM,QAAQ,GAAG,SAAS,CAAC,0BAA0B,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YACrE,MAAM,eAAe,GAAG,SAAS,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3E,MAAM,CAAA,IAAA,EAAO,QAAQ,CAAA,IAAA,CAAM,CAAA;AAC3B,YAAA,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAChC,OAAO,MAAM,CAAC,CAAA,OAAA,EAAU,IAAI,CAAkC,+BAAA,EAAA,eAAe,CAAI,EAAA,CAAA,CAAC,CAAA;aACnF;iBAAM;gBACL,OAAO,MAAM,CAAC,CAAA,OAAA,EAAU,IAAI,CAAiC,8BAAA,EAAA,eAAe,CAAI,EAAA,CAAA,CAAC,CAAA;aAClF;AACD,YAAA,MAAM,IAAI,CAAA;SACX;AACD,QAAA,MAAM,sBAAsB,CAAA;AAC5B,QAAA,MAAM,sBAAsB,CAAA;AAC5B,QAAA,MAAM,OAAO,CAAA;KACd;AACH;;;;"}
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var writer = require('../output/writer.cjs');
3
+ var writer = require('../output/writer.js');
4
4
  var algokit = require('@algorandfoundation/algokit-utils');
5
- var sanitization = require('../util/sanitization.cjs');
6
- var getCallConfigSummary = require('./helpers/get-call-config-summary.cjs');
7
- var deployTypes = require('./deploy-types.cjs');
5
+ var getCallConfigSummary = require('./helpers/get-call-config-summary.js');
6
+ var deployTypes = require('./deploy-types.js');
8
7
 
9
8
  function _interopNamespaceDefault(e) {
10
9
  var n = Object.create(null);
@@ -83,10 +82,11 @@ function* callComposerTypeClearState({ app, name }) {
83
82
  yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`;
84
83
  yield writer.NewLine;
85
84
  }
86
- function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName }) {
85
+ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
87
86
  for (const method of app.contract.methods) {
88
87
  const methodSignature = algokit__namespace.getABIMethodSignature(method);
89
- const methodName = sanitization.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
88
+ const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
89
+ const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
90
90
  // Skip methods which don't support a no_op call config
91
91
  if (!callConfig.callMethods.includes(methodSignature))
92
92
  continue;
@@ -99,11 +99,11 @@ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUnique
99
99
  },
100
100
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
101
101
  });
102
- yield `${methodName}(args: MethodArgs<'${methodSignature}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignature}'>]>`;
102
+ yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`;
103
103
  yield writer.NewLine;
104
104
  }
105
105
  }
106
- function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, name }, description, methods, verb, includeCompilation) {
106
+ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, name, sanitizer }, description, methods, verb, includeCompilation) {
107
107
  if (methods.length) {
108
108
  yield* writer.jsDoc(`Gets available ${verb} methods`);
109
109
  yield `readonly ${verb}: {`;
@@ -130,7 +130,8 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
130
130
  },
131
131
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
132
132
  });
133
- yield `${sanitization.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSig}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSig}'>]>`;
133
+ const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
134
+ yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`;
134
135
  }
135
136
  }
136
137
  yield writer.DecIndentAndCloseBlock;
@@ -139,3 +140,4 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
139
140
  }
140
141
 
141
142
  exports.callComposerType = callComposerType;
143
+ //# sourceMappingURL=call-composer-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer-types.js","sources":["../../src/client/call-composer-types.ts"],"sourcesContent":["import { DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport * as algokit from '@algorandfoundation/algokit-utils'\n\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\n\nexport function* callComposerType(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig, app } = ctx\n yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`\n yield IncIndent\n\n yield* callComposerTypeNoops(ctx)\n yield* callComposerOperationMethodType(\n ctx,\n `Updates an existing instance of the ${app.contract.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Deletes an existing instance of the ${app.contract.name} smart contract`,\n callConfig.deleteMethods,\n 'delete',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Opts the user into an existing instance of the ${app.contract.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n\n yield* callComposerTypeClearState(ctx)\n\n yield* jsDoc({\n description: 'Adds a transaction to the composer',\n params: {\n txn: 'One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter)',\n defaultSender:\n 'The default sender to be used to obtain a signer where the object provided to the transaction parameter does not' +\n ' include a signer.',\n },\n })\n yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom): ${name}Composer<TReturns>`\n\n yield* jsDoc({\n description: 'Returns the underlying AtomicTransactionComposer instance',\n })\n yield `atc(): Promise<AtomicTransactionComposer>`\n\n yield* jsDoc({\n description: 'Simulates the transaction group and returns the result',\n })\n yield `simulate(options?: SimulateOptions): Promise<${name}ComposerSimulateResult<TReturns>>`\n\n yield* jsDoc({\n description: 'Executes the transaction group and returns the results',\n })\n yield `execute(sendParams?: AppClientComposeExecuteParams): Promise<${name}ComposerResults<TReturns>>`\n\n yield DecIndentAndCloseBlock\n yield `export type SimulateOptions = Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>`\n\n yield `export type ${name}ComposerSimulateResult<TReturns extends [...any[]]> = {`\n yield IncIndent\n yield `returns: TReturns`\n yield `methodResults: ABIResult[]`\n yield `simulateResponse: modelsv2.SimulateResponse`\n yield DecIndentAndCloseBlock\n\n yield `export type ${name}ComposerResults<TReturns extends [...any[]]> = {`\n yield IncIndent\n yield `returns: TReturns`\n yield `groupId: string`\n yield `txIds: string[]`\n yield `transactions: Transaction[]`\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerTypeClearState({ app, name }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: `Makes a clear_state call to an existing instance of the ${app.contract.name} smart contract.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`\n yield NewLine\n}\n\nfunction* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.contract.methods) {\n const methodSignature = algokit.getABIMethodSignature(method)\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n yield* jsDoc({\n description: `Calls the ${algokit.getABIMethodSignature(method)} ABI method.`,\n abiDescription: method.desc,\n params: {\n args: `The arguments for the contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`\n yield NewLine\n }\n}\n\nfunction* callComposerOperationMethodType(\n { app, methodSignatureToUniqueName, name, sanitizer }: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `readonly ${verb}: {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield* jsDoc({\n description: `${description} using a bare call.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${\n includeCompilation ? '& AppClientCompilationParams ' : ''\n }& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, undefined]>`\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n params: {\n args: `The arguments for the smart contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${\n onComplete?.isOptional !== false ? '?' : ''\n }: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`\n }\n }\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n"],"names":["IncIndent","jsDoc","DecIndentAndCloseBlock","NewLine","algokit","getCreateOnCompleteOptions","BARE_CALL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOe,UAAE,gBAAgB,CAAC,GAAqB,EAAA;IACrD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;IACrC,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,8CAAA,CAAgD,CAAA;AACzE,IAAA,MAAMA,gBAAS,CAAA;AAEf,IAAA,OAAO,qBAAqB,CAAC,GAAG,CAAC,CA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A,mBAAA,EAAsB,aAAa,CAAA,UAAA,EACxF,UAAU,EAAE,UAAU,KAAK,KAAK,GAAG,GAAG,GAAG,EAC3C,CAAmC,gCAAA,EAAA,kBAAkB,GAAG,+BAA+B,GAAG,EAAE,CAAA,EAC1F,UAAU,EAAE,IAAI,GAAG,CAAA,GAAA,EAAM,UAAU,CAAC,IAAI,CAAE,CAAA,GAAG,EAC/C,CAAA,GAAA,EAAM,IAAI,CAAA,qCAAA,EAAwC,aAAa,CAAA,IAAA,CAAM,CAAA;aACtE;SACF;AACD,QAAA,MAAMC,6BAAsB,CAAA;AAC5B,QAAA,MAAMC,cAAO,CAAA;KACd;AACH;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { IncIndent, jsDoc, DecIndentAndCloseBlock, NewLine } from '../output/writer.mjs';
2
2
  import * as algokit from '@algorandfoundation/algokit-utils';
3
- import { makeSafeMethodIdentifier } from '../util/sanitization.mjs';
4
3
  import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
5
4
  import { getCreateOnCompleteOptions } from './deploy-types.mjs';
6
5
 
@@ -62,10 +61,11 @@ function* callComposerTypeClearState({ app, name }) {
62
61
  yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`;
63
62
  yield NewLine;
64
63
  }
65
- function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName }) {
64
+ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
66
65
  for (const method of app.contract.methods) {
67
66
  const methodSignature = algokit.getABIMethodSignature(method);
68
- const methodName = makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
67
+ const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
68
+ const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
69
69
  // Skip methods which don't support a no_op call config
70
70
  if (!callConfig.callMethods.includes(methodSignature))
71
71
  continue;
@@ -78,11 +78,11 @@ function* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUnique
78
78
  },
79
79
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
80
80
  });
81
- yield `${methodName}(args: MethodArgs<'${methodSignature}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignature}'>]>`;
81
+ yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`;
82
82
  yield NewLine;
83
83
  }
84
84
  }
85
- function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, name }, description, methods, verb, includeCompilation) {
85
+ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, name, sanitizer }, description, methods, verb, includeCompilation) {
86
86
  if (methods.length) {
87
87
  yield* jsDoc(`Gets available ${verb} methods`);
88
88
  yield `readonly ${verb}: {`;
@@ -109,7 +109,8 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
109
109
  },
110
110
  returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,
111
111
  });
112
- yield `${makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSig}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSig}'>]>`;
112
+ const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
113
+ yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`;
113
114
  }
114
115
  }
115
116
  yield DecIndentAndCloseBlock;
@@ -118,3 +119,4 @@ function* callComposerOperationMethodType({ app, methodSignatureToUniqueName, na
118
119
  }
119
120
 
120
121
  export { callComposerType };
122
+ //# sourceMappingURL=call-composer-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer-types.mjs","sources":["../../src/client/call-composer-types.ts"],"sourcesContent":["import { DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport * as algokit from '@algorandfoundation/algokit-utils'\n\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\n\nexport function* callComposerType(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig, app } = ctx\n yield `export type ${name}Composer<TReturns extends [...any[]] = []> = {`\n yield IncIndent\n\n yield* callComposerTypeNoops(ctx)\n yield* callComposerOperationMethodType(\n ctx,\n `Updates an existing instance of the ${app.contract.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Deletes an existing instance of the ${app.contract.name} smart contract`,\n callConfig.deleteMethods,\n 'delete',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Opts the user into an existing instance of the ${app.contract.name} smart contract`,\n callConfig.optInMethods,\n 'optIn',\n )\n yield* callComposerOperationMethodType(\n ctx,\n `Makes a close out call to an existing instance of the ${app.contract.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n\n yield* callComposerTypeClearState(ctx)\n\n yield* jsDoc({\n description: 'Adds a transaction to the composer',\n params: {\n txn: 'One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter)',\n defaultSender:\n 'The default sender to be used to obtain a signer where the object provided to the transaction parameter does not' +\n ' include a signer.',\n },\n })\n yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom): ${name}Composer<TReturns>`\n\n yield* jsDoc({\n description: 'Returns the underlying AtomicTransactionComposer instance',\n })\n yield `atc(): Promise<AtomicTransactionComposer>`\n\n yield* jsDoc({\n description: 'Simulates the transaction group and returns the result',\n })\n yield `simulate(options?: SimulateOptions): Promise<${name}ComposerSimulateResult<TReturns>>`\n\n yield* jsDoc({\n description: 'Executes the transaction group and returns the results',\n })\n yield `execute(sendParams?: AppClientComposeExecuteParams): Promise<${name}ComposerResults<TReturns>>`\n\n yield DecIndentAndCloseBlock\n yield `export type SimulateOptions = Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>`\n\n yield `export type ${name}ComposerSimulateResult<TReturns extends [...any[]]> = {`\n yield IncIndent\n yield `returns: TReturns`\n yield `methodResults: ABIResult[]`\n yield `simulateResponse: modelsv2.SimulateResponse`\n yield DecIndentAndCloseBlock\n\n yield `export type ${name}ComposerResults<TReturns extends [...any[]]> = {`\n yield IncIndent\n yield `returns: TReturns`\n yield `groupId: string`\n yield `txIds: string[]`\n yield `transactions: Transaction[]`\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerTypeClearState({ app, name }: GeneratorContext): DocumentParts {\n yield* jsDoc({\n description: `Makes a clear_state call to an existing instance of the ${app.contract.name} smart contract.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, undefined]>`\n yield NewLine\n}\n\nfunction* callComposerTypeNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.contract.methods) {\n const methodSignature = algokit.getABIMethodSignature(method)\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n yield* jsDoc({\n description: `Calls the ${algokit.getABIMethodSignature(method)} ABI method.`,\n abiDescription: method.desc,\n params: {\n args: `The arguments for the contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): ${name}Composer<[...TReturns, MethodReturn<'${methodSignatureSafe}'>]>`\n yield NewLine\n }\n}\n\nfunction* callComposerOperationMethodType(\n { app, methodSignatureToUniqueName, name, sanitizer }: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `readonly ${verb}: {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield* jsDoc({\n description: `${description} using a bare call.`,\n params: {\n args: `The arguments for the bare call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${\n includeCompilation ? '& AppClientCompilationParams ' : ''\n }& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}): ${name}Composer<[...TReturns, undefined]>`\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n params: {\n args: `The arguments for the smart contract call`,\n params: `Any additional parameters for the call`,\n },\n returns: `The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions`,\n })\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${sanitizer.makeSafeMethodIdentifier(uniqueName)}(args: MethodArgs<'${methodSigSafe}'>, params${\n onComplete?.isOptional !== false ? '?' : ''\n }: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }): ${name}Composer<[...TReturns, MethodReturn<'${methodSigSafe}'>]>`\n }\n }\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n"],"names":[],"mappings":";;;;;AAOe,UAAE,gBAAgB,CAAC,GAAqB,EAAA;IACrD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;IACrC,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,8CAAA,CAAgD,CAAA;AACzE,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,+BAA+B,CACpC,GAAG,EACH,CAAA,oCAAA,EAAuC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAiB,eAAA,CAAA,EACzE,UAAU,CAAC,aAAa,EACxB,QAAQ,EACR,IAAI,CACL,CAAA;IACD,OAAO,+BAA+B,CACpC,GAAG,EACH,CAAA,oCAAA,EAAuC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAA,eAAA,CAAiB,EACzE,UAAU,CAAC,aAAa,EACxB,QAAQ,CACT,CAAA;IACD,OAAO,+BAA+B,CACpC,GAAG,EACH,CAAA,+CAAA,EAAkD,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAA,eAAA,CAAiB,EACpF,UAAU,CAAC,YAAY,EACvB,OAAO,CACR,CAAA;IACD,OAAO,+BAA+B,CACpC,GAAG,EACH,CAAA,sDAAA,EAAyD,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAA,eAAA,CAAiB,EAC3F,UAAU,CAAC,eAAe,EAC1B,UAAU,CACX,CAAA;AA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EAAE,CAAM,GAAA,EAAA,IAAI,oCAAoC,CAAA;aAClH;iBAAM;AACL,gBAAA,MAAM,UAAU,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAA;gBACzD,OAAO,KAAK,CAAC;AACX,oBAAA,WAAW,EAAE,CAAA,EAAG,WAAW,CAAA,WAAA,EAAc,SAAS,CAAc,YAAA,CAAA;AAChE,oBAAA,MAAM,EAAE;AACN,wBAAA,IAAI,EAAE,CAA2C,yCAAA,CAAA;AACjD,wBAAA,MAAM,EAAE,CAAwC,sCAAA,CAAA;AACjD,qBAAA;AACD,oBAAA,OAAO,EAAE,CAA+H,6HAAA,CAAA;AACzI,iBAAA,CAAC,CAAA;gBACF,MAAM,aAAa,GAAG,SAAS,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAA;gBACpE,MAAM,CAAA,EAAG,SAAS,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAA,mBAAA,EAAsB,aAAa,CAAA,UAAA,EACxF,UAAU,EAAE,UAAU,KAAK,KAAK,GAAG,GAAG,GAAG,EAC3C,CAAmC,gCAAA,EAAA,kBAAkB,GAAG,+BAA+B,GAAG,EAAE,CAAA,EAC1F,UAAU,EAAE,IAAI,GAAG,CAAA,GAAA,EAAM,UAAU,CAAC,IAAI,CAAE,CAAA,GAAG,EAC/C,CAAA,GAAA,EAAM,IAAI,CAAA,qCAAA,EAAwC,aAAa,CAAA,IAAA,CAAM,CAAA;aACtE;SACF;AACD,QAAA,MAAM,sBAAsB,CAAA;AAC5B,QAAA,MAAM,OAAO,CAAA;KACd;AACH;;;;"}
@@ -1,10 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var writer = require('../output/writer.cjs');
3
+ var writer = require('../output/writer.js');
4
4
  var algokit = require('@algorandfoundation/algokit-utils');
5
- var sanitization = require('../util/sanitization.cjs');
6
- var getCallConfigSummary = require('./helpers/get-call-config-summary.cjs');
7
- var deployTypes = require('./deploy-types.cjs');
5
+ var getCallConfigSummary = require('./helpers/get-call-config-summary.js');
6
+ var deployTypes = require('./deploy-types.js');
8
7
 
9
8
  function _interopNamespaceDefault(e) {
10
9
  var n = Object.create(null);
@@ -79,16 +78,18 @@ function* composeMethod(ctx) {
79
78
  yield `} as unknown as ${name}Composer`;
80
79
  yield writer.DecIndentAndCloseBlock;
81
80
  }
82
- function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName }) {
81
+ function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }) {
83
82
  for (const method of app.contract.methods) {
84
83
  const methodSignature = algokit__namespace.getABIMethodSignature(method);
85
- const methodName = sanitization.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
84
+ const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
85
+ const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
86
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
86
87
  // Skip methods which don't support a no_op call config
87
88
  if (!callConfig.callMethods.includes(methodSignature))
88
89
  continue;
89
- yield `${methodName}(args: MethodArgs<'${methodSignature}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`;
90
+ yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`;
90
91
  yield writer.IncIndent;
91
- yield `promiseChain = promiseChain.then(() => client.${methodName}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
92
+ yield `promiseChain = promiseChain.then(() => client${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
92
93
  const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name;
93
94
  yield `resultMappers.push(${outputTypeName ?? 'undefined'})`;
94
95
  yield `return this`;
@@ -105,7 +106,7 @@ function* callComposerClearState() {
105
106
  yield writer.DecIndent;
106
107
  yield '},';
107
108
  }
108
- function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, methods, verb, includeCompilation) {
109
+ function* callComposerOperationMethods({ app, methodSignatureToUniqueName, sanitizer }, methods, verb, includeCompilation) {
109
110
  if (methods.length) {
110
111
  yield `get ${verb}() {`;
111
112
  yield writer.IncIndent;
@@ -125,10 +126,12 @@ function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, met
125
126
  }
126
127
  else {
127
128
  const uniqueName = methodSignatureToUniqueName[methodSig];
128
- const methodName = sanitization.makeSafeMethodIdentifier(uniqueName);
129
- yield `${methodName}(args: MethodArgs<'${methodSig}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`;
129
+ const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
130
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
131
+ const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
132
+ yield `${methodName}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`;
130
133
  yield writer.IncIndent;
131
- yield `promiseChain = promiseChain.then(() => client.${verb}.${methodName}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
134
+ yield `promiseChain = promiseChain.then(() => client.${verb}${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
132
135
  const outputTypeName = app.hints?.[methodSig]?.structs?.output?.name;
133
136
  yield `resultMappers.push(${outputTypeName ?? 'undefined'})`;
134
137
  yield `return $this`;
@@ -143,3 +146,4 @@ function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, met
143
146
  }
144
147
 
145
148
  exports.composeMethod = composeMethod;
149
+ //# sourceMappingURL=call-composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer.js","sources":["../../src/client/call-composer.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport * as algokit from '@algorandfoundation/algokit-utils'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\n\nexport function* composeMethod(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig } = ctx\n yield `public compose(): ${name}Composer {`\n yield IncIndent\n\n yield `const client = this`\n yield `const atc = new AtomicTransactionComposer()`\n yield `let promiseChain:Promise<unknown> = Promise.resolve()`\n yield `const resultMappers: Array<undefined | ((x: any) => any)> = []`\n yield `return {`\n yield IncIndent\n\n yield* callComposerNoops(ctx)\n yield* callComposerOperationMethods(ctx, callConfig.updateMethods, 'update', true)\n yield* callComposerOperationMethods(ctx, callConfig.deleteMethods, 'delete')\n yield* callComposerOperationMethods(ctx, callConfig.optInMethods, 'optIn')\n yield* callComposerOperationMethods(ctx, callConfig.closeOutMethods, 'closeOut')\n yield* callComposerClearState()\n\n yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom) {`\n yield IncIndent\n yield 'promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ??' +\n ' client.sender)))'\n yield 'return this'\n yield DecIndent\n yield '},'\n\n yield `async atc() {`\n yield IncIndent\n yield 'await promiseChain'\n yield 'return atc'\n yield DecIndent\n yield '},'\n\n yield `async simulate(options?: SimulateOptions) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options }))`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n\n yield `async execute(sendParams?: AppClientComposeExecuteParams) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `} as unknown as ${name}Composer`\n\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.contract.methods) {\n const methodSignature = algokit.getABIMethodSignature(method)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\n yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`\n const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name\n yield `resultMappers.push(${outputTypeName ?? 'undefined'})`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n}\n\nfunction* callComposerClearState(): DocumentParts {\n yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}}))`\n yield `resultMappers.push(undefined)`\n yield `return this`\n yield DecIndent\n yield '},'\n}\n\nfunction* callComposerOperationMethods(\n { app, methodSignatureToUniqueName, sanitizer }: GeneratorContext,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield `get ${verb}() {`\n yield IncIndent\n yield `const $this = this`\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${\n includeCompilation ? '& AppClientCompilationParams ' : ''\n }& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.${verb}.bare({...args, sendParams: {...args?.sendParams, skipSending: true, atc}}))`\n yield `resultMappers.push(undefined)`\n yield `return $this`\n yield DecIndent\n yield '},'\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}(args: MethodArgs<'${methodSigSafe}'>, params${\n onComplete?.isOptional !== false ? '?' : ''\n }: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.${verb}${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`\n const outputTypeName = app.hints?.[methodSig]?.structs?.output?.name\n yield `resultMappers.push(${outputTypeName ?? 'undefined'})`\n yield `return $this`\n yield DecIndent\n yield '},'\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n }\n}\n"],"names":["IncIndent","DecIndent","DecIndentAndCloseBlock","algokit","getCreateOnCompleteOptions","BARE_CALL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMe,UAAE,aAAa,CAAC,GAAqB,EAAA;AAClD,IAAA,MAAM,EAAE,IAAI,EAA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AAG,EAAA,kBAAkB,mFAAmF,CAAA;AACnK,gBAAA,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAA;AACpE,gBAAA,MAAM,CAAsB,mBAAA,EAAA,cAAc,IAAI,WAAW,GAAG,CAAA;AAC5D,gBAAA,MAAM,cAAc,CAAA;AACpB,gBAAA,MAAMC,gBAAS,CAAA;AACf,gBAAA,MAAM,IAAI,CAAA;aACX;SACF;AACD,QAAA,MAAMC,6BAAsB,CAAA;AAC5B,QAAA,MAAMD,gBAAS,CAAA;AACf,QAAA,MAAM,IAAI,CAAA;KACX;AACH;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { IncIndent, DecIndent, DecIndentAndCloseBlock } from '../output/writer.mjs';
2
2
  import * as algokit from '@algorandfoundation/algokit-utils';
3
- import { makeSafeMethodIdentifier } from '../util/sanitization.mjs';
4
3
  import { BARE_CALL } from './helpers/get-call-config-summary.mjs';
5
4
  import { getCreateOnCompleteOptions } from './deploy-types.mjs';
6
5
 
@@ -58,16 +57,18 @@ function* composeMethod(ctx) {
58
57
  yield `} as unknown as ${name}Composer`;
59
58
  yield DecIndentAndCloseBlock;
60
59
  }
61
- function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName }) {
60
+ function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }) {
62
61
  for (const method of app.contract.methods) {
63
62
  const methodSignature = algokit.getABIMethodSignature(method);
64
- const methodName = makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
63
+ const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
64
+ const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
65
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
65
66
  // Skip methods which don't support a no_op call config
66
67
  if (!callConfig.callMethods.includes(methodSignature))
67
68
  continue;
68
- yield `${methodName}(args: MethodArgs<'${methodSignature}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`;
69
+ yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`;
69
70
  yield IncIndent;
70
- yield `promiseChain = promiseChain.then(() => client.${methodName}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
71
+ yield `promiseChain = promiseChain.then(() => client${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
71
72
  const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name;
72
73
  yield `resultMappers.push(${outputTypeName ?? 'undefined'})`;
73
74
  yield `return this`;
@@ -84,7 +85,7 @@ function* callComposerClearState() {
84
85
  yield DecIndent;
85
86
  yield '},';
86
87
  }
87
- function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, methods, verb, includeCompilation) {
88
+ function* callComposerOperationMethods({ app, methodSignatureToUniqueName, sanitizer }, methods, verb, includeCompilation) {
88
89
  if (methods.length) {
89
90
  yield `get ${verb}() {`;
90
91
  yield IncIndent;
@@ -104,10 +105,12 @@ function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, met
104
105
  }
105
106
  else {
106
107
  const uniqueName = methodSignatureToUniqueName[methodSig];
107
- const methodName = makeSafeMethodIdentifier(uniqueName);
108
- yield `${methodName}(args: MethodArgs<'${methodSig}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`;
108
+ const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
109
+ const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
110
+ const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
111
+ yield `${methodName}(args: MethodArgs<'${methodSigSafe}'>, params${onComplete?.isOptional !== false ? '?' : ''}: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`;
109
112
  yield IncIndent;
110
- yield `promiseChain = promiseChain.then(() => client.${verb}.${methodName}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
113
+ yield `promiseChain = promiseChain.then(() => client.${verb}${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`;
111
114
  const outputTypeName = app.hints?.[methodSig]?.structs?.output?.name;
112
115
  yield `resultMappers.push(${outputTypeName ?? 'undefined'})`;
113
116
  yield `return $this`;
@@ -122,3 +125,4 @@ function* callComposerOperationMethods({ app, methodSignatureToUniqueName }, met
122
125
  }
123
126
 
124
127
  export { composeMethod };
128
+ //# sourceMappingURL=call-composer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-composer.mjs","sources":["../../src/client/call-composer.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport * as algokit from '@algorandfoundation/algokit-utils'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\n\nexport function* composeMethod(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig } = ctx\n yield `public compose(): ${name}Composer {`\n yield IncIndent\n\n yield `const client = this`\n yield `const atc = new AtomicTransactionComposer()`\n yield `let promiseChain:Promise<unknown> = Promise.resolve()`\n yield `const resultMappers: Array<undefined | ((x: any) => any)> = []`\n yield `return {`\n yield IncIndent\n\n yield* callComposerNoops(ctx)\n yield* callComposerOperationMethods(ctx, callConfig.updateMethods, 'update', true)\n yield* callComposerOperationMethods(ctx, callConfig.deleteMethods, 'delete')\n yield* callComposerOperationMethods(ctx, callConfig.optInMethods, 'optIn')\n yield* callComposerOperationMethods(ctx, callConfig.closeOutMethods, 'closeOut')\n yield* callComposerClearState()\n\n yield `addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom) {`\n yield IncIndent\n yield 'promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ??' +\n ' client.sender)))'\n yield 'return this'\n yield DecIndent\n yield '},'\n\n yield `async atc() {`\n yield IncIndent\n yield 'await promiseChain'\n yield 'return atc'\n yield DecIndent\n yield '},'\n\n yield `async simulate(options?: SimulateOptions) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options }))`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n\n yield `async execute(sendParams?: AppClientComposeExecuteParams) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `} as unknown as ${name}Composer`\n\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n for (const method of app.contract.methods) {\n const methodSignature = algokit.getABIMethodSignature(method)\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n\n yield `${methodName}(args: MethodArgs<'${methodSignatureSafe}'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`\n const outputTypeName = app.hints?.[methodSignature]?.structs?.output?.name\n yield `resultMappers.push(${outputTypeName ?? 'undefined'})`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n}\n\nfunction* callComposerClearState(): DocumentParts {\n yield `clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}}))`\n yield `resultMappers.push(undefined)`\n yield `return this`\n yield DecIndent\n yield '},'\n}\n\nfunction* callComposerOperationMethods(\n { app, methodSignatureToUniqueName, sanitizer }: GeneratorContext,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield `get ${verb}() {`\n yield IncIndent\n yield `const $this = this`\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig === BARE_CALL) {\n yield `bare(args${onComplete?.isOptional !== false ? '?' : ''}: BareCallArgs & AppClientComposeCallCoreParams ${\n includeCompilation ? '& AppClientCompilationParams ' : ''\n }& CoreAppCallArgs${onComplete?.type ? ` & ${onComplete.type}` : ''}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.${verb}.bare({...args, sendParams: {...args?.sendParams, skipSending: true, atc}}))`\n yield `resultMappers.push(undefined)`\n yield `return $this`\n yield DecIndent\n yield '},'\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}(args: MethodArgs<'${methodSigSafe}'>, params${\n onComplete?.isOptional !== false ? '?' : ''\n }: AppClientComposeCallCoreParams${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => client.${verb}${methodNameAccessor}(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}}))`\n const outputTypeName = app.hints?.[methodSig]?.structs?.output?.name\n yield `resultMappers.push(${outputTypeName ?? 'undefined'})`\n yield `return $this`\n yield DecIndent\n yield '},'\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n }\n}\n"],"names":[],"mappings":";;;;;AAMe,UAAE,aAAa,CAAC,GAAqB,EAAA;AAClD,IAAA,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;IAChC,MAAM,CAAA,kBAAA,EAAqB,IAAI,CAAA,UAAA,CAAY,CAAA;AAC3C,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,MAAM,qBAAqB,CAAA;AAC3B,IAAA,MAAM,6CAA6C,CAAA;AACnD,IAAA,MAAM,uDAAuD,CAAA;AAC7D,IAAA,MAAM,gEAAgE,CAAA;AACtE,IAAA,MAAM,UAAU,CAAA;AAChB,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAA;AAC7B,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAClF,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;AAC5E,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;AAC1E,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;AAChF,IAAA,OAAO,sBAAsB,EAAE,CAAA;AAE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