mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-23 23:05:18 +00:00
feat(community): add CLI cmd for annualized-rewards (#1756)
This commit is contained in:
parent
adbd70f71c
commit
48ee996f61
@ -24,6 +24,7 @@ func GetQueryCmd() *cobra.Command {
|
||||
commands := []*cobra.Command{
|
||||
getCmdQueryParams(),
|
||||
getCmdQueryBalance(),
|
||||
getCmdQueryAnnualizedRewards(),
|
||||
}
|
||||
|
||||
for _, cmd := range commands {
|
||||
@ -81,3 +82,26 @@ func getCmdQueryBalance() *cobra.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// getCmdQueryAnnualizedRewards implements a command to return the current annualized rewards.
|
||||
func getCmdQueryAnnualizedRewards() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "annualized-rewards",
|
||||
Short: "Query a current calculation of annualized rewards for the chain.",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.AnnualizedRewards(cmd.Context(), &types.QueryAnnualizedRewardsRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user