aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-11 22:41:43 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-11 22:41:43 +0800
commite2c2d8e15ebef85c77f7486f92c6430ca6f30785 (patch)
tree1cd237e5aba5453c641a8d631cffd96c9eb08757 /cmd/geth
parent6609d45ef48ce1c2d2b0e73fa8fe5190d36e3920 (diff)
parentb3c07f167f8b82d1079abe6e15cd1f480712b030 (diff)
downloadgo-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.gz
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.bz2
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.lz
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.xz
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.tar.zst
go-tangerine-e2c2d8e15ebef85c77f7486f92c6430ca6f30785.zip
Merge pull request #1239 from bas-vk/rpc-apis
RPC refactoring
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/js.go11
-rw-r--r--cmd/geth/js_test.go2
-rw-r--r--cmd/geth/main.go10
3 files changed, 17 insertions, 6 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 706bc6554..7e6e10ca9 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -73,7 +73,7 @@ type jsre struct {
prompter
}
-func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, interactive bool, f xeth.Frontend) *jsre {
+func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain, ipcpath string, interactive bool, f xeth.Frontend) *jsre {
js := &jsre{ethereum: ethereum, ps1: "> "}
// set default cors domain used by startRpc from CLI flag
js.corsDomain = corsDomain
@@ -84,7 +84,7 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, interactive boo
js.wait = js.xeth.UpdateState()
// update state in separare forever blocks
js.re = re.New(libPath)
- js.apiBindings(f)
+ js.apiBindings(ipcpath, f)
js.adminBindings()
if !liner.TerminalSupported() || !interactive {
@@ -103,14 +103,15 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, interactive boo
return js
}
-func (js *jsre) apiBindings(f xeth.Frontend) {
+func (js *jsre) apiBindings(ipcpath string, f xeth.Frontend) {
xe := xeth.New(js.ethereum, f)
ethApi := rpc.NewEthereumApi(xe)
- jeth := rpc.NewJeth(ethApi, js.re)
+ jeth := rpc.NewJeth(ethApi, js.re, ipcpath)
js.re.Set("jeth", struct{}{})
t, _ := js.re.Get("jeth")
jethObj := t.Object()
+
jethObj.Set("send", jeth.Send)
jethObj.Set("sendAsync", jeth.Send)
@@ -119,7 +120,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) {
utils.Fatalf("Error loading bignumber.js: %v", err)
}
- err = js.re.Compile("ethereum.js", re.Ethereum_JS)
+ err = js.re.Compile("ethereum.js", re.Web3_JS)
if err != nil {
utils.Fatalf("Error loading ethereum.js: %v", err)
}
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index e7285a38d..20bde01f3 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -105,7 +105,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
t.Errorf("Error creating DocServer: %v", err)
}
tf := &testjethre{ds: ds, stateDb: ethereum.ChainManager().State().Copy()}
- repl := newJSRE(ethereum, assetPath, "", false, tf)
+ repl := newJSRE(ethereum, assetPath, "", "", false, tf)
tf.jsre = repl
return tmp, tf, ethereum
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 4d7d57220..8e55b310c 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -239,6 +239,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.RPCEnabledFlag,
utils.RPCListenAddrFlag,
utils.RPCPortFlag,
+ utils.IPCDisabledFlag,
+ utils.IPCApiFlag,
+ utils.IPCPathFlag,
utils.WhisperEnabledFlag,
utils.VMDebugFlag,
utils.ProtocolVersionFlag,
@@ -305,6 +308,7 @@ func console(ctx *cli.Context) {
ethereum,
ctx.String(utils.JSpathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
+ ctx.GlobalString(utils.IPCPathFlag.Name),
true,
nil,
)
@@ -326,6 +330,7 @@ func execJSFiles(ctx *cli.Context) {
ethereum,
ctx.String(utils.JSpathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
+ ctx.GlobalString(utils.IPCPathFlag.Name),
false,
nil,
)
@@ -382,6 +387,11 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) {
}
}
// Start auxiliary services if enabled.
+ if !ctx.GlobalBool(utils.IPCDisabledFlag.Name) {
+ if err := utils.StartIPC(eth, ctx); err != nil {
+ utils.Fatalf("Error string IPC: %v", err)
+ }
+ }
if ctx.GlobalBool(utils.RPCEnabledFlag.Name) {
if err := utils.StartRPC(eth, ctx); err != nil {
utils.Fatalf("Error starting RPC: %v", err)