@@ -21,11 +21,15 @@ func GetQueryEvmRpcEthCallCommand() *cobra.Command {
2121 cmd := & cobra.Command {
2222 Use : "eth_call [contract address] [call data]" ,
2323 Short : "Call `eth_call` of EVM RPC: executes a new EVM message call immediately without creating a transaction on the block chain" ,
24- Args : cobra .ExactArgs (2 ),
24+ Long : `Call "eth_call" of EVM RPC: executes a new EVM message call immediately without creating a transaction on the block chain.
25+ Bech32 account address is accepted.` ,
26+ Args : cobra .ExactArgs (2 ),
2527 Run : func (cmd * cobra.Command , args []string ) {
2628 ethClient , _ := flags .MustGetEthClient (cmd )
2729
28- contractAddress := common .HexToAddress (args [0 ])
30+ evmAddrs , err := utils .GetEvmAddressFromAnyFormatAddress (args [0 ])
31+ utils .ExitOnErr (err , "failed to parse contract address" )
32+ contractAddress := evmAddrs [0 ]
2933 callData , err := hex .DecodeString (strings .TrimPrefix (strings .ToLower (args [1 ]), "0x" ))
3034 utils .ExitOnErr (err , "failed to decode call data" )
3135
@@ -44,7 +48,9 @@ func GetQueryEvmRpcEthCallCommand() *cobra.Command {
4448 if from == "" {
4549 return common.Address {}
4650 }
47- fromAddr := common .HexToAddress (from )
51+ evmAddrs , err := utils .GetEvmAddressFromAnyFormatAddress (from )
52+ utils .ExitOnErr (err , fmt .Sprintf ("failed to parse address of --%s" , flagFrom ))
53+ fromAddr := evmAddrs [0 ]
4854 utils .PrintfStdErr ("INF: using from: %s\n " , fromAddr )
4955 return fromAddr
5056 }(),
@@ -62,9 +68,9 @@ func GetQueryEvmRpcEthCallCommand() *cobra.Command {
6268 }(),
6369 GasPrice : func () * big.Int {
6470 gasPrice , err := flags .ReadFlagShortIntOrHexOrNil (cmd , flags .FlagGasPrices )
65- utils .ExitOnErr (err , "failed to parse gas price " )
71+ utils .ExitOnErr (err , "failed to parse gas prices " )
6672 if gasPrice != nil && gasPrice .Sign () == 1 {
67- utils .PrintfStdErr ("INF: using gas-price : %s\n " , gasPrice )
73+ utils .PrintfStdErr ("INF: using gas-prices : %s\n " , gasPrice )
6874 }
6975 return gasPrice
7076 }(),
@@ -88,7 +94,7 @@ func GetQueryEvmRpcEthCallCommand() *cobra.Command {
8894 }
8995
9096 cmd .Flags ().String (flags .FlagEvmRpc , "" , flags .FlagEvmRpcDesc )
91- cmd .Flags ().StringP (flagFrom , "f" , "" , "the address from which the transaction is sent" )
97+ cmd .Flags ().StringP (flagFrom , "f" , "" , "the address from which the transaction is sent, support 0x or bech32 " )
9298 cmd .Flags ().StringP (flags .FlagGasLimit , "g" , "" , "gas provided for the transaction execution, support short int and hex" )
9399 cmd .Flags ().StringP (flags .FlagGasPrices , "p" , "" , "gas prices used for each paid gas, support short int and hex" )
94100 cmd .Flags ().StringP (flagValue , "v" , "" , "value sent with this transaction, support short int and hex" )
0 commit comments