aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-12-15 00:38:10 +0800
committerFelix Lange <fjl@twurst.com>2015-12-15 00:38:10 +0800
commitfa187a366dda1894179635eeec2a929bfacc4ad3 (patch)
tree4494d4dcded47dd49f2fe7374e85fefa9249246e /cmd/geth
parent787d71d6595df98586c625e82f4decb034215203 (diff)
parenteae81465c1c815c317cd30e4de6bdf4d59df2340 (diff)
downloadgo-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.gz
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.bz2
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.lz
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.xz
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.zst
go-tangerine-fa187a366dda1894179635eeec2a929bfacc4ad3.zip
Merge pull request #2035 from bas-vk/rcp-v2-rebase
rpc: new RPC implementation with pub/sub support
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/js.go22
-rw-r--r--cmd/geth/js_test.go2
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/geth/usage.go1
4 files changed, 22 insertions, 4 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 843c9a5b5..56b7a8b00 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -246,10 +246,10 @@ func (self *jsre) welcome() {
self.re.Run(`
(function () {
console.log('instance: ' + web3.version.node);
- console.log(' datadir: ' + admin.datadir);
console.log("coinbase: " + eth.coinbase);
var ts = 1000 * eth.getBlock(eth.blockNumber).timestamp;
console.log("at block: " + eth.blockNumber + " (" + new Date(ts) + ")");
+ console.log(' datadir: ' + admin.datadir);
})();
`)
if modules, err := self.supportedApis(); err == nil {
@@ -258,7 +258,7 @@ func (self *jsre) welcome() {
loadedModules = append(loadedModules, fmt.Sprintf("%s:%s", api, version))
}
sort.Strings(loadedModules)
- fmt.Println("modules:", strings.Join(loadedModules, " "))
+
}
}
@@ -325,12 +325,28 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
}
_, err = js.re.Run(shortcuts)
-
if err != nil {
utils.Fatalf("Error setting namespaces: %v", err)
}
js.re.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`)
+
+ // overrule some of the methods that require password as input and ask for it interactively
+ p, err := js.re.Get("personal")
+ if err != nil {
+ fmt.Println("Unable to overrule sensitive methods in personal module")
+ return nil
+ }
+
+ // Override the unlockAccount and newAccount methods on the personal object since these require user interaction.
+ // Assign the jeth.unlockAccount and jeth.newAccount in the jsre the original web3 callbacks. These will be called
+ // by the jeth.* methods after they got the password from the user and send the original web3 request to the backend.
+ persObj := p.Object()
+ js.re.Run(`jeth.unlockAccount = personal.unlockAccount;`)
+ persObj.Set("unlockAccount", jeth.UnlockAccount)
+ js.re.Run(`jeth.newAccount = personal.newAccount;`)
+ persObj.Set("newAccount", jeth.NewAccount)
+
return nil
}
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index a0f3f2fb7..ca636188f 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -168,7 +168,7 @@ func TestAccounts(t *testing.T) {
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`)
checkEvalJSON(t, repl, `eth.coinbase`, `"`+testAddress+`"`)
- val, err := repl.re.Run(`personal.newAccount("password")`)
+ val, err := repl.re.Run(`jeth.newAccount("password")`)
if err != nil {
t.Errorf("expected no error, got %v", err)
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 8798bbb27..f2bb27552 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -313,6 +313,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.IPCDisabledFlag,
utils.IPCApiFlag,
utils.IPCPathFlag,
+ utils.IPCExperimental,
utils.ExecFlag,
utils.WhisperEnabledFlag,
utils.DevModeFlag,
diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go
index 5c09e29ce..7a6ff704c 100644
--- a/cmd/geth/usage.go
+++ b/cmd/geth/usage.go
@@ -158,6 +158,7 @@ var AppHelpFlagGroups = []flagGroup{
Flags: []cli.Flag{
utils.WhisperEnabledFlag,
utils.NatspecEnabledFlag,
+ utils.IPCExperimental,
},
},
{