如果交易信息没有gasPrice,那么根据maxFeePerGas和maxPriorityFeePerGas来计算gasPrice
This commit is contained in:
parent
92fa1b635b
commit
f6ed757a1c
@ -91,9 +91,22 @@ export function universalChainCb(reqData: any, req: any) {
|
||||
return req
|
||||
.on("presend", function (dataObj: any) {
|
||||
if (jc.wallet.isInternal) {
|
||||
console.log("before send tran: ", dataObj);
|
||||
console.log("before send tran: ", JSON.stringify(dataObj));
|
||||
let gasPrice;
|
||||
if (
|
||||
!dataObj.gasPrice &&
|
||||
dataObj.maxPriorityFeePerGas &&
|
||||
dataObj.maxFeePerGas
|
||||
) {
|
||||
gasPrice = toBN(dataObj.maxFeePerGas)
|
||||
.sub(toBN(dataObj.maxPriorityFeePerGas))
|
||||
.div(toBN(2))
|
||||
.mul(toBN(1000000000));
|
||||
} else if (dataObj.gasPrice) {
|
||||
gasPrice = toBN(dataObj.gasPrice);
|
||||
}
|
||||
reqData.gas = toBN(dataObj.gas).toString();
|
||||
reqData.gasPrice = toBN(dataObj.gasPrice).toString();
|
||||
reqData.gasPrice = gasPrice.toString();
|
||||
reqData.transactionHash = dataObj.transactionHash;
|
||||
reqData.chain = jc.wallet.currentChain.id;
|
||||
reqData.startTime = Date.now();
|
||||
|
Loading…
x
Reference in New Issue
Block a user