api3dao / airseeker

A service powering the dAPIs
MIT License
2 stars 5 forks source link

Fetch gas price using low-level RPC method #321

Closed bdrhn9 closed 3 months ago

bdrhn9 commented 3 months ago

Closes #305

bdrhn9 commented 3 months ago

Alternatively, it can be implemented by extending the JsonRpcProvider class like following:

// eslint-disable-next-line functional/no-classes
export class LegacyGasPriceRpcProvider extends ethers.JsonRpcProvider {
  public async getGasPrice(): Promise<bigint> {
    const value = await this.send('eth_gasPrice', []);

    return getBigInt(value);
  }
}

I didn't prefer this approach because it would necessitate modifying nearly every file that references ethers.JsonRpcProvider, both as a class and as an interface.