rpc: protocol version (#575)

* evm: protocol version

* changelog

* version

* fix

* support latest version only
This commit is contained in:
Federico Kunze
2020-12-08 20:51:26 +01:00
committed by GitHub
parent 3bb76e8533
commit ef1bef16e5
10 changed files with 20 additions and 60 deletions
+1 -2
View File
@@ -17,7 +17,6 @@ import (
rpctypes "github.com/cosmos/ethermint/rpc/types"
ethermint "github.com/cosmos/ethermint/types"
"github.com/cosmos/ethermint/utils"
"github.com/cosmos/ethermint/version"
evmtypes "github.com/cosmos/ethermint/x/evm/types"
abci "github.com/tendermint/tendermint/abci/types"
@@ -124,7 +123,7 @@ func (api *PublicEthereumAPI) SetKeys(keys []ethsecp256k1.PrivKey) {
// ProtocolVersion returns the supported Ethereum protocol version.
func (api *PublicEthereumAPI) ProtocolVersion() hexutil.Uint {
api.logger.Debug("eth_protocolVersion")
return hexutil.Uint(version.ProtocolVersion)
return hexutil.Uint(ethermint.ProtocolVersion)
}
// ChainId returns the chain's identifier in hex format
+6 -3
View File
@@ -1,23 +1,26 @@
package web3
import (
"github.com/cosmos/ethermint/version"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/cosmos/cosmos-sdk/version"
)
// PublicWeb3API is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec.
type PublicWeb3API struct{}
// New creates an instance of the Web3 API.
// NewAPI creates an instance of the Web3 API.
func NewAPI() *PublicWeb3API {
return &PublicWeb3API{}
}
// ClientVersion returns the client version in the Web3 user agent format.
func (PublicWeb3API) ClientVersion() string {
return version.ClientVersion()
info := version.NewInfo()
return fmt.Sprintf("%s-%s", info.Name, info.Version)
}
// Sha3 returns the keccak-256 hash of the passed-in input.