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
7843390e
Commit
7843390e
authored
Jun 04, 2014
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement getStateKeyVal for JS bindings.
Gives JS the option to 'loop' over contract key/val storage
parent
307fe4a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
3 deletions
+18
-3
ethereum.js
ethereal/assets/ext/ethereum.js
+4
-0
webapp.qml
ethereal/assets/qml/webapp.qml
+7
-2
gui.go
ethereal/ui/gui.go
+2
-0
repl.go
ethereum/repl.go
+5
-1
No files found.
ethereal/assets/ext/ethereum.js
View file @
7843390e
...
@@ -32,6 +32,10 @@ window.eth = {
...
@@ -32,6 +32,10 @@ window.eth = {
postData
({
call
:
"getStorage"
,
args
:
[
address
,
storageAddress
]},
cb
);
postData
({
call
:
"getStorage"
,
args
:
[
address
,
storageAddress
]},
cb
);
},
},
getStateKeyVals
:
function
(
address
,
cb
){
postData
({
call
:
"getStateKeyVals"
,
args
:
[
address
]},
cb
);
},
getKey
:
function
(
cb
)
{
getKey
:
function
(
cb
)
{
postData
({
call
:
"getKey"
},
cb
);
postData
({
call
:
"getKey"
},
cb
);
},
},
...
...
ethereal/assets/qml/webapp.qml
View file @
7843390e
...
@@ -34,7 +34,6 @@ ApplicationWindow {
...
@@ -34,7 +34,6 @@ ApplicationWindow {
top: parent.top
top: parent.top
}
}
*/
*/
onTitleChanged
:
{
window
.
title
=
title
}
onTitleChanged
:
{
window
.
title
=
title
}
experimental.preferences.javascriptEnabled
:
true
experimental.preferences.javascriptEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
...
@@ -97,6 +96,12 @@ ApplicationWindow {
...
@@ -97,6 +96,12 @@ ApplicationWindow {
var
storage
=
stateObject
.
getStorage
(
data
.
args
[
1
])
var
storage
=
stateObject
.
getStorage
(
data
.
args
[
1
])
postData
(
data
.
_seed
,
storage
)
postData
(
data
.
_seed
,
storage
)
break
case
"getStateKeyVals"
:
require
(
1
);
var
stateObject
=
eth
.
getStateObject
(
data
.
args
[
0
]).
stateKeyVal
(
true
)
postData
(
data
.
_seed
,
stateObject
)
break
break
case
"getBalance"
:
case
"getBalance"
:
require
(
1
);
require
(
1
);
...
@@ -188,7 +193,7 @@ ApplicationWindow {
...
@@ -188,7 +193,7 @@ ApplicationWindow {
WebView
{
WebView
{
id
:
inspector
id
:
inspector
visible
:
fals
e
visible
:
tru
e
url
:
webview
.
experimental
.
remoteInspectorUrl
url
:
webview
.
experimental
.
remoteInspectorUrl
anchors
{
anchors
{
left
:
root
.
left
left
:
root
.
left
...
...
ethereal/ui/gui.go
View file @
7843390e
...
@@ -65,6 +65,8 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -65,6 +65,8 @@ func (gui *Gui) Start(assetPath string) {
Init
:
func
(
p
*
ethpub
.
PBlock
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
Init
:
func
(
p
*
ethpub
.
PBlock
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
},
{
},
{
Init
:
func
(
p
*
ethpub
.
PTx
,
obj
qml
.
Object
)
{
p
.
Value
=
""
;
p
.
Hash
=
""
;
p
.
Address
=
""
},
Init
:
func
(
p
*
ethpub
.
PTx
,
obj
qml
.
Object
)
{
p
.
Value
=
""
;
p
.
Hash
=
""
;
p
.
Address
=
""
},
},
{
Init
:
func
(
p
*
ethpub
.
KeyVal
,
obj
qml
.
Object
)
{
p
.
Key
=
""
;
p
.
Value
=
""
},
}})
}})
ethutil
.
Config
.
SetClientString
(
fmt
.
Sprintf
(
"/Ethereal v%s"
,
version
))
ethutil
.
Config
.
SetClientString
(
fmt
.
Sprintf
(
"/Ethereal v%s"
,
version
))
...
...
ethereum/repl.go
View file @
7843390e
...
@@ -78,6 +78,10 @@ func (self *JSEthereum) GetStateObject(addr string) otto.Value {
...
@@ -78,6 +78,10 @@ func (self *JSEthereum) GetStateObject(addr string) otto.Value {
return
self
.
toVal
(
self
.
PEthereum
.
GetStateObject
(
addr
))
return
self
.
toVal
(
self
.
PEthereum
.
GetStateObject
(
addr
))
}
}
func
(
self
*
JSEthereum
)
GetStateKeyVals
(
addr
string
)
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetStateObject
(
addr
)
.
StateKeyVal
(
false
))
}
func
(
self
*
JSEthereum
)
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
string
)
otto
.
Value
{
func
(
self
*
JSEthereum
)
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
string
)
otto
.
Value
{
r
,
err
:=
self
.
PEthereum
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
r
,
err
:=
self
.
PEthereum
.
Transact
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
dataStr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -105,7 +109,7 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value {
...
@@ -105,7 +109,7 @@ func (self *JSEthereum) toVal(v interface{}) otto.Value {
result
,
err
:=
self
.
vm
.
ToValue
(
v
)
result
,
err
:=
self
.
vm
.
ToValue
(
v
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
"Value unknown:"
,
err
)
return
otto
.
UndefinedValue
()
return
otto
.
UndefinedValue
()
}
}
...
...
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