Skip to content

Commit

Permalink
Merge pull request #340 from pendulum-chain/fix/merge-conflicts-staging
Browse files Browse the repository at this point in the history
fix swap page conflicts
  • Loading branch information
gianfra-t authored Dec 23, 2024
2 parents 0f46779 + 62410fd commit a78f472
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 8 additions & 2 deletions signer-service/src/api/middlewares/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const validateChangeOpInput = (req, res, next) => {
next();
};

const validateRequestBodyValues = () => (req, res, next) => {
const validateRequestBodyValuesForTransactionStore = () => (req, res, next) => {
const data = req.body;
const offramperAddress = data.offramperAddress;
if (!offramperAddress) {
Expand All @@ -98,6 +98,12 @@ const validateRequestBodyValues = () => (req, res, next) => {
? DUMP_SHEET_HEADER_VALUES_EVM
: DUMP_SHEET_HEADER_VALUES_ASSETHUB;

validateRequestBodyValues(requiredRequestBodyKeys)(req, res, next);
};

const validateRequestBodyValues = (requiredRequestBodyKeys) => (req, res, next) => {
const data = req.body;

if (!requiredRequestBodyKeys.every((key) => data[key])) {
const missingItems = requiredRequestBodyKeys.filter((key) => !data[key]);
const errorMessage = 'Request body data does not match schema. Missing items: ' + missingItems.join(', ');
Expand All @@ -108,7 +114,7 @@ const validateRequestBodyValues = () => (req, res, next) => {
next();
};

const validateStorageInput = validateRequestBodyValues();
const validateStorageInput = validateRequestBodyValuesForTransactionStore();
const validateEmailInput = validateRequestBodyValues(EMAIL_SHEET_HEADER_VALUES);
const validateRatingInput = validateRequestBodyValues(RATING_SHEET_HEADER_VALUES);
const validateExecuteXCM = validateRequestBodyValues(['id', 'payload']);
Expand Down
10 changes: 4 additions & 6 deletions src/pages/swap/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ArrowDownIcon } from '@heroicons/react/20/solid';
import Big from 'big.js';
import { Fragment } from 'preact';
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';

import { ApiPromise } from '@polkadot/api';

import { calculateTotalReceive, FeeCollapse } from '../../components/FeeCollapse';
Expand All @@ -18,6 +16,7 @@ import { LabeledInput } from '../../components/LabeledInput';
import { UserBalance } from '../../components/UserBalance';
import { SigningBox } from '../../components/SigningBox';
import { SignInModal } from '../../components/SignIn';
import { PoweredBy } from '../../components/PoweredBy';

import {
getInputTokenDetailsOrDefault,
Expand All @@ -39,6 +38,9 @@ import { showToast, ToastMessage } from '../../helpers/notifications';
import { useInputTokenBalance } from '../../hooks/useInputTokenBalance';
import { useTokenOutAmount } from '../../hooks/nabla/useTokenAmountOut';
import { useMainProcess } from '../../hooks/offramp/useMainProcess';
import { useTermsAndConditions } from '../../hooks/useTermsAndConditions';
import { useVortexAccount } from '../../hooks/useVortexAccount';
import { useSwapUrlParams } from './useSwapUrlParams';

import { initialChecks } from '../../services/initialChecks';

Expand All @@ -47,10 +49,6 @@ import { ProgressPage } from '../progress';
import { FailurePage } from '../failure';
import { SuccessPage } from '../success';
import { swapConfirm } from './helpers/swapConfirm';
import { useTermsAndConditions } from '../../hooks/useTermsAndConditions';
import { useVortexAccount } from '../../hooks/useVortexAccount';
import { useSwapUrlParams } from './useSwapUrlParams';
import { PoweredBy } from '../../components/PoweredBy';

const Arrow = () => (
<div className="flex justify-center w-full my-5">
Expand Down

0 comments on commit a78f472

Please sign in to comment.