Fix tx object in getGas method & bump version to 0.2.1

This commit is contained in:
Theo 2023-08-19 10:55:41 -07:00
parent 85b057fbed
commit 03e6af5614
2 changed files with 3 additions and 3 deletions

@ -1,6 +1,6 @@
{
"name": "@tornado/tornado-oracles",
"version": "0.2.0",
"version": "0.2.1",
"description": "Gas oracle for Tornado-specific transactions",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",

@ -45,9 +45,9 @@ export abstract class TornadoFeeOracle implements ITornadoFeeOracle {
type: TxType = 'other',
speed: LegacyGasPriceKey = 'fast',
): Promise<BigNumber> {
const gasPrice = await this.getGasPrice(type, speed);
const gasPrice = await this.getGasPriceInHex(type, speed);
let gas = BigNumber.from(0);
gas = gas.add(calculateGasPriceInWei(gasPrice));
gas = gas.add(gasPrice);
if (tx) tx = Object.assign(tx, { gasPrice });
gas = gas.mul(await this.getGasLimit(tx, type));
if (this.chainId === ChainId.OPTIMISM) gas = gas.add(await this.fetchL1OptimismFee(tx));