scalecodec

package module
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

README

Scale Codec in Golang

Scale Codec written by golang, reference from 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/m0ssc0de/scale.go

Test

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

Resources

Contributing

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

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"`
	TypeName string      `json:"type_name"`
	Value    interface{} `json:"value"`
}

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"`
	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             interface{}      `json:"address"`
	Signature           string           `json:"signature"`
	Nonce               int              `json:"nonce"`
	Era                 string           `json:"era"`
	CallIndex           string           `json:"call_index"`
	Params              []ExtrinsicParam `json:"params"`
	Metadata            *scaleType.MetadataStruct
	SignedExtensions    []scaleType.SignedExtension `json:"signed_extensions"`
}

func (*ExtrinsicDecoder) Init

func (*ExtrinsicDecoder) Process

func (e *ExtrinsicDecoder) Process()

type ExtrinsicParam

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

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) CheckRegistry

func (m *MetadataDecoder) CheckRegistry() (notReg []string)

CheckRegistry deprecated, metadata v14 will auto register all types

func (*MetadataDecoder) Init

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

func (*MetadataDecoder) Process

func (m *MetadataDecoder) Process() error

Directories

Path Synopsis
pkg
go-ethereum/crypto/sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
crypto/ethereum/common/math
Package math provides integer math utilities.
Package math provides integer math utilities.

Jump to

Keyboard shortcuts

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