@algorandfoundation/algokit-client-generator 4.0.0-beta.3 → 4.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/app-client.js +55 -28
- package/client/app-client.js.map +1 -1
- package/client/app-client.mjs +55 -28
- package/client/app-client.mjs.map +1 -1
- package/client/app-factory.js +26 -29
- package/client/app-factory.js.map +1 -1
- package/client/app-factory.mjs +26 -29
- package/client/app-factory.mjs.map +1 -1
- package/client/app-types.js +78 -28
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs +79 -29
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js +6 -6
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs +6 -6
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js +11 -11
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs +11 -11
- package/client/call-composer.mjs.map +1 -1
- package/client/deploy-types.js +9 -9
- package/client/deploy-types.js.map +1 -1
- package/client/deploy-types.mjs +9 -9
- package/client/deploy-types.mjs.map +1 -1
- package/client/generate.js +1 -2
- package/client/generate.js.map +1 -1
- package/client/generate.mjs +1 -2
- package/client/generate.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.js +2 -0
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs +2 -0
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.js +2 -1
- package/client/imports.js.map +1 -1
- package/client/imports.mjs +2 -1
- package/client/imports.mjs.map +1 -1
- package/client/params-factory.js +11 -11
- package/client/params-factory.js.map +1 -1
- package/client/params-factory.mjs +11 -11
- package/client/params-factory.mjs.map +1 -1
- package/output/writer.d.ts +5 -5
- package/output/writer.js +9 -3
- package/output/writer.js.map +1 -1
- package/output/writer.mjs +9 -3
- package/output/writer.mjs.map +1 -1
- package/package.json +2 -2
- package/schema/load.js +7 -1
- package/schema/load.js.map +1 -1
- package/schema/load.mjs +7 -1
- package/schema/load.mjs.map +1 -1
- package/util/sanitization.js +1 -1
- package/util/sanitization.js.map +1 -1
- package/util/sanitization.mjs +1 -1
- package/util/sanitization.mjs.map +1 -1
package/client/call-composer.mjs
CHANGED
|
@@ -5,10 +5,11 @@ import { ABIMethod } from 'algosdk';
|
|
|
5
5
|
|
|
6
6
|
function* composeMethod(ctx) {
|
|
7
7
|
const { name, callConfig } = ctx;
|
|
8
|
+
// todo: Patrick feedback - allow common params to be passed in here so they propagate to all params calls e.g. firstValid
|
|
8
9
|
yield `public newGroup(): ${name}Composer {`;
|
|
9
10
|
yield IncIndent;
|
|
10
11
|
yield `const client = this`;
|
|
11
|
-
yield `const composer =
|
|
12
|
+
yield `const composer = this.algorand.newGroup()`;
|
|
12
13
|
yield `let promiseChain:Promise<unknown> = Promise.resolve()`;
|
|
13
14
|
yield `const resultMappers: Array<undefined | ((x: ABIReturn | undefined) => any)> = []`;
|
|
14
15
|
yield `return {`;
|
|
@@ -56,7 +57,7 @@ function* composeMethod(ctx) {
|
|
|
56
57
|
yield `} as unknown as ${name}Composer`;
|
|
57
58
|
yield DecIndentAndCloseBlock;
|
|
58
59
|
}
|
|
59
|
-
function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }) {
|
|
60
|
+
function* callComposerNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }) {
|
|
60
61
|
if (callConfig.callMethods.includes(BARE_CALL)) {
|
|
61
62
|
yield* jsDoc(`Add a bare method call to the ${app.name} contract`);
|
|
62
63
|
yield `bare(params: AppClientBareCallParams & ${getCallOnCompleteOptions(BARE_CALL, app).type}) {`;
|
|
@@ -68,17 +69,17 @@ function* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sani
|
|
|
68
69
|
}
|
|
69
70
|
for (const methodSignature of callConfig.callMethods.filter((m) => m !== BARE_CALL).map((m) => m)) {
|
|
70
71
|
const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]);
|
|
71
|
-
const
|
|
72
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature);
|
|
72
73
|
const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
|
|
73
74
|
// Skip methods which don't support a no_op call config
|
|
74
75
|
if (!callConfig.callMethods.includes(methodSignature))
|
|
75
76
|
continue;
|
|
76
77
|
yield* jsDoc(`Add a ${methodSignature} method call against the ${app.name} contract`);
|
|
77
|
-
yield `${methodName}(params: CallParams
|
|
78
|
+
yield `${methodName}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & ${getCallOnCompleteOptions(methodSignature, app).type}) {`;
|
|
78
79
|
yield IncIndent;
|
|
79
80
|
yield `promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params${methodNameAccessor}(params)))`;
|
|
80
81
|
const outputTypeName = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSignature)?.returns.type;
|
|
81
|
-
yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${
|
|
82
|
+
yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSigSafe}', v)` : 'undefined'})`;
|
|
82
83
|
yield `return this`;
|
|
83
84
|
yield DecIndent;
|
|
84
85
|
yield '},';
|
|
@@ -93,20 +94,19 @@ function* callComposerClearState({ app }) {
|
|
|
93
94
|
yield DecIndent;
|
|
94
95
|
yield '},';
|
|
95
96
|
}
|
|
96
|
-
function* callComposerOperationMethods({ app, methodSignatureToUniqueName, sanitizer }, methods, verb, includeCompilation) {
|
|
97
|
+
function* callComposerOperationMethods({ app, name, methodSignatureToUniqueName, sanitizer }, methods, verb, includeCompilation) {
|
|
97
98
|
const callType = verb === 'update' ? 'Update' : verb === 'delete' ? 'Delete' : 'Call';
|
|
98
99
|
if (methods.length) {
|
|
99
100
|
yield `get ${verb}() {`;
|
|
100
101
|
yield IncIndent;
|
|
101
|
-
yield `const $this = this`;
|
|
102
102
|
yield `return {`;
|
|
103
103
|
yield IncIndent;
|
|
104
104
|
for (const methodSig of methods) {
|
|
105
105
|
if (methodSig === BARE_CALL) {
|
|
106
|
-
yield `bare(params?: AppClientBareCallParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}) {`;
|
|
106
|
+
yield `bare: (params?: AppClientBareCallParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}) => {`;
|
|
107
107
|
yield IncIndent;
|
|
108
108
|
yield `promiseChain = promiseChain.then(${verb === 'update' ? 'async ' : ''}() => composer.addApp${callType}(${verb === 'update' ? 'await ' : ''}client.params.${verb}.bare(params)))`;
|
|
109
|
-
yield `return
|
|
109
|
+
yield `return this`;
|
|
110
110
|
yield DecIndent;
|
|
111
111
|
yield '},';
|
|
112
112
|
}
|
|
@@ -115,12 +115,12 @@ function* callComposerOperationMethods({ app, methodSignatureToUniqueName, sanit
|
|
|
115
115
|
const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName);
|
|
116
116
|
const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName);
|
|
117
117
|
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig);
|
|
118
|
-
yield `${methodName}(params: CallParams
|
|
118
|
+
yield `${methodName}: (params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' & AppClientCompilationParams' : ''}) => {`;
|
|
119
119
|
yield IncIndent;
|
|
120
120
|
yield `promiseChain = promiseChain.then(async () => composer.addApp${callType}MethodCall(await client.params.${verb}${methodNameAccessor}(params)))`;
|
|
121
121
|
const outputTypeName = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)?.returns.type;
|
|
122
122
|
yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSigSafe}', v)` : 'undefined'})`;
|
|
123
|
-
yield `return
|
|
123
|
+
yield `return this`;
|
|
124
124
|
yield DecIndent;
|
|
125
125
|
yield '},';
|
|
126
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-composer.mjs","sources":["../../src/client/call-composer.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCallOnCompleteOptions } from './deploy-types'\nimport { ABIMethod, ABIMethodParams } from 'algosdk'\n\nexport function* composeMethod(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig } = ctx\n yield `public newGroup(): ${name}Composer {`\n yield IncIndent\n\n yield `const client = this`\n yield `const composer = client.appClient.newGroup()`\n yield `let promiseChain:Promise<unknown> = Promise.resolve()`\n yield `const resultMappers: Array<undefined | ((x: ABIReturn | undefined) => any)> = []`\n yield `return {`\n yield IncIndent\n\n yield* callComposerNoops(ctx)\n yield* callComposerOperationMethods(ctx, callConfig.updateMethods, 'update', true)\n yield* callComposerOperationMethods(ctx, callConfig.deleteMethods, 'delete')\n yield* callComposerOperationMethods(ctx, callConfig.optInMethods, 'optIn')\n yield* callComposerOperationMethods(ctx, callConfig.closeOutMethods, 'closeOut')\n yield* callComposerClearState(ctx)\n\n yield `addTransaction(txn: Transaction, signer?: TransactionSigner) {`\n yield IncIndent\n yield 'promiseChain = promiseChain.then(() => composer.addTransaction(txn, signer))'\n yield 'return this'\n yield DecIndent\n yield '},'\n\n yield `async composer() {`\n yield IncIndent\n yield `await promiseChain`\n yield 'return composer'\n yield DecIndent\n yield '},'\n\n yield `async simulate(options?: SimulateOptions) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await composer.simulate(options)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n\n yield `async send(params?: SendParams) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await composer.send(params)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `} as unknown as ${name}Composer`\n\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerNoops({ app, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n if (callConfig.callMethods.includes(BARE_CALL)) {\n yield* jsDoc(`Add a bare method call to the ${app.name} contract`)\n yield `bare(params: AppClientBareCallParams & ${getCallOnCompleteOptions(BARE_CALL, app).type}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => composer.addAppCall(client.params.bare(params)))`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n\n for (const methodSignature of callConfig.callMethods.filter((m) => m !== BARE_CALL).map((m) => m as string)) {\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n const methodSignatureSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n yield* jsDoc(`Add a ${methodSignature} method call against the ${app.name} contract`)\n yield `${methodName}(params: CallParams<'${methodSignatureSafe}'> & ${getCallOnCompleteOptions(methodSignature, app).type}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params${methodNameAccessor}(params)))`\n const outputTypeName = app.methods.find((m: ABIMethodParams) => new ABIMethod(m).getSignature() === methodSignature)?.returns.type\n yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSignatureSafe}', v)` : 'undefined'})`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n}\n\nfunction* callComposerClearState({ app }: GeneratorContext): DocumentParts {\n yield* jsDoc(`Add a clear state call to the ${app.name} contract`)\n yield `clearState(params: AppClientBareCallParams) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => composer.addAppCall(client.params.clearState(params)))`\n yield `return this`\n yield DecIndent\n yield '},'\n}\n\nfunction* callComposerOperationMethods(\n { app, methodSignatureToUniqueName, sanitizer }: GeneratorContext,\n methods: MethodList,\n verb: 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const callType = verb === 'update' ? 'Update' : verb === 'delete' ? 'Delete' : 'Call'\n if (methods.length) {\n yield `get ${verb}() {`\n yield IncIndent\n yield `const $this = this`\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) {\n yield `bare(params?: AppClientBareCallParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(${verb === 'update' ? 'async ' : ''}() => composer.addApp${callType}(${verb === 'update' ? 'await ' : ''}client.params.${verb}.bare(params)))`\n yield `return $this`\n yield DecIndent\n yield '},'\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}(params: CallParams<'${methodSigSafe}'>${includeCompilation ? ' & AppClientCompilationParams' : ''}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(async () => composer.addApp${callType}MethodCall(await client.params.${verb}${methodNameAccessor}(params)))`\n const outputTypeName = app.methods.find((m: ABIMethodParams) => new ABIMethod(m).getSignature() === methodSig)?.returns.type\n yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSigSafe}', v)` : 'undefined'})`\n yield `return $this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;AACD,QAAA,MAAM,sBAAsB,CAAA;AAC5B,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,MAAM,IAAI,CAAA;KACX;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"call-composer.mjs","sources":["../../src/client/call-composer.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, jsDoc } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCallOnCompleteOptions } from './deploy-types'\nimport { ABIMethod, ABIMethodParams } from 'algosdk'\n\nexport function* composeMethod(ctx: GeneratorContext): DocumentParts {\n const { name, callConfig } = ctx\n // todo: Patrick feedback - allow common params to be passed in here so they propagate to all params calls e.g. firstValid\n yield `public newGroup(): ${name}Composer {`\n yield IncIndent\n\n yield `const client = this`\n yield `const composer = this.algorand.newGroup()`\n yield `let promiseChain:Promise<unknown> = Promise.resolve()`\n yield `const resultMappers: Array<undefined | ((x: ABIReturn | undefined) => any)> = []`\n yield `return {`\n yield IncIndent\n\n yield* callComposerNoops(ctx)\n yield* callComposerOperationMethods(ctx, callConfig.updateMethods, 'update', true)\n yield* callComposerOperationMethods(ctx, callConfig.deleteMethods, 'delete')\n yield* callComposerOperationMethods(ctx, callConfig.optInMethods, 'optIn')\n yield* callComposerOperationMethods(ctx, callConfig.closeOutMethods, 'closeOut')\n yield* callComposerClearState(ctx)\n\n yield `addTransaction(txn: Transaction, signer?: TransactionSigner) {`\n yield IncIndent\n yield 'promiseChain = promiseChain.then(() => composer.addTransaction(txn, signer))'\n yield 'return this'\n yield DecIndent\n yield '},'\n\n yield `async composer() {`\n yield IncIndent\n yield `await promiseChain`\n yield 'return composer'\n yield DecIndent\n yield '},'\n\n yield `async simulate(options?: SimulateOptions) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await composer.simulate(options)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n\n yield `async send(params?: SendParams) {`\n yield IncIndent\n yield `await promiseChain`\n yield `const result = await composer.send(params)`\n yield `return {`\n yield IncIndent\n yield `...result,`\n yield `returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val) : val.returnValue)`\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield `} as unknown as ${name}Composer`\n\n yield DecIndentAndCloseBlock\n}\n\nfunction* callComposerNoops({ app, name, callConfig, methodSignatureToUniqueName, sanitizer }: GeneratorContext): DocumentParts {\n if (callConfig.callMethods.includes(BARE_CALL)) {\n yield* jsDoc(`Add a bare method call to the ${app.name} contract`)\n yield `bare(params: AppClientBareCallParams & ${getCallOnCompleteOptions(BARE_CALL, app).type}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => composer.addAppCall(client.params.bare(params)))`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n\n for (const methodSignature of callConfig.callMethods.filter((m) => m !== BARE_CALL).map((m) => m as string)) {\n const methodName = sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature])\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSignature)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n // Skip methods which don't support a no_op call config\n if (!callConfig.callMethods.includes(methodSignature)) continue\n yield* jsDoc(`Add a ${methodSignature} method call against the ${app.name} contract`)\n yield `${methodName}(params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & ${getCallOnCompleteOptions(methodSignature, app).type}) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(async () => composer.addAppCallMethodCall(await client.params${methodNameAccessor}(params)))`\n const outputTypeName = app.methods.find((m: ABIMethodParams) => new ABIMethod(m).getSignature() === methodSignature)?.returns.type\n yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSigSafe}', v)` : 'undefined'})`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n}\n\nfunction* callComposerClearState({ app }: GeneratorContext): DocumentParts {\n yield* jsDoc(`Add a clear state call to the ${app.name} contract`)\n yield `clearState(params: AppClientBareCallParams) {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(() => composer.addAppCall(client.params.clearState(params)))`\n yield `return this`\n yield DecIndent\n yield '},'\n}\n\nfunction* callComposerOperationMethods(\n { app, name, methodSignatureToUniqueName, sanitizer }: GeneratorContext,\n methods: MethodList,\n verb: 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const callType = verb === 'update' ? 'Update' : verb === 'delete' ? 'Delete' : 'Call'\n if (methods.length) {\n yield `get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) {\n yield `bare: (params?: AppClientBareCallParams ${includeCompilation ? '& AppClientCompilationParams ' : ''}) => {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(${verb === 'update' ? 'async ' : ''}() => composer.addApp${callType}(${verb === 'update' ? 'await ' : ''}client.params.${verb}.bare(params)))`\n yield `return this`\n yield DecIndent\n yield '},'\n } else {\n const uniqueName = methodSignatureToUniqueName[methodSig]\n const methodName = sanitizer.makeSafeMethodIdentifier(uniqueName)\n const methodNameAccessor = sanitizer.getSafeMemberAccessor(methodName)\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(methodSig)\n yield `${methodName}: (params: CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']>${includeCompilation ? ' & AppClientCompilationParams' : ''}) => {`\n yield IncIndent\n yield `promiseChain = promiseChain.then(async () => composer.addApp${callType}MethodCall(await client.params.${verb}${methodNameAccessor}(params)))`\n const outputTypeName = app.methods.find((m: ABIMethodParams) => new ABIMethod(m).getSignature() === methodSig)?.returns.type\n yield `resultMappers.push(${outputTypeName && outputTypeName !== 'void' ? `(v) => client.decodeReturnValue('${methodSigSafe}', v)` : 'undefined'})`\n yield `return this`\n yield DecIndent\n yield '},'\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndent\n yield '},'\n }\n}\n"],"names":[],"mappings":";;;;;AAMe,UAAE,aAAa,CAAC,GAAqB,EAAA;AAClD,IAAA,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;;IAEhC,MAAM,CAAA,mBAAA,EAAsB,IAAI,CAAA,UAAA,CAAY,CAAA;AAC5C,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,MAAM,qBAAqB,CAAA;AAC3B,IAAA,MAAM,2CAA2C,CAAA;AACjD,IAAA,MAAM,uDAAuD,CAAA;AAC7D,IAAA,MAAM,kFAAkF,CAAA;AACxF,IAAA,MAAM,UAAU,CAAA;AAChB,IAAA,MAAM,SAAS,CAAA;AAEf,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAA;AAC7B,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AAClF,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;AAC5E,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;AAC1E,IAAA,OAAO,4BAA4B,CAAC,GAAG,EAAE,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;AAChF,IAAA,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAA;AAElC,IAAA,MAAM,gEAAgE,CAAA;AACtE,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,MAAM,8EAA8E,CAAA;AACpF,IAAA,MAAM,aAAa,CAAA;AACnB,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;AAEV,IAA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IAAI,cAAc,KAAK,MAAM,GAAG,CAAA,iCAAA,EAAoC,aAAa,CAAO,KAAA,CAAA,GAAG,WAAW,GAAG,CAAA;AACnJ,gBAAA,MAAM,aAAa,CAAA;AACnB,gBAAA,MAAM,SAAS,CAAA;AACf,gBAAA,MAAM,IAAI,CAAA;aACX;SACF;AACD,QAAA,MAAM,sBAAsB,CAAA;AAC5B,QAAA,MAAM,SAAS,CAAA;AACf,QAAA,MAAM,IAAI,CAAA;KACX;AACH;;;;"}
|
package/client/deploy-types.js
CHANGED
|
@@ -38,13 +38,13 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
38
38
|
yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`;
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
41
42
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
42
43
|
if (uniqueName !== method) {
|
|
43
44
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
44
|
-
yield `| Expand<CallParams
|
|
45
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`;
|
|
47
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
yield writer.DecIndent;
|
|
@@ -59,12 +59,12 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
62
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
62
63
|
if (uniqueName !== method) {
|
|
63
64
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
64
|
-
yield `| Expand<CallParams
|
|
65
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`;
|
|
67
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
yield writer.DecIndent;
|
|
@@ -79,12 +79,12 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
81
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
82
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
82
83
|
if (uniqueName !== method) {
|
|
83
84
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
84
|
-
yield `| Expand<CallParams
|
|
85
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`;
|
|
87
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
yield writer.DecIndent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-types.js","sources":["../../src/client/deploy-types.ts"],"sourcesContent":["import { DecIndent, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { BARE_CALL, MethodIdentifier } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function getCreateOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCreateOnCompletes =\n method === BARE_CALL ? app.bareActions.create : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.create\n const hasNoOp = validCreateOnCompletes?.includes('NoOp')\n const onCompleteType = validCreateOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCreateOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function getCallOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCallOnCompletes =\n method === BARE_CALL ? app.bareActions.call : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.call\n const hasNoOp = validCallOnCompletes?.includes('NoOp')\n const onCompleteType = validCallOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCallOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName }: GeneratorContext): DocumentParts {\n const name = sanitizer.makeSafeTypeIdentifier(app.name)\n\n if (callConfig.createMethods.length > 0) {\n yield* jsDoc('Defines supported create method params for this smart contract')\n yield `export type ${name}CreateCallParams =`\n yield IncIndent\n for (const method of callConfig.createMethods) {\n const onComplete = getCreateOnCompleteOptions(method, app)\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`\n }\n }\n yield DecIndent\n }\n if (callConfig.updateMethods.length > 0) {\n yield* jsDoc('Defines supported update method params for this smart contract')\n yield `export type ${name}UpdateCallParams =`\n yield IncIndent\n for (const method of callConfig.updateMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'}>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n if (callConfig.deleteMethods.length > 0) {\n yield* jsDoc('Defines supported delete method params for this smart contract')\n yield `export type ${name}DeleteCallParams =`\n yield IncIndent\n for (const method of callConfig.deleteMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'}>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n yield* jsDoc('Defines arguments required for the deploy method.')\n yield `export type ${name}DeployParams = Expand<Omit<AppFactoryDeployParams, 'createParams' | 'updateParams' | 'deleteParams'> & {`\n yield IncIndent\n if (callConfig.createMethods.length) {\n yield* jsDoc(\n 'Create transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `createParams?: ${name}CreateCallParams`\n }\n if (callConfig.updateMethods.length) {\n yield* jsDoc(\n 'Update transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `updateParams?: ${name}UpdateCallParams`\n }\n if (callConfig.deleteMethods.length) {\n yield* jsDoc(\n 'Delete transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `deleteParams?: ${name}DeleteCallParams`\n }\n yield DecIndent\n yield `}>`\n yield NewLine\n}\n"],"names":["BARE_CALL","ABIMethod","jsDoc","IncIndent","DecIndent","NewLine"],"mappings":";;;;;;AAMgB,SAAA,0BAA0B,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACrF,IAAA,MAAM,sBAAsB,GAC1B,MAAM,KAAKA,8BAAS,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAIC,iBAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAA;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxD,MAAM,cAAc,GAAG,sBAAsB;AAC3C,UAAE,CAAA,WAAA,EAAc,OAAO,GAAG,GAAG,GAAG,EAAE,CAAA,EAAA,EAAK,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAyB,sBAAA,EAAA,EAAE,CAAI,EAAA,CAAA,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAG,CAAA,CAAA;UACvH,EAAE,CAAA;IACN,OAAO;AACL,QAAA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CAAA,YAAA,EAAe,IAAI,CAAA,wGAAA,CAA0G,CAAA;AACnI,IAAA,MAAMC,gBAAS,CAAA;AACf,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOD,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,MAAME,gBAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;AACV,IAAA,MAAMC,cAAO,CAAA;AACf;;;;;;"}
|
|
1
|
+
{"version":3,"file":"deploy-types.js","sources":["../../src/client/deploy-types.ts"],"sourcesContent":["import { DecIndent, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { BARE_CALL, MethodIdentifier } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function getCreateOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCreateOnCompletes =\n method === BARE_CALL ? app.bareActions.create : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.create\n const hasNoOp = validCreateOnCompletes?.includes('NoOp')\n const onCompleteType = validCreateOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCreateOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function getCallOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCallOnCompletes =\n method === BARE_CALL ? app.bareActions.call : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.call\n const hasNoOp = validCallOnCompletes?.includes('NoOp')\n const onCompleteType = validCallOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCallOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName }: GeneratorContext): DocumentParts {\n const name = sanitizer.makeSafeTypeIdentifier(app.name)\n\n if (callConfig.createMethods.length > 0) {\n yield* jsDoc('Defines supported create method params for this smart contract')\n yield `export type ${name}CreateCallParams =`\n yield IncIndent\n for (const method of callConfig.createMethods) {\n const onComplete = getCreateOnCompleteOptions(method, app)\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`\n } else {\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`\n }\n }\n yield DecIndent\n }\n if (callConfig.updateMethods.length > 0) {\n yield* jsDoc('Defines supported update method params for this smart contract')\n yield `export type ${name}UpdateCallParams =`\n yield IncIndent\n for (const method of callConfig.updateMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n if (callConfig.deleteMethods.length > 0) {\n yield* jsDoc('Defines supported delete method params for this smart contract')\n yield `export type ${name}DeleteCallParams =`\n yield IncIndent\n for (const method of callConfig.deleteMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n yield* jsDoc('Defines arguments required for the deploy method.')\n yield `export type ${name}DeployParams = Expand<Omit<AppFactoryDeployParams, 'createParams' | 'updateParams' | 'deleteParams'> & {`\n yield IncIndent\n if (callConfig.createMethods.length) {\n yield* jsDoc(\n 'Create transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `createParams?: ${name}CreateCallParams`\n }\n if (callConfig.updateMethods.length) {\n yield* jsDoc(\n 'Update transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `updateParams?: ${name}UpdateCallParams`\n }\n if (callConfig.deleteMethods.length) {\n yield* jsDoc(\n 'Delete transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `deleteParams?: ${name}DeleteCallParams`\n }\n yield DecIndent\n yield `}>`\n yield NewLine\n}\n"],"names":["BARE_CALL","ABIMethod","jsDoc","IncIndent","DecIndent","NewLine"],"mappings":";;;;;;AAMgB,SAAA,0BAA0B,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACrF,IAAA,MAAM,sBAAsB,GAC1B,MAAM,KAAKA,8BAAS,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAIC,iBAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAA;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxD,MAAM,cAAc,GAAG,sBAAsB;AAC3C,UAAE,CAAA,WAAA,EAAc,OAAO,GAAG,GAAG,GAAG,EAAE,CAAA,EAAA,EAAK,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAyB,sBAAA,EAAA,EAAE,CAAI,EAAA,CAAA,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAG,CAAA,CAAA;UACvH,EAAE,CAAA;IACN,OAAO;AACL,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,UAAU,EAAE,OAAO;KACpB,CAAA;AACH,CAAC;AAEe,SAAA,wBAAwB,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACnF,IAAA,MAAM,oBAAoB,GACxB,MAAM,KAAKD,8BAAS,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,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AAgB,aAAa,CAAA,KAAA,EAAQ,IAAI,CAAA,eAAA,EAAkB,aAAa,CAAA,gBAAA,EAAmB,aAAa,CAAA,GAAA,CAAK,CAAA;aAC/I;SACF;AACD,QAAA,MAAMI,gBAAS,CAAA;KAChB;AAED,IAAA,OAAOF,YAAK,CAAC,mDAAmD,CAAC,CAAA;IACjE,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,wGAAA,CAA0G,CAAA;AACnI,IAAA,MAAMC,gBAAS,CAAA;AACf,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOD,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL,CAAA;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,MAAME,gBAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;AACV,IAAA,MAAMC,cAAO,CAAA;AACf;;;;;;"}
|
package/client/deploy-types.mjs
CHANGED
|
@@ -36,13 +36,13 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
36
36
|
yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`;
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
39
40
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
40
41
|
if (uniqueName !== method) {
|
|
41
42
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
42
|
-
yield `| Expand<CallParams
|
|
43
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`;
|
|
45
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
yield DecIndent;
|
|
@@ -57,12 +57,12 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
60
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
60
61
|
if (uniqueName !== method) {
|
|
61
62
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
62
|
-
yield `| Expand<CallParams
|
|
63
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`;
|
|
65
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
yield DecIndent;
|
|
@@ -77,12 +77,12 @@ function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName
|
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
const uniqueName = methodSignatureToUniqueName[method];
|
|
80
|
+
const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method);
|
|
80
81
|
if (uniqueName !== method) {
|
|
81
82
|
const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName);
|
|
82
|
-
yield `| Expand<CallParams
|
|
83
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`;
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`;
|
|
85
|
+
yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
yield DecIndent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-types.mjs","sources":["../../src/client/deploy-types.ts"],"sourcesContent":["import { DecIndent, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { BARE_CALL, MethodIdentifier } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function getCreateOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCreateOnCompletes =\n method === BARE_CALL ? app.bareActions.create : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.create\n const hasNoOp = validCreateOnCompletes?.includes('NoOp')\n const onCompleteType = validCreateOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCreateOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function getCallOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCallOnCompletes =\n method === BARE_CALL ? app.bareActions.call : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.call\n const hasNoOp = validCallOnCompletes?.includes('NoOp')\n const onCompleteType = validCallOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCallOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName }: GeneratorContext): DocumentParts {\n const name = sanitizer.makeSafeTypeIdentifier(app.name)\n\n if (callConfig.createMethods.length > 0) {\n yield* jsDoc('Defines supported create method params for this smart contract')\n yield `export type ${name}CreateCallParams =`\n yield IncIndent\n for (const method of callConfig.createMethods) {\n const onComplete = getCreateOnCompleteOptions(method, app)\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`\n }\n }\n yield DecIndent\n }\n if (callConfig.updateMethods.length > 0) {\n yield* jsDoc('Defines supported update method params for this smart contract')\n yield `export type ${name}UpdateCallParams =`\n yield IncIndent\n for (const method of callConfig.updateMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'}>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n if (callConfig.deleteMethods.length > 0) {\n yield* jsDoc('Defines supported delete method params for this smart contract')\n yield `export type ${name}DeleteCallParams =`\n yield IncIndent\n for (const method of callConfig.deleteMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<'${methodName}'> & {method: '${methodName}'}>`\n }\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n yield `| Expand<CallParams<'${methodSigSafe}'> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n yield* jsDoc('Defines arguments required for the deploy method.')\n yield `export type ${name}DeployParams = Expand<Omit<AppFactoryDeployParams, 'createParams' | 'updateParams' | 'deleteParams'> & {`\n yield IncIndent\n if (callConfig.createMethods.length) {\n yield* jsDoc(\n 'Create transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `createParams?: ${name}CreateCallParams`\n }\n if (callConfig.updateMethods.length) {\n yield* jsDoc(\n 'Update transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `updateParams?: ${name}UpdateCallParams`\n }\n if (callConfig.deleteMethods.length) {\n yield* jsDoc(\n 'Delete transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `deleteParams?: ${name}DeleteCallParams`\n }\n yield DecIndent\n yield `}>`\n yield NewLine\n}\n"],"names":[],"mappings":";;;;AAMgB,SAAA,0BAA0B,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACrF,IAAA,MAAM,sBAAsB,GAC1B,MAAM,KAAK,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
|
+
{"version":3,"file":"deploy-types.mjs","sources":["../../src/client/deploy-types.ts"],"sourcesContent":["import { DecIndent, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { BARE_CALL, MethodIdentifier } from './helpers/get-call-config-summary'\nimport { GeneratorContext } from './generator-context'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function getCreateOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCreateOnCompletes =\n method === BARE_CALL ? app.bareActions.create : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.create\n const hasNoOp = validCreateOnCompletes?.includes('NoOp')\n const onCompleteType = validCreateOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCreateOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function getCallOnCompleteOptions(method: MethodIdentifier, app: Arc56Contract) {\n const validCallOnCompletes =\n method === BARE_CALL ? app.bareActions.call : app.methods.find((m) => new ABIMethod(m).getSignature() === method)?.actions?.call\n const hasNoOp = validCallOnCompletes?.includes('NoOp')\n const onCompleteType = validCallOnCompletes\n ? `{onComplete${hasNoOp ? '?' : ''}: ${validCallOnCompletes.map((oc) => `OnApplicationComplete.${oc}OC`).join(' | ')}}`\n : {}\n return {\n type: onCompleteType,\n isOptional: hasNoOp,\n }\n}\n\nexport function* deployTypes({ app, callConfig, sanitizer, methodSignatureToUniqueName }: GeneratorContext): DocumentParts {\n const name = sanitizer.makeSafeTypeIdentifier(app.name)\n\n if (callConfig.createMethods.length > 0) {\n yield* jsDoc('Defines supported create method params for this smart contract')\n yield `export type ${name}CreateCallParams =`\n yield IncIndent\n for (const method of callConfig.createMethods) {\n const onComplete = getCreateOnCompleteOptions(method, app)\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams & {method?: undefined} & ${onComplete.type} & CreateSchema>`\n } else {\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n const uniqueName = methodSignatureToUniqueName[method]\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'} & ${onComplete.type} & CreateSchema>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'} & ${onComplete.type} & CreateSchema>`\n }\n }\n yield DecIndent\n }\n if (callConfig.updateMethods.length > 0) {\n yield* jsDoc('Defines supported update method params for this smart contract')\n yield `export type ${name}UpdateCallParams =`\n yield IncIndent\n for (const method of callConfig.updateMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n if (callConfig.deleteMethods.length > 0) {\n yield* jsDoc('Defines supported delete method params for this smart contract')\n yield `export type ${name}DeleteCallParams =`\n yield IncIndent\n for (const method of callConfig.deleteMethods) {\n if (method === BARE_CALL) {\n yield `| Expand<AppClientBareCallParams> & {method?: undefined}`\n } else {\n const uniqueName = methodSignatureToUniqueName[method]\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method)\n if (uniqueName !== method) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n yield* jsDoc('Defines arguments required for the deploy method.')\n yield `export type ${name}DeployParams = Expand<Omit<AppFactoryDeployParams, 'createParams' | 'updateParams' | 'deleteParams'> & {`\n yield IncIndent\n if (callConfig.createMethods.length) {\n yield* jsDoc(\n 'Create transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `createParams?: ${name}CreateCallParams`\n }\n if (callConfig.updateMethods.length) {\n yield* jsDoc(\n 'Update transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `updateParams?: ${name}UpdateCallParams`\n }\n if (callConfig.deleteMethods.length) {\n yield* jsDoc(\n 'Delete transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `deleteParams?: ${name}DeleteCallParams`\n }\n yield DecIndent\n yield `}>`\n yield NewLine\n}\n"],"names":[],"mappings":";;;;AAMgB,SAAA,0BAA0B,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACrF,IAAA,MAAM,sBAAsB,GAC1B,MAAM,KAAK,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAA;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxD,MAAM,cAAc,GAAG,sBAAsB;AAC3C,UAAE,CAAA,WAAA,EAAc,OAAO,GAAG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gBAAA,CAAkB,CAAA;KAC/C;AACD,IAAA,MAAM,SAAS,CAAA;AACf,IAAA,MAAM,IAAI,CAAA;AACV,IAAA,MAAM,OAAO,CAAA;AACf;;;;"}
|
package/client/generate.js
CHANGED
|
@@ -20,7 +20,6 @@ function convertStructs(s, sanitizer) {
|
|
|
20
20
|
function* generate(app, options = { preserveNames: false }) {
|
|
21
21
|
const ctx = generatorContext.createGeneratorContext(app, options);
|
|
22
22
|
yield `/* eslint-disable */`;
|
|
23
|
-
yield `// @ts-nocheck`;
|
|
24
23
|
yield `/**`;
|
|
25
24
|
yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`;
|
|
26
25
|
yield ` * DO NOT MODIFY IT BY HAND.`;
|
|
@@ -30,7 +29,7 @@ function* generate(app, options = { preserveNames: false }) {
|
|
|
30
29
|
// Change the structs definition to sanitize property names according to the defined rules
|
|
31
30
|
// for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp
|
|
32
31
|
app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]));
|
|
33
|
-
yield* writer.inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app));
|
|
32
|
+
yield* writer.inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app), ' as unknown as Arc56Contract');
|
|
34
33
|
yield writer.NewLine;
|
|
35
34
|
yield* utilityTypes.utilityTypes();
|
|
36
35
|
yield writer.NewLine;
|
package/client/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^7`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]))\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n yield* deployTypes(ctx)\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory\n yield* appFactory(ctx)\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":["createGeneratorContext","imports","inline","NewLine","utilityTypes","appTypes","deployTypes","paramsFactory","appFactory","appClient","callComposerType"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B,CAAA;AACH,CAAC;AAEc,UAAE,QAAQ,CAAC,GAAkB,EAAE,OAAA,GAA4B,EAAE,aAAa,EAAE,KAAK,EAAE,EAAA;IAChG,MAAM,GAAG,GAAGA,uCAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAChD,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,KAAK,CAAA;AACX,IAAA,MAAM,2FAA2F,CAAA;AACjG,IAAA,MAAM,8BAA8B,CAAA;AACpC,IAAA,MAAM,oDAAoD,CAAA;AAC1D,IAAA,MAAM,KAAK,CAAA;AAEX,IAAA,OAAOC,eAAO,EAAE,CAAA;;;AAGhB,IAAA,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/H,IAAA,OAAOC,aAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,8BAA8B,CAAC,CAAA;AAC7G,IAAA,MAAMC,cAAO,CAAA;AAEb,IAAA,OAAOC,yBAAY,EAAE,CAAA;AACrB,IAAA,MAAMD,cAAO,CAAA;AACb,IAAA,OAAOE,iBAAQ,CAAC,GAAG,CAAC,CAAA;AACpB,IAAA,OAAOC,uBAAW,CAAC,GAAG,CAAC,CAAA;AACvB,IAAA,MAAMH,cAAO,CAAA;;AAGb,IAAA,OAAOI,2BAAa,CAAC,GAAG,CAAC,CAAA;AACzB,IAAA,MAAMJ,cAAO,CAAA;;AAEb,IAAA,OAAOK,qBAAU,CAAC,GAAG,CAAC,CAAA;;AAEtB,IAAA,OAAOC,mBAAS,CAAC,GAAG,CAAC,CAAA;AAErB,IAAA,OAAOC,kCAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B;;;;"}
|
package/client/generate.mjs
CHANGED
|
@@ -18,7 +18,6 @@ function convertStructs(s, sanitizer) {
|
|
|
18
18
|
function* generate(app, options = { preserveNames: false }) {
|
|
19
19
|
const ctx = createGeneratorContext(app, options);
|
|
20
20
|
yield `/* eslint-disable */`;
|
|
21
|
-
yield `// @ts-nocheck`;
|
|
22
21
|
yield `/**`;
|
|
23
22
|
yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`;
|
|
24
23
|
yield ` * DO NOT MODIFY IT BY HAND.`;
|
|
@@ -28,7 +27,7 @@ function* generate(app, options = { preserveNames: false }) {
|
|
|
28
27
|
// Change the structs definition to sanitize property names according to the defined rules
|
|
29
28
|
// for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp
|
|
30
29
|
app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]));
|
|
31
|
-
yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app));
|
|
30
|
+
yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app), ' as unknown as Arc56Contract');
|
|
32
31
|
yield NewLine;
|
|
33
32
|
yield* utilityTypes();
|
|
34
33
|
yield NewLine;
|
package/client/generate.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.mjs","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield
|
|
1
|
+
{"version":3,"file":"generate.mjs","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^7`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]))\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n yield* deployTypes(ctx)\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory\n yield* appFactory(ctx)\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cA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C,CAAA;AAErB,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B;;;;"}
|
|
@@ -32,6 +32,8 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
32
32
|
return abiTypeToTs(abiType, ioType);
|
|
33
33
|
function abiTypeToTs(abiType, ioType) {
|
|
34
34
|
if (abiType instanceof algosdk.ABIUintType) {
|
|
35
|
+
if (abiType.bitSize < 53)
|
|
36
|
+
return ioType === 'input' ? 'bigint | number' : 'number';
|
|
35
37
|
return ioType === 'input' ? 'bigint | number' : 'bigint';
|
|
36
38
|
}
|
|
37
39
|
if (abiType instanceof algosdk.ABIArrayDynamicType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":["abiTypeIsTransaction","ABIReferenceType","ABIType","ABIUintType","ABIArrayDynamicType","ABIByteType","ABIArrayStaticType","ABIAddressType","ABIBoolType","ABIUfixedType","ABITupleType","ABIStringType"],"mappings":";;;;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAIA,4BAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC,CAAA;KAC1C;AACD,IAAA,IAAI,UAAU,IAAIC,wBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAIA,wBAAgB,CAAC,WAAW,IAAI,UAAU,IAAIA,wBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AACjD,QAAA,OAAO,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;KACpD;IAED,MAAM,OAAO,GAAGC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAExC,IAAA,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAEnC,IAAA,SAAS,WAAW,CAAC,OAAgB,EAAE,MAA0B,EAAA;AAC/D,QAAA,IAAI,OAAO,YAAYC,mBAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n if (abiType.bitSize < 53) return ioType === 'input' ? 'bigint | number' : 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":["abiTypeIsTransaction","ABIReferenceType","ABIType","ABIUintType","ABIArrayDynamicType","ABIByteType","ABIArrayStaticType","ABIAddressType","ABIBoolType","ABIUfixedType","ABITupleType","ABIStringType"],"mappings":";;;;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAIA,4BAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC,CAAA;KAC1C;AACD,IAAA,IAAI,UAAU,IAAIC,wBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAIA,wBAAgB,CAAC,WAAW,IAAI,UAAU,IAAIA,wBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AACjD,QAAA,OAAO,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;KACpD;IAED,MAAM,OAAO,GAAGC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAExC,IAAA,OAAO,WAA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,EAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;SAC/E;AACD,QAAA,IAAI,OAAO,YAAYL,mBAAW,EAAE;AAClC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAYM,qBAAa,EAAE;AACpC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;AACH;;;;"}
|
|
@@ -30,6 +30,8 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
30
30
|
return abiTypeToTs(abiType, ioType);
|
|
31
31
|
function abiTypeToTs(abiType, ioType) {
|
|
32
32
|
if (abiType instanceof ABIUintType) {
|
|
33
|
+
if (abiType.bitSize < 53)
|
|
34
|
+
return ioType === 'input' ? 'bigint | number' : 'number';
|
|
33
35
|
return ioType === 'input' ? 'bigint | number' : 'bigint';
|
|
34
36
|
}
|
|
35
37
|
if (abiType instanceof ABIArrayDynamicType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":[],"mappings":";;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC,CAAA;KAC1C;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,WAAW,IAAI,UAAU,IAAI,gBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AACjD,QAAA,OAAO,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;KACpD;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAExC,IAAA,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAEnC,IAAA,SAAS,WAAW,CAAC,OAAgB,EAAE,MAA0B,EAAA;AAC/D,QAAA,IAAI,OAAO,YAAY,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n if (abiType.bitSize < 53) return ioType === 'input' ? 'bigint | number' : 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":[],"mappings":";;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC,CAAA;KAC1C;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,WAAW,IAAI,UAAU,IAAI,gBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AACjD,QAAA,OAAO,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;KACpD;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,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AA,CAAA,EAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;SAC/E;AACD,QAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;AACH;;;;"}
|
package/client/imports.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
function* imports() {
|
|
4
4
|
yield `
|
|
5
|
+
import { AlgorandClientInterface } from '@algorandfoundation/algokit-utils/types/algorand-client-interface'
|
|
5
6
|
import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'
|
|
6
|
-
import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'
|
|
7
|
+
import { Arc56Contract, getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56'
|
|
7
8
|
import {
|
|
8
9
|
AppClient,
|
|
9
10
|
AppClientMethodCallParams,
|
package/client/imports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { AlgorandClientInterface } from '@algorandfoundation/algokit-utils/types/algorand-client-interface'\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA;;;;;;;;;;;;;;;;;;;GAmBL,CAAA;AACH;;;;"}
|
package/client/imports.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
function* imports() {
|
|
2
2
|
yield `
|
|
3
|
+
import { AlgorandClientInterface } from '@algorandfoundation/algokit-utils/types/algorand-client-interface'
|
|
3
4
|
import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'
|
|
4
|
-
import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'
|
|
5
|
+
import { Arc56Contract, getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56'
|
|
5
6
|
import {
|
|
6
7
|
AppClient,
|
|
7
8
|
AppClientMethodCallParams,
|
package/client/imports.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA
|
|
1
|
+
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { AlgorandClientInterface } from '@algorandfoundation/algokit-utils/types/algorand-client-interface'\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue, getABIStructFromABITuple } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA;;;;;;;;;;;;;;;;;;;GAmBL,CAAA;AACH;;;;"}
|