Skip to content

Commit

Permalink
fix: disable amount and range check for non btc balances
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Feb 29, 2024
1 parent 6712709 commit 5209d2d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/app/screens/Keysend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ function Keysend() {
const { t: tCommon } = useTranslation("common");

const amountMin = 1;
const amountExceeded = +amountSat > (auth?.account?.balance || 0);
const rangeExceeded = +amountSat < amountMin;

const amountExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +amountSat > (auth?.account?.balance || 0);
const rangeExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +amountSat < amountMin;

useEffect(() => {
(async () => {
Expand Down
10 changes: 8 additions & 2 deletions src/app/screens/LNURLPay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ function LNURLPay() {

const amountMin = Math.floor(+details.minSendable / 1000);
const amountMax = Math.floor(+details.maxSendable / 1000);
const amountExceeded = +valueSat > (auth?.account?.balance || 0);
const rangeExceeded = +valueSat > amountMax || +valueSat < amountMin;
const amountExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +valueSat > (auth?.account?.balance || 0);
const rangeExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +valueSat > amountMax || +valueSat < amountMin;

const [showMoreFields, setShowMoreFields] = useState(false);
const [fiatValue, setFiatValue] = useState("");
Expand Down
10 changes: 8 additions & 2 deletions src/app/screens/SendToBitcoinAddress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,14 @@ function SendToBitcoinAddress() {
const amountMin = 100_000;
const amountMax = 10_000_000;

const amountExceeded = +amountSat > (auth?.account?.balance || 0);
const rangeExceeded = +amountSat > amountMax || +amountSat < amountMin;
const amountExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +amountSat > (auth?.account?.balance || 0);
const rangeExceeded =
(auth?.account?.currency || "BTC") !== "BTC"
? false
: +amountSat > amountMax || +amountSat < amountMin;

const timeEstimateAlert = <Alert type="info">{t("time_estimate")}</Alert>;

Expand Down

0 comments on commit 5209d2d

Please sign in to comment.