forked from cerc-io/laconicd-deprecated
Basic RPC and CLI Queries (#77)
- Adds ethermint query command (`emintcli query ethermint <query>`)
- Supports block number, storage, code, balance lookups
- Implements RPC API methods `eth_blockNumber`, `eth_getStorageAt`, `eth_getBalance`, and `eth_getCode`
- Adds tester utility for RPC calls
- Adheres to go test format, but should not be run with regular suite
- Requires daemon and RPC server to be running
- Excluded from `make test`, available with `make test-rpc`
- Implemented AppModule interface and added EVM module to app
- Required for routing
- Implements `InitGenesis` (`x/evm/genesis.go`) and stubs `ExportGenesis`
- Modifies GenesisAccount to match expected format
This commit is contained in:
+21
-2
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/cosmos/ethermint/rpc"
|
||||
"github.com/tendermint/go-amino"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
@@ -10,7 +12,6 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
emintapp "github.com/cosmos/ethermint/app"
|
||||
"github.com/cosmos/ethermint/rpc"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
@@ -43,7 +44,7 @@ func main() {
|
||||
rootCmd.AddCommand(
|
||||
sdkrpc.StatusCommand(),
|
||||
client.ConfigCmd(emintapp.DefaultCLIHome),
|
||||
// TODO: Set up query command
|
||||
queryCmd(cdc),
|
||||
// TODO: Set up tx command
|
||||
// TODO: Set up rest routes (if included, different from web3 api)
|
||||
rpc.Web3RpcCmd(cdc),
|
||||
@@ -59,6 +60,24 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func queryCmd(cdc *amino.Codec) *cobra.Command {
|
||||
queryCmd := &cobra.Command{
|
||||
Use: "query",
|
||||
Aliases: []string{"q"},
|
||||
Short: "Querying subcommands",
|
||||
}
|
||||
|
||||
// TODO: Possibly add these query commands from other modules
|
||||
//queryCmd.AddCommand(
|
||||
// ...
|
||||
//)
|
||||
|
||||
// add modules' query commands
|
||||
emintapp.ModuleBasics.AddQueryCommands(queryCmd, cdc)
|
||||
|
||||
return queryCmd
|
||||
}
|
||||
|
||||
func initConfig(cmd *cobra.Command) error {
|
||||
home, err := cmd.PersistentFlags().GetString(cli.HomeFlag)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user