rpc, evm: refactor (#588)

* stargate: refactor

* remove evm CLI

* rpc: refactor

* more fixes

* fixes fixes fixes

* changelog

* refactor according to namespaces

* fix

* lint

* remove export logic

* fix rpc test

* godoc
This commit is contained in:
Federico Kunze
2020-10-22 17:39:51 -03:00
committed by GitHub
parent be09a6ee1b
commit 4501bbccdc
36 changed files with 2396 additions and 2587 deletions
+31
View File
@@ -0,0 +1,31 @@
package net
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/context"
ethermint "github.com/cosmos/ethermint/types"
)
// PublicNetAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.
type PublicNetAPI struct {
networkVersion uint64
}
// NewAPI creates an instance of the public Net Web3 API.
func NewAPI(clientCtx context.CLIContext) *PublicNetAPI {
// parse the chainID from a integer string
chainIDEpoch, err := ethermint.ParseChainID(clientCtx.ChainID)
if err != nil {
panic(err)
}
return &PublicNetAPI{
networkVersion: chainIDEpoch.Uint64(),
}
}
// Version returns the current ethereum protocol version.
func (api *PublicNetAPI) Version() string {
return fmt.Sprintf("%d", api.networkVersion)
}