Browse Source

代码

master
Dread 4 years ago
parent
commit
3d326fa885
  1. 2
      main.js
  2. 139
      pages/menu/backUp/transPaw/index.vue
  3. 16
      unpackage/dist/dev/app-plus/app-service.js
  4. 7466
      unpackage/dist/dev/app-plus/app-view.js
  5. 16
      utils/WalletUtil.js

2
main.js

@ -13,6 +13,7 @@ import ethers from 'ethers'
import util from 'ethereumjs-util'
import store from './store'
import walletUtil from './utils/WalletUtil.js'
Vue.prototype.$store = store
Vue.prototype.tronweb = tronweb
Vue.prototype.bip32 = bip32
@ -21,6 +22,7 @@ Vue.prototype.Tx = Tx
Vue.prototype.bitcoin = bitcoin
Vue.prototype.ethers = ethers
Vue.prototype.$axios = axios
Vue.prototype.$walletUtil = walletUtil
// 自定义底部导航栏
import tabBar from 'components/tabBar/tabBar.vue'
Vue.component('tab-bar', tabBar)

139
pages/menu/backUp/transPaw/index.vue

@ -64,81 +64,82 @@
//
setWalletInfo(e) {
this.word = uni.getStorageSync('word');
this.walletInfo = this.$Token.initialWallet(this.word, e)
let that=this
this.$api.getBtcBalance().then((res) => {
var b = res.data.data[0]
for (var k in b) {
that.btcBalance = b[k]
}
})
this.walletInfo.BTC[0].balance = this.btcBalance
this.walletInfo.BTC[0].coinList = [{
name: "BTC",
name2: "BTC",
xname: 'Bitcoin',
icon: require('@/static/tongyonh/bye.png'),
balance: this.btcBalance
}];
this.$walletUtil.initialWallet(this.word, e)
console.log(123123)
// let that=this
// this.$api.getBtcBalance().then((res) => {
// var b = res.data.data[0]
// for (var k in b) {
// that.btcBalance = b[k]
// }
// })
// this.walletInfo.BTC[0].balance = this.btcBalance
// this.walletInfo.BTC[0].coinList = [{
// name: "BTC",
// name2: "BTC",
// xname: 'Bitcoin',
// icon: require('@/static/tongyonh/bye.png'),
// balance: this.btcBalance
// }];
// this.$EthUtil.getBalance(eth.address,function(res){
// eth.balance = res
// this.ethBbalance = res;
// });
console.log(this.walletInfo.ETH[0].address,2222222)
this.$EthUtil.getBalance(this.walletInfo.ETH[0].address,function(res){
console.log(res,787878)
that.walletInfo.ETH[0].balance = res
console.log(res,4444455555)
that.walletInfo.ETH[0].coinList = [
{
name: "ETH",
name2: "ETH",
xname: 'Ethereum',
icon: require('@/static/tongyonh/Frame3299.png'),
balance: res
},
{
name:"USDT",
name2:"ERC20-USDT",
xname:'Tether USD',
contractAddress:'0xdac17f958d2ee523a2206206994597c13d831ec7',
icon:require('@/static/tongyonh/img500.png'),
balance: 0
}
]
// // this.$EthUtil.getBalance(eth.address,function(res){
// // eth.balance = res
// // this.ethBbalance = res;
// // });
// console.log(this.walletInfo.ETH[0].address,2222222)
// this.$EthUtil.getBalance(this.walletInfo.ETH[0].address,function(res){
// console.log(res,787878)
// that.walletInfo.ETH[0].balance = res
// console.log(res,4444455555)
// that.walletInfo.ETH[0].coinList = [
// {
// name: "ETH",
// name2: "ETH",
// xname: 'Ethereum',
// icon: require('@/static/tongyonh/Frame3299.png'),
// balance: res
// },
// {
// name:"USDT",
// name2:"ERC20-USDT",
// xname:'Tether USD',
// contractAddress:'0xdac17f958d2ee523a2206206994597c13d831ec7',
// icon:require('@/static/tongyonh/img500.png'),
// balance: 0
// }
// ]
});
// });
this.$TronUtil.getTronBalance(this.walletInfo.TRON[0].address).then((res) => {
that.walletInfo.TRON[0].balance = res
that.walletInfo.TRON[0].coinList = [
{
name: "TRX",
name2: "TRX",
xname: 'TRON',
icon: require('@/static/tongyonh/tron1.png'),
balance: res
},
{
name:"USDT",
name2:"TRC20-USDT",
xname:'Tether USD',
contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
icon:require('@/static/tongyonh/tether_usd.png')
}
]
// this.$TronUtil.getTronBalance(this.walletInfo.TRON[0].address).then((res) => {
// that.walletInfo.TRON[0].balance = res
// that.walletInfo.TRON[0].coinList = [
// {
// name: "TRX",
// name2: "TRX",
// xname: 'TRON',
// icon: require('@/static/tongyonh/tron1.png'),
// balance: res
// },
// {
// name:"USDT",
// name2:"TRC20-USDT",
// xname:'Tether USD',
// contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
// icon:require('@/static/tongyonh/tether_usd.png')
// }
// ]
}).catch(err => {
console.log(err)
})
setTimeout(()=>{
uni.setStorageSync('ethi', 0);
uni.setStorageSync('itype', true);
uni.setStorageSync('walletInfo', this.walletInfo);
},1500)
// }).catch(err => {
// console.log(err)
// })
// setTimeout(()=>{
// uni.setStorageSync('ethi', 0);
// uni.setStorageSync('itype', true);
// uni.setStorageSync('walletInfo', this.walletInfo);
// },1500)
},

16
unpackage/dist/dev/app-plus/app-service.js

File diff suppressed because one or more lines are too long

7466
unpackage/dist/dev/app-plus/app-view.js

File diff suppressed because one or more lines are too long

16
utils/WalletUtil.js

@ -1,4 +1,4 @@
impor TokenUtil from './TokenUtil.js'
import TokenUtil from './TokenUtil.js'
let fullWallet = {
"BTC": [{
balance: 0,
@ -11,7 +11,7 @@ let fullWallet = {
}]
}],
"ETH": [
balance: 0,
{balance: 0,
name: "ETH",
coinList: [{
name: "ETH",
@ -26,10 +26,10 @@ let fullWallet = {
contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7',
icon: require('@/static/tongyonh/img500.png')
}
]
]}
],
"TRON": [
balance: 0,
{balance: 0,
name: "TRON",
coinList: [{
name: "TRX",
@ -44,7 +44,7 @@ let fullWallet = {
contractAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
icon: require('@/static/tongyonh/tether_usd.png')
}
],
]}
]
}
@ -52,17 +52,17 @@ let WalletUtil = {
//初次创建钱包
initialWallet: function(mnemonic, password) {
let walletInfo = fullWallet;
let btc = TokenUtil.token.generateBtc(mnemonic);
let btc = TokenUtil.generateBtc(mnemonic);
walletInfo.BTC[0].password = password;
walletInfo.BTC[0].mnemonic = mnemonic;
walletInfo.BTC[0].privateKey = btc.privateKey;
walletInfo.BTC[0].address = btc.address;
let eth = TokenUtil.token.generateEth(mnemonic)
let eth = TokenUtil.generateEth(mnemonic)
walletInfo.ETH[0].password = password;
walletInfo.ETH[0].mnemonic = mnemonic;
walletInfo.ETH[0].privateKey = eth.privateKey;
walletInfo.ETH[0].address = eth.mnemonic;
let tron = TokenUtil.token.generateTron(mnemonic);
let tron = TokenUtil.generateTron(mnemonic);
walletInfo.TRON[0].mnemonic = mnemonic;
walletInfo.TRON[0].password = password;
walletInfo.TRON[0].privateKey = tron.privateKey;

Loading…
Cancel
Save