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