Skip to content

Commit

Permalink
fix maxAmount var in staking
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-nax committed Sep 23, 2024
1 parent 72bc180 commit 6f5be7d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spaceward/src/features/staking/StakeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const StakeModal = ({

const { balance } = useAsset("award");
const ward = parseInt(balance?.amount ?? "0") / 10 ** 18;

let maxAmount = ward - 1;
const maxAmount = Math.max(ward - 1e-14 /* should be enough to pay fee */, 0);
const isInputError = Number(amount) > maxAmount;

async function submitTransaction() {
Expand Down Expand Up @@ -163,7 +162,7 @@ const StakeModal = ({
{(
Number(
validator.commission.commissionRates.rate ??
0,
0,
) * 100
).toFixed(1)}
%
Expand All @@ -188,8 +187,8 @@ const StakeModal = ({
<div>
{bigintToFixed(
(apr ?? BigInt(0)) *
// fixme maybe incorrect decimals
BigInt(100),
// fixme maybe incorrect decimals
BigInt(100),
{
decimals: 18,
format: true,
Expand Down

0 comments on commit 6f5be7d

Please sign in to comment.