Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type AccountDetails
- type Argument
- type BalanceSummary
- type Block
- type BlockWithMeta
- type ClaimedReward
- type Delegation
- type EMFunction
- type EMInternal
- type EMLogs
- type EventTransfer
- type ExpandedHeightRange
- type GetAccountBalanceResponse
- type GetAccountDelegationsResponse
- type GetClaimedRewardResponse
- type GetRewardResponse
- type GetUnclaimedRewardResponse
- type HeightAccount
- type HeightHash
- type HeightRange
- type Heights
- type LatestDataRequest
- type LatestDataResponse
- type MarkRange
- type MarkRangeIface
- type Marks
- type RewardAPRSummary
- type RewardAmount
- type RewardSummary
- type RewardsDataRequest
- type RewardsDataResponse
- type RewardsPerValidator
- type RewardsRequest
- type SearchArr
- type SingleValidatorResponse
- type SingleValidatorStatusResponse
- type SlashingsRequest
- type SmartContractDataEVM
- type SubsetEvent
- type SubsetEventError
- type SyncDataRequest
- type SyncDataResponse
- type TimeAccount
- type Transaction
- type TransactionAmount
- type TransactionEvent
- type TransactionEvents
- type TransactionSearch
- type TransactionSearchInternal
- type TransactionWithMeta
- type UnclaimedReward
- type Validator
- type ValidatorStatus
- type ValidatorStatusesDataRequest
- type ValidatorStatusesDataResponse
- type ValidatorStatusesRequest
- type ValidatorStatusesResponse
Constants ¶
const ( ReqIDAccountBalance = "GetAccountBalance" ReqIDAccountDelegations = "GetAccountDelegations" ReqIDLatestData = "GetLatest" ReqIDGetLatestMark = "GetLatestMark" ReqIDGetReward = "GetReward" ReqIDSlashingEvents = "GetSlashingEvents" ReqIDGetTransactions = "GetTransactions" ReqIDGetValidatorStatuses = "GetValidatorStatuses" )
Variables ¶
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
type AccountDetails ¶
type AccountDetails struct { // Description of account Description string `json:"description,omitempty"` // Contact information Contact string `json:"contact,omitempty"` // Name of account Name string `json:"name,omitempty"` // Website address Website string `json:"website,omitempty"` }
AccountDetails External optional account details (if applies)
type BalanceSummary ¶
type BalanceSummary struct { Height uint64 `json:"height"` Time time.Time `json:"time"` Amount []TransactionAmount `json:"balances"` }
type Block ¶
type Block struct { // ID ID uuid.UUID `json:"id,omitempty"` // CreatedAt of block creation time in database CreatedAt *time.Time `json:"created_at,omitempty"` // UpdatedAt of block update time in database UpdatedAt *time.Time `json:"updated_at,omitempty"` // Hash of the Block Hash string `json:"hash,omitempty"` // Height of the Block Height uint64 `json:"height,omitempty"` // Time of the Block Time time.Time `json:"time,omitempty"` Epoch string `json:"epoch,omitempty"` ChainID string `json:"chain_id,omitempty"` NumberOfTransactions uint64 `json:"num_txs,omitempty"` }
Block contains the block details
type BlockWithMeta ¶
type BlockWithMeta struct { // Network name Network string `json:"network,omitempty"` // ChainID ChainID string `json:"chain_id,omitempty"` // Version of block details Version string `json:"version,omitempty"` // Block details Block Block `json:"block,omitempty"` }
BlockWithMeta contains the block deails with metadata
type ClaimedReward ¶
type ClaimedReward struct { // ID UniqueID of reward ID string `json:"id,omitempty"` // Created at CreatedAt *time.Time `json:"created_at,omitempty"` // Updated at UpdatedAt *time.Time `json:"updated_at,omitempty"` // Reward recipient account address Account string `json:"account,omitempty"` // Chain id of reward ChainID string `json:"chain_id,omitempty"` // Validator rewards ClaimedReward []RewardAmount `json:"claimed_reward,omitempty"` // Epoch Epoch string `json:"epoch,omitempty"` // Mark from which reward come from Mark uint64 `json:"mark,omitempty"` // Name of the network Network string `json:"network,omitempty"` // Address of validator Validator string `json:"validator,omitempty"` // Version of reward Version string `json:"version,omitempty"` // Reward time Time time.Time `json:"time,omitempty"` }
type Delegation ¶
type Delegation struct { Delegator string `json:"delegator"` Validator Validator `json:"validator"` Balance RewardAmount `json:"balance"` }
type EMFunction ¶
type EMFunction struct { // Address of the smart contract Address string `json:"address,omitempty"` // Caller account address Caller string `json:"caller,omitempty"` // From account address From string `json:"from,omitempty"` // To account address To string `json:"to,omitempty"` // Transaction value Value big.Int `json:"value,omitempty"` // Undecoded input Input string `json:"input,omitempty"` // Undecoded output Output string `json:"output,omitempty"` // Execution error Error string `json:"error,omitempty"` // Method function Function string `json:"func,omitempty"` // Smart contract method function hash FunctionHash string `json:"funcHash,omitempty"` // Method name Name string `json:"name,omitempty"` // Input details Inputs []Argument `json:"inputs,omitempty"` // Output details Outputs []Argument `json:"outputs,omitempty"` }
EMFunction contains smart contract method details
type EMInternal ¶
type EMInternal struct { *EMFunction Type string `json:"type,omitempty"` Raw []byte `json:"raw,omitempty"` }
type EMLogs ¶
type EMLogs struct { // Address of the smart contract Address string `json:"address,omitempty"` // Event data Data string `json:"data,omitempty"` // Event function Function string `json:"func,omitempty"` // Event name Name string `json:"name,omitempty"` // Event topics Topics []string `json:"topics,omitempty"` // Input details Inputs []Argument `json:"inputs,omitempty"` // Output details Outputs []Argument `json:"outputs,omitempty"` // Raw event Raw []byte `json:"raw,omitempty"` }
EMLogs contains smart contract event details
type EventTransfer ¶
type EventTransfer struct { // Account recipient Account Account `json:"account,omitempty"` // Amounts from Transfer Amounts []TransactionAmount `json:"amounts,omitempty"` }
EventTransfer - Account and Amounts pair
type ExpandedHeightRange ¶ added in v0.8.3
type ExpandedHeightRange struct { Epoch string Hash string StartHeight uint64 EndHeight uint64 ChainID string Network string FirstRequest bool NetworkParams map[string]interface{} SubKind string }
ExpandedHeightRange is necessary to account out the extra data needed by workers such as eth2. No json tags for backwards compatibility with HeightRange.
func (ExpandedHeightRange) GetEndMark ¶ added in v0.8.4
func (hr ExpandedHeightRange) GetEndMark() uint64
func (ExpandedHeightRange) GetStartMark ¶ added in v0.8.4
func (hr ExpandedHeightRange) GetStartMark() uint64
func (ExpandedHeightRange) Validate ¶ added in v0.8.4
func (hr ExpandedHeightRange) Validate() error
type GetAccountBalanceResponse ¶
type GetAccountBalanceResponse struct { Height uint64 `json:"height"` Balances []TransactionAmount `json:"balances"` }
type GetAccountDelegationsResponse ¶
type GetAccountDelegationsResponse struct { Height uint64 `json:"height"` Delegations []Delegation `json:"delegations"` }
type GetClaimedRewardResponse ¶
type GetClaimedRewardResponse struct { Mark uint64 `json:"mark"` Time time.Time `json:"time"` ClaimedRewards []ClaimedReward `json:"claimed_rewards"` }
type GetRewardResponse ¶
type GetRewardResponse struct { Height uint64 `json:"height"` Rewards RewardsPerValidator `json:"rewards"` }
type GetUnclaimedRewardResponse ¶
type GetUnclaimedRewardResponse struct { Mark uint64 `json:"mark"` Time time.Time `json:"time"` UnclaimedRewards []UnclaimedReward `json:"unclaimed_rewards"` }
type HeightAccount ¶
type HeightHash ¶
type HeightRange ¶
type HeightRange struct { Epoch string Hash string StartHeight uint64 EndHeight uint64 ChainID string Network string }
func (HeightRange) GetEndMark ¶ added in v0.8.0
func (hr HeightRange) GetEndMark() uint64
func (HeightRange) GetStartMark ¶ added in v0.8.0
func (hr HeightRange) GetStartMark() uint64
func (HeightRange) Validate ¶ added in v0.8.0
func (hr HeightRange) Validate() error
type Heights ¶
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"` // MaxHeights defines the maximum number of blocks that can be requested by the // manager for each scheduled job it receives. MaxHeights uint64 `json:"max_heights"` // FirstRequest is set to true when this request is the first being sent for a scheduled task. FirstRequest bool `json:"first_request"` // NetworkParams can contain any network specific key/value pairs. NetworkParams map[string]interface{} `json:"network_params"` // SubKind is necessary for those last data requests to workers that are processing multiple types // of last data tasks. SubKind string `json:"sub_kind"` }
func (*LatestDataRequest) FromMapStringInterface ¶
func (ldr *LatestDataRequest) FromMapStringInterface(m map[string]interface{})
func (*LatestDataRequest) String ¶ added in v0.8.3
func (ldr *LatestDataRequest) String() string
type LatestDataResponse ¶
type LatestDataResponse struct { LastHash string `json:"last_hash"` LastHeight uint64 `json:"last_height"` // to be deprecated LastMark uint64 `json:"last_mark"` LastTime time.Time `json:"last_time"` LastEpoch string `json:"last_epoch"` Nonce []byte `json:"nonce"` Error []byte `json:"error"` Processing bool `json:"processing"` }
type MarkRange ¶ added in v0.8.0
type MarkRange struct { // StartMark and EndMark are ordinals on the blockchain, eg height, slot, etc StartMark uint64 `json:"start_mark"` EndMark uint64 `json:"end_mark"` }
func (MarkRange) GetEndMark ¶ added in v0.8.0
func (MarkRange) GetStartMark ¶ added in v0.8.0
type MarkRangeIface ¶ added in v0.8.2
type Marks ¶ added in v0.7.4
type Marks struct { Marks []uint64 `json:"marks"` ErrorAt []uint64 `json:"error_at"` LatestData LatestDataResponse `json:"latest"` NumberOfMarks uint64 `json:"num_marks"` }
type RewardAPRSummary ¶
type RewardAPRSummary struct { Height uint64 `json:"start_height"` TimeBucket time.Time `json:"time_bucket"` Apr string `json:"apr"` Bonded RewardAmount `json:"bonded"` TotalRewards RewardAmount `json:"total_rewards"` Validator Validator `json:"validator"` }
type RewardAmount ¶
type RewardAmount 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"` }
RewardAmount structure holding amount information with decimal implementation (numeric * 10 ^ exp)
type RewardSummary ¶
type RewardsDataRequest ¶ added in v0.7.2
type RewardsDataRequest struct { Network string `json:"network"` ChainID string `json:"chain_id"` Version string `json:"version"` TaskID string `json:"task_id"` RetryCount uint64 `json:"retry_count"` Account string `json:"account"` RewardsTime time.Time `json:"rewards_time"` LastMark uint64 `json:"last_mark"` }
func (*RewardsDataRequest) FromMapStringInterface ¶ added in v0.7.2
func (sdr *RewardsDataRequest) FromMapStringInterface(m map[string]interface{})
type RewardsDataResponse ¶ added in v0.7.2
type RewardsPerValidator ¶
type RewardsPerValidator map[Validator][]RewardAmount
type RewardsRequest ¶ added in v0.7.3
type SingleValidatorResponse ¶ added in v0.8.0
type SingleValidatorResponse struct { Account string `json:"account"` WithdrawalCredentials string `json:"withdrawal_credentials"` Statuses []SingleValidatorStatusResponse `json:"statuses"` }
type SingleValidatorStatusResponse ¶ added in v0.8.0
type SlashingsRequest ¶ added in v0.8.0
type SmartContractDataEVM ¶
type SmartContractDataEVM struct { // Contract method Input EMFunction `json:"input,omitempty"` // Contract events Output []EMLogs `json:"output,omitempty"` // List of Internal Transactions Internals []EMInternal `json:"internals,omitempty"` }
SmartContractDataEVM contains the smart contract details
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"` // List of smart contracts details SmartContracts []SmartContractDataEVM `json:"smart_contracts,omitempty"` }
SubsetEvent - structure storing main contents of transacion
type SubsetEventError ¶
type SubsetEventError struct { // Message from error event Message string `json:"message,omitempty"` }
SubsetEventError error structure for event
type SyncDataRequest ¶
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"` // MaxHeights defines the maximum number of blocks that can be requested by the // manager for each scheduled job it receives. MaxHeights uint64 `json:"max_heights"` 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"` // FirstRequest can't be set when the request is coming from the scheduler; it can only be set when // this request type is being used as a part of the last data request flow. FirstRequest bool `json:"first_request"` // NetworkParams can contain any network specific key/value pairs. NetworkParams map[string]interface{} `json:"network_params"` // SubKind is necessary for those last data requests to workers that are processing multiple types // of last data tasks. SubKind string `json:"sub_kind"` }
func (*SyncDataRequest) FromMapStringInterface ¶
func (sdr *SyncDataRequest) FromMapStringInterface(m map[string]interface{})
func (*SyncDataRequest) String ¶ added in v0.8.3
func (sdr *SyncDataRequest) String() string
type SyncDataResponse ¶
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 TimeAccount ¶ added in v0.7.1
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
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)
func Add ¶
func Add(t, o TransactionAmount) (TransactionAmount, error)
func Clone ¶
func Clone(t TransactionAmount) TransactionAmount
func Div ¶
func Div(t, o TransactionAmount) (TransactionAmount, error)
func Sub ¶
func Sub(t, o TransactionAmount) (TransactionAmount, error)
func (*TransactionAmount) GetFloat ¶
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
type TransactionEvents ¶
type TransactionEvents []TransactionEvent
TransactionEvents - a set of TransactionEvent
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 UnclaimedReward ¶
type UnclaimedReward struct { // ID UniqueID of reward ID string `json:"id,omitempty"` // Created at CreatedAt *time.Time `json:"created_at,omitempty"` // Updated at UpdatedAt *time.Time `json:"updated_at,omitempty"` // Reward recipient account address Account string `json:"account,omitempty"` // Chain id of reward ChainID string `json:"chain_id,omitempty"` // Epoch Epoch string `json:"epoch,omitempty"` // Mark from which reward come from Mark uint64 `json:"mark,omitempty"` // Name of the network Network string `json:"network,omitempty"` // Validator rewards UnclaimedReward []RewardAmount `json:"unclaimed_reward,omitempty"` // Address of validator Validator string `json:"validator,omitempty"` // Version of reward Version string `json:"version,omitempty"` // Reward time Time time.Time `json:"time,omitempty"` }
type ValidatorStatus ¶ added in v0.8.0
type ValidatorStatus struct { ID string `json:"id,omitempty"` Network string `json:"network,omitempty"` ChainID string `json:"chain_id,omitempty"` Version string `json:"version,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Epoch string `json:"epoch,omitempty"` Mark uint64 `json:"mark,omitempty"` Time time.Time `json:"time,omitempty"` Account string `json:"account"` Status string `json:"status"` WithdrawalCredentials string `json:"withdrawal_credentials"` }
type ValidatorStatusesDataRequest ¶ added in v0.8.0
type ValidatorStatusesDataRequest struct { Network string `json:"network"` ChainID string `json:"chain_id"` Version string `json:"version"` TaskID string `json:"task_id"` RetryCount uint64 `json:"retry_count"` WriteAllStatusesAtFirstMark bool `json:"write_all_statuses_at_first_mark"` Accounts []string `json:"accounts"` LastMark uint64 `json:"last_mark"` }
func (*ValidatorStatusesDataRequest) FromMapStringInterface ¶ added in v0.8.0
func (vsdr *ValidatorStatusesDataRequest) FromMapStringInterface(m map[string]interface{})
type ValidatorStatusesDataResponse ¶ added in v0.8.0
type ValidatorStatusesRequest ¶ added in v0.8.0
type ValidatorStatusesRequest struct { MarkRange Epoch string `json:"epoch"` // There is a scenario that immediately comes in regards to when this flag should be set: // We want to be able to always provide the most recent statuses and, for whatever the reason, // there is a gap in recorded statuses up until the chain's most current mark. In this case we // may want to begin getting statuses from the latest marks starting with the latest mark. While // setting this flag won't account for any status changes in between, it will guarantee that the // most recent statuses are up to date. // // Backfilling can fill in the status changes eventually. It should be noted that ones backfilling // is complete, any duplicate statuses need to be manually removed. These statuses will be at the // first mark of the range of the request where `WriteAllStatusesAtFirstMark` was set to true.s WriteAllStatusesAtFirstMark bool `json:"write_all_statuses_at_first_mark"` Accounts []string `json:"accounts"` ChainID string `json:"chain_id"` Network string `json:"network"` }
type ValidatorStatusesResponse ¶ added in v0.8.0
type ValidatorStatusesResponse struct { Network string `json:"network"` ChainID string `json:"chain_id"` Validators []SingleValidatorResponse `json:"validators"` }