@azuro-org/toolkit 5.2.0-beta.1 → 6.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +6 -4
  2. package/dist/docs/bets/fragments/legacyLiveBet.d.ts +1 -0
  3. package/dist/docs/bets/fragments/legacyPrematchBet.d.ts +1 -0
  4. package/dist/docs/bets/legacyBets.d.ts +2 -0
  5. package/dist/docs/index.d.ts +0 -13
  6. package/dist/global.d.ts +33 -3
  7. package/dist/helpers/normalizeTimestampToMs.d.ts +9 -0
  8. package/dist/helpers/serializeApiParams.d.ts +4 -0
  9. package/dist/index.d.ts +27 -18
  10. package/dist/index.js +942 -605
  11. package/dist/index.js.map +1 -1
  12. package/dist/utils/bet/createBet.d.ts +39 -0
  13. package/dist/utils/bet/createComboBet.d.ts +44 -0
  14. package/dist/utils/bet/getBet.d.ts +28 -0
  15. package/dist/utils/{getBetCalculation.d.ts → bet/getBetCalculation.d.ts} +10 -15
  16. package/dist/utils/bet/getBetFee.d.ts +32 -0
  17. package/dist/utils/bet/getBetStatus.d.ts +43 -0
  18. package/dist/utils/bet/getBetTypedData.d.ts +38 -0
  19. package/dist/utils/bet/getBetsByBettor.d.ts +44 -0
  20. package/dist/utils/bet/getComboBetTypedData.d.ts +42 -0
  21. package/dist/utils/bet/types.d.ts +128 -0
  22. package/dist/utils/bonus/getAvailableFreebets.d.ts +26 -3
  23. package/dist/utils/bonus/getBonuses.d.ts +23 -3
  24. package/dist/utils/calcMinOdds.d.ts +20 -0
  25. package/dist/utils/cashout/createCashout.d.ts +26 -3
  26. package/dist/utils/cashout/getCalculatedCashout.d.ts +29 -4
  27. package/dist/utils/cashout/getCashout.d.ts +22 -3
  28. package/dist/utils/cashout/getCashoutTypedData.d.ts +30 -3
  29. package/dist/utils/cashout/getPrecalculatedCashouts.d.ts +31 -3
  30. package/dist/utils/feed/getConditionsByGameIds.d.ts +52 -0
  31. package/dist/utils/feed/getConditionsState.d.ts +34 -0
  32. package/dist/utils/feed/getGamesByFilters.d.ts +35 -0
  33. package/dist/utils/feed/getGamesByIds.d.ts +26 -0
  34. package/dist/utils/feed/getNavigation.d.ts +58 -0
  35. package/dist/utils/feed/getSports.d.ts +57 -0
  36. package/dist/utils/feed/searchGames.d.ts +29 -0
  37. package/dist/utils/feed/types.d.ts +46 -0
  38. package/dist/utils/getEndpoints.d.ts +1 -0
  39. package/dist/utils/getIsPendingResolution.d.ts +17 -4
  40. package/dist/utils/getProviderFromId.d.ts +12 -0
  41. package/dist/utils/groupConditionsByMarket.d.ts +22 -4
  42. package/package.json +1 -1
  43. package/dist/docs/bets/bets.d.ts +0 -67
  44. package/dist/docs/bets/fragments/bet.d.ts +0 -57
  45. package/dist/utils/calcMindOdds.d.ts +0 -6
  46. package/dist/utils/createBet.d.ts +0 -17
  47. package/dist/utils/createComboBet.d.ts +0 -17
  48. package/dist/utils/getBet.d.ts +0 -23
  49. package/dist/utils/getBetFee.d.ts +0 -14
  50. package/dist/utils/getBetStatus.d.ts +0 -19
  51. package/dist/utils/getBetTypedData.d.ts +0 -16
  52. package/dist/utils/getBetsHistory.d.ts +0 -71
  53. package/dist/utils/getComboBetTypedData.d.ts +0 -16
  54. package/dist/utils/getMaxBet.d.ts +0 -18
package/README.md CHANGED
@@ -12,10 +12,12 @@ npm i --save @azuro-org/toolkit
12
12
  #### Peer Dependencies
13
13
 
14
14
  ```
15
- @azuro-org/dictionaries@^3.0.27
15
+ @azuro-org/dictionaries@^3.0.28
16
16
  graphql-tag@^2.12.6
17
- @wagmi/core@^2.17.2
18
- viem@^2.30.4
17
+ @wagmi/core@^2.20.3
18
+ viem@^2.37.4
19
19
  ```
20
20
 
21
- Package information can be found in our [Doc](https://gem.azuro.org/hub/apps/toolkit/overview)
21
+ ## Documentation
22
+
23
+ Package documentation can be found in our [Doc](https://gem.azuro.org/hub/apps/toolkit/overview)
@@ -19,6 +19,7 @@ export type LegacyLiveBetFragment = {
19
19
  createdAt: string;
20
20
  resolvedAt?: string | null;
21
21
  txHash: string;
22
+ redeemedAt?: string | null;
22
23
  core: {
23
24
  __typename?: 'CoreContract';
24
25
  address: string;
@@ -19,6 +19,7 @@ export type LegacyPrematchBetFragment = {
19
19
  createdAt: string;
20
20
  resolvedAt?: string | null;
21
21
  txHash: string;
22
+ redeemedAt?: string | null;
22
23
  core: {
23
24
  __typename?: 'CoreContract';
24
25
  address: string;
@@ -28,6 +28,7 @@ export type LegacyBetsQuery = {
28
28
  createdAt: string;
29
29
  resolvedAt?: string | null;
30
30
  txHash: string;
31
+ redeemedAt?: string | null;
31
32
  core: {
32
33
  __typename?: 'CoreContract';
33
34
  address: string;
@@ -120,6 +121,7 @@ export type LegacyBetsQuery = {
120
121
  createdAt: string;
121
122
  resolvedAt?: string | null;
122
123
  txHash: string;
124
+ redeemedAt?: string | null;
123
125
  core: {
124
126
  __typename?: 'CoreContract';
125
127
  address: string;
@@ -1,21 +1,8 @@
1
1
  export * from './bets/fragments/bettor';
2
2
  export * from './bets/fragments/legacyLiveBet';
3
3
  export * from './bets/fragments/legacyPrematchBet';
4
- export * from './bets/fragments/bet';
5
4
  export * from './bets/bettors';
6
5
  export * from './bets/legacyBets';
7
6
  export * from './bets/gameBets';
8
- export * from './bets/bets';
9
- export * from './feed/fragments/condition';
10
- export * from './feed/fragments/gameInfo';
11
- export * from './feed/condition';
12
- export * from './feed/conditions';
13
- export * from './feed/conditionsBatch';
14
- export * from './feed/game';
15
- export * from './feed/games';
16
- export * from './feed/navigation';
17
- export * from './feed/sports';
18
- export * from './feed/sportsNavigation';
19
7
  export * from './legacy-live-feed/games';
20
8
  export { BetResult, Bet_OrderBy as Legacy_Bet_OrderBy, GameStatus as LegacyGameStatus, SelectionResult, BetStatus as GraphBetStatus, V3_Bet_OrderBy as Bet_OrderBy, ConditionStatus as BetConditionStatus, V3_SelectionConditionKind as SelectionKind, } from './bets/types';
21
- export * from './feed/types';
package/dist/global.d.ts CHANGED
@@ -30,17 +30,47 @@ export type Selection = {
30
30
  conditionId: string;
31
31
  };
32
32
  export type WaveId = number | 'active';
33
- export declare enum BetState {
33
+ /** a string in format `YYYY-MM-DDTHH:mm:ss.sssZ` */
34
+ export type ISOTimestamp = string;
35
+ export declare enum BetOrderState {
34
36
  Created = "Created",
35
- Pending = "Pending",
37
+ Placed = "Placed",
36
38
  Sent = "Sent",
39
+ Pending = "Pending",
37
40
  Accepted = "Accepted",
38
41
  Rejected = "Rejected",
42
+ PendingCancel = "PendingCancel",
43
+ Canceled = "Canceled",
44
+ CancelFailed = "CancelFailed",
45
+ Settled = "Settled"
46
+ }
47
+ export declare enum BetOrderResult {
48
+ Won = "Won",
49
+ Lost = "Lost",
50
+ Canceled = "Canceled"
51
+ }
52
+ export declare enum GameState {
53
+ Finished = "Finished",
54
+ Live = "Live",
55
+ Prematch = "Prematch",
56
+ Stopped = "Stopped",
39
57
  Canceled = "Canceled"
40
58
  }
59
+ export declare enum ConditionState {
60
+ Active = "Active",
61
+ Canceled = "Canceled",
62
+ Removed = "Removed",
63
+ Resolved = "Resolved",
64
+ Stopped = "Stopped"
65
+ }
66
+ /** Defines the order direction, either ascending or descending */
67
+ export declare enum OrderDirection {
68
+ Asc = "asc",
69
+ Desc = "desc"
70
+ }
41
71
  export type CreateBetResponse = {
42
72
  id: string;
43
- state: BetState;
73
+ state: BetOrderState;
44
74
  errorMessage?: string;
45
75
  error?: string;
46
76
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Normalize events timestamp (ISO String, unix time in seconds or ms) to milliseconds.
3
+ *
4
+ * As a reasonable threshold for whether to count the number in seconds or milliseconds,
5
+ * it takes the value 32_503_680_000 (which equals January 12, 1971 in ms and Jan 01, 3000 in seconds).
6
+ *
7
+ * So it isn't applicable to dates before January 12, 1971.
8
+ * */
9
+ export declare const normalizeTimestampToMs: (timestamp: string | number) => number;
@@ -0,0 +1,4 @@
1
+ type Primitive = bigint | string | number | boolean | null | undefined;
2
+ /** Serialize an object to URLSearchParams, filtering undefined values, and handling arrays to the expected format */
3
+ export declare function serializeApiParams(struct: Record<string, Primitive | Primitive[]>): URLSearchParams;
4
+ export {};
package/dist/index.d.ts CHANGED
@@ -4,29 +4,38 @@ export * from './global';
4
4
  export * from './abis';
5
5
  export * from './docs';
6
6
  export { getProviderFromId } from './utils/getProviderFromId';
7
- export { calcMindOdds } from './utils/calcMindOdds';
8
- export { getIsPendingResolution } from './utils/getIsPendingResolution';
9
- export { getBetStatus, BetStatus } from './utils/getBetStatus';
10
- export { getBetFee, type BetFeeResponse } from './utils/getBetFee';
7
+ export { calcMinOdds, type CalcMinOddsParams } from 'src/utils/calcMinOdds';
8
+ export { getIsPendingResolution, type GetIsPendingResolutionParams } from './utils/getIsPendingResolution';
11
9
  export { groupConditionsByMarket, type GameMarkets, type MarketOutcome, type Market } from './utils/groupConditionsByMarket';
12
10
  export { setupContracts, type Contracts } from './utils/setupContracts';
13
11
  export { getFeedGraphqlEndpoint, getBetsGraphqlEndpoint, getApiEndpoint, getSocketEndpoint } from './utils/getEndpoints';
14
- export { getBetTypedData } from './utils/getBetTypedData';
15
- export { getComboBetTypedData } from './utils/getComboBetTypedData';
16
- export { createBet } from './utils/createBet';
17
- export { createComboBet } from './utils/createComboBet';
18
- export { getBet, type GetBetResponse } from './utils/getBet';
19
- export { getMaxBet, type GetMaxBetResponse } from './utils/getMaxBet';
20
- export { getBetCalculation, type GetBetCalculationResponse } from './utils/getBetCalculation';
12
+ export { getBetStatus, BetStatus } from './utils/bet/getBetStatus';
13
+ export { getBetFee, type GetBetFeeParams, type GetBetFeeResult, type BetFeeResponse } from './utils/bet/getBetFee';
14
+ export { getBetTypedData, type GetBetTypedDataParams } from './utils/bet/getBetTypedData';
15
+ export { getComboBetTypedData, type GetComboBetTypedDataParams } from './utils/bet/getComboBetTypedData';
16
+ export { createBet, type CreateBetParams, type CreateBetResult } from './utils/bet/createBet';
17
+ export { createComboBet, type CreateComboBetParams, type CreateComboBetResult } from './utils/bet/createComboBet';
18
+ export { getBet, type GetBetParams, type GetBetResponse, type GetBetResult } from './utils/bet/getBet';
19
+ export { getBetCalculation, type GetBetCalculationParams, type GetBetCalculationResult } from './utils/bet/getBetCalculation';
20
+ export { getBetsByBettor, type GetBetsByBettorParams, type GetBetsByBettorResult } from 'src/utils/bet/getBetsByBettor';
21
+ export { type BetOrderData, type BetOrderConditionData, type BetMetaData } from './utils/bet/types';
22
+ export { getConditionsByGameIds, type GetConditionsByGameIdsParams, type GetConditionsByGameIdsResponseResult, type ConditionDetailedData } from './utils/feed/getConditionsByGameIds';
23
+ export { getConditionsState, type GetConditionsStateParams, type GetConditionsStateResult, type ConditionStateData } from './utils/feed/getConditionsState';
24
+ export { getGamesByFilters, type GetGamesByFiltersParams, type GetGamesByFiltersResult } from './utils/feed/getGamesByFilters';
25
+ export { getGamesByIds, type GetGamesByIdsParams, type GetGamesByIdsResult } from './utils/feed/getGamesByIds';
26
+ export { getNavigation, type GetNavigationParams, type GetNavigationResult, type NavigationSportData } from './utils/feed/getNavigation';
27
+ export { getSports, type GetSportsParams, type GetSportsResult, type SportData } from './utils/feed/getSports';
28
+ export { searchGames, type SearchGamesParams, type SearchGamesResult } from './utils/feed/searchGames';
29
+ export { type GameData, type PaginatedGamesResponse, type GameParticipant, GameOrderBy } from './utils/feed/types';
21
30
  export { getWaveLevels, WaveLevelName, type WaveLevelData, type WaveLevelsResponse } from './utils/wave/getWaveLevels';
22
31
  export { getWaveStats, type WaveStatsResponse } from './utils/wave/getWaveStats';
23
32
  export { getWavePeriods, type WavePeriodsResponse } from './utils/wave/getWavePeriods';
24
33
  export { getWaveLeaderBoard, type WaveLeaderBoardItem } from './utils/wave/getWaveLeaderBoard';
25
34
  export { activateWave } from './utils/wave/activateWave';
26
- export { getPrecalculatedCashouts, type GetPrecalculatedCashouts } from './utils/cashout/getPrecalculatedCashouts';
27
- export { getCalculatedCashout, type GetCalculatedCashout } from './utils/cashout/getCalculatedCashout';
28
- export { getCashoutTypedData } from './utils/cashout/getCashoutTypedData';
29
- export { createCashout, CashoutState, type CreateCashoutResponse } from './utils/cashout/createCashout';
30
- export { getCashout, type GetCashoutResponse } from './utils/cashout/getCashout';
31
- export { getBonuses, type GetBonuses } from './utils/bonus/getBonuses';
32
- export { getAvailableFreebets, type GetAvailableFreebets } from './utils/bonus/getAvailableFreebets';
35
+ export { getPrecalculatedCashouts, type GetPrecalculatedCashoutsParams, type GetPrecalculatedCashoutsResult, type GetPrecalculatedCashouts } from './utils/cashout/getPrecalculatedCashouts';
36
+ export { getCalculatedCashout, type GetCalculatedCashoutParams, type GetCalculatedCashoutResult, type GetCalculatedCashout } from './utils/cashout/getCalculatedCashout';
37
+ export { getCashoutTypedData, type GetCashoutTypedDataParams } from './utils/cashout/getCashoutTypedData';
38
+ export { createCashout, CashoutState, type CreateCashoutParams, type CreateCashoutResult, type CreateCashoutResponse } from './utils/cashout/createCashout';
39
+ export { getCashout, type GetCashoutParams, type GetCashoutResult, type GetCashoutResponse } from './utils/cashout/getCashout';
40
+ export { getBonuses, type GetBonusesParams, type GetBonusesResult, type GetBonuses } from './utils/bonus/getBonuses';
41
+ export { getAvailableFreebets, type GetAvailableFreebetsParams, type GetAvailableFreebetsResult, type GetAvailableFreebets } from './utils/bonus/getAvailableFreebets';