Sell all shares properly on bet panel UI
This commit is contained in:
parent
db14a63c08
commit
4b116a5b96
|
@ -771,7 +771,9 @@ export function SellPanel(props: {
|
|||
const betDisabled = isSubmitting || !amount || error
|
||||
|
||||
// Sell all shares if remaining shares would be < 1
|
||||
const sellQuantity = amount === Math.floor(shares) ? shares : amount
|
||||
const isSellingAllShares = amount === Math.floor(shares)
|
||||
|
||||
const sellQuantity = isSellingAllShares ? shares : amount
|
||||
|
||||
async function submitSell() {
|
||||
if (!user || !amount) return
|
||||
|
@ -780,7 +782,7 @@ export function SellPanel(props: {
|
|||
setIsSubmitting(true)
|
||||
|
||||
await sellShares({
|
||||
shares: sellQuantity,
|
||||
shares: isSellingAllShares ? undefined : amount,
|
||||
outcome: sharesOutcome,
|
||||
contractId: contract.id,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user