72 lines
2.0 KiB
Go
72 lines
2.0 KiB
Go
package cmtservice
|
|
|
|
import (
|
|
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
|
cmtv1beta1 "cosmossdk.io/api/cosmos/base/tendermint/v1beta1"
|
|
)
|
|
|
|
var CometBFTAutoCLIDescriptor = &autocliv1.ServiceCommandDescriptor{
|
|
Service: cmtv1beta1.Service_ServiceDesc.ServiceName,
|
|
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
|
{
|
|
RpcMethod: "GetNodeInfo",
|
|
Use: "node-info",
|
|
Short: "Query the current node info",
|
|
},
|
|
{
|
|
RpcMethod: "GetSyncing",
|
|
Use: "syncing",
|
|
Short: "Query node syncing status",
|
|
},
|
|
{
|
|
RpcMethod: "GetLatestBlock",
|
|
Use: "block-latest",
|
|
Short: "Query for the latest committed block",
|
|
},
|
|
{
|
|
RpcMethod: "GetBlockByHeight",
|
|
Use: "block-by-height <height>",
|
|
Short: "Query for a committed block by height",
|
|
Long: "Query for a specific committed block using the CometBFT RPC `block_by_height` method",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
|
},
|
|
{
|
|
RpcMethod: "GetLatestValidatorSet",
|
|
Use: "validator-set",
|
|
Alias: []string{"validator-set-latest", "comet-validator-set", "cometbft-validator-set", "tendermint-validator-set"},
|
|
Short: "Query for the latest validator set",
|
|
},
|
|
{
|
|
RpcMethod: "GetValidatorSetByHeight",
|
|
Use: "validator-set-by-height <height>",
|
|
Short: "Query for a validator set by height",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "height"}},
|
|
},
|
|
{
|
|
RpcMethod: "ABCIQuery",
|
|
Skip: true,
|
|
},
|
|
},
|
|
}
|
|
|
|
// NewCometBFTCommands is a fake `appmodule.Module` to be considered as a module
|
|
// and be added in AutoCLI.
|
|
func NewCometBFTCommands() *cometModule {
|
|
return &cometModule{}
|
|
}
|
|
|
|
type cometModule struct{}
|
|
|
|
func (m cometModule) IsOnePerModuleType() {}
|
|
func (m cometModule) IsAppModule() {}
|
|
|
|
func (m cometModule) Name() string {
|
|
return "comet"
|
|
}
|
|
|
|
func (m cometModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
|
return &autocliv1.ModuleOptions{
|
|
Query: CometBFTAutoCLIDescriptor,
|
|
}
|
|
}
|