scalecodec

package module
v0.0.0-...-ff6828f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

Scale codec golang

Scale Codec written by golang, Reference from https://github.com/polkascan/py-scale-codec

Features

  • low level codec decode
  • metadata decode
  • extrinsic decode
  • LogDigest decode
  • event decode
  • custom type reg
  • reg special version type
  • low level codec encode

Installation

go get -u github.com/freehere107/go-scale-codec

Test

go test ./... --cover -v

Resources

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/freehere107/go-scale-codec

License

The package is available as open source under the terms of the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventParam

type EventParam struct {
	Type     string      `json:"type"`
	Value    interface{} `json:"value"`
	ValueRaw string      `json:"value_raw"`
}

type EventRecord

type EventRecord struct {
	scaleType.ScaleDecoder
	Metadata     *scaleType.MetadataStruct
	Phase        int                       `json:"phase"`
	ExtrinsicIdx int                       `json:"extrinsic_idx"`
	Type         string                    `json:"type"`
	Params       []EventParam              `json:"params"`
	Event        scaleType.MetadataEvents  `json:"event"`
	EventModule  scaleType.MetadataModules `json:"event_module"`
	Topic        []string                  `json:"topic"`
}

func (*EventRecord) Process

func (e *EventRecord) Process() map[string]interface{}

type EventsDecoder

type EventsDecoder struct {
	scaleType.Vec
	Metadata *scaleType.MetadataStruct
}

func (*EventsDecoder) Init

func (*EventsDecoder) Process

func (e *EventsDecoder) Process()

type ExtrinsicDecoder

type ExtrinsicDecoder struct {
	scaleType.ScaleDecoder
	ExtrinsicLength     int                       `json:"extrinsic_length"`
	ExtrinsicHash       string                    `json:"extrinsic_hash"`
	VersionInfo         string                    `json:"version_info"`
	ContainsTransaction bool                      `json:"contains_transaction"`
	Address             string                    `json:"address"`
	Signature           string                    `json:"signature"`
	SignatureVersion    int                       `json:"signature_version"`
	Nonce               int                       `json:"nonce"`
	Era                 string                    `json:"era"`
	CallIndex           string                    `json:"call_index"`
	Tip                 decimal.Decimal           `json:"tip"`
	CallModule          scaleType.MetadataModules `json:"call_module"`
	Call                scaleType.MetadataCalls   `json:"call"`
	Params              []ExtrinsicParam          `json:"params"`
	Metadata            *scaleType.MetadataStruct
}

func (*ExtrinsicDecoder) Init

func (*ExtrinsicDecoder) Process

func (e *ExtrinsicDecoder) Process()

type ExtrinsicParam

type ExtrinsicParam struct {
	Name     string      `json:"name"`
	Type     string      `json:"type"`
	Value    interface{} `json:"value"`
	ValueRaw string      `json:"value_raw"`
}

type MetadataDecoder

type MetadataDecoder struct {
	types.ScaleDecoder
	Version       string               `json:"version"`
	VersionNumber int                  `json:"version_number"`
	Metadata      types.MetadataStruct `json:"metadata"`
	CodecTypes    []string             `json:"codec_types"`
}

func (*MetadataDecoder) Init

func (m *MetadataDecoder) Init(data []byte)

func (*MetadataDecoder) Process

func (m *MetadataDecoder) Process() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL