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 #6123

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/expanded-state/asset/ChartExpandedState.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export default function ChartExpandedState({ asset }) {

const isL2 = useMemo(() => isL2Chain({ chainId: asset?.chainId }), [asset?.chainId]);
const isTestnet = isTestnetChain({ chainId: currentChainId });
const isTransferable = asset?.transferable ?? genericAsset?.transferable ?? true;

const { data, isLoading: additionalAssetDataLoading } = useAdditionalAssetData({
address: asset?.address,
Expand Down Expand Up @@ -293,7 +294,9 @@ export default function ChartExpandedState({ asset }) {
<SwapActionButton asset={assetWithPrice} color={color} inputType={AssetInputTypes.in} />
)}
{hasBalance ? (
<SendActionButton asset={assetWithPrice} color={color} fromDiscover={fromDiscover} />
isTransferable ? (
<SendActionButton asset={assetWithPrice} color={color} fromDiscover={fromDiscover} />
) : null
Comment on lines 296 to +299
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just combine the check (hasBalance && isTransferable) here

Copy link
Contributor Author

@greg-schrammel greg-schrammel Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic is like this, I didn't want to mess with that

hasBalance 
  ? isTransferable 
      ? <SendActionButton asset={assetWithPrice} color={color} fromDiscover={fromDiscover} />
      : null
  : swapEnabled 
     ? <SwapActionButton asset={assetWithPrice} ...
     : null

but I see there is another <SwapActionButton /> with other checks above I believe we can have only one gonna take a look

) : swapEnabled ? (
<SwapActionButton
asset={assetWithPrice}
Expand Down
1 change: 1 addition & 0 deletions src/graphql/queries/metadata.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ query externalToken($address: String!, $chainId: Int!, $currency: String) {
iconUrl
name
networks
transferable
price {
relativeChange24h
value
Expand Down
1 change: 1 addition & 0 deletions src/resources/assets/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function parseAsset({ address, asset }: { address: string; asset: AddysAs
symbol: asset?.symbol,
type: asset?.type,
uniqueId,
transferable: asset?.transferable,
};

return parsedAsset;
Expand Down
1 change: 1 addition & 0 deletions src/resources/assets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type AddysAsset = {
price?: AddysAssetPrice;
symbol: string;
type?: string;
transferable?: boolean;
};

export type AddysNetworkDetails = {
Expand Down
Loading