aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/config.go
blob: 4669807c41fd8bcf04d88fea95e11d733ba11a3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
}