"limit bet" => "limit order"
This commit is contained in:
parent
5fd42df1ed
commit
24896e44b4
|
@ -21,7 +21,7 @@ export const cancelbet = newEndpoint({}, async (req, auth) => {
|
||||||
if (bet.userId !== auth.uid)
|
if (bet.userId !== auth.uid)
|
||||||
throw new APIError(400, 'Not authorized to cancel bet.')
|
throw new APIError(400, 'Not authorized to cancel bet.')
|
||||||
if (bet.limitProb === undefined)
|
if (bet.limitProb === undefined)
|
||||||
throw new APIError(400, 'Not a limit bet: Cannot cancel.')
|
throw new APIError(400, 'Not a limit order: Cannot cancel.')
|
||||||
if (bet.isCancelled) throw new APIError(400, 'Bet already cancelled.')
|
if (bet.isCancelled) throw new APIError(400, 'Bet already cancelled.')
|
||||||
|
|
||||||
trans.update(betDoc.ref, { isCancelled: true })
|
trans.update(betDoc.ref, { isCancelled: true })
|
||||||
|
|
|
@ -186,7 +186,7 @@ export const updateMakers = (
|
||||||
const totalAmount = sumBy(fills, 'amount')
|
const totalAmount = sumBy(fills, 'amount')
|
||||||
const isFilled = floatingEqual(totalAmount, bet.orderAmount)
|
const isFilled = floatingEqual(totalAmount, bet.orderAmount)
|
||||||
|
|
||||||
log('Updated a matched limit bet.')
|
log('Updated a matched limit order.')
|
||||||
trans.update(contractDoc.collection('bets').doc(bet.id), {
|
trans.update(contractDoc.collection('bets').doc(bet.id), {
|
||||||
fills,
|
fills,
|
||||||
isFilled,
|
isFilled,
|
||||||
|
|
|
@ -71,7 +71,7 @@ export function BetPanel(props: {
|
||||||
>
|
>
|
||||||
<Row className="align-center justify-between">
|
<Row className="align-center justify-between">
|
||||||
<div className="mb-6 text-2xl">
|
<div className="mb-6 text-2xl">
|
||||||
{isLimitOrder ? <>Limit bet</> : <>Place your bet</>}
|
{isLimitOrder ? <>Limit order</> : <>Place your bet</>}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className="btn btn-ghost btn-sm text-sm normal-case"
|
className="btn btn-ghost btn-sm text-sm normal-case"
|
||||||
|
@ -120,7 +120,7 @@ export function SimpleBetPanel(props: {
|
||||||
<Col className={clsx('rounded-b-md rounded-t-md bg-white px-8 py-6')}>
|
<Col className={clsx('rounded-b-md rounded-t-md bg-white px-8 py-6')}>
|
||||||
<Row className="justify-between">
|
<Row className="justify-between">
|
||||||
<div className="mb-6 text-2xl">
|
<div className="mb-6 text-2xl">
|
||||||
{isLimitOrder ? <>Limit bet</> : <>Place your bet</>}
|
{isLimitOrder ? <>Limit order</> : <>Place your bet</>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
@ -385,7 +385,9 @@ function BuyPanel(props: {
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{wasSubmitted && <div className="mt-4">Bet submitted!</div>}
|
{wasSubmitted && (
|
||||||
|
<div className="mt-4">{isLimitOrder ? 'Order' : 'Bet'} submitted!</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ export function BetsList(props: {
|
||||||
onChange={(e) => setFilter(e.target.value as BetFilter)}
|
onChange={(e) => setFilter(e.target.value as BetFilter)}
|
||||||
>
|
>
|
||||||
<option value="open">Open</option>
|
<option value="open">Open</option>
|
||||||
<option value="limit_bet">Limit bets</option>
|
<option value="limit_bet">Limit orders</option>
|
||||||
<option value="sold">Sold</option>
|
<option value="sold">Sold</option>
|
||||||
<option value="closed">Closed</option>
|
<option value="closed">Closed</option>
|
||||||
<option value="resolved">Resolved</option>
|
<option value="resolved">Resolved</option>
|
||||||
|
@ -364,7 +364,7 @@ function ContractBets(props: {
|
||||||
|
|
||||||
{contract.mechanism === 'cpmm-1' && limitBets.length > 0 && (
|
{contract.mechanism === 'cpmm-1' && limitBets.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<div className="bg-gray-50 px-4 py-2">Your limit bets</div>
|
<div className="bg-gray-50 px-4 py-2">Your limit orders</div>
|
||||||
<LimitBets
|
<LimitBets
|
||||||
className="max-w-md px-2 py-0 sm:px-4"
|
className="max-w-md px-2 py-0 sm:px-4"
|
||||||
contract={contract}
|
contract={contract}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export function LimitBets(props: {
|
||||||
'gap-2 overflow-hidden rounded bg-white px-4 py-3'
|
'gap-2 overflow-hidden rounded bg-white px-4 py-3'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!hideLabel && <div className="px-2 py-3 text-2xl">Your limit bets</div>}
|
{!hideLabel && <div className="px-2 py-3 text-2xl">Your limit orders</div>}
|
||||||
<table className="table-compact table w-full rounded text-gray-500">
|
<table className="table-compact table w-full rounded text-gray-500">
|
||||||
<tbody>
|
<tbody>
|
||||||
{recentBets.map((bet) => (
|
{recentBets.map((bet) => (
|
||||||
|
|
|
@ -817,7 +817,7 @@ function NotificationTextLabel(props: {
|
||||||
<span className="text-primary">
|
<span className="text-primary">
|
||||||
{formatMoney(parseInt(sourceText))}
|
{formatMoney(parseInt(sourceText))}
|
||||||
</span>{' '}
|
</span>{' '}
|
||||||
<span>of your limit bet was filled</span>
|
<span>of your limit order was filled</span>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user