From 6ac2d38241ed9163fbc745ea4f67c53a14f12c24 Mon Sep 17 00:00:00 2001 From: lissavxo Date: Wed, 22 Jan 2025 19:45:55 -0300 Subject: [PATCH 1/2] fix: sideshift amount decimals --- react/lib/components/Widget/AltpaymentWidget.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/react/lib/components/Widget/AltpaymentWidget.tsx b/react/lib/components/Widget/AltpaymentWidget.tsx index 79e02639..3d5f8124 100644 --- a/react/lib/components/Widget/AltpaymentWidget.tsx +++ b/react/lib/components/Widget/AltpaymentWidget.tsx @@ -11,7 +11,8 @@ import { } from '@material-ui/core'; import { resolveNumber, - CryptoCurrency + CryptoCurrency, + DECIMALS } from '../../util'; import { Button, animation } from '../Button/Button'; import { Socket } from 'socket.io-client'; @@ -149,8 +150,11 @@ export const AltpaymentWidget: React.FunctionComponent = props setPairAmount(pairAmount) if (coinPair !== undefined) { - const xecAmount = +coinPair.rate * +pairAmount - updateAmount(xecAmount.toString()) + const settleCoinAmount = +coinPair.rate * +pairAmount + + if(Object.keys(DECIMALS).includes(coinPair.settleCoin)){ + updateAmount(settleCoinAmount.toFixed(DECIMALS[coinPair.settleCoin])) + } } }; @@ -437,7 +441,7 @@ export const AltpaymentWidget: React.FunctionComponent = props

{' '} 1 {selectedCoin?.name} ~={' '} - {resolveNumber(coinPair.rate).toFixed(2)} XEC{' '} + {resolveNumber(coinPair.rate).toFixed(DECIMALS[coinPair.settleCoin])} {coinPair.settleCoin}{' '}

{altpaymentEditable ? ( Date: Sat, 25 Jan 2025 21:21:39 -0800 Subject: [PATCH 2/2] Partial fix for PWA not loading on mobile. --- react/lib/components/Widget/Widget.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/react/lib/components/Widget/Widget.tsx b/react/lib/components/Widget/Widget.tsx index dc57fd3f..ebd8257f 100644 --- a/react/lib/components/Widget/Widget.tsx +++ b/react/lib/components/Widget/Widget.tsx @@ -522,7 +522,6 @@ export const Widget: React.FunctionComponent = props => { if (addressType === 'XEC') { const hasExtension = getCashtabProviderStatus(); if (!hasExtension) { - window.location.href = url; const isMobile = window.matchMedia('(pointer:coarse)').matches; if (isMobile) { window.location.href = `https://cashtab.com/#/send?bip21=${url}`;