github.com/stafiprotocol/go-substrate-rpc-client@v1.4.7/types/metadataV11.go (about)

     1  package types
     2  
     3  import "github.com/stafiprotocol/go-substrate-rpc-client/pkg/scale"
     4  
     5  // Modelled after packages/types/src/Metadata/v10/toV11.ts
     6  type MetadataV11 struct {
     7  	MetadataV10
     8  	Extrinsic ExtrinsicV11
     9  }
    10  
    11  // Modelled after packages/types/src/Metadata/v10/toV11.ts
    12  type ExtrinsicV11 struct {
    13  	Version          uint8
    14  	SignedExtensions []string
    15  }
    16  
    17  func (m *MetadataV11) Decode(decoder scale.Decoder) error {
    18  	err := decoder.Decode(&m.MetadataV10)
    19  	if err != nil {
    20  		return err
    21  	}
    22  	return decoder.Decode(&m.Extrinsic)
    23  }
    24  
    25  func (m MetadataV11) Encode(encoder scale.Encoder) error {
    26  	err := encoder.Encode(m.MetadataV10)
    27  	if err != nil {
    28  		return err
    29  	}
    30  	return encoder.Encode(m.Extrinsic)
    31  }
    32  
    33  func (e *ExtrinsicV11) Decode(decoder scale.Decoder) error {
    34  	err := decoder.Decode(&e.Version)
    35  	if err != nil {
    36  		return err
    37  	}
    38  
    39  	return decoder.Decode(&e.SignedExtensions)
    40  }
    41  
    42  func (e ExtrinsicV11) Encode(encoder scale.Encoder) error {
    43  	err := encoder.Encode(e.Version)
    44  	if err != nil {
    45  		return err
    46  	}
    47  
    48  	return encoder.Encode(e.SignedExtensions)
    49  }