feat: add basic autocli config to every module (#13786)
* feat: add autocli configs to every module * auto-discover config * tests + gov, auth config tweaks * docs * Update x/auth/autocli.go Co-authored-by: Julien Robert <julien@rbrt.fr> * Update x/auth/autocli.go Co-authored-by: Julien Robert <julien@rbrt.fr> * cleanup Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
co-authored by
Julien Robert
Amaury
parent
4f7d9ea233
commit
bcdf81cbaf
@@ -0,0 +1,32 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
authv1beta1 "cosmossdk.io/api/cosmos/auth/v1beta1"
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
)
|
||||
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: authv1beta1.Query_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Account",
|
||||
Use: "account [address]",
|
||||
Short: "query account by address",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "AccountAddressByID",
|
||||
Use: "address-by-id [acc-num]",
|
||||
Short: "query account address by account number",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tx: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: authv1beta1.Msg_ServiceDesc.ServiceName,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
modulev1 "cosmossdk.io/api/cosmos/auth/module/v1"
|
||||
@@ -111,11 +110,6 @@ func (am AppModule) IsOnePerModuleType() {}
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return types.AutoCLIOptions
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, randGenAccountsFn types.RandomGenesisAccountsFn, ss exported.Subspace) AppModule {
|
||||
return AppModule{
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package types
|
||||
|
||||
import autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
|
||||
var AutoCLIOptions = &autocliv1.ModuleOptions{
|
||||
Query: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: _Query_serviceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Account",
|
||||
Use: "account [address]",
|
||||
Short: "query account by address",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}},
|
||||
},
|
||||
{
|
||||
RpcMethod: "AccountAddressByID",
|
||||
Use: "address-by-id [id]",
|
||||
Short: "query account address by account ID",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tx: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: _Msg_serviceDesc.ServiceName,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user