Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed SC buy errors #108

Merged
merged 11 commits into from
Apr 24, 2024
3 changes: 2 additions & 1 deletion src/routes/reservecoin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export default function ReserveCoin() {
: tradeData.amountUnscaled;

const onSubmit = (e) => {
if (!isWalletConnected) return;
if (!termsAccepted) return;
e.preventDefault();
if (isWSCConnected) {
Expand All @@ -290,7 +291,7 @@ export default function ReserveCoin() {
? buyValidity === TRANSACTION_VALIDITY.OK
: sellValidity === TRANSACTION_VALIDITY.OK;

const buttonDisabled = value === null || isWrongChain || !transactionValidated;
const buttonDisabled = isNaN(parseInt(value)) || parseInt(value) === 0 || isWrongChain || !transactionValidated;

const rcFloat = parseFloat(coinsDetails?.scaledNumberRc.replaceAll(",", ""));
const rcConverted = getRcUsdEquivalent(coinsDetails, rcFloat);
Expand Down
3 changes: 2 additions & 1 deletion src/routes/stablecoin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export default function Stablecoin() {
: sellSc.bind(null, tradeData.amountUnscaled);

const onSubmit = (e) => {
if (!isWalletConnected) return;
if (!termsAccepted) return;
e.preventDefault();
if (isWSCConnected) {
Expand All @@ -265,7 +266,7 @@ export default function Stablecoin() {
? buyValidity === TRANSACTION_VALIDITY.OK
: sellValidity === TRANSACTION_VALIDITY.OK;

const buttonDisabled = value === null || isWrongChain || !transactionValidated;
const buttonDisabled = isNaN(parseInt(value)) || parseInt(value) === 0 || isWrongChain || !transactionValidated;

const scFloat = parseFloat(coinsDetails?.scaledNumberSc.replaceAll(",", ""));
const scConverted = getScAdaEquivalent(coinsDetails, scFloat);
Expand Down
Loading