Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/rpc/api/api.go

52 lines
1.0 KiB

package api
import (
"strings"
"github.com/ethereum/go-ethereum/rpc/shared"
)
const (
10 years ago
AdminApiName = "admin"
EthApiName = "eth"
10 years ago
DbApiName = "db"
DebugApiName = "debug"
MergedApiName = "merged"
MinerApiName = "miner"
NetApiName = "net"
10 years ago
ShhApiName = "shh"
TxPoolApiName = "txpool"
PersonalApiName = "personal"
Web3ApiName = "web3"
JsonRpcVersion = "2.0"
)
var (
// All API's
AllApis = strings.Join([]string{
10 years ago
AdminApiName, DbApiName, EthApiName, DebugApiName, MinerApiName, NetApiName,
10 years ago
ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName,
}, ",")
)
// Ethereum RPC API interface
type EthereumApi interface {
// API identifier
Name() string
// API version
ApiVersion() string
// Execute the given request and returns the response or an error
Execute(*shared.Request) (interface{}, error)
// List of supported RCP methods this API provides
Methods() []string
}
// Merge multiple API's to a single API instance
func Merge(apis ...EthereumApi) EthereumApi {
return newMergedApi(apis...)
}