solana_exporter/pkg/rpc/responses.go

78 lines
1.8 KiB
Go
Raw Normal View History

2024-06-14 02:09:39 -07:00
package rpc
type (
response[T any] struct {
2024-06-14 03:58:32 -07:00
Result T `json:"result"`
Error rpcError `json:"error"`
2024-06-14 02:09:39 -07:00
}
EpochInfo struct {
// Current absolute slot in epoch
AbsoluteSlot int64 `json:"absoluteSlot"`
// Current block height
BlockHeight int64 `json:"blockHeight"`
// Current epoch number
Epoch int64 `json:"epoch"`
// Current slot relative to the start of the current epoch
SlotIndex int64 `json:"slotIndex"`
// Number of slots in this epoch
SlotsInEpoch int64 `json:"slotsInEpoch"`
2024-06-14 03:58:32 -07:00
// Total number of transactions
2024-06-14 02:09:39 -07:00
TransactionCount int64 `json:"transactionCount"`
}
VoteAccount struct {
ActivatedStake int64 `json:"activatedStake"`
Commission int `json:"commission"`
EpochCredits [][]int `json:"epochCredits"`
EpochVoteAccount bool `json:"epochVoteAccount"`
LastVote int `json:"lastVote"`
NodePubkey string `json:"nodePubkey"`
RootSlot int `json:"rootSlot"`
VotePubkey string `json:"votePubkey"`
}
VoteAccounts struct {
Current []VoteAccount `json:"current"`
Delinquent []VoteAccount `json:"delinquent"`
}
2024-06-14 03:58:32 -07:00
blockProductionRange struct {
FirstSlot int64 `json:"firstSlot"`
LastSlot *int64 `json:"lastSlot,omitempty"`
}
blockProductionResult struct {
Value struct {
ByIdentity map[string][]int64 `json:"byIdentity"`
Range blockProductionRange `json:"range"`
} `json:"value"`
}
BlockProductionPerHost struct {
LeaderSlots int64
BlocksProduced int64
}
BlockProduction struct {
FirstSlot int64
LastSlot int64
Hosts map[string]BlockProductionPerHost
2024-06-14 02:09:39 -07:00
}
2024-10-01 02:52:02 -07:00
BalanceResult struct {
Value int64 `json:"value"`
Context struct {
Slot int64 `json:"slot"`
} `json:"context"`
}
2024-06-14 02:09:39 -07:00
)
2024-06-14 03:58:32 -07:00
func (r response[T]) getError() rpcError {
2024-06-14 02:09:39 -07:00
return r.Error
}
type HasRPCError interface {
2024-06-14 03:58:32 -07:00
getError() rpcError
2024-06-14 02:09:39 -07:00
}