fix(chains): build explorer api requests with URL params#4602
Open
tn0vak wants to merge 1 commit into
Open
Conversation
|
@tn0vak is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR solving?
This PR fixes how
blockExplorer.apiUrlrequests are built intest/scripts/chains.test.ts.Previously, the test appended query params via string concatenation:
${blockExplorer.apiUrl}?module=...That breaks or becomes ambiguous when
apiUrlalready contains query params (for example?chainid=...) or ends with?.As a result, URL construction could be incorrect and chain metadata validation could produce false failures.
This PR updates the request construction to use
URL+searchParams, which safely merges params and preserves existing query values.Additionally, it normalizes one malformed definition:
src/chains/definitions/morphHolesky.tsapiUrlchanged fromhttps://explorer-api-holesky.morphl2.io/api?tohttps://explorer-api-holesky.morphl2.io/apiAlternatives considered
?handling with manual conditionals.apiUrlentries to enforce a no-query convention.chainidfor Etherscan v2).URLSearchParamsoverURL.Areas for reviewer attention
Please focus on:
blockExplorer.apiUrltest path intest/scripts/chains.test.ts.chainid) is the expected behavior.morphHolesky.tsand that no unrelated chain definitions were changed.Tests
test/scripts/chains.test.tsblockExplorer.apiUrlchecks.Documentation impact
No documentation changes are required.