-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathget_block_production.go
36 lines (28 loc) · 1.32 KB
/
get_block_production.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
30
31
32
33
34
35
36
package rpc
import (
"context"
)
type GetBlockProductionResponse JsonRpcResponse[GetBlockProduction]
type GetBlockProduction ValueWithContext[GetBlockProductionResponseResultValue]
type GetBlockProductionResponseResultValue struct {
ByIdentity map[string][]uint64 `json:"byIdentity"`
Range GetBlockProductionRange `json:"range"`
}
// GetBlockProductionConfig is a option config for `getBlockProduction`
type GetBlockProductionConfig struct {
Commitment Commitment `json:"commitment,omitempty"`
Range *GetBlockProductionRange `json:"range,omitempty"`
Identity string `json:"identity,omitempty"`
}
type GetBlockProductionRange struct {
FirstSlot uint64 `json:"firstSlot"`
LastSlot uint64 `json:"lastSlot,omitempty"`
}
// GetBlockProduction returns the current block height of the node
func (c *RpcClient) GetBlockProduction(ctx context.Context) (JsonRpcResponse[GetBlockProduction], error) {
return call[JsonRpcResponse[GetBlockProduction]](c, ctx, "getBlockProduction")
}
// GetBlockProductionWithConfig returns the current block height of the node
func (c *RpcClient) GetBlockProductionWithConfig(ctx context.Context, cfg GetBlockProductionConfig) (JsonRpcResponse[GetBlockProduction], error) {
return call[JsonRpcResponse[GetBlockProduction]](c, ctx, "getBlockProduction", cfg)
}