Added max button.
This commit is contained in:
parent
0dc1ae1590
commit
7f9d8daba4
|
@ -464,9 +464,18 @@ function useForm(balanceInfo, addressHelperText, passAddressValidation) {
|
|||
margin="normal"
|
||||
type="number"
|
||||
InputProps={{
|
||||
endAdornment: tokenSymbol ? (
|
||||
<InputAdornment position="end">{tokenSymbol}</InputAdornment>
|
||||
) : null,
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<Button onClick={() =>
|
||||
setTransferAmountString(
|
||||
balanceAmountToUserAmount(balanceAmount, decimals),
|
||||
)
|
||||
}>
|
||||
MAX
|
||||
</Button>
|
||||
{tokenSymbol ? tokenSymbol : null}
|
||||
</InputAdornment>
|
||||
),
|
||||
inputProps: {
|
||||
step: Math.pow(10, -decimals),
|
||||
},
|
||||
|
@ -477,11 +486,11 @@ function useForm(balanceInfo, addressHelperText, passAddressValidation) {
|
|||
<span
|
||||
onClick={() =>
|
||||
setTransferAmountString(
|
||||
(balanceAmount / Math.pow(10, decimals)).toFixed(decimals),
|
||||
balanceAmountToUserAmount(balanceAmount, decimals),
|
||||
)
|
||||
}
|
||||
>
|
||||
Max: {balanceAmount / Math.pow(10, decimals)}
|
||||
Max: {balanceAmountToUserAmount(balanceAmount, decimals)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
@ -497,6 +506,10 @@ function useForm(balanceInfo, addressHelperText, passAddressValidation) {
|
|||
};
|
||||
}
|
||||
|
||||
function balanceAmountToUserAmount(balanceAmount, decimals) {
|
||||
return (balanceAmount / Math.pow(10, decimals)).toFixed(decimals)
|
||||
}
|
||||
|
||||
function EthWithdrawalCompleter({ ethAccount, publicKey }) {
|
||||
const [swaps] = useSwapApiGet(`swaps_from/sol/${publicKey.toBase58()}`, {
|
||||
refreshInterval: 10000,
|
||||
|
|
Loading…
Reference in New Issue