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
3e174a08
Commit
3e174a08
authored
Nov 04, 2014
by
Marian OANCΞA
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from cubedro/example
example
parents
b0e11826
0cdef337
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
index.html
index.html
+18
-11
No files found.
index.html
View file @
3e174a08
...
...
@@ -2,22 +2,27 @@
<html>
<head>
<script
type=
"text/javascript"
src=
"es6-promise-2.0.0.js"
></script>
<script
type=
"text/javascript"
src=
"main.js"
></script>
<script
type=
"text/javascript"
src=
"websocket.js"
></script>
<script
type=
"text/javascript"
src=
"qt.js"
></script>
<script
type=
"text/javascript"
src=
"httprpc.js"
></script>
<script
type=
"text/javascript"
>
function
registerName
()
{
var
name
=
document
.
querySelector
(
"#name"
).
value
;
name
=
web3
.
fromAscii
(
name
);
var
eth
=
web3
.
eth
;
eth
.
transact
({
to
:
"NameReg"
,
gas
:
"10000"
,
gasPrice
:
eth
.
gasPrice
,
data
:
[
web3
.
fromAscii
(
"register"
),
name
]}).
then
(
function
(
tx
)
{
document
.
querySelector
(
"#result"
).
innerHTML
=
"Registered name. Please wait for the next block to come through."
;
},
function
(
err
)
{
console
.
log
(
err
);
if
(
window
.
Promise
===
undefined
)
{
window
.
Promise
=
ES6Promise
.
Promise
;
}
//web3.setProvider(new web3.providers.QtProvider());
web3
.
setProvider
(
new
web3
.
providers
.
HttpRpcProvider
(
"http://localhost:8080"
));
function
testSnippet
()
{
web3
.
eth
.
watch
({
altered
:
web3
.
eth
.
coinbase
}).
changed
(
function
()
{
web3
.
eth
.
balanceAt
(
web3
.
eth
.
coinbase
).
then
(
function
(
balance
)
{
document
.
getElementById
(
"result"
).
innerText
=
web3
.
toDecimal
(
balance
);
});
});
}
</script>
</head>
...
...
@@ -25,8 +30,10 @@ function registerName() {
<h1>
std::name_reg
</h1>
<input
type=
"text"
id=
"name"
></input>
<input
type=
"submit"
onClick=
"registerName();"
></input>
<div
id=
"result"
></div>
<button
type=
"button"
onClick=
"testSnippet();"
>
test snippet
</button>
<div></div>
result:
<div
id=
"result"
></div>
</body>
...
...
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