Skip to content

Commit

Permalink
Only show button for Send Assets modal if Safe has fungible assets
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Sep 17, 2024
1 parent 26a186e commit a078b65
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/pages/Roles/forms/RoleFormCreateProposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function RoleFormCreateProposal({ close }: { close: () => void })

const {
node: { daoAddress },
treasury: { assetsFungible },
} = useFractal();
const navigate = useNavigate();
const { addressPrefix } = useNetworkConfig();
Expand All @@ -94,6 +95,9 @@ export default function RoleFormCreateProposal({ close }: { close: () => void })
setFieldValueTopLevel('actions', [...values.actions, sendAssetsAction]);
};

const hasAnyBalanceOfAnyFungibleTokens =
assetsFungible.reduce((p, c) => p + BigInt(c.balance), 0n) > 0n;

return (
<Box maxW="736px">
<Flex
Expand Down Expand Up @@ -212,9 +216,11 @@ export default function RoleFormCreateProposal({ close }: { close: () => void })
onCloseAction();
onOpenAssets();
}}
isDisabled={!hasAnyBalanceOfAnyFungibleTokens}
>
Transfer assets
</Button>

<Button
size="lg"
isDisabled
Expand Down

0 comments on commit a078b65

Please sign in to comment.