api.go 662 B

1234567891011121314151617181920212223242526272829
  1. package api
  2. import "github.com/ethereum/go-ethereum/rpc/shared"
  3. const (
  4. // List with all API's which are offered over the IPC interface by default
  5. DefaultIpcApis = "eth,web3"
  6. EthApiName = "eth"
  7. MergedApiName = "merged"
  8. Web3ApiName = "web3"
  9. )
  10. // Ethereum RPC API interface
  11. type EthereumApi interface {
  12. // API identifier
  13. Name() string
  14. // Execute the given request and returns the response or an error
  15. Execute(*shared.Request) (interface{}, error)
  16. // List of supported RCP methods this API provides
  17. Methods() []string
  18. }
  19. // Merge multiple API's to a single API instance
  20. func Merge(apis ...EthereumApi) EthereumApi {
  21. return newMergedApi(apis...)
  22. }