mirror of https://github.com/status-im/op-geth.git
fixed natspec example
This commit is contained in:
parent
5e623f14f3
commit
d6a92b18d4
|
@ -9,7 +9,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var web3 = require('web3');
|
var web3 = require('web3');
|
||||||
web3.setProvider(new web3.providers.AutoProvider());
|
web3.setProvider(new web3.providers.QtSyncProvider());
|
||||||
|
|
||||||
// solidity source code
|
// solidity source code
|
||||||
var source = "" +
|
var source = "" +
|
||||||
|
@ -45,20 +45,19 @@
|
||||||
document.getElementById('source').innerText = source;
|
document.getElementById('source').innerText = source;
|
||||||
|
|
||||||
// create contract
|
// create contract
|
||||||
web3.eth.transact({code: web3.eth.solidity(source)}).then(function (address) {
|
var address = web3.eth.transact({code: web3.eth.solidity(source)});
|
||||||
contract = web3.eth.contract(address, desc);
|
contract = web3.eth.contract(address, desc);
|
||||||
document.getElementById('call').style.visibility = 'visible';
|
document.getElementById('call').style.visibility = 'visible';
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function callExampleContract() {
|
function callExampleContract() {
|
||||||
// this should be generated by ethereum
|
// this should be generated by ethereum
|
||||||
var param = parseInt(document.getElementById('value').value);
|
var param = parseInt(document.getElementById('value').value);
|
||||||
|
|
||||||
// call the contract
|
// transaction does not return any result, cause it's not synchronous and we don't know,
|
||||||
contract.multiply(param).transact().then(function(res) {
|
// when it will be processed
|
||||||
document.getElementById('result').innerText = res[0];
|
contract.multiply(param).transact();
|
||||||
});
|
document.getElementById('result').innerText = 'transaction made';
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue