Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
c59d7a89
Commit
c59d7a89
authored
Aug 11, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added open js option for repetitive tasks in ethereal
parent
ce8f24e5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
12 deletions
+51
-12
wallet.qml
ethereal/assets/qml/wallet.qml
+20
-0
gui.go
ethereal/gui.go
+14
-1
cmd.go
ethereum/cmd.go
+5
-3
repl.go
ethereum/repl/repl.go
+7
-5
repl_darwin.go
ethereum/repl/repl_darwin.go
+2
-2
vm_env.go
utils/vm_env.go
+3
-1
No files found.
ethereal/assets/qml/wallet.qml
View file @
c59d7a89
...
@@ -63,6 +63,16 @@ ApplicationWindow {
...
@@ -63,6 +63,16 @@ ApplicationWindow {
txImportDialog
.
visible
=
true
txImportDialog
.
visible
=
true
}
}
}
}
MenuItem
{
text
:
"Run JS file"
onTriggered
:
{
generalFileDialog
.
callback
=
function
(
path
)
{
eth
.
evalJavascriptFile
(
path
)
}
generalFileDialog
.
open
()
}
}
}
}
Menu
{
Menu
{
...
@@ -452,6 +462,16 @@ ApplicationWindow {
...
@@ -452,6 +462,16 @@ ApplicationWindow {
onAccepted
:
{
onAccepted
:
{
}
}
}
}
FileDialog
{
id
:
generalFileDialog
property
var
callback
;
onAccepted
:
{
var
path
=
this
.
fileUrl
.
toString
()
callback
.
call
(
this
,
path
)
}
}
FileDialog
{
FileDialog
{
id
:
importDialog
id
:
importDialog
...
...
ethereal/gui.go
View file @
c59d7a89
...
@@ -18,6 +18,7 @@ import (
...
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
)
)
...
@@ -47,6 +48,8 @@ type Gui struct {
...
@@ -47,6 +48,8 @@ type Gui struct {
config
*
ethutil
.
ConfigManager
config
*
ethutil
.
ConfigManager
miner
*
ethminer
.
Miner
miner
*
ethminer
.
Miner
jsEngine
*
javascript
.
JSRE
}
}
// Create GUI, but doesn't start it
// Create GUI, but doesn't start it
...
@@ -58,7 +61,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
...
@@ -58,7 +61,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
pub
:=
ethpub
.
NewPEthereum
(
ethereum
)
pub
:=
ethpub
.
NewPEthereum
(
ethereum
)
return
&
Gui
{
eth
:
ethereum
,
txDb
:
db
,
pub
:
pub
,
logLevel
:
ethlog
.
LogLevel
(
logLevel
),
Session
:
session
,
open
:
false
,
clientIdentity
:
clientIdentity
,
config
:
config
}
return
&
Gui
{
eth
:
ethereum
,
txDb
:
db
,
pub
:
pub
,
logLevel
:
ethlog
.
LogLevel
(
logLevel
),
Session
:
session
,
open
:
false
,
clientIdentity
:
clientIdentity
,
config
:
config
,
jsEngine
:
javascript
.
NewJSRE
(
ethereum
)
}
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
...
@@ -121,6 +124,9 @@ func (gui *Gui) Stop() {
...
@@ -121,6 +124,9 @@ func (gui *Gui) Stop() {
gui
.
open
=
false
gui
.
open
=
false
gui
.
win
.
Hide
()
gui
.
win
.
Hide
()
}
}
gui
.
jsEngine
.
Stop
()
logger
.
Infoln
(
"Stopped"
)
logger
.
Infoln
(
"Stopped"
)
}
}
...
@@ -464,6 +470,13 @@ func (self *Gui) ImportTx(rlpTx string) {
...
@@ -464,6 +470,13 @@ func (self *Gui) ImportTx(rlpTx string) {
self
.
eth
.
TxPool
()
.
QueueTransaction
(
tx
)
self
.
eth
.
TxPool
()
.
QueueTransaction
(
tx
)
}
}
func
(
self
*
Gui
)
SearchChange
(
blockHash
,
address
,
storageAddress
string
)
{
}
func
(
self
*
Gui
)
EvalJavascriptFile
(
path
string
)
{
self
.
jsEngine
.
LoadExtFile
(
path
[
7
:
])
}
func
(
gui
*
Gui
)
SetCustomIdentifier
(
customIdentifier
string
)
{
func
(
gui
*
Gui
)
SetCustomIdentifier
(
customIdentifier
string
)
{
gui
.
clientIdentity
.
SetCustomIdentifier
(
customIdentifier
)
gui
.
clientIdentity
.
SetCustomIdentifier
(
customIdentifier
)
gui
.
config
.
Save
(
"id"
,
customIdentifier
)
gui
.
config
.
Save
(
"id"
,
customIdentifier
)
...
...
ethereum/cmd.go
View file @
c59d7a89
package
main
package
main
import
(
import
(
"io/ioutil"
"os"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go"
"github.com/ethereum/go-ethereum/ethereum/repl"
"github.com/ethereum/go-ethereum/ethereum/repl"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
"io/ioutil"
"os"
)
)
func
InitJsConsole
(
ethereum
*
eth
.
Ethereum
)
{
func
InitJsConsole
(
ethereum
*
eth
.
Ethereum
)
{
...
@@ -25,7 +27,7 @@ func ExecJsFile(ethereum *eth.Ethereum, InputFile string) {
...
@@ -25,7 +27,7 @@ func ExecJsFile(ethereum *eth.Ethereum, InputFile string) {
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Fatalln
(
err
)
logger
.
Fatalln
(
err
)
}
}
re
:=
ethrepl
.
NewJSRE
(
ethereum
)
re
:=
javascript
.
NewJSRE
(
ethereum
)
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
re
.
Stop
()
re
.
Stop
()
})
})
...
...
ethereum/repl/repl.go
View file @
c59d7a89
...
@@ -3,12 +3,14 @@ package ethrepl
...
@@ -3,12 +3,14 @@ package ethrepl
import
(
import
(
"bufio"
"bufio"
"fmt"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"io"
"io"
"os"
"os"
"path"
"path"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
)
)
var
logger
=
ethlog
.
NewLogger
(
"REPL"
)
var
logger
=
ethlog
.
NewLogger
(
"REPL"
)
...
@@ -19,7 +21,7 @@ type Repl interface {
...
@@ -19,7 +21,7 @@ type Repl interface {
}
}
type
JSRepl
struct
{
type
JSRepl
struct
{
re
*
JSRE
re
*
javascript
.
JSRE
prompt
string
prompt
string
...
@@ -34,7 +36,7 @@ func NewJSRepl(ethereum *eth.Ethereum) *JSRepl {
...
@@ -34,7 +36,7 @@ func NewJSRepl(ethereum *eth.Ethereum) *JSRepl {
panic
(
err
)
panic
(
err
)
}
}
return
&
JSRepl
{
re
:
NewJSRE
(
ethereum
),
prompt
:
"> "
,
history
:
hist
}
return
&
JSRepl
{
re
:
javascript
.
NewJSRE
(
ethereum
),
prompt
:
"> "
,
history
:
hist
}
}
}
func
(
self
*
JSRepl
)
Start
()
{
func
(
self
*
JSRepl
)
Start
()
{
...
...
ethereum/repl/repl_darwin.go
View file @
c59d7a89
...
@@ -115,8 +115,8 @@ L:
...
@@ -115,8 +115,8 @@ L:
}
}
func
(
self
*
JSRepl
)
PrintValue
(
v
interface
{})
{
func
(
self
*
JSRepl
)
PrintValue
(
v
interface
{})
{
method
,
_
:=
self
.
re
.
v
m
.
Get
(
"prettyPrint"
)
method
,
_
:=
self
.
re
.
V
m
.
Get
(
"prettyPrint"
)
v
,
err
:=
self
.
re
.
v
m
.
ToValue
(
v
)
v
,
err
:=
self
.
re
.
V
m
.
ToValue
(
v
)
if
err
==
nil
{
if
err
==
nil
{
method
.
Call
(
method
,
v
)
method
.
Call
(
method
,
v
)
}
}
...
...
utils/vm_env.go
View file @
c59d7a89
package
utils
package
utils
import
(
import
(
"math/big"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethstate"
"math/big"
)
)
type
VMEnv
struct
{
type
VMEnv
struct
{
...
@@ -29,5 +30,6 @@ func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
...
@@ -29,5 +30,6 @@ func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
func
(
self
*
VMEnv
)
Coinbase
()
[]
byte
{
return
self
.
block
.
Coinbase
}
func
(
self
*
VMEnv
)
Coinbase
()
[]
byte
{
return
self
.
block
.
Coinbase
}
func
(
self
*
VMEnv
)
Time
()
int64
{
return
self
.
block
.
Time
}
func
(
self
*
VMEnv
)
Time
()
int64
{
return
self
.
block
.
Time
}
func
(
self
*
VMEnv
)
Difficulty
()
*
big
.
Int
{
return
self
.
block
.
Difficulty
}
func
(
self
*
VMEnv
)
Difficulty
()
*
big
.
Int
{
return
self
.
block
.
Difficulty
}
func
(
self
*
VMEnv
)
BlockHash
()
[]
byte
{
return
self
.
block
.
Hash
()
}
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
value
}
func
(
self
*
VMEnv
)
State
()
*
ethstate
.
State
{
return
self
.
state
}
func
(
self
*
VMEnv
)
State
()
*
ethstate
.
State
{
return
self
.
state
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment