From 30486056b1c72d2738b6c2a55d0402981e4f5d72 Mon Sep 17 00:00:00 2001 From: gregs Date: Wed, 2 Oct 2024 02:39:52 -0300 Subject: [PATCH] hide send button when token is not transferable (#1706) Co-authored-by: Daniel Sinclair <4412473+DanielSinclair@users.noreply.github.com> --- src/core/types/assets.ts | 2 ++ src/core/utils/assets.ts | 1 + .../pages/home/TokenDetails/TokenDetails.tsx | 28 +++++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/core/types/assets.ts b/src/core/types/assets.ts index 1d3e231e1d..9fdfdc5628 100644 --- a/src/core/types/assets.ts +++ b/src/core/types/assets.ts @@ -40,6 +40,7 @@ export interface ParsedAsset { isBridgeable: boolean; networks: { [id in ChainId]?: { bridgeable: boolean } }; }; + transferable?: boolean; } export interface ParsedUserAsset extends ParsedAsset { @@ -101,6 +102,7 @@ export type AssetApiResponse = { }; type?: AssetType; interface?: 'erc-721' | 'erc-1155'; + transferable?: boolean; }; type AssetType = ProtocolType | 'nft'; diff --git a/src/core/utils/assets.ts b/src/core/utils/assets.ts index 18f6da501d..85e33dae82 100644 --- a/src/core/utils/assets.ts +++ b/src/core/utils/assets.ts @@ -132,6 +132,7 @@ export function parseAsset({ networks: asset.bridging.networks, }, }), + transferable: asset.transferable, }; return parsedAsset; diff --git a/src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx b/src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx index 5ffd567f39..b5e42f9158 100644 --- a/src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx +++ b/src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx @@ -185,7 +185,9 @@ function SwapSend({ navigate(to); }; const isBridgeable = token.bridging?.isBridgeable; + const isTransferable = token.transferable ?? true; + if (!isSwappable && !isBridgeable && !isTransferable) return null; return ( {isSwappable && ( @@ -213,17 +215,19 @@ function SwapSend({ {i18n.t('token_details.bridge')} )} - + {isTransferable && ( + + )} ); } @@ -828,9 +832,9 @@ export function TokenDetails() { ); })} + ) : null} - )}