|
|
@@ -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)
|