package codec
import "github.com/centrifuge/go-substrate-rpc-client/v4/types/codec"
Index ¶
- func Decode(bz []byte, target interface{}) error
- func DecodeFromHex(str string, target interface{}) error
- func Encode(value interface{}) ([]byte, error)
- func EncodeToHex(value interface{}) (string, error)
- func EncodedLength(value interface{}) (int, error)
- func Eq(one, other interface{}) bool
- func Hex(value interface{}) (string, error)
- func HexDecodeString(s string) ([]byte, error)
- func HexEncodeToString(b []byte) string
- func MustHexDecodeString(str string) []byte
- type Hexer
Functions ¶
func Decode ¶
Decode decodes `bz` with the scale codec into `target`. `target` should be a pointer.
func DecodeFromHex ¶
DecodeFromHex decodes `str` with the scale codec into `target`. `target` should be a pointer.
func Encode ¶
Encode encodes `value` with the scale codec with passed EncoderOptions, returning []byte
func EncodeToHex ¶
EncodeToHex 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
func Eq ¶
func Eq(one, other interface{}) bool
Eq compares the value of the input to see if there is a match
func Hex ¶
Hex returns a hex string representation of the value (not of the encoded value)
func HexDecodeString ¶
HexDecodeString decodes bytes from a hex string. Contrary to hex.DecodeString, this function does not error if "0x" is prefixed, and adds an extra 0 if the hex string has an odd length.
func HexEncodeToString ¶
HexEncodeToString encodes bytes to a hex string. Contrary to hex.EncodeToString, this function prefixes the hex string with "0x"
func MustHexDecodeString ¶
MustHexDecodeString panics if str cannot be decoded
Types ¶
type Hexer ¶
type Hexer interface { Hex() string }
Hexer interface is implemented by any type that has a Hex() function returning a string
Source Files ¶
- Version
- v4.2.1 (latest)
- Published
- Dec 5, 2023
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 1 week ago –
Tools for package owners.