Skip to content

Commit c540370

Browse files
Agilulfo1820claude
andcommitted
fix(swap): block veDelegate from being swapped
Disable swap on the veDelegate token detail and exclude veDelegate from both sides of the swap token-selection list. veDelegate remains transferable elsewhere. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 092f4e0 commit c540370

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

packages/vechain-kit/src/components/AccountModal/Contents/Swap/SwapTokenContent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ import { useVeChainKitConfig } from '@/providers';
4242
import { TOKEN_LOGOS, TOKEN_LOGO_COMPONENTS } from '@/utils';
4343
import { formatUnits, parseUnits } from 'viem';
4444
import { compareAddresses, NON_TRANSFERABLE_TOKEN_SYMBOLS } from '@/utils';
45+
46+
const SWAP_EXCLUDED_TOKEN_SYMBOLS: readonly string[] = [
47+
...NON_TRANSFERABLE_TOKEN_SYMBOLS,
48+
'veDelegate',
49+
];
4550
import { SelectTokenContent } from '../SendToken/SelectTokenContent';
4651
import { formatCompactCurrency } from '@/utils/currencyUtils';
4752
import {
@@ -143,7 +148,7 @@ export const SwapTokenContent = ({
143148
);
144149
if (
145150
match &&
146-
!NON_TRANSFERABLE_TOKEN_SYMBOLS.includes(match.symbol)
151+
!SWAP_EXCLUDED_TOKEN_SYMBOLS.includes(match.symbol)
147152
) {
148153
setFromToken(match);
149154
}
@@ -154,7 +159,7 @@ export const SwapTokenContent = ({
154159
);
155160
if (
156161
match &&
157-
!NON_TRANSFERABLE_TOKEN_SYMBOLS.includes(match.symbol)
162+
!SWAP_EXCLUDED_TOKEN_SYMBOLS.includes(match.symbol)
158163
) {
159164
setToToken(match);
160165
}
@@ -621,6 +626,7 @@ export const SwapTokenContent = ({
621626
onSelectToken={handleSelectFromToken}
622627
onBack={() => setStep('main')}
623628
showAllTokens={false}
629+
excludedTokenSymbols={SWAP_EXCLUDED_TOKEN_SYMBOLS}
624630
/>
625631
);
626632
}
@@ -647,6 +653,7 @@ export const SwapTokenContent = ({
647653
onSelectToken={handleSelectToToken}
648654
onBack={() => setStep('main')}
649655
showAllTokens={true}
656+
excludedTokenSymbols={SWAP_EXCLUDED_TOKEN_SYMBOLS}
650657
/>
651658
);
652659
}

packages/vechain-kit/src/components/AccountModal/Contents/TokenDetail/TokenDetailContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const TokenDetailContent = ({
9292
const isNonTransferable = NON_TRANSFERABLE_TOKEN_SYMBOLS.includes(
9393
token.symbol,
9494
);
95+
const isNonSwappable = isNonTransferable || token.symbol === 'veDelegate';
9596

9697
const amountNumber = Number(token.balance);
9798
const balanceText = amountNumber.toLocaleString(undefined, {
@@ -237,7 +238,7 @@ export const TokenDetailContent = ({
237238
icon={LuArrowLeftRight}
238239
label="Swap"
239240
onClick={handleSwap}
240-
isDisabled={isNonTransferable}
241+
isDisabled={isNonSwappable}
241242
/>
242243
<ActionIconButton
243244
icon={LuArrowUpFromLine}

0 commit comments

Comments
 (0)