Skip to content

Commit

Permalink
update asContractParamType to handle Hash160/256/ECPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
devhawk committed Jun 25, 2023
1 parent 57355a2 commit ab90ba8
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/compiler/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,16 @@ export function asContractParamType(type: tsm.Type): sc.ContractParamType {

const typeSymbol = type.getAliasSymbol() ?? type.getSymbol();
const typeFQN = typeSymbol?.getFullyQualifiedName();
if (typeFQN === "global.ByteString") {
return sc.ContractParamType.ByteArray;
}

if (typeFQN === "Iterator") {
return sc.ContractParamType.InteropInterface;
}

if (typeFQN === "Map") {
return sc.ContractParamType.Map;
switch (typeFQN) {
case "global.ByteString": return sc.ContractParamType.ByteArray;
case "global.Hash160": return sc.ContractParamType.Hash160;
case "global.Hash256": return sc.ContractParamType.Hash256;
case "global.ECPoint": return sc.ContractParamType.PublicKey;
case "Iterator": return sc.ContractParamType.InteropInterface;
case "Map": return sc.ContractParamType.Map;
default: return sc.ContractParamType.Any;
}

return sc.ContractParamType.Any;
}

export function asReturnType(type: tsm.Type) {
Expand Down

0 comments on commit ab90ba8

Please sign in to comment.