Documentation ¶
Index ¶
- func DecodeFromBytes(bz []byte, target interface{}) error
- func DecodeFromHexString(str string, target interface{}) error
- func EncodeToBytes(value interface{}) ([]byte, error)
- func EncodeToHexString(value interface{}) (string, error)
- func EncodedLength(value interface{}) (int, error)
- func Eq(one, other interface{}) bool
- func Hex(value interface{}) (string, error)
- type Bool
- type Bytes
- type Bytes1024
- type Bytes128
- type Bytes16
- type Bytes2048
- type Bytes256
- type Bytes32
- type Bytes512
- type Bytes64
- type Bytes8
- type EventMetadata
- type ExampleEnum
- type ExampleStruct
- type ExampleTuple
- type ExampleVec
- type ExampleVecAny
- type FunctionArgumentMetadata
- type FunctionMetadata
- type H160
- type H256
- type H512
- type Hash
- type Hexer
- type I16
- type I32
- type I64
- type I8
- type Metadata
- type MethodIDX
- type ModuleMetadata
- type OptionBool
- func (o *OptionBool) Decode(decoder scale.Decoder) error
- func (o OptionBool) Encode(encoder scale.Encoder) error
- func (o OptionBool) IsNone() bool
- func (o OptionBool) IsSome() bool
- func (o *OptionBool) SetNone()
- func (o *OptionBool) SetSome(value Bool)
- func (o OptionBool) Unwrap() (ok bool, value Bool)
- type OptionBytes
- func (o *OptionBytes) Decode(decoder scale.Decoder) error
- func (o OptionBytes) Encode(encoder scale.Encoder) error
- func (o OptionBytes) IsNone() bool
- func (o OptionBytes) IsSome() bool
- func (o *OptionBytes) SetNone()
- func (o *OptionBytes) SetSome(value Bytes)
- func (o OptionBytes) Unwrap() (ok bool, value Bytes)
- type OptionBytes1024
- func (o *OptionBytes1024) Decode(decoder scale.Decoder) error
- func (o OptionBytes1024) Encode(encoder scale.Encoder) error
- func (o OptionBytes1024) IsNone() bool
- func (o OptionBytes1024) IsSome() bool
- func (o *OptionBytes1024) SetNone()
- func (o *OptionBytes1024) SetSome(value Bytes1024)
- func (o OptionBytes1024) Unwrap() (ok bool, value Bytes1024)
- type OptionBytes128
- func (o *OptionBytes128) Decode(decoder scale.Decoder) error
- func (o OptionBytes128) Encode(encoder scale.Encoder) error
- func (o OptionBytes128) IsNone() bool
- func (o OptionBytes128) IsSome() bool
- func (o *OptionBytes128) SetNone()
- func (o *OptionBytes128) SetSome(value Bytes128)
- func (o OptionBytes128) Unwrap() (ok bool, value Bytes128)
- type OptionBytes16
- func (o *OptionBytes16) Decode(decoder scale.Decoder) error
- func (o OptionBytes16) Encode(encoder scale.Encoder) error
- func (o OptionBytes16) IsNone() bool
- func (o OptionBytes16) IsSome() bool
- func (o *OptionBytes16) SetNone()
- func (o *OptionBytes16) SetSome(value Bytes16)
- func (o OptionBytes16) Unwrap() (ok bool, value Bytes16)
- type OptionBytes2048
- func (o *OptionBytes2048) Decode(decoder scale.Decoder) error
- func (o OptionBytes2048) Encode(encoder scale.Encoder) error
- func (o OptionBytes2048) IsNone() bool
- func (o OptionBytes2048) IsSome() bool
- func (o *OptionBytes2048) SetNone()
- func (o *OptionBytes2048) SetSome(value Bytes2048)
- func (o OptionBytes2048) Unwrap() (ok bool, value Bytes2048)
- type OptionBytes256
- func (o *OptionBytes256) Decode(decoder scale.Decoder) error
- func (o OptionBytes256) Encode(encoder scale.Encoder) error
- func (o OptionBytes256) IsNone() bool
- func (o OptionBytes256) IsSome() bool
- func (o *OptionBytes256) SetNone()
- func (o *OptionBytes256) SetSome(value Bytes256)
- func (o OptionBytes256) Unwrap() (ok bool, value Bytes256)
- type OptionBytes32
- func (o *OptionBytes32) Decode(decoder scale.Decoder) error
- func (o OptionBytes32) Encode(encoder scale.Encoder) error
- func (o OptionBytes32) IsNone() bool
- func (o OptionBytes32) IsSome() bool
- func (o *OptionBytes32) SetNone()
- func (o *OptionBytes32) SetSome(value Bytes32)
- func (o OptionBytes32) Unwrap() (ok bool, value Bytes32)
- type OptionBytes512
- func (o *OptionBytes512) Decode(decoder scale.Decoder) error
- func (o OptionBytes512) Encode(encoder scale.Encoder) error
- func (o OptionBytes512) IsNone() bool
- func (o OptionBytes512) IsSome() bool
- func (o *OptionBytes512) SetNone()
- func (o *OptionBytes512) SetSome(value Bytes512)
- func (o OptionBytes512) Unwrap() (ok bool, value Bytes512)
- type OptionBytes64
- func (o *OptionBytes64) Decode(decoder scale.Decoder) error
- func (o OptionBytes64) Encode(encoder scale.Encoder) error
- func (o OptionBytes64) IsNone() bool
- func (o OptionBytes64) IsSome() bool
- func (o *OptionBytes64) SetNone()
- func (o *OptionBytes64) SetSome(value Bytes64)
- func (o OptionBytes64) Unwrap() (ok bool, value Bytes64)
- type OptionBytes8
- func (o *OptionBytes8) Decode(decoder scale.Decoder) error
- func (o OptionBytes8) Encode(encoder scale.Encoder) error
- func (o OptionBytes8) IsNone() bool
- func (o OptionBytes8) IsSome() bool
- func (o *OptionBytes8) SetNone()
- func (o *OptionBytes8) SetSome(value Bytes8)
- func (o OptionBytes8) Unwrap() (ok bool, value Bytes8)
- type OptionH160
- func (o *OptionH160) Decode(decoder scale.Decoder) error
- func (o OptionH160) Encode(encoder scale.Encoder) error
- func (o OptionH160) IsNone() bool
- func (o OptionH160) IsSome() bool
- func (o *OptionH160) SetNone()
- func (o *OptionH160) SetSome(value H160)
- func (o OptionH160) Unwrap() (ok bool, value H160)
- type OptionH256
- func (o *OptionH256) Decode(decoder scale.Decoder) error
- func (o OptionH256) Encode(encoder scale.Encoder) error
- func (o OptionH256) IsNone() bool
- func (o OptionH256) IsSome() bool
- func (o *OptionH256) SetNone()
- func (o *OptionH256) SetSome(value H256)
- func (o OptionH256) Unwrap() (ok bool, value H256)
- type OptionH512
- func (o *OptionH512) Decode(decoder scale.Decoder) error
- func (o OptionH512) Encode(encoder scale.Encoder) error
- func (o OptionH512) IsNone() bool
- func (o OptionH512) IsSome() bool
- func (o *OptionH512) SetNone()
- func (o *OptionH512) SetSome(value H512)
- func (o OptionH512) Unwrap() (ok bool, value H512)
- type OptionHash
- func (o *OptionHash) Decode(decoder scale.Decoder) error
- func (o OptionHash) Encode(encoder scale.Encoder) error
- func (o OptionHash) IsNone() bool
- func (o OptionHash) IsSome() bool
- func (o *OptionHash) SetNone()
- func (o *OptionHash) SetSome(value Hash)
- func (o OptionHash) Unwrap() (ok bool, value Hash)
- type OptionI16
- type OptionI32
- type OptionI64
- type OptionI8
- type OptionU16
- type OptionU32
- type OptionU64
- type OptionU8
- type RuntimeMetadataV4
- type RuntimeVersion
- type RuntimeVersionAPI
- type StorageFunctionMetadata
- type TypDoubleMap
- type TypMap
- type U16
- type U32
- type U64
- type U8
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFromBytes ¶
DecodeFromBytes decodes `bz` with the scale codec into `target`. `target` should be a pointer.
func DecodeFromHexString ¶
DecodeFromHexString decodes `str` with the scale codec into `target`. `target` should be a pointer.
func EncodeToBytes ¶
EncodeToBytes encodes `value` with the scale codec, returning []byte
func EncodeToHexString ¶
EncodeToHexString encodes `value` with the scale codec, returning a hex string (prefixed by 0x)
func EncodedLength ¶
EncodedLength returns the length of the value when encoded as a byte array
Types ¶
type Bytes1024 ¶
type Bytes1024 [1024]byte
Bytes1024 represents an 1024 byte array
func NewBytes1024 ¶
NewBytes1024 creates a new Bytes1024 type
type Bytes2048 ¶
type Bytes2048 [2048]byte
Bytes2048 represents an 2048 byte array
func NewBytes2048 ¶
NewBytes2048 creates a new Bytes2048 type
type EventMetadata ¶
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 (C) 2019 Centrifuge GmbH // // This file is part of Go Substrate RPC Client (GSRPC). // // GSRPC is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // GSRPC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. 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 FunctionMetadata ¶
type FunctionMetadata struct { Name string Args []FunctionArgumentMetadata Documentation []string }
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
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
type H512 ¶
type H512 [64]byte
H512 is a hash containing 512 bits (64 bytes), typically used for signature
type Hash ¶
type Hash H256
Hash is the default hash that is used across the system. It is just a thin wrapper around H256
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 (*I16) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of i
func (*I16) UnmarshalJSON ¶
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 (*I32) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of i
func (*I32) UnmarshalJSON ¶
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 (*I64) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of i
func (*I64) UnmarshalJSON ¶
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 (*I8) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of i
func (*I8) UnmarshalJSON ¶
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
type ModuleMetadata ¶
type ModuleMetadata struct { Name string Prefix string HasStorage bool Storage []StorageFunctionMetadata HasCalls bool Calls []FunctionMetadata HasEvents bool Events []EventMetadata }
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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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 ¶
NewOptionI16 creates an OptionI16 with a value
func NewOptionI16Empty ¶
func NewOptionI16Empty() OptionI16
NewOptionI16Empty creates an OptionI16 without a value
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
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 ¶
NewOptionI32 creates an OptionI32 with a value
func NewOptionI32Empty ¶
func NewOptionI32Empty() OptionI32
NewOptionI32Empty creates an OptionI32 without a value
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
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 ¶
NewOptionI64 creates an OptionI64 with a value
func NewOptionI64Empty ¶
func NewOptionI64Empty() OptionI64
NewOptionI64Empty creates an OptionI64 without a value
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
type OptionI8 ¶
type OptionI8 struct {
// contains filtered or unexported fields
}
OptionI8 is a structure that can store a I8 or a missing value
func NewOptionI8Empty ¶
func NewOptionI8Empty() OptionI8
NewOptionI8Empty creates an OptionI8 without a value
func (OptionI8) IsNone ¶
func (o OptionI8) IsNone() bool
IsNone returns true if the value is missing
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 ¶
NewOptionU16 creates an OptionU16 with a value
func NewOptionU16Empty ¶
func NewOptionU16Empty() OptionU16
NewOptionU16Empty creates an OptionU16 without a value
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
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 ¶
NewOptionU32 creates an OptionU32 with a value
func NewOptionU32Empty ¶
func NewOptionU32Empty() OptionU32
NewOptionU32Empty creates an OptionU32 without a value
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
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 ¶
NewOptionU64 creates an OptionU64 with a value
func NewOptionU64Empty ¶
func NewOptionU64Empty() OptionU64
NewOptionU64Empty creates an OptionU64 without a value
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
type OptionU8 ¶
type OptionU8 struct {
// contains filtered or unexported fields
}
OptionU8 is a structure that can store a U8 or a missing value
func NewOptionU8Empty ¶
func NewOptionU8Empty() OptionU8
NewOptionU8Empty creates an OptionU8 without a value
func (OptionU8) IsNone ¶
func (o OptionU8) IsNone() bool
IsNone returns true if the value is missing
type RuntimeMetadataV4 ¶
type RuntimeMetadataV4 struct {
Modules []ModuleMetadata
}
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
type RuntimeVersionAPI ¶
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 }
type TypDoubleMap ¶
type U16 ¶
type U16 uint16
U16 is an unsigned 16-bit integer
func (*U16) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of u
func (*U16) UnmarshalJSON ¶
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 (*U32) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of u
func (*U32) UnmarshalJSON ¶
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 (*U64) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of u
func (*U64) UnmarshalJSON ¶
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 (*U8) MarshalJSON ¶
MarshalJSON returns a JSON encoded byte array of u
func (*U8) UnmarshalJSON ¶
UnmarshalJSON fills u with the JSON encoded byte array given by b