|
|
@ -181,7 +181,8 @@ let WalletUtil = { |
|
|
|
walletList = walletInfo[type] |
|
|
|
for (var k = 0, length = walletList.length; k < length; k++) { |
|
|
|
let address = walletList[k].address; |
|
|
|
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address.length - 6, |
|
|
|
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address |
|
|
|
.length - 6, |
|
|
|
address.length) |
|
|
|
} |
|
|
|
} else { |
|
|
@ -207,7 +208,8 @@ let WalletUtil = { |
|
|
|
console.log() |
|
|
|
for (var k = 0, length = walletList.length; k < length; k++) { |
|
|
|
if (walletList[k].address == address) { |
|
|
|
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address.length - 6, |
|
|
|
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address |
|
|
|
.length - 6, |
|
|
|
address.length) |
|
|
|
uni.setStorageSync('wallet', walletList[k]); |
|
|
|
break; |
|
|
@ -238,12 +240,15 @@ let WalletUtil = { |
|
|
|
wallet.balance = wallet.balance > 0 ? wallet.balance.toFixed(6) : wallet.balance |
|
|
|
console.log("进来ETH", wallet.balance) |
|
|
|
for (let i = 1; i < wallet.coinList.length; i++) { |
|
|
|
wallet.coinList[i].balance = await EthUtil.getTokenBalance(wallet.address, wallet.coinList[i].contractAddress); |
|
|
|
wallet.coinList[i].balance = await EthUtil.getTokenBalance(wallet.address, wallet.coinList[ |
|
|
|
i].contractAddress); |
|
|
|
console.log("进来ETH", wallet.coinList[i].balance) |
|
|
|
|
|
|
|
} |
|
|
|
wallet.totalBalancePrice = wallet.coinList[1].balancePrice?wallet.coinList[1].balancePrice:0; |
|
|
|
wallet.totalBalanceCnyPrice=wallet.coinList[1].balanceCnyPrice?wallet.coinList[1].balanceCnyPrice:0; |
|
|
|
wallet.totalBalancePrice = wallet.coinList[1].balancePrice ? wallet.coinList[1].balancePrice : |
|
|
|
0; |
|
|
|
wallet.totalBalanceCnyPrice = wallet.coinList[1].balanceCnyPrice ? wallet.coinList[1] |
|
|
|
.balanceCnyPrice : 0; |
|
|
|
wallet.coinList[1].balancePrice = (wallet |
|
|
|
.coinList[1].balance * usdtU.data.priceInUsd).toFixed(2); |
|
|
|
wallet.coinList[1].balanceCnyPrice = (wallet |
|
|
@ -256,12 +261,16 @@ let WalletUtil = { |
|
|
|
params.chainName = wallet.type; |
|
|
|
const tronCoin = await api.getBalance(params); |
|
|
|
var newList = []; |
|
|
|
|
|
|
|
newList.push(wallet.coinList[0]) |
|
|
|
newList.push(wallet.coinList[1]) |
|
|
|
newList[0].tokenType = "trc10" |
|
|
|
newList[0].contractAddress='_'; |
|
|
|
for (let i = 1; i < tronCoin.data.length; i++) { |
|
|
|
if (tronCoin.data[i].tokenAbbr === 'USDT') { |
|
|
|
newList[1].balance = (Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin |
|
|
|
.data[i].tokenDecimal)); |
|
|
|
newList[1].tokenType = "trc20" |
|
|
|
newList[1].balanceCnyPrice = (newList[1].balance * usdtU.data.priceCny).toFixed(2); |
|
|
|
newList[1].balancePrice = (newList[1].balance * usdtU.data.priceInUsd).toFixed(2); |
|
|
|
wallet.totalBalancePrice = newList[1].balancePrice |
|
|
@ -275,13 +284,10 @@ let WalletUtil = { |
|
|
|
balance: (Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin.data[i] |
|
|
|
.tokenDecimal)), |
|
|
|
icon: tronCoin.data[i].tokenLogo, |
|
|
|
|
|
|
|
} |
|
|
|
if (tronCoin.data[i].tokenType === 'trc20') { |
|
|
|
coin.contractAddress = tronCoin.data[i].tokenId |
|
|
|
} else { |
|
|
|
coin.contractAddress = tronCoin.data[i].owner_address |
|
|
|
contractAddress: tronCoin.data[i].tokenId, |
|
|
|
tokenType: tronCoin.data[i].tokenType |
|
|
|
} |
|
|
|
|
|
|
|
newList.push(coin) |
|
|
|
} |
|
|
|
|
|
|
@ -298,7 +304,8 @@ let WalletUtil = { |
|
|
|
wallet.balancePrice = (wallet.balance * mainCoinP.data.priceInUsd).toFixed(2); |
|
|
|
wallet.balanceCnyPrice = (wallet.balance * mainCoinP.data.priceCny).toFixed(2); |
|
|
|
wallet.totalBalancePrice = (Number(wallet.totalBalancePrice) + Number(wallet.balancePrice)).toFixed(2); |
|
|
|
wallet.totalBalanceCnyPrice=(Number(wallet.totalBalanceCnyPrice)+Number(wallet.balanceCnyPrice)).toFixed(2); |
|
|
|
wallet.totalBalanceCnyPrice = (Number(wallet.totalBalanceCnyPrice) + Number(wallet.balanceCnyPrice)) |
|
|
|
.toFixed(2); |
|
|
|
console.log("wallet.balancePrice", Number(wallet.totalBalancePrice)) |
|
|
|
console.log("wallet.balanceCnyPrice", wallet.totalBalancePrice) |
|
|
|
wallet.coinList[0].balance = wallet.balance |
|
|
|