Browse Source

1234

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

17
utils/EthUtil.js

@ -12,15 +12,16 @@ if (typeof web3 !== 'undefined') {
let eth = {
// //获取主币eth余额
getBalance: async function(address) {
web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode));
console.log("查询余额:",address)
let balance = await web3.eth.getBalance(address);
console.log("余额:",balance)
return Number(balance) / Math.pow(10, 18);
},
// getBalance: async function(address) {
// web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode));
// console.log("查询余额:",address)
// let balance = await web3.eth.getBalance(address);
// console.log("余额:",balance)
// return Number(balance) / Math.pow(10, 18);
// },
// //获取eth代币币余额
// getTokenBalance: async function(address, contract) {
// console.log(address, contract)
@ -74,7 +75,7 @@ let eth = {
// 获取bms,bmdt,usdt/erc余额
getTokenBalance: async function(address, contract, success) {
web3 = new Web3();
const data = {
const data = {
'jsonrpc': '2.0',
'id': '1',
'method': 'eth_call',

Loading…
Cancel
Save