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
a6c4543c
Commit
a6c4543c
authored
Aug 15, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving over to ethpipe
parent
c3621725
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
65 additions
and
107 deletions
+65
-107
ethereum.js
ethereal/assets/ext/ethereum.js
+10
-0
test.html
ethereal/assets/ext/test.html
+4
-0
info.qml
ethereal/assets/qml/views/info.qml
+1
-1
transaction.qml
ethereal/assets/qml/views/transaction.qml
+1
-1
webapp.qml
ethereal/assets/qml/webapp.qml
+4
-4
debugger.go
ethereal/debugger.go
+1
-8
ext_app.go
ethereal/ext_app.go
+5
-22
gui.go
ethereal/gui.go
+21
-31
html_container.go
ethereal/html_container.go
+0
-8
ui_lib.go
ethereal/ui_lib.go
+3
-1
types.go
javascript/types.go
+1
-31
cmd.go
utils/cmd.go
+14
-0
No files found.
ethereal/assets/ext/ethereum.js
View file @
a6c4543c
...
@@ -4,6 +4,16 @@ window.eth = {
...
@@ -4,6 +4,16 @@ window.eth = {
_callbacks
:
{},
_callbacks
:
{},
_onCallbacks
:
{},
_onCallbacks
:
{},
test
:
function
()
{
var
t
=
undefined
;
navigator
.
qt
.
onmessage
=
function
(
d
)
{
t
=
d
;
}
for
(;;)
{
if
(
t
!==
undefined
)
{
return
t
}
}
},
mutan
:
function
(
code
)
{
mutan
:
function
(
code
)
{
},
},
...
...
ethereal/assets/ext/test.html
View file @
a6c4543c
...
@@ -25,6 +25,10 @@ function test() {
...
@@ -25,6 +25,10 @@ function test() {
eth
.
getEachStorageAt
(
"9ef0f0d81e040012600b0c1abdef7c48f720f88a"
,
function
(
a
,
b
)
{
eth
.
getEachStorageAt
(
"9ef0f0d81e040012600b0c1abdef7c48f720f88a"
,
function
(
a
,
b
)
{
console
.
log
(
a
,
b
)
console
.
log
(
a
,
b
)
})
})
eth
.
getBlock
(
"f70097659f329a09642a27f11338d9269de64f1d4485786e36bfc410832148cd"
,
function
(
block
)
{
console
.
log
(
block
)
})
}
}
</script>
</script>
...
...
ethereal/assets/qml/views/info.qml
View file @
a6c4543c
...
@@ -28,7 +28,7 @@ Rectangle {
...
@@ -28,7 +28,7 @@ Rectangle {
text
:
"Address"
text
:
"Address"
}
}
TextField
{
TextField
{
text
:
pub
.
getKey
().
address
text
:
eth
.
getKey
().
address
width
:
500
width
:
500
}
}
...
...
ethereal/assets/qml/views/transaction.qml
View file @
a6c4543c
...
@@ -169,7 +169,7 @@ Rectangle {
...
@@ -169,7 +169,7 @@ Rectangle {
onClicked
:
{
onClicked
:
{
var
value
=
txValue
.
text
+
denomModel
.
get
(
valueDenom
.
currentIndex
).
zeros
;
var
value
=
txValue
.
text
+
denomModel
.
get
(
valueDenom
.
currentIndex
).
zeros
;
var
gasPrice
=
txGasPrice
.
text
+
denomModel
.
get
(
gasDenom
.
currentIndex
).
zeros
;
var
gasPrice
=
txGasPrice
.
text
+
denomModel
.
get
(
gasDenom
.
currentIndex
).
zeros
;
var
res
=
gui
.
create
(
txFuelRecipient
.
text
,
value
,
txGas
.
text
,
gasPrice
,
codeView
.
text
)
var
res
=
gui
.
transact
(
txFuelRecipient
.
text
,
value
,
txGas
.
text
,
gasPrice
,
codeView
.
text
)
if
(
res
[
1
])
{
if
(
res
[
1
])
{
txResult
.
text
=
"Your contract <b>could not</b> be sent over the network:
\n
<b>"
txResult
.
text
=
"Your contract <b>could not</b> be sent over the network:
\n
<b>"
txResult
.
text
+=
res
[
1
].
error
()
txResult
.
text
+=
res
[
1
].
error
()
...
...
ethereal/assets/qml/webapp.qml
View file @
a6c4543c
...
@@ -165,13 +165,13 @@ ApplicationWindow {
...
@@ -165,13 +165,13 @@ ApplicationWindow {
break
break
case
"getBlockByNumber"
:
case
"getBlockByNumber"
:
var
block
=
eth
.
getBlock
(
data
.
args
[
0
])
var
block
=
eth
.
getBlock
ByNumber
(
data
.
args
[
0
])
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
case
"getBlockByHash"
:
case
"getBlockByHash"
:
var
block
=
eth
.
getBlock
(
data
.
args
[
0
])
var
block
=
eth
.
getBlock
ByHash
(
data
.
args
[
0
])
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
...
@@ -195,8 +195,8 @@ ApplicationWindow {
...
@@ -195,8 +195,8 @@ ApplicationWindow {
case
"getEachStorage"
:
case
"getEachStorage"
:
require
(
1
);
require
(
1
);
var
st
ateObject
=
eth
.
getStateObject
(
data
.
args
[
0
]).
stateKeyVal
(
true
)
var
st
orage
=
eth
.
getEachStorage
(
data
.
args
[
0
]
)
postData
(
data
.
_seed
,
stateObject
)
postData
(
data
.
_seed
,
storage
)
break
break
...
...
ethereal/debugger.go
View file @
a6c4543c
...
@@ -103,14 +103,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
...
@@ -103,14 +103,7 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
}
}
}()
}()
data
:=
ethutil
.
StringToByteFunc
(
dataStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
data
:=
utils
.
FormatTransactionData
(
dataStr
)
slice
:=
strings
.
Split
(
dataStr
,
"
\n
"
)
for
_
,
dataItem
:=
range
slice
{
d
:=
ethutil
.
FormatData
(
dataItem
)
ret
=
append
(
ret
,
d
...
)
}
return
})
var
err
error
var
err
error
script
:=
ethutil
.
StringToByteFunc
(
scriptStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
script
:=
ethutil
.
StringToByteFunc
(
scriptStr
,
func
(
s
string
)
(
ret
[]
byte
)
{
...
...
ethereal/ext_app.go
View file @
a6c4543c
...
@@ -4,7 +4,7 @@ import (
...
@@ -4,7 +4,7 @@ import (
"encoding/json"
"encoding/json"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethp
ub
"
"github.com/ethereum/eth-go/ethp
ipe
"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/javascript"
...
@@ -19,42 +19,36 @@ type AppContainer interface {
...
@@ -19,42 +19,36 @@ type AppContainer interface {
Engine
()
*
qml
.
Engine
Engine
()
*
qml
.
Engine
NewBlock
(
*
ethchain
.
Block
)
NewBlock
(
*
ethchain
.
Block
)
ObjectChanged
(
*
ethstate
.
StateObject
)
StorageChanged
(
*
ethstate
.
StorageState
)
NewWatcher
(
chan
bool
)
NewWatcher
(
chan
bool
)
Messages
(
ethstate
.
Messages
,
string
)
Messages
(
ethstate
.
Messages
,
string
)
}
}
type
ExtApplication
struct
{
type
ExtApplication
struct
{
*
ethp
ub
.
PEthereum
*
ethp
ipe
.
JSPipe
eth
ethchain
.
EthManager
eth
ethchain
.
EthManager
blockChan
chan
ethreact
.
Event
blockChan
chan
ethreact
.
Event
changeChan
chan
ethreact
.
Event
messageChan
chan
ethreact
.
Event
messageChan
chan
ethreact
.
Event
quitChan
chan
bool
quitChan
chan
bool
watcherQuitChan
chan
bool
watcherQuitChan
chan
bool
filters
map
[
string
]
*
ethchain
.
Filter
filters
map
[
string
]
*
ethchain
.
Filter
container
AppContainer
container
AppContainer
lib
*
UiLib
lib
*
UiLib
registeredEvents
[]
string
}
}
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
app
:=
&
ExtApplication
{
app
:=
&
ExtApplication
{
ethp
ub
.
New
(
lib
.
eth
),
ethp
ipe
.
NewJSPipe
(
lib
.
eth
),
lib
.
eth
,
lib
.
eth
,
make
(
chan
ethreact
.
Event
,
100
),
make
(
chan
ethreact
.
Event
,
100
),
make
(
chan
ethreact
.
Event
,
100
),
make
(
chan
ethreact
.
Event
,
100
),
make
(
chan
ethreact
.
Event
,
100
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
chan
bool
),
make
(
map
[
string
]
*
ethchain
.
Filter
),
make
(
map
[
string
]
*
ethchain
.
Filter
),
container
,
container
,
lib
,
lib
,
nil
,
}
}
return
app
return
app
...
@@ -93,9 +87,6 @@ func (app *ExtApplication) stop() {
...
@@ -93,9 +87,6 @@ func (app *ExtApplication) stop() {
// Clean up
// Clean up
reactor
:=
app
.
lib
.
eth
.
Reactor
()
reactor
:=
app
.
lib
.
eth
.
Reactor
()
reactor
.
Unsubscribe
(
"newBlock"
,
app
.
blockChan
)
reactor
.
Unsubscribe
(
"newBlock"
,
app
.
blockChan
)
for
_
,
event
:=
range
app
.
registeredEvents
{
reactor
.
Unsubscribe
(
event
,
app
.
changeChan
)
}
// Kill the main loop
// Kill the main loop
app
.
quitChan
<-
true
app
.
quitChan
<-
true
...
@@ -103,7 +94,6 @@ func (app *ExtApplication) stop() {
...
@@ -103,7 +94,6 @@ func (app *ExtApplication) stop() {
close
(
app
.
blockChan
)
close
(
app
.
blockChan
)
close
(
app
.
quitChan
)
close
(
app
.
quitChan
)
close
(
app
.
changeChan
)
app
.
container
.
Destroy
()
app
.
container
.
Destroy
()
}
}
...
@@ -118,13 +108,6 @@ out:
...
@@ -118,13 +108,6 @@ out:
if
block
,
ok
:=
block
.
Resource
.
(
*
ethchain
.
Block
);
ok
{
if
block
,
ok
:=
block
.
Resource
.
(
*
ethchain
.
Block
);
ok
{
app
.
container
.
NewBlock
(
block
)
app
.
container
.
NewBlock
(
block
)
}
}
case
object
:=
<-
app
.
changeChan
:
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
ethstate
.
StateObject
);
ok
{
app
.
container
.
ObjectChanged
(
stateObject
)
}
else
if
storageObject
,
ok
:=
object
.
Resource
.
(
*
ethstate
.
StorageState
);
ok
{
app
.
container
.
StorageChanged
(
storageObject
)
}
case
msg
:=
<-
app
.
messageChan
:
case
msg
:=
<-
app
.
messageChan
:
if
messages
,
ok
:=
msg
.
Resource
.
(
ethstate
.
Messages
);
ok
{
if
messages
,
ok
:=
msg
.
Resource
.
(
ethstate
.
Messages
);
ok
{
for
id
,
filter
:=
range
app
.
filters
{
for
id
,
filter
:=
range
app
.
filters
{
...
...
ethereal/gui.go
View file @
a6c4543c
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethpipe"
"github.com/ethereum/eth-go/ethpipe"
"github.com/ethereum/eth-go/ethpub"
"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"
...
@@ -39,10 +38,11 @@ type Gui struct {
...
@@ -39,10 +38,11 @@ type Gui struct {
txDb
*
ethdb
.
LDBDatabase
txDb
*
ethdb
.
LDBDatabase
pub
*
ethpub
.
PEthereum
logLevel
ethlog
.
LogLevel
logLevel
ethlog
.
LogLevel
open
bool
open
bool
pipe
*
ethpipe
.
JSPipe
Session
string
Session
string
clientIdentity
*
ethwire
.
SimpleClientIdentity
clientIdentity
*
ethwire
.
SimpleClientIdentity
config
*
ethutil
.
ConfigManager
config
*
ethutil
.
ConfigManager
...
@@ -57,9 +57,9 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
...
@@ -57,9 +57,9 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
panic
(
err
)
panic
(
err
)
}
}
p
ub
:=
ethpub
.
New
(
ethereum
)
p
ipe
:=
ethpipe
.
NewJSPipe
(
ethereum
)
return
&
Gui
{
eth
:
ethereum
,
txDb
:
db
,
p
ub
:
pub
,
logLevel
:
ethlog
.
LogLevel
(
logLevel
),
Session
:
session
,
open
:
false
,
clientIdentity
:
clientIdentity
,
config
:
config
}
return
&
Gui
{
eth
:
ethereum
,
txDb
:
db
,
p
ipe
:
pipe
,
logLevel
:
ethlog
.
LogLevel
(
logLevel
),
Session
:
session
,
open
:
false
,
clientIdentity
:
clientIdentity
,
config
:
config
}
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
...
@@ -68,13 +68,12 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -68,13 +68,12 @@ func (gui *Gui) Start(assetPath string) {
// Register ethereum functions
// Register ethereum functions
qml
.
RegisterTypes
(
"Ethereum"
,
1
,
0
,
[]
qml
.
TypeSpec
{{
qml
.
RegisterTypes
(
"Ethereum"
,
1
,
0
,
[]
qml
.
TypeSpec
{{
Init
:
func
(
p
*
ethp
ub
.
P
Block
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
Init
:
func
(
p
*
ethp
ipe
.
JS
Block
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
},
{
},
{
Init
:
func
(
p
*
ethp
ub
.
PTx
,
obj
qml
.
Object
)
{
p
.
Value
=
""
;
p
.
Hash
=
""
;
p
.
Address
=
""
},
Init
:
func
(
p
*
ethp
ipe
.
JSTransaction
,
obj
qml
.
Object
)
{
p
.
Value
=
""
;
p
.
Hash
=
""
;
p
.
Address
=
""
},
},
{
},
{
Init
:
func
(
p
*
ethp
ub
.
KeyVal
,
obj
qml
.
Object
)
{
p
.
Key
=
""
;
p
.
Value
=
""
},
Init
:
func
(
p
*
ethp
ipe
.
KeyVal
,
obj
qml
.
Object
)
{
p
.
Key
=
""
;
p
.
Value
=
""
},
}})
}})
// Create a new QML engine
// Create a new QML engine
gui
.
engine
=
qml
.
NewEngine
()
gui
.
engine
=
qml
.
NewEngine
()
context
:=
gui
.
engine
.
Context
()
context
:=
gui
.
engine
.
Context
()
...
@@ -82,7 +81,6 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -82,7 +81,6 @@ func (gui *Gui) Start(assetPath string) {
// Expose the eth library and the ui library to QML
// Expose the eth library and the ui library to QML
context
.
SetVar
(
"gui"
,
gui
)
context
.
SetVar
(
"gui"
,
gui
)
context
.
SetVar
(
"pub"
,
gui
.
pub
)
context
.
SetVar
(
"eth"
,
gui
.
uiLib
)
context
.
SetVar
(
"eth"
,
gui
.
uiLib
)
// Load the main QML interface
// Load the main QML interface
...
@@ -231,7 +229,7 @@ func (gui *Gui) loadAddressBook() {
...
@@ -231,7 +229,7 @@ func (gui *Gui) loadAddressBook() {
view
:=
gui
.
getObjectByName
(
"infoView"
)
view
:=
gui
.
getObjectByName
(
"infoView"
)
view
.
Call
(
"clearAddress"
)
view
.
Call
(
"clearAddress"
)
nameReg
:=
ethpub
.
EthereumConfig
(
gui
.
eth
.
StateManager
())
.
NameReg
(
)
nameReg
:=
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
if
nameReg
!=
nil
{
if
nameReg
!=
nil
{
nameReg
.
EachStorage
(
func
(
name
string
,
value
*
ethutil
.
Value
)
{
nameReg
.
EachStorage
(
func
(
name
string
,
value
*
ethutil
.
Value
)
{
if
name
[
0
]
!=
0
{
if
name
[
0
]
!=
0
{
...
@@ -255,7 +253,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
...
@@ -255,7 +253,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
}
}
var
(
var
(
ptx
=
ethp
ub
.
NewP
Tx
(
tx
)
ptx
=
ethp
ipe
.
NewJS
Tx
(
tx
)
send
=
nameReg
.
Storage
(
tx
.
Sender
())
send
=
nameReg
.
Storage
(
tx
.
Sender
())
rec
=
nameReg
.
Storage
(
tx
.
Recipient
)
rec
=
nameReg
.
Storage
(
tx
.
Recipient
)
s
,
r
string
s
,
r
string
...
@@ -301,8 +299,9 @@ func (gui *Gui) readPreviousTransactions() {
...
@@ -301,8 +299,9 @@ func (gui *Gui) readPreviousTransactions() {
}
}
func
(
gui
*
Gui
)
processBlock
(
block
*
ethchain
.
Block
,
initial
bool
)
{
func
(
gui
*
Gui
)
processBlock
(
block
*
ethchain
.
Block
,
initial
bool
)
{
name
:=
ethpub
.
FindNameInNameReg
(
gui
.
eth
.
StateManager
(),
block
.
Coinbase
)
//name := ethpub.FindNameInNameReg(gui.eth.StateManager(), block.Coinbase)
b
:=
ethpub
.
NewPBlock
(
block
)
name
:=
strings
.
Trim
(
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
.
Storage
(
block
.
Coinbase
)
.
Str
(),
"
\x00
"
)
b
:=
ethpipe
.
NewJSBlock
(
block
)
b
.
Name
=
name
b
.
Name
=
name
gui
.
getObjectByName
(
"chainView"
)
.
Call
(
"addBlock"
,
b
,
initial
)
gui
.
getObjectByName
(
"chainView"
)
.
Call
(
"addBlock"
,
b
,
initial
)
...
@@ -391,12 +390,12 @@ func (gui *Gui) update() {
...
@@ -391,12 +390,12 @@ func (gui *Gui) update() {
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
address
())
==
0
{
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
address
())
==
0
{
object
.
SubAmount
(
tx
.
Value
)
object
.
SubAmount
(
tx
.
Value
)
gui
.
getObjectByName
(
"transactionView"
)
.
Call
(
"addTx"
,
ethp
ub
.
NewP
Tx
(
tx
),
"send"
)
gui
.
getObjectByName
(
"transactionView"
)
.
Call
(
"addTx"
,
ethp
ipe
.
NewJS
Tx
(
tx
),
"send"
)
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
}
else
if
bytes
.
Compare
(
tx
.
Recipient
,
gui
.
address
())
==
0
{
}
else
if
bytes
.
Compare
(
tx
.
Recipient
,
gui
.
address
())
==
0
{
object
.
AddAmount
(
tx
.
Value
)
object
.
AddAmount
(
tx
.
Value
)
gui
.
getObjectByName
(
"transactionView"
)
.
Call
(
"addTx"
,
ethp
ub
.
NewP
Tx
(
tx
),
"recv"
)
gui
.
getObjectByName
(
"transactionView"
)
.
Call
(
"addTx"
,
ethp
ipe
.
NewJS
Tx
(
tx
),
"recv"
)
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
}
}
...
@@ -442,10 +441,9 @@ func (gui *Gui) update() {
...
@@ -442,10 +441,9 @@ func (gui *Gui) update() {
reactor
.
Subscribe
(
"miner:start"
,
miningChan
)
reactor
.
Subscribe
(
"miner:start"
,
miningChan
)
reactor
.
Subscribe
(
"miner:stop"
,
miningChan
)
reactor
.
Subscribe
(
"miner:stop"
,
miningChan
)
nameReg
:=
ethpub
.
EthereumConfig
(
gui
.
eth
.
StateManager
())
.
NameReg
()
nameReg
:=
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
if
nameReg
!=
nil
{
reactor
.
Subscribe
(
"object:"
+
string
(
nameReg
.
Address
()),
objectChan
)
reactor
.
Subscribe
(
"object:"
+
string
(
nameReg
.
Address
()),
objectChan
)
}
reactor
.
Subscribe
(
"peerList"
,
peerChan
)
reactor
.
Subscribe
(
"peerList"
,
peerChan
)
}
}
...
@@ -453,7 +451,7 @@ func (gui *Gui) setPeerInfo() {
...
@@ -453,7 +451,7 @@ func (gui *Gui) setPeerInfo() {
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"resetPeers"
)
gui
.
win
.
Root
()
.
Call
(
"resetPeers"
)
for
_
,
peer
:=
range
gui
.
p
ub
.
GetPeers
()
{
for
_
,
peer
:=
range
gui
.
p
ipe
.
GetPeers
()
{
gui
.
win
.
Root
()
.
Call
(
"addPeer"
,
peer
)
gui
.
win
.
Root
()
.
Call
(
"addPeer"
,
peer
)
}
}
}
}
...
@@ -466,18 +464,10 @@ func (gui *Gui) address() []byte {
...
@@ -466,18 +464,10 @@ func (gui *Gui) address() []byte {
return
gui
.
eth
.
KeyManager
()
.
Address
()
return
gui
.
eth
.
KeyManager
()
.
Address
()
}
}
func
(
gui
*
Gui
)
RegisterName
(
name
string
)
{
func
(
gui
*
Gui
)
Transact
(
recipient
,
value
,
gas
,
gasPrice
,
d
string
)
(
*
ethpipe
.
JSReceipt
,
error
)
{
name
=
fmt
.
Sprintf
(
"
\"
register
\"\n\"
%s
\"
"
,
name
)
data
:=
ethutil
.
Bytes2Hex
(
utils
.
FormatTransactionData
(
d
))
gui
.
pub
.
Transact
(
gui
.
privateKey
(),
"NameReg"
,
""
,
"10000"
,
"10000000000000"
,
name
)
}
func
(
gui
*
Gui
)
Transact
(
recipient
,
value
,
gas
,
gasPrice
,
data
string
)
(
*
ethpub
.
PReceipt
,
error
)
{
return
gui
.
pub
.
Transact
(
gui
.
privateKey
(),
recipient
,
value
,
gas
,
gasPrice
,
data
)
}
func
(
gui
*
Gui
)
Create
(
recipient
,
value
,
gas
,
gasPrice
,
data
string
)
(
*
ethpub
.
PReceipt
,
error
)
{
return
gui
.
pipe
.
Transact
(
gui
.
privateKey
(),
recipient
,
value
,
gas
,
gasPrice
,
data
)
return
gui
.
pub
.
Transact
(
gui
.
privateKey
(),
recipient
,
value
,
gas
,
gasPrice
,
data
)
}
}
func
(
gui
*
Gui
)
SetCustomIdentifier
(
customIdentifier
string
)
{
func
(
gui
*
Gui
)
SetCustomIdentifier
(
customIdentifier
string
)
{
...
...
ethereal/html_container.go
View file @
a6c4543c
...
@@ -125,14 +125,6 @@ func (app *HtmlApplication) NewBlock(block *ethchain.Block) {
...
@@ -125,14 +125,6 @@ func (app *HtmlApplication) NewBlock(block *ethchain.Block) {
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
}
}
func
(
app
*
HtmlApplication
)
ObjectChanged
(
stateObject
*
ethstate
.
StateObject
)
{
app
.
webView
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
}
func
(
app
*
HtmlApplication
)
StorageChanged
(
storageObject
*
ethstate
.
StorageState
)
{
app
.
webView
.
Call
(
"onStorageChangeCb"
,
ethpub
.
NewPStorageState
(
storageObject
))
}
func
(
self
*
HtmlApplication
)
Messages
(
messages
ethstate
.
Messages
,
id
string
)
{
func
(
self
*
HtmlApplication
)
Messages
(
messages
ethstate
.
Messages
,
id
string
)
{
var
msgs
[]
javascript
.
JSMessage
var
msgs
[]
javascript
.
JSMessage
for
_
,
m
:=
range
messages
{
for
_
,
m
:=
range
messages
{
...
...
ethereal/ui_lib.go
View file @
a6c4543c
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpipe"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/javascript"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
...
@@ -18,6 +19,7 @@ type memAddr struct {
...
@@ -18,6 +19,7 @@ type memAddr struct {
// UI Library that has some basic functionality exposed
// UI Library that has some basic functionality exposed
type
UiLib
struct
{
type
UiLib
struct
{
*
ethpipe
.
JSPipe
engine
*
qml
.
Engine
engine
*
qml
.
Engine
eth
*
eth
.
Ethereum
eth
*
eth
.
Ethereum
connected
bool
connected
bool
...
@@ -31,7 +33,7 @@ type UiLib struct {
...
@@ -31,7 +33,7 @@ type UiLib struct {
}
}
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
string
)
*
UiLib
{
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
string
)
*
UiLib
{
return
&
UiLib
{
engine
:
engine
,
eth
:
eth
,
assetPath
:
assetPath
,
jsEngine
:
javascript
.
NewJSRE
(
eth
)}
return
&
UiLib
{
JSPipe
:
ethpipe
.
NewJSPipe
(
eth
),
engine
:
engine
,
eth
:
eth
,
assetPath
:
assetPath
,
jsEngine
:
javascript
.
NewJSRE
(
eth
)}
}
}
func
(
self
*
UiLib
)
ImportTx
(
rlpTx
string
)
{
func
(
self
*
UiLib
)
ImportTx
(
rlpTx
string
)
{
...
...
javascript/types.go
View file @
a6c4543c
...
@@ -128,37 +128,7 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value {
...
@@ -128,37 +128,7 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value {
}
}
func
(
self
*
JSEthereum
)
Messages
(
object
map
[
string
]
interface
{})
otto
.
Value
{
func
(
self
*
JSEthereum
)
Messages
(
object
map
[
string
]
interface
{})
otto
.
Value
{
filter
:=
ethchain
.
NewFilter
(
self
.
ethereum
)
filter
:=
ethchain
.
NewFilterFromMap
(
object
,
self
.
ethereum
)
if
object
[
"earliest"
]
!=
nil
{
earliest
:=
object
[
"earliest"
]
if
e
,
ok
:=
earliest
.
(
string
);
ok
{
filter
.
SetEarliestBlock
(
ethutil
.
Hex2Bytes
(
e
))
}
else
{
filter
.
SetEarliestBlock
(
earliest
)
}
}
if
object
[
"latest"
]
!=
nil
{
latest
:=
object
[
"latest"
]
if
l
,
ok
:=
latest
.
(
string
);
ok
{
filter
.
SetLatestBlock
(
ethutil
.
Hex2Bytes
(
l
))
}
else
{
filter
.
SetLatestBlock
(
latest
)
}
}
if
object
[
"to"
]
!=
nil
{
filter
.
AddTo
(
ethutil
.
Hex2Bytes
(
object
[
"to"
]
.
(
string
)))
}
if
object
[
"from"
]
!=
nil
{
filter
.
AddFrom
(
ethutil
.
Hex2Bytes
(
object
[
"from"
]
.
(
string
)))
}
if
object
[
"max"
]
!=
nil
{
filter
.
SetMax
(
object
[
"max"
]
.
(
int
))
}
if
object
[
"skip"
]
!=
nil
{
filter
.
SetSkip
(
object
[
"skip"
]
.
(
int
))
}
messages
:=
filter
.
Find
()
messages
:=
filter
.
Find
()
var
msgs
[]
JSMessage
var
msgs
[]
JSMessage
...
...
utils/cmd.go
View file @
a6c4543c
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"os/signal"
"os/signal"
"path"
"path"
"path/filepath"
"path/filepath"
"regexp"
"runtime"
"runtime"
"time"
"time"
...
@@ -267,6 +268,19 @@ func StartMining(ethereum *eth.Ethereum) bool {
...
@@ -267,6 +268,19 @@ func StartMining(ethereum *eth.Ethereum) bool {
return
false
return
false
}
}
func
FormatTransactionData
(
data
string
)
[]
byte
{
d
:=
ethutil
.
StringToByteFunc
(
data
,
func
(
s
string
)
(
ret
[]
byte
)
{
slice
:=
regexp
.
MustCompile
(
"
\\
n|
\\
s"
)
.
Split
(
s
,
1000000000
)
for
_
,
dataItem
:=
range
slice
{
d
:=
ethutil
.
FormatData
(
dataItem
)
ret
=
append
(
ret
,
d
...
)
}
return
})
return
d
}
func
StopMining
(
ethereum
*
eth
.
Ethereum
)
bool
{
func
StopMining
(
ethereum
*
eth
.
Ethereum
)
bool
{
if
ethereum
.
Mining
&&
miner
!=
nil
{
if
ethereum
.
Mining
&&
miner
!=
nil
{
miner
.
Stop
()
miner
.
Stop
()
...
...
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