@algorandfoundation/algokit-client-generator 3.0.5 → 3.0.6-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.
|
@@ -26,7 +26,11 @@ function getEquivalentType(abiTypeStr, ioType) {
|
|
|
26
26
|
if (abiType instanceof algosdk.ABIArrayDynamicType) {
|
|
27
27
|
if (abiType.childType instanceof algosdk.ABIByteType)
|
|
28
28
|
return 'Uint8Array';
|
|
29
|
-
|
|
29
|
+
const childTsType = abiTypeToTs(abiType.childType, ioType);
|
|
30
|
+
if (childTsType === 'bigint | number') {
|
|
31
|
+
return 'bigint[] | number[]';
|
|
32
|
+
}
|
|
33
|
+
return `${childTsType}[]`;
|
|
30
34
|
}
|
|
31
35
|
if (abiType instanceof algosdk.ABIArrayStaticType) {
|
|
32
36
|
if (abiType.childType instanceof algosdk.ABIByteType)
|
|
@@ -1 +1 @@
|
|
|
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 ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\n\nexport function getEquivalentType(abiTypeStr: string, ioType: 'input' | 'output'): string {\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'TransactionToSign | Transaction | Promise<SendTransactionResult>'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'number | bigint'\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 <= 51) return 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n
|
|
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 ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\n\nexport function getEquivalentType(abiTypeStr: string, ioType: 'input' | 'output'): string {\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'TransactionToSign | Transaction | Promise<SendTransactionResult>'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'number | bigint'\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 <= 51) return 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === 'bigint | number') {\n return 'bigint[] | number[]'\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":";;;;AAegB,SAAA,iBAAiB,CAAC,UAAkB,EAAE,MAA0B,EAAA;AAC9E,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAIA,4BAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kEAAkE,CAAA;KAC1E;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,iBAAiB,CAAA;KACzB;IAED,MAAM,OAAO,GAAGC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAExC,IAAA,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAEnC,IAAA,SAAS,WAAW,CAAC,OAAgB,EAAE,MAA0B,EAAA;AAC/D,QAAA,IAAI,OAAO,YAAYC,mBAAW,EAAE;AAClC,YAAA,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE;AAAE,gBAAA,OAAO,QAAQ,CAAA;YAC1C,OAAO,MAAM,KAAK,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAA;SACzD;AACD,QAAA,IAAI,OAAO,YAAYC,2BAAmB,EAAE;AAC1C,YAAA,IAAI,OAAO,C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,CAAA;SAChB;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;AACH;;;;"}
|
|
@@ -24,7 +24,11 @@ function getEquivalentType(abiTypeStr, ioType) {
|
|
|
24
24
|
if (abiType instanceof ABIArrayDynamicType) {
|
|
25
25
|
if (abiType.childType instanceof ABIByteType)
|
|
26
26
|
return 'Uint8Array';
|
|
27
|
-
|
|
27
|
+
const childTsType = abiTypeToTs(abiType.childType, ioType);
|
|
28
|
+
if (childTsType === 'bigint | number') {
|
|
29
|
+
return 'bigint[] | number[]';
|
|
30
|
+
}
|
|
31
|
+
return `${childTsType}[]`;
|
|
28
32
|
}
|
|
29
33
|
if (abiType instanceof ABIArrayStaticType) {
|
|
30
34
|
if (abiType.childType instanceof ABIByteType)
|
|
@@ -1 +1 @@
|
|
|
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 ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\n\nexport function getEquivalentType(abiTypeStr: string, ioType: 'input' | 'output'): string {\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'TransactionToSign | Transaction | Promise<SendTransactionResult>'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'number | bigint'\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 <= 51) return 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n
|
|
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 ABIUfixedType,\n ABIUintType,\n abiTypeIsTransaction,\n} from 'algosdk'\n\nexport function getEquivalentType(abiTypeStr: string, ioType: 'input' | 'output'): string {\n if (abiTypeStr == 'void') {\n return 'void'\n }\n if (abiTypeIsTransaction(abiTypeStr)) {\n return 'TransactionToSign | Transaction | Promise<SendTransactionResult>'\n }\n if (abiTypeStr == ABIReferenceType.account) {\n return 'string | Uint8Array'\n }\n if (abiTypeStr == ABIReferenceType.application || abiTypeStr == ABIReferenceType.asset) {\n return 'number | bigint'\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 <= 51) return 'number'\n return ioType === 'input' ? 'bigint | number' : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType)\n if (childTsType === 'bigint | number') {\n return 'bigint[] | number[]'\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":";;AAegB,SAAA,iBAAiB,CAAC,UAAkB,EAAE,MAA0B,EAAA;AAC9E,IAAA,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,QAAA,OAAO,MAAM,CAAA;KACd;AACD,IAAA,IAAI,oBAAoB,CAAC,UAAU,CAAC,EAAE;AACpC,QAAA,OAAO,kEAAkE,CAAA;KAC1E;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,OAAO,EAAE;AAC1C,QAAA,OAAO,qBAAqB,CAAA;KAC7B;AACD,IAAA,IAAI,UAAU,IAAI,gBAAgB,CAAC,WAAW,IAAI,UAAU,IAAI,gBAAgB,CAAC,KAAK,EAAE;AACtF,QAAA,OAAO,iBAAiB,CAAA;KACzB;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAExC,IAAA,OAAO,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAEnC,IAAA,SAAS,WAAW,CAAC,OAAgB,EAAE,MAA0B,EAAA;AAC/D,QAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,YAAA,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE;AAAE,gBAAA,OAAO,QAAQ,CAAA;YAC1C,OAAO,MAAM,KAAK,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAA;SACzD;AACD,QAAA,IAAI,OAAO,YAAY,mBAAmB,EAAE;AAC1C,YAAA,IAAI,OAAO,CAAC,SAAS,YAAY,WAAW;AAAE,gBAAA,OAAO,YAAY,CAAA;YAEjE,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;AAC1D,YAAA,IAAI,WAAW,KAAK,iBAAiB,EAAE;AACrC,gBAAA,OAAO,qBAAqB,CAAA;aAC7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
"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,
|