@algorandfoundation/algokit-client-generator 6.0.2-beta.1 → 7.0.0-alpha.2
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-context.d.ts +122 -0
- package/client/app-client-context.js +212 -0
- package/client/app-client-context.js.map +1 -0
- package/client/app-client-context.mjs +209 -0
- package/client/app-client-context.mjs.map +1 -0
- package/client/app-client.js +29 -51
- package/client/app-client.js.map +1 -1
- package/client/app-client.mjs +29 -51
- package/client/app-client.mjs.map +1 -1
- package/client/app-factory.js +23 -27
- package/client/app-factory.js.map +1 -1
- package/client/app-factory.mjs +23 -27
- package/client/app-factory.mjs.map +1 -1
- package/client/app-types.js +31 -60
- package/client/app-types.js.map +1 -1
- package/client/app-types.mjs +32 -61
- package/client/app-types.mjs.map +1 -1
- package/client/call-composer-types.js +31 -34
- package/client/call-composer-types.js.map +1 -1
- package/client/call-composer-types.mjs +31 -34
- package/client/call-composer-types.mjs.map +1 -1
- package/client/call-composer.js +24 -31
- package/client/call-composer.js.map +1 -1
- package/client/call-composer.mjs +24 -31
- package/client/call-composer.mjs.map +1 -1
- package/client/deploy-types.d.ts +1 -11
- package/client/deploy-types.js +28 -53
- package/client/deploy-types.js.map +1 -1
- package/client/deploy-types.mjs +29 -52
- package/client/deploy-types.mjs.map +1 -1
- package/client/generate.d.ts +1 -1
- package/client/generate.js +2 -2
- package/client/generate.js.map +1 -1
- package/client/generate.mjs +2 -2
- package/client/generate.mjs.map +1 -1
- package/client/generator-context.d.ts +3 -5
- package/client/generator-context.js +4 -10
- package/client/generator-context.js.map +1 -1
- package/client/generator-context.mjs +4 -10
- package/client/generator-context.mjs.map +1 -1
- package/client/helpers/contains-non-void-method.d.ts +2 -2
- package/client/helpers/contains-non-void-method.js +3 -2
- package/client/helpers/contains-non-void-method.js.map +1 -1
- package/client/helpers/contains-non-void-method.mjs +3 -2
- package/client/helpers/contains-non-void-method.mjs.map +1 -1
- package/client/helpers/get-equivalent-type.d.ts +3 -5
- package/client/helpers/get-equivalent-type.js +53 -54
- package/client/helpers/get-equivalent-type.js.map +1 -1
- package/client/helpers/get-equivalent-type.mjs +53 -55
- package/client/helpers/get-equivalent-type.mjs.map +1 -1
- package/client/imports.d.ts +1 -2
- package/client/imports.js +10 -19
- package/client/imports.js.map +1 -1
- package/client/imports.mjs +10 -19
- package/client/imports.mjs.map +1 -1
- package/client/params-factory.js +47 -50
- package/client/params-factory.js.map +1 -1
- package/client/params-factory.mjs +47 -50
- package/client/params-factory.mjs.map +1 -1
- package/package.json +2 -3
- package/schema/load.d.ts +1 -1
- package/schema/load.js.map +1 -1
- package/schema/load.mjs.map +1 -1
- package/client/helpers/get-call-config-summary.d.ts +0 -19
- package/client/helpers/get-call-config-summary.js +0 -60
- package/client/helpers/get-call-config-summary.js.map +0 -1
- package/client/helpers/get-call-config-summary.mjs +0 -57
- package/client/helpers/get-call-config-summary.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.js","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIStructType,\n ABIUfixedType,\n ABIUintType,\n AVMType,\n argTypeIsTransaction,\n ABITransactionType,\n} from '@algorandfoundation/algokit-utils/abi'\n\nimport { Sanitizer } from '../../util/sanitization'\n\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\n\nexport function getEquivalentType(\n algoType: ABIType | ABIReferenceType | ABITransactionType | AVMType | 'void',\n ioType: 'input' | 'output',\n sanitizer: Sanitizer,\n): string {\n if (algoType == 'void') {\n return 'void'\n }\n if (algoType == 'AVMBytes') {\n return ioType === 'input' ? bytesOrStringType : 'Uint8Array'\n }\n if (algoType == 'AVMString') {\n return 'string'\n }\n if (algoType == 'AVMUint64') {\n return 'bigint'\n }\n if (argTypeIsTransaction(algoType)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (algoType == ABIReferenceType.Account) {\n return bytesOrStringType\n }\n if (algoType == ABIReferenceType.Application || algoType == ABIReferenceType.Asset) {\n return 'bigint'\n }\n\n return abiTypeToTs(algoType, ioType, sanitizer)\n}\n\nexport function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output', sanitizer: Sanitizer): string {\n if (abiType instanceof ABIStructType) {\n return sanitizer.makeSafeTypeIdentifier(abiType.structName)\n }\n\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, sanitizer)\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.length).fill(abiTypeToTs(abiType.childType, ioType, sanitizer)).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, sanitizer)).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"],"names":["argTypeIsTransaction","ABIReferenceType","ABIStructType","ABIUintType","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AE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;IAC3F;AACA,IAAA,IAAI,OAAO,YAAYL,eAAW,EAAE;AAClC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAYM,iBAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,SAAS;AAClB;;;;;"}
|
|
@@ -1,79 +1,77 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { argTypeIsTransaction, ABIReferenceType, ABIStructType, ABIUintType, ABIArrayDynamicType, ABIByteType, ABIArrayStaticType, ABIAddressType, ABIBoolType, ABIUfixedType, ABITupleType, ABIStringType } from '@algorandfoundation/algokit-utils/abi';
|
|
2
2
|
|
|
3
3
|
const bigIntOrNumberType = 'bigint | number';
|
|
4
4
|
const bytesOrStringType = 'Uint8Array | string';
|
|
5
|
-
function getEquivalentType(
|
|
6
|
-
|
|
7
|
-
if (abiTypeStr == 'void') {
|
|
5
|
+
function getEquivalentType(algoType, ioType, sanitizer) {
|
|
6
|
+
if (algoType == 'void') {
|
|
8
7
|
return 'void';
|
|
9
8
|
}
|
|
10
|
-
if (
|
|
9
|
+
if (algoType == 'AVMBytes') {
|
|
11
10
|
return ioType === 'input' ? bytesOrStringType : 'Uint8Array';
|
|
12
11
|
}
|
|
13
|
-
if (
|
|
12
|
+
if (algoType == 'AVMString') {
|
|
14
13
|
return 'string';
|
|
15
14
|
}
|
|
16
|
-
if (
|
|
15
|
+
if (algoType == 'AVMUint64') {
|
|
17
16
|
return 'bigint';
|
|
18
17
|
}
|
|
19
|
-
if (
|
|
18
|
+
if (argTypeIsTransaction(algoType)) {
|
|
20
19
|
return 'AppMethodCallTransactionArgument';
|
|
21
20
|
}
|
|
22
|
-
if (
|
|
21
|
+
if (algoType == ABIReferenceType.Account) {
|
|
23
22
|
return bytesOrStringType;
|
|
24
23
|
}
|
|
25
|
-
if (
|
|
24
|
+
if (algoType == ABIReferenceType.Application || algoType == ABIReferenceType.Asset) {
|
|
26
25
|
return 'bigint';
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return abiTypeToTs(algoType, ioType, sanitizer);
|
|
28
|
+
}
|
|
29
|
+
function abiTypeToTs(abiType, ioType, sanitizer) {
|
|
30
|
+
if (abiType instanceof ABIStructType) {
|
|
31
|
+
return sanitizer.makeSafeTypeIdentifier(abiType.structName);
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const childTsType = abiTypeToTs(abiType.childType, ioType);
|
|
43
|
-
if (childTsType === bigIntOrNumberType) {
|
|
44
|
-
return 'bigint[] | number[]';
|
|
45
|
-
}
|
|
46
|
-
else if (childTsType === bytesOrStringType) {
|
|
47
|
-
return 'Uint8Array[] | string[]';
|
|
48
|
-
}
|
|
49
|
-
return `${childTsType}[]`;
|
|
50
|
-
}
|
|
51
|
-
if (abiType instanceof ABIArrayStaticType) {
|
|
52
|
-
if (abiType.childType instanceof ABIByteType)
|
|
53
|
-
return 'Uint8Array';
|
|
54
|
-
return `[${new Array(abiType.staticLength).fill(abiTypeToTs(abiType.childType, ioType)).join(', ')}]`;
|
|
55
|
-
}
|
|
56
|
-
if (abiType instanceof ABIAddressType) {
|
|
57
|
-
return 'string';
|
|
58
|
-
}
|
|
59
|
-
if (abiType instanceof ABIBoolType) {
|
|
60
|
-
return 'boolean';
|
|
61
|
-
}
|
|
62
|
-
if (abiType instanceof ABIUfixedType) {
|
|
63
|
-
return 'number';
|
|
64
|
-
}
|
|
65
|
-
if (abiType instanceof ABITupleType) {
|
|
66
|
-
return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType)).join(', ')}]`;
|
|
67
|
-
}
|
|
68
|
-
if (abiType instanceof ABIByteType) {
|
|
69
|
-
return 'number';
|
|
33
|
+
if (abiType instanceof ABIUintType) {
|
|
34
|
+
if (abiType.bitSize < 53)
|
|
35
|
+
return ioType === 'input' ? bigIntOrNumberType : 'number';
|
|
36
|
+
return ioType === 'input' ? bigIntOrNumberType : 'bigint';
|
|
37
|
+
}
|
|
38
|
+
if (abiType instanceof ABIArrayDynamicType) {
|
|
39
|
+
if (abiType.childType instanceof ABIByteType)
|
|
40
|
+
return 'Uint8Array';
|
|
41
|
+
const childTsType = abiTypeToTs(abiType.childType, ioType, sanitizer);
|
|
42
|
+
if (childTsType === bigIntOrNumberType) {
|
|
43
|
+
return 'bigint[] | number[]';
|
|
70
44
|
}
|
|
71
|
-
if (
|
|
72
|
-
return 'string';
|
|
45
|
+
else if (childTsType === bytesOrStringType) {
|
|
46
|
+
return 'Uint8Array[] | string[]';
|
|
73
47
|
}
|
|
74
|
-
return
|
|
48
|
+
return `${childTsType}[]`;
|
|
49
|
+
}
|
|
50
|
+
if (abiType instanceof ABIArrayStaticType) {
|
|
51
|
+
if (abiType.childType instanceof ABIByteType)
|
|
52
|
+
return 'Uint8Array';
|
|
53
|
+
return `[${new Array(abiType.length).fill(abiTypeToTs(abiType.childType, ioType, sanitizer)).join(', ')}]`;
|
|
54
|
+
}
|
|
55
|
+
if (abiType instanceof ABIAddressType) {
|
|
56
|
+
return 'string';
|
|
57
|
+
}
|
|
58
|
+
if (abiType instanceof ABIBoolType) {
|
|
59
|
+
return 'boolean';
|
|
60
|
+
}
|
|
61
|
+
if (abiType instanceof ABIUfixedType) {
|
|
62
|
+
return 'number';
|
|
63
|
+
}
|
|
64
|
+
if (abiType instanceof ABITupleType) {
|
|
65
|
+
return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType, sanitizer)).join(', ')}]`;
|
|
66
|
+
}
|
|
67
|
+
if (abiType instanceof ABIByteType) {
|
|
68
|
+
return 'number';
|
|
69
|
+
}
|
|
70
|
+
if (abiType instanceof ABIStringType) {
|
|
71
|
+
return 'string';
|
|
75
72
|
}
|
|
73
|
+
return 'unknown';
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
export { getEquivalentType };
|
|
76
|
+
export { abiTypeToTs, getEquivalentType };
|
|
79
77
|
//# sourceMappingURL=get-equivalent-type.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"get-equivalent-type.mjs","sources":["../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIStructType,\n ABIUfixedType,\n ABIUintType,\n AVMType,\n argTypeIsTransaction,\n ABITransactionType,\n} from '@algorandfoundation/algokit-utils/abi'\n\nimport { Sanitizer } from '../../util/sanitization'\n\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\n\nexport function getEquivalentType(\n algoType: ABIType | ABIReferenceType | ABITransactionType | AVMType | 'void',\n ioType: 'input' | 'output',\n sanitizer: Sanitizer,\n): string {\n if (algoType == 'void') {\n return 'void'\n }\n if (algoType == 'AVMBytes') {\n return ioType === 'input' ? bytesOrStringType : 'Uint8Array'\n }\n if (algoType == 'AVMString') {\n return 'string'\n }\n if (algoType == 'AVMUint64') {\n return 'bigint'\n }\n if (argTypeIsTransaction(algoType)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (algoType == ABIReferenceType.Account) {\n return bytesOrStringType\n }\n if (algoType == ABIReferenceType.Application || algoType == ABIReferenceType.Asset) {\n return 'bigint'\n }\n\n return abiTypeToTs(algoType, ioType, sanitizer)\n}\n\nexport function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output', sanitizer: Sanitizer): string {\n if (abiType instanceof ABIStructType) {\n return sanitizer.makeSafeTypeIdentifier(abiType.structName)\n }\n\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, sanitizer)\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.length).fill(abiTypeToTs(abiType.childType, ioType, sanitizer)).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, sanitizer)).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"],"names":[],"mappings":";;AAoBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,QAA4E,EAC5E,MAA0B,EAC1B,SAAoB,EAAA;AAEpB,IAAA,IAAI,QAAQ,IAAI,MAAM,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,IAAI,QAAQ,IAAI,UAAU,EAAE;QAC1B,OAAO,MAAM,KAAK,OAAO,GAAG,iBAAiB,GAAG,YAAY;IAC9D;AACA,IAAA,IAAI,QAAQ,IAAI,WAAW,EAAE;AAC3B,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,QAAQ,IAAI,WAAW,EAAE;AAC3B,QAAA,OAAO,QAAQ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AAA,IAAI,OAAO,CAAC,SAAS,YAAY,WAAW;AAAE,YAAA,OAAO,YAAY;AACjE,QAAA,OAAO,CAAA,CAAA,EAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;IAC5G;AACA,IAAA,IAAI,OAAO,YAAY,cAAc,EAAE;AACrC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,YAAY,EAAE;QACnC,OAAO,CAAA,CAAA,EAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;IAC3F;AACA,IAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,SAAS;AAClB;;;;"}
|
package/client/imports.d.ts
CHANGED
package/client/imports.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function* imports(
|
|
3
|
+
function* imports() {
|
|
4
4
|
yield `
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
AppClientCompilationParams,
|
|
15
|
-
ResolveAppClientByCreatorAndName,
|
|
16
|
-
ResolveAppClientByNetwork,
|
|
17
|
-
CloneAppClientParams,
|
|
18
|
-
} from '@algorandfoundation/algokit-utils/types/app-client'
|
|
19
|
-
${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}
|
|
20
|
-
import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
|
|
21
|
-
import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
22
|
-
import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'
|
|
5
|
+
import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'
|
|
6
|
+
import { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'
|
|
7
|
+
import { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'
|
|
8
|
+
import { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'
|
|
9
|
+
import { Address, encodeAddress } from '@algorandfoundation/algokit-utils'
|
|
10
|
+
import { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'
|
|
11
|
+
import { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
12
|
+
import { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
13
|
+
import { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'
|
|
23
14
|
`;
|
|
24
15
|
}
|
|
25
16
|
|
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'\
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\nimport { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\nimport { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'\nimport { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'\nimport { Address, encodeAddress } from '@algorandfoundation/algokit-utils'\nimport { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'\nimport { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\nimport { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\nimport { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,OAAO,GAAA;IACtB,MAAM;;;;;;;;;;GAUL;AACH;;;;"}
|
package/client/imports.mjs
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
function* imports(
|
|
1
|
+
function* imports() {
|
|
2
2
|
yield `
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
AppClientCompilationParams,
|
|
13
|
-
ResolveAppClientByCreatorAndName,
|
|
14
|
-
ResolveAppClientByNetwork,
|
|
15
|
-
CloneAppClientParams,
|
|
16
|
-
} from '@algorandfoundation/algokit-utils/types/app-client'
|
|
17
|
-
${ctx.mode === 'full' ? `import { AppFactory as _AppFactory, AppFactoryAppClientParams, AppFactoryResolveAppClientByCreatorAndNameParams, AppFactoryDeployParams, AppFactoryParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'` : ''}
|
|
18
|
-
import { TransactionComposer, AppCallMethodCall, AppMethodCallTransactionArgument, SimulateOptions, RawSimulateOptions, SkipSignaturesSimulateOptions } from '@algorandfoundation/algokit-utils/types/composer'
|
|
19
|
-
import { SendParams, SendSingleTransactionResult, SendAtomicTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
20
|
-
import { Address, encodeAddress, modelsv2, OnApplicationComplete, Transaction, TransactionSigner } from 'algosdk'
|
|
3
|
+
import { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'
|
|
4
|
+
import { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'
|
|
5
|
+
import { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'
|
|
6
|
+
import { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'
|
|
7
|
+
import { Address, encodeAddress } from '@algorandfoundation/algokit-utils'
|
|
8
|
+
import { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'
|
|
9
|
+
import { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'
|
|
10
|
+
import { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'
|
|
11
|
+
import { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'
|
|
21
12
|
`;
|
|
22
13
|
}
|
|
23
14
|
|
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'\
|
|
1
|
+
{"version":3,"file":"imports.mjs","sources":["../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\nimport { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\nimport { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'\nimport { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'\nimport { Address, encodeAddress } from '@algorandfoundation/algokit-utils'\nimport { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'\nimport { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\nimport { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\nimport { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,OAAO,GAAA;IACtB,MAAM;;;;;;;;;;GAUL;AACH;;;;"}
|
package/client/params-factory.js
CHANGED
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var writer = require('../output/writer.js');
|
|
4
|
-
var
|
|
5
|
-
var deployTypes = require('./deploy-types.js');
|
|
6
|
-
var algosdk = require('algosdk');
|
|
4
|
+
var appClientContext = require('./app-client-context.js');
|
|
7
5
|
|
|
8
6
|
function* paramsFactory(ctx) {
|
|
9
|
-
yield* writer.jsDoc(`Exposes methods for constructing \`AppClient\` params objects for ABI calls to the ${ctx.name} smart contract`);
|
|
10
|
-
yield `export abstract class ${ctx.name}ParamsFactory {`;
|
|
7
|
+
yield* writer.jsDoc(`Exposes methods for constructing \`AppClient\` params objects for ABI calls to the ${ctx.app.name.original} smart contract`);
|
|
8
|
+
yield `export abstract class ${ctx.app.name.makeSafeTypeIdentifier}ParamsFactory {`;
|
|
11
9
|
yield writer.IncIndent;
|
|
12
10
|
yield* opMethods(ctx);
|
|
13
11
|
for (const method of ctx.app.methods) {
|
|
12
|
+
if (!method.callActions.noOp)
|
|
13
|
+
continue;
|
|
14
14
|
yield* callFactoryMethod(ctx, method);
|
|
15
15
|
}
|
|
16
16
|
yield writer.DecIndent;
|
|
17
17
|
yield '}';
|
|
18
18
|
}
|
|
19
19
|
function* opMethods(ctx) {
|
|
20
|
-
const { app
|
|
20
|
+
const { app } = ctx;
|
|
21
21
|
if (ctx.mode === 'full') {
|
|
22
|
-
yield* operationMethod(ctx, `Constructs create ABI call params for the ${app.name} smart contract`,
|
|
23
|
-
yield* operationMethod(ctx, `Constructs update ABI call params for the ${app.name} smart contract`,
|
|
24
|
-
yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`,
|
|
22
|
+
yield* operationMethod(ctx, `Constructs create ABI call params for the ${app.name} smart contract`, app.createMethods, 'create', true);
|
|
23
|
+
yield* operationMethod(ctx, `Constructs update ABI call params for the ${app.name} smart contract`, app.updateMethods, 'update', true);
|
|
24
|
+
yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, app.deleteMethods, 'delete');
|
|
25
25
|
}
|
|
26
|
-
yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`,
|
|
27
|
-
yield* operationMethod(ctx, `Constructs close out ABI call params for the ${app.name} smart contract`,
|
|
26
|
+
yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, app.optInMethods, 'optIn');
|
|
27
|
+
yield* operationMethod(ctx, `Constructs close out ABI call params for the ${app.name} smart contract`, app.closeOutMethods, 'closeOut');
|
|
28
28
|
}
|
|
29
29
|
function* operationMethod(ctx, description, methods, verb, includeCompilation) {
|
|
30
|
-
const { app,
|
|
31
|
-
if (methods.
|
|
30
|
+
const { app, sanitizer, name } = ctx;
|
|
31
|
+
if (methods.some((m) => !m.isBare)) {
|
|
32
32
|
yield* writer.jsDoc(`Gets available ${verb} ABI call param factories`);
|
|
33
33
|
yield `static get ${verb}() {`;
|
|
34
34
|
yield writer.IncIndent;
|
|
35
35
|
yield `return {`;
|
|
36
36
|
yield writer.IncIndent;
|
|
37
37
|
if (['create', 'update', 'delete'].includes(verb)) {
|
|
38
|
-
yield `_resolveByMethod<TParams extends ${
|
|
38
|
+
yield `_resolveByMethod<TParams extends ${app.name.makeSafeTypeIdentifier}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`;
|
|
39
39
|
yield writer.IncIndent;
|
|
40
40
|
yield `switch(params.method) {`;
|
|
41
41
|
yield writer.IncIndent;
|
|
42
|
-
for (const
|
|
43
|
-
if (
|
|
42
|
+
for (const method of methods) {
|
|
43
|
+
if (!appClientContext.isAbiMethod(method))
|
|
44
44
|
continue;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
yield `case '${sanitizer.makeSafeStringTypeLiteral(uniqueName)}':`;
|
|
45
|
+
if (method.baseNameIsUnique) {
|
|
46
|
+
yield `case '${method.name.makeSafeStringTypeLiteral}':`;
|
|
48
47
|
}
|
|
49
|
-
yield `case '${sanitizer.makeSafeStringTypeLiteral(
|
|
50
|
-
yield* writer.indent(`return ${
|
|
48
|
+
yield `case '${sanitizer.makeSafeStringTypeLiteral(method.signature)}':`;
|
|
49
|
+
yield* writer.indent(`return ${app.name.makeSafeTypeIdentifier}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(method.uniqueName.original))}(params)`);
|
|
51
50
|
}
|
|
52
51
|
yield writer.DecIndentAndCloseBlock;
|
|
53
52
|
// 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
|
|
@@ -56,40 +55,38 @@ function* operationMethod(ctx, description, methods, verb, includeCompilation) {
|
|
|
56
55
|
yield '},';
|
|
57
56
|
yield writer.NewLine;
|
|
58
57
|
}
|
|
59
|
-
for (const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
58
|
+
for (const method of methods) {
|
|
59
|
+
if (!appClientContext.isAbiMethod(method))
|
|
60
|
+
continue;
|
|
61
|
+
const onComplete = verb === 'create' ? method.createActions.inputType : undefined;
|
|
62
|
+
const uniqueName = method.uniqueName.original;
|
|
63
|
+
yield* writer.jsDoc({
|
|
64
|
+
description: `${description} using the ${method.signature} ABI method`,
|
|
65
|
+
params: {
|
|
66
|
+
params: `Parameters for the call`,
|
|
67
|
+
},
|
|
68
|
+
returns: 'An `AppClientMethodCallParams` object for the call',
|
|
69
|
+
});
|
|
70
|
+
yield* factoryMethod({
|
|
71
|
+
isNested: true,
|
|
72
|
+
sanitizer,
|
|
73
|
+
name: sanitizer.makeSafeMethodIdentifier(uniqueName),
|
|
74
|
+
signature: method.signature,
|
|
75
|
+
args: method.args,
|
|
76
|
+
additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''}`,
|
|
77
|
+
contractName: name,
|
|
78
|
+
});
|
|
81
79
|
}
|
|
82
80
|
yield writer.DecIndentAndCloseBlock;
|
|
83
81
|
yield writer.DecIndentAndCloseBlock;
|
|
84
82
|
yield writer.NewLine;
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
|
-
function* callFactoryMethod({
|
|
88
|
-
|
|
89
|
-
if (!callConfig.callMethods.includes(methodSignature))
|
|
85
|
+
function* callFactoryMethod({ sanitizer, name }, method) {
|
|
86
|
+
if (!method.callActions.any || !appClientContext.isAbiMethod(method))
|
|
90
87
|
return;
|
|
91
88
|
yield* writer.jsDoc({
|
|
92
|
-
description: `Constructs a no op call for the ${
|
|
89
|
+
description: `Constructs a no op call for the ${method.signature} ABI method`,
|
|
93
90
|
abiDescription: method.desc,
|
|
94
91
|
params: {
|
|
95
92
|
params: `Parameters for the call`,
|
|
@@ -99,8 +96,8 @@ function* callFactoryMethod({ methodSignatureToUniqueName, callConfig, sanitizer
|
|
|
99
96
|
yield* factoryMethod({
|
|
100
97
|
isNested: false,
|
|
101
98
|
sanitizer,
|
|
102
|
-
name:
|
|
103
|
-
signature:
|
|
99
|
+
name: method.uniqueName.makeSafeMethodIdentifier,
|
|
100
|
+
signature: method.signature,
|
|
104
101
|
args: method.args,
|
|
105
102
|
additionalParamTypes: ' & CallOnComplete',
|
|
106
103
|
contractName: name,
|
|
@@ -116,7 +113,7 @@ function* factoryMethod(m) {
|
|
|
116
113
|
yield '...params,';
|
|
117
114
|
yield `method: '${methodSigSafe}' as const,`;
|
|
118
115
|
yield `args: Array.isArray(params.args) ? params.args : [${args
|
|
119
|
-
.map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(
|
|
116
|
+
.map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(a.name?.makeSafePropertyIdentifier ?? `arg${i + 1}`)}`)
|
|
120
117
|
.join(', ')}],`;
|
|
121
118
|
yield writer.DecIndent;
|
|
122
119
|
yield '}';
|
|
@@ -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":";;;;;;;AAQM,UAAW,aAAa,CAAC,GAAqB,EAAA;IAClD,OAAOA,YAAK,CAAC,CAAA,mFAAA,EAAsF,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB,CAAC;AAC7H,IAAA,MAAM,CAAA,sBAAA,EAAyB,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;IACvC;AAEA,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,OAAO,eAAe,CAAC,GAAG,EAAE,6CAA6C,GAAG,CAAC,IAAI,CAAA,eAAA,CAAiB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sources":["../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { Sanitizer } from '../util/sanitization'\nimport { AppClientMethodContext, MethodArgClientContext, isAbiMethod } from './app-client-context'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.app.name.original} smart contract`)\n yield `export abstract class ${ctx.app.name.makeSafeTypeIdentifier}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n if (!method.callActions.noOp) continue\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(ctx, `Constructs create ABI call params for the ${app.name} smart contract`, app.createMethods, 'create', true)\n yield* operationMethod(ctx, `Constructs update ABI call params for the ${app.name} smart contract`, app.updateMethods, 'update', true)\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, app.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, app.optInMethods, 'optIn')\n yield* operationMethod(ctx, `Constructs close out ABI call params for the ${app.name} smart contract`, app.closeOutMethods, 'closeOut')\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: AppClientMethodContext[],\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, sanitizer, name } = ctx\n if (methods.some((m) => !m.isBare)) {\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 ${app.name.makeSafeTypeIdentifier}${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 method of methods) {\n if (!isAbiMethod(method)) continue\n if (method.baseNameIsUnique) {\n yield `case '${method.name.makeSafeStringTypeLiteral}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(method.signature)}':`\n yield* indent(\n `return ${app.name.makeSafeTypeIdentifier}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(method.uniqueName.original))}(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 method of methods) {\n if (!isAbiMethod(method)) continue\n const onComplete = verb === 'create' ? method.createActions.inputType : undefined\n\n const uniqueName = method.uniqueName.original\n yield* jsDoc({\n description: `${description} using the ${method.signature} 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: method.signature,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''\n }`,\n contractName: name,\n })\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ sanitizer, name }: GeneratorContext, method: AppClientMethodContext) {\n if (!method.callActions.any || !isAbiMethod(method)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${method.signature} 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: method.uniqueName.makeSafeMethodIdentifier,\n signature: method.signature,\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: MethodArgClientContext[]\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(a.name?.makeSafePropertyIdentifier ?? `arg${i + 1}`)}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n yield `}${isNested ? ',' : ''}`\n}\n"],"names":["jsDoc","IncIndent","DecIndent","isAbiMethod","indent","DecIndentAndCloseBlock","NewLine"],"mappings":";;;;;AAKM,UAAW,aAAa,CAAC,GAAqB,EAAA;AAClD,IAAA,OAAOA,YAAK,CAAC,sFAAsF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAA,eAAA,CAAiB,CAAC;IAC1I,MAAM,CAAA,sBAAA,EAAyB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAA,eAAA,CAAiB;AACnF,IAAA,MAAMC,gBAAS;AAEf,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC;IAErB,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE;AACpC,QAAA,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI;YAAE;QAC9B,OAAO,iBAAiB,CAA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