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
dd45197b
Commit
dd45197b
authored
May 05, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added storage watch
parent
2582d719
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
18 deletions
+48
-18
ethereum.js
ethereal/assets/ethereum.js
+23
-3
webapp.qml
ethereal/assets/qml/webapp.qml
+14
-2
samplecoin.html
ethereal/assets/samplecoin/samplecoin.html
+6
-6
ext_app.go
ethereal/ui/ext_app.go
+3
-4
html_container.go
ethereal/ui/html_container.go
+2
-3
No files found.
ethereal/assets/ethereum.js
View file @
dd45197b
...
@@ -36,6 +36,7 @@ window.eth = {
...
@@ -36,6 +36,7 @@ window.eth = {
postData
({
call
:
"getKey"
},
cb
);
postData
({
call
:
"getKey"
},
cb
);
},
},
getBalanceAt
:
function
(
address
,
cb
)
{
getBalanceAt
:
function
(
address
,
cb
)
{
postData
({
call
:
"getBalance"
,
args
:
[
address
]},
cb
);
postData
({
call
:
"getBalance"
,
args
:
[
address
]},
cb
);
},
},
...
@@ -101,7 +102,13 @@ window.eth = {
...
@@ -101,7 +102,13 @@ window.eth = {
var
callbacks
=
eth
.
_onCallbacks
[
event
];
var
callbacks
=
eth
.
_onCallbacks
[
event
];
if
(
callbacks
!==
undefined
)
{
if
(
callbacks
!==
undefined
)
{
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
callbacks
.
length
;
i
++
)
{
callbacks
[
i
](
data
);
// Figure out whether the returned data was an array
// array means multiple return arguments (multiple params)
if
(
data
instanceof
Array
)
{
callbacks
[
i
].
apply
(
this
,
data
);
}
else
{
callbacks
[
i
].
call
(
this
,
data
);
}
}
}
}
}
},
},
...
@@ -109,6 +116,11 @@ window.eth = {
...
@@ -109,6 +116,11 @@ window.eth = {
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_callbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
window
.
eth
.
_onCallbacks
=
{}
function
hello
()
{
debug
(
"hello"
)
window
.
dataTest
=
true
;
}
function
debug
(
/**/
)
{
function
debug
(
/**/
)
{
var
args
=
arguments
;
var
args
=
arguments
;
var
msg
=
""
var
msg
=
""
...
@@ -120,6 +132,7 @@ function debug(/**/) {
...
@@ -120,6 +132,7 @@ function debug(/**/) {
}
}
}
}
postData
({
call
:
"debug"
,
args
:[
msg
]})
document
.
getElementById
(
"debug"
).
innerHTML
+=
"<br>"
+
msg
document
.
getElementById
(
"debug"
).
innerHTML
+=
"<br>"
+
msg
}
}
...
@@ -146,8 +159,14 @@ navigator.qt.onmessage = function(ev) {
...
@@ -146,8 +159,14 @@ navigator.qt.onmessage = function(ev) {
if
(
data
.
_seed
)
{
if
(
data
.
_seed
)
{
var
cb
=
eth
.
_callbacks
[
data
.
_seed
];
var
cb
=
eth
.
_callbacks
[
data
.
_seed
];
if
(
cb
)
{
if
(
cb
)
{
// Call the callback
// Figure out whether the returned data was an array
cb
(
data
.
data
);
// array means multiple return arguments (multiple params)
if
(
data
.
data
instanceof
Array
)
{
cb
.
apply
(
this
,
data
.
data
)
}
else
{
cb
.
call
(
this
,
data
.
data
)
}
// Remove the "trigger" callback
// Remove the "trigger" callback
delete
eth
.
_callbacks
[
ev
.
_seed
];
delete
eth
.
_callbacks
[
ev
.
_seed
];
}
}
...
@@ -211,3 +230,4 @@ String.prototype.hex2bin = function() {
...
@@ -211,3 +230,4 @@ String.prototype.hex2bin = function() {
String
.
prototype
.
num2bin
=
function
()
{
String
.
prototype
.
num2bin
=
function
()
{
return
(
"0x"
+
parseInt
(
this
).
toString
(
16
)).
bin
()
return
(
"0x"
+
parseInt
(
this
).
toString
(
16
)).
bin
()
}
}
ethereal/assets/qml/webapp.qml
View file @
dd45197b
...
@@ -41,7 +41,7 @@ ApplicationWindow {
...
@@ -41,7 +41,7 @@ ApplicationWindow {
experimental.preferences.developerExtrasEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
experimental.userScripts
:
[
ui
.
assetPath
(
"ethereum.js"
)]
experimental.userScripts
:
[
ui
.
assetPath
(
"ethereum.js"
)]
experimental.onMessageReceived
:
{
experimental.onMessageReceived
:
{
//
console.log("[onMessageReceived]: ", message.data)
console
.
log
(
"[onMessageReceived]: "
,
message
.
data
)
// TODO move to messaging.js
// TODO move to messaging.js
var
data
=
JSON
.
parse
(
message
.
data
)
var
data
=
JSON
.
parse
(
message
.
data
)
...
@@ -98,6 +98,15 @@ ApplicationWindow {
...
@@ -98,6 +98,15 @@ ApplicationWindow {
window
[
key
]
=
data
.
args
[
key
];
window
[
key
]
=
data
.
args
[
key
];
}
}
}
}
break
;
case
"debug"
:
console
.
log
(
data
.
args
[
0
]);
break
;
case
"test"
:
console
.
log
(
"in"
)
webview
.
experimental
.
evaluateJavaScript
(
"hello()"
)
console
.
log
(
"out"
)
break
;
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
data
.
call
+
": "
+
e
)
console
.
log
(
data
.
call
+
": "
+
e
)
...
@@ -124,7 +133,10 @@ ApplicationWindow {
...
@@ -124,7 +133,10 @@ ApplicationWindow {
function
onObjectChangeCb
(
stateObject
)
{
function
onObjectChangeCb
(
stateObject
)
{
postEvent
(
"object:"
+
stateObject
.
address
(),
stateObject
)
postEvent
(
"object:"
+
stateObject
.
address
(),
stateObject
)
}
}
function
onStorageChangeCb
()
{
function
onStorageChangeCb
(
storageObject
)
{
console
.
log
(
"storage object cb"
,
storageObject
)
var
ev
=
[
"storage"
,
storageObject
.
stateAddress
,
storageObject
.
address
].
join
(
":"
);
postEvent
(
ev
,
[
storageObject
.
address
,
storageObject
.
value
])
}
}
}
}
...
...
ethereal/assets/samplecoin/samplecoin.html
View file @
dd45197b
...
@@ -5,9 +5,11 @@
...
@@ -5,9 +5,11 @@
<link
rel=
"stylesheet"
href=
"bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"bootstrap-theme.min.css"
>
<link
rel=
"stylesheet"
href=
"bootstrap-theme.min.css"
>
<link
rel=
"stylesheet"
href=
"samplecoin.css"
>
<link
rel=
"stylesheet"
href=
"samplecoin.css"
>
<script
src=
"promise.min.js"
></script>
<meta
name=
"viewport"
content=
"minimum-scale=1; maximum-scale=1; initial-scale=1;"
>
<meta
name=
"viewport"
content=
"minimum-scale=1; maximum-scale=1; initial-scale=1;"
>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
jefcoinAddr
=
"3dff537f51350239abc95c76a5864aa605259e7d"
var
jefcoinAddr
=
"3dff537f51350239abc95c76a5864aa605259e7d"
var
mAddr
=
""
var
mAddr
=
""
...
@@ -17,12 +19,12 @@ function createTransaction() {
...
@@ -17,12 +19,12 @@ function createTransaction() {
var
data
=
((
"0x"
+
addr
).
pad
(
32
)
+
amount
.
pad
(
32
)).
unbin
()
var
data
=
((
"0x"
+
addr
).
pad
(
32
)
+
amount
.
pad
(
32
)).
unbin
()
eth
.
transact
(
mAddr
,
jefcoinAddr
,
0
,
"10000000"
,
"250"
,
data
,
function
(
receipt
)
{
eth
.
transact
(
mAddr
,
jefcoinAddr
,
0
,
"10000000"
,
"250"
,
data
,
function
(
receipt
)
{
debug
(
"received tx hash:"
,
rec
eipt
)
debug
(
"received tx hash:"
,
rec
iept
.
address
)
})
})
}
}
function
init
()
{
function
init
()
{
eth
.
set
({
width
:
500
})
eth
.
set
({
width
:
500
})
;
eth
.
getKey
(
function
(
keyPair
)
{
eth
.
getKey
(
function
(
keyPair
)
{
mAddr
=
keyPair
.
privateKey
;
mAddr
=
keyPair
.
privateKey
;
...
@@ -31,10 +33,8 @@ function init() {
...
@@ -31,10 +33,8 @@ function init() {
document
.
querySelector
(
"#current-amount"
).
innerHTML
=
storage
;
document
.
querySelector
(
"#current-amount"
).
innerHTML
=
storage
;
});
});
eth
.
watch
(
jefcoinAddr
,
function
(
stateObject
)
{
eth
.
watch
(
jefcoinAddr
,
keyPair
.
address
,
function
(
addr
,
value
)
{
eth
.
getStorageAt
(
jefcoinAddr
,
keyPair
.
address
,
function
(
storage
)
{
document
.
querySelector
(
"#current-amount"
).
innerHTML
=
value
document
.
querySelector
(
"#current-amount"
).
innerHTML
=
storage
;
});
});
});
});
});
}
}
...
...
ethereal/ui/ext_app.go
View file @
dd45197b
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
"math/big"
)
)
type
AppContainer
interface
{
type
AppContainer
interface
{
...
@@ -18,7 +17,7 @@ type AppContainer interface {
...
@@ -18,7 +17,7 @@ type AppContainer interface {
NewBlock
(
*
ethchain
.
Block
)
NewBlock
(
*
ethchain
.
Block
)
ObjectChanged
(
*
ethchain
.
StateObject
)
ObjectChanged
(
*
ethchain
.
StateObject
)
StorageChanged
(
*
ethchain
.
St
ateObject
,
[]
byte
,
*
big
.
Int
)
StorageChanged
(
*
ethchain
.
St
orageState
)
}
}
type
ExtApplication
struct
{
type
ExtApplication
struct
{
...
@@ -105,8 +104,8 @@ out:
...
@@ -105,8 +104,8 @@ out:
case
object
:=
<-
app
.
changeChan
:
case
object
:=
<-
app
.
changeChan
:
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
ethchain
.
StateObject
);
ok
{
if
stateObject
,
ok
:=
object
.
Resource
.
(
*
ethchain
.
StateObject
);
ok
{
app
.
container
.
ObjectChanged
(
stateObject
)
app
.
container
.
ObjectChanged
(
stateObject
)
}
else
if
_
,
ok
:=
object
.
Resource
.
(
*
big
.
Int
);
ok
{
}
else
if
storageObject
,
ok
:=
object
.
Resource
.
(
*
ethchain
.
StorageState
);
ok
{
//
app
.
container
.
StorageChanged
(
storageObject
)
}
}
}
}
}
}
...
...
ethereal/ui/html_container.go
View file @
dd45197b
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
"math/big"
"path/filepath"
"path/filepath"
)
)
...
@@ -65,8 +64,8 @@ func (app *HtmlApplication) ObjectChanged(stateObject *ethchain.StateObject) {
...
@@ -65,8 +64,8 @@ func (app *HtmlApplication) ObjectChanged(stateObject *ethchain.StateObject) {
app
.
webView
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
app
.
webView
.
Call
(
"onObjectChangeCb"
,
ethpub
.
NewPStateObject
(
stateObject
))
}
}
func
(
app
*
HtmlApplication
)
StorageChanged
(
st
ateObject
*
ethchain
.
StateObject
,
addr
[]
byte
,
value
*
big
.
Int
)
{
func
(
app
*
HtmlApplication
)
StorageChanged
(
st
orageObject
*
ethchain
.
StorageState
)
{
app
.
webView
.
Call
(
"onStorageChangeCb"
,
nil
)
app
.
webView
.
Call
(
"onStorageChangeCb"
,
ethpub
.
NewPStorageState
(
storageObject
)
)
}
}
func
(
app
*
HtmlApplication
)
Destroy
()
{
func
(
app
*
HtmlApplication
)
Destroy
()
{
...
...
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