-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore(stellar): Stellar preparation - Add Stellar support in social AI component + trending component + bridge network but gate by FF #34527
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
Changes from all commits
e231d6f
94785e5
0b3f66b
4e30f41
dd5c770
7371414
cd875bc
bfcc7de
add7a33
d5e5fe8
eb23e7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { useMemo } from 'react'; | ||
| import { useSelector } from 'react-redux'; | ||
| import { SolScope, TrxScope, BtcScope } from '@metamask/keyring-api'; | ||
| import { SolScope, TrxScope, BtcScope, XlmScope } from '@metamask/keyring-api'; | ||
| import type { CaipChainId } from '@metamask/utils'; | ||
| import type { BridgeToken } from '../../Bridge/types'; | ||
| import type { RootState } from '../../../../reducers'; | ||
|
|
@@ -54,6 +54,7 @@ export const usePayWithTokens = (): { | |
|
|
||
| const solanaAccount = accountByScope(SolScope.Mainnet); | ||
| const tronAccount = accountByScope(TrxScope.Mainnet); | ||
| const stellarAccount = accountByScope(XlmScope.Pubnet); | ||
| const bitcoinAccount = accountByScope(BtcScope.Mainnet); | ||
| const multichainBalances = useSelector(selectMultichainBalances); | ||
| const multichainRates = useSelector(selectMultichainAssetsRates); | ||
|
|
@@ -82,6 +83,7 @@ export const usePayWithTokens = (): { | |
| allNetworkConfigs, | ||
| solanaAccount: solanaAccount ?? undefined, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for quick buy and sell, safe for added when only activate if stellar account exist + bridge FF activate |
||
| tronAccount: tronAccount ?? undefined, | ||
| stellarAccount: stellarAccount ?? undefined, | ||
| bitcoinAccount: bitcoinAccount ?? undefined, | ||
| multichainBalances, | ||
| multichainRates: multichainRates as Record< | ||
|
|
@@ -125,6 +127,7 @@ export const usePayWithTokens = (): { | |
| allNetworkConfigs, | ||
| solanaAccount, | ||
| tronAccount, | ||
| stellarAccount, | ||
| bitcoinAccount, | ||
| multichainBalances, | ||
| multichainRates, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ import { | |
| isNativeAddress, | ||
| formatChainIdToHex, | ||
| } from '@metamask/bridge-controller'; | ||
| import { SolScope, TrxScope, BtcScope } from '@metamask/keyring-api'; | ||
| import { SolScope, TrxScope, BtcScope, XlmScope } from '@metamask/keyring-api'; | ||
| import type { Hex, CaipChainId } from '@metamask/utils'; | ||
| import type { BridgeToken } from '../../Bridge/types'; | ||
| import type { RootState } from '../../../../reducers'; | ||
|
|
@@ -70,6 +70,9 @@ export const usePositionTokenBalance = ( | |
| const tronAccount = useSelector((state: RootState) => | ||
| selectSelectedInternalAccountByScope(state)(TrxScope.Mainnet), | ||
| ); | ||
| const stellarAccount = useSelector((state: RootState) => | ||
| selectSelectedInternalAccountByScope(state)(XlmScope.Pubnet), | ||
| ); | ||
| const bitcoinAccount = useSelector((state: RootState) => | ||
| selectSelectedInternalAccountByScope(state)(BtcScope.Mainnet), | ||
| ); | ||
|
|
@@ -170,6 +173,7 @@ export const usePositionTokenBalance = ( | |
| allNetworkConfigs, | ||
| solanaAccount: solanaAccount ?? undefined, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for quick buy and sell, safe for added when only activate if stellar account exist + bridge FF activate |
||
| tronAccount: tronAccount ?? undefined, | ||
| stellarAccount: stellarAccount ?? undefined, | ||
| bitcoinAccount: bitcoinAccount ?? undefined, | ||
| multichainBalances, | ||
| multichainRates: multichainRates as Record< | ||
|
|
@@ -228,6 +232,7 @@ export const usePositionTokenBalance = ( | |
| accountAddress, | ||
| solanaAccount, | ||
| tronAccount, | ||
| stellarAccount, | ||
| bitcoinAccount, | ||
| multichainBalances, | ||
| multichainRates, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { useMemo } from 'react'; | ||
| import { useSelector } from 'react-redux'; | ||
| import { isNonEvmChainId, isSolanaChainId } from '@metamask/bridge-controller'; | ||
| import { BtcScope, SolScope, TrxScope } from '@metamask/keyring-api'; | ||
| import { BtcScope, SolScope, TrxScope, XlmScope } from '@metamask/keyring-api'; | ||
| import type { CaipChainId } from '@metamask/utils'; | ||
| import type { BridgeToken } from '../../Bridge/types'; | ||
| import type { RootState } from '../../../../reducers'; | ||
|
|
@@ -54,7 +54,8 @@ const STABLECOIN_CANDIDATES: BridgeToken[] = (() => { | |
| typeof token.chainId === 'string' && | ||
| (token.chainId.startsWith('0x') || | ||
| isSolanaChainId(token.chainId) || | ||
| token.chainId === TrxScope.Mainnet), | ||
| token.chainId === TrxScope.Mainnet || | ||
| token.chainId === XlmScope.Pubnet), | ||
| ); | ||
| const seen = new Set(primaries.map(getTokenKey)); | ||
| const extras = RECEIVE_STABLECOIN_CANDIDATES.filter( | ||
|
|
@@ -137,6 +138,7 @@ export const useReceiveTokens = ( | |
| ); | ||
| const solanaAccount = selectAccountByScope(SolScope.Mainnet); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for quick buy and sell, safe for added when only activate if stellar account exist + bridge FF activate |
||
| const tronAccount = selectAccountByScope(TrxScope.Mainnet); | ||
| const stellarAccount = selectAccountByScope(XlmScope.Pubnet); | ||
| const bitcoinAccount = selectAccountByScope(BtcScope.Mainnet); | ||
|
|
||
| // Non-EVM accounts in the selected group, keyed by the CAIP chain id the | ||
|
|
@@ -146,9 +148,10 @@ export const useReceiveTokens = ( | |
| () => ({ | ||
| [SolScope.Mainnet]: solanaAccount, | ||
| [TrxScope.Mainnet]: tronAccount, | ||
| [XlmScope.Pubnet]: stellarAccount, | ||
| [BtcScope.Mainnet]: bitcoinAccount, | ||
| }), | ||
| [solanaAccount, tronAccount, bitcoinAccount], | ||
| [solanaAccount, tronAccount, stellarAccount, bitcoinAccount], | ||
| ); | ||
|
|
||
| const candidates = useMemo( | ||
|
|
@@ -195,6 +198,7 @@ export const useReceiveTokens = ( | |
| allNetworkConfigs, | ||
| solanaAccount: solanaAccount ?? undefined, | ||
| tronAccount: tronAccount ?? undefined, | ||
| stellarAccount: stellarAccount ?? undefined, | ||
| bitcoinAccount: bitcoinAccount ?? undefined, | ||
| multichainBalances, | ||
| multichainRates: multichainRates as Record< | ||
|
|
@@ -219,6 +223,7 @@ export const useReceiveTokens = ( | |
| allNetworkConfigs, | ||
| solanaAccount, | ||
| tronAccount, | ||
| stellarAccount, | ||
| bitcoinAccount, | ||
| multichainBalances, | ||
| multichainRates, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ import { useSearchTracking } from '../../hooks/useSearchTracking/useSearchTracki | |
| import { FilterButton } from '../../components/FilterBar/FilterBar'; | ||
| import TokenListPageLayout from '../../components/TokenListPageLayout/TokenListPageLayout'; | ||
| import { TRENDING_NETWORKS_LIST } from '../../utils/trendingNetworksList'; | ||
| import { useTrendingChainIds } from '../../hooks/useTrendingChainIds/useTrendingChainIds'; | ||
| import type { Theme } from '../../../../../util/theme/models'; | ||
| import { useABTest } from '../../../../../hooks/useABTest'; | ||
| import { | ||
|
|
@@ -142,6 +143,13 @@ const TrendingTokensFullView = () => { | |
| const [quickTradeToken, setQuickTradeToken] = useState<TrendingAsset | null>( | ||
| null, | ||
| ); | ||
| const trendingChainIds = useTrendingChainIds(); | ||
| const trendingNetworks = useMemo(() => { | ||
| const allowedChainIds = new Set(trendingChainIds); | ||
| return TRENDING_NETWORKS_LIST.filter((network) => | ||
| allowedChainIds.has(network.caipChainId), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gated by FF |
||
| ); | ||
| }, [trendingChainIds]); | ||
| const { variant: quickBuyVariant } = useABTest( | ||
| EXPLORE_QUICK_BUY_AB_KEY, | ||
| EXPLORE_QUICK_BUY_VARIANTS, | ||
|
|
@@ -303,7 +311,7 @@ const TrendingTokensFullView = () => { | |
| searchResults={searchResults} | ||
| isLoading={isLoading} | ||
| onRefresh={handleRefresh} | ||
| allowedNetworks={TRENDING_NETWORKS_LIST} | ||
| allowedNetworks={trendingNetworks} | ||
| extraFilters={timeFilterButton} | ||
| onLoadMore={loadMore} | ||
| isLoadingMore={isLoadingMore} | ||
|
|
||
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 for quick buy and sell, safe for added when only activate if stellar account exist + bridge FF activate