aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-12-15 00:38:10 +0800
committerFelix Lange <fjl@twurst.com>2015-12-15 00:38:10 +0800
commitfa187a366dda1894179635eeec2a929bfacc4ad3 (patch)
tree4494d4dcded47dd49f2fe7374e85fefa9249246e /eth/backend.go
parent787d71d6595df98586c625e82f4decb034215203 (diff)
parenteae81465c1c815c317cd30e4de6bdf4d59df2340 (diff)
downloaddexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.gz
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.bz2
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.lz
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.xz
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.zst
dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.zip
Merge pull request #2035 from bas-vk/rcp-v2-rebase
rpc: new RPC implementation with pub/sub support
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 91f02db72..ad98635a5 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/downloader"
+ "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
@@ -43,6 +44,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
+ rpc "github.com/ethereum/go-ethereum/rpc/v2"
)
const (
@@ -239,6 +241,64 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
return eth, nil
}
+// APIs returns the collection of RPC services the ethereum package offers.
+// NOTE, some of these services probably need to be moved to somewhere else.
+func (s *Ethereum) APIs() []rpc.API {
+ return []rpc.API{
+ {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: NewPublicEthereumAPI(s),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: NewPublicAccountAPI(s.AccountManager()),
+ Public: true,
+ }, {
+ Namespace: "personal",
+ Version: "1.0",
+ Service: NewPrivateAccountAPI(s.AccountManager()),
+ Public: false,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: NewPublicBlockChainAPI(s.BlockChain(), s.ChainDb(), s.EventMux(), s.AccountManager()),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: NewPublicTransactionPoolAPI(s.TxPool(), s.ChainDb(), s.EventMux(), s.BlockChain(), s.AccountManager()),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: miner.NewPublicMinerAPI(s.Miner()),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: downloader.NewPublicDownloaderAPI(s.Downloader()),
+ Public: true,
+ }, {
+ Namespace: "miner",
+ Version: "1.0",
+ Service: NewPrivateMinerAPI(s),
+ Public: false,
+ }, {
+ Namespace: "txpool",
+ Version: "1.0",
+ Service: NewPublicTxPoolAPI(s),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: filters.NewPublicFilterAPI(s.ChainDb(), s.EventMux()),
+ Public: true,
+ },
+ }
+}
+
func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) {
s.blockchain.ResetWithGenesisBlock(gb)
}