-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat: init perpsEnabled feature flag #39145
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
Merged
+456
−1
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b1ee90a
chore: setup perps codeownership
gambinish 0e97686
chore: Fix formatting
gambinish 10c07d9
fix: whitespace diff
gambinish dfa3f85
fix: jsdoc must have whitespace after description
gambinish cd506ea
chore: update docs to be extension specific
gambinish b6908b0
chore: add docs path
gambinish 159e977
Merge branch 'perps/codeowners' into perps/docs
gambinish bf8645e
feat: init perpsEnabled feature flag
gambinish 2e61495
chore: Perps tab should appear after Tokens tab
gambinish b6328b5
fix: bugbot
gambinish 37aa001
chore: Add missing locale string
gambinish 163505c
chore: Remove docs
gambinish f5fe3e5
chore: Merge main, address conflicts
gambinish cb91c53
chore: Add GB string
gambinish 083f350
chore: Add version gating to feature flag
gambinish 1fd421b
chore: Add version gating to feature flag
gambinish 4c5dbfe
chore: Update to latest version gated flag
gambinish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Perps E2E test helpers | ||
| * | ||
| * This directory contains E2E test utilities and helpers for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Perps UI components | ||
| * | ||
| * This directory contains reusable UI components for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * Perps Redux slice | ||
| * | ||
| * This directory contains Redux state management (actions, reducers, selectors) | ||
| * for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Perps custom hooks | ||
| * | ||
| * This directory contains custom React hooks for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Perps page components | ||
| * | ||
| * This directory contains page-level components for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { getIsPerpsEnabled } from './feature-flags'; | ||
|
|
||
| type MockState = { | ||
| metamask: { | ||
| remoteFeatureFlags: { | ||
| perpsEnabled?: boolean; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| const getMockState = (perpsEnabled?: boolean): MockState => ({ | ||
| metamask: { | ||
| remoteFeatureFlags: { | ||
| perpsEnabled, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| describe('Perps Feature Flags', () => { | ||
| describe('getIsPerpsEnabled', () => { | ||
| it('returns true when perpsEnabled flag is true', () => { | ||
| const state = getMockState(true); | ||
| expect(getIsPerpsEnabled(state)).toBe(true); | ||
| }); | ||
|
|
||
| it('returns false when perpsEnabled flag is false', () => { | ||
| const state = getMockState(false); | ||
| expect(getIsPerpsEnabled(state)).toBe(false); | ||
| }); | ||
|
|
||
| it('returns false when perpsEnabled flag is undefined', () => { | ||
| const state = getMockState(undefined); | ||
| expect(getIsPerpsEnabled(state)).toBe(false); | ||
| }); | ||
|
|
||
| it('returns false when remoteFeatureFlags is empty', () => { | ||
| const state = { metamask: { remoteFeatureFlags: {} } }; | ||
| expect(getIsPerpsEnabled(state)).toBe(false); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { createSelector } from 'reselect'; | ||
| import { getRemoteFeatureFlags } from '../remote-feature-flags'; | ||
|
|
||
| /** | ||
| * Get the state of the `perpsEnabled` remote feature flag. | ||
| * | ||
| * @param _state - The MetaMask state object | ||
| * @returns `true` if Perps trading is enabled, `false` otherwise. | ||
| */ | ||
| export const getIsPerpsEnabled = createSelector( | ||
| getRemoteFeatureFlags, | ||
| (remoteFeatureFlags) => remoteFeatureFlags.perpsEnabled === true, | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Perps selectors | ||
| * | ||
| * This directory contains Redux selectors for the Perps trading feature. | ||
| * | ||
| * @see {@link https://github.com/MetaMask/metamask-extension} for more info | ||
| */ | ||
|
|
||
| export { getIsPerpsEnabled } from './feature-flags'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.