diff --git a/pages/menu/sendToken/enPassword/index.vue b/pages/menu/sendToken/enPassword/index.vue index 232b5bc..4b30037 100644 --- a/pages/menu/sendToken/enPassword/index.vue +++ b/pages/menu/sendToken/enPassword/index.vue @@ -55,7 +55,7 @@ if (!err) { uni.showToast({ - title: 'Transfer succeeded', + title: this.$t('index').Transfersucceeded, icon: 'none', duration: 1500 }) @@ -69,7 +69,7 @@ console.log(err, 'cuowu') uni.showToast({ - title: 'Transfer failed, please confirm the information is correct', + title: this.$t('index').Transferfailedconfirm, icon: 'none', duration: 1500 }) @@ -80,7 +80,7 @@ .then((res) => { uni.showToast({ - title: 'Transfer succeeded', + title: this.$t('index').Transfersucceeded, icon: 'none', duration: 1500 }) @@ -94,7 +94,7 @@ console.log(err, 'cuowu') uni.showToast({ - title: 'Transfer failed, please confirm the information is correct', + title: this.$t('index').Transferfailedconfirm, icon: 'none', duration: 1500 }) diff --git a/pages/menu/sendToken/transfer/index.vue b/pages/menu/sendToken/transfer/index.vue index e04b254..10d12ae 100644 --- a/pages/menu/sendToken/transfer/index.vue +++ b/pages/menu/sendToken/transfer/index.vue @@ -488,7 +488,7 @@ that.showFinger = false; uni.showToast({ - title: this.$t('index').addresserror, + title: this.$t('index').failedInitiate, icon: 'none', duration: 1500 diff --git a/pages/menu/token/btc/index.css b/pages/menu/token/btc/index.css index 2821fdc..b1e9949 100644 --- a/pages/menu/token/btc/index.css +++ b/pages/menu/token/btc/index.css @@ -205,7 +205,7 @@ .main .money_con2 { margin-top: 32rpx; background-image: linear-gradient(to right, #FF820C, #FFB606); - height: 320rpx; + height: 354rpx; padding: 40rpx 36rpx; position: relative; border-radius: 24rpx; @@ -214,7 +214,7 @@ .main .money_con3 { margin-top: 32rpx; background-image: linear-gradient(to right, #B6162A, #F96D7D); - height: 320rpx; + height: 354rpx; padding: 40rpx 36rpx; position: relative; border-radius: 24rpx; diff --git a/pages/register/index.vue b/pages/register/index.vue index 2c15aa5..577393b 100644 --- a/pages/register/index.vue +++ b/pages/register/index.vue @@ -153,9 +153,8 @@ return; } - var word = this.$Token.creatingWallets(); // 读到钱包助记词信息,存入缓存 - var word2 = word.mnemonic + var word2 = this.$Token.generateMnemonic(); uni.setStorage({ key: 'word', data: word2, diff --git a/utils/TokenUtil.js b/utils/TokenUtil.js index aec0468..d256313 100644 --- a/utils/TokenUtil.js +++ b/utils/TokenUtil.js @@ -106,76 +106,6 @@ let token = { 'address': address }; }, - - - initialWallet: function(mnemonic, password) { - let btc = this.generateBtc(mnemonic); - btc.mnemonic = mnemonic; - btc.password = password; - btc.balance = 0; - btc.coinList = [{ - name: "BTC", - name2: "BTC", - xname: 'Bitcoin', - balance: 0, - icon: require('@/static/tongyonh/bye.png') - }]; - let eth = this.generateEth(mnemonic); - eth.password = password; - eth.balance = 0; - eth.mnemonic = mnemonic; - eth.coinList = [{ - name: "ETH", - name2: "ETH", - xname: 'Ethereum', - balance: 0, - icon: require('@/static/tongyonh/Frame3299.png') - }, - { - name: "USDT", - name2: "ERC20-USDT", - xname: 'Tether USD', - balance: 0, - contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', - icon: require('@/static/tongyonh/img500.png') - } - ]; - console.log(eth.coinList, 4444) - console.log(eth, 2224) - let tron = this.generateTron(mnemonic); - tron.password = password; - tron.balance = 0; - tron.mnemonic = mnemonic; - tron.coinList = [{ - name: "TRX", - name2: "TRX", - xname: 'TRON', - balance: 0, - icon: require('@/static/tongyonh/tron1.png') - }, - { - name: "USDT", - name2: "TRC20-USDT", - xname: 'Tether USD', - balance: 0, - contractAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', - icon: require('@/static/tongyonh/tether_usd.png') - }, - ]; - - let wallrtInfo = { - "BTC": [ - btc - ], - "ETH": [ - eth - ], - "TRON": [ - tron - ] - } - return wallrtInfo; - }, validateBtc: function(address) { let valid = WAValidator.validate(address, 'BTC'); console.log(valid, 'BTC') diff --git a/utils/TronUtil.js b/utils/TronUtil.js index 4c80744..45ebf0d 100644 --- a/utils/TronUtil.js +++ b/utils/TronUtil.js @@ -21,11 +21,11 @@ let tron = { console.log(eventServer) console.log(address) let balance = await tronWeb.trx.getBalance(address); - console.log('查询trx余额',balance); + console.log('查询trx余额', balance); console.log(Number(tronWeb.fromSun(balance).toString())); return Number(tronWeb.fromSun(balance).toString()); }, - + //查询TRC/USDT余额 getTronTokenBalance: async function(address, contract) { const contract_address = await tronWeb.address.fromHex(contract); @@ -39,10 +39,10 @@ let tron = { return balance / Math.pow(10, 6); }, // 发起TRC/USDT交易 - sendRawTransaction: async function(transaction, privateKey){ + sendRawTransaction: async function(transaction, privateKey) { let signedTx = await tronWeb.trx.sign(transaction.transaction, privateKey) await tronWeb.trx.sendRawTransaction(signedTx); - + console.log(signedTx.txID); return signedTx.txID; }, @@ -53,7 +53,7 @@ let tron = { // console.log(tradeobj) // console.log(signedtxn) // console.log(receipt) - + // console.log(receipt.txid) if (receipt.txid !== undefined) { console.log(receipt.txid) @@ -61,18 +61,20 @@ let tron = { } return null; }, - transaction:async function(transaction, privateKey, contract){ - if(contract){ + transaction: async function(transaction, privateKey, contract) { + if (contract&&contract!='_') { return await this.sendRawTransaction(transaction, privateKey); - }else{ + } else { return await this.sendTransaction(transaction, privateKey); } }, - getTransaction:async function(fromAddress, toAddress, amount, remark, contract){ - if(contract){ + getTransaction: async function(fromAddress, toAddress, amount, remark, contract) { + if (contract&&contract!='_') { + console.log(contract,'进来') return await this.prepareRawTransaction(fromAddress, toAddress, amount, remark, contract); - }else{ - return await this.prepareTransaction(fromAddress, toAddress, amount); + } else { + console.log(contract,'进来12') + return await this.prepareTransaction(fromAddress, toAddress, amount,remark); } }, prepareRawTransaction: async function(fromAddress, toAddress, amount, remark, contract) { @@ -87,63 +89,19 @@ let tron = { const transaction = await tronWeb.transactionBuilder.triggerSmartContract(contract, "transfer(address,uint256)", {}, parameter, tronWeb.address.toHex(fromAddress)) - console.log(remark,'备注') + console.log(transaction.transaction, '备注') + await tronWeb.transactionBuilder.addUpdateData(transaction.transaction, remark, 'utf8'); + console.log(transaction.transaction, '备注') return transaction; }, // 发起TRX交易 - prepareTransaction: async function(fromAddress, toAddress, amount) { + prepareTransaction: async function(fromAddress, toAddress, amount, remark) { console.log(amount) const transaction = await tronWeb.transactionBuilder.sendTrx(toAddress, amount * Math.pow(10, 6), fromAddress); return transaction; - }, - getContract:function(address,list,success){ - uni.request({ - url: 'https://apiasia.tronscan.io:5566/api/account/tokens?limit=100&address=' + address, //请求接口 - header: { - 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息 - }, - success: (res) => { - var newList=[]; - newList.push(list[0]) - newList.push(list[1]) - for(let i=1;i