|
|
@@ -157,9 +157,11 @@ tokenpocketBnb.getGasPrice= async function (){
|
|
|
tokenpocketBnb.getEstimateGas= async function (data){
|
|
|
let estimateGas =await tokenpocketBnb.getProvider().request({ method: 'eth_estimateGas',params:[data]})
|
|
|
// estimateGas=web3.utils.hexToNumber(estimateGas)
|
|
|
+ console.log(estimateGas,'estimateGas-------------------------------------------------------',web3.utils.hexToNumberString(estimateGas))
|
|
|
if(!estimateGas){
|
|
|
- estimateGas=100000
|
|
|
+ estimateGas=1000000
|
|
|
}
|
|
|
+ estimateGas=web3.utils.numberToHex('1000000');
|
|
|
console.log('estimateGas:',estimateGas)
|
|
|
return estimateGas;
|
|
|
}
|
|
|
@@ -176,7 +178,6 @@ tokenpocketBnb.getTransactionData=async function (to,money){
|
|
|
data.to=to;
|
|
|
data.from=tokenpocketBnb.getMyAddress();
|
|
|
data.gasPrice=await tokenpocketBnb.getGasPrice();
|
|
|
- data.gas=await tokenpocketBnb.getEstimateGas();
|
|
|
data.chainId=chainId;
|
|
|
if(tools.isDevelopment()){
|
|
|
money=0.00001;
|
|
|
@@ -184,6 +185,26 @@ tokenpocketBnb.getTransactionData=async function (to,money){
|
|
|
console.log(money.toString())
|
|
|
data.value=web3.utils.numberToHex(ethers.utils.parseEther(money.toString()).toString());
|
|
|
console.log('value:'+data.value)
|
|
|
+ data.gas=await tokenpocketBnb.getEstimateGas(data);
|
|
|
+ return data;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+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();
|
|
|
+ console.log('getContractTransaction-----------------3')
|
|
|
+ data.chainId=chainId;
|
|
|
+ console.log('value:'+data.value)
|
|
|
+ console.log('getContractTransaction-----------------end')
|
|
|
return data;
|
|
|
}
|
|
|
|