Skip to content

Commit

Permalink
[Update] - Change content bittensor and bifrost dot unstake
Browse files Browse the repository at this point in the history
  • Loading branch information
tunghp2002 committed Nov 7, 2024
1 parent bd9e5ea commit 94d0de4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import { getValidatorLabel } from '@subwallet/extension-base/koni/api/staking/bo
import { isActionFromValidator } from '@subwallet/extension-base/services/earning-service/utils';
import { AccountJson, RequestYieldLeave, YieldPoolType, YieldPositionInfo } from '@subwallet/extension-base/types';
import { AccountSelector, AlertBox, AmountInput, HiddenInput, InstructionItem, NominationSelector } from '@subwallet/extension-koni-ui/components';
import { BN_ZERO, UNSTAKE_ALERT_DATA } from '@subwallet/extension-koni-ui/constants';
import {

Check failure on line 10 in packages/extension-koni-ui/src/Popup/Transaction/variants/Unbond.tsx

View workflow job for this annotation

GitHub Actions / Build Development Preview

Imports must not be broken into multiple lines if there are 2048 or less elements

Check failure on line 10 in packages/extension-koni-ui/src/Popup/Transaction/variants/Unbond.tsx

View workflow job for this annotation

GitHub Actions / Build Development Preview

Unexpected line break after this opening brace
BN_ZERO,
UNSTAKE_ALERT_DATA,
UNSTAKE_BIFROST_ALERT_DATA,
UNSTAKE_BITTENSOR_ALERT_DATA
} from '@subwallet/extension-koni-ui/constants';

Check failure on line 15 in packages/extension-koni-ui/src/Popup/Transaction/variants/Unbond.tsx

View workflow job for this annotation

GitHub Actions / Build Development Preview

Unexpected line break before this closing brace
import { MktCampaignModalContext } from '@subwallet/extension-koni-ui/contexts/MktCampaignModalContext';
import { useHandleSubmitTransaction, useInitValidateTransaction, usePreCheckAction, useRestoreTransaction, useSelector, useTransactionContext, useWatchTransaction, useYieldPositionDetail } from '@subwallet/extension-koni-ui/hooks';
import useGetConfirmationByScreen from '@subwallet/extension-koni-ui/hooks/campaign/useGetConfirmationByScreen';
Expand Down Expand Up @@ -360,6 +365,10 @@ const Component: React.FC = () => {
return label !== 'dApp' ? label.toLowerCase() : label;
}, [chainValue]);

const unstakeAlertData = poolChain === 'bifrost_dot'
? UNSTAKE_BIFROST_ALERT_DATA
: poolChain === 'bittensor' ? UNSTAKE_BITTENSOR_ALERT_DATA : UNSTAKE_ALERT_DATA;

return (
<>
<TransactionContent>
Expand Down Expand Up @@ -443,7 +452,7 @@ const Component: React.FC = () => {
poolInfo.type !== YieldPoolType.LENDING
? (
<>
{!!UNSTAKE_ALERT_DATA.length && UNSTAKE_ALERT_DATA.map((_props, index) => {
{!!unstakeAlertData.length && unstakeAlertData.map((_props, index) => {
return (
<InstructionItem
className={'__instruction-item'}
Expand Down Expand Up @@ -476,7 +485,9 @@ const Component: React.FC = () => {
)
: (
<AlertBox
description={t('With fast unstake, you will receive your funds immediately with a higher fee')}
description={poolChain === 'bifrost_dot'
? t('In this mode, vDOT will be directly exchanged for DOT at the market price without waiting for the unstaking period')
: t('With fast unstake, you will receive your funds immediately with a higher fee')}
title={t('Fast unstake')}
type={'info'}
/>
Expand Down
24 changes: 24 additions & 0 deletions packages/extension-koni-ui/src/constants/earning/staticData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,27 @@ export const UNSTAKE_ALERT_DATA = [
iconColor: '#aada62'
}
];

export const UNSTAKE_BIFROST_ALERT_DATA = UNSTAKE_ALERT_DATA.map((item, index) => ({
...item,
title: index === 2 ? 'Manual Withdrawal' : item.title,
description: index === 0
? 'Once unstaked, your funds will become available within {unBondedTime}'
: index === 1
? 'During the unstaking period, your tokens produce no rewards'
: index === 2
? 'The funds will be automatically withdrawn to your account once the wait time is over'
: item.description,
icon: index === 0 ? 'ThumbsUp' : index === 2 ? 'Coins' : item.icon,
iconColor: index === 0 ? '#aada62' : index === 2 ? '#e6dc25' : item.iconColor
}));

export const UNSTAKE_BITTENSOR_ALERT_DATA = UNSTAKE_ALERT_DATA.map((item, index) => ({
...item,
title: index === 2 ? 'Instant Withdrawal' : item.title,
description: index === 2
? 'Once unstaked, the funds will be instantly withdrawn to your account'
: item.description,
icon: index === 2 ? 'Coins' : item.icon,
iconColor: index === 2 ? '#e6dc25' : item.iconColor
}));

0 comments on commit 94d0de4

Please sign in to comment.