Browse Source
d223ac0 Additional work on the JS stuff to make it more similar to Solidity. 113a380 Fix string outputs. Auto collapse for < 2 returns. fb34c6c Auto select call or transact depending on constness. 7869294 Fixes to ethereum.js and standard.js. 61a0158 Vanity addresses in AZ. Fixes to ethereum.js eth.flush() c01f0ae Merge commit 'b1971f46cce7d21be5f6277c9f8c406a0d195f78' into natspec 29fa57e natspec.js updated to use sync api 13f39af Merge commit '93fa6855afad7a7eb86e49efe384372a6060da35' into natspec 6c4432d Merge commit 'b32dedc5b54f853cf63bb2663c8bca6aa4272b0b' into natspec 375ca54 Merge commit '8e3ba3a4285cc7e902a018196b3849df56944dd0' into natspec d6a92b1 fixed natspec example 5e623f1 Merge commit 'cdd7af2a6e87363d0ff7d2528f9d9b521bf2ef20' into natspec ad8e92e Merge commit 'eb4984c0d036c1420e782ca136810e851e33fb37' into natspec 81ff253 Merge commit 'c4638ba3edbd14677da5441d61f7845668df2b22' into natspec e68f8e7 natspec changes 689630d Merge commit '53b4fda16d0b191be8ab986379a328aa38aaf916' into natspec 5c79ee4 fixed natspec_contract.html example 83505e6 Merge commit '2b4d38b9bf059014596e1ab00c99dc2ad4ab3761' into ethereumjs 2ce109e Merge commit '6a383d6ed3fb37cf6739f6ac441652adfdb70463' into ethereumjs 1c4d8f3 Merge commit '29333fc213b62b27ef826616cf77430947fb6eab' into ethereumjs de4ea8e Merge commit 'd876522bc0614fea3180a54be57bcb61784b352e' into ethereumjs 6d02c0d Merge commit '1a6dbeff6e86d65cae6d7db366cbaa4182eaff7f' into ethereumjs 508f116 Merge pull request #798 from LefterisJP/natspec_OnContractCreation a4049fb Cleaned up some unused functions dac93ed Natspechandler: Get function hash from transaction data f54c90a A first version of Natspec warning popup b6c0e53 Auto-generated commits, too. e95bb34 Fix for JS API formatting. git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: d223ac0379c4c1f8c209e777ec9ed63384590157cl-refactor
7 changed files with 175 additions and 17 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,78 @@ |
|||
<!doctype> |
|||
<html> |
|||
|
|||
<head> |
|||
<script type="text/javascript" src="js/es6-promise/promise.min.js"></script> |
|||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script> |
|||
<script type="text/javascript" src="../dist/ethereum.js"></script> |
|||
<script type="text/javascript" src="../../natspec.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
var web3 = require('web3'); |
|||
web3.setProvider(new web3.providers.QtSyncProvider()); |
|||
|
|||
// solidity source code |
|||
var source = "" + |
|||
"contract test {\n" + |
|||
" /// @notice Will multiply `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(uint256)", |
|||
"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 |
|||
var address = web3.eth.transact({code: web3.eth.solidity(source)}); |
|||
contract = web3.eth.contract(address, desc); |
|||
document.getElementById('call').style.visibility = 'visible'; |
|||
} |
|||
|
|||
function callExampleContract() { |
|||
// this should be generated by ethereum |
|||
var param = parseInt(document.getElementById('value').value); |
|||
|
|||
// transaction does not return any result, cause it's not synchronous and we don't know, |
|||
// when it will be processed |
|||
contract.transact().multiply(param); |
|||
document.getElementById('result').innerText = 'transaction made'; |
|||
} |
|||
|
|||
</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> |
|||
|
Loading…
Reference in new issue