Releases: Azuro-protocol/sdk
v7.3.1
v7.3.0
Requires
@azuro-org/toolkit^6.2.0 · Node>=22.12.0
Features
Authentication (SIWE) — useAuth
- New
useAuthhook authenticates users via Sign-In With Ethereum, persists the resulting JWT inlocalStorage, and keeps it in sync across browser tabs. Works with both regular and Account Abstraction (AA) wallets. - Supports
autoSignIn,onSignIn,onSignOut, andonErrorcallbacks; exposestoken,isAuthenticated,isLoading,error,signIn, andsignOut. - Added the
AuthErrorclass with typedAuthErrorCodevalues, plusauthStoragehelpers (getAuthStorageKey,StoredAuth).
User favorites
- New hooks to manage favorite countries and leagues (auth-backed):
useUserFavorites(withgetUseUserFavoritesQueryOptionshelper)useCreateUserFavoriteuseDeleteUserFavorite
Dynamic markets / new conditions
- Added
extendedflag support across conditions fetching (useConditions,useActiveConditions, …) to receive the new dynamic "5…" conditions from the API. - Bet history now supports the new conditions (
useBets,useBetsGraph,useLegacyBets). - Bumped
@azuro-org/toolkitto^6.2.0.
Note
When to enable extended
Optional, defaults to false. When true, the API additionally returns new-generation conditions and outcomes alongside the standard set. Detect a new condition by its first character: conditionId[0] === '5'.
Titles are returned directly in the response. Each condition exposes title (the market name), and each outcome exposes its own title — ConditionDetailedData.title and OutcomeData.title. The toolkit and SDK already handle grouping, sorting, and rendering of new markets out of the box.
If your app reads market/outcome metadata only from these hooks’ / utility’s response (no direct use of @azuro-org/dictionaries), enabling the flag is safe — new markets will appear automatically.
f your app reads from @azuro-org/dictionaries directly, note that new markets are not in the dictionaries package — their titles live only on the API. Use the title fields returned here.
If you only have a conditionId later (e.g. in a betslip, history, or activity feed) and need its market title, call getConditionsState — its ConditionStateData now exposes title for the condition and each outcome. The SDK’s useConditionsState wraps that endpoint.
For new bets, titles also are present in the subgraph.
Fixes
isApproveRequirednow accounts for freebets (addedisFreeBetcheck) so approval isn't requested for freebet placements.- Fixed
conditionIdshandling in the socket subscription for condition updates.
Full Changelog: v7.2.1...v7.3.0
v7.2.0
- Bump toolkit for
isTopLeaguefield in leagues; - Fix
UseNavigationQueryFnDatareturn map type; - Add
topLeagueFiltertouseSports.
Full Changelog: v7.1.1...v7.2.0
v7.1.1
- simplify
isCanceledcondition logic of bet selection inuseBetsGraphanduseBetshooks
Full Changelog: v7.1.0...v7.1.1
v7.1.0
New: Query Options Helpers
Most of data hooks now:
- export a
getUse*QueryOptionsfunction, allowing you to construct query options outside of a component — useful for prefetching, SSR, or composing with other queries. - export supporting types:
GetUse*QueryOptionsProps,Use*QueryFnData - accept
selectfield in thequeryprop for result transformation and re-render optimization.selectreceivesUse*QueryFnData, query.data type is inferred from returning data fromselect, if it exists
Supported for:
useConditionsuseGameuseGamesuseSearchGamesuseSportsuseSportsNavigationuseNavigationuseBetFeeuseBetCalculationuseBonusesuseAvailableFreebets
import { getUseSportsQueryOptions, type UseSportsQueryFnData } from '@azuro-org/sdk'
// UseSportsQueryFnData = SportData[]
const select = (data: UseSportsQueryFnData) => data[0]
const options = getUseSportsQueryOptions({
chainId,
isLive: false,
query: {
select,
staleTime: 30_000,
},
})
await queryClient.prefetchQuery(options)
// because of select, query.data type is `SportData | undefined`New: sortLeaguesAndCountriesByName in useSports
Optional boolean prop. When true (or when start times are equal), leagues and countries are sorted alphabetically by name instead of by game start time.
useSports({ sortLeaguesAndCountriesByName: true })New: hidden Field Support in Condition Watchers
useConditionState
- New prop:
isInitiallyHidden?: boolean— passcondition.hiddenfromConditionDetailedData - New return value:
isHidden— startstruefor stopped secondary conditions; resets tofalsewhen a socket update arrives (condition is still alive, only temporarily stopped by the provider)
useConditionsState
- Now accepts a
conditionsarray (Pick<ConditionDetailedData, 'conditionId' | 'state' | 'hidden'>[]) as an alternative toconditionIds+initialStates - New return value:
conditionsMap—Record<string, { state: ConditionState, hidden: boolean }> hiddenfollows the same logic: starts from initial data, clears on any socket update
// preferred for game markets list
const { data, conditionsMap } = useConditionsState({ conditions })
// still works for betslip / ID-only scenarios
const { data, conditionsMap } = useConditionsState({ conditionIds, initialStates })Extended Watcher Event Data
conditionWatcher events now include:
gameId,isLiveEnabled,isPrematchEnabled,isCashoutEnabled- Full
outcomes[]array (previously only odds were propagated)
outcomeWatcher events now include:
turnover
ConditionData type changes:
maxConditionPayout→maxConditionPotentialLossmaxOutcomePayout→maxOutcomePotentialLoss- Added
isCashoutEnabled,outcomes[].turnover
Improved: useBet
- New return value:
isWalletReadyToSubmit—truewhen the account is connected, wallet client is resolved, and the appropriate client (AA or regular) is ready UseBetPropsis now exported- Submit function now uses refs for
aaClientandwalletClient— captures the latest value at call time instead of closing over a stale reference - Explicit guards added: throws descriptive errors if account or wallet client is missing at submit time
- Chain switch for AA wallets only fires when the current chain differs from
appChain walletClientnow scoped toappChain.idviauseWalletClient({ chainId })
Fixed: useBets — Canceled Game State
isCanceled check additionally compares game state against GameState.Canceled as a double-check for edge cases.
Dependencies
@azuro-org/toolkitbumped to6.0.2
Full Changelog: v7.0.2...v7.1.0
v7.0.2
v7.0.1
v7.0.0
SDK v7.0.0:
- Major dependency update: Toolkit v6
- New
useSearchGameshook for enhanced game discovery - New
useBetCalculationhook replacesuseMaxBet - Full integration with Toolkit v6's REST API methods
- Removed deprecated
useMaxBethook - If used tanstack/query keys of sdk hooks, they are changed (primarily, because there was a graphql url in the key, now it's chain id)
useBetsis prepared to be used with REST API, that supports order history including preparing orders
Full Changelog: v6.2.3...v7.0.0
v6.2.2
Bump deps:
- @azuro-org/toolkit v5.1.8