Skip to content

Commit 90e885f

Browse files
committed
fix locked withdraw flow issues
1 parent e259992 commit 90e885f

File tree

8 files changed

+436
-180
lines changed

8 files changed

+436
-180
lines changed

src/components/pages/vaults/components/widget/shared/TransactionOverlay.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,6 @@ export const TransactionOverlay: FC<TransactionOverlayProps> = ({
393393

394394
if (wrongNetwork && txChainId) {
395395
try {
396-
console.info('[TransactionOverlay] Switching chain', {
397-
from: currentChainId,
398-
to: txChainId,
399-
step: currentStep.label
400-
})
401396
await switchChainAsync({ chainId: txChainId })
402397
} catch {
403398
console.warn('[TransactionOverlay] Chain switch rejected', { to: txChainId, step: currentStep.label })
@@ -411,11 +406,6 @@ export const TransactionOverlay: FC<TransactionOverlayProps> = ({
411406

412407
try {
413408
if (isEnsoOrder) {
414-
console.info('[TransactionOverlay] Executing Enso order', {
415-
step: currentStep.label,
416-
isCrossChain
417-
})
418-
419409
const customWriteAsync = request.writeContractAsync
420410
const result = await customWriteAsync()
421411
if (!result.hash) {

src/components/pages/vaults/components/widget/withdraw/WithdrawDetails.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FC } from 'react'
1+
import type { ReactElement } from 'react'
22
import { formatUnits } from 'viem'
33
import { formatWidgetAllowance, formatWidgetValue } from '../shared/valueDisplay'
44
import type { WithdrawRouteType } from './types'
@@ -32,10 +32,16 @@ interface WithdrawDetailsProps {
3232
allowance?: bigint
3333
allowanceTokenDecimals?: number
3434
allowanceTokenSymbol?: string
35+
approvalSpenderName?: string
3536
onAllowanceClick?: () => void
37+
onShowApprovalOverlay?: () => void
3638
}
3739

38-
export const WithdrawDetails: FC<WithdrawDetailsProps> = ({
40+
function getApprovalLabel(approvalSpenderName?: string): string {
41+
return approvalSpenderName ? `Existing Approval (${approvalSpenderName})` : 'Existing Approval'
42+
}
43+
44+
export function WithdrawDetails({
3945
actionLabel,
4046
requiredShares,
4147
sharesDecimals,
@@ -56,11 +62,12 @@ export const WithdrawDetails: FC<WithdrawDetailsProps> = ({
5662
allowance,
5763
allowanceTokenDecimals,
5864
allowanceTokenSymbol,
59-
onAllowanceClick
60-
}) => {
65+
approvalSpenderName,
66+
onAllowanceClick,
67+
onShowApprovalOverlay
68+
}: WithdrawDetailsProps): ReactElement {
6169
const allowanceDisplay = formatWidgetAllowance(allowance, allowanceTokenDecimals)
62-
63-
// Calculate price impact (withdraw amount USD vs expected output USD)
70+
const approvalLabel = getApprovalLabel(approvalSpenderName)
6471
const withdrawUsdValue = Number(formatUnits(withdrawAmountBn, assetDecimals)) * assetUsdPrice
6572
const expectedOutUsdValue = Number(formatUnits(expectedOut, outputDecimals)) * outputUsdPrice
6673
const priceImpact =
@@ -131,7 +138,17 @@ export const WithdrawDetails: FC<WithdrawDetailsProps> = ({
131138
{/* Approved allowance (for zap withdrawals) */}
132139
{allowanceDisplay && (
133140
<div className="flex items-center justify-between h-5">
134-
<p className="text-sm text-text-secondary">Existing Approval</p>
141+
{onShowApprovalOverlay ? (
142+
<button
143+
type="button"
144+
onClick={onShowApprovalOverlay}
145+
className="text-sm text-text-secondary hover:text-text-primary transition-colors yearn--link-dots"
146+
>
147+
{approvalLabel}
148+
</button>
149+
) : (
150+
<p className="text-sm text-text-secondary">{approvalLabel}</p>
151+
)}
135152
{onAllowanceClick && allowanceDisplay !== 'Unlimited' ? (
136153
<button
137154
type="button"

0 commit comments

Comments
 (0)