mirror of https://github.com/status-im/web3.js.git
Merge branch 'develop' of github.com:ethereum/web3.js into develop
This commit is contained in:
commit
d02a3756c9
|
@ -44,9 +44,25 @@
|
|||
// let's assume that coinbase is our account
|
||||
web3.eth.defaultAccount = web3.eth.coinbase;
|
||||
|
||||
var watch = web3.eth.filter('latest');
|
||||
|
||||
// create contract
|
||||
myContract = web3.eth.contract(desc).new({data: code});
|
||||
document.getElementById('call').style.visibility = 'visible';
|
||||
console.log('address: ' + myContract.address);
|
||||
document.getElementById('status').innerText = "transaction send, waiting for confirmation";
|
||||
watch.watch(function (err, hash) {
|
||||
var block = web3.eth.getBlock(hash, true);
|
||||
var contractMined = block.transactions.reduce(function (mined, th) {
|
||||
// TODO: compiled code do not have 0x prefix
|
||||
return mined || (th.from === web3.eth.defaultAccount && th.input.indexOf(code) !== -1);
|
||||
}, false);
|
||||
|
||||
if (contractMined) {
|
||||
document.getElementById('status').innerText = 'Mined!';
|
||||
document.getElementById('call').style.visibility = 'visible';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function callExampleContract() {
|
||||
|
@ -63,6 +79,7 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue