diff options
author | aaronbuchwald <[email protected]> | 2020-11-04 12:25:20 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-04 12:25:20 -0500 |
commit | 24cf772145b7d976fff613a51b7d22f70fc1ac34 (patch) | |
tree | 484c281f203a286e5e6ac268e4c1db751662b5a0 /plugin/evm/service.go | |
parent | c613e21ea107e8369926f4b53b7830a9d5dabf18 (diff) | |
parent | e3c39e7cde79a0f5b080db026242056032a1f55a (diff) |
Merge pull request #47 from ava-labs/web3-apiv0.3.13
Add back web3 API
Diffstat (limited to 'plugin/evm/service.go')
-rw-r--r-- | plugin/evm/service.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugin/evm/service.go b/plugin/evm/service.go index a934941..7b8368e 100644 --- a/plugin/evm/service.go +++ b/plugin/evm/service.go @@ -19,11 +19,12 @@ import ( "github.com/ava-labs/avalanchego/utils/json" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + ethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" ) const ( - version = "coreth-v0.3.7" + version = "coreth" ) // test constants @@ -50,6 +51,15 @@ func (s *NetAPI) PeerCount() hexutil.Uint { return hexutil.Uint(0) } // TODO: re // Version returns the current ethereum protocol version. func (s *NetAPI) Version() string { return fmt.Sprintf("%d", s.vm.networkID) } +// Web3API offers helper API methods +type Web3API struct{} + +// ClientVersion returns the version of the vm running +func (s *Web3API) ClientVersion() string { return version } + +// Sha3 returns the bytes returned by hashing [input] with Keccak256 +func (s *Web3API) Sha3(input hexutil.Bytes) hexutil.Bytes { return ethcrypto.Keccak256(input) } + // GetAcceptedFrontReply defines the reply that will be sent from the // GetAcceptedFront API call type GetAcceptedFrontReply struct { |