diff --git a/signer-service/src/api/middlewares/validators.js b/signer-service/src/api/middlewares/validators.js index 3199ffb4..51d876a7 100644 --- a/signer-service/src/api/middlewares/validators.js +++ b/signer-service/src/api/middlewares/validators.js @@ -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) { @@ -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(', '); @@ -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']); diff --git a/src/pages/swap/index.tsx b/src/pages/swap/index.tsx index 836992ee..1e5a1983 100644 --- a/src/pages/swap/index.tsx +++ b/src/pages/swap/index.tsx @@ -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'; @@ -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, @@ -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'; @@ -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 = () => (