@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
2 lines (1 loc) • 710 B
JavaScript
var t=require("@ethersproject/units"),o=require("@privy-io/chains");const e=[o.polygon.id,o.polygonAmoy.id];let a=o=>({maxPriorityFee:t.parseUnits(o.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:t.parseUnits(o.maxFee.toFixed(9),"gwei").toHexString()}),s=t=>({safeLow:a(t.safeLow),standard:a(t.standard),fast:a(t.fast)});exports.POLYGON_GAS_STATION_CHAIN_IDS=e,exports.getPolygonGasStationFees=async t=>{let e="";switch(t){case o.polygon.id:e="https://gasstation.polygon.technology/v2";break;case o.polygonAmoy.id:e="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${t} does not support polygon gas stations`)}let a=await fetch(e);return s(await a.json())};
;