diff --git a/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx b/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx index f5ce50976..24a2b9349 100644 --- a/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx +++ b/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx @@ -8,7 +8,7 @@ import { doesValueEquateToParam, } from '@vegaprotocol/proposals'; import { useEnvironment, DocsLinks } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/utils'; +import { useValidateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams, @@ -41,6 +41,7 @@ export interface NewAssetProposalFormFields { const DOCS_LINK = '/new-asset-proposal'; export const ProposeNewAsset = () => { + const validateJson = useValidateJson(); const { params, loading: networkParamsLoading, diff --git a/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx b/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx index f659ea703..b637bb5f9 100644 --- a/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx +++ b/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx @@ -7,7 +7,7 @@ import { doesValueEquateToParam, } from '@vegaprotocol/proposals'; import { useEnvironment, DocsLinks } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/utils'; +import { useValidateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams, @@ -39,6 +39,7 @@ export interface NewMarketProposalFormFields { const DOCS_LINK = '/new-market-proposal'; export const ProposeNewMarket = () => { + const validateJson = useValidateJson(); const { params, loading: networkParamsLoading, diff --git a/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx b/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx index dbc002619..d43a27e92 100644 --- a/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx +++ b/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx @@ -14,7 +14,7 @@ import { RoundedWrapper, TextArea, } from '@vegaprotocol/ui-toolkit'; -import { validateJson } from '@vegaprotocol/utils'; +import { useValidateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams, @@ -31,6 +31,7 @@ export interface RawProposalFormFields { } export const ProposeRaw = () => { + const validateJson = useValidateJson(); const { params, loading: networkParamsLoading, diff --git a/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx b/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx index 77004c00a..b4aaa30e4 100644 --- a/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx +++ b/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx @@ -7,7 +7,7 @@ import { doesValueEquateToParam, } from '@vegaprotocol/proposals'; import { useEnvironment, DocsLinks } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/utils'; +import { useValidateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams, @@ -39,6 +39,7 @@ export interface UpdateAssetProposalFormFields { const DOCS_LINK = '/update-asset-proposal'; export const ProposeUpdateAsset = () => { + const validateJson = useValidateJson(); const { params, loading: networkParamsLoading, diff --git a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx index 867a24fac..cef4c81ac 100644 --- a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx +++ b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx @@ -8,7 +8,7 @@ import { useProposalSubmit, } from '@vegaprotocol/proposals'; import { useEnvironment, DocsLinks } from '@vegaprotocol/environment'; -import { validateJson } from '@vegaprotocol/utils'; +import { useValidateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams, @@ -53,6 +53,7 @@ export interface UpdateMarketProposalFormFields { const DOCS_LINK = '/update-market-proposal'; export const ProposeUpdateMarket = () => { + const validateJson = useValidateJson(); const { params, loading: networkParamsLoading, @@ -260,7 +261,7 @@ export const ProposeUpdateMarket = () => { {selectedMarket && ( -
+
{t('MarketName')} diff --git a/libs/accounts/src/lib/transfer-form.tsx b/libs/accounts/src/lib/transfer-form.tsx index 2eef079fd..4ceff1ab2 100644 --- a/libs/accounts/src/lib/transfer-form.tsx +++ b/libs/accounts/src/lib/transfer-form.tsx @@ -1,8 +1,8 @@ import sortBy from 'lodash/sortBy'; import { - maxSafe, - required, - vegaPublicKey, + useMaxSafe, + useRequired, + useVegaPublicKey, addDecimal, formatNumber, addDecimalsFormatNumber, @@ -67,6 +67,9 @@ export const TransferForm = ({ minQuantumMultiple, }: TransferFormProps) => { const t = useT(); + const maxSafe = useMaxSafe(); + const required = useRequired(); + const vegaPublicKey = useVegaPublicKey(); const { control, register, @@ -415,7 +418,7 @@ export const TransferForm = ({ {accountBalance && ( diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx index 19fc6b265..05c532c2a 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx @@ -1,7 +1,7 @@ import { Controller, type Control } from 'react-hook-form'; import type { Market } from '@vegaprotocol/markets'; import type { OrderFormValues } from '../../hooks/use-form-values'; -import { toDecimal, validateAmount } from '@vegaprotocol/utils'; +import { toDecimal, useValidateAmount } from '@vegaprotocol/utils'; import { TradingFormGroup, TradingInput, @@ -28,6 +28,7 @@ export const DealTicketSizeIceberg = ({ peakSize, }: DealTicketSizeIcebergProps) => { const t = useT(); + const validateAmount = useValidateAmount(); const sizeStep = toDecimal(market?.positionDecimalPlaces); const renderPeakSizeError = () => { diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-stop-order.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-stop-order.tsx index 769eb2462..b92e8f65d 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-stop-order.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-stop-order.tsx @@ -9,7 +9,7 @@ import { formatValue, removeDecimal, toDecimal, - validateAmount, + useValidateAmount, } from '@vegaprotocol/utils'; import { type Control, type UseFormWatch } from 'react-hook-form'; import { useForm, Controller, useController } from 'react-hook-form'; @@ -109,6 +109,7 @@ const Trigger = ({ decimalPlaces: number; }) => { const t = useT(); + const validateAmount = useValidateAmount(); const triggerType = watch(oco ? 'ocoTriggerType' : 'triggerType'); const triggerDirection = watch('triggerDirection'); const isPriceTrigger = triggerType === 'price'; @@ -341,6 +342,7 @@ const Size = ({ assetUnit?: string; }) => { const t = useT(); + const validateAmount = useValidateAmount(); return ( { const t = useT(); + const validateAmount = useValidateAmount(); if (watch(oco ? 'ocoType' : 'type') === Schema.OrderType.TYPE_MARKET) { return null; } diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx index 2aa4cbabf..207a3eb34 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -28,7 +28,7 @@ import { useOpenVolume } from '@vegaprotocol/positions'; import { toBigNum, removeDecimal, - validateAmount, + useValidateAmount, toDecimal, formatForInput, formatValue, @@ -140,6 +140,7 @@ export const DealTicket = ({ onDeposit, }: DealTicketProps) => { const t = useT(); + const validateAmount = useValidateAmount(); const { pubKey, isReadOnly } = useVegaWallet(); const setType = useDealTicketFormValues((state) => state.setType); const storedFormValues = useDealTicketFormValues( diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx index 43b5c6a29..7b9b4e9a1 100644 --- a/libs/deposits/src/lib/deposit-form.tsx +++ b/libs/deposits/src/lib/deposit-form.tsx @@ -1,11 +1,11 @@ import type { Asset, AssetFieldsFragment } from '@vegaprotocol/assets'; import { AssetOption } from '@vegaprotocol/assets'; import { - ethereumAddress, - required, - vegaPublicKey, - minSafe, - maxSafe, + useEthereumAddress, + useRequired, + useVegaPublicKey, + useMinSafe, + useMaxSafe, addDecimal, isAssetTypeERC20, formatNumber, @@ -85,6 +85,11 @@ export const DepositForm = ({ isFaucetable, }: DepositFormProps) => { const t = useT(); + const ethereumAddress = useEthereumAddress(); + const required = useRequired(); + const vegaPublicKey = useVegaPublicKey(); + const minSafe = useMinSafe(); + const maxSafe = useMaxSafe(); const { open: openAssetDetailsDialog } = useAssetDetailsDialogStore(); const openDialog = useWeb3ConnectStore((store) => store.open); const { isActive, account } = useWeb3React(); @@ -459,7 +464,7 @@ const UseButton = (props: UseButtonProps) => {