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
1fd69e95
Commit
1fd69e95
authored
Aug 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented "messages"
parent
612b6318
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
29 deletions
+133
-29
ethereum.js
ethereal/assets/ext/ethereum.js
+33
-0
wallet.qml
ethereal/assets/qml/wallet.qml
+32
-23
webapp.qml
ethereal/assets/qml/webapp.qml
+8
-0
ext_app.go
ethereal/ext_app.go
+52
-0
gui.go
ethereal/gui.go
+8
-6
No files found.
ethereal/assets/ext/ethereum.js
View file @
1fd69e95
...
@@ -95,6 +95,10 @@ window.eth = {
...
@@ -95,6 +95,10 @@ window.eth = {
postData
({
call
:
"transact"
,
args
:
[
params
.
from
,
params
.
to
,
params
.
value
,
params
.
gas
,
params
.
gasPrice
,
"0x"
+
data
]},
cb
);
postData
({
call
:
"transact"
,
args
:
[
params
.
from
,
params
.
to
,
params
.
value
,
params
.
gas
,
params
.
gasPrice
,
"0x"
+
data
]},
cb
);
},
},
getMessages
:
function
(
filter
,
cb
)
{
postData
({
call
:
"messages"
,
args
:
[
filter
]},
cb
);
},
getStorageAt
:
function
(
address
,
storageAddress
,
cb
)
{
getStorageAt
:
function
(
address
,
storageAddress
,
cb
)
{
postData
({
call
:
"getStorage"
,
args
:
[
address
,
storageAddress
]},
cb
);
postData
({
call
:
"getStorage"
,
args
:
[
address
,
storageAddress
]},
cb
);
},
},
...
@@ -209,4 +213,33 @@ window.eth = {
...
@@ -209,4 +213,33 @@ window.eth = {
}
}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
function
postData
(
data
,
cb
)
{
data
.
_seed
=
Math
.
floor
(
Math
.
random
()
*
1000000
)
if
(
cb
)
{
eth
.
_callbacks
[
data
.
_seed
]
=
cb
;
}
if
(
data
.
args
===
undefined
)
{
data
.
args
=
[];
}
navigator
.
qt
.
postMessage
(
JSON
.
stringify
(
data
));
}
navigator
.
qt
.
onmessage
=
function
(
ev
)
{
var
data
=
JSON
.
parse
(
ev
.
data
)
if
(
data
.
_event
!==
undefined
)
{
eth
.
trigger
(
data
.
_event
,
data
.
data
);
}
else
{
if
(
data
.
_seed
)
{
var
cb
=
eth
.
_callbacks
[
data
.
_seed
];
if
(
cb
)
{
cb
.
call
(
this
,
data
.
data
)
// Remove the "trigger" callback
delete
eth
.
_callbacks
[
ev
.
_seed
];
}
}
}
}
ethereal/assets/qml/wallet.qml
View file @
1fd69e95
...
@@ -98,7 +98,7 @@ ApplicationWindow {
...
@@ -98,7 +98,7 @@ ApplicationWindow {
MenuItem
{
MenuItem
{
text
:
"Debugger"
text
:
"Debugger"
shortcut
:
"Ctrl+d"
shortcut
:
"Ctrl+d"
onTriggered
:
ui
.
startDebugger
()
onTriggered
:
eth
.
startDebugger
()
}
}
MenuItem
{
MenuItem
{
...
@@ -282,9 +282,10 @@ ApplicationWindow {
...
@@ -282,9 +282,10 @@ ApplicationWindow {
/*
/*
Component {
Component {
id: menuItemTemplate
id: menuItemTemplate
Rectangle {
RowLayout {
property var view;
property var view;
property
var
source;
property
alias source: icon.
source;
property alias title: title.text
property alias title: title.text
height: 25
height: 25
...
@@ -295,11 +296,9 @@ ApplicationWindow {
...
@@ -295,11 +296,9 @@ ApplicationWindow {
right: parent.right
right: parent.right
}
}
Label {
Image {
id: title
id: icon
y: parent.height / 2 - this.height / 2
//anchors.horizontalCenter: parent.horizontalCenter
x: 5
font.pixelSize: 10
}
}
MouseArea {
MouseArea {
...
@@ -309,21 +308,32 @@ ApplicationWindow {
...
@@ -309,21 +308,32 @@ ApplicationWindow {
}
}
}
}
Image {
Rectangle {
id: closeButton
color: "#bbbbbb"
y: parent.height / 2 - this.height / 2
Label {
visible: false
id: title
y: parent.height / 2 - this.height / 2
source: "../close.png"
//x: 5
anchors {
font.pixelSize: 10
right: parent.right
rightMargin: 5
}
}
MouseArea {
anchors.fill: parent
Image {
onClicked: {
id: closeButton
console.log("should close")
y: parent.height / 2 - this.height / 2
visible: false
source: "../close.png"
anchors {
right: parent.right
rightMargin: 5
}
MouseArea {
anchors.fill: parent
onClicked: {
console.log("should close")
}
}
}
}
}
}
}
...
@@ -331,7 +341,6 @@ ApplicationWindow {
...
@@ -331,7 +341,6 @@ ApplicationWindow {
}
}
*/
*/
function
createMenuItem
(
icon
,
view
,
options
)
{
function
createMenuItem
(
icon
,
view
,
options
)
{
if
(
options
===
undefined
)
{
if
(
options
===
undefined
)
{
options
=
{};
options
=
{};
...
@@ -340,8 +349,8 @@ ApplicationWindow {
...
@@ -340,8 +349,8 @@ ApplicationWindow {
var
comp
=
menuItemTemplate
.
createObject
(
menuColumn
)
var
comp
=
menuItemTemplate
.
createObject
(
menuColumn
)
comp
.
view
=
view
comp
.
view
=
view
comp
.
source
=
icon
comp
.
source
=
icon
//comp.title = options.title
/*
/*
comp.title = options.title
if(options.canClose) {
if(options.canClose) {
//comp.closeButton.visible = options.canClose
//comp.closeButton.visible = options.canClose
}
}
...
...
ethereal/assets/qml/webapp.qml
View file @
1fd69e95
...
@@ -238,6 +238,14 @@ ApplicationWindow {
...
@@ -238,6 +238,14 @@ ApplicationWindow {
break
;
break
;
case
"messages"
:
require
(
1
);
var
messages
=
JSON
.
parse
(
eth
.
getMessages
(
data
.
args
[
0
]))
postData
(
data
.
_seed
,
messages
)
break
case
"debug"
:
case
"debug"
:
console
.
log
(
data
.
args
[
0
]);
console
.
log
(
data
.
args
[
0
]);
break
;
break
;
...
...
ethereal/ext_app.go
View file @
1fd69e95
package
main
package
main
import
(
import
(
"encoding/json"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"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/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
)
)
...
@@ -24,6 +27,7 @@ type AppContainer interface {
...
@@ -24,6 +27,7 @@ type AppContainer interface {
type
ExtApplication
struct
{
type
ExtApplication
struct
{
*
ethpub
.
PEthereum
*
ethpub
.
PEthereum
eth
ethchain
.
EthManager
blockChan
chan
ethreact
.
Event
blockChan
chan
ethreact
.
Event
changeChan
chan
ethreact
.
Event
changeChan
chan
ethreact
.
Event
...
@@ -38,6 +42,7 @@ type ExtApplication struct {
...
@@ -38,6 +42,7 @@ type ExtApplication struct {
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
func
NewExtApplication
(
container
AppContainer
,
lib
*
UiLib
)
*
ExtApplication
{
app
:=
&
ExtApplication
{
app
:=
&
ExtApplication
{
ethpub
.
NewPEthereum
(
lib
.
eth
),
ethpub
.
NewPEthereum
(
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
bool
),
make
(
chan
bool
),
...
@@ -130,3 +135,50 @@ func (app *ExtApplication) Watch(addr, storageAddr string) {
...
@@ -130,3 +135,50 @@ func (app *ExtApplication) Watch(addr, storageAddr string) {
app
.
registeredEvents
=
append
(
app
.
registeredEvents
,
event
)
app
.
registeredEvents
=
append
(
app
.
registeredEvents
,
event
)
}
}
func
(
self
*
ExtApplication
)
GetMessages
(
object
map
[
string
]
interface
{})
string
{
filter
:=
ethchain
.
NewFilter
(
self
.
eth
)
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
()
var
msgs
[]
javascript
.
JSMessage
for
_
,
m
:=
range
messages
{
msgs
=
append
(
msgs
,
javascript
.
NewJSMessage
(
m
))
}
b
,
err
:=
json
.
Marshal
(
msgs
)
if
err
!=
nil
{
return
"{
\"
error
\"
:"
+
err
.
Error
()
+
"}"
}
return
string
(
b
)
}
ethereal/gui.go
View file @
1fd69e95
...
@@ -515,11 +515,13 @@ func (gui *Gui) Printf(format string, v ...interface{}) {
...
@@ -515,11 +515,13 @@ func (gui *Gui) Printf(format string, v ...interface{}) {
// Print function that logs directly to the GUI
// Print function that logs directly to the GUI
func
(
gui
*
Gui
)
printLog
(
s
string
)
{
func
(
gui
*
Gui
)
printLog
(
s
string
)
{
str
:=
strings
.
TrimRight
(
s
,
"
\n
"
)
/*
lines
:=
strings
.
Split
(
str
,
"
\n
"
)
str := strings.TrimRight(s, "\n")
lines := strings.Split(str, "\n")
view
:=
gui
.
getObjectByName
(
"infoView"
)
view := gui.getObjectByName("infoView")
for
_
,
line
:=
range
lines
{
for _, line := range lines {
view
.
Call
(
"addLog"
,
line
)
view.Call("addLog", line)
}
}
*/
}
}
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