|
|
@ -187,12 +187,13 @@ let WalletUtil = { |
|
|
|
return walletList; |
|
|
|
}, |
|
|
|
selectWallet: function(type, address) { |
|
|
|
console.log('选择钱包') |
|
|
|
uni.setStorageSync('walleti', address); |
|
|
|
let walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
let walletList = walletInfo[type]; |
|
|
|
console.log() |
|
|
|
for (var k = 0, length = walletList.length; k < length; k++) { |
|
|
|
if (walletList[k].address === address) { |
|
|
|
if (walletList[k].address == address) { |
|
|
|
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(25, |
|
|
|
address.length) |
|
|
|
uni.setStorageSync('wallet', walletList[k]); |
|
|
@ -204,6 +205,7 @@ let WalletUtil = { |
|
|
|
}, |
|
|
|
updateBalance:function() { |
|
|
|
const wallet = uni.getStorageSync('wallet'); |
|
|
|
console.log(wallet,'更新余额') |
|
|
|
const walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) { |
|
|
|
if (walletInfo[wallet.type][k].address === wallet.address) { |
|
|
@ -217,6 +219,7 @@ let WalletUtil = { |
|
|
|
that.getPrice('USDT',function(usdt){ |
|
|
|
switch (wallet.type) { |
|
|
|
case 'BTC': |
|
|
|
console.log("进来BTC") |
|
|
|
BtcUtil.getBalance(wallet.address,function(balance){ |
|
|
|
wallet.balance=balance; |
|
|
|
wallet.balancePrice=(balance*rr).toFixed(2); |
|
|
@ -226,6 +229,7 @@ let WalletUtil = { |
|
|
|
}) |
|
|
|
break; |
|
|
|
case 'ETH': |
|
|
|
console.log("进来ETH") |
|
|
|
EthUtil.getBalance(wallet.address,function(balance){ |
|
|
|
wallet.balance=balance; |
|
|
|
wallet.balancePrice=(balance*rr).toFixed(2); |
|
|
@ -243,7 +247,7 @@ let WalletUtil = { |
|
|
|
|
|
|
|
break; |
|
|
|
case 'TRX': |
|
|
|
|
|
|
|
console.log("进来TRX") |
|
|
|
TronUtil.getTronBalance(wallet.address).then((res) => { |
|
|
|
wallet.balance=res; |
|
|
|
wallet.balancePrice=(res*rr).toFixed(2); |
|
|
|