Skip to content

Commit

Permalink
chore: Bump Polygon GasStation timeout to 2s, 0 retries
Browse files Browse the repository at this point in the history
Plus some other incidental cleanup in this file.
  • Loading branch information
pxrl committed Sep 17, 2024
1 parent b55a6de commit 076cd36
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gasPriceOracle/adapters/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ type GasStationArgs = BaseHTTPAdapterArgs & {

const { POLYGON } = CHAIN_IDs;

// @dev toBNWei() is not imported from ../utils because of a circular dependency loop.
// The fix is probably to relocate the function estimateTotalGasRequiredByUnsignedTransaction().
class PolygonGasStation extends BaseHTTPAdapter {
readonly chainId: number;

Expand All @@ -42,7 +40,7 @@ class PolygonGasStation extends BaseHTTPAdapter {
async getFeeData(strategy: "safeLow" | "standard" | "fast" = "fast"): Promise<GasPriceEstimate> {
const gas = await this.query("v2", {});

const gasPrice: Polygon1559GasPrice = (gas as GasStationV2Response)?.[strategy];
const gasPrice = (gas as GasStationV2Response)?.[strategy];
if (!this.isPolygon1559GasPrice(gasPrice)) {
// @todo: generalise gasPriceError() to accept a reason/cause?
gasPriceError("getFeeData()", this.chainId, bnZero);
Expand Down Expand Up @@ -70,7 +68,7 @@ class PolygonGasStation extends BaseHTTPAdapter {
}

export function gasStation(provider: providers.Provider, chainId: number): Promise<GasPriceEstimate> {
const gasStation = new PolygonGasStation({ chainId: chainId });
const gasStation = new PolygonGasStation({ chainId: chainId, timeout: 2000, retries: 0 });
try {
return gasStation.getFeeData();
} catch (err) {
Expand Down

0 comments on commit 076cd36

Please sign in to comment.