Browse Source

1234

master
vee 4 years ago
parent
commit
3aaaecdece
  1. 15
      utils/EthUtil.js

15
utils/EthUtil.js

@ -12,15 +12,16 @@ if (typeof web3 !== 'undefined') {
let eth = { let eth = {
// //获取主币eth余额 // //获取主币eth余额
getBalance: async function(address) { // getBalance: async function(address) {
web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode)); // web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode));
console.log("查询余额:",address) // console.log("查询余额:",address)
let balance = await web3.eth.getBalance(address); // let balance = await web3.eth.getBalance(address);
console.log("余额:",balance) // console.log("余额:",balance)
return Number(balance) / Math.pow(10, 18); // return Number(balance) / Math.pow(10, 18);
}, // },
// //获取eth代币币余额 // //获取eth代币币余额
// getTokenBalance: async function(address, contract) { // getTokenBalance: async function(address, contract) {
// console.log(address, contract) // console.log(address, contract)

Loading…
Cancel
Save