resources

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMainAccount added in v1.0.0

func GetMainAccount(account sql.NullString, alias string) string

Types

type AccountPair added in v1.0.0

type AccountPair struct {
	Signer      string `json:"signer"`
	MainAccount string `json:"main_account"`
}

type AggregatedEventsList added in v1.0.0

type AggregatedEventsList struct {
	Data  CountEvents `json:"data"`
	Links *Links      `json:"links,omitempty"`
}

func PopulateAggregatedEventsList added in v1.0.0

func PopulateAggregatedEventsList(aggregatedEvents data.CountVotingEvents) *AggregatedEventsList

PopulateAggregatedEventsList from data layer.

type Block

type Block struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Attributes BlockAttrs `json:"attributes"`
}

type BlockAttrs

type BlockAttrs struct {
	Hash         string `json:"hash"`
	ParentHash   string `json:"parent_hash"`
	Miner        string `json:"miner"`
	MainAccount  string `json:"mainaccount"`
	Timestamp    int64  `json:"timestamp"`
	InTurnSigner string `json:"inturn_signer"`
	Difficulty   int64  `json:"difficulty"`
}

type BlocksList

type BlocksList struct {
	Data  []Block `json:"data"`
	Links *Links  `json:"links,omitempty"`
}

func PopulateBlocksList

func PopulateBlocksList(blocks []data.Block) *BlocksList

PopulateBlocksList from data layer.

type ByAddress added in v1.0.0

type ByAddress struct {
	Account               string                `json:"mainAccount"`
	FirstObservedApproval FirstObservedApproval `json:"firstObservedApproval"`
	LastObservedApproval  LastObservedApproval  `json:"lastObservedApproval"`
	ObservedApprovals     []ObservedApprovals   `json:"observedApprovals"`
}

type CountEvents added in v1.0.0

type CountEvents struct {
	ID         string           `json:"id"`
	Type       string           `json:"type"`
	Attributes CountEventsAttrs `json:"attributes"`
}

type CountEventsAttrs added in v1.0.0

type CountEventsAttrs struct {
	TotalCounts     map[string]uint64      `json:"total"`
	CountsByAddress []CountEventsByAddress `json:"byAddress"`
}

type CountEventsByAddress added in v1.0.0

type CountEventsByAddress struct {
	AccountAddress string            `json:"accountAddress"`
	Counts         map[string]uint64 `json:"counts"`
}

type DiffEntry added in v1.0.0

type DiffEntry struct {
	Name string        `json:"name"`
	Diff []AccountPair `json:"diff"`
}

type Event added in v1.0.0

type Event struct {
	ID         string     `json:"id"`
	Type       string     `json:"type"`
	Attributes EventAttrs `json:"attributes"`
}

type EventAttrs added in v1.0.0

type EventAttrs struct {
	AccountAddress string `json:"accountAddress"`
	VotingType     string `json:"votingType"`
	ProposalId     uint64 `json:"proposalId"`
	BlockId        uint64 `json:"blockId"`
}

type EventsList added in v1.0.0

type EventsList struct {
	Data  []Event `json:"data"`
	Links *Links  `json:"links,omitempty"`
}

func PopulateEventsList added in v1.0.0

func PopulateEventsList(events []data.VotingEvent) *EventsList

type Exclusion added in v1.0.0

type Exclusion struct {
	AccountPair
	StartBlock uint64  `json:"start_block"`
	EndBlock   *uint64 `json:"end_block"`
}

type ExclusionList added in v1.0.0

type ExclusionList struct {
	Data ExclusionListData `json:"data"`
}

func PopulateExclusionList added in v1.0.0

func PopulateExclusionList(l data.NodeExclusionList, percentage float32) ExclusionList

type ExclusionListAttributes added in v1.0.0

type ExclusionListAttributes struct {
	Status     string        `json:"status"`
	Timestamp  time.Time     `json:"timestamp"`
	Signers    []AccountPair `json:"signers"`
	Exclusions []Exclusion   `json:"exclusions"`

	ActiveRootPercentage float32 `json:"active_root_percentage,omitempty"`
}

type ExclusionListData added in v1.0.0

type ExclusionListData struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Attributes ExclusionListAttributes `json:"attributes"`
}

type FirstObservedApproval added in v1.0.0

type FirstObservedApproval struct {
	Block     uint64 `json:"block"`
	DueCycles uint64 `json:"dueCycles"`
}

type Key

type Key struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type LastObservedApproval added in v1.0.0

type LastObservedApproval struct {
	Block         uint64 `json:"block"`
	OfflineCycles uint64 `json:"offlineCycles"`
}

type LayerZeroData added in v1.0.0

type LayerZeroData struct {
	Root      []RootList      `json:"root"`
	Exclusion []ExclusionList `json:"exclusion"`
}

type LayerZeroList added in v1.0.0

type LayerZeroList struct {
	Data LayerZeroData `json:"data"`
}

func PopulateLayerZeroList added in v1.0.0

func PopulateLayerZeroList(root []RootList, exclusion []ExclusionList) LayerZeroList
type Links struct {
	Self string `json:"self"`
	Prev string `json:"prev,omitempty"`
	Next string `json:"next,omitempty"`
}

type ListDiff added in v1.0.0

type ListDiff struct {
	Data ListDiffData `json:"data"`
}

func PopulateListDiff added in v1.0.0

func PopulateListDiff(listA, listB []AccountPair, listType, listAName, listBName string) ListDiff

type ListDiffAttributes added in v1.0.0

type ListDiffAttributes struct {
	Result []DiffEntry `json:"result"`
}

type ListDiffData added in v1.0.0

type ListDiffData struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Attributes ListDiffAttributes `json:"attributes"`
}

type ObservedApprovals added in v1.0.0

type ObservedApprovals struct {
	Alias                 string                `json:"alias"`
	FirstObservedApproval FirstObservedApproval `json:"firstObservedApproval"`
	LastObservedApproval  LastObservedApproval  `json:"lastObservedApproval"`
}

type Payment

type Payment struct {
	ID         string       `json:"id"`
	Type       string       `json:"type"`
	Attributes PaymentAttrs `json:"attributes"`

	Relationships *PaymentRelationships `json:"relationships,omitempty"`
}

type PaymentAttrs

type PaymentAttrs struct {
	Sender    string `json:"sender"`
	Recipient string `json:"recipient"`
	Value     string `json:"value"`

	Token *string `json:"token"`

	Timestamp int64 `json:"timestamp"`
}

type PaymentRelationships

type PaymentRelationships struct {
	Transaction *Relationship `json:"transaction,omitempty"`
}

type PaymentsList

type PaymentsList struct {
	Data     []Payment   `json:"data"`
	Links    *Links      `json:"links,omitempty"`
	Included RelationMap `json:"included,omitempty"`
}

func PopulatePaymentsList

func PopulatePaymentsList(payments []data.Payment) *PaymentsList

PopulatePaymentsList creates a tx list response.

type RelationMap

type RelationMap map[Key]interface{}

func (RelationMap) MarshalJSON

func (m RelationMap) MarshalJSON() ([]byte, error)

type Relationship

type Relationship struct {
	Data Key `json:"data"`
}

type RootAttributes added in v1.0.0

type RootAttributes struct {
	Status    string        `json:"status"`
	Timestamp time.Time     `json:"timestamp"`
	Signers   []AccountPair `json:"signers"`
	Roots     []AccountPair `json:"roots"`

	ActiveRootPercentage float32 `json:"active_root_percentage,omitempty"`
}

type RootList added in v1.0.0

type RootList struct {
	Data RootListData `json:"data"`
}

func PopulateRootList added in v1.0.0

func PopulateRootList(l data.RootNodeList, percentage float32) RootList

type RootListData added in v1.0.0

type RootListData struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Attributes RootAttributes `json:"attributes"`
}

type RootMembershipPeriod added in v1.0.0

type RootMembershipPeriod struct {
	ID   string `json:"id"`
	Type string `json:"type"`

	Attributes RootMembershipPeriodAttrs `json:"attributes"`
}

type RootMembershipPeriodAttrs added in v1.0.0

type RootMembershipPeriodAttrs struct {
	RootAddress string `json:"rootAddress"`
	StartBlock  int64  `json:"startBlock"`
	EndBlock    int64  `json:"endBlock"`
	StartTime   int64  `json:"startTime"`
	EndTime     int64  `json:"endTime"`
}

type RootMembershipPeriodList added in v1.0.0

type RootMembershipPeriodList struct {
	Data  []RootMembershipPeriod `json:"data"`
	Links *Links                 `json:"links,omitempty"`
}

func PopulateRootMembershipPeriodList added in v1.0.0

func PopulateRootMembershipPeriodList(rootsMemberships []data.RootsMembership) *RootMembershipPeriodList

PopulateRootMembershipPeriodList from data layer.

type RootNodeApprovals added in v1.0.0

type RootNodeApprovals struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes RootNodeApprovalsAttrs `json:"attributes"`
}

type RootNodeApprovalsAttrs added in v1.0.0

type RootNodeApprovalsAttrs struct {
	FirstTransitionBlock uint64      `json:"firstTransitionBlock"`
	LastTransitionBlock  uint64      `json:"lastTransitionBlock"`
	ByAddress            []ByAddress `json:"byAddress"`
}

type RootNodeApprovalsList added in v1.0.0

type RootNodeApprovalsList struct {
	Data  RootNodeApprovals `json:"data"`
	Links *Links            `json:"links,omitempty"`
}

func PopulateRootNodeApprovalsList added in v1.0.0

func PopulateRootNodeApprovalsList(approvals data.RootNodeBreakdown) *RootNodeApprovalsList

type RootNodeBreakdown added in v1.0.0

type RootNodeBreakdown struct {
	FirstTransitionBlock uint64
	LastTransitionBlock  uint64
	ObservedApprovals    []ByAddress
}

type SummaryMetrics

type SummaryMetrics struct {
	ID   string `json:"id"`
	Type string `json:"metrics"`

	Attributes SummaryMetricsAttrs `json:"attributes"`
}

type SummaryMetricsAttrs

type SummaryMetricsAttrs struct {
	MainAccount     string                         `db:"mainaccount"`
	DueBlocks       uint64                         `db:"totaldueblocks"`
	InTurnBlocks    uint64                         `db:"totalinturnblocks"`
	OutOfTurnBlocks uint64                         `db:"totaloutofturnblocks"`
	MetricsByMiner  map[string]data.MetricsByMiner `db:"metricsbyminer"`
}

type SummaryMetricsList

type SummaryMetricsList struct {
	Data  []SummaryMetrics `json:"data"`
	Links *Links           `json:"links,omitempty"`
}

func PopulateSummaryMetricsList

func PopulateSummaryMetricsList(metrics []data.SummaryMetrics) *SummaryMetricsList

PopulateMetricsList from data layer.

type SystemContract added in v1.0.0

type SystemContract struct {
	ID   string `json:"id"`
	Type string `json:"key"`

	Attributes SystemContractAttributes `json:"attributes"`
}

func PopulateSystemContract added in v1.0.0

func PopulateSystemContract(i *data.SystemContract) SystemContract

type SystemContractAttributes added in v1.0.0

type SystemContractAttributes struct {
	Proxy          string  `json:"proxy"`
	Implementation *string `json:"implementation"`
	Key            string  `json:"key"`
}

type SystemContractList added in v1.0.0

type SystemContractList struct {
	Data  []SystemContract `json:"data"`
	Links *Links           `json:"links,omitempty"`
}

func PopulateSysContractsList added in v1.0.0

func PopulateSysContractsList(l []data.SystemContract) SystemContractList

type Transaction

type Transaction struct {
	ID         string           `json:"id"`
	Type       string           `json:"type"`
	Attributes TransactionAttrs `json:"attributes"`
}

type TransactionAttrs

type TransactionAttrs struct {
	Block     uint64  `json:"block_id"`
	Sender    string  `json:"sender"`
	Recipient *string `json:"recipient"`
	Value     string  `json:"value"`

	Nonce    uint64 `json:"nonce"`
	GasPrice string `json:"gas_price"`
	Gas      uint64 `json:"gas"`
	Input    string `json:"input"`

	Timestamp int64 `json:"timestamp"`
}

type TransactionResponse

type TransactionResponse struct {
	Data  Transaction `json:"data"`
	Links *Links      `json:"links,omitempty"`
}

func PopulateTransactionResponse

func PopulateTransactionResponse(tx *data.Transaction) *TransactionResponse

type TransactionsList

type TransactionsList struct {
	Data  []Transaction `json:"data"`
	Links *Links        `json:"links,omitempty"`
}

func PopulateTransactionsList

func PopulateTransactionsList(txs []data.Transaction) *TransactionsList

PopulateTransactionsList creates a tx list response.

type Version

type Version struct {
	VersionNumber string `json:"version"`
}

type VersionList

type VersionList struct {
	Data Version `json:"data"`
}

func PopulateVersion

func PopulateVersion(version string) *VersionList

type VotingsList

type VotingsList struct {
	Data  []interface{} `json:"data"`
	Links *Links        `json:"links,omitempty"`
}

func PopulateVotingsList

func PopulateVotingsList(votings []interface{}) *VotingsList

Jump to

Keyboard shortcuts

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