laconicd/rpc/ethereum/namespaces/web3/api.go
Daniel Burckhardt 34c2593e43
rpc: restructure JSON-RPC directory and rename server config (#612)
* Restructure ethermint/rpc repo structure and change import statements

* Add #400 to changelog

* fix filepath in util and json_rpc

* Move #400  to unreleased section
2021-10-01 14:49:22 +00: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)
}