aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-04-16 00:13:24 +0800
committerFelix Lange <fjl@twurst.com>2016-04-16 00:13:24 +0800
commit27116bd46cbc14a8eec9e1818945f1f10b9b834a (patch)
treec8bb256db634a0b6d8f55296e6a047f074b7337b
parent16d10aae0c67e79179cb2f7b51c593420b6b59f6 (diff)
parente728aaca7249809a3d4a14f53aa288c91c340eba (diff)
downloadgo-tangerine-27116bd46cbc14a8eec9e1818945f1f10b9b834a.tar.gz
go-tangerine-27116bd46cbc14a8eec9e1818945f1f10b9b834a.tar.zst
go-tangerine-27116bd46cbc14a8eec9e1818945f1f10b9b834a.zip
Merge pull request #2462 from fjl/rpc-remove-js
rpc: move web3.js extensions to internal/web3ext
-rw-r--r--cmd/geth/js.go3
-rw-r--r--internal/web3ext/web3ext.go (renamed from rpc/javascript.go)22
2 files changed, 12 insertions, 13 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 95cf85e4b..767b513c1 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/registrar"
"github.com/ethereum/go-ethereum/eth"
+ "github.com/ethereum/go-ethereum/internal/web3ext"
re "github.com/ethereum/go-ethereum/jsre"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rpc"
@@ -202,7 +203,7 @@ func (js *jsre) apiBindings() error {
continue // manually mapped or ignore
}
- if jsFile, ok := rpc.WEB3Extensions[apiName]; ok {
+ if jsFile, ok := web3ext.Modules[apiName]; ok {
if err = js.re.Compile(fmt.Sprintf("%s.js", apiName), jsFile); err == nil {
shortcuts += fmt.Sprintf("var %s = web3.%s; ", apiName, apiName)
} else {
diff --git a/rpc/javascript.go b/internal/web3ext/web3ext.go
index 4d2bd1cde..bc1e46921 100644
--- a/rpc/javascript.go
+++ b/internal/web3ext/web3ext.go
@@ -14,19 +14,17 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-package rpc
+// package web3ext contains geth specific web3.js extensions.
+package web3ext
-var (
- // Holds geth specific RPC extends which can be used to extend web3
- WEB3Extensions = map[string]string{
- "txpool": TxPool_JS,
- "admin": Admin_JS,
- "eth": Eth_JS,
- "miner": Miner_JS,
- "debug": Debug_JS,
- "net": Net_JS,
- }
-)
+var Modules = map[string]string{
+ "txpool": TxPool_JS,
+ "admin": Admin_JS,
+ "eth": Eth_JS,
+ "miner": Miner_JS,
+ "debug": Debug_JS,
+ "net": Net_JS,
+}
const TxPool_JS = `
web3._extend({