|
|
@ -77,222 +77,222 @@ |
|
|
|
// 比较 |
|
|
|
// 第二次创建钱包 第二次才执行 |
|
|
|
finish2(e) { |
|
|
|
var a = uni.getStorageSync('createWalletName') |
|
|
|
if (a == 'BTC' && a != '' && a != undefined) { |
|
|
|
this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
var mnemonic = uni.getStorageSync('word'); |
|
|
|
console.log(mnemonic, 7777777777) |
|
|
|
let btc = this.$Token.generateBtc(mnemonic); |
|
|
|
|
|
|
|
btc.mnemonic = mnemonic; |
|
|
|
btc.password = e; |
|
|
|
|
|
|
|
|
|
|
|
this.$api.getBtcBalance().then((res) => { |
|
|
|
var b = res.data.data[0] |
|
|
|
for (var k in b) { |
|
|
|
this.btcBalance = b[k] |
|
|
|
} |
|
|
|
}) |
|
|
|
btc.coinList = [{ |
|
|
|
name: "BTC", |
|
|
|
name2: "BTC", |
|
|
|
xname: 'Bitcoin', |
|
|
|
icon: require('@/static/tongyonh/bye.png'), |
|
|
|
balance: this.btcBalance |
|
|
|
}]; |
|
|
|
btc.balance = this.btcBalance |
|
|
|
console.log(this.$store.state.btci, 555566565) |
|
|
|
this.$store.commit('addBtci', 1) |
|
|
|
uni.setStorageSync('wallet', btc) |
|
|
|
uni.setStorageSync('walleti', btc.privateKey) |
|
|
|
|
|
|
|
this.walletInfo.BTC[this.$store.state.btci] = btc; |
|
|
|
// 增加钱包位置 |
|
|
|
console.log(this.$store.state.btci, 555566565) |
|
|
|
console.log(this.walletInfo, 44444) |
|
|
|
uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
if (this.password != e) { |
|
|
|
this.info = true; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: 'successfully', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500, |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '../../wallet/index' |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
this.info = false; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (a == 'ETH' && a != '' && a != undefined) { |
|
|
|
|
|
|
|
this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
|
|
|
|
var mnemonic = uni.getStorageSync('word'); |
|
|
|
let eth = this.$Token.generateEth(mnemonic); |
|
|
|
|
|
|
|
eth.mnemonic = mnemonic; |
|
|
|
eth.password = e; |
|
|
|
|
|
|
|
this.$EthUtil.getBalance(eth.address,function(res){ |
|
|
|
eth.balance = res |
|
|
|
this.ethBbalance = res; |
|
|
|
console.log(res,'手机eth的钱包余额') |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
eth.coinList = [ |
|
|
|
{ |
|
|
|
name: "ETH", |
|
|
|
name2: "ETH", |
|
|
|
xname: 'Ethereum', |
|
|
|
icon: require('@/static/tongyonh/Frame3299.png'), |
|
|
|
balance: this.ethBbalance |
|
|
|
}, |
|
|
|
{ |
|
|
|
name:"USDT", |
|
|
|
name2:"ERC20-USDT", |
|
|
|
xname:'Tether USD', |
|
|
|
contractAddress:'0xdac17f958d2ee523a2206206994597c13d831ec7', |
|
|
|
icon:require('@/static/tongyonh/img500.png') |
|
|
|
} |
|
|
|
]; |
|
|
|
this.$store.commit('addEthi', 1) |
|
|
|
|
|
|
|
uni.setStorageSync('walleti', eth.privateKey) |
|
|
|
this.walletInfo.ETH[this.$store.state.ethi] = eth; |
|
|
|
|
|
|
|
// 增加钱包位置 |
|
|
|
console.log(this.$store.state.ethi, 555566565) |
|
|
|
console.log(this.walletInfo, 44444) |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
// 存一下当前钱包的索引方便后续做 |
|
|
|
var e=uni.getStorageSync(ethi) |
|
|
|
e+=1 |
|
|
|
uni.setStorageSync('ethi', e); |
|
|
|
uni.setStorageSync('itype', true); |
|
|
|
},1000) |
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
uni.setStorageSync('wallet', eth) |
|
|
|
},1000) |
|
|
|
if (this.password != e) { |
|
|
|
this.info = true; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: 'successfully', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500, |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '../../wallet/index' |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
this.info = false; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (a == 'TRX' && a != '' && a != undefined) { |
|
|
|
console.log(123123) |
|
|
|
this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
var mnemonic = uni.getStorageSync('word'); |
|
|
|
let tron = this.$Token.generateTron(mnemonic); |
|
|
|
tron.mnemonic = mnemonic; |
|
|
|
tron.password = e; |
|
|
|
|
|
|
|
this.$TronUtil.getTronBalance(tron.address).then((res) => { |
|
|
|
tron.balance = res |
|
|
|
this.trxBbalance = res |
|
|
|
console.log(res,'手机tron的钱包余额') |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
tron.coinList = [ |
|
|
|
{ |
|
|
|
name: "TRX", |
|
|
|
name2: "TRX", |
|
|
|
xname: 'TRON', |
|
|
|
icon: require('@/static/tongyonh/tron1.png'), |
|
|
|
balance: this.trxBbalance |
|
|
|
}, |
|
|
|
{ |
|
|
|
name:"USDT", |
|
|
|
name2:"TRC20-USDT", |
|
|
|
xname:'Tether USD', |
|
|
|
contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', |
|
|
|
icon:require('@/static/tongyonh/tether_usd.png') |
|
|
|
} |
|
|
|
]; |
|
|
|
console.log(this.$store.state.troni, 555566565) |
|
|
|
// 增加钱包位置 |
|
|
|
this.$store.commit('addTroni', 1) |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.setStorageSync('wallet', tron) |
|
|
|
},1000) |
|
|
|
uni.setStorageSync('walleti', tron.privateKey) |
|
|
|
this.walletInfo.TRON[this.$store.state.troni] = tron; |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
|
|
|
|
},1000) |
|
|
|
if (this.password != e) { |
|
|
|
this.info = true; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: 'Set successfully', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500, |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '../../wallet/index' |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
this.info = false; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.password != e) { |
|
|
|
this.info = true; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
var a = uni.getStorageSync('createWalletName') |
|
|
|
var mnemonic = uni.getStorageSync('word'); |
|
|
|
this.$walletUtil.mnemonicEstablishWallet(a,mnemonic,e) |
|
|
|
uni.showToast({ |
|
|
|
title: 'Set successfully', |
|
|
|
icon: 'success', |
|
|
|
duration: 1500, |
|
|
|
}) |
|
|
|
this.setWalletInfo(e); |
|
|
|
setTimeout(() => { |
|
|
|
// uni.navigateTo({ |
|
|
|
// url:'../reSuccessful' |
|
|
|
// }) |
|
|
|
uni.navigateTo({ |
|
|
|
url: '../../wallet/index' |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
this.info = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (a == 'BTC' && a != '' && a != undefined) { |
|
|
|
// this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
|
|
|
|
// console.log(mnemonic, 7777777777) |
|
|
|
// let btc = this.$Token.generateBtc(mnemonic); |
|
|
|
|
|
|
|
// btc.mnemonic = mnemonic; |
|
|
|
// btc.password = e; |
|
|
|
|
|
|
|
|
|
|
|
// this.$api.getBtcBalance().then((res) => { |
|
|
|
// var b = res.data.data[0] |
|
|
|
// for (var k in b) { |
|
|
|
// this.btcBalance = b[k] |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// btc.coinList = [{ |
|
|
|
// name: "BTC", |
|
|
|
// name2: "BTC", |
|
|
|
// xname: 'Bitcoin', |
|
|
|
// icon: require('@/static/tongyonh/bye.png'), |
|
|
|
// balance: this.btcBalance |
|
|
|
// }]; |
|
|
|
// btc.balance = this.btcBalance |
|
|
|
// console.log(this.$store.state.btci, 555566565) |
|
|
|
// this.$store.commit('addBtci', 1) |
|
|
|
// uni.setStorageSync('wallet', btc) |
|
|
|
// uni.setStorageSync('walleti', btc.privateKey) |
|
|
|
|
|
|
|
// this.walletInfo.BTC[this.$store.state.btci] = btc; |
|
|
|
// // 增加钱包位置 |
|
|
|
// console.log(this.$store.state.btci, 555566565) |
|
|
|
// console.log(this.walletInfo, 44444) |
|
|
|
// uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
// if (this.password != e) { |
|
|
|
// this.info = true; |
|
|
|
// return; |
|
|
|
// } else { |
|
|
|
// uni.showToast({ |
|
|
|
// title: 'successfully', |
|
|
|
// icon: 'success', |
|
|
|
// duration: 1500, |
|
|
|
// }) |
|
|
|
// setTimeout(() => { |
|
|
|
// uni.navigateTo({ |
|
|
|
// url: '../../wallet/index' |
|
|
|
// }) |
|
|
|
// }, 1500) |
|
|
|
// this.info = false; |
|
|
|
// } |
|
|
|
// return; |
|
|
|
// } |
|
|
|
|
|
|
|
// if (a == 'ETH' && a != '' && a != undefined) { |
|
|
|
|
|
|
|
// this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
|
|
|
|
// var mnemonic = uni.getStorageSync('word'); |
|
|
|
// let eth = this.$Token.generateEth(mnemonic); |
|
|
|
|
|
|
|
// eth.mnemonic = mnemonic; |
|
|
|
// eth.password = e; |
|
|
|
|
|
|
|
// this.$EthUtil.getBalance(eth.address,function(res){ |
|
|
|
// eth.balance = res |
|
|
|
// this.ethBbalance = res; |
|
|
|
// console.log(res,'手机eth的钱包余额') |
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
|
|
// eth.coinList = [ |
|
|
|
// { |
|
|
|
// name: "ETH", |
|
|
|
// name2: "ETH", |
|
|
|
// xname: 'Ethereum', |
|
|
|
// icon: require('@/static/tongyonh/Frame3299.png'), |
|
|
|
// balance: this.ethBbalance |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// name:"USDT", |
|
|
|
// name2:"ERC20-USDT", |
|
|
|
// xname:'Tether USD', |
|
|
|
// contractAddress:'0xdac17f958d2ee523a2206206994597c13d831ec7', |
|
|
|
// icon:require('@/static/tongyonh/img500.png') |
|
|
|
// } |
|
|
|
// ]; |
|
|
|
// this.$store.commit('addEthi', 1) |
|
|
|
|
|
|
|
// uni.setStorageSync('walleti', eth.privateKey) |
|
|
|
// this.walletInfo.ETH[this.$store.state.ethi] = eth; |
|
|
|
|
|
|
|
// // 增加钱包位置 |
|
|
|
// console.log(this.$store.state.ethi, 555566565) |
|
|
|
// console.log(this.walletInfo, 44444) |
|
|
|
// setTimeout(()=>{ |
|
|
|
// uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
// // 存一下当前钱包的索引方便后续做 |
|
|
|
// var e=uni.getStorageSync(ethi) |
|
|
|
// e+=1 |
|
|
|
// uni.setStorageSync('ethi', e); |
|
|
|
// uni.setStorageSync('itype', true); |
|
|
|
// },1000) |
|
|
|
|
|
|
|
// setTimeout(()=>{ |
|
|
|
// uni.setStorageSync('wallet', eth) |
|
|
|
// },1000) |
|
|
|
// if (this.password != e) { |
|
|
|
// this.info = true; |
|
|
|
// return; |
|
|
|
// } else { |
|
|
|
// uni.showToast({ |
|
|
|
// title: 'successfully', |
|
|
|
// icon: 'success', |
|
|
|
// duration: 1500, |
|
|
|
// }) |
|
|
|
// setTimeout(() => { |
|
|
|
// uni.navigateTo({ |
|
|
|
// url: '../../wallet/index' |
|
|
|
// }) |
|
|
|
// }, 1500) |
|
|
|
// this.info = false; |
|
|
|
// } |
|
|
|
// return; |
|
|
|
// } |
|
|
|
|
|
|
|
// if (a == 'TRX' && a != '' && a != undefined) { |
|
|
|
// console.log(123123) |
|
|
|
// this.walletInfo = uni.getStorageSync('walletInfo'); |
|
|
|
// var mnemonic = uni.getStorageSync('word'); |
|
|
|
// let tron = this.$Token.generateTron(mnemonic); |
|
|
|
// tron.mnemonic = mnemonic; |
|
|
|
// tron.password = e; |
|
|
|
|
|
|
|
// this.$TronUtil.getTronBalance(tron.address).then((res) => { |
|
|
|
// tron.balance = res |
|
|
|
// this.trxBbalance = res |
|
|
|
// console.log(res,'手机tron的钱包余额') |
|
|
|
|
|
|
|
// }).catch(err => { |
|
|
|
// console.log(err) |
|
|
|
// }) |
|
|
|
// tron.coinList = [ |
|
|
|
// { |
|
|
|
// name: "TRX", |
|
|
|
// name2: "TRX", |
|
|
|
// xname: 'TRON', |
|
|
|
// icon: require('@/static/tongyonh/tron1.png'), |
|
|
|
// balance: this.trxBbalance |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// name:"USDT", |
|
|
|
// name2:"TRC20-USDT", |
|
|
|
// xname:'Tether USD', |
|
|
|
// contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', |
|
|
|
// icon:require('@/static/tongyonh/tether_usd.png') |
|
|
|
// } |
|
|
|
// ]; |
|
|
|
// console.log(this.$store.state.troni, 555566565) |
|
|
|
// // 增加钱包位置 |
|
|
|
// this.$store.commit('addTroni', 1) |
|
|
|
// setTimeout(()=>{ |
|
|
|
// uni.setStorageSync('wallet', tron) |
|
|
|
// },1000) |
|
|
|
// uni.setStorageSync('walleti', tron.privateKey) |
|
|
|
// this.walletInfo.TRON[this.$store.state.troni] = tron; |
|
|
|
// setTimeout(()=>{ |
|
|
|
// uni.setStorageSync('walletInfo', this.walletInfo); |
|
|
|
|
|
|
|
// },1000) |
|
|
|
// if (this.password != e) { |
|
|
|
// this.info = true; |
|
|
|
// return; |
|
|
|
// } else { |
|
|
|
// uni.showToast({ |
|
|
|
// title: 'Set successfully', |
|
|
|
// icon: 'success', |
|
|
|
// duration: 1500, |
|
|
|
// }) |
|
|
|
// setTimeout(() => { |
|
|
|
// uni.navigateTo({ |
|
|
|
// url: '../../wallet/index' |
|
|
|
// }) |
|
|
|
// }, 1500) |
|
|
|
// this.info = false; |
|
|
|
// } |
|
|
|
// return; |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
// 第一次存密码 |
|
|
|
finish(e) { |
|
|
@ -300,14 +300,7 @@ |
|
|
|
var that = this; |
|
|
|
that.borNum = false; |
|
|
|
that.borNum2 = false; |
|
|
|
// uni.setStorage({ |
|
|
|
// key: 'transPaw', |
|
|
|
// data: e, |
|
|
|
// success: function() { |
|
|
|
// |
|
|
|
// }, |
|
|
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
that.borNum2 = true; |
|
|
|
}, 50) |
|
|
|