diff --git a/metadata_test.go b/metadata_test.go index 9752a99..7f93e83 100644 --- a/metadata_test.go +++ b/metadata_test.go @@ -49,5 +49,5 @@ func TestMetadataV15DecoderProcess(t *testing.T) { if m.Version != "MetadataV15Decoder" { t.Errorf("MetadataV15version should equal 15") } - utiles.Debug(m.Metadata) + // utiles.Debug(m.Metadata) } diff --git a/types/base.go b/types/base.go index a51ba4e..11f3611 100644 --- a/types/base.go +++ b/types/base.go @@ -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 strings.ToLower(out[0].String()) + return utiles.TrimHex(strings.ToLower(out[0].String())) } return "" } diff --git a/types/types.go b/types/types.go index be22a68..af33a31 100644 --- a/types/types.go +++ b/types/types.go @@ -182,7 +182,7 @@ type AccountId struct { } func (s *AccountId) Process() { - s.Value = xstrings.RightJustify(utiles.BytesToHex(s.NextBytes(32)), 64, "0") + s.Value = utiles.AddHex(xstrings.RightJustify(utiles.BytesToHex(s.NextBytes(32)), 64, "0")) } func (s *AccountId) Encode(value string) string { diff --git a/types/types_test.go b/types/types_test.go index 3a2fefc..e3d038c 100644 --- a/types/types_test.go +++ b/types/types_test.go @@ -317,7 +317,7 @@ func TestEncode(t *testing.T) { assert.Equal(t, "070736c8230a", Encode("compact", decimal.New(43549996551, 0))) assert.Equal(t, "87d61200000000000000000000000000", Encode("U128", decimal.NewFromInt32(1234567))) assert.Equal(t, "47a952404f2b1568e6881efeb58c8918", Encode("U128", decimal.RequireFromString("32615670524745285411807346420584982855"))) - assert.Equal(t, "0x9a5b8a1b7bca89cdb3931d8ee71aa468081d971c", Encode("H160", "0x9a5b8a1B7Bca89CDB3931D8eE71AA468081D971c")) + assert.Equal(t, "9a5b8a1b7bca89cdb3931d8ee71aa468081d971c", Encode("H160", "0x9a5b8a1B7Bca89CDB3931D8eE71AA468081D971c")) } func TestSubstrateFixedU64(t *testing.T) {