types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeFromBytes

func DecodeFromBytes(bz []byte, target interface{}) error

DecodeFromBytes decodes `bz` with the scale codec into `target`. `target` should be a pointer.

func DecodeFromHexString

func DecodeFromHexString(str string, target interface{}) error

DecodeFromHexString decodes `str` with the scale codec into `target`. `target` should be a pointer.

func EncodeToBytes

func EncodeToBytes(value interface{}) ([]byte, error)

EncodeToBytes encodes `value` with the scale codec, returning []byte

func EncodeToHexString

func EncodeToHexString(value interface{}) (string, error)

EncodeToHexString encodes `value` with the scale codec, returning a hex string (prefixed by 0x)

func EncodedLength

func EncodedLength(value interface{}) (int, error)

EncodedLength returns the length of the value when encoded as a byte array

func Eq

func Eq(one, other interface{}) bool

Eq compares the value of the input to see if there is a match

func Hex

func Hex(value interface{}) (string, error)

Hex returns a hex string representation of the value (not of the encoded value)

Types

type Bool

type Bool bool

Bool represents boolean values

func NewBool

func NewBool(b bool) Bool

NewBool creates a new Bool

type Bytes

type Bytes []byte

Bytes represents byte slices

func NewBytes

func NewBytes(b []byte) Bytes

NewBytes creates a new Bytes type

type Bytes1024

type Bytes1024 [1024]byte

Bytes1024 represents an 1024 byte array

func NewBytes1024

func NewBytes1024(b [1024]byte) Bytes1024

NewBytes1024 creates a new Bytes1024 type

type Bytes128

type Bytes128 [128]byte

Bytes128 represents an 128 byte array

func NewBytes128

func NewBytes128(b [128]byte) Bytes128

NewBytes128 creates a new Bytes128 type

type Bytes16

type Bytes16 [16]byte

Bytes16 represents an 16 byte array

func NewBytes16

func NewBytes16(b [16]byte) Bytes16

NewBytes16 creates a new Bytes16 type

type Bytes2048

type Bytes2048 [2048]byte

Bytes2048 represents an 2048 byte array

func NewBytes2048

func NewBytes2048(b [2048]byte) Bytes2048

NewBytes2048 creates a new Bytes2048 type

type Bytes256

type Bytes256 [256]byte

Bytes256 represents an 256 byte array

func NewBytes256

func NewBytes256(b [256]byte) Bytes256

NewBytes256 creates a new Bytes256 type

type Bytes32

type Bytes32 [32]byte

Bytes32 represents an 32 byte array

func NewBytes32

func NewBytes32(b [32]byte) Bytes32

NewBytes32 creates a new Bytes32 type

type Bytes512

type Bytes512 [512]byte

Bytes512 represents an 512 byte array

func NewBytes512

func NewBytes512(b [512]byte) Bytes512

NewBytes512 creates a new Bytes512 type

type Bytes64

type Bytes64 [64]byte

Bytes64 represents an 64 byte array

func NewBytes64

func NewBytes64(b [64]byte) Bytes64

NewBytes64 creates a new Bytes64 type

type Bytes8

type Bytes8 [8]byte

Bytes8 represents an 8 byte array

func NewBytes8

func NewBytes8(b [8]byte) Bytes8

NewBytes8 creates a new Bytes8 type

type EventMetadata

type EventMetadata struct {
	Name          string
	Args          []string
	Documentation []string
}

func (*EventMetadata) Decode

func (m *EventMetadata) Decode(decoder scale.Decoder) error

func (EventMetadata) Encode

func (m EventMetadata) Encode(encoder scale.Encoder) error

type ExampleEnum

type ExampleEnum struct{}

ExampleEnum - Enum types can be represented using Go's structs. The ExampleEnum type itself is not used anywhere, it's just here for documentation purposes.

Example (ApplyExtrinsic)
applyExtrinsic := PhaseEnum{
	IsApplyExtrinsic: true,
	AsApplyExtrinsic: 1234,
}

enc, err := EncodeToHexString(applyExtrinsic)
if err != nil {
	panic(err)
}

var dec PhaseEnum
err = DecodeFromHexString(enc, &dec)
if err != nil {
	panic(err)
}

fmt.Println(reflect.DeepEqual(applyExtrinsic, dec))
Output:

Example (Finalization)
finalization := PhaseEnum{
	IsFinalization: true,
}

enc, err := EncodeToHexString(finalization)
if err != nil {
	panic(err)
}

var dec PhaseEnum
err = DecodeFromHexString(enc, &dec)
if err != nil {
	panic(err)
}

fmt.Println(reflect.DeepEqual(finalization, dec))
Output:

type ExampleStruct

type ExampleStruct struct{}

ExampleStruct - Struct types (fixed-sized series of values with predetermined and fixed types, typically without names/labels/keys) can be represented using Go's structs. The ExampleStruct type itself is not used anywhere, it's just here for documentation purposes.

Example
type Animal struct {
	Name     string
	Legs     U8
	Children []string
}

dog := Animal{Name: "Bello", Legs: 2, Children: []string{"Sam"}}

encoded, err := EncodeToHexString(dog)
if err != nil {
	panic(err)
}
fmt.Println(encoded)

var decoded Animal
err = DecodeFromHexString(encoded, &decoded)
if err != nil {
	panic(err)
}
fmt.Println(decoded)
Output:

0x1442656c6c6f02040c53616d
{Bello 2 [Sam]}

type ExampleTuple

type ExampleTuple struct{}

ExampleTuple - Tuple types (fixed-sized series of values with predetermined and fixed types, typically without names/labels/keys) can be represented using Go's structs. To use tuples, just define a struct that has exported fields with the right types for each value in the tuple, and the encoding manages the rest for you. The ExampleTuple type itself is not used anywhere, it's just here for documentation purposes.

Example
// This represents a document tuple of types [uint64, hash]
type Doc struct {
	ID   U64
	Hash Hash
}

doc := Doc{12, blake2b.Sum256([]byte("My document"))}

encoded, err := EncodeToHexString(doc)
if err != nil {
	panic(err)
}
fmt.Println(encoded)

var decoded Doc
err = DecodeFromHexString(encoded, &decoded)
if err != nil {
	panic(err)
}
fmt.Println(decoded)
Output:

0x0c00000000000000809199a254aedc9d92a3157cd27bd21ceccc1e2ecee5760788663a3e523bc1a759
{12 [145 153 162 84 174 220 157 146 163 21 124 210 123 210 28 236 204 30 46 206 229 118 7 136 102 58 62 82 59 193 167 89]}

type ExampleVec

type ExampleVec struct{}

ExampleVec - Vec types (vectors, lists, series, sets, arrays, slices) can be represented using Go's native slices and arrays. The ExampleVec type itself is not used anywhere, it's just here for documentation purposes.

Example (Simple)
ingredients := []string{"salt", "sugar"}

encoded, err := EncodeToHexString(ingredients)
if err != nil {
	panic(err)
}
fmt.Println(encoded)

var decoded []string
err = DecodeFromHexString(encoded, &decoded)
if err != nil {
	panic(err)
}
fmt.Println(decoded)
Output:

0x081073616c74147375676172
[salt sugar]
Example (Struct)
type Votes struct {
	Options     [2]string
	Yay         []string
	Nay         []string
	Outstanding []string
}

votes := Votes{
	Options:     [2]string{"no deal", "muddle through"},
	Yay:         []string{"Alice"},
	Nay:         nil,
	Outstanding: []string{"Bob", "Carol"},
}

encoded, err := EncodeToBytes(votes)
if err != nil {
	panic(err)
}
var decoded Votes
err = DecodeFromBytes(encoded, &decoded)
if err != nil {
	panic(err)
}

fmt.Println(reflect.DeepEqual(votes, decoded))
Output:

true

type ExampleVecAny

type ExampleVecAny struct{}

ExampleVecAny - VecAny is used in polkadot-js as a list of elements that are of any type, while Vec and VecFixed require fixed types. Albeit Go has no dynamic types, VecAny can be implemented using arrays/slices of custom types with custom encoding. An example is provided here. The ExampleVecAny type itself is not used anywhere, it's just here for documentation purposes.

Example
// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls
//
// Copyright 2019 Centrifuge GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
	"fmt"
	"reflect"

	"github.com/centrifuge/go-substrate-rpc-client/scale"
	. "github.com/centrifuge/go-substrate-rpc-client/types"
)

// MyVal is a custom type that is used to hold arbitrarily encoded data. In this example, we encode uint8s with a 0x00
// and strings with 0x01 as the first byte.
type MyVal struct {
	Value interface{}
}

func (a *MyVal) Decode(decoder scale.Decoder) error {
	b, err := decoder.ReadOneByte()

	if err != nil {
		return err
	}

	if b == 0 {
		var u uint8
		err = decoder.Decode(&u)
		a.Value = u
	} else if b == 1 {
		var s string
		err = decoder.Decode(&s)
		a.Value = s
	}

	if err != nil {
		return err
	}

	return nil
}

func (a MyVal) Encode(encoder scale.Encoder) error {
	var err1, err2 error

	switch v := a.Value.(type) {
	case uint8:
		err1 = encoder.PushByte(0)
		err2 = encoder.Encode(v)
	case string:
		err1 = encoder.PushByte(1)
		err2 = encoder.Encode(v)
	default:
		return fmt.Errorf("unknown type %T", v)
	}

	if err1 != nil {
		return err1
	}
	if err2 != nil {
		return err2
	}

	return nil
}

func main() {
	myValSlice := []MyVal{{uint8(12)}, {"Abc"}}

	encoded, err := EncodeToBytes(myValSlice)
	if err != nil {
		panic(err)
	}
	fmt.Println(encoded)

	var decoded []MyVal
	err = DecodeFromBytes(encoded, &decoded)
	if err != nil {
		panic(err)
	}

	fmt.Println(reflect.DeepEqual(myValSlice, decoded))
}
Output:

[8 0 12 1 12 65 98 99]
true

type FunctionArgumentMetadata

type FunctionArgumentMetadata struct {
	Name string
	Type string
}

func (*FunctionArgumentMetadata) Decode

func (m *FunctionArgumentMetadata) Decode(decoder scale.Decoder) error

func (FunctionArgumentMetadata) Encode

func (m FunctionArgumentMetadata) Encode(encoder scale.Encoder) error

type FunctionMetadata

type FunctionMetadata struct {
	Name          string
	Args          []FunctionArgumentMetadata
	Documentation []string
}

func (*FunctionMetadata) Decode

func (m *FunctionMetadata) Decode(decoder scale.Decoder) error

func (FunctionMetadata) Encode

func (m FunctionMetadata) Encode(encoder scale.Encoder) error

type H160

type H160 [20]byte

H160 is a hash containing 160 bits (20 bytes), typically used in blocks, extrinsics and as a sane default

func NewH160

func NewH160(b [20]byte) H160

NewH160 creates a new H160 type

func (H160) Hex

func (h H160) Hex() string

Hex returns a hex string representation of the value (not of the encoded value)

type H256

type H256 [32]byte

H256 is a hash containing 256 bits (32 bytes), typically used in blocks, extrinsics and as a sane default

func NewH256

func NewH256(b [32]byte) H256

NewH256 creates a new H256 type

func (H256) Hex

func (h H256) Hex() string

Hex returns a hex string representation of the value (not of the encoded value)

type H512

type H512 [64]byte

H512 is a hash containing 512 bits (64 bytes), typically used for signature

func NewH512

func NewH512(b [64]byte) H512

NewH512 creates a new H512 type

func (H512) Hex

func (h H512) Hex() string

Hex returns a hex string representation of the value (not of the encoded value)

type Hash

type Hash H256

Hash is the default hash that is used across the system. It is just a thin wrapper around H256

func GetHash

func GetHash(value interface{}) (Hash, error)

GetHash returns a hash of the value

func NewHash

func NewHash(b [32]byte) Hash

NewHash creates a new Hash type

func (Hash) Hex

func (h Hash) Hex() string

Hex returns a hex string representation of the value (not of the encoded value)

type Hexer

type Hexer interface {
	Hex() string
}

Hexer interface is implemented by any type that has a Hex() function returning a string

type I16

type I16 int16

I16 is a signed 16-bit integer

func NewI16

func NewI16(i int16) I16

NewI16 creates a new 16 type

func (*I16) MarshalJSON

func (i *I16) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of i

func (*I16) UnmarshalJSON

func (i *I16) UnmarshalJSON(b []byte) error

UnmarshalJSON fills i with the JSON encoded byte array given by b

type I32

type I32 int32

I32 is a signed 32-bit integer

func NewI32

func NewI32(i int32) I32

NewI32 creates a new 32 type

func (*I32) MarshalJSON

func (i *I32) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of i

func (*I32) UnmarshalJSON

func (i *I32) UnmarshalJSON(b []byte) error

UnmarshalJSON fills i with the JSON encoded byte array given by b

type I64

type I64 int64

I64 is a signed 64-bit integer

func NewI64

func NewI64(i int64) I64

NewI64 creates a new 64 type

func (*I64) MarshalJSON

func (i *I64) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of i

func (*I64) UnmarshalJSON

func (i *I64) UnmarshalJSON(b []byte) error

UnmarshalJSON fills i with the JSON encoded byte array given by b

type I8

type I8 int8

I8 is a signed 8-bit integer

func NewI8

func NewI8(i int8) I8

NewI8 creates a new I8 type

func (*I8) MarshalJSON

func (i *I8) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of i

func (*I8) UnmarshalJSON

func (i *I8) UnmarshalJSON(b []byte) error

UnmarshalJSON fills i with the JSON encoded byte array given by b

type Metadata

type Metadata struct {
	MagicNumber uint32
	Version     uint8
	Metadata    RuntimeMetadataV4
}

func NewMetadata

func NewMetadata() *Metadata

func (*Metadata) Decode

func (m *Metadata) Decode(decoder scale.Decoder) error

func (Metadata) Encode

func (m Metadata) Encode(encoder scale.Encoder) error

type MethodIDX

type MethodIDX struct {
	SectionIndex uint8
	MethodIndex  uint8
}

MethodIDX [sectionIndex, methodIndex] 16bits

func (*MethodIDX) Decode

func (m *MethodIDX) Decode(decoder scale.Decoder) error

func (MethodIDX) Encode

func (m MethodIDX) Encode(encoder scale.Encoder) error

type ModuleMetadata

type ModuleMetadata struct {
	Name       string
	Prefix     string
	HasStorage bool
	Storage    []StorageFunctionMetadata
	HasCalls   bool
	Calls      []FunctionMetadata
	HasEvents  bool
	Events     []EventMetadata
}

func (*ModuleMetadata) Decode

func (m *ModuleMetadata) Decode(decoder scale.Decoder) error

func (ModuleMetadata) Encode

func (m ModuleMetadata) Encode(encoder scale.Encoder) error

type OptionBool

type OptionBool struct {
	// contains filtered or unexported fields
}

OptionBool is a structure that can store a Bool or a missing value Note that encoding rules are slightly different from other "option" fields This implementation was adopted from https://github.com/Joystream/parity-codec-go/blob/develop/noreflect/codec.go

func NewOptionBool

func NewOptionBool(value Bool) OptionBool

NewOptionBool creates an OptionBool with a value

func NewOptionBoolEmpty

func NewOptionBoolEmpty() OptionBool

NewOptionBoolEmpty creates an OptionBool without a value

func (*OptionBool) Decode

func (o *OptionBool) Decode(decoder scale.Decoder) error

Decode implements decoding for OptionBool as per Rust implementation

func (OptionBool) Encode

func (o OptionBool) Encode(encoder scale.Encoder) error

Encode implements encoding for OptionBool as per Rust implementation

func (OptionBool) IsNone

func (o OptionBool) IsNone() bool

IsNone returns true if the value is missing

func (OptionBool) IsSome

func (o OptionBool) IsSome() bool

IsNone returns true if a value is present

func (*OptionBool) SetNone

func (o *OptionBool) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBool) SetSome

func (o *OptionBool) SetSome(value Bool)

SetSome sets a value

func (OptionBool) Unwrap

func (o OptionBool) Unwrap() (ok bool, value Bool)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes

type OptionBytes struct {
	// contains filtered or unexported fields
}

OptionBytes is a structure that can store a Bytes or a missing value

func NewOptionBytes

func NewOptionBytes(value Bytes) OptionBytes

NewOptionBytes creates an OptionBytes with a value

func NewOptionBytesEmpty

func NewOptionBytesEmpty() OptionBytes

NewOptionBytesEmpty creates an OptionBytes without a value

func (*OptionBytes) Decode

func (o *OptionBytes) Decode(decoder scale.Decoder) error

func (OptionBytes) Encode

func (o OptionBytes) Encode(encoder scale.Encoder) error

func (OptionBytes) IsNone

func (o OptionBytes) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes) IsSome

func (o OptionBytes) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes) SetNone

func (o *OptionBytes) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes) SetSome

func (o *OptionBytes) SetSome(value Bytes)

SetSome sets a value

func (OptionBytes) Unwrap

func (o OptionBytes) Unwrap() (ok bool, value Bytes)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes1024

type OptionBytes1024 struct {
	// contains filtered or unexported fields
}

OptionBytes1024 is a structure that can store a Bytes1024 or a missing value

func NewOptionBytes1024

func NewOptionBytes1024(value Bytes1024) OptionBytes1024

NewOptionBytes1024 creates an OptionBytes1024 with a value

func NewOptionBytes1024Empty

func NewOptionBytes1024Empty() OptionBytes1024

NewOptionBytes1024Empty creates an OptionBytes1024 without a value

func (*OptionBytes1024) Decode

func (o *OptionBytes1024) Decode(decoder scale.Decoder) error

func (OptionBytes1024) Encode

func (o OptionBytes1024) Encode(encoder scale.Encoder) error

func (OptionBytes1024) IsNone

func (o OptionBytes1024) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes1024) IsSome

func (o OptionBytes1024) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes1024) SetNone

func (o *OptionBytes1024) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes1024) SetSome

func (o *OptionBytes1024) SetSome(value Bytes1024)

SetSome sets a value

func (OptionBytes1024) Unwrap

func (o OptionBytes1024) Unwrap() (ok bool, value Bytes1024)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes128

type OptionBytes128 struct {
	// contains filtered or unexported fields
}

OptionBytes128 is a structure that can store a Bytes128 or a missing value

func NewOptionBytes128

func NewOptionBytes128(value Bytes128) OptionBytes128

NewOptionBytes128 creates an OptionBytes128 with a value

func NewOptionBytes128Empty

func NewOptionBytes128Empty() OptionBytes128

NewOptionBytes128Empty creates an OptionBytes128 without a value

func (*OptionBytes128) Decode

func (o *OptionBytes128) Decode(decoder scale.Decoder) error

func (OptionBytes128) Encode

func (o OptionBytes128) Encode(encoder scale.Encoder) error

func (OptionBytes128) IsNone

func (o OptionBytes128) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes128) IsSome

func (o OptionBytes128) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes128) SetNone

func (o *OptionBytes128) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes128) SetSome

func (o *OptionBytes128) SetSome(value Bytes128)

SetSome sets a value

func (OptionBytes128) Unwrap

func (o OptionBytes128) Unwrap() (ok bool, value Bytes128)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes16

type OptionBytes16 struct {
	// contains filtered or unexported fields
}

OptionBytes16 is a structure that can store a Bytes16 or a missing value

func NewOptionBytes16

func NewOptionBytes16(value Bytes16) OptionBytes16

NewOptionBytes16 creates an OptionBytes16 with a value

func NewOptionBytes16Empty

func NewOptionBytes16Empty() OptionBytes16

NewOptionBytes16Empty creates an OptionBytes16 without a value

func (*OptionBytes16) Decode

func (o *OptionBytes16) Decode(decoder scale.Decoder) error

func (OptionBytes16) Encode

func (o OptionBytes16) Encode(encoder scale.Encoder) error

func (OptionBytes16) IsNone

func (o OptionBytes16) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes16) IsSome

func (o OptionBytes16) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes16) SetNone

func (o *OptionBytes16) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes16) SetSome

func (o *OptionBytes16) SetSome(value Bytes16)

SetSome sets a value

func (OptionBytes16) Unwrap

func (o OptionBytes16) Unwrap() (ok bool, value Bytes16)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes2048

type OptionBytes2048 struct {
	// contains filtered or unexported fields
}

OptionBytes2048 is a structure that can store a Bytes2048 or a missing value

func NewOptionBytes2048

func NewOptionBytes2048(value Bytes2048) OptionBytes2048

NewOptionBytes2048 creates an OptionBytes2048 with a value

func NewOptionBytes2048Empty

func NewOptionBytes2048Empty() OptionBytes2048

NewOptionBytes2048Empty creates an OptionBytes2048 without a value

func (*OptionBytes2048) Decode

func (o *OptionBytes2048) Decode(decoder scale.Decoder) error

func (OptionBytes2048) Encode

func (o OptionBytes2048) Encode(encoder scale.Encoder) error

func (OptionBytes2048) IsNone

func (o OptionBytes2048) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes2048) IsSome

func (o OptionBytes2048) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes2048) SetNone

func (o *OptionBytes2048) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes2048) SetSome

func (o *OptionBytes2048) SetSome(value Bytes2048)

SetSome sets a value

func (OptionBytes2048) Unwrap

func (o OptionBytes2048) Unwrap() (ok bool, value Bytes2048)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes256

type OptionBytes256 struct {
	// contains filtered or unexported fields
}

OptionBytes256 is a structure that can store a Bytes256 or a missing value

func NewOptionBytes256

func NewOptionBytes256(value Bytes256) OptionBytes256

NewOptionBytes256 creates an OptionBytes256 with a value

func NewOptionBytes256Empty

func NewOptionBytes256Empty() OptionBytes256

NewOptionBytes256Empty creates an OptionBytes256 without a value

func (*OptionBytes256) Decode

func (o *OptionBytes256) Decode(decoder scale.Decoder) error

func (OptionBytes256) Encode

func (o OptionBytes256) Encode(encoder scale.Encoder) error

func (OptionBytes256) IsNone

func (o OptionBytes256) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes256) IsSome

func (o OptionBytes256) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes256) SetNone

func (o *OptionBytes256) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes256) SetSome

func (o *OptionBytes256) SetSome(value Bytes256)

SetSome sets a value

func (OptionBytes256) Unwrap

func (o OptionBytes256) Unwrap() (ok bool, value Bytes256)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes32

type OptionBytes32 struct {
	// contains filtered or unexported fields
}

OptionBytes32 is a structure that can store a Bytes32 or a missing value

func NewOptionBytes32

func NewOptionBytes32(value Bytes32) OptionBytes32

NewOptionBytes32 creates an OptionBytes32 with a value

func NewOptionBytes32Empty

func NewOptionBytes32Empty() OptionBytes32

NewOptionBytes32Empty creates an OptionBytes32 without a value

func (*OptionBytes32) Decode

func (o *OptionBytes32) Decode(decoder scale.Decoder) error

func (OptionBytes32) Encode

func (o OptionBytes32) Encode(encoder scale.Encoder) error

func (OptionBytes32) IsNone

func (o OptionBytes32) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes32) IsSome

func (o OptionBytes32) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes32) SetNone

func (o *OptionBytes32) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes32) SetSome

func (o *OptionBytes32) SetSome(value Bytes32)

SetSome sets a value

func (OptionBytes32) Unwrap

func (o OptionBytes32) Unwrap() (ok bool, value Bytes32)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes512

type OptionBytes512 struct {
	// contains filtered or unexported fields
}

OptionBytes512 is a structure that can store a Bytes512 or a missing value

func NewOptionBytes512

func NewOptionBytes512(value Bytes512) OptionBytes512

NewOptionBytes512 creates an OptionBytes512 with a value

func NewOptionBytes512Empty

func NewOptionBytes512Empty() OptionBytes512

NewOptionBytes512Empty creates an OptionBytes512 without a value

func (*OptionBytes512) Decode

func (o *OptionBytes512) Decode(decoder scale.Decoder) error

func (OptionBytes512) Encode

func (o OptionBytes512) Encode(encoder scale.Encoder) error

func (OptionBytes512) IsNone

func (o OptionBytes512) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes512) IsSome

func (o OptionBytes512) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes512) SetNone

func (o *OptionBytes512) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes512) SetSome

func (o *OptionBytes512) SetSome(value Bytes512)

SetSome sets a value

func (OptionBytes512) Unwrap

func (o OptionBytes512) Unwrap() (ok bool, value Bytes512)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes64

type OptionBytes64 struct {
	// contains filtered or unexported fields
}

OptionBytes64 is a structure that can store a Bytes64 or a missing value

func NewOptionBytes64

func NewOptionBytes64(value Bytes64) OptionBytes64

NewOptionBytes64 creates an OptionBytes64 with a value

func NewOptionBytes64Empty

func NewOptionBytes64Empty() OptionBytes64

NewOptionBytes64Empty creates an OptionBytes64 without a value

func (*OptionBytes64) Decode

func (o *OptionBytes64) Decode(decoder scale.Decoder) error

func (OptionBytes64) Encode

func (o OptionBytes64) Encode(encoder scale.Encoder) error

func (OptionBytes64) IsNone

func (o OptionBytes64) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes64) IsSome

func (o OptionBytes64) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes64) SetNone

func (o *OptionBytes64) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes64) SetSome

func (o *OptionBytes64) SetSome(value Bytes64)

SetSome sets a value

func (OptionBytes64) Unwrap

func (o OptionBytes64) Unwrap() (ok bool, value Bytes64)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionBytes8

type OptionBytes8 struct {
	// contains filtered or unexported fields
}

OptionBytes8 is a structure that can store a Bytes8 or a missing value

func NewOptionBytes8

func NewOptionBytes8(value Bytes8) OptionBytes8

NewOptionBytes8 creates an OptionBytes8 with a value

func NewOptionBytes8Empty

func NewOptionBytes8Empty() OptionBytes8

NewOptionBytes8Empty creates an OptionBytes8 without a value

func (*OptionBytes8) Decode

func (o *OptionBytes8) Decode(decoder scale.Decoder) error

func (OptionBytes8) Encode

func (o OptionBytes8) Encode(encoder scale.Encoder) error

func (OptionBytes8) IsNone

func (o OptionBytes8) IsNone() bool

IsNone returns true if the value is missing

func (OptionBytes8) IsSome

func (o OptionBytes8) IsSome() bool

IsNone returns true if a value is present

func (*OptionBytes8) SetNone

func (o *OptionBytes8) SetNone()

SetNone removes a value and marks it as missing

func (*OptionBytes8) SetSome

func (o *OptionBytes8) SetSome(value Bytes8)

SetSome sets a value

func (OptionBytes8) Unwrap

func (o OptionBytes8) Unwrap() (ok bool, value Bytes8)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionH160

type OptionH160 struct {
	// contains filtered or unexported fields
}

OptionH160 is a structure that can store a H160 or a missing value

func NewOptionH160

func NewOptionH160(value H160) OptionH160

NewOptionH160 creates an OptionH160 with a value

func NewOptionH160Empty

func NewOptionH160Empty() OptionH160

NewOptionH160Empty creates an OptionH160 without a value

func (*OptionH160) Decode

func (o *OptionH160) Decode(decoder scale.Decoder) error

func (OptionH160) Encode

func (o OptionH160) Encode(encoder scale.Encoder) error

func (OptionH160) IsNone

func (o OptionH160) IsNone() bool

IsNone returns true if the value is missing

func (OptionH160) IsSome

func (o OptionH160) IsSome() bool

IsNone returns true if a value is present

func (*OptionH160) SetNone

func (o *OptionH160) SetNone()

SetNone removes a value and marks it as missing

func (*OptionH160) SetSome

func (o *OptionH160) SetSome(value H160)

SetSome sets a value

func (OptionH160) Unwrap

func (o OptionH160) Unwrap() (ok bool, value H160)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionH256

type OptionH256 struct {
	// contains filtered or unexported fields
}

OptionH256 is a structure that can store a H256 or a missing value

func NewOptionH256

func NewOptionH256(value H256) OptionH256

NewOptionH256 creates an OptionH256 with a value

func NewOptionH256Empty

func NewOptionH256Empty() OptionH256

NewOptionH256Empty creates an OptionH256 without a value

func (*OptionH256) Decode

func (o *OptionH256) Decode(decoder scale.Decoder) error

func (OptionH256) Encode

func (o OptionH256) Encode(encoder scale.Encoder) error

func (OptionH256) IsNone

func (o OptionH256) IsNone() bool

IsNone returns true if the value is missing

func (OptionH256) IsSome

func (o OptionH256) IsSome() bool

IsNone returns true if a value is present

func (*OptionH256) SetNone

func (o *OptionH256) SetNone()

SetNone removes a value and marks it as missing

func (*OptionH256) SetSome

func (o *OptionH256) SetSome(value H256)

SetSome sets a value

func (OptionH256) Unwrap

func (o OptionH256) Unwrap() (ok bool, value H256)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionH512

type OptionH512 struct {
	// contains filtered or unexported fields
}

OptionH512 is a structure that can store a H512 or a missing value

func NewOptionH512

func NewOptionH512(value H512) OptionH512

NewOptionH512 creates an OptionH512 with a value

func NewOptionH512Empty

func NewOptionH512Empty() OptionH512

NewOptionH512Empty creates an OptionH512 without a value

func (*OptionH512) Decode

func (o *OptionH512) Decode(decoder scale.Decoder) error

func (OptionH512) Encode

func (o OptionH512) Encode(encoder scale.Encoder) error

func (OptionH512) IsNone

func (o OptionH512) IsNone() bool

IsNone returns true if the value is missing

func (OptionH512) IsSome

func (o OptionH512) IsSome() bool

IsNone returns true if a value is present

func (*OptionH512) SetNone

func (o *OptionH512) SetNone()

SetNone removes a value and marks it as missing

func (*OptionH512) SetSome

func (o *OptionH512) SetSome(value H512)

SetSome sets a value

func (OptionH512) Unwrap

func (o OptionH512) Unwrap() (ok bool, value H512)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionHash

type OptionHash struct {
	// contains filtered or unexported fields
}

OptionHash is a structure that can store a Hash or a missing value

func NewOptionHash

func NewOptionHash(value Hash) OptionHash

NewOptionHash creates an OptionHash with a value

func NewOptionHashEmpty

func NewOptionHashEmpty() OptionHash

NewOptionHashEmpty creates an OptionHash without a value

func (*OptionHash) Decode

func (o *OptionHash) Decode(decoder scale.Decoder) error

func (OptionHash) Encode

func (o OptionHash) Encode(encoder scale.Encoder) error

func (OptionHash) IsNone

func (o OptionHash) IsNone() bool

IsNone returns true if the value is missing

func (OptionHash) IsSome

func (o OptionHash) IsSome() bool

IsNone returns true if a value is present

func (*OptionHash) SetNone

func (o *OptionHash) SetNone()

SetNone removes a value and marks it as missing

func (*OptionHash) SetSome

func (o *OptionHash) SetSome(value Hash)

SetSome sets a value

func (OptionHash) Unwrap

func (o OptionHash) Unwrap() (ok bool, value Hash)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionI16

type OptionI16 struct {
	// contains filtered or unexported fields
}

OptionI16 is a structure that can store a I16 or a missing value

func NewOptionI16

func NewOptionI16(value I16) OptionI16

NewOptionI16 creates an OptionI16 with a value

func NewOptionI16Empty

func NewOptionI16Empty() OptionI16

NewOptionI16Empty creates an OptionI16 without a value

func (*OptionI16) Decode

func (o *OptionI16) Decode(decoder scale.Decoder) error

func (OptionI16) Encode

func (o OptionI16) Encode(encoder scale.Encoder) error

func (OptionI16) IsNone

func (o OptionI16) IsNone() bool

IsNone returns true if the value is missing

func (OptionI16) IsSome

func (o OptionI16) IsSome() bool

IsNone returns true if a value is present

func (*OptionI16) SetNone

func (o *OptionI16) SetNone()

SetNone removes a value and marks it as missing

func (*OptionI16) SetSome

func (o *OptionI16) SetSome(value I16)

SetSome sets a value

func (OptionI16) Unwrap

func (o OptionI16) Unwrap() (ok bool, value I16)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionI32

type OptionI32 struct {
	// contains filtered or unexported fields
}

OptionI32 is a structure that can store a I32 or a missing value

func NewOptionI32

func NewOptionI32(value I32) OptionI32

NewOptionI32 creates an OptionI32 with a value

func NewOptionI32Empty

func NewOptionI32Empty() OptionI32

NewOptionI32Empty creates an OptionI32 without a value

func (*OptionI32) Decode

func (o *OptionI32) Decode(decoder scale.Decoder) error

func (OptionI32) Encode

func (o OptionI32) Encode(encoder scale.Encoder) error

func (OptionI32) IsNone

func (o OptionI32) IsNone() bool

IsNone returns true if the value is missing

func (OptionI32) IsSome

func (o OptionI32) IsSome() bool

IsNone returns true if a value is present

func (*OptionI32) SetNone

func (o *OptionI32) SetNone()

SetNone removes a value and marks it as missing

func (*OptionI32) SetSome

func (o *OptionI32) SetSome(value I32)

SetSome sets a value

func (OptionI32) Unwrap

func (o OptionI32) Unwrap() (ok bool, value I32)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionI64

type OptionI64 struct {
	// contains filtered or unexported fields
}

OptionI64 is a structure that can store a I64 or a missing value

func NewOptionI64

func NewOptionI64(value I64) OptionI64

NewOptionI64 creates an OptionI64 with a value

func NewOptionI64Empty

func NewOptionI64Empty() OptionI64

NewOptionI64Empty creates an OptionI64 without a value

func (*OptionI64) Decode

func (o *OptionI64) Decode(decoder scale.Decoder) error

func (OptionI64) Encode

func (o OptionI64) Encode(encoder scale.Encoder) error

func (OptionI64) IsNone

func (o OptionI64) IsNone() bool

IsNone returns true if the value is missing

func (OptionI64) IsSome

func (o OptionI64) IsSome() bool

IsNone returns true if a value is present

func (*OptionI64) SetNone

func (o *OptionI64) SetNone()

SetNone removes a value and marks it as missing

func (*OptionI64) SetSome

func (o *OptionI64) SetSome(value I64)

SetSome sets a value

func (OptionI64) Unwrap

func (o OptionI64) Unwrap() (ok bool, value I64)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionI8

type OptionI8 struct {
	// contains filtered or unexported fields
}

OptionI8 is a structure that can store a I8 or a missing value

func NewOptionI8

func NewOptionI8(value I8) OptionI8

NewOptionI8 creates an OptionI8 with a value

func NewOptionI8Empty

func NewOptionI8Empty() OptionI8

NewOptionI8Empty creates an OptionI8 without a value

func (*OptionI8) Decode

func (o *OptionI8) Decode(decoder scale.Decoder) error

func (OptionI8) Encode

func (o OptionI8) Encode(encoder scale.Encoder) error

func (OptionI8) IsNone

func (o OptionI8) IsNone() bool

IsNone returns true if the value is missing

func (OptionI8) IsSome

func (o OptionI8) IsSome() bool

IsNone returns true if a value is present

func (*OptionI8) SetNone

func (o *OptionI8) SetNone()

SetNone removes a value and marks it as missing

func (*OptionI8) SetSome

func (o *OptionI8) SetSome(value I8)

SetSome sets a value

func (OptionI8) Unwrap

func (o OptionI8) Unwrap() (ok bool, value I8)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionU16

type OptionU16 struct {
	// contains filtered or unexported fields
}

OptionU16 is a structure that can store a U16 or a missing value

func NewOptionU16

func NewOptionU16(value U16) OptionU16

NewOptionU16 creates an OptionU16 with a value

func NewOptionU16Empty

func NewOptionU16Empty() OptionU16

NewOptionU16Empty creates an OptionU16 without a value

func (*OptionU16) Decode

func (o *OptionU16) Decode(decoder scale.Decoder) error

func (OptionU16) Encode

func (o OptionU16) Encode(encoder scale.Encoder) error

func (OptionU16) IsNone

func (o OptionU16) IsNone() bool

IsNone returns true if the value is missing

func (OptionU16) IsSome

func (o OptionU16) IsSome() bool

IsNone returns true if a value is present

func (*OptionU16) SetNone

func (o *OptionU16) SetNone()

SetNone removes a value and marks it as missing

func (*OptionU16) SetSome

func (o *OptionU16) SetSome(value U16)

SetSome sets a value

func (OptionU16) Unwrap

func (o OptionU16) Unwrap() (ok bool, value U16)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionU32

type OptionU32 struct {
	// contains filtered or unexported fields
}

OptionU32 is a structure that can store a U32 or a missing value

func NewOptionU32

func NewOptionU32(value U32) OptionU32

NewOptionU32 creates an OptionU32 with a value

func NewOptionU32Empty

func NewOptionU32Empty() OptionU32

NewOptionU32Empty creates an OptionU32 without a value

func (*OptionU32) Decode

func (o *OptionU32) Decode(decoder scale.Decoder) error

func (OptionU32) Encode

func (o OptionU32) Encode(encoder scale.Encoder) error

func (OptionU32) IsNone

func (o OptionU32) IsNone() bool

IsNone returns true if the value is missing

func (OptionU32) IsSome

func (o OptionU32) IsSome() bool

IsNone returns true if a value is present

func (*OptionU32) SetNone

func (o *OptionU32) SetNone()

SetNone removes a value and marks it as missing

func (*OptionU32) SetSome

func (o *OptionU32) SetSome(value U32)

SetSome sets a value

func (OptionU32) Unwrap

func (o OptionU32) Unwrap() (ok bool, value U32)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionU64

type OptionU64 struct {
	// contains filtered or unexported fields
}

OptionU64 is a structure that can store a U64 or a missing value

func NewOptionU64

func NewOptionU64(value U64) OptionU64

NewOptionU64 creates an OptionU64 with a value

func NewOptionU64Empty

func NewOptionU64Empty() OptionU64

NewOptionU64Empty creates an OptionU64 without a value

func (*OptionU64) Decode

func (o *OptionU64) Decode(decoder scale.Decoder) error

func (OptionU64) Encode

func (o OptionU64) Encode(encoder scale.Encoder) error

func (OptionU64) IsNone

func (o OptionU64) IsNone() bool

IsNone returns true if the value is missing

func (OptionU64) IsSome

func (o OptionU64) IsSome() bool

IsNone returns true if a value is present

func (*OptionU64) SetNone

func (o *OptionU64) SetNone()

SetNone removes a value and marks it as missing

func (*OptionU64) SetSome

func (o *OptionU64) SetSome(value U64)

SetSome sets a value

func (OptionU64) Unwrap

func (o OptionU64) Unwrap() (ok bool, value U64)

Unwrap returns a flag that indicates whether a value is present and the stored value

type OptionU8

type OptionU8 struct {
	// contains filtered or unexported fields
}

OptionU8 is a structure that can store a U8 or a missing value

func NewOptionU8

func NewOptionU8(value U8) OptionU8

NewOptionU8 creates an OptionU8 with a value

func NewOptionU8Empty

func NewOptionU8Empty() OptionU8

NewOptionU8Empty creates an OptionU8 without a value

func (*OptionU8) Decode

func (o *OptionU8) Decode(decoder scale.Decoder) error

func (OptionU8) Encode

func (o OptionU8) Encode(encoder scale.Encoder) error

func (OptionU8) IsNone

func (o OptionU8) IsNone() bool

IsNone returns true if the value is missing

func (OptionU8) IsSome

func (o OptionU8) IsSome() bool

IsNone returns true if a value is present

func (*OptionU8) SetNone

func (o *OptionU8) SetNone()

SetNone removes a value and marks it as missing

func (*OptionU8) SetSome

func (o *OptionU8) SetSome(value U8)

SetSome sets a value

func (OptionU8) Unwrap

func (o OptionU8) Unwrap() (ok bool, value U8)

Unwrap returns a flag that indicates whether a value is present and the stored value

type RuntimeMetadataV4

type RuntimeMetadataV4 struct {
	Modules []ModuleMetadata
}

func (*RuntimeMetadataV4) Decode

func (m *RuntimeMetadataV4) Decode(decoder scale.Decoder) error

func (RuntimeMetadataV4) Encode

func (m RuntimeMetadataV4) Encode(encoder scale.Encoder) error

func (*RuntimeMetadataV4) MethodIndex

func (m *RuntimeMetadataV4) MethodIndex(method string) MethodIDX

type RuntimeVersion

type RuntimeVersion struct {
	APIs             []RuntimeVersionAPI `json:"apis"`
	AuthoringVersion U32                 `json:"authoringVersion"`
	ImplName         string              `json:"implName"`
	ImplVersion      U32                 `json:"implVersion"`
	SpecName         string              `json:"specName"`
	SpecVersion      U32                 `json:"specVersion"`
}

func NewRuntimeVersion

func NewRuntimeVersion() *RuntimeVersion

func (*RuntimeVersion) Decode

func (r *RuntimeVersion) Decode(decoder scale.Decoder) error

func (RuntimeVersion) Encode

func (r RuntimeVersion) Encode(encoder scale.Encoder) error

type RuntimeVersionAPI

type RuntimeVersionAPI struct {
	APIID   string
	Version U32
}

func (*RuntimeVersionAPI) Decode

func (r *RuntimeVersionAPI) Decode(decoder scale.Decoder) error

func (RuntimeVersionAPI) Encode

func (r RuntimeVersionAPI) Encode(encoder scale.Encoder) error

func (*RuntimeVersionAPI) MarshalJSON

func (r *RuntimeVersionAPI) MarshalJSON() ([]byte, error)

func (*RuntimeVersionAPI) UnmarshalJSON

func (r *RuntimeVersionAPI) UnmarshalJSON(b []byte) error

type StorageFunctionMetadata

type StorageFunctionMetadata struct {
	Name          string
	Modifier      uint8
	Type          uint8
	Plane         string
	Map           TypMap
	DMap          TypDoubleMap
	Fallback      []byte
	Documentation []string
}

func (*StorageFunctionMetadata) Decode

func (s *StorageFunctionMetadata) Decode(decoder scale.Decoder) error

func (StorageFunctionMetadata) Encode

func (s StorageFunctionMetadata) Encode(encoder scale.Encoder) error

type TypDoubleMap

type TypDoubleMap struct {
	Hasher     uint8
	Key        string
	Key2       string
	Value      string
	Key2Hasher string
}

func (*TypDoubleMap) Decode

func (m *TypDoubleMap) Decode(decoder scale.Decoder) error

func (TypDoubleMap) Encode

func (m TypDoubleMap) Encode(encoder scale.Encoder) error

type TypMap

type TypMap struct {
	Hasher   uint8
	Key      string
	Value    string
	IsLinked bool
}

func (*TypMap) Decode

func (m *TypMap) Decode(decoder scale.Decoder) error

func (TypMap) Encode

func (m TypMap) Encode(encoder scale.Encoder) error

type U16

type U16 uint16

U16 is an unsigned 16-bit integer

func NewU16

func NewU16(u uint16) U16

NewU16 creates a new U16 type

func (*U16) MarshalJSON

func (u *U16) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of u

func (*U16) UnmarshalJSON

func (u *U16) UnmarshalJSON(b []byte) error

UnmarshalJSON fills u with the JSON encoded byte array given by b

type U32

type U32 uint32

U32 is an unsigned 32-bit integer

func NewU32

func NewU32(u uint32) U32

NewU32 creates a new U32 type

func (*U32) MarshalJSON

func (u *U32) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of u

func (*U32) UnmarshalJSON

func (u *U32) UnmarshalJSON(b []byte) error

UnmarshalJSON fills u with the JSON encoded byte array given by b

type U64

type U64 uint64

U64 is an unsigned 64-bit integer

func NewU64

func NewU64(u uint64) U64

NewU64 creates a new U64 type

func (*U64) MarshalJSON

func (u *U64) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of u

func (*U64) UnmarshalJSON

func (u *U64) UnmarshalJSON(b []byte) error

UnmarshalJSON fills u with the JSON encoded byte array given by b

type U8

type U8 uint8

U8 is an unsigned 8-bit integer

func NewU8

func NewU8(u uint8) U8

NewU8 creates a new U8 type

func (*U8) MarshalJSON

func (u *U8) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoded byte array of u

func (*U8) UnmarshalJSON

func (u *U8) UnmarshalJSON(b []byte) error

UnmarshalJSON fills u with the JSON encoded byte array given by b

Jump to

Keyboard shortcuts

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