const { ethers } = require('ethers');
const DEPLOYER = '0xfA15Ee28939B222B0448261A22156070f0A7813C';
const RPCS = [
  'https://polygon-bor-rpc.publicnode.com',
  'https://rpc.ankr.com/polygon',
  'https://polygon.llamarpc.com',
  'https://1rpc.io/matic',
  'https://polygon-mainnet.public.blastapi.io',
];
function timeout(p, ms, l) { return Promise.race([p, new Promise((_, r) => setTimeout(() => r(new Error(`timeout ${l}`)), ms))]); }
(async () => {
  for (const url of RPCS) {
    try {
      const p = new ethers.JsonRpcProvider(url, 137, { staticNetwork: true });
      const bal = await timeout(p.getBalance(DEPLOYER), 8000, url);
      console.log(`OK   ${url}  =>  ${ethers.formatEther(bal)} POL`);
    } catch (e) {
      console.log(`FAIL ${url}  =>  ${e.message.slice(0, 80)}`);
    }
  }
})();
