-
Notifications
You must be signed in to change notification settings - Fork 146
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
fix: only show swaps option on mainnet #4698
Conversation
{isMainnet && ( | ||
<ActionButton | ||
data-testid={HomePageSelectors.SwapBtn} | ||
icon={<SwapIcon />} | ||
label="Swap" | ||
onClick={() => navigate(RouteUrls.Swap)} | ||
/> | ||
)} |
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.
We have a whenNetwork
helper you can use here to avoid the equality expression on L26
Please reference issue in the commit msg |
07215ab
to
d799836
Compare
label="Swap" | ||
onClick={() => navigate(RouteUrls.Swap)} | ||
/> | ||
{whenNetwork(networkType)({ |
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.
Why would this only be based on the networkType
for bitcoin?
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.
Perhaps my request was confusing here. whenNetwork
just forwards to mainnet or testnet, but technically stacks works on chain id. As swaps is a Stacks feature, using bitcoin network types might be confusing (but works as bitcoin testnet === stacks testnet).
Alternatively, we have whenStacksChainId();
too
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.
Yeah, a bit confusing in code if don't know both are always the same, will that always be the case with network refactoring?
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.
@fbwoolf good catch! Used whenStacksChainId
to check stacks testnet
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.
I don't understand why this change is conditional on the bitcoin network?
81430ca
to
2f89adb
Compare
efe1490
to
daa1627
Compare
39e1a18
to
ce70a34
Compare
Closes #4687
swapsOnMainnet.mov