Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Feb 26, 2024
1 parent 0ac6ea1 commit f285641
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions trade.renegade.fi/app/(desktop)/[base]/[quote]/deposit-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ export default function DepositButton() {
hash: approveData?.hash,
})

const hasRpcConnectionError = !allowance
const hasRpcConnectionError = typeof allowance === "undefined"
console.log(
"🚀 ~ DepositButton ~ hasRpcConnectionError:",
hasRpcConnectionError
)
const hasInsufficientBalance = l1Balance
? l1Balance < parseUnits(baseTokenAmount, 18)
: false
console.log(
"🚀 ~ DepositButton ~ hasInsufficientBalance:",
hasInsufficientBalance
)
const needsApproval = allowance === BigInt(0) && !txIsSuccess

const isDisabled =
Expand Down Expand Up @@ -129,9 +137,9 @@ export default function DepositButton() {
isDisabled
? { backgroundColor: "transparent" }
: {
borderColor: "white.60",
color: "white",
}
borderColor: "white.60",
color: "white",
}
}
transform={baseTokenAmount ? "translateY(10px)" : "translateY(-10px)"}
visibility={baseTokenAmount ? "visible" : "hidden"}
Expand All @@ -147,12 +155,12 @@ export default function DepositButton() {
{shouldUse
? buttonText
: needsApproval
? `Approve ${baseTicker}`
: hasRpcConnectionError
? "Error connecting to sequencer"
: hasInsufficientBalance
? "Insufficient balance"
: `Deposit ${baseTokenAmount || ""} ${baseTicker}`}
? `Approve ${baseTicker}`
: hasRpcConnectionError
? "Error connecting to sequencer"
: hasInsufficientBalance
? "Insufficient balance"
: `Deposit ${baseTokenAmount || ""} ${baseTicker}`}
</Button>
{signInIsOpen && <CreateStepper onClose={onCloseSignIn} />}
</>
Expand Down

0 comments on commit f285641

Please sign in to comment.