aboutsummaryrefslogtreecommitdiffstats
path: root/example/contract.html
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:12:07 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-22 04:12:07 +0800
commitc9693b47467f16a6f35be6de85f57244b70d7a01 (patch)
tree0df54c99eb4a1529123f27be8bfe321cc1539cfa /example/contract.html
parentceb4357a8d66e5112369293b15247f03c561c514 (diff)
downloadgo-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.gz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.bz2
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.lz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.xz
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.zst
go-tangerine-c9693b47467f16a6f35be6de85f57244b70d7a01.zip
contract.html example is working with sync api
Diffstat (limited to 'example/contract.html')
-rw-r--r--example/contract.html14
1 files changed, 6 insertions, 8 deletions
diff --git a/example/contract.html b/example/contract.html
index a3f0df176..3d0260d34 100644
--- a/example/contract.html
+++ b/example/contract.html
@@ -8,7 +8,7 @@
<script type="text/javascript">
var web3 = require('web3');
- web3.setProvider(new web3.providers.AutoProvider());
+ web3.setProvider(new web3.providers.HttpSyncProvider());
// solidity source code
var source = "" +
@@ -43,10 +43,9 @@
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() {
@@ -54,9 +53,8 @@
var param = parseInt(document.getElementById('value').value);
// call the contract
- contract.multiply(param).call().then(function(res) {
- document.getElementById('result').innerText = res[0];
- });
+ var res = contract.multiply(param).call();
+ document.getElementById('result').innerText = res[0];
}
</script>