aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/config.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/config.go
parenta02b51064dcb5e4fe062237635d2b986591630f0 (diff)
Add CLI config to coreth plugin
Diffstat (limited to 'plugin/evm/config.go')
-rw-r--r--plugin/evm/config.go35
1 files changed, 35 insertions, 0 deletions
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
+}