2021-07-01 05:29:35 -07:00
|
|
|
package rpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
bin "github.com/dfuse-io/binary"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetEpochInfo returns information about the current epoch.
|
|
|
|
func (cl *Client) GetEpochInfo(
|
|
|
|
ctx context.Context,
|
2021-07-19 12:57:25 -07:00
|
|
|
commitment CommitmentType, // optional
|
2021-07-01 05:29:35 -07:00
|
|
|
) (out *GetEpochInfoResult, err error) {
|
2021-07-09 08:36:53 -07:00
|
|
|
params := []interface{}{}
|
2021-07-01 05:29:35 -07:00
|
|
|
if commitment != "" {
|
|
|
|
params = append(params, M{"commitment": commitment})
|
|
|
|
}
|
|
|
|
err = cl.rpcClient.CallFor(&out, "getEpochInfo", params)
|
|
|
|
return
|
|
|
|
}
|
2021-07-19 12:57:25 -07:00
|
|
|
|
|
|
|
type GetEpochInfoResult struct {
|
|
|
|
// The current slot.
|
|
|
|
AbsoluteSlot bin.Uint64 `json:"absoluteSlot"`
|
|
|
|
|
|
|
|
// The current block height.
|
|
|
|
BlockHeight bin.Uint64 `json:"blockHeight"`
|
|
|
|
|
|
|
|
// The current epoch.
|
|
|
|
Epoch bin.Uint64 `json:"epoch"`
|
|
|
|
|
|
|
|
// The current slot relative to the start of the current epoch.
|
|
|
|
SlotIndex bin.Uint64 `json:"slotIndex"`
|
|
|
|
|
|
|
|
// The number of slots in this epoch.
|
|
|
|
SlotsInEpoch bin.Uint64 `json:"slotsInEpoch"`
|
|
|
|
|
|
|
|
TransactionCount bin.Uint64 `json:"transactionCount"`
|
|
|
|
}
|