diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-10-16 19:22:12 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:50 +0800 |
commit | 06fd0255cd83497c43b6c25aff3be470d0a3c91a (patch) | |
tree | 4a136e803fbe139228958dbf17267d0fdd0a90b5 /dex/backend.go | |
parent | cbc8f1ac578845341b02563210184ff849c38c22 (diff) | |
download | dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar.gz dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar.bz2 dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar.lz dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar.xz dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.tar.zst dexon-06fd0255cd83497c43b6c25aff3be470d0a3c91a.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 { |