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
508f1167
Commit
508f1167
authored
Jan 15, 2015
by
Lefteris Karapetsas
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #798 from LefterisJP/natspec_OnContractCreation
Natspec Popup Authentication on transaction
parents
b6c0e53d
a4049fb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
natspec_contract.html
example/natspec_contract.html
+77
-0
No files found.
example/natspec_contract.html
0 → 100644
View file @
508f1167
<
!
doctype
>
<html>
<head>
<script
type=
"text/javascript"
src=
"js/es6-promise/promise.min.js"
></script>
<script
type=
"text/javascript"
src=
"../dist/ethereum.js"
></script>
<script
type=
"text/javascript"
>
var
web3
=
require
(
'web3'
);
web3
.
setProvider
(
new
web3
.
providers
.
AutoProvider
());
// solidity source code
var
source
=
""
+
"contract test {
\n
"
+
" /// @notice Will multiplty `a` by 7.
\n
"
+
" function multiply(uint a) returns(uint d) {
\n
"
+
" return a * 7;
\n
"
+
" }
\n
"
+
"}
\n
"
;
// contract description, this will be autogenerated somehow
var
desc
=
[{
"name"
:
"multiply"
,
"inputs"
:
[
{
"name"
:
"a"
,
"type"
:
"uint256"
}
],
"outputs"
:
[
{
"name"
:
"d"
,
"type"
:
"uint256"
}
]
}];
var
contract
;
function
createExampleContract
()
{
// hide create button
document
.
getElementById
(
'create'
).
style
.
visibility
=
'hidden'
;
document
.
getElementById
(
'source'
).
innerText
=
source
;
// create contract
web3
.
eth
.
transact
({
code
:
web3
.
eth
.
solidity
(
source
)}).
then
(
function
(
address
)
{
contract
=
web3
.
contract
(
address
,
desc
);
document
.
getElementById
(
'call'
).
style
.
visibility
=
'visible'
;
});
}
function
callExampleContract
()
{
// this should be generated by ethereum
var
param
=
parseInt
(
document
.
getElementById
(
'value'
).
value
);
// call the contract
contract
.
multiply
(
param
).
transact
().
then
(
function
(
res
)
{
document
.
getElementById
(
'result'
).
innerText
=
res
[
0
];
});
}
</script>
</head>
<body>
<h1>
contract
</h1>
<div
id=
"source"
></div>
<div
id=
'create'
>
<button
type=
"button"
onClick=
"createExampleContract();"
>
create example contract
</button>
</div>
<div
id=
'call'
style=
'visibility: hidden;'
>
<input
type=
"number"
id=
"value"
></input>
<button
type=
"button"
onClick=
"callExampleContract()"
>
Call Contract
</button>
</div>
<div
id=
"result"
></div>
</body>
</html>
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