-
Notifications
You must be signed in to change notification settings - Fork 51
Sam/etherscan v2 fix #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Sam/etherscan v2 fix #997
Changes from all commits
d53919a
7a1b408
9e5a55e
aad44bb
5a6ac03
e6c2b95
a59d4e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,11 +222,12 @@ export const fetchFeesFromEvmScan = async ( | |
| const apiKey = `&apikey=${ | ||
| Array.isArray(scanApiKey) ? pickRandom(scanApiKey, 1)[0] : scanApiKey ?? '' | ||
| }` | ||
| // Use Etherscan v2 API when targeting etherscan.io, otherwise use the network-specific scan API format | ||
| // Use version from config to determine URL format (server URLs already include full paths) | ||
| 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}` | ||
| const url = | ||
| evmScanConfig.version === 2 | ||
| ? `${server}?chainid=${chainId}&module=gastracker&action=gasoracle${apiKey}` | ||
| : `${server}?module=gastracker&action=gasoracle${apiKey}` | ||
|
|
||
| const fetchResponse = await fetch(url) | ||
| if (!fetchResponse.ok) | ||
|
|
@@ -346,6 +347,8 @@ export const getEvmScanApiKey = ( | |
| log: EdgeLog, | ||
| 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. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Legacy Etherscan Check Blocks Unified APIThe
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| const { evmScanApiKey, etherscanApiKey, bscscanApiKey, polygonscanApiKey } = | ||
| initOptions | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,12 +47,13 @@ const networkInfo: EthereumNetworkInfo = { | |
| networkAdapterConfigs: [ | ||
| { | ||
| type: 'rpc', | ||
| servers: ['https://api.mainnet.abs.xyz '] | ||
| servers: ['https://api.mainnet.abs.xyz'] | ||
| }, | ||
| { | ||
| type: 'evmscan', | ||
| gastrackerSupport: true, | ||
| servers: ['https://api.abscan.org/'] | ||
| servers: ['https://api.etherscan.io/v2/api'], | ||
| version: 2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Abstract Chain API: Generic Endpoint IncompatibilityAbstract 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| ], | ||
| uriNetworks: ['abstract'], | ||
|
|
||
There was a problem hiding this comment.
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
getEvmScanApiKeyfunction checks ifserverUrl.includes('etherscan.io')and requiresetherscanApiKey, but this breaks BSC after removingapi.bscscan.comas a fallback server. Now BSC uses onlyhttps://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, allowingbscscanApiKeyor the unifiedevmScanApiKeyto be used for BSC.There was a problem hiding this comment.
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