@algorandfoundation/algokit-client-generator 4.0.0-beta.2 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/app-client.js +34 -19
- package/client/app-client.js.map +1 -1
- package/client/app-client.mjs +34 -19
- package/client/app-client.mjs.map +1 -1
- package/client/app-factory.js +34 -17
- package/client/app-factory.js.map +1 -1
- package/client/app-factory.mjs +34 -17
- package/client/app-factory.mjs.map +1 -1
- package/client/app-types.js +11 -7
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs +11 -7
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js +2 -2
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs +2 -2
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js +16 -14
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs +16 -14
- package/client/call-composer.mjs.map +1 -1
- package/client/generate.js +4 -4
- package/client/generate.js.map +1 -1
- package/client/generate.mjs +4 -4
- package/client/generate.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.js +7 -3
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs +7 -3
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.js +3 -2
- package/client/imports.js.map +1 -1
- package/client/imports.mjs +3 -2
- package/client/imports.mjs.map +1 -1
- package/package.json +4 -3
- package/schema/arc56.schema.json.js +106 -55
- package/schema/arc56.schema.json.js.map +1 -1
- package/schema/arc56.schema.json.mjs +106 -55
- package/schema/arc56.schema.json.mjs.map +1 -1
package/client/generate.js
CHANGED
|
@@ -12,10 +12,10 @@ var callComposerTypes = require('./call-composer-types.js');
|
|
|
12
12
|
var appFactory = require('./app-factory.js');
|
|
13
13
|
|
|
14
14
|
function convertStructs(s, sanitizer) {
|
|
15
|
-
return
|
|
16
|
-
sanitizer.makeSafePropertyIdentifier(
|
|
17
|
-
typeof
|
|
18
|
-
|
|
15
|
+
return s.map(({ name, type }) => ({
|
|
16
|
+
name: sanitizer.makeSafePropertyIdentifier(name),
|
|
17
|
+
type: typeof type === 'string' ? type : convertStructs(type, sanitizer),
|
|
18
|
+
}));
|
|
19
19
|
}
|
|
20
20
|
function* generate(app, options = { preserveNames: false }) {
|
|
21
21
|
const ctx = generatorContext.createGeneratorContext(app, options);
|
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,
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield `// @ts-nocheck`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^7`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]))\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app))\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n yield* deployTypes(ctx)\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory\n yield* appFactory(ctx)\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":["createGeneratorContext","imports","inline","NewLine","utilityTypes","appTypes","deployTypes","paramsFactory","appFactory","appClient","callComposerType"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B,CAAA;AACH,CAAC;AAEc,UAAE,QAAQ,CAAC,GAAkB,EAAE,OAAA,GAA4B,EAAE,aAAa,EAAE,KAAK,EAAE,EAAA;IAChG,MAAM,GAAG,GAAGA,uCAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAChD,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,gBAAgB,CAAA;AACtB,IAAA,MAAM,KAAK,CAAA;AACX,IAAA,MAAM,2FAA2F,CAAA;AACjG,IAAA,MAAM,8BAA8B,CAAA;AACpC,IAAA,MAAM,oDAAoD,CAAA;AAC1D,IAAA,MAAM,KAAK,CAAA;AAEX,IAAA,OAAOC,eAAO,EAAE,CAAA;;;AAGhB,IAAA,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/H,IAAA,OAAOC,aAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;AAC7E,IAAA,MAAMC,cAAO,CAAA;AAEb,IAAA,OAAOC,yBAAY,EAAE,CAAA;AACrB,IAAA,MAAMD,cAAO,CAAA;AACb,IAAA,OAAOE,iBAAQ,CAAC,GAAG,CAAC,CAAA;AACpB,IAAA,OAAOC,uBAAW,CAAC,GAAG,CAAC,CAAA;AACvB,IAAA,MAAMH,cAAO,CAAA;;AAGb,IAAA,OAAOI,2BAAa,CAAC,GAAG,CAAC,CAAA;AACzB,IAAA,MAAMJ,cAAO,CAAA;;AAEb,IAAA,OAAOK,qBAAU,CAAC,GAAG,CAAC,CAAA;;AAEtB,IAAA,OAAOC,mBAAS,CAAC,GAAG,CAAC,CAAA;AAErB,IAAA,OAAOC,kCAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B;;;;"}
|
package/client/generate.mjs
CHANGED
|
@@ -10,10 +10,10 @@ import { callComposerType } from './call-composer-types.mjs';
|
|
|
10
10
|
import { appFactory } from './app-factory.mjs';
|
|
11
11
|
|
|
12
12
|
function convertStructs(s, sanitizer) {
|
|
13
|
-
return
|
|
14
|
-
sanitizer.makeSafePropertyIdentifier(
|
|
15
|
-
typeof
|
|
16
|
-
|
|
13
|
+
return s.map(({ name, type }) => ({
|
|
14
|
+
name: sanitizer.makeSafePropertyIdentifier(name),
|
|
15
|
+
type: typeof type === 'string' ? type : convertStructs(type, sanitizer),
|
|
16
|
+
}));
|
|
17
17
|
}
|
|
18
18
|
function* generate(app, options = { preserveNames: false }) {
|
|
19
19
|
const ctx = createGeneratorContext(app, options);
|
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,
|
|
1
|
+
{"version":3,"file":"generate.mjs","sources":["../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, StructField } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nexport function* generate(app: Arc56Contract, options: GeneratorOptions = { preserveNames: false }): DocumentParts {\n const ctx = createGeneratorContext(app, options)\n yield `/* eslint-disable */`\n yield `// @ts-nocheck`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^7`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n app.structs = Object.fromEntries(Object.keys(app.structs).map((key) => [key, convertStructs(app.structs[key], ctx.sanitizer)]))\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(app))\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n yield* deployTypes(ctx)\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory\n yield* appFactory(ctx)\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B,CAAA;AACH,CAAC;AAEc,UAAE,QAAQ,CAAC,GAAkB,EAAE,OAAA,GAA4B,EAAE,aAAa,EAAE,KAAK,EAAE,EAAA;IAChG,MAAM,GAAG,GAAG,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAChD,IAAA,MAAM,sBAAsB,CAAA;AAC5B,IAAA,MAAM,gBAAgB,CAAA;AACtB,IAAA,MAAM,KAAK,CAAA;AACX,IAAA,MAAM,2FAA2F,CAAA;AACjG,IAAA,MAAM,8BAA8B,CAAA;AACpC,IAAA,MAAM,oDAAoD,CAAA;AAC1D,IAAA,MAAM,KAAK,CAAA;AAEX,IAAA,OAAO,OAAO,EAAE,CAAA;;;AAGhB,IAAA,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/H,IAAA,OAAO,MAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;AAC7E,IAAA,MAAM,OAAO,CAAA;AAEb,IAAA,OAAO,YAAY,EAAE,CAAA;AACrB,IAAA,MAAM,OAAO,CAAA;AACb,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;AACpB,IAAA,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;AACvB,IAAA,MAAM,OAAO,CAAA;;AAGb,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;AACzB,IAAA,MAAM,OAAO,CAAA;;AAEb,IAAA,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;;AAEtB,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC,CAAA;AAErB,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B;;;;"}
|
|
@@ -7,9 +7,15 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
7
7
|
if (abiTypeStr == 'void') {
|
|
8
8
|
return 'void';
|
|
9
9
|
}
|
|
10
|
-
if (abiTypeStr == '
|
|
10
|
+
if (abiTypeStr == 'AVMBytes') {
|
|
11
11
|
return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array';
|
|
12
12
|
}
|
|
13
|
+
if (abiTypeStr == 'AVMString') {
|
|
14
|
+
return 'string';
|
|
15
|
+
}
|
|
16
|
+
if (abiTypeStr == 'AVMUint64') {
|
|
17
|
+
return 'bigint';
|
|
18
|
+
}
|
|
13
19
|
if (algosdk.abiTypeIsTransaction(abiTypeStr)) {
|
|
14
20
|
return 'AppMethodCallTransactionArgument';
|
|
15
21
|
}
|
|
@@ -26,8 +32,6 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
26
32
|
return abiTypeToTs(abiType, ioType);
|
|
27
33
|
function abiTypeToTs(abiType, ioType) {
|
|
28
34
|
if (abiType instanceof algosdk.ABIUintType) {
|
|
29
|
-
if (abiType.bitSize <= 51)
|
|
30
|
-
return 'number';
|
|
31
35
|
return ioType === 'input' ? 'bigint | number' : 'bigint';
|
|
32
36
|
}
|
|
33
37
|
if (abiType instanceof algosdk.ABIArrayDynamicType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == '
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":["abiTypeIsTransaction","ABIReferenceType","ABIType","ABIUintType","ABIArrayDynamicType","ABIByteType","ABIArrayStaticType","ABIAddressType","ABIBoolType","ABIUfixedType","ABITupleType","ABIStringType"],"mappings":";;;;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAIA,4BAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kCAAkC,CAAA;KAC1C;AACD,IAAA,IAAI,UAAU,IAAIC,wBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAIA,wBAAgB,CAAC,WAAW,IAAI,UAAU,IAAIA,wBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AACjD,QAAA,OAAO,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;KACpD;IAED,MAAM,OA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AAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;SAC/E;AACD,QAAA,IAAI,OAAO,YAAYL,mBAAW,EAAE;AAClC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAYM,qBAAa,EAAE;AACpC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;AACH;;;;"}
|
|
@@ -5,9 +5,15 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
5
5
|
if (abiTypeStr == 'void') {
|
|
6
6
|
return 'void';
|
|
7
7
|
}
|
|
8
|
-
if (abiTypeStr == '
|
|
8
|
+
if (abiTypeStr == 'AVMBytes') {
|
|
9
9
|
return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array';
|
|
10
10
|
}
|
|
11
|
+
if (abiTypeStr == 'AVMString') {
|
|
12
|
+
return 'string';
|
|
13
|
+
}
|
|
14
|
+
if (abiTypeStr == 'AVMUint64') {
|
|
15
|
+
return 'bigint';
|
|
16
|
+
}
|
|
11
17
|
if (abiTypeIsTransaction(abiTypeStr)) {
|
|
12
18
|
return 'AppMethodCallTransactionArgument';
|
|
13
19
|
}
|
|
@@ -24,8 +30,6 @@ function getEquivalentType(abiTypeStr, ioType, ctx) {
|
|
|
24
30
|
return abiTypeToTs(abiType, ioType);
|
|
25
31
|
function abiTypeToTs(abiType, ioType) {
|
|
26
32
|
if (abiType instanceof ABIUintType) {
|
|
27
|
-
if (abiType.bitSize <= 51)
|
|
28
|
-
return 'number';
|
|
29
33
|
return ioType === 'input' ? 'bigint | number' : 'bigint';
|
|
30
34
|
}
|
|
31
35
|
if (abiType instanceof ABIArrayDynamicType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == '
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import { Arc56Contract } from '@algorandfoundation/algokit-utils/types/app-arc56'\nimport {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\nimport { Sanitizer } from '../../util/sanitization'\n\nexport function getEquivalentType(\n abiTypeStr: string,\n ioType: 'input' | 'output',\n ctx: { app: Arc56Contract; sanitizer: Sanitizer },\n): string {\n const { app, sanitizer } = ctx\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeStr == 'AVMBytes') {\n return ioType === 'input' ? 'Uint8Array | string' : 'Uint8Array'\n }\n if (abiTypeStr == 'AVMString') {\n return 'string'\n }\n if (abiTypeStr == 'AVMUint64') {\n return 'bigint'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'bigint'\n }\n if (Object.keys(app.structs).includes(abiTypeStr)) {\n return sanitizer.makeSafeTypeIdentifier(abiTypeStr)\n }\n\n const abiType = ABIType.from(abiTypeStr)\n\n return abiTypeToTs(abiType, ioType)\n\n function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output'): string {\n if (abiType instanceof ABIUintType) {\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n }\n}\n"],"names":[],"mappings":";;SAiBgB,iBAAiB,CAC/B,UAAkB,EAClB,MAA0B,EAC1B,GAAiD,EAAA;AAEjD,IAAA,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;AAC9B,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,UAAU,IAAI,UAAU,EAAE;QAC5B,OAAO,MAAM,KAAK,OAAO,GAAG,qBAAqB,GAAG,YAAY,CAAA;KACjE;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAAA;KAChB;AACD,IAAA,IAAI,UAAU,IAAI,WAAW,EAAE;AAC7B,QAAA,OAAO,QAAQ,CAA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O,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA;SACtG;AACD,QAAA,IAAI,OAAO,YAAY,cAAc,EAAE;AACrC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,YAAA,OAAO,SAAS,CAAA;SACjB;AACD,QAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAY,YAAY,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,CAAA;SAC/E;AACD,QAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,YAAA,OAAO,QAAQ,CAAA;SAChB;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;AACH;;;;"}
|
package/client/imports.js
CHANGED
|
@@ -12,10 +12,11 @@ function* imports() {
|
|
|
12
12
|
CallOnComplete,
|
|
13
13
|
AppClientCompilationParams,
|
|
14
14
|
ResolveAppClientByCreatorAndName,
|
|
15
|
+
ResolveAppClientByNetwork,
|
|
15
16
|
} from '@algorandfoundation/algokit-utils/types/app-client'
|
|
16
|
-
import { AppFactory, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
17
|
+
import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
17
18
|
import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
|
|
18
|
-
import {
|
|
19
|
+
import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
19
20
|
import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'
|
|
20
21
|
import SimulateResponse = modelsv2.SimulateResponse
|
|
21
22
|
`;
|
package/client/imports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import {
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA;;;;;;;;;;;;;;;;;;GAkBL,CAAA;AACH;;;;"}
|
package/client/imports.mjs
CHANGED
|
@@ -10,10 +10,11 @@ function* imports() {
|
|
|
10
10
|
CallOnComplete,
|
|
11
11
|
AppClientCompilationParams,
|
|
12
12
|
ResolveAppClientByCreatorAndName,
|
|
13
|
+
ResolveAppClientByNetwork,
|
|
13
14
|
} from '@algorandfoundation/algokit-utils/types/app-client'
|
|
14
|
-
import { AppFactory, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
15
|
+
import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
15
16
|
import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
|
|
16
|
-
import {
|
|
17
|
+
import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
17
18
|
import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'
|
|
18
19
|
import SimulateResponse = modelsv2.SimulateResponse
|
|
19
20
|
`;
|
package/client/imports.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import {
|
|
1
|
+
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\n import { ABIReturn, AppReturn, SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app'\n import { Arc56Contract, getArc56ReturnValue } from '@algorandfoundation/algokit-utils/types/app-arc56'\n import {\n AppClient,\n AppClientMethodCallParams,\n AppClientParams,\n AppClientBareCallParams,\n CallOnComplete,\n AppClientCompilationParams,\n ResolveAppClientByCreatorAndName,\n ResolveAppClientByNetwork,\n } from '@algorandfoundation/algokit-utils/types/app-client'\n import { AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\n import AlgoKitComposer, { AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'\n import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\n import { modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'\n import SimulateResponse = modelsv2.SimulateResponse\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,OAAO,GAAA;IACtB,MAAM,CAAA;;;;;;;;;;;;;;;;;;GAkBL,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-client-generator",
|
|
9
|
-
"version": "4.0.0-beta.
|
|
9
|
+
"version": "4.0.0-beta.3",
|
|
10
10
|
"description": "Generates a TypeScript client for interacting with, and deploying ARC-0032 smart contracts on the Algorand Blockchain.",
|
|
11
11
|
"module": "index.mjs",
|
|
12
12
|
"private": false,
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"overrides": {
|
|
24
24
|
"semver": "7.5.2",
|
|
25
|
-
"micromatch": "4.0.8"
|
|
25
|
+
"micromatch": "4.0.8",
|
|
26
|
+
"rollup": "^4.22.5"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@algorandfoundation/algokit-utils": "^7.0.0-beta.
|
|
29
|
+
"@algorandfoundation/algokit-utils": "^7.0.0-beta.7",
|
|
29
30
|
"algosdk": "^2.7.0",
|
|
30
31
|
"chalk": "^4.1.2",
|
|
31
32
|
"change-case": "^4.1.2",
|