-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathget_inflation_reward.go
32 lines (26 loc) · 1.33 KB
/
get_inflation_reward.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
package rpc
import (
"context"
)
type GetInflationRewardResponse JsonRpcResponse[[]*GetInflationReward]
// GetInflationRewardResult is a part of raw rpc response of `getInflationReward`
type GetInflationReward struct {
Epoch uint64 `json:"epoch"`
EffectiveSlot uint64 `json:"effectiveSlot"`
Amount uint64 `json:"amount"`
PostBalance uint64 `json:"postBalance"`
Commission *uint8 `json:"commission"`
}
// GetInflationRewardConfig is a option config for `getInflationReward`
type GetInflationRewardConfig struct {
Commitment Commitment `json:"commitment,omitempty"`
Epoch uint64 `json:"epoch,omitempty"`
}
// GetInflationReward returns the inflation reward for a list of addresses for an epoch
func (c *RpcClient) GetInflationReward(ctx context.Context, stakeAccountAddrs []string) (JsonRpcResponse[[]*GetInflationReward], error) {
return call[JsonRpcResponse[[]*GetInflationReward]](c, ctx, "getInflationReward", stakeAccountAddrs)
}
// GetInflationRewardWithConfig returns the inflation reward for a list of addresses for an epoch
func (c *RpcClient) GetInflationRewardWithConfig(ctx context.Context, stakeAccountAddrs []string, cfg GetInflationRewardConfig) (JsonRpcResponse[[]*GetInflationReward], error) {
return call[JsonRpcResponse[[]*GetInflationReward]](c, ctx, "getInflationReward", stakeAccountAddrs, cfg)
}