@algorandfoundation/algokit-client-generator 6.0.0 → 6.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js.map +1 -1
- package/cli.mjs.map +1 -1
- package/client/app-client.js.map +1 -1
- package/client/app-client.mjs.map +1 -1
- package/client/app-factory.js.map +1 -1
- package/client/app-factory.mjs.map +1 -1
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs.map +1 -1
- package/client/deploy-types.js.map +1 -1
- package/client/deploy-types.mjs.map +1 -1
- package/client/generate.js.map +1 -1
- package/client/generate.mjs.map +1 -1
- package/client/generator-context.js.map +1 -1
- package/client/generator-context.mjs.map +1 -1
- package/client/helpers/get-call-config-summary.js.map +1 -1
- package/client/helpers/get-call-config-summary.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.js.map +1 -1
- package/client/imports.mjs.map +1 -1
- package/client/params-factory.js.map +1 -1
- package/client/params-factory.mjs.map +1 -1
- package/output/writer.js.map +1 -1
- package/output/writer.mjs.map +1 -1
- package/package.json +1 -1
- package/schema/load.js.map +1 -1
- package/schema/load.mjs.map +1 -1
- package/util/boom.js.map +1 -1
- package/util/boom.mjs.map +1 -1
- package/util/color-console.js.map +1 -1
- package/util/color-console.mjs.map +1 -1
- package/util/sanitization.js.map +1 -1
- package/util/sanitization.mjs.map +1 -1
|
@@ -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?: never} & ${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?: never}`\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?: never}`\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;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC;IACxD,MAAM,cAAc,GAAG;AACrB,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,CAA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AAA,EAAgB,aAAa,CAAA,KAAA,EAAQ,IAAI,CAAA,eAAA,EAAkB,aAAa,CAAA,gBAAA,EAAmB,aAAa,CAAA,GAAA,CAAK;;;AAGlJ,QAAA,MAAMI,gBAAS;;AAGjB,IAAA,OAAOF,YAAK,CAAC,mDAAmD,CAAC;IACjE,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,wGAAA,CAA0G;AACnI,IAAA,MAAMC,gBAAS;AACf,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOD,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,MAAME,gBAAS;AACf,IAAA,MAAM,IAAI;AACV,IAAA,MAAMC,cAAO;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?: never} & ${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?: never}`\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?: never}`\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":";;;;;;AAMM,SAAU,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;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC;IACxD,MAAM,cAAc,GAAG;AACrB,UAAE,CAAA,WAAA,EAAc,OAAO,GAAG,GAAG,GAAG,EAAE,CAAA,EAAA,EAAK,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAA,sBAAA,EAAyB,EAAE,CAAA,EAAA,CAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,CAAA;UACpH,EAAE;IACN,OAAO;AACL,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,UAAU,EAAE,OAAO;KACpB;AACH;AAEM,SAAU,wBAAwB,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACnF,IAAA,MAAM,oBAAoB,GACxB,MAAM,KAAKD,8BAAS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B;AAEA,IAAA,OAAOF,YAAK,CAAC,mDAAmD,CAAC;IACjE,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,wGAAA,CAA0G;AACnI,IAAA,MAAMC,gBAAS;AACf,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOD,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAOA,YAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,MAAME,gBAAS;AACf,IAAA,MAAM,IAAI;AACV,IAAA,MAAMC,cAAO;AACf;;;;;;"}
|
|
@@ -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?: never} & ${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?: never}`\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?: never}`\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;IACtI,MAAM,OAAO,GAAG,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC;IACxD,MAAM,cAAc,GAAG;AACrB,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;UACvH,EAAE;IACN,OAAO;AACL,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,UAAU,EAAE,OAAO;KACpB;AACH;AAEgB,SAAA,wBAAwB,CAAC,MAAwB,EAAE,GAAkB,EAAA;AACnF,IAAA,MAAM,oBAAoB,GACxB,MAAM,KAAK,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,KAAK,MAAM,CAAC,EA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kB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE;AACnC,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;;AAEhD,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,IAAI;AACV,IAAA,MAAM,OAAO;AACf;;;;"}
|
|
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?: never} & ${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?: never}`\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?: never}`\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":";;;;AAMM,SAAU,0BAA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AAM,EAAE;AACnC,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,IAAI;AACV,IAAA,MAAM,OAAO;AACf;;;;"}
|
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, ProgramSourceInfo, 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\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\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(ctx)\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 reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\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;AACH;AAEA,SAAS,aAAa,CAAC,GAAkB,EAAE,OAAyB,EAAA;AAClE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC;;AAG5C,IAAA,MAAM,gBAAgB,GAAG,CAAC,UAA2C,KAAI;AACvE,QAAA,OAAO;aACJ,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY;AACpC,aAAA,GAAG,CAAC,CAAC,KAAK,MAAM;YACf,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,YAAY;;AAEhC,YAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACtD,SAAA,CAAC,CAAC;AACP,
|
|
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, ProgramSourceInfo, 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\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\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(ctx)\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 reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\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,IAA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AOC,aAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;AACvH,IAAA,MAAMC,cAAO;AAEb,IAAA,OAAOC,yBAAY,EAAE;AACrB,IAAA,MAAMD,cAAO;AACb,IAAA,OAAOE,iBAAQ,CAAC,GAAG,CAAC;AAEpB,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAOC,uBAAW,CAAC,GAAG,CAAC;IACzB;AACA,IAAA,MAAMH,cAAO;;AAGb,IAAA,OAAOI,2BAAa,CAAC,GAAG,CAAC;AACzB,IAAA,MAAMJ,cAAO;;AAEb,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAOK,qBAAU,CAAC,GAAG,CAAC;IACxB;;AAEA,IAAA,OAAOC,mBAAS,CAAC,GAAG,CAAC;AAErB,IAAA,OAAOC,kCAAgB,CAAC,GAAG,CAAC;AAC9B;;;;"}
|
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, ProgramSourceInfo, 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\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\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(ctx)\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 reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\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,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B;AACH;AAEA,SAAS,aAAa,CAAC,GAAkB,EAAE,OAAyB,EAAA;AAClE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC;;AAG5C,IAAA,MAAM,gBAAgB,GAAG,CAAC,UAA2C,KAAI;AACvE,QAAA,OAAO;aACJ,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY;AACpC,aAAA,GAAG,CAAC,CAAC,KAAK,MAAM;YACf,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,YAAY;;AAEhC,YAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACtD,SAAA,CAAC,CAAC;AACP,
|
|
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, ProgramSourceInfo, 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\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\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(ctx)\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 reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\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,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B;AACH;AAEA,SAAS,aAAa,CAAC,GAAkB,EAAE,OAAyB,EAAA;AAClE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC;;AAG5C,IAAA,MAAM,gBAAgB,GAAG,CAAC,UAA2C,KAAI;AACvE,QAAA,OAAO;aACJ,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY;AACpC,aAAA,GAAG,CAAC,CAAC,KAAK,MAAM;YACf,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,YAAY;;AAEhC,YAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACtD,SAAA,CAAC,CAAC;AACP,IAAA,CAAC;;IAGD,IAAI,eAAe,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACjH,QAAA,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,GAAG,gBAAgB,CAAC,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC;IACnH;IAE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GAAG,CAAC;;;AAGnB,IAAA,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACxC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAClH;AACD,IAAA,OAAO,MAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;AACvH,IAAA,MAAM,OAAO;AAEb,IAAA,OAAO,YAAY,EAAE;AACrB,IAAA,MAAM,OAAO;AACb,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC;AAEpB,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAO,WAAW,CAAC,GAAG,CAAC;IACzB;AACA,IAAA,MAAM,OAAO;;AAGb,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC;AACzB,IAAA,MAAM,OAAO;;AAEb,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAO,UAAU,CAAC,GAAG,CAAC;IACxB;;AAEA,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC;AAErB,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC;AAC9B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-context.js","sources":["../../src/client/generator-context.ts"],"sourcesContent":["import { CallConfigSummary, getCallConfigSummary } from './helpers/get-call-config-summary'\nimport { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n app: Arc56Contract\n name: string\n callConfig: CallConfigSummary\n methodSignatureToUniqueName: Record<string, string>\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n return {\n sanitizer,\n app,\n name: sanitizer.makeSafeTypeIdentifier(app.name),\n callConfig: getCallConfigSummary(app),\n methodSignatureToUniqueName: app.methods.reduce(\n (acc, cur) => {\n const signature = new ABIMethod(cur).getSignature()\n acc[signature] = app.methods.some((m) => m.name === cur.name && m !== cur) ? signature : cur.name\n return acc\n },\n {} as Record<string, string>,\n ),\n mode: options.mode,\n }\n}\n"],"names":["getSanitizer","getCallConfigSummary","ABIMethod"],"mappings":";;;;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;
|
|
1
|
+
{"version":3,"file":"generator-context.js","sources":["../../src/client/generator-context.ts"],"sourcesContent":["import { CallConfigSummary, getCallConfigSummary } from './helpers/get-call-config-summary'\nimport { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n app: Arc56Contract\n name: string\n callConfig: CallConfigSummary\n methodSignatureToUniqueName: Record<string, string>\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n return {\n sanitizer,\n app,\n name: sanitizer.makeSafeTypeIdentifier(app.name),\n callConfig: getCallConfigSummary(app),\n methodSignatureToUniqueName: app.methods.reduce(\n (acc, cur) => {\n const signature = new ABIMethod(cur).getSignature()\n acc[signature] = app.methods.some((m) => m.name === cur.name && m !== cur) ? signature : cur.name\n return acc\n },\n {} as Record<string, string>,\n ),\n mode: options.mode,\n }\n}\n"],"names":["getSanitizer","getCallConfigSummary","ABIMethod"],"mappings":";;;;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY;MAgB1C,sBAAsB,GAAG,CAAC,GAAkB,EAAE,OAAyB,KAAsB;AACxG,IAAA,MAAM,SAAS,GAAGA,yBAAY,CAAC,OAAO,CAAC;IACvC,OAAO;QACL,SAAS;QACT,GAAG;QACH,IAAI,EAAE,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;AAChD,QAAA,UAAU,EAAEC,yCAAoB,CAAC,GAAG,CAAC;AACrC,QAAA,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAC7C,CAAC,GAAG,EAAE,GAAG,KAAI;YACX,MAAM,SAAS,GAAG,IAAIC,iBAAS,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE;AACnD,YAAA,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,IAAI;AACjG,YAAA,OAAO,GAAG;QACZ,CAAC,EACD,EAA4B,CAC7B;QACD,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB;AACH;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-context.mjs","sources":["../../src/client/generator-context.ts"],"sourcesContent":["import { CallConfigSummary, getCallConfigSummary } from './helpers/get-call-config-summary'\nimport { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n app: Arc56Contract\n name: string\n callConfig: CallConfigSummary\n methodSignatureToUniqueName: Record<string, string>\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n return {\n sanitizer,\n app,\n name: sanitizer.makeSafeTypeIdentifier(app.name),\n callConfig: getCallConfigSummary(app),\n methodSignatureToUniqueName: app.methods.reduce(\n (acc, cur) => {\n const signature = new ABIMethod(cur).getSignature()\n acc[signature] = app.methods.some((m) => m.name === cur.name && m !== cur) ? signature : cur.name\n return acc\n },\n {} as Record<string, string>,\n ),\n mode: options.mode,\n }\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;
|
|
1
|
+
{"version":3,"file":"generator-context.mjs","sources":["../../src/client/generator-context.ts"],"sourcesContent":["import { CallConfigSummary, getCallConfigSummary } from './helpers/get-call-config-summary'\nimport { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n app: Arc56Contract\n name: string\n callConfig: CallConfigSummary\n methodSignatureToUniqueName: Record<string, string>\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n return {\n sanitizer,\n app,\n name: sanitizer.makeSafeTypeIdentifier(app.name),\n callConfig: getCallConfigSummary(app),\n methodSignatureToUniqueName: app.methods.reduce(\n (acc, cur) => {\n const signature = new ABIMethod(cur).getSignature()\n acc[signature] = app.methods.some((m) => m.name === cur.name && m !== cur) ? signature : cur.name\n return acc\n },\n {} as Record<string, string>,\n ),\n mode: options.mode,\n }\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY;MAgB1C,sBAAsB,GAAG,CAAC,GAAkB,EAAE,OAAyB,KAAsB;AACxG,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;IACvC,OAAO;QACL,SAAS;QACT,GAAG;QACH,IAAI,EAAE,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC;AAChD,QAAA,UAAU,EAAE,oBAAoB,CAAC,GAAG,CAAC;AACrC,QAAA,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAC7C,CAAC,GAAG,EAAE,GAAG,KAAI;YACX,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE;AACnD,YAAA,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,IAAI;AACjG,YAAA,OAAO,GAAG;QACZ,CAAC,EACD,EAA4B,CAC7B;QACD,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-call-config-summary.js","sources":["../../../src/client/helpers/get-call-config-summary.ts"],"sourcesContent":["import { pascalCase } from 'change-case'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport const BARE_CALL = Symbol('bare')\n\nexport type MethodIdentifier = string | typeof BARE_CALL\n\nexport type MethodList = Array<MethodIdentifier>\n\nexport type OnComplete = 'NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication'\n\nexport type Actions = {\n create: ('NoOp' | 'OptIn' | 'DeleteApplication')[]\n call: OnComplete[]\n}\n\nexport type CallConfigSummary = {\n createMethods: MethodList\n callMethods: MethodList\n deleteMethods: MethodList\n updateMethods: MethodList\n optInMethods: MethodList\n closeOutMethods: MethodList\n}\nexport const getCallConfigSummary = (app: Arc56Contract) => {\n const result: CallConfigSummary = {\n createMethods: [],\n callMethods: [],\n deleteMethods: [],\n updateMethods: [],\n optInMethods: [],\n closeOutMethods: [],\n }\n if (app.bareActions) {\n addToConfig(result, BARE_CALL, app.bareActions)\n }\n if (app.methods) {\n for (const m of app.methods) {\n if (m.actions) {\n addToConfig(result, new ABIMethod(m).getSignature(), m.actions)\n }\n }\n }\n return result\n}\n\nexport const getCreateOnComplete = (app: Arc56Contract, method: MethodIdentifier) => {\n const actions = method === BARE_CALL ? app.bareActions : app.methods?.find((m) => m.name === method)?.actions\n if (!actions) {\n return ''\n }\n const hasNoOp = actions.create.includes('NoOp')\n return `{ onCompleteAction${hasNoOp ? '?' : ''}: ${getCreateOnCompleteTypes(actions)} }`\n}\n\nconst getCreateOnCompleteTypes = (config: Actions) => {\n return config.create.map((oc) => `'${oc}' | OnApplicationComplete.${pascalCase(oc)}OC`).join(' | ')\n}\n\nconst addToConfig = (result: CallConfigSummary, method: MethodIdentifier, config: Actions) => {\n if (hasCall(config, 'NoOp')) {\n result.callMethods.push(method)\n }\n if (\n hasCreate(config, 'NoOp') ||\n hasCreate(config, 'OptIn') ||\n hasCreate(config, 'CloseOut') ||\n hasCreate(config, 'UpdateApplication') ||\n hasCreate(config, 'DeleteApplication')\n ) {\n result.createMethods.push(method)\n }\n if (hasCall(config, 'DeleteApplication')) {\n result.deleteMethods.push(method)\n }\n if (hasCall(config, 'UpdateApplication')) {\n result.updateMethods.push(method)\n }\n if (hasCall(config, 'OptIn')) {\n result.optInMethods.push(method)\n }\n if (hasCall(config, 'CloseOut')) {\n result.closeOutMethods.push(method)\n }\n}\n\nconst hasCall = (config: Actions | undefined, action: OnComplete) => {\n return config?.call.includes(action)\n}\nconst hasCreate = (config: Actions | undefined, action: OnComplete) => {\n return (config?.create as OnComplete[]).includes(action)\n}\n"],"names":["ABIMethod"],"mappings":";;;;MAIa,SAAS,GAAG,MAAM,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"get-call-config-summary.js","sources":["../../../src/client/helpers/get-call-config-summary.ts"],"sourcesContent":["import { pascalCase } from 'change-case'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport const BARE_CALL = Symbol('bare')\n\nexport type MethodIdentifier = string | typeof BARE_CALL\n\nexport type MethodList = Array<MethodIdentifier>\n\nexport type OnComplete = 'NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication'\n\nexport type Actions = {\n create: ('NoOp' | 'OptIn' | 'DeleteApplication')[]\n call: OnComplete[]\n}\n\nexport type CallConfigSummary = {\n createMethods: MethodList\n callMethods: MethodList\n deleteMethods: MethodList\n updateMethods: MethodList\n optInMethods: MethodList\n closeOutMethods: MethodList\n}\nexport const getCallConfigSummary = (app: Arc56Contract) => {\n const result: CallConfigSummary = {\n createMethods: [],\n callMethods: [],\n deleteMethods: [],\n updateMethods: [],\n optInMethods: [],\n closeOutMethods: [],\n }\n if (app.bareActions) {\n addToConfig(result, BARE_CALL, app.bareActions)\n }\n if (app.methods) {\n for (const m of app.methods) {\n if (m.actions) {\n addToConfig(result, new ABIMethod(m).getSignature(), m.actions)\n }\n }\n }\n return result\n}\n\nexport const getCreateOnComplete = (app: Arc56Contract, method: MethodIdentifier) => {\n const actions = method === BARE_CALL ? app.bareActions : app.methods?.find((m) => m.name === method)?.actions\n if (!actions) {\n return ''\n }\n const hasNoOp = actions.create.includes('NoOp')\n return `{ onCompleteAction${hasNoOp ? '?' : ''}: ${getCreateOnCompleteTypes(actions)} }`\n}\n\nconst getCreateOnCompleteTypes = (config: Actions) => {\n return config.create.map((oc) => `'${oc}' | OnApplicationComplete.${pascalCase(oc)}OC`).join(' | ')\n}\n\nconst addToConfig = (result: CallConfigSummary, method: MethodIdentifier, config: Actions) => {\n if (hasCall(config, 'NoOp')) {\n result.callMethods.push(method)\n }\n if (\n hasCreate(config, 'NoOp') ||\n hasCreate(config, 'OptIn') ||\n hasCreate(config, 'CloseOut') ||\n hasCreate(config, 'UpdateApplication') ||\n hasCreate(config, 'DeleteApplication')\n ) {\n result.createMethods.push(method)\n }\n if (hasCall(config, 'DeleteApplication')) {\n result.deleteMethods.push(method)\n }\n if (hasCall(config, 'UpdateApplication')) {\n result.updateMethods.push(method)\n }\n if (hasCall(config, 'OptIn')) {\n result.optInMethods.push(method)\n }\n if (hasCall(config, 'CloseOut')) {\n result.closeOutMethods.push(method)\n }\n}\n\nconst hasCall = (config: Actions | undefined, action: OnComplete) => {\n return config?.call.includes(action)\n}\nconst hasCreate = (config: Actions | undefined, action: OnComplete) => {\n return (config?.create as OnComplete[]).includes(action)\n}\n"],"names":["ABIMethod"],"mappings":";;;;MAIa,SAAS,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AA,IAAI,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACnC;AACA,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACnC;AACA,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;AAC5B,QAAA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IAClC;AACA,IAAA,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;AAC/B,QAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC;AACF,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,MAA2B,EAAE,MAAkB,KAAI;IAClE,OAAO,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AACtC,CAAC;AACD,MAAM,SAAS,GAAG,CAAC,MAA2B,EAAE,MAAkB,KAAI;IACpE,OAAO,CAAC,MAAM,EAAE,MAAuB,EAAC,QAAQ,CAAC,MAAM,CAAC;AAC1D,CAAC;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-call-config-summary.mjs","sources":["../../../src/client/helpers/get-call-config-summary.ts"],"sourcesContent":["import { pascalCase } from 'change-case'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport const BARE_CALL = Symbol('bare')\n\nexport type MethodIdentifier = string | typeof BARE_CALL\n\nexport type MethodList = Array<MethodIdentifier>\n\nexport type OnComplete = 'NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication'\n\nexport type Actions = {\n create: ('NoOp' | 'OptIn' | 'DeleteApplication')[]\n call: OnComplete[]\n}\n\nexport type CallConfigSummary = {\n createMethods: MethodList\n callMethods: MethodList\n deleteMethods: MethodList\n updateMethods: MethodList\n optInMethods: MethodList\n closeOutMethods: MethodList\n}\nexport const getCallConfigSummary = (app: Arc56Contract) => {\n const result: CallConfigSummary = {\n createMethods: [],\n callMethods: [],\n deleteMethods: [],\n updateMethods: [],\n optInMethods: [],\n closeOutMethods: [],\n }\n if (app.bareActions) {\n addToConfig(result, BARE_CALL, app.bareActions)\n }\n if (app.methods) {\n for (const m of app.methods) {\n if (m.actions) {\n addToConfig(result, new ABIMethod(m).getSignature(), m.actions)\n }\n }\n }\n return result\n}\n\nexport const getCreateOnComplete = (app: Arc56Contract, method: MethodIdentifier) => {\n const actions = method === BARE_CALL ? app.bareActions : app.methods?.find((m) => m.name === method)?.actions\n if (!actions) {\n return ''\n }\n const hasNoOp = actions.create.includes('NoOp')\n return `{ onCompleteAction${hasNoOp ? '?' : ''}: ${getCreateOnCompleteTypes(actions)} }`\n}\n\nconst getCreateOnCompleteTypes = (config: Actions) => {\n return config.create.map((oc) => `'${oc}' | OnApplicationComplete.${pascalCase(oc)}OC`).join(' | ')\n}\n\nconst addToConfig = (result: CallConfigSummary, method: MethodIdentifier, config: Actions) => {\n if (hasCall(config, 'NoOp')) {\n result.callMethods.push(method)\n }\n if (\n hasCreate(config, 'NoOp') ||\n hasCreate(config, 'OptIn') ||\n hasCreate(config, 'CloseOut') ||\n hasCreate(config, 'UpdateApplication') ||\n hasCreate(config, 'DeleteApplication')\n ) {\n result.createMethods.push(method)\n }\n if (hasCall(config, 'DeleteApplication')) {\n result.deleteMethods.push(method)\n }\n if (hasCall(config, 'UpdateApplication')) {\n result.updateMethods.push(method)\n }\n if (hasCall(config, 'OptIn')) {\n result.optInMethods.push(method)\n }\n if (hasCall(config, 'CloseOut')) {\n result.closeOutMethods.push(method)\n }\n}\n\nconst hasCall = (config: Actions | undefined, action: OnComplete) => {\n return config?.call.includes(action)\n}\nconst hasCreate = (config: Actions | undefined, action: OnComplete) => {\n return (config?.create as OnComplete[]).includes(action)\n}\n"],"names":[],"mappings":";;MAIa,SAAS,GAAG,MAAM,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"get-call-config-summary.mjs","sources":["../../../src/client/helpers/get-call-config-summary.ts"],"sourcesContent":["import { pascalCase } from 'change-case'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport const BARE_CALL = Symbol('bare')\n\nexport type MethodIdentifier = string | typeof BARE_CALL\n\nexport type MethodList = Array<MethodIdentifier>\n\nexport type OnComplete = 'NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication'\n\nexport type Actions = {\n create: ('NoOp' | 'OptIn' | 'DeleteApplication')[]\n call: OnComplete[]\n}\n\nexport type CallConfigSummary = {\n createMethods: MethodList\n callMethods: MethodList\n deleteMethods: MethodList\n updateMethods: MethodList\n optInMethods: MethodList\n closeOutMethods: MethodList\n}\nexport const getCallConfigSummary = (app: Arc56Contract) => {\n const result: CallConfigSummary = {\n createMethods: [],\n callMethods: [],\n deleteMethods: [],\n updateMethods: [],\n optInMethods: [],\n closeOutMethods: [],\n }\n if (app.bareActions) {\n addToConfig(result, BARE_CALL, app.bareActions)\n }\n if (app.methods) {\n for (const m of app.methods) {\n if (m.actions) {\n addToConfig(result, new ABIMethod(m).getSignature(), m.actions)\n }\n }\n }\n return result\n}\n\nexport const getCreateOnComplete = (app: Arc56Contract, method: MethodIdentifier) => {\n const actions = method === BARE_CALL ? app.bareActions : app.methods?.find((m) => m.name === method)?.actions\n if (!actions) {\n return ''\n }\n const hasNoOp = actions.create.includes('NoOp')\n return `{ onCompleteAction${hasNoOp ? '?' : ''}: ${getCreateOnCompleteTypes(actions)} }`\n}\n\nconst getCreateOnCompleteTypes = (config: Actions) => {\n return config.create.map((oc) => `'${oc}' | OnApplicationComplete.${pascalCase(oc)}OC`).join(' | ')\n}\n\nconst addToConfig = (result: CallConfigSummary, method: MethodIdentifier, config: Actions) => {\n if (hasCall(config, 'NoOp')) {\n result.callMethods.push(method)\n }\n if (\n hasCreate(config, 'NoOp') ||\n hasCreate(config, 'OptIn') ||\n hasCreate(config, 'CloseOut') ||\n hasCreate(config, 'UpdateApplication') ||\n hasCreate(config, 'DeleteApplication')\n ) {\n result.createMethods.push(method)\n }\n if (hasCall(config, 'DeleteApplication')) {\n result.deleteMethods.push(method)\n }\n if (hasCall(config, 'UpdateApplication')) {\n result.updateMethods.push(method)\n }\n if (hasCall(config, 'OptIn')) {\n result.optInMethods.push(method)\n }\n if (hasCall(config, 'CloseOut')) {\n result.closeOutMethods.push(method)\n }\n}\n\nconst hasCall = (config: Actions | undefined, action: OnComplete) => {\n return config?.call.includes(action)\n}\nconst hasCreate = (config: Actions | undefined, action: OnComplete) => {\n return (config?.create as OnComplete[]).includes(action)\n}\n"],"names":[],"mappings":";;MAIa,SAAS,GAAG,MAAM,CAAC,MAAM;AAqB/B,MAAM,oBAAoB,GAAG,CAAC,GAAkB,KAAI;AACzD,IAAA,MAAM,MAAM,GAAsB;AAChC,QAAA,aAAa,EAAE,EAAE;AACjB,QAAA,WAAW,EAAE,EAAE;AACf,QAAA,aAAa,EAAE,EAAE;AACjB,QAAA,aAAa,EAAE,EAAE;AACjB,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,eAAe,EAAE,EAAE;KACpB;AACD,IAAA,IAAI,GAAG,CAAC,WAAW,EAAE;QACnB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC;IACjD;AACA,IAAA,IAAI,GAAG,CAAC,OAAO,EAAE;AACf,QAAA,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE;AAC3B,YAAA,IAAI,CAAC,CAAC,OAAO,EAAE;AACb,gBAAA,WAAW,CAAC,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC;YACjE;QACF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A2B,EAAE,MAAkB,KAAI;IACpE,OAAO,CAAC,MAAM,EAAE,MAAuB,EAAC,QAAQ,CAAC,MAAM,CAAC;AAC1D,CAAC;;;;"}
|
|
@@ -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\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\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' ? bytesOrStringType : '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 bytesOrStringType\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' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\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":";;;;AAiBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM
|
|
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\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\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' ? bytesOrStringType : '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 bytesOrStringType\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' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\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":";;;;AAiBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,iBAAiB,GAAG,YAAY;IAC9D;AACA,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAIA,4BAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC;IAC3C;AACA,IAAA,IAAI,UAAU,IAAIC,wBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,iBAAiB;IAC1B;AACA,IAAA,IAAI,UAAU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AK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;QACvG;AACA,QAAA,IAAI,OAAO,YAAYE,sBAAc,EAAE;AACrC,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,IAAI,OAAO,YAAYC,mBAAW,EAAE;AAClC,YAAA,OAAO,SAAS;QAClB;AACA,QAAA,IAAI,OAAO,YAAYC,qBAAa,EAAE;AACpC,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,IAAI,OAAO,YAAYC,oBAAY,EAAE;YACnC,OAAO,CAAA,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;QAChF;AACA,QAAA,IAAI,OAAO,YAAYL,mBAAW,EAAE;AAClC,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,IAAI,OAAO,YAAYM,qBAAa,EAAE;AACpC,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,OAAO,SAAS;IAClB;AACF;;;;"}
|
|
@@ -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\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\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' ? bytesOrStringType : '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 bytesOrStringType\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' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\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":";;AAiBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM
|
|
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\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\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' ? bytesOrStringType : '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 bytesOrStringType\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' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\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":";;AAiBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,I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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\n\nexport function* imports(ctx: GeneratorContext): DocumentParts {\n yield `\n import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\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 as _AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n CloneAppClientParams,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n ${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}\n import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n `\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\n\nexport function* imports(ctx: GeneratorContext): DocumentParts {\n yield `\n import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\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 as _AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n CloneAppClientParams,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n ${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}\n import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n `\n}\n"],"names":[],"mappings":";;AAGM,UAAW,OAAO,CAAC,GAAqB,EAAA;IAC5C,MAAM;;;;;;;;;;;;;;;MAeF,GAAG,CAAC,IAAI,KAAK,MAAM,GAAG,CAAA,oOAAA,CAAsO,GAAG,EAAE;;;;GAIpQ;AACH;;;;"}
|
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'\nimport { GeneratorContext } from './generator-context'\n\nexport function* imports(ctx: GeneratorContext): DocumentParts {\n yield `\n import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\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 as _AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n CloneAppClientParams,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n ${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}\n import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n `\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\n\nexport function* imports(ctx: GeneratorContext): DocumentParts {\n yield `\n import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\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 as _AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n CloneAppClientParams,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n ${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}\n import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n `\n}\n"],"names":[],"mappings":"AAGM,UAAW,OAAO,CAAC,GAAqB,EAAA;IAC5C,MAAM;;;;;;;;;;;;;;;MAeF,GAAG,CAAC,IAAI,KAAK,MAAM,GAAG,CAAA,oOAAA,CAAsO,GAAG,EAAE;;;;GAIpQ;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params-factory.js","sources":["../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { Sanitizer } from '../util/sanitization'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.name} smart contract`)\n yield `export abstract class ${ctx.name}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(\n ctx,\n `Constructs create ABI call params for the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n true,\n )\n yield* operationMethod(\n ctx,\n `Constructs update ABI call params for the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, callConfig.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, callConfig.optInMethods, 'optIn')\n yield* operationMethod(\n ctx,\n `Constructs close out ABI call params for the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, methodSignatureToUniqueName, sanitizer, name } = ctx\n if (methods.length > 0 && methods.some((m) => m !== BARE_CALL)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${ctx.name}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) continue\n\n const uniqueName = methodSignatureToUniqueName[methodSig]\n if (uniqueName !== methodSig) {\n yield `case '${sanitizer.makeSafeStringTypeLiteral(uniqueName)}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(methodSig)}':`\n yield* indent(\n `return ${ctx.name}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(uniqueName))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig !== BARE_CALL) {\n const method = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: methodSig,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }`,\n contractName: name,\n })\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ methodSignatureToUniqueName, callConfig, sanitizer, name }: GeneratorContext, method: Method) {\n const methodSignature = new ABIMethod(method).getSignature()\n if (!callConfig.callMethods.includes(methodSignature)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${methodSignature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]),\n signature: methodSignature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: Array<{ name?: string }>\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(sanitizer.makeSafePropertyIdentifier(a.name ?? `arg${i + 1}`))}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n yield `}${isNested ? ',' : ''}`\n}\n"],"names":["jsDoc","IncIndent","DecIndent","BARE_CALL","indent","DecIndentAndCloseBlock","NewLine","getCreateOnCompleteOptions","ABIMethod"],"mappings":";;;;;;;AAQe,UAAE,aAAa,CAAC,GAAqB,EAAA;IAClD,OAAOA,YAAK,CAAC,CAAA,mFAAA,EAAsF,GAAG,CAAC,IAAI,CAAiB,eAAA,CAAA,CAAC;AAC7H,IAAA,MAAM,CAAyB,sBAAA,EAAA,GAAG,CAAC,IAAI,iBAAiB;AACxD,IAAA,MAAMC,gBAAS;AAEf,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC;IAErB,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE;QACpC,OAAO,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC;;AAGvC,IAAA,MAAMC,gBAAS;AAEf,IAAA,MAAM,GAAG;AACX;AAEA,UAAU,SAAS,CAAC,GAAqB,EAAA;AACvC,IAAA,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG;AAE/B,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OAAO,eAAe,CACpB,GAAG,EACH,CAAA,0CAAA,EAA6C,GAAG,CAAC,IAAI,iBAAiB,EACtE,UAAU,CAAC,aAAa,EACxB,QAAQ,EACR,IAAI,CACL;QACD,OAAO,eAAe,CACpB,GAAG,EACH,CAAA,0CAAA,EAA6C,GAAG,CAAC,IAAI,iBAAiB,EACtE,UAAU,CAAC,aAAa,EACxB,QAAQ,EACR,IAAI,CACL;AACD,QAAA,OAA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AAE;AACjC;;;;"}
|
|
1
|
+
{"version":3,"file":"params-factory.js","sources":["../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { Sanitizer } from '../util/sanitization'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.name} smart contract`)\n yield `export abstract class ${ctx.name}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(\n ctx,\n `Constructs create ABI call params for the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n true,\n )\n yield* operationMethod(\n ctx,\n `Constructs update ABI call params for the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, callConfig.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, callConfig.optInMethods, 'optIn')\n yield* operationMethod(\n ctx,\n `Constructs close out ABI call params for the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, methodSignatureToUniqueName, sanitizer, name } = ctx\n if (methods.length > 0 && methods.some((m) => m !== BARE_CALL)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${ctx.name}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) continue\n\n const uniqueName = methodSignatureToUniqueName[methodSig]\n if (uniqueName !== methodSig) {\n yield `case '${sanitizer.makeSafeStringTypeLiteral(uniqueName)}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(methodSig)}':`\n yield* indent(\n `return ${ctx.name}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(uniqueName))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig !== BARE_CALL) {\n const method = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: methodSig,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }`,\n contractName: name,\n })\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ methodSignatureToUniqueName, callConfig, sanitizer, name }: GeneratorContext, method: Method) {\n const methodSignature = new ABIMethod(method).getSignature()\n if (!callConfig.callMethods.includes(methodSignature)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${methodSignature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]),\n signature: methodSignature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: Array<{ name?: string }>\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(sanitizer.makeSafePropertyIdentifier(a.name ?? `arg${i + 1}`))}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n yield `}${isNested ? ',' : ''}`\n}\n"],"names":["jsDoc","IncIndent","DecIndent","BARE_CALL","indent","DecIndentAndCloseBlock","NewLine","getCreateOnCompleteOptions","ABIMethod"],"mappings":";;;;;;;AAQM,UAAW,aAAa,CAAC,GAAqB,EAAA;IAClD,OAAOA,YAAK,CAAC,CAAA,mFAAA,EAAsF,GAAG,CAAC,I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AAG,EAAE,GAAG,SAAS,CAAA,EAAG,IAAI,uBAAuB,YAAY,CAAA,aAAA,EAAgB,aAAa,CAAA,KAAA,EAAQ,YAAY,CAAA,eAAA,EAAkB,aAAa,CAAA,GAAA,EAAM,oBAAoB,CAAA,4BAAA,EAA+B,oBAAoB,CAAA,EAAA,CAAI;AAC7O,IAAA,MAAMC,gBAAS;AACf,IAAA,MAAM,UAAU;AAChB,IAAA,MAAMA,gBAAS;AACf,IAAA,MAAM,YAAY;IAClB,MAAM,CAAA,SAAA,EAAY,aAAa,CAAA,WAAA,CAAa;AAC5C,IAAA,MAAM,qDAAqD;AACxD,SAAA,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,WAAA,EAAc,SAAS,CAAC,qBAAqB,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA,GAAA,EAAM,CAAC,GAAG,CAAC,CAAA,CAAE,CAAC,CAAC,EAAE;AAC5H,SAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AACjB,IAAA,MAAMC,gBAAS;AACf,IAAA,MAAM,GAAG;AACT,IAAA,MAAMA,gBAAS;IACf,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAA,CAAE;AACjC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params-factory.mjs","sources":["../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { Sanitizer } from '../util/sanitization'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.name} smart contract`)\n yield `export abstract class ${ctx.name}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(\n ctx,\n `Constructs create ABI call params for the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n true,\n )\n yield* operationMethod(\n ctx,\n `Constructs update ABI call params for the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, callConfig.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, callConfig.optInMethods, 'optIn')\n yield* operationMethod(\n ctx,\n `Constructs close out ABI call params for the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, methodSignatureToUniqueName, sanitizer, name } = ctx\n if (methods.length > 0 && methods.some((m) => m !== BARE_CALL)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${ctx.name}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) continue\n\n const uniqueName = methodSignatureToUniqueName[methodSig]\n if (uniqueName !== methodSig) {\n yield `case '${sanitizer.makeSafeStringTypeLiteral(uniqueName)}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(methodSig)}':`\n yield* indent(\n `return ${ctx.name}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(uniqueName))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig !== BARE_CALL) {\n const method = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: methodSig,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }`,\n contractName: name,\n })\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ methodSignatureToUniqueName, callConfig, sanitizer, name }: GeneratorContext, method: Method) {\n const methodSignature = new ABIMethod(method).getSignature()\n if (!callConfig.callMethods.includes(methodSignature)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${methodSignature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]),\n signature: methodSignature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: Array<{ name?: string }>\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(sanitizer.makeSafePropertyIdentifier(a.name ?? `arg${i + 1}`))}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n yield `}${isNested ? ',' : ''}`\n}\n"],"names":[],"mappings":";;;;;AAQe,UAAE,aAAa,CAAC,GAAqB,EAAA;IAClD,OAAO,KAAK,CAAC,CAAA,mFAAA,EAAsF,GAAG,CAAC,IAAI,CAAiB,eAAA,CAAA,CAAC;AAC7H,IAAA,MAAM,CAAyB,sBAAA,EAAA,GAAG,CAAC,IAAI,iBAAiB;AACxD,IAAA,MAAM,SAAS;AAEf,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC;IAErB,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE;QACpC,OAAO,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC;;AAGvC,IAAA,MAAM,SAAS;AAEf,IAAA,MAAM,GAAG;AACX;AAEA,UAAU,SAAS,CAAC,GAAqB,EAAA;AACvC,IAAA,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG;AAE/B,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OA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AAC,CAAA,CAAE,CAAC,CAAC,EAAE;AAC5H,SAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AACjB,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,GAAG;AACT,IAAA,MAAM,SAAS;IACf,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAA,CAAE;AACjC;;;;"}
|
|
1
|
+
{"version":3,"file":"params-factory.mjs","sources":["../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { BARE_CALL, MethodList } from './helpers/get-call-config-summary'\nimport { getCreateOnCompleteOptions } from './deploy-types'\nimport { Sanitizer } from '../util/sanitization'\nimport { Method } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { ABIMethod } from 'algosdk'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.name} smart contract`)\n yield `export abstract class ${ctx.name}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app, callConfig } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(\n ctx,\n `Constructs create ABI call params for the ${app.name} smart contract`,\n callConfig.createMethods,\n 'create',\n true,\n )\n yield* operationMethod(\n ctx,\n `Constructs update ABI call params for the ${app.name} smart contract`,\n callConfig.updateMethods,\n 'update',\n true,\n )\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, callConfig.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, callConfig.optInMethods, 'optIn')\n yield* operationMethod(\n ctx,\n `Constructs close out ABI call params for the ${app.name} smart contract`,\n callConfig.closeOutMethods,\n 'closeOut',\n )\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: MethodList,\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, methodSignatureToUniqueName, sanitizer, name } = ctx\n if (methods.length > 0 && methods.some((m) => m !== BARE_CALL)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${ctx.name}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const methodSig of methods) {\n if (methodSig === BARE_CALL) continue\n\n const uniqueName = methodSignatureToUniqueName[methodSig]\n if (uniqueName !== methodSig) {\n yield `case '${sanitizer.makeSafeStringTypeLiteral(uniqueName)}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(methodSig)}':`\n yield* indent(\n `return ${ctx.name}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(uniqueName))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const methodSig of methods) {\n const onComplete = verb === 'create' ? getCreateOnCompleteOptions(methodSig, app) : undefined\n if (methodSig !== BARE_CALL) {\n const method = app.methods.find((m) => new ABIMethod(m).getSignature() === methodSig)!\n const uniqueName = methodSignatureToUniqueName[methodSig]\n yield* jsDoc({\n description: `${description} using the ${methodSig} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: methodSig,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.type ? ` & ${onComplete.type}` : ''\n }`,\n contractName: name,\n })\n }\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ methodSignatureToUniqueName, callConfig, sanitizer, name }: GeneratorContext, method: Method) {\n const methodSignature = new ABIMethod(method).getSignature()\n if (!callConfig.callMethods.includes(methodSignature)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${methodSignature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(methodSignatureToUniqueName[methodSignature]),\n signature: methodSignature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: Array<{ name?: string }>\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(sanitizer.makeSafePropertyIdentifier(a.name ?? `arg${i + 1}`))}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n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AAC;IAC5F,MAAM,aAAa,GAAG,SAAS,CAAC,yBAAyB,CAAC,SAAS,CAAC;IACpE,MAAM,CAAA,EAAG,QAAQ,GAAG,EAAE,GAAG,SAAS,CAAA,EAAG,IAAI,uBAAuB,YAAY,CAAA,aAAA,EAAgB,aAAa,CAAA,KAAA,EAAQ,YAAY,CAAA,eAAA,EAAkB,aAAa,CAAA,GAAA,EAAM,oBAAoB,CAAA,4BAAA,EAA+B,oBAAoB,CAAA,EAAA,CAAI;AAC7O,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,UAAU;AAChB,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,YAAY;IAClB,MAAM,CAAA,SAAA,EAAY,aAAa,CAAA,WAAA,CAAa;AAC5C,IAAA,MAAM,qDAAqD;AACxD,SAAA,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,WAAA,EAAc,SAAS,CAAC,qBAAqB,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA,GAAA,EAAM,CAAC,GAAG,CAAC,CAAA,CAAE,CAAC,CAAC,EAAE;AAC5H,SAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AACjB,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,GAAG;AACT,IAAA,MAAM,SAAS;IACf,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAA,CAAE;AACjC;;;;"}
|
package/output/writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.js","sources":["../../src/output/writer.ts"],"sourcesContent":["export const IncIndent = Symbol('Increase Indent')\nexport const DecIndent = Symbol('Decrease Indent')\nexport const DecIndentAndCloseBlock = Symbol('Decrease Indent and write a closing brace')\nexport const NewLineMode = Symbol('New Line Mode')\nexport const RestoreLineMode = Symbol('Restore Line Mode')\nexport const PropertyDelimiter = Symbol('Property Delimiter')\nexport const InlineMode = Symbol('Inline Mode')\nexport const NewLine = Symbol('New Line')\n\nexport type Part =\n | string\n | typeof IncIndent\n | typeof DecIndent\n | typeof NewLineMode\n | typeof DecIndentAndCloseBlock\n | typeof InlineMode\n | typeof NewLine\n | typeof RestoreLineMode\n | typeof PropertyDelimiter\nexport type DocumentParts = Generator<Part, void>\n\nexport type WriteOptions = {\n indent?: string\n disableEslint?: boolean\n header?: string\n}\n\ninterface StringWriter {\n write(value: string): void\n get last(): string\n}\n\nexport function writeDocumentPartsToStream(document: DocumentParts, stream: { write(chunk: string): void }, options: WriteOptions = {}) {\n const writer = {\n _last: '',\n write(val: string) {\n this._last = val\n stream.write(val)\n },\n get last() {\n return this._last\n },\n }\n writeDocumentPartsTo(document, options, writer)\n}\n\nexport function writeDocumentPartsToString(document: DocumentParts, options: WriteOptions = {}) {\n const writer = {\n result: [] as string[],\n _last: '',\n write(val: string) {\n this._last = val\n this.result.push(val)\n },\n get last() {\n return this._last\n },\n toString() {\n return this.result.join('')\n },\n }\n writeDocumentPartsTo(document, options, writer)\n return writer.toString()\n}\n\nexport function* inline(...parts: Array<Part | DocumentParts>) {\n yield InlineMode\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield RestoreLineMode\n}\n\nexport function* indent(...parts: Array<Part | DocumentParts>) {\n yield IncIndent\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield DecIndent\n}\n\nexport function* jsDoc(\n docs: string | string[] | { description: string | string[]; abiDescription?: string; params?: Record<string, string>; returns?: string },\n) {\n yield `/**`\n if (typeof docs === 'string' || Array.isArray(docs)) {\n const description = typeof docs === 'string' ? [docs] : docs\n for (const line of description) {\n yield ` * ${line}`\n }\n } else {\n const description = typeof docs.description === 'string' ? [docs.description] : docs.description\n for (const line of description) {\n yield ` * ${line}`\n }\n if (docs.abiDescription) {\n yield ' *'\n yield ` * ${docs.abiDescription}`\n }\n if (docs.params || docs.returns) {\n yield ' *'\n }\n for (const [paramName, paramDesc] of Object.entries(docs.params ?? {})) {\n yield ` * @param ${paramName} ${paramDesc}`\n }\n if (docs.returns) yield ` * @returns ${docs.returns}`\n }\n yield ' */'\n}\n\nfunction writeDocumentPartsTo(document: DocumentParts, { indent = ' ', ...options }: WriteOptions, writer: StringWriter): void {\n if (options.header) writer.write(`${options.header}\\n`)\n if (options.disableEslint) writer.write('/* eslint-disable */\\n')\n\n const lineModes = [NewLineMode]\n const currentLineMode = () => lineModes.at(-1) ?? NewLineMode\n\n let curIndent = ''\n for (const part of document) {\n switch (part) {\n case IncIndent:\n curIndent += indent\n break\n case DecIndent:\n curIndent = curIndent.slice(0, -indent.length)\n break\n case DecIndentAndCloseBlock:\n curIndent = curIndent.slice(0, -indent.length)\n writer.write(`${curIndent}}\\n`)\n break\n case NewLineMode:\n lineModes.push(NewLineMode)\n if (writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case InlineMode:\n lineModes.push(InlineMode)\n break\n case RestoreLineMode:\n lineModes.pop()\n\n if (currentLineMode() === NewLineMode && writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case PropertyDelimiter:\n if (currentLineMode() === NewLineMode) {\n writer.write('\\n')\n } else {\n writer.write(', ')\n }\n break\n case NewLine:\n writer.write('\\n')\n break\n default:\n // Multi-line\n if (part.includes('\\n') || part.includes('\\r')) {\n if (writer.last.slice(-1)[0] !== '\\n') writer.write('\\n')\n const normalisedLineEndings = part.replaceAll(/\\r\\n/g, '\\n').replaceAll(/\\r/g, '\\n').replace(/^\\n/, '').trimEnd()\n const lines = normalisedLineEndings.split('\\n')\n const baseIndent = lines[0].match(/^\\s+/)?.[0] ?? ''\n for (const line of lines) {\n writer.write(curIndent + line.replace(new RegExp(`^${baseIndent}`, ''), '').trimEnd())\n writer.write('\\n')\n }\n } else {\n if (writer.last.slice(-1)[0] === '\\n') writer.write(curIndent)\n writer.write(part)\n }\n if (currentLineMode() === NewLineMode) writer.write('\\n')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,MAAM,qBAAqB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;oBACjH,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;AAC/C,oBAAA,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;AACpD,oBAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;wBACxB,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,UAAU,CAAA,CAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AACtF,wBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;;;qBAEf;AACL,oBAAA,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;AAAE,wBAAA,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;AAC9D,oBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;;gBAEpB,IAAI,eAAe,EAAE,KAAK,WAAW;AAAE,oBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;gBACzD;;;AAGR;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"writer.js","sources":["../../src/output/writer.ts"],"sourcesContent":["export const IncIndent = Symbol('Increase Indent')\nexport const DecIndent = Symbol('Decrease Indent')\nexport const DecIndentAndCloseBlock = Symbol('Decrease Indent and write a closing brace')\nexport const NewLineMode = Symbol('New Line Mode')\nexport const RestoreLineMode = Symbol('Restore Line Mode')\nexport const PropertyDelimiter = Symbol('Property Delimiter')\nexport const InlineMode = Symbol('Inline Mode')\nexport const NewLine = Symbol('New Line')\n\nexport type Part =\n | string\n | typeof IncIndent\n | typeof DecIndent\n | typeof NewLineMode\n | typeof DecIndentAndCloseBlock\n | typeof InlineMode\n | typeof NewLine\n | typeof RestoreLineMode\n | typeof PropertyDelimiter\nexport type DocumentParts = Generator<Part, void>\n\nexport type WriteOptions = {\n indent?: string\n disableEslint?: boolean\n header?: string\n}\n\ninterface StringWriter {\n write(value: string): void\n get last(): string\n}\n\nexport function writeDocumentPartsToStream(document: DocumentParts, stream: { write(chunk: string): void }, options: WriteOptions = {}) {\n const writer = {\n _last: '',\n write(val: string) {\n this._last = val\n stream.write(val)\n },\n get last() {\n return this._last\n },\n }\n writeDocumentPartsTo(document, options, writer)\n}\n\nexport function writeDocumentPartsToString(document: DocumentParts, options: WriteOptions = {}) {\n const writer = {\n result: [] as string[],\n _last: '',\n write(val: string) {\n this._last = val\n this.result.push(val)\n },\n get last() {\n return this._last\n },\n toString() {\n return this.result.join('')\n },\n }\n writeDocumentPartsTo(document, options, writer)\n return writer.toString()\n}\n\nexport function* inline(...parts: Array<Part | DocumentParts>) {\n yield InlineMode\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield RestoreLineMode\n}\n\nexport function* indent(...parts: Array<Part | DocumentParts>) {\n yield IncIndent\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield DecIndent\n}\n\nexport function* jsDoc(\n docs: string | string[] | { description: string | string[]; abiDescription?: string; params?: Record<string, string>; returns?: string },\n) {\n yield `/**`\n if (typeof docs === 'string' || Array.isArray(docs)) {\n const description = typeof docs === 'string' ? [docs] : docs\n for (const line of description) {\n yield ` * ${line}`\n }\n } else {\n const description = typeof docs.description === 'string' ? [docs.description] : docs.description\n for (const line of description) {\n yield ` * ${line}`\n }\n if (docs.abiDescription) {\n yield ' *'\n yield ` * ${docs.abiDescription}`\n }\n if (docs.params || docs.returns) {\n yield ' *'\n }\n for (const [paramName, paramDesc] of Object.entries(docs.params ?? {})) {\n yield ` * @param ${paramName} ${paramDesc}`\n }\n if (docs.returns) yield ` * @returns ${docs.returns}`\n }\n yield ' */'\n}\n\nfunction writeDocumentPartsTo(document: DocumentParts, { indent = ' ', ...options }: WriteOptions, writer: StringWriter): void {\n if (options.header) writer.write(`${options.header}\\n`)\n if (options.disableEslint) writer.write('/* eslint-disable */\\n')\n\n const lineModes = [NewLineMode]\n const currentLineMode = () => lineModes.at(-1) ?? NewLineMode\n\n let curIndent = ''\n for (const part of document) {\n switch (part) {\n case IncIndent:\n curIndent += indent\n break\n case DecIndent:\n curIndent = curIndent.slice(0, -indent.length)\n break\n case DecIndentAndCloseBlock:\n curIndent = curIndent.slice(0, -indent.length)\n writer.write(`${curIndent}}\\n`)\n break\n case NewLineMode:\n lineModes.push(NewLineMode)\n if (writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case InlineMode:\n lineModes.push(InlineMode)\n break\n case RestoreLineMode:\n lineModes.pop()\n\n if (currentLineMode() === NewLineMode && writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case PropertyDelimiter:\n if (currentLineMode() === NewLineMode) {\n writer.write('\\n')\n } else {\n writer.write(', ')\n }\n break\n case NewLine:\n writer.write('\\n')\n break\n default:\n // Multi-line\n if (part.includes('\\n') || part.includes('\\r')) {\n if (writer.last.slice(-1)[0] !== '\\n') writer.write('\\n')\n const normalisedLineEndings = part.replaceAll(/\\r\\n/g, '\\n').replaceAll(/\\r/g, '\\n').replace(/^\\n/, '').trimEnd()\n const lines = normalisedLineEndings.split('\\n')\n const baseIndent = lines[0].match(/^\\s+/)?.[0] ?? ''\n for (const line of lines) {\n writer.write(curIndent + line.replace(new RegExp(`^${baseIndent}`, ''), '').trimEnd())\n writer.write('\\n')\n }\n } else {\n if (writer.last.slice(-1)[0] === '\\n') writer.write(curIndent)\n writer.write(part)\n }\n if (currentLineMode() === NewLineMode) writer.write('\\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