aboutsummaryrefslogtreecommitdiffstats
path: root/example/balance.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/balance.html
parentceb4357a8d66e5112369293b15247f03c561c514 (diff)
downloaddexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.gz
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.bz2
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.lz
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.xz
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.tar.zst
dexon-c9693b47467f16a6f35be6de85f57244b70d7a01.zip
contract.html example is working with sync api
Diffstat (limited to 'example/balance.html')
-rw-r--r--example/balance.html16
1 files changed, 7 insertions, 9 deletions
diff --git a/example/balance.html b/example/balance.html
index 53a65805f..60b8bbe87 100644
--- a/example/balance.html
+++ b/example/balance.html
@@ -14,17 +14,15 @@
var coinbase = web3.eth.coinbase;
var originalBalance = 0;
- web3.eth.balanceAt(coinbase).then(function (balance) {
- originalBalance = web3.toDecimal(balance);
- document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
- });
+ var balance = web3.eth.balanceAt(coinbase);
+ var originalBalance = web3.toDecimal(balance);
+ document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
web3.eth.watch({altered: coinbase}).changed(function() {
- web3.eth.balanceAt(coinbase).then(function (balance) {
- var currentBalance = web3.toDecimal(balance);
- document.getElementById("current").innerText = 'current: ' + currentBalance;
- document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance);
- });
+ balance = web3.eth.balanceAt(coinbase)
+ var currentBalance = web3.toDecimal(balance);
+ document.getElementById("current").innerText = 'current: ' + currentBalance;
+ document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance);
});
}