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

fix: only show swaps option on mainnet #4698

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

edgarkhanzadian
Copy link
Contributor

@edgarkhanzadian edgarkhanzadian commented Dec 14, 2023

Try out this version of Leather — Extension build, Test report

Closes #4687

swapsOnMainnet.mov

Comment on lines 51 to 58
{isMainnet && (
<ActionButton
data-testid={HomePageSelectors.SwapBtn}
icon={<SwapIcon />}
label="Swap"
onClick={() => navigate(RouteUrls.Swap)}
/>
)}
Copy link
Collaborator

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

@kyranjamie
Copy link
Collaborator

Please reference issue in the commit msg

@edgarkhanzadian edgarkhanzadian force-pushed the fix/only-show-swaps-on-mainnet branch 3 times, most recently from 07215ab to d799836 Compare December 14, 2023 14:37
label="Swap"
onClick={() => navigate(RouteUrls.Swap)}
/>
{whenNetwork(networkType)({
Copy link
Contributor

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?

Copy link
Collaborator

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

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

@fbwoolf fbwoolf left a 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?

@edgarkhanzadian edgarkhanzadian force-pushed the fix/only-show-swaps-on-mainnet branch from 81430ca to 2f89adb Compare December 14, 2023 15:08
@edgarkhanzadian edgarkhanzadian force-pushed the fix/only-show-swaps-on-mainnet branch from efe1490 to daa1627 Compare December 18, 2023 10:23
@edgarkhanzadian edgarkhanzadian force-pushed the fix/only-show-swaps-on-mainnet branch from 39e1a18 to ce70a34 Compare December 18, 2023 10:35
@edgarkhanzadian edgarkhanzadian added this pull request to the merge queue Dec 18, 2023
@edgarkhanzadian edgarkhanzadian removed this pull request from the merge queue due to a manual request Dec 18, 2023
@edgarkhanzadian edgarkhanzadian added this pull request to the merge queue Dec 18, 2023
Merged via the queue into dev with commit af6443c Dec 18, 2023
24 of 25 checks passed
@edgarkhanzadian edgarkhanzadian deleted the fix/only-show-swaps-on-mainnet branch December 18, 2023 10:38
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.

Hide swaps option on testnet / any network other than mainnet
4 participants