Skip to content

Releases: Azuro-protocol/sdk

v7.5.0

Choose a tag to compare

@on47sky on47sky released this 09 Jul 09:13

Real-time per-outcome state hooks

Requires @azuro-org/toolkit@^6.4.0.

What's new

  • New watch hooks (outcome-level analogs of useConditionState / useConditionsState):
    • useOutcomeState — track a single outcome's live state / hidden over the socket. Returns state
      plus isLocked (true when not Active), isHidden, and live odds / turnover.
    • useOutcomesState — track many outcomes at once; pass full outcome objects or selections only. Returns
      data (a { conditionId-outcomeId: OutcomeState } map) and outcomesMap (odds / turnover / state /
      hidden per outcome).
    • Both require FeedSocketProvider + ConditionUpdatesProvider (already included in AzuroSDKProvider).
  • Betslip tracks outcome stateuseDetailedBetslip now also returns outcomeStates and
    isOutcomeStatesFetching, and blocks a bet when a selected outcome is hidden or not Active
    (reported via the existing BetslipDisableReason.ConditionState).
  • ConditionUpdatesProvider — per-outcome state / hidden are now carried through condition updates;
    exports the OutcomeUpdateData and ConditionUpdatedData types.

Fixes

  • useConditionsState now resets its state when the tracked conditions are cleared to empty.

Docs:
useOutcomeState
useOutcomesState
betslip provider

Full Changelog: v7.4.1...v7.5.0

v7.4.1

Choose a tag to compare

@on47sky on47sky released this 09 Jul 09:11

Fixes

  • Fixes signing with account-abstraction wallets: pass the full account entity (not just the address) to signTypedData for the AA wallet client in useCashout and useBet (single + combo).

Full Changelog: v7.4.0...v7.4.1

v7.4.0

Choose a tag to compare

@on47sky on47sky released this 09 Jul 09:11

Predefined combos, betslip addItems, per-chain AA wallet
Requires @azuro-org/toolkit@^6.3.0.

What's new

  • usePredefinedCombo hook — wraps the toolkit's getPredefinedCombo, reading the chain from the SDK
    chain context by default. Also exports getUsePredefinedComboQueryOptions (prefetch / SSR) and the
    UsePredefinedComboProps / UsePredefinedCombo / GetUsePredefinedComboQueryOptionsProps /
    UsePredefinedComboQueryFnData types.
  • Betslip addItems(items, replace?) — batch-add selections to the betslip. With replace: true, an
    added item swaps the existing selection for the same game.

Fixes

  • AA (social-login) wallet resolved per chain — the write flows useBet, useCashout, useRedeemBet,
    useWrapTokens and useAuth now resolve the smart-account wallet client for the required chain via
    getClientForChain({ id: appChain.id }), instead of the single ambient client bound to Privy's currently
    selected chain. This removes a class of "signed/sent against the wrong chain" bugs. Internal to the SDK —
    no app changes required.

Note

Apps that drive the AA wallet directly (e.g. withdrawals) should migrate from the deprecated
useAAWalletClient (singular, ambient) to useAAWalletClients().getClientForChain({ id }) from
@azuro-org/sdk-social-aa-connector. See the Social Login guide.

Also: dependency bumps.

Docs:
usePredefinedCombo
betslip provider

Full changelog: v7.3.1...v7.4.0

v7.3.1

Choose a tag to compare

@on47sky on47sky released this 30 May 20:31

Fixes

  • Added the missing extended flag to useActiveMarkets and useResolvedMarkets, so the new dynamic ("5…") conditions can be requested through these hooks as well (it was already supported on the lower-level conditions hooks in 7.3.0).

v7.3.0

Choose a tag to compare

@on47sky on47sky released this 30 May 20:30

Requires @azuro-org/toolkit ^6.2.0 · Node >=22.12.0

Features

Authentication (SIWE) — useAuth

  • New useAuth hook authenticates users via Sign-In With Ethereum, persists the resulting JWT in localStorage, and keeps it in sync across browser tabs. Works with both regular and Account Abstraction (AA) wallets.
  • Supports autoSignIn, onSignIn, onSignOut, and onError callbacks; exposes token, isAuthenticated, isLoading, error, signIn, and signOut.
  • Added the AuthError class with typed AuthErrorCode values, plus authStorage helpers (getAuthStorageKey, StoredAuth).

User favorites

  • New hooks to manage favorite countries and leagues (auth-backed):
    • useUserFavorites (with getUseUserFavoritesQueryOptions helper)
    • useCreateUserFavorite
    • useDeleteUserFavorite

Dynamic markets / new conditions

  • Added extended flag 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/toolkit to ^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

  • isApproveRequired now accounts for freebets (added isFreeBet check) so approval isn't requested for freebet placements.
  • Fixed conditionIds handling in the socket subscription for condition updates.

Full Changelog: v7.2.1...v7.3.0

v7.2.0

Choose a tag to compare

@on47sky on47sky released this 23 Apr 10:34
  • Bump toolkit for isTopLeague field in leagues;
  • Fix UseNavigationQueryFnData return map type;
  • Add topLeagueFilter to useSports.

Full Changelog: v7.1.1...v7.2.0

v7.1.1

Choose a tag to compare

@on47sky on47sky released this 01 Apr 07:22
  • simplify isCanceled condition logic of bet selection in useBetsGraph and useBets hooks

Full Changelog: v7.1.0...v7.1.1

v7.1.0

Choose a tag to compare

@on47sky on47sky released this 31 Mar 11:39

New: Query Options Helpers

Most of data hooks now:

  • export a getUse*QueryOptions function, 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 select field in the query prop for result transformation and re-render optimization. select receives Use*QueryFnData, query.data type is inferred from returning data from select, if it exists

Supported for:

  • useConditions
  • useGame
  • useGames
  • useSearchGames
  • useSports
  • useSportsNavigation
  • useNavigation
  • useBetFee
  • useBetCalculation
  • useBonuses
  • useAvailableFreebets
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 — pass condition.hidden from ConditionDetailedData
  • New return value: isHidden — starts true for stopped secondary conditions; resets to false when a socket update arrives (condition is still alive, only temporarily stopped by the provider)

useConditionsState

  • Now accepts a conditions array (Pick<ConditionDetailedData, 'conditionId' | 'state' | 'hidden'>[]) as an alternative to conditionIds + initialStates
  • New return value: conditionsMapRecord<string, { state: ConditionState, hidden: boolean }>
  • hidden follows 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:

  • maxConditionPayoutmaxConditionPotentialLoss
  • maxOutcomePayoutmaxOutcomePotentialLoss
  • Added isCashoutEnabled, outcomes[].turnover

Improved: useBet

  • New return value: isWalletReadyToSubmittrue when the account is connected, wallet client is resolved, and the appropriate client (AA or regular) is ready
  • UseBetProps is now exported
  • Submit function now uses refs for aaClient and walletClient — 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
  • walletClient now scoped to appChain.id via useWalletClient({ 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/toolkit bumped to 6.0.2

Full Changelog: v7.0.2...v7.1.0

v7.0.2

Choose a tag to compare

@on47sky on47sky released this 17 Mar 10:10

fix useSports hook:

  • filter.maxGamesPerLeague: set default games per league limit to 1000 (as it was in previous graphql version)

v7.0.1

Choose a tag to compare

@on47sky on47sky released this 17 Mar 10:09

fix useSports:

  • correctly pass "games per league" limit to API
  • add new prop filter.maxGamesPerLeague, deprecate old filter.limit as it ambiguous