postypes

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: LGPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Address     Address        `json:"address"`
	BlockNumber hexutil.Uint64 `json:"blockNumber"`
	Status      NodeLockStatus `json:"status"`
}

type Address

type Address = common.Hash

type Block

type Block struct {
	Hash          common.Hash    `json:"hash"`
	Height        hexutil.Uint64 `json:"height"`
	Epoch         hexutil.Uint64 `json:"epoch"`
	Round         hexutil.Uint64 `json:"round"`
	LastTxNumber  hexutil.Uint64 `json:"lastTxNumber"`
	Miner         *Address       `json:"miner"`
	ParentHash    common.Hash    `json:"parentHash"`
	Timestamp     hexutil.Uint64 `json:"timestamp"`
	PivotDecision *Decision      `json:"pivotDecision"`
	// Transactions  BlockTransactions `json:"transactions"`
	Signatures []Signature `json:"signatures"`
}

type BlockNumber

type BlockNumber struct {
	// contains filtered or unexported fields
}
var (
	BlockEarliest        *BlockNumber = &BlockNumber{"earliest", 0}
	BlockLatestCommitted *BlockNumber = &BlockNumber{"latest_committed", 0}
	BlockLatestVoted     *BlockNumber = &BlockNumber{"latest_voted", 0}
)

func NewBlockNumber

func NewBlockNumber(number uint64) BlockNumber

func (BlockNumber) MarshalText

func (e BlockNumber) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*BlockNumber) String

func (e *BlockNumber) String() string

String implements the fmt.Stringer interface

func (*BlockNumber) UnmarshalJSON

func (e *BlockNumber) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type CommitteeState

type CommitteeState struct {
	CurrentCommittee RpcCommittee  `json:"currentCommittee"`
	Elections        []RpcTermData `json:"elections"`
}

type ConflictSignature

type ConflictSignature struct {
	Proposal [2][]byte
	Vote     [2][]byte
}

type Decision

type Decision struct {
	BlockHash common.Hash    `json:"blockHash"`
	Height    hexutil.Uint64 `json:"height"`
}

type DisputePayload

type DisputePayload struct {
	Address          Address           `json:"address"`
	BlsPubKey        string            `json:"blsPubKey"`
	VrfPubKey        string            `json:"vrfPubKey"`
	ConflictingVotes ConflictSignature `json:"conflictingVotes"`
}

type ElectionPayload

type ElectionPayload struct {
	PublicKey    string         `json:"publicKey"`
	VrfPublicKey string         `json:"vrfPublicKey"`
	TargetTerm   hexutil.Uint64 `json:"targetTerm"`
	VrfProof     string         `json:"vrfProof"`
}

type EpochReward

type EpochReward struct {
	PowEpochHash   common.Hash `json:"powEpochHash"`
	AccountRewards []Reward    `json:"accountRewards"`
}

type NodeLockStatus

type NodeLockStatus struct {
	InQueue  []VotePowerState `json:"inQueue"`
	Locked   hexutil.Uint64   `json:"locked"`
	OutQueue []VotePowerState `json:"outQueue"`
	Unlocked hexutil.Uint64   `json:"unlocked"`

	// Equals to the summation of in_queue + locked
	AvailableVotes hexutil.Uint64  `json:"availableVotes"`
	ForceRetired   *hexutil.Uint64 `json:"forceRetired"`

	// If the staking is forfeited, the unlocked votes before forfeiting is
	// exempted.
	Forfeited hexutil.Uint64 `json:"forfeited"`
}

type NodeVotingPower

type NodeVotingPower struct {
	Address     common.Hash    `json:"address"`
	VotingPower hexutil.Uint64 `json:"votingPower"`
}

type PivotBlockDecision

type PivotBlockDecision struct {
	Height    hexutil.Uint64 `json:"height"`
	BlockHash common.Hash    `json:"blockHash"`
}

type RegisterPayload

type RegisterPayload struct {
	PublicKey    string `json:"publicKey"`
	VrfPublicKey string `json:"vrfPublicKey"`
}

type RetirePayload

type RetirePayload struct {
	NodeId Address        `json:"nodeId"`
	Votes  hexutil.Uint64 `json:"votes"`
}

type Reward

type Reward struct {
	PosAddress Address            `json:"posAddress"`
	PowAddress cfxaddress.Address `json:"powAddress"`
	Reward     hexutil.Big        `json:"reward"`
}

type RpcCommittee

type RpcCommittee struct {
	EpochNumber       hexutil.Uint64    `json:"epochNumber"`
	QuorumVotingPower hexutil.Uint64    `json:"quorumVotingPower"`
	TotalVotingPower  hexutil.Uint64    `json:"totalVotingPower"`
	Nodes             []NodeVotingPower `json:"nodes"`
}

type RpcTermData

type RpcTermData struct {
	StartBlockNumber hexutil.Uint64    `json:"startBlockNumber"`
	IsFinalized      bool              `json:"isFinalized"`
	TopElectingNodes []NodeVotingPower `json:"topElectingNodes"`
}

type Signature

type Signature struct {
	Account Address        `json:"account"`
	Votes   hexutil.Uint64 `json:"votes"`
}

type Status

type Status struct {
	LatestCommitted hexutil.Uint64  `json:"latestCommitted"`
	Epoch           hexutil.Uint64  `json:"epoch"`
	PivotDecision   Decision        `json:"pivotDecision"`
	LatestVoted     *hexutil.Uint64 `json:"latestVoted"`
	LatestTxNumber  hexutil.Uint64  `json:"latestTxNumber"`
}

type Transaction

type Transaction struct {
	Hash        common.Hash         `json:"hash"`
	From        Address             `json:"from"`
	BlockHash   *common.Hash        `json:"blockHash"`
	BlockNumber *hexutil.Uint64     `json:"blockNumber"`
	Timestamp   *hexutil.Uint64     `json:"timestamp"`
	Number      hexutil.Uint64      `json:"number"`
	Payload     *TransactionPayload `json:"payload"`
	Status      *string             `json:"status"`
	Type        string              `json:"type"`
}

func (*Transaction) UnmarshalJSON

func (b *Transaction) UnmarshalJSON(data []byte) error

type TransactionPayload

type TransactionPayload struct {
	ElectionPayload
	RetirePayload
	RegisterPayload
	UpdateVotingPowerPayload
	PivotBlockDecision
	DisputePayload
	// contains filtered or unexported fields
}

func (TransactionPayload) MarshalJSON

func (b TransactionPayload) MarshalJSON() ([]byte, error)

func (*TransactionPayload) SetTransactionType

func (t *TransactionPayload) SetTransactionType(txType string)

func (*TransactionPayload) UnmarshalJSON

func (b *TransactionPayload) UnmarshalJSON(data []byte) error

type UpdateVotingPowerPayload

type UpdateVotingPowerPayload struct {
	NodeAddress Address        `json:"nodeAddress"`
	VotingPower hexutil.Uint64 `json:"votingPower"`
}

type VotePowerState

type VotePowerState struct {
	EndBlockNumber hexutil.Uint64 `json:"endBlockNumber"`
	Power          hexutil.Uint64 `json:"power"`
}

Jump to

Keyboard shortcuts

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