USER-20230908AJ\Administrator hace 6 meses
padre
commit
6aa7b19a37

+ 8 - 5
common/wallet/tokenpocket-wallet/tokenpocket-bnb.js

@@ -155,13 +155,15 @@ tokenpocketBnb.getGasPrice= async function (){
  * @returns {Promise<unknown>}
  */
 tokenpocketBnb.getEstimateGas= async function (data){
-    let estimateGas =await   tokenpocketBnb.getProvider().request({ method: 'eth_estimateGas',params:[data]})
+    console.log('estimateGas---------------start',data)
+    let estimateGas =await   tokenpocketBnb.getProvider().request({ method: 'eth_estimateGas',params:[data, "latest"]})
     // estimateGas=web3.utils.hexToNumber(estimateGas)
     console.log(estimateGas,'estimateGas-------------------------------------------------------',web3.utils.hexToNumberString(estimateGas))
-    if(!estimateGas){
+    if(!estimateGas || web3.utils.hexToNumberString(estimateGas)<100000){
         estimateGas=1000000
+        estimateGas=web3.utils.numberToHex('1500000');
     }
-    estimateGas=web3.utils.numberToHex('1000000');
+
     console.log('estimateGas:',estimateGas)
     return estimateGas;
 }
@@ -193,14 +195,15 @@ tokenpocketBnb.getTransactionData=async function (to,money){
 tokenpocketBnb.getContractTransaction=async function (sendData,contractType){
     console.log('getContractTransaction-----------------start')
     let data={};
-    data.data=sendData;
+
     data.to=contractArr[contractType];
     data.from=tokenpocketBnb.getMyAddress();
     console.log('getContractTransaction-----------------1')
     data.value='0x0';
     data.gasPrice=await tokenpocketBnb.getGasPrice();
     console.log('getContractTransaction-----------------2')
-    data.gas=await tokenpocketBnb.getEstimateGas();
+    data.gas=await tokenpocketBnb.getEstimateGas(data);
+    data.data=sendData;
     console.log('getContractTransaction-----------------3')
     data.chainId=chainId;
     console.log('value:'+data.value)

+ 4 - 0
pages/convert/convert-index.vue

@@ -54,13 +54,17 @@ export default {
         return
       }
       let data=''
+      console.log(web3.utils.stringToHex('buyCoin'),'buyCoin----------------------------')
+      console.log(web3.utils.stringToHex('transfer'),'buyCoin----------------------------')
       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)
       }else {
         data='0xa9059cbb'
+        // data='0x7472616e73666572'
         data=data+tools.replenishZero(this.dealAddress)+tools.replenishZero(formHex)
       }
       // data='0x5e9a0c48000000000000000000000000b7f1c21c51a0f85704a13b981aa9075d9b102962';