You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5 KiB

Squashed 'libjsqrc/ethereumjs/' changes from 2a0b46a..d5d2115 d5d2115 example contract using array, fixed #185 21ed235 removed connection keep-alive c44fe01 version 0.7.1 d9b785e fixed #248 490dde5 fixed encoding/decoding strings, #249 b3f5d09 fixed long bytes dynamic decoding/encoding, #249 d097821 small filter improvement d59b1cd removed xhr from browser 42b6e9d version 0.7.0 fe6defd gulp 44dcd24 set connection keepalive 2b17c0f gulpfile changes 4a46c73 Merge pull request #228 from ethereum/strings 93c8006 tests for encoding and decoding prematurely terminated strings and strings containing internal zeros 7dd44e7 Merge branch 'strings' of https://github.com/ethereum/ethereum.js into strings 390a9ff Merge branch 'develop' into strings bcd9cfb updated deps, removed unused karma ef15fc1 Merge pull request #244 from ethereum/allevents 6f74d57 Merge branch 'develop' into allevents 7aca17e Merge branch 'develop' into allevents c5ee34d fix for optional event parameters 8170a0a Merge pull request #245 from ethereum/filterInstantWatch 76a094c fixed all issues noted by marek d78b512 add possible callback to filters e1b17a9 re-build develop af9c027 all events filter b270616 version 0.6.1 c47d6a8 gulp 7cf7cf3 map file 6da1d3e gulp 450042e Update eth.js 3951286 Added sendRawTransaction 323b529 merged develop 16ffdf6 merged master ecf0a2c changed | to Math.floor d2b5ba2 Merge pull request #239 from ethereum/mistFixes 9e6bf9d removed browser XHR 9061116 fixed build issues in formatInputDynamicBytes 0e3b29c fixed coverage issue d51e9a2 merged latest develop f0247aa made meteor package available on the server side as well e97c5f5 fixed and tested meteor package init 3e49f56 add currentProvidor and mist fixes bd6d9ba merged develop 7b730b1 Merge branch 'strings' of github.com:ethereum/web3.js into strings cc533d9 fixed bytes wrong encoding 8c6f976 Merge branch 'develop' into strings 7c970e3 add bytes32 test with leading 0 9c7f7bb re-add .map files 189484f add extra int tests 73cc711 Merge branch 'develop' into strings fa3239f abi string type, fixes #216, #218, #219 git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: d5d2115bf9ad07a736a189e1022b7d3a549e4006
10 years ago
<!doctype>
<html>
<head>
<script type="text/javascript" src="../dist/web3.js"></script>
<script type="text/javascript">
var web3 = require('web3');
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
// solidity code code
var source = "" +
"contract test {\n" +
" function take(uint[] a, uint b) constant returns(uint d) {\n" +
" return a[b];\n" +
" }\n" +
"}\n";
var compiled = web3.eth.compile.solidity(source);
var code = compiled.test.code;
// contract json abi, this is autogenerated using solc CLI
var abi = compiled.test.info.abiDefinition;
var myContract;
function createExampleContract() {
// hide create button
document.getElementById('create').style.visibility = 'hidden';
document.getElementById('code').innerText = code;
// let's assume that coinbase is our account
web3.eth.defaultAccount = web3.eth.coinbase;
// create contract
document.getElementById('status').innerText = "transaction sent, waiting for confirmation";
web3.eth.contract(abi).new({data: code}, function (err, contract) {
if (err) {
console.error(err);
return;
// callback fires twice, we only want the second call when the contract is deployed
} else if(contract.address){
myContract = contract;
console.log('address: ' + myContract.address);
Squashed &#39;libjsqrc/ethereumjs/&#39; changes from 2a0b46a..d5d2115 d5d2115 example contract using array, fixed #185 21ed235 removed connection keep-alive c44fe01 version 0.7.1 d9b785e fixed #248 490dde5 fixed encoding/decoding strings, #249 b3f5d09 fixed long bytes dynamic decoding/encoding, #249 d097821 small filter improvement d59b1cd removed xhr from browser 42b6e9d version 0.7.0 fe6defd gulp 44dcd24 set connection keepalive 2b17c0f gulpfile changes 4a46c73 Merge pull request #228 from ethereum/strings 93c8006 tests for encoding and decoding prematurely terminated strings and strings containing internal zeros 7dd44e7 Merge branch &#39;strings&#39; of https://github.com/ethereum/ethereum.js into strings 390a9ff Merge branch &#39;develop&#39; into strings bcd9cfb updated deps, removed unused karma ef15fc1 Merge pull request #244 from ethereum/allevents 6f74d57 Merge branch &#39;develop&#39; into allevents 7aca17e Merge branch &#39;develop&#39; into allevents c5ee34d fix for optional event parameters 8170a0a Merge pull request #245 from ethereum/filterInstantWatch 76a094c fixed all issues noted by marek d78b512 add possible callback to filters e1b17a9 re-build develop af9c027 all events filter b270616 version 0.6.1 c47d6a8 gulp 7cf7cf3 map file 6da1d3e gulp 450042e Update eth.js 3951286 Added sendRawTransaction 323b529 merged develop 16ffdf6 merged master ecf0a2c changed | to Math.floor d2b5ba2 Merge pull request #239 from ethereum/mistFixes 9e6bf9d removed browser XHR 9061116 fixed build issues in formatInputDynamicBytes 0e3b29c fixed coverage issue d51e9a2 merged latest develop f0247aa made meteor package available on the server side as well e97c5f5 fixed and tested meteor package init 3e49f56 add currentProvidor and mist fixes bd6d9ba merged develop 7b730b1 Merge branch &#39;strings&#39; of github.com:ethereum/web3.js into strings cc533d9 fixed bytes wrong encoding 8c6f976 Merge branch &#39;develop&#39; into strings 7c970e3 add bytes32 test with leading 0 9c7f7bb re-add .map files 189484f add extra int tests 73cc711 Merge branch &#39;develop&#39; into strings fa3239f abi string type, fixes #216, #218, #219 git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: d5d2115bf9ad07a736a189e1022b7d3a549e4006
10 years ago
document.getElementById('status').innerText = 'Mined!';
document.getElementById('call').style.visibility = 'visible';
}
});
}
function callExampleContract() {
// this should be generated by ethereum
var param = parseInt(document.getElementById('value').value);
// call the contract
var res = myContract.take([0,6,5,2,1,5,6], param);
document.getElementById('result').innerText = res.toString(10);
}
</script>
</head>
<body>
<h1>contract</h1>
<div id="code"></div>
<div id="status"></div>
<div id='create'>
<button type="button" onClick="createExampleContract();">create example contract</button>
</div>
<div id='call' style='visibility: hidden;'>
<div>var array = [0,6,5,2,1,5,6];</div>
<div>var x = array[
<input type="number" id="value" onkeyup='callExampleContract()'></input>
];
</div>
</div>
<div id="result"></div>
</body>
</html>