indexertypes

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON added in v1.9.0

func DecodeJSON[T any](s string) T

func DecodeProtoJSON added in v1.9.0

func DecodeProtoJSON[T proto.Message](newT T, s string) T

func EncodeJSON added in v1.9.0

func EncodeJSON(v any) string

func EncodeProtoJSON added in v1.9.0

func EncodeProtoJSON(v proto.Message) string

Types

type Account added in v1.10.0

type Account struct {
	Address types.AccountID `json:"address"`
	Balance uint64          `json:"balance"`
	Nonce   uint32          `json:"nonce"`
}

type EnvelopeMetadata

type EnvelopeMetadata struct {
	ProcessId types.HexBytes `json:"processId"`
	Nullifier types.HexBytes `json:"nullifier"`
	VoterID   types.HexBytes `json:"voterId"`
	TxIndex   int32          `json:"txIndex"`
	Height    uint32         `json:"height"`
	TxHash    types.HexBytes `json:"txHash"`
}

EnvelopeMetadata contains vote information for the EnvelopeList api

type EnvelopePackage

type EnvelopePackage struct {
	EncryptionKeyIndexes []uint32         `json:"encryptionKeyIndexes"`
	Meta                 EnvelopeMetadata `json:"meta"`
	Nonce                types.HexBytes   `json:"nonce"`
	Signature            types.HexBytes   `json:"signature"`
	VotePackage          []byte           `json:"votePackage"` // plaintext or encrypted JSON
	Weight               string           `json:"weight"`
	OverwriteCount       uint32           `json:"overwriteCount"`
	Date                 time.Time        `json:"date"`
}

EnvelopePackage contains a VoteEnvelope and auxiliary information for the Envelope api

type Process

type Process struct {
	ID                types.HexBytes             `json:"processId"`
	EntityID          types.HexBytes             `json:"entityId"`
	StartBlock        uint32                     `json:"startBlock"`
	EndBlock          uint32                     `json:"endBlock"`
	StartDate         time.Time                  `json:"startDate,omitempty"`
	EndDate           time.Time                  `json:"endDate,omitempty"`
	BlockCount        uint32                     `json:"blockCount"`
	VoteCount         uint64                     `json:"voteCount"`
	CensusRoot        types.HexBytes             `json:"censusRoot"`
	CensusURI         string                     `json:"censusURI"`
	Metadata          string                     `json:"metadata"`
	CensusOrigin      int32                      `json:"censusOrigin"`
	Status            int32                      `json:"status"`
	Namespace         uint32                     `json:"namespace"`
	Envelope          *models.EnvelopeType       `json:"envelopeType"`
	Mode              *models.ProcessMode        `json:"processMode"`
	VoteOpts          *models.ProcessVoteOptions `json:"voteOptions"`
	QuestionIndex     uint32                     `json:"questionIndex"` // TODO: unset?
	CreationTime      time.Time                  `json:"creationTime"`
	HaveResults       bool                       `json:"haveResults"`
	FinalResults      bool                       `json:"finalResults"`
	SourceBlockHeight uint64                     `json:"sourceBlockHeight"`
	SourceNetworkId   string                     `json:"sourceNetworkId"` // string form of the enum to be user friendly
	MaxCensusSize     uint64                     `json:"maxCensusSize"`
	FromArchive       bool                       `json:"fromArchive,omitempty"`
	ChainID           string                     `json:"chainId,omitempty"`

	PrivateKeys json.RawMessage `json:"-"` // json array
	PublicKeys  json.RawMessage `json:"-"` // json array

	ResultsVotes       [][]*types.BigInt `json:"-"`
	ResultsWeight      *types.BigInt     `json:"-"`
	ResultsBlockHeight uint32            `json:"-"`
}

Process represents an election process handled by the Vochain. The indexer Process data type is different from the vochain state data type since it is optimized for querying purposes and not for keeping a shared consensus state.

func ProcessFromDB

func ProcessFromDB(dbproc *indexerdb.Process) *Process

func (*Process) Results added in v1.9.0

func (p *Process) Results() *results.Results

type TokenFeeMeta added in v1.9.0

type TokenFeeMeta struct {
	Cost      uint64          `json:"cost"`
	From      types.AccountID `json:"from"`
	Height    uint64          `json:"height"`
	Reference string          `json:"reference"`
	Timestamp time.Time       `json:"timestamp"`
	TxType    string          `json:"txType"`
}

TokenFeeMeta contains the information of a token fees and some extra useful information. The types are compatible with the SQL defined schema.

type TokenTransferMeta

type TokenTransferMeta struct {
	Amount    uint64          `json:"amount"`
	From      types.AccountID `json:"from"`
	Height    uint64          `json:"height"`
	TxHash    types.Hash      `json:"txHash"`
	Timestamp time.Time       `json:"timestamp"`
	To        types.AccountID `json:"to"`
}

TokenTransferMeta contains the information of a token transfer and some extra useful information. The types are compatible with the SQL defined schema.

type TokenTransfersAccount added in v1.10.0

type TokenTransfersAccount struct {
	Received []*TokenTransferMeta `json:"received"`
	Sent     []*TokenTransferMeta `json:"sent"`
}

TokenTransfersAccount contains the tokes transfers received and sent information in an account

type Transaction added in v1.8.0

type Transaction struct {
	Index        uint64         `json:"transactionNumber" format:"int64" example:"944"`
	Hash         types.HexBytes `json:"transactionHash" swaggertype:"string" example:"75e8f822f5dd13973ac5158d600f0a2a5fea4bfefce9712ab5195bf17884cfad"`
	BlockHeight  uint32         `json:"blockHeight" format:"int32" example:"64924"`
	TxBlockIndex int32          `json:"transactionIndex" format:"int32" example:"0"`
	TxType       string         `` /* 170-byte string literal not displayed */
}

Transaction holds the db reference for a single transaction

func TransactionFromDB added in v1.8.0

func TransactionFromDB(dbtx *indexerdb.Transaction) *Transaction

type TxMetadata

type TxMetadata struct {
	Type        string         `json:"type"`
	BlockHeight uint32         `json:"blockHeight,omitempty"`
	Index       int32          `json:"index"`
	Hash        types.HexBytes `json:"hash"`
}

TxMetadata contains tx information for the TransactionList api

type TxPackage

type TxPackage struct {
	Tx          []byte         `json:"tx"`
	ID          uint32         `json:"id,omitempty"`
	BlockHeight uint32         `json:"blockHeight,omitempty"`
	Index       *int32         `json:"index,omitempty"`
	Hash        types.HexBytes `json:"hash"`
	Signature   types.HexBytes `json:"signature"`
}

TxPackage contains a SignedTx and auxiliary information for the Transaction api

Jump to

Keyboard shortcuts

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