aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
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)
}