rpc: move web3.js extensions to internal/web3ext
This commit is contained in:
parent
6197fbf8d7
commit
e728aaca72
@ -32,6 +32,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/registrar"
|
"github.com/ethereum/go-ethereum/common/registrar"
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
"github.com/ethereum/go-ethereum/eth"
|
||||||
|
"github.com/ethereum/go-ethereum/internal/web3ext"
|
||||||
re "github.com/ethereum/go-ethereum/jsre"
|
re "github.com/ethereum/go-ethereum/jsre"
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
@ -202,7 +203,7 @@ func (js *jsre) apiBindings() error {
|
|||||||
continue // manually mapped or ignore
|
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 {
|
if err = js.re.Compile(fmt.Sprintf("%s.js", apiName), jsFile); err == nil {
|
||||||
shortcuts += fmt.Sprintf("var %s = web3.%s; ", apiName, apiName)
|
shortcuts += fmt.Sprintf("var %s = web3.%s; ", apiName, apiName)
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,19 +14,17 @@
|
|||||||
// You should have received a copy of the GNU Lesser General Public License
|
// 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/>.
|
// 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 (
|
var Modules = map[string]string{
|
||||||
// Holds geth specific RPC extends which can be used to extend web3
|
"txpool": TxPool_JS,
|
||||||
WEB3Extensions = map[string]string{
|
"admin": Admin_JS,
|
||||||
"txpool": TxPool_JS,
|
"eth": Eth_JS,
|
||||||
"admin": Admin_JS,
|
"miner": Miner_JS,
|
||||||
"eth": Eth_JS,
|
"debug": Debug_JS,
|
||||||
"miner": Miner_JS,
|
"net": Net_JS,
|
||||||
"debug": Debug_JS,
|
}
|
||||||
"net": Net_JS,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const TxPool_JS = `
|
const TxPool_JS = `
|
||||||
web3._extend({
|
web3._extend({
|
Loading…
Reference in New Issue
Block a user