types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeight

type BlockHeight struct {
	types.BlockHeight
}

BlockHeight overwrites the Rivine BlockHeight type, encapsulating it internally for practical reasons.

func AsBlockHeight

func AsBlockHeight(c types.BlockHeight) BlockHeight

AsBlockHeight turns a Rivine-typed BlockHeight into the BlockHeight overwritten type used in this project.

func (*BlockHeight) DecodeMsg

func (bh *BlockHeight) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (*BlockHeight) Decrease

func (bh *BlockHeight) Decrease()

Decrease this block height by 1, causing a panic in case the block height is 0 already.

func (BlockHeight) EncodeMsg

func (bh BlockHeight) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (*BlockHeight) Increase

func (bh *BlockHeight) Increase()

Increase this block height by 1

func (BlockHeight) LockValue

func (bh BlockHeight) LockValue() LockValue

LockValue returns this block height as a LockValue.

func (BlockHeight) MarshalJSON

func (bh BlockHeight) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (BlockHeight) Msgsize

func (bh BlockHeight) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BlockHeight) UnmarshalJSON

func (bh *BlockHeight) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type CoinOutputID

type CoinOutputID struct {
	types.CoinOutputID
}

CoinOutputID overwrites the Rivine CoinOutputID type, encapsulating it internally for practical reasons.

func AsCoinOutputID

func AsCoinOutputID(id types.CoinOutputID) CoinOutputID

AsCoinOutputID returns a Rivine-typed CoinOutputID into the CoinOutputID overwritten type used in this project.

func (*CoinOutputID) DecodeMsg

func (id *CoinOutputID) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (CoinOutputID) EncodeMsg

func (id CoinOutputID) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (CoinOutputID) MarshalJSON

func (id CoinOutputID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (CoinOutputID) Msgsize

func (id CoinOutputID) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CoinOutputID) UnmarshalJSON

func (id *CoinOutputID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type ConsensusChangeID

type ConsensusChangeID struct {
	modules.ConsensusChangeID
}

ConsensusChangeID overwrites the Rivine ConsensusChangeID type, encapsulating it internally for practical reasons.

func AsConsensusChangeID

func AsConsensusChangeID(id modules.ConsensusChangeID) ConsensusChangeID

AsConsensusChangeID returns a Rivine-typed ConsensusChangeID into the ConsensusChangeID overwritten type used in this project.

func (*ConsensusChangeID) DecodeMsg

func (id *ConsensusChangeID) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (ConsensusChangeID) EncodeMsg

func (id ConsensusChangeID) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (ConsensusChangeID) MarshalJSON

func (id ConsensusChangeID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (ConsensusChangeID) Msgsize

func (id ConsensusChangeID) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ConsensusChangeID) UnmarshalJSON

func (id *ConsensusChangeID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type Currency

type Currency struct {
	types.Currency
}

Currency overwrites the Rivine Currency type, encapsulating it internally for practical reasons.

func AsCurrency

func AsCurrency(c types.Currency) Currency

AsCurrency returns a Rivine-typed Currency into the Currency overwritten type used in this project.

func (*Currency) Add

func (c *Currency) Add(o Currency) Currency

Add adds two currencies together, returning this Currency instance, containing the sum of the two currencies as value.

func (*Currency) Cmp

func (c *Currency) Cmp(o Currency) int

Cmp compares two currencies, returning

-1 if this currency is less than the other
 0 if the two currencies are equal
 1 if this currency is greater than the other

func (*Currency) DecodeMsg

func (c *Currency) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (Currency) EncodeMsg

func (c Currency) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (Currency) MarshalJSON

func (c Currency) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (Currency) Msgsize

func (c Currency) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Currency) Sub

func (c *Currency) Sub(o Currency) Currency

Sub subtracts two currencies from one another, returning this Currency instance, containing the difference of the two currencies as value.

func (*Currency) UnmarshalJSON

func (c *Currency) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type LockValue

type LockValue uint64

LockValue represents a LockValue, representing either a timestamp or a block height

func (*LockValue) DecodeMsg

func (lv *LockValue) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (LockValue) EncodeMsg

func (lv LockValue) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (*LockValue) LoadString

func (lv *LockValue) LoadString(str string) error

LoadString implements StringLoader.LoadString

func (LockValue) Msgsize

func (lv LockValue) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (LockValue) String

func (lv LockValue) String() string

String implements Stringer.String

type NetworkStats

type NetworkStats struct {
	Timestamp              Timestamp   `json:"timestamp" msg:"timestamp"`
	BlockHeight            BlockHeight `json:"blockHeight" msg:"blockHeight"`
	TransactionCount       uint64      `json:"txCount" msg:"txCount"`
	ValueTransactionCount  uint64      `json:"valueTxCount" msg:"valueTxCount"`
	CointOutputCount       uint64      `json:"coinOutputCount" msg:"coinOutputCount"`
	LockedCointOutputCount uint64      `json:"lockedCoinOutputCount" msg:"lockedCoinOutputCount"`
	CointInputCount        uint64      `json:"coinInputCount" msg:"coinInputCount"`
	MinerPayoutCount       uint64      `json:"minerPayoutCount" msg:"minerPayoutCount"`
	TransactionFeeCount    uint64      `json:"txFeeCount" msg:"txFeeCount"`
	MinerPayouts           Currency    `json:"minerPayouts" msg:"minerPayouts"`
	TransactionFees        Currency    `json:"txFees" msg:"txFees"`
	Coins                  Currency    `json:"coins" msg:"coins"`
	LockedCoins            Currency    `json:"lockedCoins" msg:"lockedCoins"`
}

NetworkStats collects the global statistics for the blockchain.

func NewNetworkStats

func NewNetworkStats() NetworkStats

NewNetworkStats creates a nil (fresh) network state.

func (*NetworkStats) DecodeMsg

func (z *NetworkStats) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*NetworkStats) EncodeMsg

func (z *NetworkStats) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*NetworkStats) Msgsize

func (z *NetworkStats) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Timestamp

type Timestamp struct {
	types.Timestamp
}

Timestamp overwrites the Rivine Timestamp type, encapsulating it internally for practical reasons.

func AsTimestamp

func AsTimestamp(c types.Timestamp) Timestamp

AsTimestamp turns a Rivine-typed Timestamp into the Timestamp overwritten type used in this project.

func (*Timestamp) DecodeMsg

func (ts *Timestamp) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (Timestamp) EncodeMsg

func (ts Timestamp) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (Timestamp) LockValue

func (ts Timestamp) LockValue() LockValue

LockValue returns this Timstamp as a LockValue

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (Timestamp) Msgsize

func (ts Timestamp) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Timestamp) UnmarshalJSON

func (ts *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type UnlockHash

type UnlockHash struct {
	types.UnlockHash
}

UnlockHash overwrites the Rivine UnlockHash type, encapsulating it internally for practical reasons.

func AsUnlockHash

func AsUnlockHash(uh types.UnlockHash) UnlockHash

AsUnlockHash returns a Rivine-typed UnlockHash into the UnlockHash overwritten type used in this project.

func (*UnlockHash) DecodeMsg

func (uh *UnlockHash) DecodeMsg(r *msgp.Reader) error

DecodeMsg implements msgp.Decodable.DecodeMsg

func (UnlockHash) EncodeMsg

func (uh UnlockHash) EncodeMsg(w *msgp.Writer) error

EncodeMsg implements msgp.Encodable.EncodeMsg

func (UnlockHash) MarshalJSON

func (uh UnlockHash) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON

func (UnlockHash) Msgsize

func (uh UnlockHash) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (UnlockHash) String

func (uh UnlockHash) String() string

String implements fmt.Stringer.String

func (*UnlockHash) UnmarshalJSON

func (uh *UnlockHash) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Marshaler.UnmarshalJSON

type Wallet

type Wallet struct {
	// Balance is optional and defines the balance the wallet currently has.
	Balance WalletBalance `json:"balance,omitempty" msg:"balance,omitempty"`
	// MultiSignAddresses is optional and is only defined if the wallet is part of
	// one or multiple multisign wallets.
	MultiSignAddresses []UnlockHash `json:"multisignAddresses,omitempty" msg:"multisignAddresses,omitempty"`
	// MultiSignData is optional and is only defined if the wallet is a multisign wallet.
	MultiSignData WalletMultiSignData `json:"multisign,omitempty" msg:"multisign,omitempty"`
}

Wallet collects all data for an address in a simple format, focussing on its balance and multisign properties.

func (*Wallet) AddUniqueMultisignAddress

func (w *Wallet) AddUniqueMultisignAddress(address UnlockHash) bool

AddUniqueMultisignAddress adds the given multisign address to the wallet's list of multisign addresses which reference this wallet's address. It only adds it however if the given multisign address is not known yet.

func (*Wallet) DecodeMsg

func (z *Wallet) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Wallet) EncodeMsg

func (z *Wallet) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Wallet) Msgsize

func (z *Wallet) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type WalletBalance

type WalletBalance struct {
	Unlocked Currency            `json:"unlocked,omitemtpy" msg:"unlocked,omitemtpy"`
	Locked   WalletLockedBalance `json:"locked,omitemtpy" msg:"locked,omitemtpy"`
}

WalletBalance contains the unlocked and/or locked balance of a wallet.

func (*WalletBalance) DecodeMsg

func (z *WalletBalance) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WalletBalance) EncodeMsg

func (z *WalletBalance) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WalletBalance) IsZero

func (wb *WalletBalance) IsZero() bool

IsZero returns true if this wallet is Zero

func (*WalletBalance) Msgsize

func (z *WalletBalance) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type WalletLockedBalance

type WalletLockedBalance struct {
	Total   Currency              `json:"total" msg:"total"`
	Outputs WalletLockedOutputMap `json:"outputs" msg:"outputs"`
}

WalletLockedBalance contains the locked balance of a wallet, defining the total amount of coins as well as all the outputs that are locked.

func (*WalletLockedBalance) AddLockedCoinOutput

func (wlb *WalletLockedBalance) AddLockedCoinOutput(id CoinOutputID, co WalletLockedOutput) error

AddLockedCoinOutput adds the unique locked coin output to the wallet's map of locked outputs as well as adds the coin output's value to the total amount of locked coins registered for this wallet.

func (*WalletLockedBalance) DecodeMsg

func (z *WalletLockedBalance) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WalletLockedBalance) EncodeMsg

func (z *WalletLockedBalance) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WalletLockedBalance) Msgsize

func (z *WalletLockedBalance) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WalletLockedBalance) SubLockedCoinOutput

func (wlb *WalletLockedBalance) SubLockedCoinOutput(id CoinOutputID) error

SubLockedCoinOutput removes the unique existing locked coin output from the wallet's map of locked outputs, as well as subtract the coin output's value from the total amount of locked coins registered for this wallet.

type WalletLockedOutput

type WalletLockedOutput struct {
	Amount      Currency  `json:"amount" msg:"amount"`
	LockedUntil LockValue `json:"lockedUntil" msg:"lockedUntil"`
	Description string    `json:"description,omitemtpy" msg:"description,omitemtpy"`
}

WalletLockedOutput defines a locked output targeted at a wallet.

func (*WalletLockedOutput) DecodeMsg

func (z *WalletLockedOutput) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WalletLockedOutput) EncodeMsg

func (z *WalletLockedOutput) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WalletLockedOutput) Msgsize

func (z *WalletLockedOutput) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type WalletLockedOutputMap

type WalletLockedOutputMap map[string]WalletLockedOutput

WalletLockedOutputMap defines the mapping between a coin output ID and its walletLockedOutput data

func (*WalletLockedOutputMap) DecodeMsg

func (z *WalletLockedOutputMap) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (WalletLockedOutputMap) EncodeMsg

func (z WalletLockedOutputMap) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (WalletLockedOutputMap) Msgsize

func (z WalletLockedOutputMap) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type WalletMultiSignData

type WalletMultiSignData struct {
	Owners             []UnlockHash `json:"owners" msg:"owners"`
	SignaturesRequired uint64       `json:"signaturesRequired" msg:"signaturesRequired"`
}

WalletMultiSignData defines the extra data defined for a MultiSignWallet.

func (*WalletMultiSignData) DecodeMsg

func (z *WalletMultiSignData) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WalletMultiSignData) EncodeMsg

func (z *WalletMultiSignData) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WalletMultiSignData) Msgsize

func (z *WalletMultiSignData) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

Jump to

Keyboard shortcuts

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