|
|
@@ -19,6 +19,7 @@ export default {
|
|
|
price:'',
|
|
|
address:'',
|
|
|
dealAddress:'',
|
|
|
+ change_num:0,
|
|
|
};
|
|
|
},
|
|
|
watch:{
|
|
|
@@ -44,7 +45,8 @@ export default {
|
|
|
getAddress(){
|
|
|
getAddress().then(res=>{
|
|
|
if(res.code===1){
|
|
|
- this.dealAddress=res.data
|
|
|
+ this.dealAddress=res.data.address
|
|
|
+ this.change_num=res.data.change_num
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -54,27 +56,42 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
let data=''
|
|
|
- console.log(web3.utils.stringToHex('buyCoin'),'buyCoin----------------------------')
|
|
|
- console.log(web3.utils.stringToHex('transfer'),'buyCoin----------------------------')
|
|
|
+ let transactionData=''
|
|
|
let formHex=web3.utils.numberToHex(ethers.utils.parseEther(this.formNUm.toString()).toString());
|
|
|
if(this.type===1){
|
|
|
- let toHex=web3.utils.numberToHex(ethers.utils.parseEther(this.toNum.toString()).toString());
|
|
|
- data='0x1262dda0'
|
|
|
- // data='0x627579436f696e'
|
|
|
- data=data+tools.replenishZero(formHex)+tools.replenishZero(toHex)
|
|
|
+ if(this.change_num>10){
|
|
|
+ tools.error('交易已锁定')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ data='0xa9059cbb'
|
|
|
+ data=data+tools.replenishZero(this.dealAddress)+tools.replenishZero(formHex)
|
|
|
+ transactionData=await tokenpocketBnb.getContractTransaction(data, 1);
|
|
|
}else {
|
|
|
data='0xa9059cbb'
|
|
|
// data='0x7472616e73666572'
|
|
|
data=data+tools.replenishZero(this.dealAddress)+tools.replenishZero(formHex)
|
|
|
+ transactionData=await tokenpocketBnb.getContractTransaction(data, 0);
|
|
|
}
|
|
|
- // data='0x5e9a0c48000000000000000000000000b7f1c21c51a0f85704a13b981aa9075d9b102962';
|
|
|
- console.log(data)
|
|
|
- let transactionData=await tokenpocketBnb.getContractTransaction(data, 0);
|
|
|
- console.log("transactionData------------------------------")
|
|
|
console.log(transactionData)
|
|
|
- console.log("transactionData------------------------------")
|
|
|
+ // data='0x5e9a0c48000000000000000000000000b7f1c21c51a0f85704a13b981aa9075d9b102962';
|
|
|
tokenpocketBnb.sendTransaction(transactionData).then(res=>{
|
|
|
console.log(res)
|
|
|
+ if(res){
|
|
|
+ addDeal({
|
|
|
+ 'type':this.type,
|
|
|
+ 'money':this.toNum,
|
|
|
+ 'hash':res
|
|
|
+ }).then(res=>{
|
|
|
+ if (res.code===1){
|
|
|
+ tools.success(res.msg)
|
|
|
+ this.toNum=''
|
|
|
+ this.getTotalMoney()
|
|
|
+ this.getIconNum()
|
|
|
+ }else {
|
|
|
+ tools.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
setMax(){
|
|
|
@@ -100,7 +117,6 @@ export default {
|
|
|
setTimeout(async ()=>{
|
|
|
this.iconNum= await tokenpocketBnb.getTokenBalance(this.address,0)
|
|
|
this.usdtNum= await tokenpocketBnb.getTokenBalance(this.address,1)
|
|
|
- console.log(this.coinNum,"icon-num----------------------")
|
|
|
},100)
|
|
|
|
|
|
},
|