Browse Source

fixed natspec example

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
111826937c
  1. 17
      libjsqrc/ethereumjs/example/natspec_contract.html
  2. 2
      libjsqrc/natspec.js

17
libjsqrc/ethereumjs/example/natspec_contract.html

@ -9,7 +9,7 @@
<script type="text/javascript">
var web3 = require('web3');
web3.setProvider(new web3.providers.AutoProvider());
web3.setProvider(new web3.providers.QtSyncProvider());
// solidity source code
var source = "" +
@ -45,20 +45,19 @@
document.getElementById('source').innerText = source;
// create contract
web3.eth.transact({code: web3.eth.solidity(source)}).then(function (address) {
contract = web3.eth.contract(address, desc);
document.getElementById('call').style.visibility = 'visible';
});
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);
// call the contract
contract.multiply(param).transact().then(function(res) {
document.getElementById('result').innerText = res[0];
});
// transaction does not return any result, cause it's not synchronous and we don't know,
// when it will be processed
contract.multiply(param).transact();
document.getElementById('result').innerText = 'transaction made';
}
</script>

2
libjsqrc/natspec.js

@ -39,7 +39,7 @@ var getContractMethods = function (address, abi) {
var impl = function () {
var params = Array.prototype.slice.call(arguments);
var parsed = inputParser[displayName][typeName].apply(null, params);
var signature = web3.abi.methodSignature(web3.method.name);
var signature = web3.abi.methodSignature(method.name);
var output = _natspec.call(JSON.stringify({
to: address,
data: signature + parsed

Loading…
Cancel
Save