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

chore: release v1.613.0 #7109

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_THORCHAIN_LP_WITHDRAW=true
REACT_APP_FEATURE_ACCOUNT_MANAGEMENT=true
REACT_APP_FEATURE_ACCOUNT_MANAGEMENT_LEDGER=true
REACT_APP_FEATURE_RFOX=false
REACT_APP_FEATURE_RFOX_REWARDS_TAB=false
REACT_APP_FEATURE_ARBITRUM_BRIDGE=false

# absolute URL prefix
Expand Down
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# feature flags
REACT_APP_FEATURE_RFOX=true
REACT_APP_FEATURE_RFOX_REWARDS_TAB=true
REACT_APP_FEATURE_ARBITRUM_BRIDGE=true

# logging
Expand Down
1 change: 1 addition & 0 deletions .env.develop
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# feature flags
REACT_APP_FEATURE_CHATWOOT=true
REACT_APP_FEATURE_RFOX=true
REACT_APP_FEATURE_RFOX_REWARDS_TAB=true
REACT_APP_FEATURE_ARBITRUM_BRIDGE=true

# mixpanel
Expand Down
37 changes: 35 additions & 2 deletions src/assets/translations/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -2430,12 +2430,15 @@
}
},
"RFOX": {
"staking": "rFOX Staking",
"bridge": "Bridge",
"bridgeFunds": "Bridge Funds",
"bridgeSuccess": "Your funds have been successfully bridged. You can now continue to staking.",
"stake": "Stake",
"unstake": "Unstake",
"claim": "Claim",
"rewards": "Rewards",
"claims": "Claims",
"changeAddress": "Change address",
"sameAddressNotAllowed": "Same address not allowed",
"stakingDetails": "Staking Details",
Expand All @@ -2461,7 +2464,7 @@
"unstakeAmount": "This is amount of FOX you will unstake",
"lockupPeriod": "This is how long you will have to wait after unstaking to claim your FOX",
"shareOfPool": "This is your percentage of the fees you'll earn.",
"unstakePendingCooldown": "Claim available %{cooldownPeriodHuman}",
"unstakePendingCooldown": "Claim available in %{cooldownPeriodHuman}",
"cooldownComplete": "Cooldown finished %{cooldownPeriodHuman}"
},
"stakeSuccess": "You have successfully staked %{amount} %{symbol}",
Expand Down Expand Up @@ -2490,6 +2493,36 @@
"bridgeAndConfirm": "Bridge & Confirm",
"noSupportedChains": "Chain not supported",
"noSupportedChainsDescription": "Add %{chainLabel} or connect to a wallet that supports it.",
"confirmAndBridge": "Confirm & Bridge"
"confirmAndBridge": "Confirm & Bridge",
"myRewardBalance": "My Reward Balance",
"myRewardBalanceHelper": "My Reward Balance",
"pendingRewardsBalance": "Pending Rewards Balance",
"pendingRewardsBalanceHelper": "Pending Rewards Balance",
"lifetimeRewards": "Lifetime Rewards",
"lifetimeRewardsHelper": "Lifetime Rewards",
"timeInPool": "Time in Pool",
"timeInPoolHelper": "Time in Pool",
"myPosition": "My Position",
"faq": {
"title": "FAQ",
"what": {
"title": "What is rFOX?",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
},
"why": {
"title": "Why stake your FOX?",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
},
"cooldown": {
"title": "What is the cooldown period?",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}
},
"totals": "rFOX Totals",
"totalStaked": "Total FOX Staked",
"totalFeesCollected": "Total Fees Collected (This Epoch)",
"emissionsPool": "Emissions Pool (This Epoch)",
"emissionsPoolHelper": "Emissions Pool (This Epoch)",
"foxBurnAmount": "FOX Burn Amount"
}
}
2 changes: 1 addition & 1 deletion src/components/Layout/Header/NavBar/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const Notifications = memo(() => {
chainId: ethChainId,
wallet,
isSnapInstalled,
chainAccountIds: ethAccountIds,
checkConnectedAccountIds: ethAccountIds,
}),
[ethAccountIds, isSnapInstalled, wallet],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const VerifyAddresses = () => {
chainId: buyAsset.chainId,
wallet,
isSnapInstalled: false,
chainAccountIds: buyAccountIds,
checkConnectedAccountIds: buyAccountIds,
})),
[
maybeManualReceiveAddress,
Expand Down
7 changes: 6 additions & 1 deletion src/components/MultiHopTrade/hooks/useSupportedAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export const useSupportedAssets = () => {
return {
walletSupportedChainIds: knownChainIds.filter(chainId => {
const chainAccountIds = accountIdsByChainId[chainId] ?? []
return walletSupportsChain({ chainId, wallet, isSnapInstalled, chainAccountIds })
return walletSupportsChain({
chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: chainAccountIds,
})
}),
sortedAssetIds: sortedAssets.map(asset => asset.assetId),
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/StakingVaults/PositionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const PositionTable: React.FC<PositionTableProps> = ({
positions.filter(position => {
const chainAccountIds = accountIdsByChainId[fromAssetId(position.assetId).chainId] ?? []
return walletSupportsChain({
chainAccountIds,
checkConnectedAccountIds: chainAccountIds,
chainId: fromAssetId(position.assetId).chainId,
wallet,
isSnapInstalled,
Expand Down
14 changes: 12 additions & 2 deletions src/components/StakingVaults/ProviderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export const ProviderCard: React.FC<ProviderCardProps> = ({

return (
staking.includes(e.id as OpportunityId) &&
walletSupportsChain({ chainId: e.chainId, wallet, isSnapInstalled, chainAccountIds })
walletSupportsChain({
chainId: e.chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: chainAccountIds,
})
)
}),
[accountIdsByChainId, isSnapInstalled, staking, stakingOpportunities, wallet],
Expand All @@ -89,7 +94,12 @@ export const ProviderCard: React.FC<ProviderCardProps> = ({

return (
lp.includes(e.assetId as OpportunityId) &&
walletSupportsChain({ chainId: e.chainId, wallet, isSnapInstalled, chainAccountIds })
walletSupportsChain({
chainId: e.chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: chainAccountIds,
})
)
}),
[accountIdsByChainId, isSnapInstalled, lp, lpOpportunities, wallet],
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ const validators = {
REACT_APP_FEATURE_ACCOUNT_MANAGEMENT: bool({ default: false }),
REACT_APP_FEATURE_ACCOUNT_MANAGEMENT_LEDGER: bool({ default: false }),
REACT_APP_FEATURE_RFOX: bool({ default: false }),
REACT_APP_FEATURE_RFOX_REWARDS_TAB: bool({ default: false }),
}

function reporter<T>({ errors }: envalid.ReporterOptions<T>) {
Expand Down
18 changes: 14 additions & 4 deletions src/context/AppProvider/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useIsSnapInstalled } from 'hooks/useIsSnapInstalled/useIsSnapInstalled'
import { useMixpanelPortfolioTracking } from 'hooks/useMixpanelPortfolioTracking/useMixpanelPortfolioTracking'
import { useRouteAssetId } from 'hooks/useRouteAssetId/useRouteAssetId'
import { useWallet } from 'hooks/useWallet/useWallet'
import { walletDeviceSupportsChain } from 'hooks/useWalletSupportsChain/useWalletSupportsChain'
import { walletSupportsChain } from 'hooks/useWalletSupportsChain/useWalletSupportsChain'
import { deriveAccountIdsAndMetadata } from 'lib/account/account'
import { isUtxoChainId } from 'lib/utils/utxo'
import { snapshotApi } from 'state/apis/snapshot/snapshot'
Expand Down Expand Up @@ -92,7 +92,12 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
if (!wallet) return
const walletSupportedChainIds = supportedChains.filter(chainId => {
return walletDeviceSupportsChain({ chainId, wallet, isSnapInstalled })
return walletSupportsChain({
chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: false, // don't check connected account ids, we're detecting initial runtime support for chains
})
})
dispatch(portfolio.actions.setWalletSupportedChainIds(walletSupportedChainIds))
}, [accountIdsByChainId, dispatch, isSnapInstalled, wallet, supportedChains])
Expand All @@ -102,8 +107,13 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
// Skip if wallet is ledger, or if wallet is already connected to accounts - prevents this overriding user selection in account management
if (!wallet || isLedger(wallet) || requestedAccountIds.length > 0) return
;(async () => {
let chainIds = Array.from(supportedChains).filter(chainId => {
return walletDeviceSupportsChain({ chainId, wallet, isSnapInstalled })
let chainIds = supportedChains.filter(chainId => {
return walletSupportsChain({
chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: false, // don't check connected account ids, we're detecting runtime support for chains
})
})

const accountMetadataByAccountId: AccountMetadataById = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export const ThorchainSaversOverview: React.FC<OverviewProps> = ({

const handleThorchainSaversEmptyClick = useCallback(() => setHideEmptyState(true), [])

if ((!earnOpportunityData && maybeAccountId) || isTradingActiveLoading) {
if ((!earnOpportunityData?.isLoaded && maybeAccountId) || isTradingActiveLoading) {
return (
<Center minW='500px' minH='350px'>
<CircularProgress />
Expand Down
40 changes: 16 additions & 24 deletions src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ import { selectAccountIdsByChainIdFilter } from 'state/slices/portfolioSlice/sel
import { selectFeatureFlag } from 'state/slices/selectors'
import { store, useAppSelector } from 'state/store'

type WalletDeviceSupportsChainArgs = {
type WalletSupportsChainArgs = {
isSnapInstalled: boolean | null
chainId: ChainId
wallet: HDWallet | null
// The connected account ids to check against. If set to false, the currently connected account
// ids will not be checked (used for initial boot)
checkConnectedAccountIds: AccountId[] | false
}

type WalletSupportsChainArgs = {
chainAccountIds: AccountId[] // allows dynamic chain-support detection for Ledger
} & WalletDeviceSupportsChainArgs

// use outside react
export const walletDeviceSupportsChain = ({
export const walletSupportsChain = ({
chainId,
wallet,
isSnapInstalled,
}: WalletDeviceSupportsChainArgs): boolean => {
checkConnectedAccountIds,
}: WalletSupportsChainArgs): boolean => {
// If the user has no connected chain account ids, the user can't use it to interact with the chain
if (checkConnectedAccountIds !== false && !checkConnectedAccountIds.length) return false

if (!wallet) return false
// A wallet may have feature-capabilities for a chain, but not have runtime support for it
// e.g MM without snaps installed
Expand Down Expand Up @@ -107,22 +110,6 @@ export const walletDeviceSupportsChain = ({
}
}

export const walletSupportsChain = ({
chainId,
chainAccountIds,
wallet,
isSnapInstalled,
}: WalletSupportsChainArgs): boolean => {
// If the user has no connected chain account ids, the user can't use it to interact with the chain
if (!chainAccountIds.length) return false

return walletDeviceSupportsChain({
chainId,
wallet,
isSnapInstalled,
})
}

export const useWalletSupportsChain = (
chainId: ChainId,
wallet: HDWallet | null,
Expand All @@ -140,7 +127,12 @@ export const useWalletSupportsChain = (
)

const result = useMemo(() => {
return walletSupportsChain({ isSnapInstalled, chainId, wallet, chainAccountIds })
return walletSupportsChain({
isSnapInstalled,
chainId,
wallet,
checkConnectedAccountIds: chainAccountIds,
})
}, [chainAccountIds, chainId, isSnapInstalled, wallet])

return result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ export const useLendingSupportedAssets = ({ type }: { type: 'collateral' | 'borr
() =>
knownChainIds.filter(chainId => {
const chainAccountIds = accountIdsByChainId[chainId] ?? []
return walletSupportsChain({ chainId, wallet, isSnapInstalled, chainAccountIds })
return walletSupportsChain({
chainId,
wallet,
isSnapInstalled,
checkConnectedAccountIds: chainAccountIds,
})
}),
[accountIdsByChainId, isSnapInstalled, wallet],
)
Expand Down
Loading
Loading