balance

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthBalance        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBalance          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBalance = fmt.Errorf("proto: unexpected end of group")
)

Functions

func NativeToWei added in v0.29.0

func NativeToWei(n uint64) *big.Int

func WeiToNative added in v0.29.0

func WeiToNative(x *big.Int) *big.Int

Types

type Balance

type Balance struct {
	Type             Type   `protobuf:"varint,1,opt,name=Type,proto3,casttype=Type" json:"Type,omitempty"`
	Amount           uint64 `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"`
	XXX_unrecognized []byte `json:"-"`
}

func Native

func Native(native uint64) Balance

func Power

func Power(power uint64) Balance

func (*Balance) Descriptor

func (*Balance) Descriptor() ([]byte, []int)

func (*Balance) GetAmount

func (m *Balance) GetAmount() uint64

func (*Balance) GetType

func (m *Balance) GetType() Type

func (*Balance) Marshal

func (m *Balance) Marshal() (dAtA []byte, err error)

func (*Balance) MarshalTo

func (m *Balance) MarshalTo(dAtA []byte) (int, error)

func (*Balance) MarshalToSizedBuffer added in v0.30.0

func (m *Balance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Balance) ProtoMessage

func (*Balance) ProtoMessage()

func (*Balance) Reset

func (m *Balance) Reset()

func (*Balance) Size

func (m *Balance) Size() (n int)

func (Balance) String

func (b Balance) String() string

func (*Balance) Unmarshal

func (m *Balance) Unmarshal(dAtA []byte) error

func (*Balance) XXX_DiscardUnknown added in v0.23.0

func (m *Balance) XXX_DiscardUnknown()

func (*Balance) XXX_Marshal added in v0.23.0

func (m *Balance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Balance) XXX_Merge added in v0.23.0

func (m *Balance) XXX_Merge(src proto.Message)

func (*Balance) XXX_MessageName

func (*Balance) XXX_MessageName() string

func (*Balance) XXX_Size added in v0.23.0

func (m *Balance) XXX_Size() int

func (*Balance) XXX_Unmarshal added in v0.23.0

func (m *Balance) XXX_Unmarshal(b []byte) error

type Balances

type Balances []Balance

func New

func New() Balances

func Sum

func Sum(bss ...Balances) Balances

func (Balances) Add

func (bs Balances) Add(ty Type, amount uint64) Balances

func (Balances) Get

func (bs Balances) Get(ty Type) *uint64

func (Balances) GetFallback

func (bs Balances) GetFallback(ty Type, fallback uint64) uint64

func (Balances) GetNative

func (bs Balances) GetNative(fallback uint64) uint64

func (Balances) GetPower

func (bs Balances) GetPower(fallback uint64) uint64

func (Balances) Has

func (bs Balances) Has(ty Type) bool

func (Balances) HasNative

func (bs Balances) HasNative() bool

func (Balances) HasPower

func (bs Balances) HasPower() bool

func (Balances) Len

func (bs Balances) Len() int

func (Balances) Less

func (bs Balances) Less(i, j int) bool

func (Balances) Native

func (bs Balances) Native(amount uint64) Balances

func (Balances) Power

func (bs Balances) Power(amount uint64) Balances

func (Balances) Sort

func (bs Balances) Sort() Balances

func (Balances) Sum

func (bs Balances) Sum(bss ...Balances) Balances

func (Balances) Swap

func (bs Balances) Swap(i, j int)

type Type

type Type uint32
const (
	TypeNative Type = 1
	TypePower  Type = 2
)

func TypeFromString

func TypeFromString(name string) Type

func (Type) Marshal

func (typ Type) Marshal() ([]byte, error)

Protobuf support

func (Type) MarshalText

func (typ Type) MarshalText() ([]byte, error)

func (Type) String

func (typ Type) String() string

func (*Type) Unmarshal

func (typ *Type) Unmarshal(data []byte) error

func (*Type) UnmarshalText

func (typ *Type) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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