diff --git a/extrinsic.go b/extrinsic.go index 30f6bd3..b113bd5 100644 --- a/extrinsic.go +++ b/extrinsic.go @@ -231,7 +231,9 @@ func (g *GenericExtrinsic) Encode(opt *scaleType.ScaleDecoderOption) (string, er data = data + scaleType.Encode("ExtrinsicSignature", g.SignatureRaw) // signature data = data + scaleType.Encode("EraExtrinsic", g.Era) // era data = data + scaleType.Encode("Compact", g.Nonce) // nonce - data = data + scaleType.Encode("Compact", g.Tip) // tip + if len(opt.Metadata.Extrinsic.SignedIdentifier) > 0 && utiles.SliceIndex("ChargeTransactionPayment", opt.Metadata.Extrinsic.SignedIdentifier) > -1 { + data = data + scaleType.Encode("Compact", g.Tip) // tip + } for identifier, extension := range g.SignedExtensions { for _, ext := range opt.Metadata.Extrinsic.SignedExtensions { if ext.Identifier == identifier { diff --git a/types/types_test.go b/types/types_test.go index bad9d4f..871b7c0 100644 --- a/types/types_test.go +++ b/types/types_test.go @@ -87,7 +87,7 @@ func Test_ComplexEnum(t *testing.T) { TypeMapping: [][]string{{"a", "[[\"col1\", \"u32\"], [\"col2\", \"u32\"]]"}}, }, }) - assert.EqualValues(t, "0100000002000000", Encode("CustomEnum", map[string]interface{}{"a": map[string]interface{}{"col1": 1, "col2": 2}})) + assert.EqualValues(t, "000100000002000000", Encode("CustomEnum", map[string]interface{}{"a": map[string]interface{}{"col1": 1, "col2": 2}})) }