Skip to content
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

Feature Request: isBase should be made less misleading #1167

Closed
mykcryptodev opened this issue Aug 26, 2024 · 1 comment
Closed

Feature Request: isBase should be made less misleading #1167

mykcryptodev opened this issue Aug 26, 2024 · 1 comment

Comments

@mykcryptodev
Copy link
Contributor

mykcryptodev commented Aug 26, 2024

Describe the solution you'd like

This may be a personal preference thing but to me, Base is 8453... if I want to use a helper to detect if something "isBase", it should only return true if the chain is 8453.

Currently, isBase will return true for Base Sepolia as well.

Perhaps for backwards compatibility, there should be optional parameters passed like:

isBase({ chainId, isMainnetOnly: true })

Describe alternatives you've considered.

it's simple enough for me to make my own "isBaseMainnet" function:

import { base } from "wagmi/chains";

const isBaseMainnet = ({ chainId }: { chainId: number }) => chainId === base.id;

but I feel like someone could stumble over "isBase" returning true for sepolia.

@Zizzamia
Copy link
Contributor

Zizzamia commented Sep 8, 2024

Thank you @mykcryptodev, here a PR #1221 with isMainnetOnly support.

The logic behind isBase is that we want something that helps us quickly to check a particular chain support. In particular for the CDP APIs, which are mostly bounded for now to Base or Base Sepolia.

I agree with you it can feel a bit confusing, and we specified the scope of the utility in the docs.

Happy to continue reflect on this in V1 if we see more adoption and confusion around this utility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants