Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Oct 9, 2024
1 parent dae2fec commit d074714
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions components/dialogs/transfer/weth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function WETHForm({
const { data: maintenanceMode } = useMaintenanceMode()
const [steps, setSteps] = React.useState<string[]>([])
const [currentStep, setCurrentStep] = React.useState(0)
const [shouldUnwrap, setShouldUnwrap] = React.useState(false)
const [unwrapRequired, setUnwrapRequired] = React.useState(false)

const mint = useWatch({
control: form.control,
Expand Down Expand Up @@ -282,7 +282,7 @@ export function WETHForm({
})
const { status: withdrawTaskStatus, setTaskId: setWithdrawTaskId } =
useWaitForTask(() => {
if (shouldUnwrap) {
if (unwrapRequired) {
setCurrentStep((prev) => prev + 1)
unwrapEth({
address: baseToken.address,
Expand Down Expand Up @@ -413,7 +413,7 @@ export function WETHForm({
setSteps(() => {
const steps = []
steps.push("Withdraw")
if (shouldUnwrap) {
if (unwrapRequired) {
steps.push("Unwrap ETH")
}
return steps
Expand Down Expand Up @@ -507,7 +507,7 @@ export function WETHForm({
depositTaskStatus === "Completed"
) {
Icon = <Check className="h-6 w-6" />
} else if (shouldUnwrap && unwrapConfirmationStatus === "success") {
} else if (unwrapRequired && unwrapConfirmationStatus === "success") {
Icon = <Check className="h-6 w-6" />
} else if (
direction === ExternalTransferDirection.Withdraw &&
Expand All @@ -532,7 +532,7 @@ export function WETHForm({
depositTaskStatus === "Completed"
) {
title = "Completed"
} else if (shouldUnwrap) {
} else if (unwrapRequired) {
if (unwrapConfirmationStatus === "success") {
title = "Completed"
}
Expand Down Expand Up @@ -742,7 +742,6 @@ export function WETHForm({
: `${formattedEthBalance} ETH`}
</ResponsiveTooltipContent>
</ResponsiveTooltip>
{/* <span className="font-mono text-sm">&nbsp;</span> */}
</div>
</div>
<div
Expand All @@ -765,11 +764,11 @@ export function WETHForm({
</div>
</div>
<Switch
checked={shouldUnwrap}
checked={unwrapRequired}
id="unwrap"
onCheckedChange={(checked) => {
if (typeof checked === "boolean") {
setShouldUnwrap(checked)
setUnwrapRequired(checked)
}
}}
/>
Expand Down

0 comments on commit d074714

Please sign in to comment.