aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm.go
diff options
context:
space:
mode:
authorAaron Buchwald <[email protected]>2020-10-20 11:57:31 -0400
committerAaron Buchwald <[email protected]>2020-10-20 11:57:31 -0400
commit6da65c2173e6da457423d67e958ce153c5598a17 (patch)
treea4e89b92bdebee9f7a2522a0bf0cf1ada394c9c5 /plugin/evm/vm.go
parenta02b51064dcb5e4fe062237635d2b986591630f0 (diff)
Add CLI config to coreth plugin
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r--plugin/evm/vm.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index f19c105..a6370e1 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -154,6 +154,8 @@ func init() {
type VM struct {
ctx *snow.Context
+ CLIConfig CommandLineConfig
+
chainID *big.Int
networkID uint64
genesisHash common.Hash
@@ -512,12 +514,17 @@ func newHandler(name string, service interface{}, lockOption ...commonEng.LockOp
// CreateHandlers makes new http handlers that can handle API calls
func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler {
handler := vm.chain.NewRPCHandler()
- vm.chain.AttachEthService(handler, []string{"eth", "personal", "txpool"})
- handler.RegisterName("net", &NetAPI{vm})
- handler.RegisterName("snowman", &SnowmanAPI{vm})
- handler.RegisterName("web3", &Web3API{})
- handler.RegisterName("debug", &DebugAPI{vm})
- handler.RegisterName("admin", &admin.Performance{})
+ vm.chain.AttachEthService(handler, vm.CLIConfig.EthAPIs())
+
+ if vm.CLIConfig.SnowmanAPIEnabled {
+ handler.RegisterName("snowman", &SnowmanAPI{vm})
+ }
+ if vm.CLIConfig.Web3APIEnabled {
+ handler.RegisterName("web3", &Web3API{})
+ }
+ if vm.CLIConfig.CorethAdminAPIEnabled {
+ handler.RegisterName("admin", &admin.Performance{})
+ }
return map[string]*commonEng.HTTPHandler{
"/rpc": {LockOptions: commonEng.NoLock, Handler: handler},