From 6da65c2173e6da457423d67e958ce153c5598a17 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 20 Oct 2020 11:57:31 -0400 Subject: Add CLI config to coreth plugin --- plugin/evm/config.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 plugin/evm/config.go (limited to 'plugin/evm/config.go') diff --git a/plugin/evm/config.go b/plugin/evm/config.go new file mode 100644 index 0000000..909992a --- /dev/null +++ b/plugin/evm/config.go @@ -0,0 +1,35 @@ +package evm + +// CommandLineConfig ... +type CommandLineConfig struct { + // Coreth APIs + SnowmanAPIEnabled bool `json:"snowmanAPIEnabled"` + Web3APIEnabled bool `json:"web3APIEnabled"` + CorethAdminAPIEnabled bool `json:"corethAdminAPIEnabled"` + + // Eth APIs + EthAPIEnabled bool `json:"ethAPIEnabled"` + PersonalAPIEnabled bool `json:"personalAPIEnabled"` + TxPoolAPIEnabled bool `json:"txPoolAPIEnabled"` + DebugAPIEnabled bool `json:"debugAPIEnabled"` +} + +// EthAPIs returns an array of strings representing the Eth APIs that should be enabled +func (c CommandLineConfig) EthAPIs() []string { + ethAPIs := make([]string, 0) + + if c.EthAPIEnabled { + ethAPIs = append(ethAPIs, "eth") + } + if c.PersonalAPIEnabled { + ethAPIs = append(ethAPIs, "personal") + } + if c.TxPoolAPIEnabled { + ethAPIs = append(ethAPIs, "txpool") + } + if c.DebugAPIEnabled { + ethAPIs = append(ethAPIs, "debug") + } + + return ethAPIs +} -- cgit v1.2.3 From cccb47666b2bccce378a9a56824061ea3a9a95fa Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Tue, 20 Oct 2020 12:20:49 -0400 Subject: Add RPC GasCap and TxFeeCap to CLI config --- plugin/evm/config.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugin/evm/config.go') diff --git a/plugin/evm/config.go b/plugin/evm/config.go index 909992a..4669807 100644 --- a/plugin/evm/config.go +++ b/plugin/evm/config.go @@ -7,6 +7,10 @@ type CommandLineConfig struct { Web3APIEnabled bool `json:"web3APIEnabled"` CorethAdminAPIEnabled bool `json:"corethAdminAPIEnabled"` + // Coreth API Gas/Price Caps + RPCGasCap uint64 `json:"rpcGasCap"` + RPCTxFeeCap float64 `json:"rpcTxFeeCap"` + // Eth APIs EthAPIEnabled bool `json:"ethAPIEnabled"` PersonalAPIEnabled bool `json:"personalAPIEnabled"` -- cgit v1.2.3