Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased (develop)

- added: Nym mixnet warning in Stake, Unstake, and Claim Rewards scenes

## 4.48.0 (staging)

- added: (iOS) Disable Liquid Glass UI for iOS 26 compatibility
Expand Down
33 changes: 31 additions & 2 deletions src/components/scenes/Staking/StakeModifyScene.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { div, eq, gt, toFixed } from 'biggystring'
import { asMaybe } from 'cleaners'
import {
DustSpendError,
type EdgeCurrencyWallet,
Expand All @@ -12,6 +13,7 @@ import { sprintf } from 'sprintf-js'
import { updateStakingPosition } from '../../../actions/scene/StakingActions'
import { useAsyncEffect } from '../../../hooks/useAsyncEffect'
import { useDisplayDenom } from '../../../hooks/useDisplayDenom'
import { useWatch } from '../../../hooks/useWatch'
import { lstrings } from '../../../locales/strings'
import {
type ChangeQuote,
Expand All @@ -35,8 +37,10 @@ import {
getPositionAllocations
} from '../../../util/stakeUtils'
import { zeroString } from '../../../util/utils'
import { AlertCardUi4 } from '../../cards/AlertCard'
import { EdgeCard } from '../../cards/EdgeCard'
import { WarningCard } from '../../cards/WarningCard'
import { EdgeAnim } from '../../common/EdgeAnim'
import { SceneWrapper } from '../../common/SceneWrapper'
import { withWallet } from '../../hoc/withWallet'
import { SceneContainer } from '../../layout/SceneContainer'
Expand All @@ -52,6 +56,7 @@ import { Airship, showError } from '../../services/AirshipInstance'
import { cacheStyles, type Theme, useTheme } from '../../services/ThemeContext'
import { Alert } from '../../themed/Alert'
import { EdgeText } from '../../themed/EdgeText'
import { asPrivateNetworkingSetting } from '../../themed/MaybePrivateNetworkingSetting'
import { SafeSlider } from '../../themed/SafeSlider'
import { CryptoFiatAmountTile } from '../../tiles/CryptoFiatAmountTile'
import { EditableAmountTile } from '../../tiles/EditableAmountTile'
Expand All @@ -69,7 +74,7 @@ interface Props extends EdgeAppSceneProps<'stakeModify'> {
wallet: EdgeCurrencyWallet
}

const StakeModifySceneComponent = (props: Props): React.ReactElement => {
const StakeModifySceneComponent: React.FC<Props> = props => {
const { navigation, route, wallet } = props
const { modification, title, stakePlugin, stakePolicy } = route.params
const dispatch = useDispatch()
Expand All @@ -94,6 +99,10 @@ const StakeModifySceneComponent = (props: Props): React.ReactElement => {
const guiExchangeRates = useSelector(state => state.exchangeRates)
const nativeAssetDenomination = useDisplayDenom(wallet.currencyConfig, null)

const userSettings = useWatch(wallet.currencyConfig, 'userSettings')
const isNymActive =
asMaybe(asPrivateNetworkingSetting)(userSettings)?.networkPrivacy === 'nym'

// ChangeQuote that gets rendered in the rows
const [changeQuote, setChangeQuote] = React.useState<ChangeQuote | null>(null)
const changeQuoteAllocations =
Expand Down Expand Up @@ -627,7 +636,7 @@ const StakeModifySceneComponent = (props: Props): React.ReactElement => {
return warningMessage == null ? null : (
<Alert
key="warning"
marginRem={[0, 1, 1, 1]}
marginRem={[0, 1, 0, 1]}
title={lstrings.wc_smartcontract_warning_title}
message={warningMessage}
numberOfLines={0}
Expand All @@ -636,6 +645,24 @@ const StakeModifySceneComponent = (props: Props): React.ReactElement => {
)
}

const renderNymWarning = (): React.ReactElement | null => {
if (!isNymActive) return null

return (
<EdgeAnim
enter={{ type: 'fadeInUp', distance: 60 }}
exit={{ type: 'fadeOutDown' }}
>
<AlertCardUi4
type="warning"
title={lstrings.settings_nym_mixnet_warning_title}
body={lstrings.settings_nym_mixnet_warning_body}
marginRem={[0, 0.5, 0, 0.5]}
/>
</EdgeAnim>
)
}

const renderChangeQuoteAmountTiles = (
modification: ChangeQuoteRequest['action']
): React.ReactElement => {
Expand Down Expand Up @@ -741,6 +768,7 @@ const StakeModifySceneComponent = (props: Props): React.ReactElement => {
<SceneContainer headerTitle={title} headerTitleChildren={icon}>
{renderChangeQuoteAmountTiles(modification)}
{renderWarning()}
{renderNymWarning()}
<View style={styles.footer}>
<SafeSlider
onSlidingComplete={handleSlideComplete}
Expand Down Expand Up @@ -775,6 +803,7 @@ const getStyles = cacheStyles((theme: Theme) => ({
marginTop: theme.rem(0.5)
},
footer: {
marginTop: theme.rem(1),
marginBottom: theme.rem(2)
}
}))
Expand Down
Loading