helpers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

We will refactor it later! But we support now sdk.Int as u128 for Libra u128. It's allows us to use balances from cosmos!

Index

Constants

View Source
const (
	EthAddressLength = 20
)

Variables

This section is empty.

Functions

func BigToBytes

func BigToBytes(val sdk.Int, bytesLen int) []byte

Convert sdk.Int to bytes with little endian (required by Libra).

func IsEthereumAddress

func IsEthereumAddress(address string) bool

Check if it's ethereum address.

func LeToBig

func LeToBig(bytes []byte) sdk.Int

Convert little endian bytes to big endian bytes and then to sdk.Int.

func Marshal

func Marshal(v interface{}) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Types

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) error

func (*Decoder) EOF

func (d *Decoder) EOF() bool

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

type EnumTypeUser

type EnumTypeUser interface {
	// EnumTypes return the ingredients used for all enum types in the struct.
	EnumTypes() []EnumVariant
}

EnumTypeUser is an interface of struct with enum type definition. Struct with enum type should implement this interface.

type EnumVariant

type EnumVariant struct {
	// Name of the enum type. Different variants of a same enum type should have same name.
	// This name should match the name defined in the struct field tag.
	Name string

	// Value is the numeric value of the enum variant. Should be unique within the same enum type.
	Value int32

	// Template object for the enum variant. Should be the zero value of the variant type.
	//
	// Example values: (*SomeStruct)(nil), MyUint32(0).
	Template interface{}
}

EnumVariant is a definition of a variant of enum type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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