Skip to content

Commit

Permalink
fix: max selection on limit input for sell
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Dec 28, 2024
1 parent 3ec3ef4 commit b15ad6c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/web/components/place-limit-tool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(

if (tab === "sell") {
// When selling we want to use the base token balance
const amount = swapState.marketState.inAmountInput.maxAmountWithGas
?.toDec()
.toString();
const amount =
type === "market"
? swapState.marketState.inAmountInput.maxAmountWithGas
?.toDec()
.toString()
: swapState.marketState.inAmountInput.balance?.toDec().toString();
if (!amount) {
return;
}
Expand All @@ -267,7 +270,9 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
tab,
setAmountSafe,
swapState.marketState.inAmountInput.maxAmountWithGas,
swapState.marketState.inAmountInput.balance,
swapState.quoteTokenBalance,
type,
]);

// Determines the input value based on the current
Expand Down

0 comments on commit b15ad6c

Please sign in to comment.