diff --git a/.changeset/khaki-tomatoes-own.md b/.changeset/khaki-tomatoes-own.md new file mode 100644 index 00000000..99ef0bca --- /dev/null +++ b/.changeset/khaki-tomatoes-own.md @@ -0,0 +1,5 @@ +--- +'ptokens-dapp-v2': minor +--- + +disable unsupported tokens diff --git a/.snyk b/.snyk index c55bdd38..d22ef4fa 100644 --- a/.snyk +++ b/.snyk @@ -5,31 +5,31 @@ ignore: SNYK-JS-WEB3UTILS-6229337: - '*': reason: will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-04-04T11:30:11.068Z SNYK-JS-WS-7266574: - '*': reason: will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-08-28T11:30:11.068Z SNYK-JS-ELLIPTIC-7577916: - '*': reason: Will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-08-28T11:30:11.068Z SNYK-JS-ELLIPTIC-7577917: - '*': reason: Will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-08-28T11:30:11.068Z SNYK-JS-ELLIPTIC-7577918: - '*': reason: Will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-08-28T11:30:11.068Z SNYK-JS-MICROMATCH-6838728: - '*': reason: Will be fixed in v4 - fix planned - expires: 2024-09-04T00:00:00.000Z + expires: 2024-09-10T00:00:00.000Z created: 2024-08-28T11:30:11.068Z patch: {} diff --git a/package-lock.json b/package-lock.json index c8fa0471..e60887e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22790,9 +22790,10 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", "engines": { "node": ">=8.3.0" }, diff --git a/src/components/pages/swap/Swap.jsx b/src/components/pages/swap/Swap.jsx index 841c0c6b..942d3b67 100644 --- a/src/components/pages/swap/Swap.jsx +++ b/src/components/pages/swap/Swap.jsx @@ -11,7 +11,7 @@ import { MAX_IMPACT, PBTC_ON_ETH_MAINNET_V1_MIGRATION, PUOS_ON_ULTRA_MAINNET } f import { sendEvent } from '../../../ga4' import { useAssets } from '../../../hooks/use-assets' import { useSwap } from '../../../hooks/use-swap' -import defaultAssets from '../../../settings/swap-assets' +import defaultAssets, { disabledAssets } from '../../../settings/swap-assets' import Button from '../../atoms/button/Button' import Icon from '../../atoms/icon/Icon' import Switch from '../../atoms/switch/Switch' @@ -410,12 +410,18 @@ const Swap = ({ caution! ) : null} - {from && from.isNative && to && to && to.notifyDepositAddressWarning && ( - - Please refrain from using previously generated deposit addresses, as doing so may result in a loss of - funds. - - )} + {from && + from.isNative && + to && + to.notifyDepositAddressWarning && + to.id !== 'PBTC_ON_ARBITRUM_MAINNET' && + to.id !== 'PBTC_ON_TELOS_MAINNET' && + to.id !== 'PBTC_ON_LIBRE_MAINNET' && ( + + Please refrain from using previously generated deposit addresses, as doing so may result in a loss + of funds. + + )} {from && from.id === 'GALA_ON_BSC_MAINNET' && to && to.id === 'GALA' ? ( You are about to pegout (redeem){' '} @@ -450,20 +456,8 @@ const Swap = ({ direct control (i.e. not a CEX deposit address). ) : null} - {(from && from.id === 'GALA' && to && to.id === 'GALA_ON_BSC_MAINNET') || - (from && from.id === '$ANRX' && to && to.id === '$ANRX_ON_BSC_MAINNET') || - (from && from.id === 'BTC' && to && to.id === 'PBTC_ON_ARBITRUM_MAINNET') || - (from && from.id === 'PNT_ON_ETH_MAINNET' && to && to.id === 'PNT_ON_ARBITRUM_MAINNET') || - (from && from.id === 'ETHPNT_ON_ETH_MAINNET' && to && to.id === 'PNT_ON_ARBITRUM_MAINNET') || - (from && from.id === 'IQ' && to && to.id === 'IQ_ON_ETH_MAINNET') || - (from && from.id === 'KEYS' && to && to.id === 'PKEYS_ON_BSC_MAINNET') || - (from && from.id === 'LUXO' && to && to.id === 'LUXO_ON_BSC_MAINNET') || - (from && from.id === 'OPEN' && to && to.id === 'POPEN_ON_BSC_MAINNET') || - (from && from.id === 'OPIUM' && to && to.id === 'POPIUM_ON_BSC_MAINNET') || - (from && from.id === 'PTERIA' && to && to.id === 'PTERIA_ON_BSC_MAINNET') || - (from && from.id === 'SEEDS' && to && to.id === 'PSEEDS_ON_ETH_MAINNET') || - (from && from.id === 'ZMT' && to && to.id === 'ZMT_ON_BSC_MAINNET') ? ( - {`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegouts are available until 09/30/2024`} + {from && to && (disabledAssets.includes(from.id) || disabledAssets.includes(to.id)) ? ( + {`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegout the native token ASAP for a smooth redeem process.`} ) : null} {to && (to.id === 'PUSDC_ON_ALGORAND_MAINNET' || diff --git a/src/hooks/use-swap.js b/src/hooks/use-swap.js index c3248533..3904d37c 100644 --- a/src/hooks/use-swap.js +++ b/src/hooks/use-swap.js @@ -10,6 +10,7 @@ import { CURVE_MAX_AMOUNT, } from '../constants' import { sendEvent } from '../ga4' +import { disabledAssets } from '../settings/swap-assets' import { maybeOptInAlgoApp, maybeOptInAlgoAsset } from '../store/swap/utils/opt-in-algo' import { isValidAccountByBlockchain } from '../utils/account-validator' import { getSwapFees, computeSwapAmount } from '../utils/fee' @@ -319,21 +320,7 @@ const useSwap = ({ return } - if ( - (from.id === 'GALA' && to.id === 'GALA_ON_BSC_MAINNET') || - (from.id === '$ANRX' && to.id === '$ANRX_ON_BSC_MAINNET') || - (from.id === 'BTC' && to.id === 'PBTC_ON_ARBITRUM_MAINNET') || - (from.id === 'PNT_ON_ETH_MAINNET' && to.id === 'PNT_ON_ARBITRUM_MAINNET') || - (from.id === 'ETHPNT_ON_ETH_MAINNET' && to.id === 'PNT_ON_ARBITRUM_MAINNET') || - (from.id === 'IQ' && to.id === 'IQ_ON_ETH_MAINNET') || - (from.id === 'KEYS' && to.id === 'PKEYS_ON_BSC_MAINNET') || - (from.id === 'LUXO' && to.id === 'LUXO_ON_BSC_MAINNET') || - (from.id === 'OPEN' && to.id === 'POPEN_ON_BSC_MAINNET') || - (from.id === 'OPIUM' && to.id === 'POPIUM_ON_BSC_MAINNET') || - (from.id === 'PTERIA' && to.id === 'PTERIA_ON_BSC_MAINNET') || - (from.id === 'SEEDS' && to.id === 'PSEEDS_ON_ETH_MAINNET') || - (from.id === 'ZMT' && to.id === 'ZMT_ON_BSC_MAINNET') - ) { + if (disabledAssets.includes(to.id)) { updateSwapButton('Disabled Swap', true) return } diff --git a/src/settings/swap-assets.js b/src/settings/swap-assets.js index c7b0df12..138545fc 100644 --- a/src/settings/swap-assets.js +++ b/src/settings/swap-assets.js @@ -1,5 +1,28 @@ import { ChainId } from '@p.network/ptokens-constants' +export const disabledAssets = [ + 'GALA_ON_BSC_MAINNET', + 'ANRX_ON_BSC_MAINNET', + 'PBTC_ON_ARBITRUM_MAINNET', + 'PBTC_ON_LIBRE_MAINNET', + 'PBTC_ON_TELOS_MAINNET', + 'PNT_ON_ARBITRUM_MAINNET', + 'IQ_ON_ETH_MAINNET', + 'PKEYS_ON_BSC_MAINNET', + 'LUXO_ON_BSC_MAINNET', + 'POPEN_ON_BSC_MAINNET', + 'POPIUM_ON_BSC_MAINNET', + 'PTERIA_ON_BSC_MAINNET', + 'PSEEDS_ON_ETH_MAINNET', + 'TLOS_ON_ETH_MAINNET', + 'TLOS_ON_BSC_MAINNET', + 'PUSDT_ON_LIBRE_MAINNET', + 'PUSDT_ON_TELOS_MAINNET', + 'PETH_ON_TELOS_MAINNET', + 'NUCO_ON_TELOS_MAINNET', + 'ZMT_ON_BSC_MAINNET', +] + const swapAssets = [ /* ################# pTokens #################*/ {