Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide send button when token is not transferable #1706

2 changes: 2 additions & 0 deletions src/core/types/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface ParsedAsset {
isBridgeable: boolean;
networks: { [id in ChainId]?: { bridgeable: boolean } };
};
transferable?: boolean;
}

export interface ParsedUserAsset extends ParsedAsset {
Expand Down Expand Up @@ -101,6 +102,7 @@ export type AssetApiResponse = {
};
type?: AssetType;
interface?: 'erc-721' | 'erc-1155';
transferable?: boolean;
};

type AssetType = ProtocolType | 'nft';
Expand Down
1 change: 1 addition & 0 deletions src/core/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function parseAsset({
networks: asset.bridging.networks,
},
}),
transferable: asset.transferable,
};

return parsedAsset;
Expand Down
28 changes: 16 additions & 12 deletions src/entries/popup/pages/home/TokenDetails/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Box display="flex" gap="8px">
{isSwappable && (
Expand Down Expand Up @@ -213,17 +215,19 @@ function SwapSend({
{i18n.t('token_details.bridge')}
</Button>
)}
<Button
height="32px"
variant="flat"
width="full"
color="accent"
symbol="paperplane.fill"
onClick={() => selectTokenAndNavigate(ROUTES.SEND)}
tabIndex={0}
>
{i18n.t('token_details.send')}
</Button>
{isTransferable && (
<Button
height="32px"
variant="flat"
width="full"
color="accent"
symbol="paperplane.fill"
onClick={() => selectTokenAndNavigate(ROUTES.SEND)}
tabIndex={0}
>
{i18n.t('token_details.send')}
</Button>
)}
</Box>
);
}
Expand Down Expand Up @@ -828,9 +832,9 @@ export function TokenDetails() {
);
})}
</Stack>
<Separator color="separatorTertiary" />
</Box>
) : null}
<Separator color="separatorTertiary" />
<About token={token} tokenInfo={tokenInfo} />
</Box>
)}
Expand Down
Loading