From 95827544925bf758f9e2caebb24319a5e302faf2 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Wed, 15 Feb 2017 14:16:12 -0500 Subject: [PATCH] readding eth/exp cross compatibility --- eth/backend.go | 20 ++++++++++++++++++++ ethstats/ethstats.go | 2 +- internal/ethapi/solc.go | 6 ++++++ internal/jsre/deps/web3.js | 1 + internal/web3ext/web3ext.go | 1 + les/backend.go | 17 +++++++++++++++++ rpc/server.go | 4 ++-- 7 files changed, 48 insertions(+), 3 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 4758f7368d..c04cb04c95 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -352,6 +352,26 @@ func (s *Ethereum) APIs() []rpc.API { Version: "1.0", Service: s.netRPCService, Public: true, + }, { + Namespace: "exp", + Version: "1.0", + Service: NewPublicEthereumAPI(s), + Public: true, + }, { + Namespace: "exp", + Version: "1.0", + Service: NewPublicMinerAPI(s), + Public: true, + }, { + Namespace: "exp", + Version: "1.0", + Service: downloader.NewPublicDownloaderAPI(s.protocolManager.downloader, s.eventMux), + Public: true, + }, { + Namespace: "exp", + Version: "1.0", + Service: filters.NewPublicFilterAPI(s.ApiBackend, false), + Public: true, }, }...) } diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index f3cd7be440..9ce8f81849 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -302,7 +302,7 @@ func (s *Service) login(in *json.Decoder, out *json.Encoder) error { infos := s.server.NodeInfo() var network, protocol string - if info := infos.Protocols["eth"]; info != nil { + if info := infos.Protocols["exp"]; info != nil { network = strconv.Itoa(info.(*eth.EthNodeInfo).Network) protocol = fmt.Sprintf("eth/%d", eth.ProtocolVersions[0]) } else { diff --git a/internal/ethapi/solc.go b/internal/ethapi/solc.go index b323a18981..0004f51f35 100644 --- a/internal/ethapi/solc.go +++ b/internal/ethapi/solc.go @@ -32,6 +32,12 @@ func makeCompilerAPIs(solcPath string) []rpc.API { Service: (*PublicCompilerAPI)(c), Public: true, }, + { + Namespace: "exp", + Version: "1.0", + Service: (*PublicCompilerAPI)(c), + Public: true, + }, { Namespace: "admin", Version: "1.0", diff --git a/internal/jsre/deps/web3.js b/internal/jsre/deps/web3.js index 3a89794fc5..03c3e90ced 100644 --- a/internal/jsre/deps/web3.js +++ b/internal/jsre/deps/web3.js @@ -2499,6 +2499,7 @@ function Web3 (provider) { this._requestManager = new RequestManager(provider); this.currentProvider = provider; this.eth = new Eth(this); + this.exp = this.eth; this.db = new DB(this); this.shh = new Shh(this); this.net = new Net(this); diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 8a546d447d..793f10a0ef 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -22,6 +22,7 @@ var Modules = map[string]string{ "chequebook": Chequebook_JS, "debug": Debug_JS, "eth": Eth_JS, + "exp": Eth_JS, "miner": Miner_JS, "net": Net_JS, "personal": Personal_JS, diff --git a/les/backend.go b/les/backend.go index 674e6e7e41..1a1b6175be 100644 --- a/les/backend.go +++ b/les/backend.go @@ -160,7 +160,24 @@ func (s *LightEthereum) APIs() []rpc.API { Version: "1.0", Service: filters.NewPublicFilterAPI(s.ApiBackend, true), Public: true, + }, + { + Namespace: "exp", + Version: "1.0", + Service: &LightDummyAPI{}, + Public: true, }, { + Namespace: "exp", + Version: "1.0", + Service: downloader.NewPublicDownloaderAPI(s.protocolManager.downloader, s.eventMux), + Public: true, + }, { + Namespace: "exp", + Version: "1.0", + Service: filters.NewPublicFilterAPI(s.ApiBackend, true), + Public: true, + }, + { Namespace: "net", Version: "1.0", Service: s.netRPCService, diff --git a/rpc/server.go b/rpc/server.go index 717936bd5a..41dedbe1db 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -32,8 +32,8 @@ const ( notificationBufferSize = 10000 // max buffered notifications before codec is closed MetadataApi = "rpc" - DefaultIPCApis = "admin,debug,eth,miner,net,personal,shh,txpool,web3" - DefaultHTTPApis = "eth,net,web3" + DefaultIPCApis = "admin,debug,eth,exp,miner,net,personal,shh,txpool,web3" + DefaultHTTPApis = "eth,exp,net,web3" ) // CodecOption specifies which type of messages this codec supports