aboutsummaryrefslogtreecommitdiffstats
path: root/dex/backend.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-16 19:22:12 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:23:39 +0800
commitab284ca86e5181cbd009aaa1e9b49d56eb532f97 (patch)
treeb2192f4c344db436e32d64a346d016d9a6289974 /dex/backend.go
parent9cba523a12858576bc2d45fd52c5530b5c1e7de6 (diff)
downloadgo-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar.gz
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar.bz2
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar.lz
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar.xz
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.tar.zst
go-tangerine-ab284ca86e5181cbd009aaa1e9b49d56eb532f97.zip
dex: register ethereum APIs
Diffstat (limited to 'dex/backend.go')
-rw-r--r--dex/backend.go39
1 files changed, 38 insertions, 1 deletions
diff --git a/dex/backend.go b/dex/backend.go
index 81ac272a0..ecc8ace2d 100644
--- a/dex/backend.go
+++ b/dex/backend.go
@@ -35,6 +35,7 @@ import (
"github.com/dexon-foundation/dexon/core/vm"
"github.com/dexon-foundation/dexon/dex/gasprice"
"github.com/dexon-foundation/dexon/eth/downloader"
+ "github.com/dexon-foundation/dexon/eth/filters"
"github.com/dexon-foundation/dexon/ethdb"
"github.com/dexon-foundation/dexon/event"
"github.com/dexon-foundation/dexon/internal/ethapi"
@@ -177,7 +178,43 @@ func (s *Dexon) Protocols() []p2p.Protocol {
}
func (s *Dexon) APIs() []rpc.API {
- return nil
+ apis := ethapi.GetAPIs(s.APIBackend)
+
+ // Append any APIs exposed explicitly by the consensus engine
+ apis = append(apis, s.engine.APIs(s.BlockChain())...)
+
+ // Append all the local APIs and return
+ return append(apis, []rpc.API{
+ {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: downloader.NewPublicDownloaderAPI(s.protocolManager.downloader, s.eventMux),
+ Public: true,
+ }, {
+ Namespace: "eth",
+ Version: "1.0",
+ Service: filters.NewPublicFilterAPI(s.APIBackend, false),
+ Public: true,
+ }, {
+ Namespace: "admin",
+ Version: "1.0",
+ Service: NewPrivateAdminAPI(s),
+ }, {
+ Namespace: "debug",
+ Version: "1.0",
+ Service: NewPublicDebugAPI(s),
+ Public: true,
+ }, {
+ Namespace: "debug",
+ Version: "1.0",
+ Service: NewPrivateDebugAPI(s.chainConfig, s),
+ }, {
+ Namespace: "net",
+ Version: "1.0",
+ Service: s.netRPCService,
+ Public: true,
+ },
+ }...)
}
func (s *Dexon) Start(srvr *p2p.Server) error {