diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-10-16 19:22:12 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 0c555d3f347dc8458ddae614b093c9b11d54e629 (patch) | |
tree | 177cb25ac9272234f70f780c41232daf31a8a31e /dex/backend.go | |
parent | ddad85b3ea5cfb8aa22c8e208a4d29a2a591194d (diff) | |
download | dexon-0c555d3f347dc8458ddae614b093c9b11d54e629.tar.gz dexon-0c555d3f347dc8458ddae614b093c9b11d54e629.tar.zst dexon-0c555d3f347dc8458ddae614b093c9b11d54e629.zip |
dex: register ethereum APIs
Diffstat (limited to 'dex/backend.go')
-rw-r--r-- | dex/backend.go | 39 |
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 { |