Skip to content

Commit

Permalink
Fix accountId convert
Browse files Browse the repository at this point in the history
  • Loading branch information
freehere107 committed Feb 28, 2024
1 parent c489233 commit a914e5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func EncodeWithOpt(typeString string, data interface{}, opt *ScaleDecoderOption)
}
out := value.MethodByName("Encode").Call([]reflect.Value{val})
if len(out) > 0 {
return out[0].String()
return strings.ToLower(out[0].String())
}
return ""
}
Expand Down
5 changes: 5 additions & 0 deletions types/scaleInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ func (s *ScaleInfo) expandComposite(id int, SiTyp SiType, id2Portable map[int]Si
}

if len(SiTyp.Def.Composite.Fields) == 1 {
// Avoid accountId32 being converted to ascii
if len(SiTyp.Path) > 0 && SiTyp.Path[len(SiTyp.Path)-1] == "AccountId32" {
s.RegisteredSiType[id] = "AccountId"
return s.RegisteredSiType[id]
}
subTypeId := SiTyp.Def.Composite.Fields[0].Type
subType, ok := s.RegisteredSiType[subTypeId]
if !ok {
Expand Down

0 comments on commit a914e5c

Please sign in to comment.