structs

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Layout = time.RFC3339

Variables

View Source
var (
	ErrNotAllowedMethod = errors.New("method not allowed")
	ErrMissingParameter = errors.New("missing parameter")
	ErrNotFound         = errors.New("record not found")
)
View Source
var (
	NodeStatusTypes = map[string]NodeStatus{
		"Active":         NodeStatusActive,
		"Leaving":        NodeStatusLeaving,
		"Left":           NodeStatusLeft,
		"In_Maintenance": NodeStatusInMaintenance,
		"Unknown":        NodeStatusUnknown,
	}
)
View Source
var (
	SysEvtTypes = map[SysEvtType]string{
		SysEvtTypeNewDelegation:         "new_delegation",
		SysEvtTypeDelegationAccepted:    "delegation_accepted",
		SysEvtTypeDelegationRejected:    "delegation_rejected",
		SysEvtTypeUndeledationRequested: "undelegation_requested",
		SysEvtTypeJoinedActiveSet:       "joined_active_set",
		SysEvtTypeLeftActiveSet:         "left_active_set",
		SysEvtTypeMDRChanged:            "mdr_change",
		SysEvtTypeFeeChanged:            "fee_change",
		SysEvtTypeSlashed:               "slashed",
		SysEvtTypeForgiven:              "forgiven",
	}
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        uuid.UUID      `json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	Address   common.Address `json:"address"`
	Type      AccountType    `json:"type"`
}

type AccountParams

type AccountParams struct {
	Type    string
	Address string

	Limit  uint64
	Offset uint64
}

type AccountType

type AccountType string
const (
	AccountTypeDefault   AccountType = "default"
	AccountTypeDelegator AccountType = "delegator"
	AccountTypeValidator AccountType = "validator"
)

type ContractEvent

type ContractEvent struct {
	ID              uuid.UUID              `json:"id"`
	ContractName    string                 `json:"contract_name"`
	EventName       string                 `json:"event_name"`
	ContractAddress common.Address         `json:"contract_address"`
	BlockHeight     uint64                 `json:"block_height"`
	Time            time.Time              `json:"time"`
	TransactionHash common.Hash            `json:"transaction_hash"`
	Removed         bool                   `json:"removed"`
	Params          map[string]interface{} `json:"params"`
	BoundType       string                 `json:"bound_type"`
	BoundID         []big.Int              `json:"bound_id"`
	BoundAddress    []common.Address       `json:"bound_address"`
}

type Delegation

type Delegation struct {
	ID               uuid.UUID       `json:"id"`
	CreatedAt        time.Time       `json:"created_at"`
	DelegationID     *big.Int        `json:"delegation_id"`
	Holder           common.Address  `json:"holder"`
	ValidatorID      *big.Int        `json:"validatorId"`
	BlockHeight      uint64          `json:"block_height"`
	TransactionHash  common.Hash     `json:"transaction_hash"`
	Amount           *big.Int        `json:"amount"`
	DelegationPeriod *big.Int        `json:"delegationPeriod"`
	Created          time.Time       `json:"created"`
	Started          *big.Int        `json:"started"`
	Finished         *big.Int        `json:"finished"`
	Info             string          `json:"info"`
	State            DelegationState `json:"state"`

	// JOIN
	ValidatorName string `json:"validator_name"`
}

type DelegationParams

type DelegationParams struct {
	ValidatorID  string
	DelegationID string
	Holder       string
	State        []DelegationState
	TimeAt       time.Time

	TimeFrom time.Time
	TimeTo   time.Time

	Limit  uint64
	Offset uint64
}

type DelegationState

type DelegationState uint
const (
	DelegationStatePROPOSED DelegationState = iota
	DelegationStateACCEPTED
	DelegationStateCANCELED
	DelegationStateREJECTED
	DelegationStateDELEGATED
	DelegationStateUNDELEGATION_REQUESTED
	DelegationStateCOMPLETED

	DelegationStateUNKNOWN DelegationState = 666
)

func DelegationStateFromString added in v0.0.4

func DelegationStateFromString(s string) DelegationState

func (DelegationState) String

func (k DelegationState) String() string

type DelegationSummary added in v0.0.4

type DelegationSummary struct {
	Count  *big.Int        `json:"count"`
	Amount *big.Int        `json:"amount"`
	State  DelegationState `json:"state"`
}

type EventParams

type EventParams struct {
	Id       uint64
	Type     string
	TimeFrom time.Time
	TimeTo   time.Time

	Limit  uint64
	Offset uint64
}

type Node

type Node struct {
	ID             string         `json:"id"`
	CreatedAt      time.Time      `json:"created_at"`
	NodeID         *big.Int       `json:"node_id"`
	Address        common.Address `json:"address"`
	Name           string         `json:"name"`
	IP             net.IP         `json:"ip"`
	PublicIP       net.IP         `json:"public_ip"`
	Port           uint16         `json:"port"`
	StartBlock     *big.Int       `json:"start_block"`
	NextRewardDate time.Time      `json:"next_reward_date"`
	LastRewardDate time.Time      `json:"last_reward_date"`
	FinishTime     *big.Int       `json:"finish_time"`
	Status         NodeStatus     `json:"node_status"`
	ValidatorID    *big.Int       `json:"validator_id"`
	BlockHeight    uint64         `json:"block_height"`
}

type NodeParams

type NodeParams struct {
	NodeID      string
	ValidatorID string
	Status      string
	Address     string

	Limit  uint64
	Offset uint64
}

type NodeStatus

type NodeStatus uint
const (
	NodeStatusActive NodeStatus = iota
	NodeStatusLeaving
	NodeStatusLeft
	NodeStatusInMaintenance
	NodeStatusUnknown NodeStatus = 999
)

func GetTypeForNode

func GetTypeForNode(s string) (NodeStatus, bool)

func (NodeStatus) String

func (k NodeStatus) String() string

type StatisticTypeVS

type StatisticTypeVS uint
const (
	ValidatorStatisticsTypeTotalStake StatisticTypeVS = iota + 1
	ValidatorStatisticsTypeActiveNodes
	ValidatorStatisticsTypeLinkedNodes
	ValidatorStatisticsTypeMDR
	ValidatorStatisticsTypeFee
	ValidatorStatisticsTypeAuthorized
	ValidatorStatisticsTypeValidatorAddress
	ValidatorStatisticsTypeRequestedAddress
)

func GetTypeForValidatorStatistics

func GetTypeForValidatorStatistics(s string) (StatisticTypeVS, bool)

func (StatisticTypeVS) String

func (k StatisticTypeVS) String() string

type SysEvtType

type SysEvtType uint64
const (
	SysEvtTypeNewDelegation SysEvtType = iota + 1
	SysEvtTypeDelegationAccepted
	SysEvtTypeDelegationRejected
	SysEvtTypeUndeledationRequested
	SysEvtTypeJoinedActiveSet
	SysEvtTypeLeftActiveSet
	SysEvtTypeSlashed
	SysEvtTypeForgiven
	SysEvtTypeMDRChanged
	SysEvtTypeFeeChanged
)

type SystemEvent

type SystemEvent struct {
	ID          string         `json:"id"`
	Height      uint64         `json:"height"`
	Time        time.Time      `json:"time"`
	Kind        SysEvtType     `json:"kind"`
	SenderID    big.Int        `json:"sender_id"`
	RecipientID big.Int        `json:"recipient_id"`
	Sender      common.Address `json:"sender"`
	Recipient   common.Address `json:"recipient"`

	Before big.Int   `json:"before"`
	After  big.Int   `json:"after"`
	Change big.Float `json:"change"`
}

type SystemEventParams

type SystemEventParams struct {
	ID          string
	After       uint64
	Kind        string
	Address     string
	ValidatorID string
	SenderID    uint64
	ReceiverID  uint64

	Limit  uint64
	Offset uint64
}

type ThreeState added in v0.0.4

type ThreeState uint8
const (
	StateNotSet ThreeState = iota
	StateTrue
	StateFalse
)

type Validator

type Validator struct {
	ID                      string         `json:"id"`
	CreatedAt               time.Time      `json:"created_at"`
	ValidatorID             *big.Int       `json:"validator_id"`
	Name                    string         `json:"name"`
	ValidatorAddress        common.Address `json:"validator_address"`
	RequestedAddress        common.Address `json:"requested_address"`
	Description             string         `json:"description"`
	FeeRate                 *big.Int       `json:"fee_rate"`
	RegistrationTime        time.Time      `json:"registration_time"`
	MinimumDelegationAmount *big.Int       `json:"minimum_delegation_amount"`
	AcceptNewRequests       bool           `json:"accept_new_requests"`
	Authorized              bool           `json:"authorized"`
	ActiveNodes             uint           `json:"active_nodes"`
	LinkedNodes             uint           `json:"linked_nodes"`
	Staked                  *big.Int       `json:"staked"`
	BlockHeight             uint64         `json:"block_height"`
}

type ValidatorParams

type ValidatorParams struct {
	ValidatorID    string
	OrderBy        string
	OrderDirection string
	Authorized     ThreeState
	TimeFrom       time.Time
	TimeTo         time.Time
	Address        string

	Limit  uint64
	Offset uint64
}

type ValidatorStatistics

type ValidatorStatistics struct {
	ID          string          `json:"id"`
	CreatedAt   time.Time       `json:"created_at"`
	ValidatorID *big.Int        `json:"validator_id"`
	Amount      *big.Int        `json:"amount"`
	BlockHeight uint64          `json:"block_height"`
	Time        time.Time       `json:"registration_time"`
	Type        StatisticTypeVS `json:"type"`
}

type ValidatorStatisticsParams

type ValidatorStatisticsParams struct {
	ValidatorID string
	Type        StatisticTypeVS
	BlockHeight uint64
	BlockTime   time.Time
	TimeFrom    time.Time
	TimeTo      time.Time

	Limit  uint64
	Offset uint64
}

Jump to

Keyboard shortcuts

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