Skip to content

Commit eb28b8d

Browse files
committed
Fix [U8; 20] h160 maybe decode as utf8
1 parent c7b394c commit eb28b8d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

types/Call.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ type Call struct {
1414
func (s *Call) Process() {
1515
start := s.Data.Offset
1616
callIndex := utiles.BytesToHex(s.NextBytes(2))
17-
callModule := s.Metadata.CallIndex[callIndex]
17+
callModule, ok := s.Metadata.CallIndex[callIndex]
18+
if !ok {
19+
panic(fmt.Sprintf("Not find Extrinsic Lookup %s, please check metadata info", callIndex))
20+
}
1821
result := map[string]interface{}{
1922
"call_index": callIndex,
2023
"call_name": callModule.Call.Name,

types/scaleInfo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ func (s *ScaleInfo) expandComposite(id int, SiTyp SiType, id2Portable map[int]Si
259259
s.RegisteredSiType[id] = "AccountId"
260260
return s.RegisteredSiType[id]
261261
}
262+
if len(SiTyp.Path) > 0 && SiTyp.Path[len(SiTyp.Path)-1] == "AccountId20" {
263+
s.RegisteredSiType[id] = "H160"
264+
return s.RegisteredSiType[id]
265+
}
262266
subTypeId := SiTyp.Def.Composite.Fields[0].Type
263267
subType, ok := s.RegisteredSiType[subTypeId]
264268
if !ok {

0 commit comments

Comments
 (0)