Repository navigation
The freebet bettor share, bet figures as recorded, and bettor summary totals
Requires @azuro-org/toolkit@^7.2.0.
What's new
-
useBetsreads a v3 bet's figures as the bets subgraph records them. The figures are already priced by the
protocol's rule, and nothing is re-priced on the client.totalOddsis the settled odds once the bet is settled, and the placed odds before that.possibleWincomes from the recorded potential payout.settledPayoutis the recorded payout. After redemption that is the amount actually paid, and for a canceled bet,
whosetotalOddsis 1, it is the stake.payout, the claimable amount, is the same figure but only while the bet is redeemable, has won or been canceled,
and was not cashed out.useRedeemBetsets it tonullin the cached list as soon as the redeem is confirmed.- A leg's won, lost and canceled flags come from its selection's result alone.
- The legs of extended conditions, whose ids start with
5or6, are named from the titles recorded with the bet
or from the API, never from@azuro-org/dictionaries.
-
A freebet's money fields are the bettor's share. For a freebet,
possibleWin,payoutandsettledPayoutgo
through the toolkit'scalcFreebetBettorShare:Freebet of 1.00 won at 1.50 payout/settledPayoutReturnable 0.50 Not returnable 1.50 Flag absent 0.50 Canceled 0 Real-money bets keep their meaning. Bets from
useLegacyBetskeep their v2 figures. -
useBetsSummaryreturns the exportedBetsSummarytype, which gains:canceledBetsCountandcashedOutBetsCount;withdrawable, which istoPayout+freebet.toPayout;- a
freebetblock:betsCount,wonBetsCount,lostBetsCount,canceledBetsCount,turnover,inBets,
toPayoutandtotalPayout. Its payouts are the bettor's share.
import { useBetsSummary } from '@azuro-org/sdk' const { data } = useBetsSummary({ account: '0x...' }) const { betsCount, toPayout, withdrawable, freebet } = data ?? {} const hasEverBet = (betsCount ?? 0) + (freebet?.betsCount ?? 0) > 0
- The top-level figures cover the wallet's own funds; freebets are counted only in
freebet. - Every figure sums all of the wallet's rows, every pool and affiliate, unless
affiliatesnarrows it. - Amounts use the decimals of the summary's chain, including after a chain switch.
-
The summary keeps up with the wallet.
- Redeem or cash-out through the SDK: the cached summary is patched at once, on the bet's own pool and affiliate
row, then re-read about 5 s and 15 s later.- A real-money redeem lowers
toPayoutby the payout, or by the stake when the bet was canceled. - A freebet redeem lowers
freebet.toPayoutby the share. - A cash-out lowers
inBetsby the stake, raisescashedOutBetsCountand leavesbetsCountas it is. - No figure goes below zero.
- A real-money redeem lowers
- New bet: the summary is re-read about 0, 4, 10 and 25 s after the receipt.
- Redeem or cash-out through the SDK: the cached summary is patched at once, on the bet's own pool and affiliate
-
useBetsSummaryBySelectionvalues a won freebet at the bettor's share and a lost freebet at 0. -
useBetsReportinherits the toolkit's report change: the freebet line is the bettor's share, with
profit = returns.
Changed meaning
- A freebet's
payoutandsettledPayoutare the bettor's share; before, they were the pool's whole payout. If
your app subtracted a returnable freebet's stake from them itself, remove that step. useBetsSummarybetsCountcounts bets placed with the wallet's own funds only. A "has this wallet ever bet"
check should testbetsCount + freebet.betsCount.totalOddscarries the subgraph's precision, up to 12 decimals. Format it for display.- Extended conditions may start with
6. SeeisExtendedConditionIdin the toolkit's
v7.2.0 release.
Note
useBetsSummary needs a bets subgraph that serves the new Bettor fields. They are served on Polygon, Base, Polygon
Amoy and Base Sepolia. On Gnosis, Chiliz, Chiliz Spicy, BSC and BSC Testnet the query fails until the subgraph there
is updated, so the hook returns an error. useBets keeps working on those chains.
Docs:
useBets
useBetsSummary
useBetsReport
Release Notes
Full Changelog: v8.1.0...v8.2.0