Skip to content

Commit 0270410

Browse files
committed
update alias for EVM-RPC eth_*
1 parent 8711629 commit 0270410

File tree

7 files changed

+52
-17
lines changed

7 files changed

+52
-17
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,18 @@ _This command will try to query `totalSupply()` if possible_
6464

6565
```bash
6666
devd query eth_getTransactionByHash [0xHash] [--evm-rpc http://localhost:8545]
67+
# devd q evm-tx 0xHash
6768

6869
devd query eth_getTransactionReceipt [0xHash] [--evm-rpc http://localhost:8545]
69-
# devd q receipt 0xHash
70+
# devd q evm-receipt 0xHash
7071

7172
devd query eth_getBlockByNumber [hex or dec block no] [--full] [--evm-rpc http://localhost:8545]
72-
# devd q eth_getBlockByNumber 0xF
73-
# devd q eth_getBlockByNumber 16 --full
73+
# devd q evm-block 0xF
74+
# devd q evm-block 16 --full
7475

7576
devd query debug_traceTransaction [0xHash] [--tracer callTracer] [--evm-rpc http://localhost:8545]
76-
# devd q trace 0xHash
77-
# devd q trace 0xHash --tracer callTracer
77+
# devd q evm-trace 0xHash
78+
# devd q evm-trace 0xHash --tracer callTracer
7879

7980
devd query eth_call 0xContractAddr 0xCallData [--evm-rpc http://localhost:8545] [--from 0xFromAddr/Bech32] [--height 5m/0xHex/latest] [--gas 500k/0xHex] [--gas-prices 20e9/0xHex] [--value 1e18/0xHex]
8081

cmd/query/debug_traceTransaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
func GetQueryEvmRpcDebugTraceTransactionCommand() *cobra.Command {
2525
cmd := &cobra.Command{
2626
Use: "debug_traceTransaction [0xhash]",
27-
Aliases: []string{"trace"},
27+
Aliases: []string{"evm-trace"},
2828
Short: "Query 'debug_traceTransaction' from EVM RPC",
2929
Long: `Query 'debug_traceTransaction' from EVM RPC, with optional tracer name.
3030
Require 'debug' namespace enabled in EVM RPC node.`,

cmd/query/deprecated_aliases.go

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ func GetDeprecatedAliasBlockAsCommand() *cobra.Command {
1212
cmd := &cobra.Command{
1313
Use: "block [height]",
1414
Hidden: true,
15-
Short: "Deprecated and removed alias of `eth_getBlockByNumber`",
15+
Short: "Deprecated and removed alias of `eth_getBlockByNumber`, renamed to `evm-block`",
1616
Args: cobra.ExactArgs(1),
1717
Run: func(cmd *cobra.Command, args []string) {
18-
utils.PrintfStdErr("ERR: `block` is a deprecated alias of `eth_getBlockByNumber`. Please use `%s q eth_getBlockByNumber` instead.\n", constants.BINARY_NAME)
18+
utils.PrintfStdErr("ERR: `block` is a deprecated alias of `eth_getBlockByNumber` and replaced by `evm-block`. Please use `%s q evm-block/eth_getBlockByNumber` instead.\n", constants.BINARY_NAME)
1919
os.Exit(1)
2020
},
2121
}
@@ -27,10 +27,40 @@ func GetDeprecatedAliasTxAsCommand() *cobra.Command {
2727
cmd := &cobra.Command{
2828
Use: "tx [hash]",
2929
Hidden: true,
30-
Short: "Deprecated and removed alias of `eth_getTransactionByHash`",
30+
Short: "Deprecated and removed alias of `eth_getTransactionByHash`, renamed to `evm-tx`",
3131
Args: cobra.ExactArgs(1),
3232
Run: func(cmd *cobra.Command, args []string) {
33-
utils.PrintfStdErr("ERR: `tx` is a deprecated alias of `eth_getTransactionByHash`. Please use `%s q eth_getTransactionByHash` instead.\n", constants.BINARY_NAME)
33+
utils.PrintfStdErr("ERR: `tx` is a deprecated alias of `eth_getTransactionByHash` and replaced by `evm-tx`. Please use `%s q evm-tx/eth_getTransactionByHash` instead.\n", constants.BINARY_NAME)
34+
os.Exit(1)
35+
},
36+
}
37+
38+
return cmd
39+
}
40+
41+
func GetDeprecatedAliasTraceAsCommand() *cobra.Command {
42+
cmd := &cobra.Command{
43+
Use: "trace [hash]",
44+
Hidden: true,
45+
Short: "Deprecated and removed alias of `debug_traceTransaction`, renamed to `evm-trace`",
46+
Args: cobra.ExactArgs(1),
47+
Run: func(cmd *cobra.Command, args []string) {
48+
utils.PrintfStdErr("ERR: `trace` is a deprecated alias of `debug_traceTransaction` and replaced by `evm-trace`. Please use `%s q evm-trace/debug_traceTransaction` instead.\n", constants.BINARY_NAME)
49+
os.Exit(1)
50+
},
51+
}
52+
53+
return cmd
54+
}
55+
56+
func GetDeprecatedAliasReceiptAsCommand() *cobra.Command {
57+
cmd := &cobra.Command{
58+
Use: "receipt [hash]",
59+
Hidden: true,
60+
Short: "Deprecated and removed alias of `eth_getTransactionReceipt`, renamed to `evm-receipt`",
61+
Args: cobra.ExactArgs(1),
62+
Run: func(cmd *cobra.Command, args []string) {
63+
utils.PrintfStdErr("ERR: `receipt` is a deprecated alias of `eth_getTransactionReceipt` and replaced by `evm-receipt`. Please use `%s q evm-receipt/eth_getTransactionReceipt` instead.\n", constants.BINARY_NAME)
3464
os.Exit(1)
3565
},
3666
}

cmd/query/eth_getBlockByNumber.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ const (
2222

2323
func GetQueryEvmRpcEthGetBlockByNumberCommand() *cobra.Command {
2424
cmd := &cobra.Command{
25-
Use: "eth_getBlockByNumber [height dec or 0xHex]",
26-
Short: "Query `eth_getBlockByNumber` from EVM RPC",
27-
Args: cobra.ExactArgs(1),
25+
Use: "eth_getBlockByNumber [height dec or 0xHex]",
26+
Aliases: []string{"evm-block"},
27+
Short: "Query `eth_getBlockByNumber` from EVM RPC",
28+
Args: cobra.ExactArgs(1),
2829
Run: func(cmd *cobra.Command, args []string) {
2930
_, evmRpc := flags.MustGetEthClient(cmd)
3031

cmd/query/eth_getTransactionByHash.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import (
1616

1717
func GetQueryEvmRpcEthGetTransactionByHashCommand() *cobra.Command {
1818
cmd := &cobra.Command{
19-
Use: "eth_getTransactionByHash [0xhash]",
20-
Short: "Query `eth_getTransactionByHash` from EVM RPC",
21-
Args: cobra.ExactArgs(1),
19+
Use: "eth_getTransactionByHash [0xhash]",
20+
Aliases: []string{"evm-tx"},
21+
Short: "Query `eth_getTransactionByHash` from EVM RPC",
22+
Args: cobra.ExactArgs(1),
2223
Run: func(cmd *cobra.Command, args []string) {
2324
ethClient, _ := flags.MustGetEthClient(cmd)
2425

cmd/query/eth_getTransactionReceipt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
func GetQueryEvmRpcEthGetTransactionReceiptCommand() *cobra.Command {
1818
cmd := &cobra.Command{
1919
Use: "eth_getTransactionReceipt [0xhash]",
20-
Aliases: []string{"receipt"},
20+
Aliases: []string{"evm-receipt"},
2121
Short: "Query `eth_getTransactionReceipt` from EVM RPC",
2222
Args: cobra.ExactArgs(1),
2323
Run: func(cmd *cobra.Command, args []string) {

cmd/query/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func Commands() *cobra.Command {
2626
// fake command for deprecated alias
2727
GetDeprecatedAliasBlockAsCommand(),
2828
GetDeprecatedAliasTxAsCommand(),
29+
GetDeprecatedAliasTraceAsCommand(),
30+
GetDeprecatedAliasReceiptAsCommand(),
2931
)
3032

3133
return cmd

0 commit comments

Comments
 (0)