diff options
author | aaronbuchwald <[email protected]> | 2020-10-26 22:03:05 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-26 22:03:05 -0400 |
commit | 806d04e9aa4b6e22fc2a484ada6fecb0c9a348e3 (patch) | |
tree | 36822cea4b16638e6a246af209ccdf77b3eb2088 /plugin/evm/config.go | |
parent | 8a8ef56dd1a0f2cd28c6d4b3a579b16cdda6e2cf (diff) | |
parent | cccb47666b2bccce378a9a56824061ea3a9a95fa (diff) |
Merge pull request #43 from ava-labs/handle-block-number-requests
Handle block number requests
Diffstat (limited to 'plugin/evm/config.go')
-rw-r--r-- | plugin/evm/config.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugin/evm/config.go b/plugin/evm/config.go new file mode 100644 index 0000000..4669807 --- /dev/null +++ b/plugin/evm/config.go @@ -0,0 +1,39 @@ +package evm + +// CommandLineConfig ... +type CommandLineConfig struct { + // Coreth APIs + SnowmanAPIEnabled bool `json:"snowmanAPIEnabled"` + 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"` + 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 +} |