-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: swaps controller remove constants 2 #23125
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
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThis PR is a pure refactoring effort that migrates chain ID constant imports from Analysis Summary:
Test Tag Selection Rationale:
These two tags provide targeted coverage of the affected functional areas. While the risk is low due to the refactoring nature, running these specific smoke tests ensures the Bridge and Card features continue to work correctly with the new constant imports. |
|
| allowanceState: AllowanceState.NotEnabled, | ||
| isStaked: false, | ||
| caipChainId: LINEA_CHAIN_ID, | ||
| caipChainId: formatChainIdToCaip(CHAIN_IDS.LINEA_MAINNET), |
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.
This is actually a different value from before. The field is caipChainId but a hex value was incorrectly being passed in before (TS did not complain for some reason). The new value is actually a CAIP chain id now.
GeorgeGkas
left a comment
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.
lgtm
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR removes more constants imported from `@metamask/swaps-controller`. Related to #23040 ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces swaps-controller chain ID constants with CHAIN_IDS from transaction-controller across bridge components, card logic/SDK, and tests. > > - **Bridge**: > - Replace chain constants with `CHAIN_IDS` in `BridgeDestNetworksBar` (update `ChainPopularity`, `ShortChainNames`). > - Migrate allowed chains to `CHAIN_IDS` in `utils/index.ts`; adjust `isBridgeAllowed` and related tests. > - **Card**: > - Use `CHAIN_IDS.LINEA_MAINNET` in `useAssetBalances` and `useGetPriorityCardToken` (including CAIP formatting) and update references accordingly. > - Update `CardSDK` to derive `lineaChainId` from `CHAIN_IDS.LINEA_MAINNET`. > - Revise associated tests to reference `CHAIN_IDS` and updated CAIP values. > - **Selectors/Tests**: > - Update multichain EVM tests to use `CHAIN_IDS` for mainnet/polygon and related assertions. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9046975. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->



Description
This PR removes more constants imported from
@metamask/swaps-controller.Related to #23040
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Replaces swaps-controller chain ID constants with CHAIN_IDS from transaction-controller across bridge components, card logic/SDK, and tests.
CHAIN_IDSinBridgeDestNetworksBar(updateChainPopularity,ShortChainNames).CHAIN_IDSinutils/index.ts; adjustisBridgeAllowedand related tests.CHAIN_IDS.LINEA_MAINNETinuseAssetBalancesanduseGetPriorityCardToken(including CAIP formatting) and update references accordingly.CardSDKto derivelineaChainIdfromCHAIN_IDS.LINEA_MAINNET.CHAIN_IDSand updated CAIP values.CHAIN_IDSfor mainnet/polygon and related assertions.Written by Cursor Bugbot for commit 9046975. This will update automatically on new commits. Configure here.