Skip to content

Commit

Permalink
feat: flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre committed Sep 19, 2024
1 parent 745a229 commit 15f5eaf
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ REACT_APP_FEATURE_USDT_APPROVAL_RESET=true
REACT_APP_FEATURE_PORTALS_SWAPPER=true
REACT_APP_FEATURE_RUNEPOOL=true
REACT_APP_FEATURE_MARKETS=false
REACT_APP_FEATURE_PHANTOM_WALLET=false

# absolute URL prefix
REACT_APP_ABSOLUTE_URL_PREFIX=https://app.shapeshift.com
Expand Down
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2

REACT_APP_FEATURE_MARKETS=true
REACT_APP_FEATURE_PHANTOM_WALLET=true
1 change: 1 addition & 0 deletions .env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com
REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2

REACT_APP_FEATURE_MARKETS=true
REACT_APP_FEATURE_PHANTOM_WALLET=true
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const validators = {
REACT_APP_FEATURE_MARKETS: bool({ default: false }),
REACT_APP_PORTALS_BASE_URL: url(),
REACT_APP_ZERION_BASE_URL: url(),
REACT_APP_FEATURE_PHANTOM_WALLET: bool({ default: false }),
}

function reporter<T>({ errors }: envalid.ReporterOptions<T>) {
Expand Down
3 changes: 3 additions & 0 deletions src/context/WalletProvider/SelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const WalletSelectItem = ({
const isCoinbaseEnabled = getConfig().REACT_APP_FEATURE_COINBASE_WALLET
if (walletType === KeyManager.Coinbase && !isCoinbaseEnabled) return null

const isPhantomEnabled = getConfig().REACT_APP_FEATURE_PHANTOM_WALLET
if (walletType === KeyManager.Phantom && !isPhantomEnabled) return null

const isWalletConnectV2Enabled = getConfig().REACT_APP_FEATURE_WALLET_CONNECT_V2
if (walletType === KeyManager.WalletConnectV2 && !isWalletConnectV2Enabled) return null

Expand Down
2 changes: 2 additions & 0 deletions src/state/slices/preferencesSlice/preferencesSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export type FeatureFlags = {
UsdtApprovalReset: boolean
RunePool: boolean
Markets: boolean
PhantomWallet: boolean
}

export type Flag = keyof FeatureFlags
Expand Down Expand Up @@ -149,6 +150,7 @@ const initialState: Preferences = {
UsdtApprovalReset: getConfig().REACT_APP_FEATURE_USDT_APPROVAL_RESET,
RunePool: getConfig().REACT_APP_FEATURE_RUNEPOOL,
Markets: getConfig().REACT_APP_FEATURE_MARKETS,
PhantomWallet: getConfig().REACT_APP_FEATURE_PHANTOM_WALLET,
},
selectedLocale: simpleLocale(),
balanceThreshold: '0',
Expand Down
1 change: 1 addition & 0 deletions src/test/mocks/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const mockStore: ReduxState = {
RunePool: false,
Portals: false,
Markets: false,
PhantomWallet: false,
},
selectedLocale: 'en',
balanceThreshold: '0',
Expand Down

0 comments on commit 15f5eaf

Please sign in to comment.