@algorandfoundation/algokit-client-generator 4.0.1-beta.1 → 4.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app-factory.js
CHANGED
|
@@ -135,13 +135,13 @@ function* createMethods(generator) {
|
|
|
135
135
|
}
|
|
136
136
|
function* paramMethods(ctx) {
|
|
137
137
|
const { app, callConfig } = ctx;
|
|
138
|
-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
139
|
-
yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', true);
|
|
140
|
-
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete');
|
|
138
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'params', true);
|
|
139
|
+
yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', 'params', true);
|
|
140
|
+
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete', 'params');
|
|
141
141
|
}
|
|
142
142
|
function* createTransactionMethods(ctx) {
|
|
143
143
|
const { app, callConfig } = ctx;
|
|
144
|
-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
144
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'createTransaction', true);
|
|
145
145
|
}
|
|
146
146
|
function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
|
|
147
147
|
const onComplete = verb === 'create' ? deployTypes.getCreateOnCompleteOptions(getCallConfigSummary.BARE_CALL, app) : undefined;
|
|
@@ -150,7 +150,9 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
|
|
|
150
150
|
params: {
|
|
151
151
|
params: `The params for the bare (raw) call`,
|
|
152
152
|
},
|
|
153
|
-
returns: type === 'params'
|
|
153
|
+
returns: type === 'params' || type === 'createTransaction'
|
|
154
|
+
? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
|
|
155
|
+
: `The ${verb} result`,
|
|
154
156
|
});
|
|
155
157
|
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
|
|
156
158
|
if (type === 'params' || type === 'createTransaction') {
|
|
@@ -185,7 +187,7 @@ function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, n
|
|
|
185
187
|
}
|
|
186
188
|
yield '},';
|
|
187
189
|
}
|
|
188
|
-
function* operationMethods(generator, description, methods, verb, includeCompilation) {
|
|
190
|
+
function* operationMethods(generator, description, methods, verb, type, includeCompilation) {
|
|
189
191
|
if (methods.length) {
|
|
190
192
|
yield* writer.jsDoc(`Gets available ${verb} methods`);
|
|
191
193
|
yield `${verb}: {`;
|
|
@@ -197,7 +199,7 @@ function* operationMethods(generator, description, methods, verb, includeCompila
|
|
|
197
199
|
name: 'bare',
|
|
198
200
|
description: `${description} using a bare call`,
|
|
199
201
|
verb,
|
|
200
|
-
type
|
|
202
|
+
type,
|
|
201
203
|
includeCompilation,
|
|
202
204
|
});
|
|
203
205
|
}
|
|
@@ -208,7 +210,7 @@ function* operationMethods(generator, description, methods, verb, includeCompila
|
|
|
208
210
|
method,
|
|
209
211
|
description,
|
|
210
212
|
verb,
|
|
211
|
-
type
|
|
213
|
+
type,
|
|
212
214
|
includeCompilation,
|
|
213
215
|
});
|
|
214
216
|
}
|
|
@@ -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 /** 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,M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D,IAAI,CAAA,0BAAA,CAA4B,CAAA;AACxF,IAAA,MAAMH,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(\n ctx,\n `Creates a new instance of the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n 'params',\n true,\n )\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'deployUpdate',\n 'params',\n true,\n )\n yield* operationMethods(\n ctx,\n `Deletes an existing instance of the ${app.name} smart contract`,\n callConfig.deleteMethods,\n 'deployDelete',\n 'params',\n )\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(\n ctx,\n `Creates a new instance of the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n 'createTransaction',\n true,\n )\n}\n\nfunction* bareMethodCallParams({\n generator: { app, name: clientName },\n name,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n name: string\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}): DocumentParts {\n const onComplete = verb === 'create' ? 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:\n type === 'params' || type === 'createTransaction'\n ? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`\n : `The ${verb} result`,\n })\n yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.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 type: 'params' | 'createTransaction',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `${verb}: {`\n yield IncIndent\n for (const 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,\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,\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,yCAAyC,CAAA;AAC/C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgCW,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,CA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C7I;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,MAAME,gBAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;IACV,MAAM,CAAA,+CAAA,EAAkD,IAAI,CAAA,0BAAA,CAA4B,CAAA;AACxF,IAAA,MAAMH,6BAAsB,CAAA;AAC5B,IAAA,MAAMD,cAAO,CAAA;AACf;;;;"}
|
package/client/app-factory.mjs
CHANGED
|
@@ -133,13 +133,13 @@ function* createMethods(generator) {
|
|
|
133
133
|
}
|
|
134
134
|
function* paramMethods(ctx) {
|
|
135
135
|
const { app, callConfig } = ctx;
|
|
136
|
-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
137
|
-
yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', true);
|
|
138
|
-
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete');
|
|
136
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'params', true);
|
|
137
|
+
yield* operationMethods(ctx, `Updates an existing instance of the ${app.name} smart contract`, callConfig.updateMethods, 'deployUpdate', 'params', true);
|
|
138
|
+
yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete', 'params');
|
|
139
139
|
}
|
|
140
140
|
function* createTransactionMethods(ctx) {
|
|
141
141
|
const { app, callConfig } = ctx;
|
|
142
|
-
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
142
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 'createTransaction', true);
|
|
143
143
|
}
|
|
144
144
|
function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
|
|
145
145
|
const onComplete = verb === 'create' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined;
|
|
@@ -148,7 +148,9 @@ function* bareMethodCallParams({ generator: { app, name: clientName }, name, des
|
|
|
148
148
|
params: {
|
|
149
149
|
params: `The params for the bare (raw) call`,
|
|
150
150
|
},
|
|
151
|
-
returns: type === 'params'
|
|
151
|
+
returns: type === 'params' || type === 'createTransaction'
|
|
152
|
+
? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`
|
|
153
|
+
: `The ${verb} result`,
|
|
152
154
|
});
|
|
153
155
|
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
|
|
154
156
|
if (type === 'params' || type === 'createTransaction') {
|
|
@@ -183,7 +185,7 @@ function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, n
|
|
|
183
185
|
}
|
|
184
186
|
yield '},';
|
|
185
187
|
}
|
|
186
|
-
function* operationMethods(generator, description, methods, verb, includeCompilation) {
|
|
188
|
+
function* operationMethods(generator, description, methods, verb, type, includeCompilation) {
|
|
187
189
|
if (methods.length) {
|
|
188
190
|
yield* jsDoc(`Gets available ${verb} methods`);
|
|
189
191
|
yield `${verb}: {`;
|
|
@@ -195,7 +197,7 @@ function* operationMethods(generator, description, methods, verb, includeCompila
|
|
|
195
197
|
name: 'bare',
|
|
196
198
|
description: `${description} using a bare call`,
|
|
197
199
|
verb,
|
|
198
|
-
type
|
|
200
|
+
type,
|
|
199
201
|
includeCompilation,
|
|
200
202
|
});
|
|
201
203
|
}
|
|
@@ -206,7 +208,7 @@ function* operationMethods(generator, description, methods, verb, includeCompila
|
|
|
206
208
|
method,
|
|
207
209
|
description,
|
|
208
210
|
verb,
|
|
209
|
-
type
|
|
211
|
+
type,
|
|
210
212
|
includeCompilation,
|
|
211
213
|
});
|
|
212
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-factory.mjs","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":[],"mappings":";;;;;AAOe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAO,KAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAuG,qGAAA,CAAA,CAC9K,CAAA;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW,CAAA;AACrC,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,OAAO,KAAK,CAAC,CAAA,wEAAA,CAA0E,CAAC,CAAA;AACxF,IAAA,MAAM,yCAAyC,CAAA;AAC/C,IAAA,MAAM,OAAO,CAAA;IAEb,OAAO,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgCW,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,MAAM,sB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IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,MAAM,EAAE;QAClE,MAAM,CAAA,4CAAA,EAA+C,IAAI,CAAA,iFAAA,CAAmF,CAAA;KAC7I;AACD,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;IACV,MAAM,CAAA,+CAAA,EAAkD,IAAI,CAAA,0BAAA,CAA4B,CAAA;AACxF,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,OAAO,CAAA;AACf;;;;"}
|
|
1
|
+
{"version":3,"file":"app-factory.mjs","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(\n ctx,\n `Creates a new instance of the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n 'params',\n true,\n )\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'deployUpdate',\n 'params',\n true,\n )\n yield* operationMethods(\n ctx,\n `Deletes an existing instance of the ${app.name} smart contract`,\n callConfig.deleteMethods,\n 'deployDelete',\n 'params',\n )\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(\n ctx,\n `Creates a new instance of the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n 'createTransaction',\n true,\n )\n}\n\nfunction* bareMethodCallParams({\n generator: { app, name: clientName },\n name,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n name: string\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}): DocumentParts {\n const onComplete = verb === 'create' ? 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:\n type === 'params' || type === 'createTransaction'\n ? `The ${type === 'createTransaction' ? 'transaction' : type} for a ${verb} call`\n : `The ${verb} result`,\n })\n yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.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 type: 'params' | 'createTransaction',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `${verb}: {`\n yield IncIndent\n for (const 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,\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,\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":[],"mappings":";;;;;AAOe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAO,KAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAuG,qGAAA,CAAA,CAC9K,CAAA;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW,CAAA;AACrC,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,OAAO,KAAK,CAAC,CAAA,wEAAA,CAA0E,CAAC,CAAA;AACxF,IAAA,MAAM,yCAAyC,CAAA;AAC/C,IAAA,MAAM,OAAO,CAAA;IAEb,OAAO,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgCW,IAAI,CAAA;;;;;;;;;;;;;;;mBAeJ,IAAI,CAAA;;GAEpB,CAAA;AAED,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,CAAA;AACxB,IAAA,OAA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AAC,KAAK,SAAS,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,KAAK,SAAS,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,KAAK,SAAS,CAAC,CAAC,MAAM,EAAE;QAClE,MAAM,CAAA,4CAAA,EAA+C,IAAI,CAAA,iFAAA,CAAmF,CAAA;KAC7I;AACD,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;IACV,MAAM,CAAA,+CAAA,EAAkD,IAAI,CAAA,0BAAA,CAA4B,CAAA;AACxF,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,OAAO,CAAA;AACf;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-client-generator",
|
|
9
|
-
"version": "4.0.
|
|
9
|
+
"version": "4.0.2-beta.1",
|
|
10
10
|
"description": "Generates a TypeScript client for interacting with, and deploying ARC-0032 smart contracts on the Algorand Blockchain.",
|
|
11
11
|
"module": "index.mjs",
|
|
12
12
|
"private": false,
|