structs

package
v0.4.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqIDAccountBalance     = "GetAccountBalance"
	ReqIDAccountDelegations = "GetAccountDelegations"
	ReqIDLatestData         = "GetLatest"
	ReqIDGetLatestMark      = "GetLatestMark"
	ReqIDGetReward          = "GetReward"
	ReqIDGetTransactions    = "GetTransactions"
)

Variables

View Source
var (
	ErrNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	// Unique account identifier
	ID string `json:"id"`
	// External optional account details (if applies)
	Details *AccountDetails `json:"detail,omitempty"`
}

Account - Extended Account information swagger:model

type AccountDetails

type AccountDetails struct {
	Description string `json:"description,omitempty"`
	Contact     string `json:"contact,omitempty"`
	Name        string `json:"name,omitempty"`
	Website     string `json:"website,omitempty"`
}

AccountDetails External optional account details (if applies) swagger:model

type Argument

type Argument struct {
	Name    string   `json:"name,omitempty"`
	Indexed bool     `json:"indexed,omitempty"`
	Order   int      `json:"order,omitempty"`
	Type    string   `json:"type,omitempty"`
	Value   []string `json:"value,omitempty"`
}

type BalanceSummary added in v0.1.0

type BalanceSummary struct {
	Height uint64              `json:"height"`
	Time   time.Time           `json:"time"`
	Amount []TransactionAmount `json:"balances"`
}

type Block

type Block struct {
	ID        uuid.UUID  `json:"id,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	Hash    string    `json:"hash,omitempty"`
	Height  uint64    `json:"height,omitempty"`
	Time    time.Time `json:"time,omitempty"`
	Epoch   string    `json:"epoch,omitempty"`
	ChainID string    `json:"chain_id,omitempty"`

	NumberOfTransactions uint64 `json:"num_txs,omitempty"`
}

Block

type BlockWithMeta

type BlockWithMeta struct {
	Network string `json:"network,omitempty"`
	ChainID string `json:"chain_id,omitempty"`
	Version string `json:"version,omitempty"`
	Block   Block  `json:"block,omitempty"`
}

type Delegation added in v0.3.8

type Delegation struct {
	Delegator string            `json:"delegator"`
	Validator Validator         `json:"validator"`
	Shares    TransactionAmount `json:"shares"`
	Balance   TransactionAmount `json:"balance"`
}

type EMFunction

type EMFunction struct {
	Address string  `json:"address,omitempty"`
	Caller  string  `json:"caller,omitempty"`
	From    string  `json:"from,omitempty"`
	To      string  `json:"to,omitempty"`
	Value   big.Int `json:"value,omitempty"`
	Input   string  `json:"input,omitempty"`
	Output  string  `json:"output,omitempty"`

	Error        string     `json:"error,omitempty"`
	Function     string     `json:"func,omitempty"`
	FunctionHash string     `json:"funcHash,omitempty"`
	Name         string     `json:"name,omitempty"`
	Inputs       []Argument `json:"inputs,omitempty"`
	Outputs      []Argument `json:"outputs,omitempty"`
}

type EMInternal

type EMInternal struct {
	*EMFunction
	Type string `json:"type,omitempty"`
	Raw  []byte `json:"raw,omitempty"`
}

type EMLogs

type EMLogs struct {
	Address  string     `json:"address,omitempty"`
	Data     string     `json:"data,omitempty"`
	Function string     `json:"func,omitempty"`
	Name     string     `json:"name,omitempty"`
	Topics   []string   `json:"topics,omitempty"`
	Inputs   []Argument `json:"inputs,omitempty"`
	Outputs  []Argument `json:"outputs,omitempty"`
	Raw      []byte     `json:"raw,omitempty"`
}

type EventTransfer

type EventTransfer struct {
	Account Account             `json:"account,omitempty"`
	Amounts []TransactionAmount `json:"amounts,omitempty"`
}

EventTransfer - Account and Amounts pair swagger:model

type GetAccountBalanceResponse added in v0.1.0

type GetAccountBalanceResponse struct {
	Height   uint64              `json:"height"`
	Balances []TransactionAmount `json:"balances"`
}

type GetAccountDelegationsResponse added in v0.3.8

type GetAccountDelegationsResponse struct {
	Height      uint64       `json:"height"`
	Delegations []Delegation `json:"delegations"`
}

type GetRewardResponse added in v0.0.9

type GetRewardResponse struct {
	Height  uint64              `json:"height"`
	Rewards RewardsPerValidator `json:"rewards"`
}

type HeightAccount added in v0.0.9

type HeightAccount struct {
	Epoch   string
	Height  uint64
	Account string

	ChainID string
	Network string
}

type HeightHash

type HeightHash struct {
	Epoch  string
	Height uint64
	Hash   string

	ChainID string
	Network string
}

type HeightRange

type HeightRange struct {
	Epoch       string
	Hash        string
	StartHeight uint64
	EndHeight   uint64

	ChainID string
	Network string
}

type Heights added in v0.4.0

type Heights struct {
	Heights    []uint64           `json:"heights"`
	ErrorAt    []uint64           `json:"error_at"`
	LatestData LatestDataResponse `json:"latest"`

	NumberOfTx      uint64 `json:"num_tx"`
	NumberOfHeights uint64 `json:"num_heights"`
}

type LatestDataRequest

type LatestDataRequest struct {
	Network string `json:"network"`
	ChainID string `json:"chain_id"`
	Version string `json:"version"`
	TaskID  string `json:"task_id"`

	LastHash   string    `json:"last_hash"`
	LastEpoch  string    `json:"last_epoch"`
	LastHeight uint64    `json:"last_height"`
	LastTime   time.Time `json:"last_time"`
	RetryCount uint64    `json:"retry_count"`
	Nonce      []byte    `json:"nonce"`

	SelfCheck bool `json:"self_check"`
}

func (*LatestDataRequest) FromMapStringInterface added in v0.4.0

func (ldr *LatestDataRequest) FromMapStringInterface(m map[string]interface{})

type LatestDataResponse

type LatestDataResponse struct {
	LastHash   string    `json:"last_hash"`
	LastHeight uint64    `json:"last_height"`
	LastTime   time.Time `json:"last_time"`
	LastEpoch  string    `json:"last_epoch"`
	Nonce      []byte    `json:"nonce"`

	Error      []byte `json:"error"`
	Processing bool   `json:"processing"`
}

type RewardAPRSummary added in v0.3.1

type RewardAPRSummary struct {
	Height       uint64            `json:"start_height"`
	TimeBucket   time.Time         `json:"time_bucket"`
	Apr          string            `json:"apr"`
	Bonded       TransactionAmount `json:"bonded"`
	TotalRewards TransactionAmount `json:"total_rewards"`
	Validator    Validator         `json:"validator"`
}

type RewardSummary added in v0.0.9

type RewardSummary struct {
	Start     uint64              `json:"start"`
	End       uint64              `json:"end"`
	Time      time.Time           `json:"time"`
	Validator Validator           `json:"validator"`
	Amount    []TransactionAmount `json:"rewards"`
}

type RewardsPerValidator added in v0.3.1

type RewardsPerValidator map[Validator][]TransactionAmount

type SearchArr

type SearchArr struct {
	Value []string `json:"value"`
	Any   bool     `json:"any"`
}

type SmartContractDataEVM

type SmartContractDataEVM struct {
	Input     EMFunction   `json:"input,omitempty"`
	Output    []EMLogs     `json:"output,omitempty"`
	Internals []EMInternal `json:"internals,omitempty"`
}

SmartContractData

type SubsetEvent

type SubsetEvent struct {
	// ID UniqueID of subsetevent
	ID string `json:"id,omitempty"`
	// Type of transaction
	Type   []string `json:"type,omitempty"`
	Action string   `json:"action,omitempty"`
	// Collection from where transaction came from
	Module string `json:"module,omitempty"`
	// List of sender accounts with optional amounts
	Sender []EventTransfer `json:"sender,omitempty"`
	// List of recipient accounts with optional amounts
	Recipient []EventTransfer `json:"recipient,omitempty"`
	// The list of all accounts that took part in the subsetevent
	Node map[string][]Account `json:"node,omitempty"`
	// Transaction nonce
	Nonce string `json:"nonce,omitempty"`
	// Completion time
	Completion *time.Time `json:"completion,omitempty"`
	// List of Amounts
	Amount map[string]TransactionAmount `json:"amount,omitempty"`
	// List of Transfers with amounts and optional recipients
	Transfers map[string][]EventTransfer `json:"transfers,omitempty"`
	// Optional error if occurred
	Error *SubsetEventError `json:"error,omitempty"`
	// Set of additional parameters attached to transaction (used as last resort)
	Additional map[string][]string `json:"additional,omitempty"`
	// SubEvents because some messages are in fact carying another messages inside
	Sub []SubsetEvent `json:"sub,omitempty"`
	// SmartContractData
	SmartContracts []SmartContractDataEVM `json:"smart_contracts,omitempty"`
}

SubsetEvent - structure storing main contents of transacion swagger:model

type SubsetEventError

type SubsetEventError struct {
	Message string `json:"message,omitempty"`
}

SubsetEventError error structure for event swagger:model

type SyncDataRequest added in v0.4.0

type SyncDataRequest struct {
	Network string `json:"network"`
	ChainID string `json:"chain_id"`
	Version string `json:"version"`
	TaskID  string `json:"task_id"`

	LastHeight  uint64 `json:"last_height"`
	FinalHeight uint64 `json:"final_height"`

	LastHash   string    `json:"last_hash"`
	LastEpoch  string    `json:"last_epoch"`
	LastTime   time.Time `json:"last_time"`
	RetryCount uint64    `json:"retry_count"`
	Nonce      []byte    `json:"nonce"`

	SelfCheck bool `json:"selfCheck"`
}

func (*SyncDataRequest) FromMapStringInterface added in v0.4.0

func (sdr *SyncDataRequest) FromMapStringInterface(m map[string]interface{})

type SyncDataResponse added in v0.4.0

type SyncDataResponse struct {
	LastHash   string    `json:"last_hash"`
	LastHeight uint64    `json:"last_height"`
	LastTime   time.Time `json:"last_time"`
	LastEpoch  string    `json:"last_epoch"`
	RetryCount uint64    `json:"retry_count"`
	Nonce      []byte    `json:"nonce"`
	Error      []byte    `json:"error"`

	Processing bool `json:"processing"`
}

type Transaction

type Transaction struct {
	// ID of transaction assigned on database write
	ID uuid.UUID `json:"id,omitempty"`
	// Created at
	CreatedAt *time.Time `json:"created_at,omitempty"`
	// Updated at
	UpdatedAt *time.Time `json:"updated_at,omitempty"`

	// Hash of the transaction
	Hash string `json:"hash,omitempty"`
	// BlockHash - hash of the block of transaction
	BlockHash string `json:"block_hash,omitempty"`
	// Height - height of the block of transaction
	Height uint64 `json:"height,omitempty"`

	Epoch string `json:"epoch,omitempty"`
	// ChainID - chain id of transacion
	ChainID string `json:"chain_id,omitempty"`
	// Time - time of transaction
	Time time.Time `json:"time,omitempty"`

	// Fee - Fees for transaction (if applies)
	Fee []TransactionAmount `json:"transaction_fee,omitempty"`
	// GasWanted
	GasWanted uint64 `json:"gas_wanted,omitempty"`
	// GasUsed
	GasUsed uint64 `json:"gas_used,omitempty"`
	// Memo - the description attached to transactions
	Memo string `json:"memo,omitempty"`

	// Version - Version of transaction record
	Version string `json:"version"`
	// Events - Transaction contents
	Events TransactionEvents `json:"events,omitempty"`

	// Raw - Raw transaction bytes
	Raw []byte `json:"raw,omitempty"`

	// RawLog - RawLog transaction's log bytes
	RawLog []byte `json:"raw_log,omitempty"`

	// HasErrors - indicates if Transaction has any errors inside
	HasErrors bool `json:"has_errors"`
}

Transaction contains the blockchain transaction details swagger:model

type TransactionAmount

type TransactionAmount struct {
	// Textual representation of Amount
	Text string `json:"text,omitempty"`
	// The currency in what amount is returned (if applies)
	Currency string `json:"currency,omitempty"`

	// Numeric part of the amount
	Numeric *big.Int `json:"numeric,omitempty"`
	// Exponential part of amount obviously 0 by default
	Exp int32 `json:"exp,omitempty"`
}

TransactionAmount structure holding amount information with decimal implementation (numeric * 10 ^ exp) swagger:model

func Add added in v0.3.6

func Clone added in v0.3.6

func Div added in v0.3.6

func Sub added in v0.3.6

func (*TransactionAmount) GetFloat added in v0.3.1

func (t *TransactionAmount) GetFloat() *big.Float

type TransactionEvent

type TransactionEvent struct {
	// ID UniqueID of event
	ID string `json:"id,omitempty"`
	// The Kind of event
	Kind string `json:"kind,omitempty"`
	// Type of transaction
	Type []string `json:"type,omitempty"`
	// Collection from where transaction came from
	Module string `json:"module,omitempty"`
	// List of sender accounts with optional amounts
	// Subcontents of event
	Sub []SubsetEvent `json:"sub,omitempty"`
}

TransactionEvent part of transaction contents swagger:model

type TransactionEvents

type TransactionEvents []TransactionEvent

TransactionEvents - a set of TransactionEvent swagger:model

func (*TransactionEvents) Scan

func (te *TransactionEvents) Scan(value interface{}) error

type TransactionSearch

type TransactionSearch struct {
	Network  string   `json:"network"`
	ChainIDs []string `json:"chain_ids"`
	Epoch    string   `json:"epoch"`

	Height     uint64    `json:"height"`
	Type       []string  `json:"type"`
	BlockHash  string    `json:"block_hash"`
	Hash       string    `json:"hash"`
	Account    []string  `json:"account"`
	Sender     []string  `json:"sender"`
	Receiver   []string  `json:"receiver"`
	Memo       string    `json:"memo"`
	BeforeTime time.Time `json:"before_time"`
	AfterTime  time.Time `json:"after_time"`
	Limit      uint64    `json:"limit"`
	Offset     uint64    `json:"offset"`

	AfterHeight  uint64 `form:"after_id"`
	BeforeHeight uint64 `form:"before_id"`

	WithRaw    bool `json:"with_raw"`
	WithRawLog bool `json:"with_raw_log"`
}

type TransactionSearchInternal

type TransactionSearchInternal struct {
	Height    uint64    `json:"height"`
	Type      SearchArr `json:"type"`
	BlockHash string    `json:"block_hash"`
	Hash      string    `json:"hash"`
	Account   []string  `json:"account"`
	Sender    []string  `json:"sender"`
	Receiver  []string  `json:"receiver"`
	Memo      string    `json:"memo"`

	AfterTime  time.Time `json:"before_time"`
	BeforeTime time.Time `json:"after_time"`

	AfterHeight  uint64 `json:"after_height"`
	BeforeHeight uint64 `json:"before_height"`
	Limit        uint64 `json:"limit"`
	Offset       uint64 `json:"offset"`

	Network  string   `json:"network"`
	ChainIDs []string `json:"chain_ids"`
	Epoch    string   `json:"epoch"`

	WithRaw    bool `json:"with_raw"`
	WithRawLog bool `json:"with_raw_log"`

	HasErrors bool `json:"has_errors"`
}

type TransactionWithMeta

type TransactionWithMeta struct {
	Network     string      `json:"network,omitempty"`
	Version     string      `json:"version,omitempty"`
	ChainID     string      `json:"chain_id,omitempty"`
	Transaction Transaction `json:"transaction,omitempty"`
}

type Validator added in v0.3.1

type Validator string

Jump to

Keyboard shortcuts

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