Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- added: New Banxa payment methods
- added: Debug settings scene (Developer Mode only) with nodes/servers inspection, engine `dataDump` viewer, and log viewer
- fixed: Swap quote timeout error interrupting user after cancelling a slow swap search
- fixed: Swap KYC terms modal stacking on auto-refresh and accidental dismissal disabling providers

## 4.45.0 (2025-03-10)

Expand Down
3 changes: 0 additions & 3 deletions src/components/modals/SwapVerifyTermsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ const SwapVerifyTermsModal: React.FC<Props> = props => {
<ModalTitle>{displayName}</ModalTitle>
</View>
}
onCancel={() => {
bridge.resolve(false)
}}
>
<Paragraph>{lstrings.swap_terms_statement}</Paragraph>
<ModalButtons
Expand Down
17 changes: 16 additions & 1 deletion src/components/scenes/SwapConfirmationScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ export const SwapConfirmationScene: React.FC<Props> = (props: Props) => {

const isFocused = useIsFocused()

const termsCheckPending = React.useRef(false)
const timerExpiredDuringTerms = React.useRef(false)

const pickBestQuoteWithPreference = (
allQuotes: EdgeSwapQuote[]
): EdgeSwapQuote => {
Expand Down Expand Up @@ -206,6 +209,10 @@ export const SwapConfirmationScene: React.FC<Props> = (props: Props) => {

const handleExchangeTimerExpired = useHandler(() => {
if (!isFocused) return
if (termsCheckPending.current) {
timerExpiredDuringTerms.current = true
return
}

navigation.replace('swapProcessing', {
swapRequest: selectedQuote.request,
Expand All @@ -227,12 +234,20 @@ export const SwapConfirmationScene: React.FC<Props> = (props: Props) => {
const swapConfig = account.swapConfig[pluginId]

dispatch(logEvent('Exchange_Shift_Quote'))
termsCheckPending.current = true
swapVerifyTerms(swapConfig)
.then(async result => {
if (!result) handleExchangeTimerExpired()
termsCheckPending.current = false
if (!result || timerExpiredDuringTerms.current) {
handleExchangeTimerExpired()
}
})
.catch((err: unknown) => {
termsCheckPending.current = false
showError(err)
if (timerExpiredDuringTerms.current) {
handleExchangeTimerExpired()
}
})
})

Expand Down
Loading