Skip to content

Commit 50009aa

Browse files
committed
Always reset confirmation slider after onConfirm settles
Move reset() from the catch block into finally so the SafeSlider returns to its idle state on both success and error paths. Previously a successful transfer with no deposit instructions left the slider spinning indefinitely.
1 parent 57ae840 commit 50009aa

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased (develop)
44

5+
- fixed: Infinite buy transfer payload and confirmation error handling
6+
57
## 4.46.0 (staging)
68

79
- added: Xgram swap exchange plugin support

src/components/scenes/RampConfirmationScene.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export const RampConfirmationScene: React.FC<Props> = props => {
4848
setIsConfirming(true)
4949
try {
5050
await onConfirm()
51-
} catch (err) {
51+
} catch (err: unknown) {
5252
setError(err)
53-
reset() // Reset the slider on error
5453
} finally {
54+
reset()
5555
setIsConfirming(false)
5656
}
5757
})

src/plugins/ramps/infinite/workflows/confirmationWorkflow.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,25 @@ export const confirmationWorkflow = async (
8181
const transfer = await infiniteApi.createTransfer(transferParams)
8282

8383
const instructions = transfer.sourceDepositInstructions
84-
if (instructions?.bankName != null && instructions.amount != null) {
85-
navigationFlow.navigate('rampBankRoutingDetails', {
86-
bank: {
87-
name: instructions.bankName,
88-
accountNumber: instructions.bankAccountNumber ?? '',
89-
routingNumber: instructions.bankRoutingNumber ?? ''
90-
},
91-
fiatCurrencyCode: cleanFiatCode,
92-
fiatAmount: instructions.amount.toString(),
93-
onDone: () => {
94-
navigationFlow.goBack()
95-
}
96-
})
84+
if (instructions?.bankName == null || instructions.amount == null) {
85+
throw new Error(
86+
`Transfer ${transfer.id} created but deposit instructions are missing`
87+
)
9788
}
9889

90+
navigationFlow.navigate('rampBankRoutingDetails', {
91+
bank: {
92+
name: instructions.bankName,
93+
accountNumber: instructions.bankAccountNumber ?? '',
94+
routingNumber: instructions.bankRoutingNumber ?? ''
95+
},
96+
fiatCurrencyCode: cleanFiatCode,
97+
fiatAmount: instructions.amount.toString(),
98+
onDone: () => {
99+
navigationFlow.goBack()
100+
}
101+
})
102+
99103
resolve({ confirmed: true, transfer })
100104
return
101105
}

0 commit comments

Comments
 (0)