Skip to content

Commit 440af9b

Browse files
committed
fix(swap): stop synth sunset copy on empty asset picker
The output picker used synthDisabled as a generic empty-state, so Native+usdt (and any other empty filter) showed "Synth minting has been discontinued" to users redeeming secured assets. Empty lists now always use common.noResult. Remove the dead synthDisabled prop and unused i18n key.
1 parent 1be4a6d commit 440af9b

14 files changed

Lines changed: 36 additions & 46 deletions

File tree

src/renderer/components/modal/tradeDeposit/TradeDepositModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ export const TradeDepositModal = (props: TradeDepositModalProps): JSX.Element =>
793793
hasLedger={false}
794794
useLedgerHandler={FP.constVoid}
795795
protocol={currentProtocol}
796-
synthDisabled
797796
/>
798797

799798
{/* Wallet Type Selection */}

src/renderer/components/swap/Swap.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,6 @@ export const Swap = ({
20712071
useLedger={useTargetAssetLedger}
20722072
useLedgerHandler={onClickUseTargetAssetLedger}
20732073
hasLedger={hasTargetAssetLedger}
2074-
synthDisabled
20752074
/>
20762075
<div className="absolute -top-[32px] left-[calc(50%-30px)] flex flex-col justify-center">
20772076
<div className="w-60px h-60px">

src/renderer/components/uielements/assets/assetInput/AssetInput.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export type Props = {
5353
className?: string
5454
classNameInput?: string
5555
onChangePercent?: (percents: number) => void
56-
synthDisabled?: boolean
5756
}
5857

5958
/**
@@ -98,8 +97,7 @@ export const AssetInput = (props: Props): JSX.Element => {
9897
useLedgerHandler,
9998
protocol,
10099
className = '',
101-
classNameInput = '',
102-
synthDisabled = false
100+
classNameInput = ''
103101
} = props
104102

105103
const inputWrapperRef = useRef<FixmeType>()
@@ -203,7 +201,6 @@ export const AssetInput = (props: Props): JSX.Element => {
203201
dialogHeadline={intl.formatMessage({ id: 'common.asset.chooseAsset' })}
204202
shadowless
205203
disabled={disabled}
206-
synthDisabled={synthDisabled}
207204
/>
208205
{walletBalance ? (
209206
<div className="flex items-center justify-end space-x-1 pr-4">

src/renderer/components/uielements/assets/assetMenu/AssetMenu.helper.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616

1717
const assetUSDT = assetFromStringEx('ETH.USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7')
1818
const assetUSDC = assetFromStringEx('ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')
19+
const assetSecuredUSDT = assetFromStringEx('ETH-USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7')
20+
const assetSynthUSDT = assetFromStringEx('ETH/USDT-0xdAC17F958D2ee523a2206206994597C13D831ec7')
1921
const assetAvaxEth = { ...AssetETH, chain: AssetAVAX.chain, type: AssetType.TOKEN }
2022
const assetBscEth = { ...AssetETH, chain: AssetBSC.chain, type: AssetType.TOKEN }
2123

@@ -62,5 +64,26 @@ describe('AssetMenu.helper', () => {
6264
expect(assetMatchesSearch(assetUSDT, 'usdt')).toBe(true)
6365
expect(assetMatchesSearch(AssetETH, 'usdt')).toBe(false)
6466
})
67+
68+
it('keeps L1 and secured USDT on All + usdt, drops synths', () => {
69+
const assets = [assetUSDT, assetSecuredUSDT, assetSynthUSDT, AssetETH]
70+
const sorted = filterAndSortAssetsForMenu(assets, 'usdt', ExtendedAssetType.All)
71+
expect(sorted).toContainEqual(assetUSDT)
72+
expect(sorted).toContainEqual(assetSecuredUSDT)
73+
expect(sorted).not.toContainEqual(assetSynthUSDT)
74+
expect(sorted.every((a) => a.type !== AssetType.SYNTH)).toBe(true)
75+
})
76+
77+
it('returns no USDT matches on Native + usdt (token, not native)', () => {
78+
const assets = [assetUSDT, assetSecuredUSDT, assetSynthUSDT, AssetETH]
79+
const sorted = filterAndSortAssetsForMenu(assets, 'usdt', ExtendedAssetType.Native)
80+
expect(sorted).toEqual([])
81+
})
82+
83+
it('keeps secured USDT on the Secured filter', () => {
84+
const assets = [assetUSDT, assetSecuredUSDT, assetSynthUSDT]
85+
const sorted = filterAndSortAssetsForMenu(assets, '', ExtendedAssetType.Secured)
86+
expect(sorted).toEqual([assetSecuredUSDT])
87+
})
6588
})
6689
})

src/renderer/components/uielements/assets/assetMenu/AssetMenu.tsx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback, useState, useMemo, useRef } from 'react'
22

33
import { Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react'
4-
import { ArchiveBoxXMarkIcon, CheckIcon, XMarkIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline'
4+
import { ArchiveBoxXMarkIcon, CheckIcon, XMarkIcon } from '@heroicons/react/24/outline'
55
import { Network } from '@xchainjs/xchain-client'
66
import { AnyAsset, assetToString, AssetType, Chain } from '@xchainjs/xchain-util'
77
import clsx from 'clsx'
@@ -26,7 +26,6 @@ export type Props = {
2626
className?: string
2727
headline?: string
2828
network: Network
29-
synthDisabled?: boolean
3029
}
3130

3231
export { ExtendedAssetType, filterButtons } from './AssetMenu.helper'
@@ -40,8 +39,7 @@ export const AssetMenu = (props: Props): JSX.Element => {
4039
headline = emptyString,
4140
network,
4241
onClose,
43-
className = '',
44-
synthDisabled = false
42+
className = ''
4543
} = props
4644

4745
const [searchValue, setSearchValue] = useState<string>(emptyString)
@@ -72,22 +70,14 @@ export const AssetMenu = (props: Props): JSX.Element => {
7270
filteredAssets,
7371
NEA.fromArray,
7472
O.fold(
75-
() =>
76-
!synthDisabled ? (
77-
<div className="flex h-full w-[calc(100%-32px)] flex-col items-center justify-center rounded-lg border border-solid border-gray0 p-1 px-20px py-50px dark:border-gray0d">
78-
<ArchiveBoxXMarkIcon className="h-[75px] w-[75px] text-gray0 dark:text-gray0d" />
79-
<h2 className="mb-10px text-[14px] text-gray1 uppercase dark:text-gray1d">
80-
{intl.formatMessage({ id: 'common.noResult' })}
81-
</h2>
82-
</div>
83-
) : (
84-
<div className="flex h-full w-[calc(100%-32px)] flex-col items-center justify-center rounded-lg border border-solid border-gray0 p-1 px-20px py-50px dark:border-gray0d">
85-
<ExclamationTriangleIcon className="h-[75px] w-[75px] text-warning0 dark:text-warning0d" />
86-
<h2 className="mb-10px text-center text-[14px] text-warning0 uppercase dark:text-warning0d">
87-
{intl.formatMessage({ id: 'swap.synth.warning' })}
88-
</h2>
89-
</div>
90-
),
73+
() => (
74+
<div className="flex h-full w-[calc(100%-32px)] flex-col items-center justify-center rounded-lg border border-solid border-gray0 p-1 px-20px py-50px dark:border-gray0d">
75+
<ArchiveBoxXMarkIcon className="h-[75px] w-[75px] text-gray0 dark:text-gray0d" />
76+
<h2 className="mb-10px text-[14px] text-gray1 uppercase dark:text-gray1d">
77+
{intl.formatMessage({ id: 'common.noResult' })}
78+
</h2>
79+
</div>
80+
),
9181
(assets) => (
9282
<div className="w-[calc(100%-32px)] overflow-y-auto rounded-lg border border-solid border-gray0 p-1 dark:border-gray0d">
9383
{FP.pipe(
@@ -110,7 +100,7 @@ export const AssetMenu = (props: Props): JSX.Element => {
110100
)
111101
)
112102
),
113-
[asset, filteredAssets, handleChangeAsset, intl, network, synthDisabled]
103+
[asset, filteredAssets, handleChangeAsset, intl, network]
114104
)
115105

116106
const searchHandler = useCallback(({ target }: React.ChangeEvent<HTMLInputElement>) => {

src/renderer/components/uielements/assets/assetSelect/AssetSelect.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type Props = {
2020
shadowless?: boolean
2121
disabled?: boolean
2222
network: Network
23-
synthDisabled?: boolean
2423
}
2524

2625
export const AssetSelect = (props: Props): JSX.Element => {
@@ -33,8 +32,7 @@ export const AssetSelect = (props: Props): JSX.Element => {
3332
showAssetName = true,
3433
disabled = false,
3534
shadowless = false,
36-
network,
37-
synthDisabled = false
35+
network
3836
} = props
3937

4038
const [openMenu, setOpenMenu] = useState<boolean>(false)
@@ -64,7 +62,6 @@ export const AssetSelect = (props: Props): JSX.Element => {
6462
onClose={() => setOpenMenu(false)}
6563
headline={dialogHeadline}
6664
network={network}
67-
synthDisabled={synthDisabled}
6865
/>
6966
<BaseButton
7067
className={clsx(

src/renderer/i18n/de/swap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ const swap: SwapMessages = {
3939
'Dein Swap ist mit diesem Mindestwert basierend auf der ausgewählten {tolerance}% Slippage-Toleranz abgesichert. Falls eine Preisänderung vor der Transaktions-Bestätigung mehr als {tolerance}% zu Deinem Nachteil beträgt, wird Deine Swap-Transaktion zurücküberwiesen.',
4040
'swap.min.result.protected': 'Gesichertes Swap-Ergebnis',
4141
'swap.address.evm.warning': 'NICHT zu Smart Contract Adressen tauschen',
42-
'swap.synth.warning':
43-
'Das Minten von Synths wurde eingestellt. Die Einlösung von Synths ist noch 3 Monate lang möglich — bitte löse sie ein, solange du kannst.',
4442
'swap.mode.rapid': 'Rapid',
4543
'swap.mode.streaming': 'Streaming',
4644
'swap.mode.instant': 'Sofort',

src/renderer/i18n/en/swap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ const swap: SwapMessages = {
3838
'Your swap is protected by this minimum value based on selected {tolerance}% slippage tolerance. In case the price changes unfavourable more than {tolerance}% your swap transaction will be reverted before confirmation.',
3939
'swap.min.result.protected': 'Protected swap result',
4040
'swap.address.evm.warning': 'Do NOT swap to Smart Contract addresses',
41-
'swap.synth.warning':
42-
'Synth minting has been discontinued. Synth redemption will remain available for the next 3 months — please redeem while you can.',
4341
'swap.mode.rapid': 'Rapid',
4442
'swap.mode.streaming': 'Streaming',
4543
'swap.mode.instant': 'Instant',

src/renderer/i18n/es/swap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ const swap: SwapMessages = {
4040
'Su swap está protegido por este valor mínimo basado en el {tolerance}% de tolerancia de deslizamiento seleccionado. En caso de que el precio cambie desfavorablemente más del {tolerance}%, su operación de swap se revertirá antes de la confirmación.',
4141
'swap.min.result.protected': 'Resultado del swap protegido',
4242
'swap.address.evm.warning': 'NO intercambiar a direcciones de Smart Contract',
43-
'swap.synth.warning':
44-
'La acuñación de Synths se ha descontinuado. La redención de Synths estará disponible durante los próximos 3 meses — por favor, canjéalos mientras puedas.',
4543
'swap.mode.rapid': 'Rapid',
4644
'swap.mode.streaming': 'Streaming',
4745
'swap.mode.instant': 'Instantáneo',

src/renderer/i18n/fr/swap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ const swap: SwapMessages = {
3939
"Votre échange est protégé par cette valeur minimale basée sur la tolérance de slippage de {tolerance} % sélectionnée. Dans le cas où le prix change défavorablement de plus de {tolerance} %, votre transaction d'échange sera annulée avant la confirmation.",
4040
'swap.min.result.protected': 'Résultat du swap protégé',
4141
'swap.address.evm.warning': 'NE PAS échanger vers des adresses de Smart Contract',
42-
'swap.synth.warning':
43-
"La création de Synths a été arrêtée. Le rachat des Synths restera disponible pendant encore 3 mois — veuillez les échanger tant que c'est possible.",
4442
'swap.mode.rapid': 'Rapid',
4543
'swap.mode.streaming': 'Streaming',
4644
'swap.mode.instant': 'Instantané',

0 commit comments

Comments
 (0)