Skip to content

Conversation

@samholmes
Copy link
Collaborator

@samholmes samholmes commented Nov 7, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Introduce versioned evmscan adapter and update network configs/fee provider to use Etherscan v2 and correct API paths; expand rate‑limit handling and add precise adapter cleaners.

  • EVM Core:
    • EvmScan Adapter: Add version: 1 | 2 to config and build URLs accordingly (v2 uses ?chainid=; v1 uses legacy /api). Expand rate‑limit detection strings.
    • Fees: fetchFeesFromEvmScan now selects URL format based on adapter version; getEvmScanApiKey logic retained with clarifying comments.
    • Types/Cleaners: Replace generic adapter cleaner with specific cleaners; add EvmScanAdapterConfig.version to schema.
  • Network Configs (multiple chains: ethereum, arbitrum, base, optimism, polygon, avalanche, amoy, sepolia, holesky, sonic, binancesmartchain, bobevm, botanix, fantom, rsk, pulsechain, zksync, etc.):
    • Point evmscan servers to correct paths (Etherscan v2: https://api.etherscan.io/v2/api with version: 2; Blockscout/Routescan/etc.: append /api with version: 1).
    • Minor RPC list tweaks (e.g., cleanup duplicates, remove defunct endpoints; ETC RPC list trimmed).
    • Add/adjust secondary evmscan entries where needed (e.g., Avalanche Avascan, Celo explorer, zkSync explorer).
  • Tests:
    • Update fee history test configs to include version: 2 on evmscan entries.
  • CHANGELOG:
    • Note removal of deprecated api.bscscan.com server.

Written by Cursor Bugbot for commit a59d4e9. This will update automatically on new commits. Configure here.


type: 'evmscan',
gastrackerSupport: true,
servers: ['https://api.abscan.org/'],
servers: ['https://api.abscan.org/v2/api'],
Copy link
Contributor

Choose a reason for hiding this comment

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

cursorbot is right. please fix the url in line 50

type: 'evmscan'
servers: string[]
version: 1 | 2
version: 2 | 'v2'
Copy link
Contributor

Choose a reason for hiding this comment

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

What was wrong with using versions 1 and 2? versions 2 and 'v2' is weird

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a rebasing error

Copy link
Contributor

Choose a reason for hiding this comment

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

Now all of the evmscan servers are set to version 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should be using version 2 where it's supported

type: 'evmscan'
servers: string[]
version: 1 | 2
version: 2 | 'v2'
Copy link
Contributor

Choose a reason for hiding this comment

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

Now all of the evmscan servers are set to version 2

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Malformed URLs Break API Connectivity

fetchFeesFromEvmScan builds URLs by appending /v2/api or /api to the server, but server URLs in the info configs already include these paths (e.g., https://api.etherscan.io/v2/api). This creates malformed URLs like https://api.etherscan.io/v2/api/v2/api?..., causing API requests to fail. Should use the version config field like EvmScanAdapter does to determine which URL format to use.

src/ethereum/fees/feeProviders.ts#L226-L229

const chainId = networkInfo.chainParams.chainId
const url = server.includes('etherscan.io')
? `${server}/v2/api?chainid=${chainId}&module=gastracker&action=gasoracle${apiKey}`
: `${server}/api?module=gastracker&action=gasoracle${apiKey}`

Fix in Cursor Fix in Web


@samholmes samholmes force-pushed the sam/etherscan-v2-fix branch from 06fa880 to ef0ca6f Compare November 14, 2025 19:26
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Redundant Paths Break API Calls

The fetchFeesFromEvmScan function constructs URLs by appending /v2/api or /api path segments to server URLs, but the updated network configs now include these path segments in the server URLs themselves. This creates double path segments (e.g., /v2/api/api) in requests, resulting in 404 errors when fetching gas prices. The URL construction needs to use the base server URL without appending duplicate paths.

src/ethereum/fees/feeProviders.ts#L241-L254

`fetchFeesFromEvmScan unrecognized response message: ${esGasResponse.message}`
)
}
const { SafeGasPrice, ProposeGasPrice, FastGasPrice } =
asEvmScanGasResponseResult(esGasResponse.result)
const newSafeLow = parseFloat(SafeGasPrice)
let newAverage = parseFloat(ProposeGasPrice)
let newFast = parseFloat(FastGasPrice)
// Correct inconsistencies, convert values
if (newAverage <= newSafeLow) newAverage = newSafeLow + 1
if (newFast <= newAverage) newFast = newAverage + 1

Fix in Cursor Fix in Web


serverUrl: string
): string | string[] | undefined => {
// TODO: This is total BS. We should just have a key associated with a domain name.
// This is getting out of hand.
Copy link

Choose a reason for hiding this comment

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

Bug: Improve EVM Scan API Key Network Handling

The getEvmScanApiKey function checks if serverUrl.includes('etherscan.io') and requires etherscanApiKey, but this breaks BSC after removing api.bscscan.com as a fallback server. Now BSC uses only https://api.etherscan.io/v2/api, which matches the etherscan.io check and throws an error or returns the wrong API key. The function should differentiate between Etherscan being used for ETH vs other networks, allowing bscscanApiKey or the unified evmScanApiKey to be used for BSC.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was always a problem. The solution is to add etherscanApiKey to bsc key list

serverUrl: string
): string | string[] | undefined => {
// TODO: This is total BS. We should just have a key associated with a domain name.
// This is getting out of hand.
Copy link

Choose a reason for hiding this comment

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

Bug: Legacy Etherscan Check Blocks Unified API

The getEvmScanApiKey function requires etherscanApiKey when the server URL contains 'etherscan.io', throwing an error before checking for the unified evmScanApiKey. After consolidating BSC to use https://api.etherscan.io/v2/api, calls for BSC will now always match the etherscan.io check and throw if etherscanApiKey is missing, even when evmScanApiKey is configured. This breaks BSC fee queries for deployments using only the recommended evmScanApiKey pattern.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was always a problem. The solution is to add etherscanApiKey to bsc key list

@samholmes samholmes force-pushed the sam/etherscan-v2-fix branch 2 times, most recently from 78eefb8 to 4cf137b Compare November 14, 2025 19:40
@samholmes samholmes enabled auto-merge November 14, 2025 19:41
@samholmes samholmes disabled auto-merge November 14, 2025 19:46
gastrackerSupport: true,
servers: ['https://api.abscan.org/']
servers: ['https://api.etherscan.io/v2/api'],
version: 2
Copy link

Choose a reason for hiding this comment

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

Bug: Abstract Chain API: Generic Endpoint Incompatibility

Abstract chain configuration is using Etherscan's v2 API with chainId 2741, but Etherscan v2 API doesn't support Abstract's chain ID. The chain-specific api.abscan.org server was replaced with a generic Etherscan endpoint that will fail queries for this network. Abstract requires its own dedicated API server configuration.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@samholmes samholmes force-pushed the sam/etherscan-v2-fix branch from 295dc90 to ed8632c Compare November 18, 2025 19:30
- Remove arbiscan.io server due to deprecation
- Remove 'https://rpc-mainnet.maticvigil.com'; This service has been
shut-down
- Remove 'https://rpc.polycat.finance'; This service is not longer
available.
- Replace abscan.org with 'etherscan.io'; Because, abscan.org has been
deprecated.
- Remove 'https://api-era.zksync.network/v2/api'; It has been deprecated
for etherscan.io.
- Remove 'https://api.polygonscan.com/v2/api'; It has been deprecated
for etherscan.io.
- Remove 'https://api.snowscan.xyz/v2/api'; It has been deprecated for
etherscan.io.
- Remove etc-network.info RPC nodes: These services are no longer
available.
- Replace stakely.io RPC node with hyperlend.finance; The stakely.io
node doesn't work (500 error) and the hyperlend.finance does.
- Remove 'https://celo-mainnet-rpc.allthatnode.com'
- Remove 'https://matic-mainnet.chainstacklabs.com'
- Remove 'https://api.basescan.org/v2/api'
- Remove 'rpc.ankr.com'; This RPC node is complaining about needing an
account to work.
- Remove 'https://api.sonicscan.org/v2/api'
@samholmes samholmes force-pushed the sam/etherscan-v2-fix branch from ed8632c to a59d4e9 Compare December 1, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants