From 98aff12a8c9654dc7390060968bf16e29bbdb482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brzezin=CC=81ski?= Date: Thu, 22 Jan 2026 13:30:26 +0200 Subject: [PATCH] fix --- .../instructions/SplTokenTransfer.tsx | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/pages/dao/[symbol]/proposal/components/instructions/SplTokenTransfer.tsx b/pages/dao/[symbol]/proposal/components/instructions/SplTokenTransfer.tsx index 24f2bce35..d2c940b66 100644 --- a/pages/dao/[symbol]/proposal/components/instructions/SplTokenTransfer.tsx +++ b/pages/dao/[symbol]/proposal/components/instructions/SplTokenTransfer.tsx @@ -1,7 +1,8 @@ import React, { useContext, useEffect, useState } from 'react' import Input from '@components/inputs/Input' +import { LinkButton } from '@components/Button' import useRealm from '@hooks/useRealm' -import { getMintMinAmountAsDecimal } from '@tools/sdk/units' +import { getMintDecimalAmount, getMintMinAmountAsDecimal } from '@tools/sdk/units' import { PublicKey } from '@solana/web3.js' import { precision } from '@utils/formatting' import { @@ -73,6 +74,17 @@ const SplTokenTransfer = ({ propertyName: 'amount', }) } + const setMaxAmount = () => { + const mintAccount = form.governedTokenAccount?.extensions?.mint?.account + const amount = form.governedTokenAccount?.extensions?.amount + if (!mintAccount || !amount) return + + const maxAmount = getMintDecimalAmount(mintAccount, amount).toNumber() + handleSetForm({ + value: maxAmount, + propertyName: 'amount', + }) + } const validateAmountOnBlur = () => { const value = form.amount @@ -192,16 +204,28 @@ const SplTokenTransfer = ({
{destinationAccountName}
)} - +
+
+ Amount +
+ + Max + +
+
+ +
) }