Skip to content

Commit

Permalink
feat: apply autocli.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Feb 3, 2024
1 parent 9ad5d16 commit 4ec1412
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 296 deletions.
88 changes: 88 additions & 0 deletions x/evm/autocli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package evm

import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
evmv1 "github.com/evmos/ethermint/api/ethermint/evm/v1"
)

// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: evmv1.Query_ServiceDesc.ServiceName,
EnhanceCustomCommand: false,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Params",
Use: "params",
Short: "Get the evm params",
Long: "Get the evm parameter values.",
},
{
RpcMethod: "Code",
Use: "code ADDRESS",
Short: "Gets code from an account",
Long: "Gets code from an account. If the height is not provided, it will use the latest height from context.",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}},
},
{
RpcMethod: "Storage",
Use: "storage ADDRESS KEY",
Short: "Gets storage for an account with a given key and height",
Long: "Gets storage for an account with a given key and height. If the height is not provided, it will use the latest height from context.", //nolint:lll
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}, {ProtoField: "key"}},
},
{
RpcMethod: "Account",
Skip: true,
},
{
RpcMethod: "CosmosAccount",
Skip: true,
},
{
RpcMethod: "ValidatorAccount",
Skip: true,
},
{
RpcMethod: "Balance",
Skip: true,
},
{
RpcMethod: "EthCall",
Skip: true,
},
{
RpcMethod: "EstimateGas",
Skip: true,
},
{
RpcMethod: "TraceTx",
Skip: true,
},
{
RpcMethod: "TraceBlock",
Skip: true,
},
{
RpcMethod: "BaseFee",
Skip: true,
},
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: evmv1.Msg_ServiceDesc.ServiceName,
EnhanceCustomCommand: true, // We provide costom RawTx in client/cli/tx.go
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
{
RpcMethod: "EthereumTx",
Skip: true,
},
},
},
}
}
149 changes: 0 additions & 149 deletions x/evm/client/cli/query.go

This file was deleted.

8 changes: 4 additions & 4 deletions x/evm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
}

// GetQueryCmd returns no root query command for the evm module.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
}
// // GetQueryCmd returns no root query command for the evm module.
// func (AppModuleBasic) GetQueryCmd() *cobra.Command {
// return cli.GetQueryCmd()
// }

// RegisterInterfaces registers interfaces and implementations of the evm module.
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
Expand Down
48 changes: 48 additions & 0 deletions x/feemarket/autocli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package feemarket

import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
feemarketv1 "github.com/evmos/ethermint/api/ethermint/feemarket/v1"
)

// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: feemarketv1.Query_ServiceDesc.ServiceName,
EnhanceCustomCommand: false,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Params",
Use: "params",
Short: "Get the fee market params",
Long: "Get the fee market parameter values.",
},
{
RpcMethod: "BaseFee",
Use: "base-fee",
Short: "Get the base fee amount at a given block height",
Long: `Get the base fee amount at a given block height.
If the height is not provided, it will use the latest height from context.`,
},
{
RpcMethod: "BlockGas",
Use: "block-gas",
Short: "Get the block gas used at a given block height",
Long: `Get the block gas used at a given block height.
If the height is not provided, it will use the latest height from context`,
},
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: feemarketv1.Msg_ServiceDesc.ServiceName,
EnhanceCustomCommand: false,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
},
},
}
}
Loading

0 comments on commit 4ec1412

Please sign in to comment.