Skip to content

Commit

Permalink
fix: Resolved an issue where the max function would crash if the valu…
Browse files Browse the repository at this point in the history
…e contained a comma. (#417)
  • Loading branch information
sh-wallet authored Nov 21, 2024
1 parent a52e2f3 commit fecbe30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/fetch-extension/src/pages-new/send/send-phase-1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Label } from "reactstrap";
import { observer } from "mobx-react-lite";
import { useNavigate } from "react-router";
import { CoinPretty, Int } from "@keplr-wallet/unit";
import { removeComma } from "@utils/format";

interface SendPhase1Props {
sendConfigs: any;
Expand Down Expand Up @@ -57,7 +58,7 @@ export const SendPhase1: React.FC<SendPhase1Props> = observer(
<CoinInput
onPress={() =>
sendConfigs.amountConfig.setAmount(
balance.shrink(true).hideDenom(true).toString()
removeComma(balance.shrink(true).hideDenom(true).toString())
)
}
amountConfig={sendConfigs.amountConfig}
Expand Down
2 changes: 2 additions & 0 deletions packages/fetch-extension/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,5 @@ export const removeTrailingZeros = (number: string) => {
.toString()
.replace(/([0-9]+(\.[0-9]+[1-9])?)(\.?0+$)/, "$1");
};

export const removeComma = (value: string) => value.replace(/,/g, "");

0 comments on commit fecbe30

Please sign in to comment.