Skip to content

Commit 27116bd

Browse files
committed
Merge pull request #2462 from fjl/rpc-remove-js
rpc: move web3.js extensions to internal/web3ext
2 parents 16d10aa + e728aac commit 27116bd

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

cmd/geth/js.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/ethereum/go-ethereum/common"
3333
"github.com/ethereum/go-ethereum/common/registrar"
3434
"github.com/ethereum/go-ethereum/eth"
35+
"github.com/ethereum/go-ethereum/internal/web3ext"
3536
re "github.com/ethereum/go-ethereum/jsre"
3637
"github.com/ethereum/go-ethereum/node"
3738
"github.com/ethereum/go-ethereum/rpc"
@@ -202,7 +203,7 @@ func (js *jsre) apiBindings() error {
202203
continue // manually mapped or ignore
203204
}
204205

205-
if jsFile, ok := rpc.WEB3Extensions[apiName]; ok {
206+
if jsFile, ok := web3ext.Modules[apiName]; ok {
206207
if err = js.re.Compile(fmt.Sprintf("%s.js", apiName), jsFile); err == nil {
207208
shortcuts += fmt.Sprintf("var %s = web3.%s; ", apiName, apiName)
208209
} else {

rpc/javascript.go renamed to internal/web3ext/web3ext.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
package rpc
17+
// package web3ext contains geth specific web3.js extensions.
18+
package web3ext
1819

19-
var (
20-
// Holds geth specific RPC extends which can be used to extend web3
21-
WEB3Extensions = map[string]string{
22-
"txpool": TxPool_JS,
23-
"admin": Admin_JS,
24-
"eth": Eth_JS,
25-
"miner": Miner_JS,
26-
"debug": Debug_JS,
27-
"net": Net_JS,
28-
}
29-
)
20+
var Modules = map[string]string{
21+
"txpool": TxPool_JS,
22+
"admin": Admin_JS,
23+
"eth": Eth_JS,
24+
"miner": Miner_JS,
25+
"debug": Debug_JS,
26+
"net": Net_JS,
27+
}
3028

3129
const TxPool_JS = `
3230
web3._extend({

0 commit comments

Comments
 (0)