aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/shared
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-06-22 18:47:32 +0800
committerBas van Kervel <bas@ethdev.com>2015-06-22 18:47:32 +0800
commit2e0b56a72b3eafc89938003da29c06496ac9ad4e (patch)
treeeba3eb3a822da0ba7de98d9c7b6dc8601a63db0a /rpc/shared
parent2737baa6577a337f33f020d587af100c9bda3585 (diff)
downloaddexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar.gz
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar.bz2
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar.lz
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar.xz
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.tar.zst
dexon-2e0b56a72b3eafc89938003da29c06496ac9ad4e.zip
added RPC start/stop support
Diffstat (limited to 'rpc/shared')
-rw-r--r--rpc/shared/types.go15
-rw-r--r--rpc/shared/utils.go28
2 files changed, 43 insertions, 0 deletions
diff --git a/rpc/shared/types.go b/rpc/shared/types.go
index dd38a4559..7c4b04e83 100644
--- a/rpc/shared/types.go
+++ b/rpc/shared/types.go
@@ -7,6 +7,21 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
)
+// 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(*Request) (interface{}, error)
+
+ // List of supported RCP methods this API provides
+ Methods() []string
+}
+
// RPC request
type Request struct {
Id interface{} `json:"id"`
diff --git a/rpc/shared/utils.go b/rpc/shared/utils.go
new file mode 100644
index 000000000..7953d6c22
--- /dev/null
+++ b/rpc/shared/utils.go
@@ -0,0 +1,28 @@
+package shared
+
+import "strings"
+
+const (
+ AdminApiName = "admin"
+ EthApiName = "eth"
+ DbApiName = "db"
+ DebugApiName = "debug"
+ MergedApiName = "merged"
+ MinerApiName = "miner"
+ NetApiName = "net"
+ ShhApiName = "shh"
+ TxPoolApiName = "txpool"
+ PersonalApiName = "personal"
+ Web3ApiName = "web3"
+
+ JsonRpcVersion = "2.0"
+)
+
+var (
+ // All API's
+ AllApis = strings.Join([]string{
+ AdminApiName, DbApiName, EthApiName, DebugApiName, MinerApiName, NetApiName,
+ ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName,
+ }, ",")
+)
+