aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-10-15 22:07:19 +0800
committerBas van Kervel <bas@ethdev.com>2015-12-14 23:34:05 +0800
commiteae81465c1c815c317cd30e4de6bdf4d59df2340 (patch)
treeb6f4b7787967a58416171adb79fd12ac29d89577 /eth/backend.go
parent8db9d44ca9fb6baf406256cae491c475de2f4989 (diff)
downloadgo-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.gz
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.bz2
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.lz
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.xz
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.zst
go-tangerine-eae81465c1c815c317cd30e4de6bdf4d59df2340.zip
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)
}