Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
import { NetworkNames } from '@enkryptcom/types';

const NetworkEndpoints: Record<string, string> = {
[NetworkNames.Ethereum]: 'https://eth.blockscout.com/',
[NetworkNames.Binance]: 'https://api.bscscan.com/',
[NetworkNames.Matic]: 'https://polygon.blockscout.com/',
[NetworkNames.Moonbeam]: 'https://api-moonbeam.moonscan.io/',
[NetworkNames.Moonriver]: 'https://api-moonriver.moonscan.io/',
[NetworkNames.KaruraEVM]: 'https://blockscout.karura.network/',
[NetworkNames.AstarEVM]: 'https://blockscout.com/astar/',
[NetworkNames.ShidenEVM]: 'https://blockscout.com/shiden/',
[NetworkNames.Optimism]: 'https://api-optimistic.etherscan.io/',
[NetworkNames.EdgeEVM]: 'https://edgscan.live/',
[NetworkNames.Rootstock]: 'https://blockscout.com/rsk/mainnet/',
[NetworkNames.RootstockTestnet]: 'https://rootstock-testnet.blockscout.com/',
[NetworkNames.Ethereum]: 'https://eth.blockscout.com/api?',
[NetworkNames.Binance]: 'https://api.etherscan.io/v2/api?chainid=56&',
[NetworkNames.Matic]: 'https://polygon.blockscout.com/api?',
[NetworkNames.Moonbeam]: 'https://api.etherscan.io/v2/api?chainid=1284&',
[NetworkNames.Moonriver]: 'https://api.etherscan.io/v2/api?chainid=1285&',
[NetworkNames.KaruraEVM]: 'https://blockscout.karura.network/api?',
[NetworkNames.AstarEVM]: 'https://blockscout.com/astar/api?',
[NetworkNames.ShidenEVM]: 'https://blockscout.com/shiden/api?',
[NetworkNames.Optimism]: 'https://api.etherscan.io/v2/api?chainid=10&',
[NetworkNames.EdgeEVM]: 'https://edgscan.live/api?',
[NetworkNames.Rootstock]: 'https://blockscout.com/rsk/mainnet/api?',
[NetworkNames.RootstockTestnet]:
'https://rootstock-testnet.blockscout.com/api?',
[NetworkNames.SkaleBlockBrawlers]:
'https://frayed-decent-antares.explorer.mainnet.skalenodes.com/',
'https://frayed-decent-antares.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleCalypso]:
'https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com/',
'https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleCryptoBlades]:
'https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com/',
'https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleCryptoColosseum]:
'https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com/',
'https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleEuropa]:
'https://elated-tan-skat.explorer.mainnet.skalenodes.com/',
'https://elated-tan-skat.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleExorde]:
'https://light-vast-diphda.explorer.mainnet.skalenodes.com/',
'https://light-vast-diphda.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleNebula]:
'https://green-giddy-denebola.explorer.mainnet.skalenodes.com/',
'https://green-giddy-denebola.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.SkaleTitan]:
'https://parallel-stormy-spica.explorer.mainnet.skalenodes.com/',
[NetworkNames.ZkSync]: 'https://block-explorer-api.mainnet.zksync.io/',
[NetworkNames.Arbitrum]: 'https://api.arbiscan.io/',
[NetworkNames.ArbitrumNova]: 'https://nova-explorer.arbitrum.io/',
[NetworkNames.Gnosis]: 'https://api.gnosisscan.io/',
[NetworkNames.Avalanche]: 'https://api.snowtrace.io/',
[NetworkNames.Aurora]: 'https://explorer.mainnet.aurora.dev/',
[NetworkNames.PuppyNet]: 'https://puppyscan.shib.io/',
[NetworkNames.Shibarium]: 'https://www.shibariumscan.io/',
[NetworkNames.MaticZK]: 'https://api-zkevm.polygonscan.com/',
[NetworkNames.Base]: 'https://api.basescan.org/',
[NetworkNames.Celo]: 'https://explorer.celo.org/mainnet/',
[NetworkNames.SyscoinNEVMTest]: 'https://explorer.tanenbaum.io/',
[NetworkNames.SyscoinNEVM]: 'https://explorer.syscoin.org/',
[NetworkNames.RolluxTest]: 'https://rollux.tanenbaum.io/',
[NetworkNames.Rollux]: 'https://explorer.rollux.com/',
[NetworkNames.Blast]: 'https://api.blastscan.io/',
[NetworkNames.Sanko]: 'https://explorer.sanko.xyz/',
[NetworkNames.Sonic]: 'https://api.sonicscan.org/',
[NetworkNames.Degen]: 'https://explorer.degen.tips/',
[NetworkNames.Ink]: 'https://explorer.inkonchain.com/',
[NetworkNames.ImmutableZkevm]: 'https://explorer.immutable.com/',
[NetworkNames.Rari]: 'https://mainnet.explorer.rarichain.org/',
[NetworkNames.Forma]: 'https://explorer.forma.art/',
[NetworkNames.XLayer]: 'https://www.oklink.com/api/v5/explorer/xlayer/',
[NetworkNames.Linea]: 'https://api.lineascan.build/',
[NetworkNames.MantaPacific]: 'https://pacific-explorer.manta.network/',
[NetworkNames.Mode]: 'https://explorer.mode.network/',
[NetworkNames.ProofOfPlayApex]: 'https://explorer.apex.proofofplay.com/',
[NetworkNames.Scroll]: 'https://api.scrollscan.com/',
[NetworkNames.Fraxtal]: 'https://api.fraxscan.com/',
[NetworkNames.Coti]: 'https://mainnet.cotiscan.io/',
'https://parallel-stormy-spica.explorer.mainnet.skalenodes.com/api?',
[NetworkNames.ZkSync]: 'https://block-explorer-api.mainnet.zksync.io/api?',
[NetworkNames.Arbitrum]: 'https://api.etherscan.io/v2/api?chainid=42161&',
[NetworkNames.ArbitrumNova]: 'https://api.etherscan.io/v2/api?chainid=42170&',
[NetworkNames.Gnosis]: 'https://api.etherscan.io/v2/api?chainid=100&',
[NetworkNames.Avalanche]: 'https://api.snowtrace.io/api?',
[NetworkNames.Aurora]: 'https://explorer.mainnet.aurora.dev/api?',
[NetworkNames.PuppyNet]: 'https://puppyscan.shib.io/api?',
[NetworkNames.Shibarium]: 'https://www.shibariumscan.io/api?',
[NetworkNames.MaticZK]: 'https://api.etherscan.io/v2/api?chainid=1101&',
[NetworkNames.Base]: 'https://api.etherscan.io/v2/api?chainid=8453&',
[NetworkNames.Celo]: 'https://explorer.celo.org/mainnet/api?',
[NetworkNames.SyscoinNEVMTest]: 'https://explorer.tanenbaum.io/api?',
[NetworkNames.SyscoinNEVM]: 'https://explorer.syscoin.org/api?',
[NetworkNames.RolluxTest]: 'https://rollux.tanenbaum.io/api?',
[NetworkNames.Rollux]: 'https://explorer.rollux.com/api?',
[NetworkNames.Blast]: 'https://api.etherscan.io/v2/api?chainid=81457&',
[NetworkNames.Sanko]: 'https://explorer.sanko.xyz/api?',
[NetworkNames.Sonic]: 'https://api.etherscan.io/v2/api?chainid=146&',
[NetworkNames.Degen]: 'https://explorer.degen.tips/api?',
[NetworkNames.Ink]: 'https://explorer.inkonchain.com/api?',
[NetworkNames.ImmutableZkevm]: 'https://explorer.immutable.com/api?',
[NetworkNames.Rari]: 'https://mainnet.explorer.rarichain.org/api?',
[NetworkNames.Forma]: 'https://explorer.forma.art/api?',
[NetworkNames.XLayer]: 'https://www.oklink.com/api/v5/explorer/xlayer/api?',
[NetworkNames.Linea]: 'https://api.lineascan.build/api?',
[NetworkNames.MantaPacific]: 'https://pacific-explorer.manta.network/api?',
[NetworkNames.Mode]: 'https://explorer.mode.network/api?',
[NetworkNames.ProofOfPlayApex]: 'https://explorer.apex.proofofplay.com/api?',
[NetworkNames.Scroll]: 'https://api.scrollscan.com/api?',
[NetworkNames.Fraxtal]: 'https://api.etherscan.io/v2/api?chainid=252&',
[NetworkNames.Coti]: 'https://mainnet.cotiscan.io/api?',
[NetworkNames.CytonicTestnet]:
'https://explorer-api.evm.testnet.cytonic.com/api/',
[NetworkNames.Derive]: 'https://explorer.derive.xyz/',
[NetworkNames.Conflux]: 'https://evmapi.confluxscan.org/',
[NetworkNames.Hemi]: 'https://explorer.hemi.xyz/',
[NetworkNames.AppLayerTestnet]: 'https://testnet-explorer.applayer.com/api/',
[NetworkNames.EthereumClassic]: 'https://etc.blockscout.com/',
[NetworkNames.TAC]: 'https://explorer.tac.build/',
'https://explorer-api.evm.testnet.cytonic.com/api/api?',
[NetworkNames.Derive]: 'https://explorer.derive.xyz/api?',
[NetworkNames.Conflux]: 'https://evmapi.confluxscan.org/api?',
[NetworkNames.Hemi]: 'https://explorer.hemi.xyz/api?',
[NetworkNames.AppLayerTestnet]:
'https://testnet-explorer.applayer.com/api/api?',
[NetworkNames.EthereumClassic]: 'https://etc.blockscout.com/api?',
[NetworkNames.TAC]: 'https://explorer.tac.build/api?',
};
Comment on lines +4 to 73
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Endpoint normalization looks coherent; verify provider mix and trailing delimiters.

  • Trailing ? vs & is consistent with the new URL builder in this PR, but becomes unnecessary if we adopt URLSearchParams in index.ts.
  • Mixed providers: some networks moved to Blockscout (e.g., Ethereum, Polygon), others to Etherscan v2 aggregator with chainid, and several custom explorers. This can change payload nuances.

Run this to sanity‑check all endpoints end with ? or & and to flag any double /api/api?:

If adopting URLSearchParams in index.ts, consider dropping the trailing delimiters entirely in this map to reduce config footguns.


🏁 Script executed:

#!/bin/bash
set -euo pipefail
F="packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts"
python - <<'PY' "$F"
import re,sys,json
t=open(sys.argv[1]).read()
urls=re.findall(r'["\'](https?://[^"\']+)["\']',t)
bad=[u for u in urls if not (u.endswith('?') or u.endswith('&'))]
double=[u for u in urls if '/api/api?' in u]
print(json.dumps({"total":len(urls),"bad_endings":bad,"double_api":double},indent=2))
PY

Length of output: 175


Fix duplicated /api/api? entries & consider removing trailing delimiters

  • Sanity check: 58 endpoints; all end with ? or &. Two entries contain a duplicated /api/api? in packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts:
  • Action: replace the above with the correct path (e.g., /api?) or the provider's canonical base URL.
  • Optional: if index.ts will use URLSearchParams, remove trailing ?/& from this map to avoid config footguns.


export { NetworkEndpoints };
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const getAddressActivity = async (
return cacheFetch(
{
// Note: would like to add offset=50 (i.e. results per page) but it seems to cause polygon API to hang
url: `${endpoint}api?module=account&action=txlist&address=${address}&sort=desc`,
url: `${endpoint}module=account&action=txlist&address=${address}&sort=desc`,
headers,
},
TTL,
Expand Down