From 7279a485c24de3f0aaf839e1884151322a97dbf7 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 15 Mar 2015 13:31:40 +0700 Subject: CLI: - js subcommand for vm - console for Frontier console interactive REPL - jspath in cli - integrate jeth apiBindings --- cmd/ethereum/main.go | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) (limited to 'cmd/ethereum/main.go') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 53746627a..0dae5b79b 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -89,16 +89,20 @@ Use "ethereum dump 0" to dump the genesis block. `, }, { - Action: runjs, + Action: console, + Name: "console", + Usage: `Ethereum Frontier Console: interactive JavaScript environment`, + Description: ` +Frontier Console is an interactive shell for the Ethereum Frontier JavaScript runtime environment which exposes a node admin interface as well as the DAPP JavaScript API. +See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console +`, + }, + { + Action: execJSFiles, Name: "js", - Usage: `interactive JavaScript console`, + Usage: `executes the given JavaScript files in the Ethereum Frontier JavaScript VM`, Description: ` -In the console, you can use the eth object to interact -with the running ethereum stack. The API does not match -ethereum.js. - -A JavaScript file can be provided as the argument. The -runtime will execute the file and exit. +The Ethereum Frontier JavaScript VM exposes a node admin interface as well as the DAPP JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console `, }, { @@ -116,6 +120,7 @@ runtime will execute the file and exit. utils.UnlockedAccountFlag, utils.BootnodesFlag, utils.DataDirFlag, + utils.JSpathFlag, utils.ListenPortFlag, utils.LogFileFlag, utils.LogFormatFlag, @@ -131,6 +136,7 @@ runtime will execute the file and exit. utils.RPCPortFlag, utils.UnencryptedKeysFlag, utils.VMDebugFlag, + //utils.VMTypeFlag, } @@ -168,7 +174,7 @@ func run(ctx *cli.Context) { ethereum.WaitForShutdown() } -func runjs(ctx *cli.Context) { +func console(ctx *cli.Context) { cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) ethereum, err := eth.New(cfg) if err != nil { @@ -176,14 +182,26 @@ func runjs(ctx *cli.Context) { } startEth(ctx, ethereum) - repl := newJSRE(ethereum) - if len(ctx.Args()) == 0 { - repl.interactive() - } else { - for _, file := range ctx.Args() { - repl.exec(file) - } + repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name)) + repl.interactive() + + ethereum.Stop() + ethereum.WaitForShutdown() +} + +func execJSFiles(ctx *cli.Context) { + cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) + ethereum, err := eth.New(cfg) + if err != nil { + utils.Fatalf("%v", err) } + + startEth(ctx, ethereum) + repl := newJSRE(ethereum, ctx.String(utils.JSpathFlag.Name)) + for _, file := range ctx.Args() { + repl.exec(file) + } + ethereum.Stop() ethereum.WaitForShutdown() } -- cgit v1.2.3 From 73af0302bed5076260ac935e452064aee423934d Mon Sep 17 00:00:00 2001 From: zelig Date: Mon, 16 Mar 2015 22:49:39 +0700 Subject: we do not use the name Frontier Console --- cmd/ethereum/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/ethereum/main.go') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 96b90b6e6..64b9949d2 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -31,9 +31,9 @@ import ( "github.com/codegangsta/cli" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/peterh/liner" @@ -91,9 +91,9 @@ Use "ethereum dump 0" to dump the genesis block. { Action: console, Name: "console", - Usage: `Ethereum Frontier Console: interactive JavaScript environment`, + Usage: `Ethereum Console: interactive JavaScript environment`, Description: ` -Frontier Console is an interactive shell for the Ethereum Frontier JavaScript runtime environment which exposes a node admin interface as well as the DAPP JavaScript API. +Console is an interactive shell for the Ethereum JavaScript runtime environment which exposes a node admin interface as well as the DAPP JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console `, }, @@ -102,7 +102,7 @@ See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console Name: "js", Usage: `executes the given JavaScript files in the Ethereum Frontier JavaScript VM`, Description: ` -The Ethereum Frontier JavaScript VM exposes a node admin interface as well as the DAPP JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console +The Ethereum JavaScript VM exposes a node admin interface as well as the DAPP JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Frontier-Console `, }, { -- cgit v1.2.3 From 53104b09fa823cb5457960b8518b9650a5b083da Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Mar 2015 21:23:05 +0100 Subject: bump --- cmd/ethereum/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/ethereum/main.go') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 64b9949d2..3b952dd79 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -41,7 +41,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.9.0" + Version = "0.9.1" ) var ( -- cgit v1.2.3 From 0a1eeca41e6ba5920ba65d9b41654768299bc7e3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 18 Mar 2015 13:00:01 +0100 Subject: conversions. -compilable- --- cmd/ethereum/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/ethereum/main.go') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 3b952dd79..459059e6c 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -302,7 +302,7 @@ func dump(ctx *cli.Context) { for _, arg := range ctx.Args() { var block *types.Block if hashish(arg) { - block = chainmgr.GetBlock(common.Hex2Bytes(arg)) + block = chainmgr.GetBlock(common.HexToHash(arg)) } else { num, _ := strconv.Atoi(arg) block = chainmgr.GetBlockByNumber(uint64(num)) -- cgit v1.2.3