-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathget_epoch_info.go
29 lines (23 loc) · 1008 Bytes
/
get_epoch_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package rpc
import "context"
type GetEpochInfoResponse JsonRpcResponse[GetEpochInfo]
type GetEpochInfo struct {
AbsoluteSlot uint64 `json:"absoluteSlot"`
BlockHeight uint64 `json:"blockHeight"`
Epoch uint64 `json:"epoch"`
SlotIndex uint64 `json:"slotIndex"`
SlotsInEpoch uint64 `json:"slotsInEpoch"`
TransactionCount *uint64 `json:"transactionCount"`
}
// GetEpochInfoConfig is a option config for `getEpochInfo`
type GetEpochInfoConfig struct {
Commitment Commitment `json:"commitment,omitempty"`
}
// GetEpochInfo returns the SOL balance
func (c *RpcClient) GetEpochInfo(ctx context.Context) (JsonRpcResponse[GetEpochInfo], error) {
return call[JsonRpcResponse[GetEpochInfo]](c, ctx, "getEpochInfo")
}
// GetEpochInfoWithConfig returns the SOL balance
func (c *RpcClient) GetEpochInfoWithConfig(ctx context.Context, cfg GetEpochInfoConfig) (JsonRpcResponse[GetEpochInfo], error) {
return call[JsonRpcResponse[GetEpochInfo]](c, ctx, "getEpochInfo", cfg)
}