@algorandfoundation/algokit-client-generator 3.0.6 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/cli.d.ts +6 -0
- package/cli.js +47 -16
- package/cli.js.map +1 -1
- package/cli.mjs +47 -17
- package/cli.mjs.map +1 -1
- package/client/{call-factory.d.ts → app-client.d.ts} +1 -1
- package/client/app-client.js +345 -0
- package/client/app-client.js.map +1 -0
- package/client/app-client.mjs +343 -0
- package/client/app-client.mjs.map +1 -0
- package/client/{call-client.d.ts → app-factory.d.ts} +1 -1
- package/client/app-factory.js +252 -0
- package/client/app-factory.js.map +1 -0
- package/client/app-factory.mjs +250 -0
- package/client/app-factory.mjs.map +1 -0
- package/client/app-types.js +206 -112
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs +210 -97
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js +27 -57
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs +27 -38
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js +47 -59
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs +49 -42
- package/client/call-composer.mjs.map +1 -1
- package/client/deploy-types.d.ts +8 -4
- package/client/deploy-types.js +52 -34
- package/client/deploy-types.js.map +1 -1
- package/client/deploy-types.mjs +53 -36
- package/client/deploy-types.mjs.map +1 -1
- package/client/generate.d.ts +2 -2
- package/client/generate.js +18 -7
- package/client/generate.js.map +1 -1
- package/client/generate.mjs +18 -7
- package/client/generate.mjs.map +1 -1
- package/client/generator-context.d.ts +4 -4
- package/client/generator-context.js +5 -24
- package/client/generator-context.js.map +1 -1
- package/client/generator-context.mjs +5 -5
- package/client/generator-context.mjs.map +1 -1
- package/client/helpers/get-call-config-summary.d.ts +8 -3
- package/client/helpers/get-call-config-summary.js +22 -20
- package/client/helpers/get-call-config-summary.js.map +1 -1
- package/client/helpers/get-call-config-summary.mjs +22 -20
- package/client/helpers/get-call-config-summary.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.d.ts +6 -1
- package/client/helpers/get-equivalent-type.js +20 -10
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs +20 -10
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.js +21 -24
- package/client/imports.js.map +1 -1
- package/client/imports.mjs +21 -24
- package/client/imports.mjs.map +1 -1
- package/client/params-factory.d.ts +3 -0
- package/client/params-factory.js +126 -0
- package/client/params-factory.js.map +1 -0
- package/client/params-factory.mjs +124 -0
- package/client/params-factory.mjs.map +1 -0
- package/client/utility-types.d.ts +0 -7
- package/client/utility-types.js +37 -50
- package/client/utility-types.js.map +1 -1
- package/client/utility-types.mjs +38 -50
- package/client/utility-types.mjs.map +1 -1
- package/output/writer.d.ts +5 -5
- package/output/writer.js +26 -6
- package/output/writer.js.map +1 -1
- package/output/writer.mjs +26 -6
- package/output/writer.mjs.map +1 -1
- package/package.json +7 -5
- package/schema/application.schema.json.js +2 -2
- package/schema/application.schema.json.mjs +2 -2
- package/schema/arc56.schema.json.js +751 -0
- package/schema/arc56.schema.json.js.map +1 -0
- package/schema/arc56.schema.json.mjs +741 -0
- package/schema/arc56.schema.json.mjs.map +1 -0
- package/schema/load.d.ts +3 -3
- package/schema/load.js +28 -8
- package/schema/load.js.map +1 -1
- package/schema/load.mjs +29 -9
- package/schema/load.mjs.map +1 -1
- package/util/sanitization.js +13 -8
- package/util/sanitization.js.map +1 -1
- package/util/sanitization.mjs +13 -8
- package/util/sanitization.mjs.map +1 -1
- package/client/call-client.js +0 -341
- package/client/call-client.js.map +0 -1
- package/client/call-client.mjs +0 -320
- package/client/call-client.mjs.map +0 -1
- package/client/call-factory.js +0 -142
- package/client/call-factory.js.map +0 -1
- package/client/call-factory.mjs +0 -121
- package/client/call-factory.mjs.map +0 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var writer = require('../output/writer.js');
|
|
4
|
+
var getCallConfigSummary = require('./helpers/get-call-config-summary.js');
|
|
5
|
+
var deployTypes = require('./deploy-types.js');
|
|
6
|
+
var algosdk = require('algosdk');
|
|
7
|
+
|
|
8
|
+
function* appFactory(ctx) {
|
|
9
|
+
const { app, name } = ctx;
|
|
10
|
+
yield* writer.jsDoc(`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`);
|
|
11
|
+
yield `export class ${name}Factory {`;
|
|
12
|
+
yield writer.IncIndent;
|
|
13
|
+
yield* writer.jsDoc(`The underlying \`AppFactory\` for when you want to have more flexibility`);
|
|
14
|
+
yield 'public readonly appFactory: AppFactory';
|
|
15
|
+
yield writer.NewLine;
|
|
16
|
+
yield* writer.jsDoc({
|
|
17
|
+
description: `Creates a new instance of \`${name}Factory\``,
|
|
18
|
+
params: {
|
|
19
|
+
params: 'The parameters to initialise the app factory with',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
yield `
|
|
23
|
+
constructor(params: Omit<AppFactoryParams, 'appSpec'>) {
|
|
24
|
+
this.appFactory = new AppFactory({
|
|
25
|
+
...params,
|
|
26
|
+
appSpec: APP_SPEC,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
|
|
31
|
+
public get appName() {
|
|
32
|
+
return this.appFactory.appName
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The ARC-56 app spec being used */
|
|
36
|
+
get appSpec() {
|
|
37
|
+
return APP_SPEC
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A reference to the underlying \`AlgorandClient\` this app factory is using. */
|
|
41
|
+
public get algorand(): AlgorandClientInterface {
|
|
42
|
+
return this.appFactory.algorand
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns a new \`AppClient\` client for an app instance of the given ID.
|
|
47
|
+
*
|
|
48
|
+
* Automatically populates appName, defaultSender and source maps from the factory
|
|
49
|
+
* if not specified in the params.
|
|
50
|
+
* @param params The parameters to create the app client
|
|
51
|
+
* @returns The \`AppClient\`
|
|
52
|
+
*/
|
|
53
|
+
public getAppClientById(params: AppFactoryAppClientParams) {
|
|
54
|
+
return new ${name}Client(this.appFactory.getAppClientById(params))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns a new \`AppClient\` client, resolving the app by creator address and name
|
|
59
|
+
* using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
|
|
60
|
+
*
|
|
61
|
+
* Automatically populates appName, defaultSender and source maps from the factory
|
|
62
|
+
* if not specified in the params.
|
|
63
|
+
* @param params The parameters to create the app client
|
|
64
|
+
* @returns The \`AppClient\`
|
|
65
|
+
*/
|
|
66
|
+
public async getAppClientByCreatorAndName(
|
|
67
|
+
params: AppFactoryResolveAppClientByCreatorAndNameParams,
|
|
68
|
+
) {
|
|
69
|
+
return new ${name}Client(await this.appFactory.getAppClientByCreatorAndName(params))
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
yield* deployMethod(ctx);
|
|
73
|
+
yield* params(ctx);
|
|
74
|
+
yield* createTransaction(ctx);
|
|
75
|
+
yield* send(ctx);
|
|
76
|
+
yield writer.DecIndentAndCloseBlock;
|
|
77
|
+
}
|
|
78
|
+
function* params(ctx) {
|
|
79
|
+
yield* writer.jsDoc(`Get parameters to create transactions (create and deploy related calls) for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`);
|
|
80
|
+
yield `readonly params = {`;
|
|
81
|
+
yield writer.IncIndent;
|
|
82
|
+
yield* paramMethods(ctx);
|
|
83
|
+
yield writer.DecIndentAndCloseBlock;
|
|
84
|
+
yield writer.NewLine;
|
|
85
|
+
}
|
|
86
|
+
function* createTransaction(ctx) {
|
|
87
|
+
yield* writer.jsDoc(`Create transactions for the current app`);
|
|
88
|
+
yield `readonly createTransaction = {`;
|
|
89
|
+
yield writer.IncIndent;
|
|
90
|
+
yield* createTransactionMethods(ctx);
|
|
91
|
+
yield writer.DecIndentAndCloseBlock;
|
|
92
|
+
yield writer.NewLine;
|
|
93
|
+
}
|
|
94
|
+
function* send(ctx) {
|
|
95
|
+
yield* writer.jsDoc(`Send calls to the current app`);
|
|
96
|
+
yield `readonly send = {`;
|
|
97
|
+
yield writer.IncIndent;
|
|
98
|
+
yield* createMethods(ctx);
|
|
99
|
+
yield writer.DecIndentAndCloseBlock;
|
|
100
|
+
yield writer.NewLine;
|
|
101
|
+
}
|
|
102
|
+
function* createMethods(generator) {
|
|
103
|
+
const { app } = generator;
|
|
104
|
+
if (generator.callConfig.createMethods.length) {
|
|
105
|
+
yield* writer.jsDoc(`Gets available create methods`);
|
|
106
|
+
yield `create: {`;
|
|
107
|
+
yield writer.IncIndent;
|
|
108
|
+
for (const methodSig of generator.callConfig.createMethods) {
|
|
109
|
+
if (methodSig === getCallConfigSummary.BARE_CALL) {
|
|
110
|
+
yield* bareMethodCallParams({
|
|
111
|
+
generator,
|
|
112
|
+
name: 'bare',
|
|
113
|
+
description: `Creates a new instance of the ${app.name} smart contract using a bare call`,
|
|
114
|
+
verb: 'create',
|
|
115
|
+
type: 'send',
|
|
116
|
+
includeCompilation: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const method = generator.app.methods.find((m) => new algosdk.ABIMethod(m).getSignature() === methodSig);
|
|
121
|
+
yield* abiMethodCallParams({
|
|
122
|
+
generator,
|
|
123
|
+
method,
|
|
124
|
+
description: `Creates a new instance of the ${app.name} smart contract using an ABI method call`,
|
|
125
|
+
verb: 'create',
|
|
126
|
+
type: 'send',
|
|
127
|
+
includeCompilation: true,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
yield writer.DecIndent;
|
|
132
|
+
yield '},';
|
|
133
|
+
yield writer.NewLine;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function* paramMethods(ctx) {
|
|
137
|
+
const { app, callConfig } = ctx;
|
|
138
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 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');
|
|
141
|
+
}
|
|
142
|
+
function* createTransactionMethods(ctx) {
|
|
143
|
+
const { app, callConfig } = ctx;
|
|
144
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
145
|
+
}
|
|
146
|
+
function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
|
|
147
|
+
const onComplete = verb === 'create' ? deployTypes.getCreateOnCompleteOptions(getCallConfigSummary.BARE_CALL, app) : undefined;
|
|
148
|
+
yield* writer.jsDoc({
|
|
149
|
+
description: `${description}.`,
|
|
150
|
+
params: {
|
|
151
|
+
params: `The params for the bare (raw) call`,
|
|
152
|
+
},
|
|
153
|
+
returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,
|
|
154
|
+
});
|
|
155
|
+
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
|
|
156
|
+
if (type === 'params' || type === 'createTransaction') {
|
|
157
|
+
yield* writer.indent(`return this.appFactory.${type}.bare.${verb}(params)`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
yield* writer.indent(`const result = await this.appFactory.send.bare.create(params)`, `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`);
|
|
161
|
+
}
|
|
162
|
+
yield '},';
|
|
163
|
+
}
|
|
164
|
+
function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, }) {
|
|
165
|
+
const methodSig = new algosdk.ABIMethod(method).getSignature();
|
|
166
|
+
const uniqueName = methodSignatureToUniqueName[methodSig];
|
|
167
|
+
const onComplete = verb === 'create' ? deployTypes.getCreateOnCompleteOptions(methodSig, app) : undefined;
|
|
168
|
+
yield* writer.jsDoc({
|
|
169
|
+
description: `${description} using the ${methodSig} ABI method.`,
|
|
170
|
+
abiDescription: method?.desc,
|
|
171
|
+
params: {
|
|
172
|
+
params: `The params for the smart contract call`,
|
|
173
|
+
},
|
|
174
|
+
returns: `The ${verb} ${type === 'params' ? 'params' : type === 'createTransaction' ? 'transaction' : 'result'}${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,
|
|
175
|
+
});
|
|
176
|
+
const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
|
|
177
|
+
const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
|
|
178
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
|
|
179
|
+
yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
|
|
180
|
+
if (type === 'params' || type === 'createTransaction') {
|
|
181
|
+
yield* writer.indent(`return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
yield* writer.indent(`const result = await this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`, `return { result: { ...result.result, return: result.result.return as undefined | ${name}Returns['${methodSigSafe}'] }, appClient: new ${name}Client(result.appClient) }`);
|
|
185
|
+
}
|
|
186
|
+
yield '},';
|
|
187
|
+
}
|
|
188
|
+
function* operationMethods(generator, description, methods, verb, includeCompilation) {
|
|
189
|
+
if (methods.length) {
|
|
190
|
+
yield* writer.jsDoc(`Gets available ${verb} methods`);
|
|
191
|
+
yield `${verb}: {`;
|
|
192
|
+
yield writer.IncIndent;
|
|
193
|
+
for (const methodSig of methods) {
|
|
194
|
+
if (methodSig === getCallConfigSummary.BARE_CALL) {
|
|
195
|
+
yield* bareMethodCallParams({
|
|
196
|
+
generator,
|
|
197
|
+
name: 'bare',
|
|
198
|
+
description: `${description} using a bare call`,
|
|
199
|
+
verb,
|
|
200
|
+
type: 'params',
|
|
201
|
+
includeCompilation,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const method = generator.app.methods.find((m) => new algosdk.ABIMethod(m).getSignature() === methodSig);
|
|
206
|
+
yield* abiMethodCallParams({
|
|
207
|
+
generator,
|
|
208
|
+
method,
|
|
209
|
+
description,
|
|
210
|
+
verb,
|
|
211
|
+
type: 'params',
|
|
212
|
+
includeCompilation,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
yield writer.DecIndent;
|
|
217
|
+
yield '},';
|
|
218
|
+
yield writer.NewLine;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function* deployMethod(ctx) {
|
|
222
|
+
const { app, callConfig, name } = ctx;
|
|
223
|
+
yield* writer.jsDoc({
|
|
224
|
+
description: `Idempotently deploys the ${app.name} smart contract.`,
|
|
225
|
+
params: {
|
|
226
|
+
params: 'The arguments for the contract calls and any additional parameters for the call',
|
|
227
|
+
},
|
|
228
|
+
returns: 'The deployment result',
|
|
229
|
+
});
|
|
230
|
+
yield `public async deploy(params: ${name}DeployParams = {}) {`;
|
|
231
|
+
yield writer.IncIndent;
|
|
232
|
+
yield `const result = await this.appFactory.deploy({`;
|
|
233
|
+
yield writer.IncIndent;
|
|
234
|
+
yield `...params,`;
|
|
235
|
+
if (callConfig.createMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
|
|
236
|
+
yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams,`;
|
|
237
|
+
}
|
|
238
|
+
if (callConfig.updateMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
|
|
239
|
+
yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams,`;
|
|
240
|
+
}
|
|
241
|
+
if (callConfig.deleteMethods.filter((m) => m !== getCallConfigSummary.BARE_CALL).length) {
|
|
242
|
+
yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams,`;
|
|
243
|
+
}
|
|
244
|
+
yield writer.DecIndent;
|
|
245
|
+
yield `})`;
|
|
246
|
+
yield `return { result: result.result, appClient: new ${name}Client(result.appClient) }`;
|
|
247
|
+
yield writer.DecIndentAndCloseBlock;
|
|
248
|
+
yield writer.NewLine;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
exports.appFactory = appFactory;
|
|
252
|
+
//# sourceMappingURL=app-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-factory.js","sources":["../../src/client/app-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { ABIMethod } from 'algosdk'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\n\nexport function* appFactory(ctx: GeneratorContext): DocumentParts {\n const { app, name } = ctx\n\n yield* jsDoc(\n `A factory to create and deploy one or more instance of the ${app.name} smart contract and to create one or more app clients to interact with those (or other) app instances`,\n )\n yield `export class ${name}Factory {`\n yield IncIndent\n yield* jsDoc(`The underlying \\`AppFactory\\` for when you want to have more flexibility`)\n yield 'public readonly appFactory: AppFactory'\n yield NewLine\n\n yield* jsDoc({\n description: `Creates a new instance of \\`${name}Factory\\``,\n params: {\n params: 'The parameters to initialise the app factory with',\n },\n })\n\n yield `\n constructor(params: Omit<AppFactoryParams, 'appSpec'>) {\n this.appFactory = new AppFactory({\n ...params,\n appSpec: APP_SPEC,\n })\n }\n\n /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */\n public get appName() {\n return this.appFactory.appName\n }\n\n /** The ARC-56 app spec being used */\n get appSpec() {\n return APP_SPEC\n }\n\n /** A reference to the underlying \\`AlgorandClient\\` this app factory is using. */\n public get algorand(): AlgorandClientInterface {\n return this.appFactory.algorand\n }\n\n /**\n * Returns a new \\`AppClient\\` client for an app instance of the given ID.\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The \\`AppClient\\`\n */\n public getAppClientById(params: AppFactoryAppClientParams) {\n return new ${name}Client(this.appFactory.getAppClientById(params))\n }\n\n /**\n * Returns a new \\`AppClient\\` client, resolving the app by creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n *\n * Automatically populates appName, defaultSender and source maps from the factory\n * if not specified in the params.\n * @param params The parameters to create the app client\n * @returns The \\`AppClient\\`\n */\n public async getAppClientByCreatorAndName(\n params: AppFactoryResolveAppClientByCreatorAndNameParams,\n ) {\n return new ${name}Client(await this.appFactory.getAppClientByCreatorAndName(params))\n }\n `\n\n yield* deployMethod(ctx)\n yield* params(ctx)\n yield* createTransaction(ctx)\n yield* send(ctx)\n yield DecIndentAndCloseBlock\n}\n\nfunction* params(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(\n `Get parameters to create transactions (create and deploy related calls) for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`,\n )\n yield `readonly params = {`\n yield IncIndent\n yield* paramMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* createTransaction(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Create transactions for the current app`)\n yield `readonly createTransaction = {`\n yield IncIndent\n yield* createTransactionMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* send(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Send calls to the current app`)\n yield `readonly send = {`\n yield IncIndent\n yield* createMethods(ctx)\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n\nfunction* createMethods(generator: GeneratorContext): DocumentParts {\n const { app } = generator\n if (generator.callConfig.createMethods.length) {\n yield* jsDoc(`Gets available create methods`)\n yield `create: {`\n yield IncIndent\n for (const methodSig of generator.callConfig.createMethods) {\n if (methodSig === BARE_CALL) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `Creates a new instance of the ${app.name} smart contract using a bare call`,\n verb: 'create',\n type: 'send',\n includeCompilation: true,\n })\n } else {\n const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n yield* abiMethodCallParams({\n generator,\n method,\n description: `Creates a new instance of the ${app.name} smart contract using an ABI method call`,\n verb: 'create',\n type: 'send',\n includeCompilation: true,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* paramMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\n\n yield* operationMethods(\n ctx,\n `Updates an existing instance of the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'deployUpdate',\n true,\n )\n yield* operationMethods(ctx, `Deletes an existing instance of the ${app.name} smart contract`, callConfig.deleteMethods, 'deployDelete')\n}\n\nfunction* createTransactionMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true)\n}\n\nfunction* bareMethodCallParams({\n generator: { app, name: clientName },\n name,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n name: string\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}): DocumentParts {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined\n yield* jsDoc({\n description: `${description}.`,\n params: {\n params: `The params for the bare (raw) call`,\n },\n returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,\n })\n yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`\n if (type === 'params' || type === 'createTransaction') {\n yield* indent(`return this.appFactory.${type}.bare.${verb}(params)`)\n } else {\n yield* indent(\n `const result = await this.appFactory.send.bare.create(params)`,\n `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`,\n )\n }\n yield '},'\n}\n\nfunction* abiMethodCallParams({\n generator: { app, methodSignatureToUniqueName, name, sanitizer },\n method,\n description,\n verb,\n type,\n includeCompilation,\n}: {\n generator: GeneratorContext\n method: Method\n description: string\n verb: 'create' | 'deployUpdate' | 'deployDelete'\n type: 'params' | 'createTransaction' | 'send'\n includeCompilation?: boolean\n}) {\n const methodSig = new ABIMethod(method).getSignature()\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method.`,\n abiDescription: method?.desc,\n params: {\n params: `The params for the smart contract call`,\n },\n returns: `The ${verb} ${type === 'params' ? 'params' : type === 'createTransaction' ? 'transaction' : 'result'}${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,\n })\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${\n includeCompilation ? ' &' + ' AppClientCompilationParams' : ''\n }${\n verb === 'create' ? ' & CreateSchema' : ''\n }${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`\n if (type === 'params' || type === 'createTransaction') {\n yield* indent(\n `return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`,\n )\n } else {\n yield* indent(\n `const result = await this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`,\n `return { result: { ...result.result, return: result.result.return as undefined | ${name}Returns['${methodSigSafe}'] }, appClient: new ${name}Client(result.appClient) }`,\n )\n }\n yield '},'\n}\n\nfunction* operationMethods(\n generator: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'deployUpdate' | 'deployDelete',\n includeCompilation?: boolean,\n): DocumentParts {\n if (methods.length) {\n yield* jsDoc(`Gets available ${verb} methods`)\n yield `${verb}: {`\n yield IncIndent\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) {\n yield* bareMethodCallParams({\n generator,\n name: 'bare',\n description: `${description} using a bare call`,\n verb,\n type: 'params',\n includeCompilation,\n })\n } else {\n const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n yield* abiMethodCallParams({\n generator,\n method,\n description,\n verb,\n type: 'params',\n includeCompilation,\n })\n }\n }\n yield DecIndent\n yield '},'\n yield NewLine\n }\n}\n\nfunction* deployMethod(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig, name } = ctx\n yield* jsDoc({\n description: `Idempotently deploys the ${app.name} smart contract.`,\n params: {\n params: 'The arguments for the contract calls and any additional parameters for the call',\n },\n returns: 'The deployment result',\n })\n yield `public async deploy(params: ${name}DeployParams = {}) {`\n yield IncIndent\n\n yield `const result = await this.appFactory.deploy({`\n yield IncIndent\n yield `...params,`\n if (callConfig.createMethods.filter((m) => m !== BARE_CALL).length) {\n yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams,`\n }\n if (callConfig.updateMethods.filter((m) => m !== BARE_CALL).length) {\n yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams,`\n }\n if (callConfig.deleteMethods.filter((m) => m !== BARE_CALL).length) {\n yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams,`\n }\n yield DecIndent\n yield `})`\n yield `return { result: result.result, appClient: new ${name}Client(result.appClient) }`\n yield DecIndentAndCloseBlock\n yield NewLine\n}\n"],"names":["jsDoc","IncIndent","NewLine","DecIndentAndCloseBlock","BARE_CALL","ABIMethod","DecIndent","getCreateOnCompleteOptions","indent"],"mappings":";;;;;;;AAOe,UAAE,UAAU,CAAC,GAAqB,EAAA;AAC/C,IAAA,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAA;IAEzB,OAAOA,YAAK,CACV,CAAA,2DAAA,EAA8D,GAAG,CAAC,IAAI,CAAuG,qGAAA,CAAA,CAC9K,CAAA;IACD,MAAM,CAAA,aAAA,EAAgB,IAAI,CAAA,SAAA,CAAW,CAAA;AACrC,IAAA,MAAMC,gBAAS,CA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L } from './helpers/get-call-config-summary.mjs';
|
|
3
|
+
import { getCreateOnCompleteOptions } from './deploy-types.mjs';
|
|
4
|
+
import { ABIMethod } from 'algosdk';
|
|
5
|
+
|
|
6
|
+
function* appFactory(ctx) {
|
|
7
|
+
const { app, name } = ctx;
|
|
8
|
+
yield* jsDoc(`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`);
|
|
9
|
+
yield `export class ${name}Factory {`;
|
|
10
|
+
yield IncIndent;
|
|
11
|
+
yield* jsDoc(`The underlying \`AppFactory\` for when you want to have more flexibility`);
|
|
12
|
+
yield 'public readonly appFactory: AppFactory';
|
|
13
|
+
yield NewLine;
|
|
14
|
+
yield* jsDoc({
|
|
15
|
+
description: `Creates a new instance of \`${name}Factory\``,
|
|
16
|
+
params: {
|
|
17
|
+
params: 'The parameters to initialise the app factory with',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
yield `
|
|
21
|
+
constructor(params: Omit<AppFactoryParams, 'appSpec'>) {
|
|
22
|
+
this.appFactory = new AppFactory({
|
|
23
|
+
...params,
|
|
24
|
+
appSpec: APP_SPEC,
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
|
|
29
|
+
public get appName() {
|
|
30
|
+
return this.appFactory.appName
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The ARC-56 app spec being used */
|
|
34
|
+
get appSpec() {
|
|
35
|
+
return APP_SPEC
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A reference to the underlying \`AlgorandClient\` this app factory is using. */
|
|
39
|
+
public get algorand(): AlgorandClientInterface {
|
|
40
|
+
return this.appFactory.algorand
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns a new \`AppClient\` client for an app instance of the given ID.
|
|
45
|
+
*
|
|
46
|
+
* Automatically populates appName, defaultSender and source maps from the factory
|
|
47
|
+
* if not specified in the params.
|
|
48
|
+
* @param params The parameters to create the app client
|
|
49
|
+
* @returns The \`AppClient\`
|
|
50
|
+
*/
|
|
51
|
+
public getAppClientById(params: AppFactoryAppClientParams) {
|
|
52
|
+
return new ${name}Client(this.appFactory.getAppClientById(params))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns a new \`AppClient\` client, resolving the app by creator address and name
|
|
57
|
+
* using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
|
|
58
|
+
*
|
|
59
|
+
* Automatically populates appName, defaultSender and source maps from the factory
|
|
60
|
+
* if not specified in the params.
|
|
61
|
+
* @param params The parameters to create the app client
|
|
62
|
+
* @returns The \`AppClient\`
|
|
63
|
+
*/
|
|
64
|
+
public async getAppClientByCreatorAndName(
|
|
65
|
+
params: AppFactoryResolveAppClientByCreatorAndNameParams,
|
|
66
|
+
) {
|
|
67
|
+
return new ${name}Client(await this.appFactory.getAppClientByCreatorAndName(params))
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
yield* deployMethod(ctx);
|
|
71
|
+
yield* params(ctx);
|
|
72
|
+
yield* createTransaction(ctx);
|
|
73
|
+
yield* send(ctx);
|
|
74
|
+
yield DecIndentAndCloseBlock;
|
|
75
|
+
}
|
|
76
|
+
function* params(ctx) {
|
|
77
|
+
yield* jsDoc(`Get parameters to create transactions (create and deploy related calls) for the current app. A good mental model for this is that these parameters represent a deferred transaction creation.`);
|
|
78
|
+
yield `readonly params = {`;
|
|
79
|
+
yield IncIndent;
|
|
80
|
+
yield* paramMethods(ctx);
|
|
81
|
+
yield DecIndentAndCloseBlock;
|
|
82
|
+
yield NewLine;
|
|
83
|
+
}
|
|
84
|
+
function* createTransaction(ctx) {
|
|
85
|
+
yield* jsDoc(`Create transactions for the current app`);
|
|
86
|
+
yield `readonly createTransaction = {`;
|
|
87
|
+
yield IncIndent;
|
|
88
|
+
yield* createTransactionMethods(ctx);
|
|
89
|
+
yield DecIndentAndCloseBlock;
|
|
90
|
+
yield NewLine;
|
|
91
|
+
}
|
|
92
|
+
function* send(ctx) {
|
|
93
|
+
yield* jsDoc(`Send calls to the current app`);
|
|
94
|
+
yield `readonly send = {`;
|
|
95
|
+
yield IncIndent;
|
|
96
|
+
yield* createMethods(ctx);
|
|
97
|
+
yield DecIndentAndCloseBlock;
|
|
98
|
+
yield NewLine;
|
|
99
|
+
}
|
|
100
|
+
function* createMethods(generator) {
|
|
101
|
+
const { app } = generator;
|
|
102
|
+
if (generator.callConfig.createMethods.length) {
|
|
103
|
+
yield* jsDoc(`Gets available create methods`);
|
|
104
|
+
yield `create: {`;
|
|
105
|
+
yield IncIndent;
|
|
106
|
+
for (const methodSig of generator.callConfig.createMethods) {
|
|
107
|
+
if (methodSig === BARE_CALL) {
|
|
108
|
+
yield* bareMethodCallParams({
|
|
109
|
+
generator,
|
|
110
|
+
name: 'bare',
|
|
111
|
+
description: `Creates a new instance of the ${app.name} smart contract using a bare call`,
|
|
112
|
+
verb: 'create',
|
|
113
|
+
type: 'send',
|
|
114
|
+
includeCompilation: true,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig);
|
|
119
|
+
yield* abiMethodCallParams({
|
|
120
|
+
generator,
|
|
121
|
+
method,
|
|
122
|
+
description: `Creates a new instance of the ${app.name} smart contract using an ABI method call`,
|
|
123
|
+
verb: 'create',
|
|
124
|
+
type: 'send',
|
|
125
|
+
includeCompilation: true,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
yield DecIndent;
|
|
130
|
+
yield '},';
|
|
131
|
+
yield NewLine;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function* paramMethods(ctx) {
|
|
135
|
+
const { app, callConfig } = ctx;
|
|
136
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', 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');
|
|
139
|
+
}
|
|
140
|
+
function* createTransactionMethods(ctx) {
|
|
141
|
+
const { app, callConfig } = ctx;
|
|
142
|
+
yield* operationMethods(ctx, `Creates a new instance of the ${app.name} smart contract`, callConfig.createMethods, 'create', true);
|
|
143
|
+
}
|
|
144
|
+
function* bareMethodCallParams({ generator: { app, name: clientName }, name, description, verb, type, includeCompilation, }) {
|
|
145
|
+
const onComplete = verb === 'create' ? getCreateOnCompleteOptions(BARE_CALL, app) : undefined;
|
|
146
|
+
yield* jsDoc({
|
|
147
|
+
description: `${description}.`,
|
|
148
|
+
params: {
|
|
149
|
+
params: `The params for the bare (raw) call`,
|
|
150
|
+
},
|
|
151
|
+
returns: type === 'params' ? `The params for a ${verb} call` : `The ${verb} result`,
|
|
152
|
+
});
|
|
153
|
+
yield `${name}: ${type === 'send' ? 'async ' : ''}(params?: Expand<AppClientBareCallParams${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}>) => {`;
|
|
154
|
+
if (type === 'params' || type === 'createTransaction') {
|
|
155
|
+
yield* indent(`return this.appFactory.${type}.bare.${verb}(params)`);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
yield* indent(`const result = await this.appFactory.send.bare.create(params)`, `return { result: result.result, appClient: new ${clientName}Client(result.appClient) }`);
|
|
159
|
+
}
|
|
160
|
+
yield '},';
|
|
161
|
+
}
|
|
162
|
+
function* abiMethodCallParams({ generator: { app, methodSignatureToUniqueName, name, sanitizer }, method, description, verb, type, includeCompilation, }) {
|
|
163
|
+
const methodSig = new ABIMethod(method).getSignature();
|
|
164
|
+
const uniqueName = methodSignatureToUniqueName[methodSig];
|
|
165
|
+
const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined;
|
|
166
|
+
yield* jsDoc({
|
|
167
|
+
description: `${description} using the ${methodSig} ABI method.`,
|
|
168
|
+
abiDescription: method?.desc,
|
|
169
|
+
params: {
|
|
170
|
+
params: `The params for the smart contract call`,
|
|
171
|
+
},
|
|
172
|
+
returns: `The ${verb} ${type === 'params' ? 'params' : type === 'createTransaction' ? 'transaction' : 'result'}${method?.returns?.desc ? `: ${method.returns.desc}` : ''}`,
|
|
173
|
+
});
|
|
174
|
+
const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
|
|
175
|
+
const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
|
|
176
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
|
|
177
|
+
yield `${methodName}: ${type === 'send' ? 'async ' : ''}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' &' + ' AppClientCompilationParams' : ''}${verb === 'create' ? ' & CreateSchema' : ''}${type === 'send' ? ' & SendParams' : ''}${onComplete?.type ? ` & ${onComplete.type}` : ''}${onComplete?.isOptional !== false && (method.args.length === 0 || !method.args.some((a) => !a.defaultValue)) ? ` = {args: [${method.args.map((_) => 'undefined').join(', ')}]}` : ''}) => {`;
|
|
178
|
+
if (type === 'params' || type === 'createTransaction') {
|
|
179
|
+
yield* indent(`return this.appFactory.${type}.${verb}(${name}ParamsFactory.${verb == 'deployDelete' ? 'delete' : verb === 'deployUpdate' ? 'update' : verb}${methodNameAccessor}(params))`);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
yield* indent(`const result = await this.appFactory.send.create(${name}ParamsFactory.${verb}${methodNameAccessor}(params))`, `return { result: { ...result.result, return: result.result.return as undefined | ${name}Returns['${methodSigSafe}'] }, appClient: new ${name}Client(result.appClient) }`);
|
|
183
|
+
}
|
|
184
|
+
yield '},';
|
|
185
|
+
}
|
|
186
|
+
function* operationMethods(generator, description, methods, verb, includeCompilation) {
|
|
187
|
+
if (methods.length) {
|
|
188
|
+
yield* jsDoc(`Gets available ${verb} methods`);
|
|
189
|
+
yield `${verb}: {`;
|
|
190
|
+
yield IncIndent;
|
|
191
|
+
for (const methodSig of methods) {
|
|
192
|
+
if (methodSig === BARE_CALL) {
|
|
193
|
+
yield* bareMethodCallParams({
|
|
194
|
+
generator,
|
|
195
|
+
name: 'bare',
|
|
196
|
+
description: `${description} using a bare call`,
|
|
197
|
+
verb,
|
|
198
|
+
type: 'params',
|
|
199
|
+
includeCompilation,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
const method = generator.app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig);
|
|
204
|
+
yield* abiMethodCallParams({
|
|
205
|
+
generator,
|
|
206
|
+
method,
|
|
207
|
+
description,
|
|
208
|
+
verb,
|
|
209
|
+
type: 'params',
|
|
210
|
+
includeCompilation,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
yield DecIndent;
|
|
215
|
+
yield '},';
|
|
216
|
+
yield NewLine;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function* deployMethod(ctx) {
|
|
220
|
+
const { app, callConfig, name } = ctx;
|
|
221
|
+
yield* jsDoc({
|
|
222
|
+
description: `Idempotently deploys the ${app.name} smart contract.`,
|
|
223
|
+
params: {
|
|
224
|
+
params: 'The arguments for the contract calls and any additional parameters for the call',
|
|
225
|
+
},
|
|
226
|
+
returns: 'The deployment result',
|
|
227
|
+
});
|
|
228
|
+
yield `public async deploy(params: ${name}DeployParams = {}) {`;
|
|
229
|
+
yield IncIndent;
|
|
230
|
+
yield `const result = await this.appFactory.deploy({`;
|
|
231
|
+
yield IncIndent;
|
|
232
|
+
yield `...params,`;
|
|
233
|
+
if (callConfig.createMethods.filter((m) => m !== BARE_CALL).length) {
|
|
234
|
+
yield `createParams: params.createParams?.method ? ${name}ParamsFactory.create._resolveByMethod(params.createParams) : params.createParams,`;
|
|
235
|
+
}
|
|
236
|
+
if (callConfig.updateMethods.filter((m) => m !== BARE_CALL).length) {
|
|
237
|
+
yield `updateParams: params.updateParams?.method ? ${name}ParamsFactory.update._resolveByMethod(params.updateParams) : params.updateParams,`;
|
|
238
|
+
}
|
|
239
|
+
if (callConfig.deleteMethods.filter((m) => m !== BARE_CALL).length) {
|
|
240
|
+
yield `deleteParams: params.deleteParams?.method ? ${name}ParamsFactory.delete._resolveByMethod(params.deleteParams) : params.deleteParams,`;
|
|
241
|
+
}
|
|
242
|
+
yield DecIndent;
|
|
243
|
+
yield `})`;
|
|
244
|
+
yield `return { result: result.result, appClient: new ${name}Client(result.appClient) }`;
|
|
245
|
+
yield DecIndentAndCloseBlock;
|
|
246
|
+
yield NewLine;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export { appFactory };
|
|
250
|
+
//# sourceMappingURL=app-factory.mjs.map
|
|
@@ -0,0 +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,wCAAwC,CAAA;AAC9C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;m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