common

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 52

Documentation

Index

Constants

View Source
const TicksPerBlock = int64(1000)

Variables

This section is empty.

Functions

func SetDurationPerBlock

func SetDurationPerBlock(d time.Duration)

Types

type Address

type Address [20]byte

func HexToAddress

func HexToAddress(hex string) Address

func NewAddressFromEth

func NewAddressFromEth(a ethcommon.Address) Address

func (Address) Equals

func (a Address) Equals(a2 Address) bool

func (Address) Hex

func (a Address) Hex() string

func (Address) IsZero

func (a Address) IsZero() bool

func (Address) MarshallToBuf

func (a Address) MarshallToBuf() *AddressBuf

func (Address) ShortString

func (a Address) ShortString() string

func (Address) String

func (a Address) String() string

func (Address) ToEthAddress

func (a Address) ToEthAddress() ethcommon.Address

type AddressBuf

type AddressBuf struct {
	Value                []byte   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*AddressBuf) Descriptor

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

func (*AddressBuf) GetValue

func (m *AddressBuf) GetValue() []byte

func (*AddressBuf) ProtoMessage

func (*AddressBuf) ProtoMessage()

func (*AddressBuf) Reset

func (m *AddressBuf) Reset()

func (*AddressBuf) String

func (m *AddressBuf) String() string

func (*AddressBuf) Unmarshal

func (a *AddressBuf) Unmarshal() Address

func (*AddressBuf) XXX_DiscardUnknown

func (m *AddressBuf) XXX_DiscardUnknown()

func (*AddressBuf) XXX_Marshal

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

func (*AddressBuf) XXX_Merge

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

func (*AddressBuf) XXX_Size

func (m *AddressBuf) XXX_Size() int

func (*AddressBuf) XXX_Unmarshal

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

type BigIntegerBuf

type BigIntegerBuf struct {
	Value                []byte   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func MarshalBigInt

func MarshalBigInt(bi *big.Int) *BigIntegerBuf

func (*BigIntegerBuf) Descriptor

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

func (*BigIntegerBuf) GetValue

func (m *BigIntegerBuf) GetValue() []byte

func (*BigIntegerBuf) ProtoMessage

func (*BigIntegerBuf) ProtoMessage()

func (*BigIntegerBuf) Reset

func (m *BigIntegerBuf) Reset()

func (*BigIntegerBuf) String

func (m *BigIntegerBuf) String() string

func (*BigIntegerBuf) Unmarshal

func (buf *BigIntegerBuf) Unmarshal() *big.Int

func (*BigIntegerBuf) XXX_DiscardUnknown

func (m *BigIntegerBuf) XXX_DiscardUnknown()

func (*BigIntegerBuf) XXX_Marshal

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

func (*BigIntegerBuf) XXX_Merge

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

func (*BigIntegerBuf) XXX_Size

func (m *BigIntegerBuf) XXX_Size() int

func (*BigIntegerBuf) XXX_Unmarshal

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

type BlockId

type BlockId struct {
	Height     *TimeBlocks
	HeaderHash Hash
}

func (*BlockId) Clone

func (id *BlockId) Clone() *BlockId

func (*BlockId) Equals

func (id *BlockId) Equals(id2 *BlockId) bool

func (*BlockId) MarshalToBuf

func (id *BlockId) MarshalToBuf() *BlockIdBuf

func (*BlockId) String

func (id *BlockId) String() string

type BlockIdBuf

type BlockIdBuf struct {
	Height               *TimeBlocksBuf `protobuf:"bytes,1,opt,name=height,proto3" json:"height,omitempty"`
	HeaderHash           *HashBuf       `protobuf:"bytes,2,opt,name=headerHash,proto3" json:"headerHash,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*BlockIdBuf) Descriptor

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

func (*BlockIdBuf) GetHeaderHash

func (m *BlockIdBuf) GetHeaderHash() *HashBuf

func (*BlockIdBuf) GetHeight

func (m *BlockIdBuf) GetHeight() *TimeBlocksBuf

func (*BlockIdBuf) ProtoMessage

func (*BlockIdBuf) ProtoMessage()

func (*BlockIdBuf) Reset

func (m *BlockIdBuf) Reset()

func (*BlockIdBuf) String

func (m *BlockIdBuf) String() string

func (*BlockIdBuf) Unmarshal

func (idb *BlockIdBuf) Unmarshal() *BlockId

func (*BlockIdBuf) XXX_DiscardUnknown

func (m *BlockIdBuf) XXX_DiscardUnknown()

func (*BlockIdBuf) XXX_Marshal

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

func (*BlockIdBuf) XXX_Merge

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

func (*BlockIdBuf) XXX_Size

func (m *BlockIdBuf) XXX_Size() int

func (*BlockIdBuf) XXX_Unmarshal

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

type Hash

type Hash [32]byte

func NewHashFromEth

func NewHashFromEth(a ethcommon.Hash) Hash

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Equals

func (h Hash) Equals(h2 Hash) bool

func (Hash) MarshalToBuf

func (h Hash) MarshalToBuf() *HashBuf

func (Hash) ShortString

func (h Hash) ShortString() string

func (Hash) String

func (h Hash) String() string

func (Hash) ToEthHash

func (h Hash) ToEthHash() ethcommon.Hash

type HashBuf

type HashBuf struct {
	Value                []byte   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func MarshalSliceOfHashes

func MarshalSliceOfHashes(hs []Hash) []*HashBuf

func (*HashBuf) Descriptor

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

func (*HashBuf) GetValue

func (m *HashBuf) GetValue() []byte

func (*HashBuf) ProtoMessage

func (*HashBuf) ProtoMessage()

func (*HashBuf) Reset

func (m *HashBuf) Reset()

func (*HashBuf) String

func (m *HashBuf) String() string

func (*HashBuf) Unmarshal

func (hb *HashBuf) Unmarshal() Hash

func (*HashBuf) XXX_DiscardUnknown

func (m *HashBuf) XXX_DiscardUnknown()

func (*HashBuf) XXX_Marshal

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

func (*HashBuf) XXX_Merge

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

func (*HashBuf) XXX_Size

func (m *HashBuf) XXX_Size() int

func (*HashBuf) XXX_Unmarshal

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

type TimeBlocks

type TimeBlocks big.Int

func BlocksFromSeconds

func BlocksFromSeconds(seconds int64) *TimeBlocks

func NewTimeBlocks

func NewTimeBlocks(val *big.Int) *TimeBlocks

func NewTimeBlocksInt

func NewTimeBlocksInt(val int64) *TimeBlocks

func (*TimeBlocks) AsInt

func (tb *TimeBlocks) AsInt() *big.Int

func (*TimeBlocks) Clone

func (tb *TimeBlocks) Clone() *TimeBlocks

func (*TimeBlocks) Cmp

func (tb *TimeBlocks) Cmp(tb2 *TimeBlocks) int

func (*TimeBlocks) Duration

func (tb *TimeBlocks) Duration() time.Duration

func (*TimeBlocks) Marshal

func (tb *TimeBlocks) Marshal() *TimeBlocksBuf

func (*TimeBlocks) String

func (tb *TimeBlocks) String() string

type TimeBlocksBuf

type TimeBlocksBuf struct {
	Val                  *BigIntegerBuf `protobuf:"bytes,1,opt,name=val,proto3" json:"val,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*TimeBlocksBuf) Descriptor

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

func (*TimeBlocksBuf) GetVal

func (m *TimeBlocksBuf) GetVal() *BigIntegerBuf

func (*TimeBlocksBuf) ProtoMessage

func (*TimeBlocksBuf) ProtoMessage()

func (*TimeBlocksBuf) Reset

func (m *TimeBlocksBuf) Reset()

func (*TimeBlocksBuf) String

func (m *TimeBlocksBuf) String() string

func (*TimeBlocksBuf) Unmarshal

func (tb *TimeBlocksBuf) Unmarshal() *TimeBlocks

func (*TimeBlocksBuf) XXX_DiscardUnknown

func (m *TimeBlocksBuf) XXX_DiscardUnknown()

func (*TimeBlocksBuf) XXX_Marshal

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

func (*TimeBlocksBuf) XXX_Merge

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

func (*TimeBlocksBuf) XXX_Size

func (m *TimeBlocksBuf) XXX_Size() int

func (*TimeBlocksBuf) XXX_Unmarshal

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

type TimeTicks

type TimeTicks struct {
	Val *big.Int
}

func TicksFromBlockNum

func TicksFromBlockNum(blockNum *TimeBlocks) TimeTicks

func TicksFromSeconds

func TicksFromSeconds(seconds int64) TimeTicks

func (TimeTicks) Add

func (rt TimeTicks) Add(rt2 TimeTicks) TimeTicks

func (TimeTicks) Clone

func (rt TimeTicks) Clone() TimeTicks

func (TimeTicks) Cmp

func (rt TimeTicks) Cmp(rt2 TimeTicks) int

func (TimeTicks) Duration

func (rt TimeTicks) Duration() time.Duration

func (TimeTicks) Equals

func (rt TimeTicks) Equals(rt2 TimeTicks) bool

func (TimeTicks) MarshalToBuf

func (rt TimeTicks) MarshalToBuf() *TimeTicksBuf

func (TimeTicks) String

func (rt TimeTicks) String() string

type TimeTicksBuf

type TimeTicksBuf struct {
	Val                  *BigIntegerBuf `protobuf:"bytes,1,opt,name=val,proto3" json:"val,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*TimeTicksBuf) Descriptor

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

func (*TimeTicksBuf) GetVal

func (m *TimeTicksBuf) GetVal() *BigIntegerBuf

func (*TimeTicksBuf) ProtoMessage

func (*TimeTicksBuf) ProtoMessage()

func (*TimeTicksBuf) Reset

func (m *TimeTicksBuf) Reset()

func (*TimeTicksBuf) String

func (m *TimeTicksBuf) String() string

func (*TimeTicksBuf) Unmarshal

func (rtb *TimeTicksBuf) Unmarshal() TimeTicks

func (*TimeTicksBuf) XXX_DiscardUnknown

func (m *TimeTicksBuf) XXX_DiscardUnknown()

func (*TimeTicksBuf) XXX_Marshal

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

func (*TimeTicksBuf) XXX_Merge

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

func (*TimeTicksBuf) XXX_Size

func (m *TimeTicksBuf) XXX_Size() int

func (*TimeTicksBuf) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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