mirror of https://github.com/ethereum/go-ethereum
commit
1f5a6f1341
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,16 +1,12 @@ |
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
require('es6-promise').polyfill(); |
|
||||||
|
|
||||||
var web3 = require("../index.js"); |
var web3 = require("../index.js"); |
||||||
|
|
||||||
web3.setProvider(new web3.providers.HttpRpcProvider('http://localhost:8080')); |
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); |
||||||
|
|
||||||
|
var coinbase = web3.eth.coinbase; |
||||||
|
console.log(coinbase); |
||||||
|
|
||||||
|
var balance = web3.eth.balanceAt(coinbase); |
||||||
|
console.log(balance); |
||||||
|
|
||||||
web3.eth.coinbase.then(function(result){ |
|
||||||
console.log(result); |
|
||||||
return web3.eth.balanceAt(result); |
|
||||||
}).then(function(balance){ |
|
||||||
console.log(web3.toDecimal(balance)); |
|
||||||
}).catch(function(err){ |
|
||||||
console.log(err); |
|
||||||
}); |
|
@ -0,0 +1,18 @@ |
|||||||
|
var addressName = {"0x12378912345789": "Gav", "0x57835893478594739854": "Jeff"}; |
||||||
|
var nameAddress = {}; |
||||||
|
|
||||||
|
for (var prop in addressName) { |
||||||
|
if (addressName.hasOwnProperty(prop)) { |
||||||
|
nameAddress[addressName[prop]] = prop; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var local = { |
||||||
|
addressBook:{ |
||||||
|
byName: addressName, |
||||||
|
byAddress: nameAddress |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
if (typeof(module) !== "undefined") |
||||||
|
module.exports = local; |
Loading…
Reference in new issue