Skip to content

Commit ab90ba8

Browse files
committed
update asContractParamType to handle Hash160/256/ECPoint
1 parent 57355a2 commit ab90ba8

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

packages/compiler/src/utils.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,16 @@ export function asContractParamType(type: tsm.Type): sc.ContractParamType {
318318

319319
const typeSymbol = type.getAliasSymbol() ?? type.getSymbol();
320320
const typeFQN = typeSymbol?.getFullyQualifiedName();
321-
if (typeFQN === "global.ByteString") {
322-
return sc.ContractParamType.ByteArray;
323-
}
324321

325-
if (typeFQN === "Iterator") {
326-
return sc.ContractParamType.InteropInterface;
327-
}
328-
329-
if (typeFQN === "Map") {
330-
return sc.ContractParamType.Map;
322+
switch (typeFQN) {
323+
case "global.ByteString": return sc.ContractParamType.ByteArray;
324+
case "global.Hash160": return sc.ContractParamType.Hash160;
325+
case "global.Hash256": return sc.ContractParamType.Hash256;
326+
case "global.ECPoint": return sc.ContractParamType.PublicKey;
327+
case "Iterator": return sc.ContractParamType.InteropInterface;
328+
case "Map": return sc.ContractParamType.Map;
329+
default: return sc.ContractParamType.Any;
331330
}
332-
333-
return sc.ContractParamType.Any;
334331
}
335332

336333
export function asReturnType(type: tsm.Type) {

0 commit comments

Comments
 (0)