Skip to content

Conversation

mondoreale
Copy link
Collaborator

@mondoreale mondoreale commented Feb 11, 2025

In this PR I eliminate the special case where we'd use amoy as a chain key (fake) for what should've been polygonAmoy (the actual chain key for Polygon Amoy testnet).

I do so in the following way:

  1. Add slug to config extension (to polygonAmoy's config) – see chains.yml.
  2. Use the slug in getChainKey to map it to the actual chain key, and in routeOptions for proper search query output.

This way any chain (new or existing) can have a short preferred identifier to be used in urls. All for the sake of making adding new chains easier.

In addition, the getPreferredChainName got renamed to getChainKey and refactored. It now always returns a ChainKey. It defaults to defaultChainKey if it fails to identify the candidate, and warns about such situation via console.warn.

It's polygonAmoy not just amoy. We'll have to handle links later.
Slug is a piece to be used in urls. In our case `?chain=polygonAmoy` is gonna be `?chain=amoy`.
@mondoreale mondoreale requested a review from jtakalai February 11, 2025 14:46
@mondoreale
Copy link
Collaborator Author

@tumppi after throwing a second look I now see that it does change the logic (see getChainKey). I mixed things up commenting on it in the call. Just FYI.

There is one more PR coming shortly addressing chain display names, etc.

@mondoreale mondoreale requested a review from tumppi February 12, 2025 10:05
Copy link
Contributor

@tumppi tumppi left a comment

Choose a reason for hiding this comment

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

I like it 👍

Base automatically changed from symbolic-chain-name-to-chain-key to master February 12, 2025 11:19
@mondoreale mondoreale merged commit 780ebd3 into master Feb 12, 2025
9 checks passed
@mondoreale mondoreale deleted the amoy-to-polygonAmoy branch February 12, 2025 11:25
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.

2 participants