diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-11 22:41:43 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-11 22:41:43 +0800 |
commit | e2c2d8e15ebef85c77f7486f92c6430ca6f30785 (patch) | |
tree | 1cd237e5aba5453c641a8d631cffd96c9eb08757 /rpc/api/api.go | |
parent | 6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920 (diff) | |
parent | b3c07f167f8b82d1079abe6e15cd1f480712b030 (diff) | |
download | dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.gz dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.bz2 dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.lz dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.xz dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.zst dexon-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.zip |
Merge pull request #1239 from bas-vk/rpc-apis
RPC refactoring
Diffstat (limited to 'rpc/api/api.go')
-rw-r--r-- | rpc/api/api.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/rpc/api/api.go b/rpc/api/api.go new file mode 100644 index 000000000..e431e5c1e --- /dev/null +++ b/rpc/api/api.go @@ -0,0 +1,48 @@ +package api + +import ( + "strings" + + "github.com/ethereum/go-ethereum/rpc/shared" +) + +const ( + AdminApiName = "admin" + EthApiName = "eth" + DebugApiName = "debug" + MergedApiName = "merged" + MinerApiName = "miner" + NetApiName = "net" + ShhApiName = "shh" + TxPoolApiName = "txpool" + PersonalApiName = "personal" + Web3ApiName = "web3" +) + +var ( + // List with all API's which are offered over the IPC interface by default + DefaultIpcApis = strings.Join([]string{ + AdminApiName, EthApiName, DebugApiName, MinerApiName, NetApiName, + 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...) +} |