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

[METABRIDGE-843] chore: disable blocked tokens #24591

Merged
merged 5 commits into from
May 22, 2024

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented May 18, 2024

Description

Changes

  • adds utilities for fetching blockedTokens from the swaps api
  • disables a dest token if it's in the blockedTokens list AND if it's not the same as the src token

Open in GitHub Codespaces

Related issues

Fixes: N/A

Manual testing steps

  1. Go to send page, chainId=1

  2. ETH -> BNB should not be possible

  3. BNB -> BNB should be possible

  4. BNB -> ETH should not be possible

  5. BNB -> USDC should not be possible

  6. BNB -> TKN should not be possible

  7. Switch to a chain that's not supported by swaps

  8. There should be no errors/crashes when attempting to do a simple send flow

  9. Console/Network tab should have no errors regarding the blockedTokens api call

Screenshots/Recordings

Blocked dest tokens disabled:

Screen.Recording.2024-05-17.at.6.00.15.PM.mov

Disable swap+send when src token is blocked:

Screenshot 2024-05-21 at 4 38 04 PM

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@micaelae micaelae requested a review from a team as a code owner May 18, 2024 00:54
@micaelae micaelae force-pushed the mb843-swaps-blocked-tokens branch from 296ff78 to 91647ce Compare May 18, 2024 00:58
@BZahory
Copy link
Contributor

BZahory commented May 20, 2024

You could update the isSwapAllowed in ui/components/multichain/pages/send/components/recipient-content.tsx to block swaps when a blocked token is selected on send

@micaelae micaelae force-pushed the mb843-swaps-blocked-tokens branch from f4d1d7f to 1573b19 Compare May 20, 2024 19:55
};

// A component that lets the user pick from a list of assets.
export function AssetPicker({
asset,
onAssetChange,
sendingAsset,
isDisabled = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we outright disable it? The current functionality shows the "send" option for both when "disabled"

@micaelae micaelae force-pushed the mb843-swaps-blocked-tokens branch from 1573b19 to 4c4b6a0 Compare May 20, 2024 20:13
@micaelae micaelae force-pushed the mb843-swaps-blocked-tokens branch from 4c4b6a0 to 57d9a5f Compare May 21, 2024 20:38
@BZahory
Copy link
Contributor

BZahory commented May 21, 2024

Still needs a tooltip for disabled dest

@micaelae micaelae merged commit 9a66f84 into mb843/updates-2 May 22, 2024
5 checks passed
@micaelae micaelae deleted the mb843-swaps-blocked-tokens branch May 22, 2024 16:00
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants