fix the transaction deadline errors
This commit is contained in:
parent
27094c87f2
commit
8bea95fab2
@ -94,6 +94,8 @@ const MenuFlyout = styled.span`
|
||||
${({ theme }) => theme.mediaWidth.upToMedium`
|
||||
min-width: 18.125rem;
|
||||
`};
|
||||
|
||||
user-select: none;
|
||||
`
|
||||
|
||||
const Break = styled.div`
|
||||
|
@ -136,11 +136,16 @@ export default function TransactionSettings({ placeholderSlippage }: Transaction
|
||||
if (value.length === 0) {
|
||||
setDeadline(DEFAULT_DEADLINE_FROM_NOW)
|
||||
} else {
|
||||
const parsed: number = Math.floor(Number.parseFloat(value) * 60)
|
||||
if (!Number.isInteger(parsed) || parsed < 60) {
|
||||
try {
|
||||
const parsed: number = Math.floor(Number.parseFloat(value) * 60)
|
||||
if (!Number.isInteger(parsed) || parsed < 60 || parsed > 180 * 60) {
|
||||
setDeadlineError(DeadlineError.InvalidInput)
|
||||
} else {
|
||||
setDeadline(parsed)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
setDeadlineError(DeadlineError.InvalidInput)
|
||||
} else {
|
||||
setDeadline(parsed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,12 @@ export default createReducer(initialState, (builder) =>
|
||||
|
||||
// deadline isnt being tracked in local storage, reset to default
|
||||
// noinspection SuspiciousTypeOfGuard
|
||||
if (typeof state.userDeadline !== 'number' || !Number.isInteger(state.userDeadline) || state.userDeadline < 60) {
|
||||
if (
|
||||
typeof state.userDeadline !== 'number' ||
|
||||
!Number.isInteger(state.userDeadline) ||
|
||||
state.userDeadline < 60 ||
|
||||
state.userDeadline > 180 * 60
|
||||
) {
|
||||
state.userDeadline = DEFAULT_DEADLINE_FROM_NOW
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user