laconicd/ethereum/rpc/namespaces/web3/api.go
crypto-facs 1c06553746
rpc: namespaces refractor (#170)
* refactor: rpc namespace refactor - txpool

* refactor: rpc namespace refactor - net

* refactor: rpc namespace refactor - web3

* refactor: rpc namespace refactor - eth

* refactor: rpc namespace refactor - personal

* fix: api to uppercase

* fix: fix import cycle

* fix: fix import cycle
2021-06-23 02:38:05 -04:00

27 lines
673 B
Go

package web3
import (
"github.com/tharsis/ethermint/version"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
// PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec.
type PublicAPI struct{}
// NewPublicAPI creates an instance of the Web3 API.
func NewPublicAPI() *PublicAPI {
return &PublicAPI{}
}
// ClientVersion returns the client version in the Web3 user agent format.
func (a *PublicAPI) ClientVersion() string {
return version.Version()
}
// Sha3 returns the keccak-256 hash of the passed-in input.
func (a *PublicAPI) Sha3(input hexutil.Bytes) hexutil.Bytes {
return crypto.Keccak256(input)
}