Skip to content

Commit

Permalink
Prevent form crash when tx is not ready
Browse files Browse the repository at this point in the history
Show native form hint
  • Loading branch information
everdimension committed Dec 28, 2024
1 parent fe73f89 commit dd5da79
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ui/pages/SwapForm/SwapForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import { getGas } from 'src/modules/ethereum/transactions/getGas';
import { uiGetBestKnownTransactionCount } from 'src/modules/ethereum/transactions/getBestKnownTransactionCount/uiGetBestKnownTransactionCount';
import type { ZerionApiClient } from 'src/modules/zerion-api/zerion-api-bare';
import { useGasbackEstimation } from 'src/modules/ethereum/account-abstraction/rewards';
import { HiddenValidationInput } from 'src/ui/shared/forms/HiddenValidationInput';
import {
DEFAULT_CONFIGURATION,
applyConfiguration,
Expand Down Expand Up @@ -832,6 +833,16 @@ export function SwapFormComponent() {
</VStack>
{quote ? <ProtocolFeeLine quote={quote} /> : null}
</VStack>
<div style={{ position: 'relative', width: '100%', textAlign: 'center' }}>
<HiddenValidationInput
form={formId}
customValidity={
currentTransaction
? ''
: 'Form is not ready. Please check your network, gas token amount and input values'
}
/>
</div>
<VStack gap={16} style={{ marginTop: 'auto' }}>
<AnimatedAppear display={showApproveHintLine}>
<HStack gap={12} alignItems="center">
Expand Down

0 comments on commit dd5da79

Please sign in to comment.