@azuro-org/toolkit 5.0.0-beta.3 → 5.0.0-beta.4

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.
package/dist/config.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Environment } from './envs';
2
2
  import { type ChainData } from './global';
3
+ export declare const MARGIN_DECIMALS = 12;
3
4
  export declare const ODDS_DECIMALS = 12;
4
5
  export declare const MIN_BET_AMOUNT = 1;
5
6
  export declare const CLIENT_DATA_TYPES: readonly [{
@@ -13,6 +13,7 @@ export type ConditionQuery = {
13
13
  isExpressForbidden: boolean;
14
14
  isPrematchEnabled: boolean;
15
15
  isLiveEnabled: boolean;
16
+ margin: string;
16
17
  outcomes: Array<{
17
18
  __typename?: 'Outcome';
18
19
  title?: string | null;
@@ -16,6 +16,7 @@ export type ConditionsQuery = {
16
16
  isExpressForbidden: boolean;
17
17
  isPrematchEnabled: boolean;
18
18
  isLiveEnabled: boolean;
19
+ margin: string;
19
20
  outcomes: Array<{
20
21
  __typename?: 'Outcome';
21
22
  title?: string | null;
@@ -8,6 +8,7 @@ export type ConditionFragment = {
8
8
  isExpressForbidden: boolean;
9
9
  isPrematchEnabled: boolean;
10
10
  isLiveEnabled: boolean;
11
+ margin: string;
11
12
  outcomes: Array<{
12
13
  __typename?: 'Outcome';
13
14
  title?: string | null;
@@ -6,6 +6,7 @@ export type GameInfoFragment = {
6
6
  title: string;
7
7
  startsAt: string;
8
8
  state: Types.GameState;
9
+ turnover: string;
9
10
  sport: {
10
11
  __typename?: 'Sport';
11
12
  sportId: string;
@@ -11,6 +11,7 @@ export type GameQuery = {
11
11
  title: string;
12
12
  startsAt: string;
13
13
  state: Types.GameState;
14
+ turnover: string;
14
15
  sport: {
15
16
  __typename?: 'Sport';
16
17
  sportId: string;
@@ -15,6 +15,7 @@ export type GamesQuery = {
15
15
  title: string;
16
16
  startsAt: string;
17
17
  state: Types.GameState;
18
+ turnover: string;
18
19
  sport: {
19
20
  __typename?: 'Sport';
20
21
  sportId: string;
@@ -29,12 +29,12 @@ export type SportsQuery = {
29
29
  turnover: string;
30
30
  games: Array<{
31
31
  __typename?: 'Game';
32
- turnover: string;
33
32
  id: string;
34
33
  gameId: string;
35
34
  title: string;
36
35
  startsAt: string;
37
36
  state: Types.GameState;
37
+ turnover: string;
38
38
  sport: {
39
39
  __typename?: 'Sport';
40
40
  sportId: string;
@@ -91,6 +91,7 @@ export type Condition = {
91
91
  isExpressForbidden: Scalars['Boolean']['output'];
92
92
  isLiveEnabled: Scalars['Boolean']['output'];
93
93
  isPrematchEnabled: Scalars['Boolean']['output'];
94
+ margin: Scalars['BigDecimal']['output'];
94
95
  maxConditionPotentialLoss: Scalars['BigDecimal']['output'];
95
96
  maxOutcomePotentialLoss: Scalars['BigDecimal']['output'];
96
97
  outcomes: Array<Outcome>;
@@ -254,6 +255,14 @@ export type Condition_Filter = {
254
255
  isPrematchEnabled_in?: InputMaybe<Array<Scalars['Boolean']['input']>>;
255
256
  isPrematchEnabled_not?: InputMaybe<Scalars['Boolean']['input']>;
256
257
  isPrematchEnabled_not_in?: InputMaybe<Array<Scalars['Boolean']['input']>>;
258
+ margin?: InputMaybe<Scalars['BigDecimal']['input']>;
259
+ margin_gt?: InputMaybe<Scalars['BigDecimal']['input']>;
260
+ margin_gte?: InputMaybe<Scalars['BigDecimal']['input']>;
261
+ margin_in?: InputMaybe<Array<Scalars['BigDecimal']['input']>>;
262
+ margin_lt?: InputMaybe<Scalars['BigDecimal']['input']>;
263
+ margin_lte?: InputMaybe<Scalars['BigDecimal']['input']>;
264
+ margin_not?: InputMaybe<Scalars['BigDecimal']['input']>;
265
+ margin_not_in?: InputMaybe<Array<Scalars['BigDecimal']['input']>>;
257
266
  maxConditionPotentialLoss?: InputMaybe<Scalars['BigDecimal']['input']>;
258
267
  maxConditionPotentialLoss_gt?: InputMaybe<Scalars['BigDecimal']['input']>;
259
268
  maxConditionPotentialLoss_gte?: InputMaybe<Scalars['BigDecimal']['input']>;
@@ -395,6 +404,7 @@ export declare enum Condition_OrderBy {
395
404
  IsExpressForbidden = "isExpressForbidden",
396
405
  IsLiveEnabled = "isLiveEnabled",
397
406
  IsPrematchEnabled = "isPrematchEnabled",
407
+ Margin = "margin",
398
408
  MaxConditionPotentialLoss = "maxConditionPotentialLoss",
399
409
  MaxOutcomePotentialLoss = "maxOutcomePotentialLoss",
400
410
  Outcomes = "outcomes",
@@ -721,6 +731,7 @@ export type Game = {
721
731
  __typename?: 'Game';
722
732
  _providerTitle?: Maybe<Scalars['String']['output']>;
723
733
  _updatedAt: Scalars['BigInt']['output'];
734
+ activeAndStoppedConditionsCount: Scalars['Int']['output'];
724
735
  activeConditionsCount: Scalars['Int']['output'];
725
736
  conditions: Array<Condition>;
726
737
  conditionsCount: Scalars['Int']['output'];
@@ -799,6 +810,14 @@ export type Game_Filter = {
799
810
  _updatedAt_lte?: InputMaybe<Scalars['BigInt']['input']>;
800
811
  _updatedAt_not?: InputMaybe<Scalars['BigInt']['input']>;
801
812
  _updatedAt_not_in?: InputMaybe<Array<Scalars['BigInt']['input']>>;
813
+ activeAndStoppedConditionsCount?: InputMaybe<Scalars['Int']['input']>;
814
+ activeAndStoppedConditionsCount_gt?: InputMaybe<Scalars['Int']['input']>;
815
+ activeAndStoppedConditionsCount_gte?: InputMaybe<Scalars['Int']['input']>;
816
+ activeAndStoppedConditionsCount_in?: InputMaybe<Array<Scalars['Int']['input']>>;
817
+ activeAndStoppedConditionsCount_lt?: InputMaybe<Scalars['Int']['input']>;
818
+ activeAndStoppedConditionsCount_lte?: InputMaybe<Scalars['Int']['input']>;
819
+ activeAndStoppedConditionsCount_not?: InputMaybe<Scalars['Int']['input']>;
820
+ activeAndStoppedConditionsCount_not_in?: InputMaybe<Array<Scalars['Int']['input']>>;
802
821
  activeConditionsCount?: InputMaybe<Scalars['Int']['input']>;
803
822
  activeConditionsCount_gt?: InputMaybe<Scalars['Int']['input']>;
804
823
  activeConditionsCount_gte?: InputMaybe<Scalars['Int']['input']>;
@@ -1062,6 +1081,7 @@ export type Game_Filter = {
1062
1081
  export declare enum Game_OrderBy {
1063
1082
  ProviderTitle = "_providerTitle",
1064
1083
  UpdatedAt = "_updatedAt",
1084
+ ActiveAndStoppedConditionsCount = "activeAndStoppedConditionsCount",
1065
1085
  ActiveConditionsCount = "activeConditionsCount",
1066
1086
  Conditions = "conditions",
1067
1087
  ConditionsCount = "conditionsCount",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {gnosis,polygon,polygonAmoy,chiliz,spicy,base,baseSepolia}from'viem/chains';import gql from'graphql-tag';import {getMarketKey,getMarketName,getMarketDescription,dictionaries,getSelectionName}from'@azuro-org/dictionaries';import {parseUnits,formatUnits}from'viem';const isDevEnabled = Boolean(JSON.parse(process.env.AZURO_UNSTABLE_DEV_ENABLED || 'false'));
1
+ import {gnosis,polygon,polygonAmoy,chiliz,spicy,base,baseSepolia}from'viem/chains';import gql from'graphql-tag';import {getMarketKey,getMarketName,getMarketDescription,dictionaries,getSelectionName}from'@azuro-org/dictionaries';import {formatUnits,parseUnits}from'viem';const isDevEnabled = Boolean(JSON.parse(process.env.AZURO_UNSTABLE_DEV_ENABLED || 'false'));
2
2
  var Environment;
3
3
  (function (Environment) {
4
4
  Environment["GnosisDevXDAI"] = "GnosisDevXDAI";
@@ -4548,7 +4548,8 @@ const getApiEndpoint = (chainId) => {
4548
4548
  return 'https://preprod-api.azuro.org/api/v1/public';
4549
4549
  }
4550
4550
  return 'https://api.azuro.org/api/v1/public';
4551
- };const ODDS_DECIMALS = 12;
4551
+ };const MARGIN_DECIMALS = 12;
4552
+ const ODDS_DECIMALS = 12;
4552
4553
  const MIN_BET_AMOUNT = 1;
4553
4554
  const CLIENT_DATA_TYPES = [
4554
4555
  { name: 'attention', type: 'string' },
@@ -5112,6 +5113,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5112
5113
  isExpressForbidden
5113
5114
  isPrematchEnabled
5114
5115
  isLiveEnabled
5116
+ margin
5115
5117
  outcomes {
5116
5118
  title
5117
5119
  outcomeId
@@ -5131,6 +5133,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5131
5133
  title
5132
5134
  startsAt
5133
5135
  state
5136
+ turnover
5134
5137
  sport {
5135
5138
  sportId
5136
5139
  slug
@@ -5251,7 +5254,6 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5251
5254
  orderBy: $gameOrderBy
5252
5255
  orderDirection: $gameOrderDirection
5253
5256
  ) {
5254
- turnover
5255
5257
  ...GameInfo
5256
5258
  }
5257
5259
  }
@@ -6099,6 +6101,7 @@ var Condition_OrderBy;
6099
6101
  Condition_OrderBy["IsExpressForbidden"] = "isExpressForbidden";
6100
6102
  Condition_OrderBy["IsLiveEnabled"] = "isLiveEnabled";
6101
6103
  Condition_OrderBy["IsPrematchEnabled"] = "isPrematchEnabled";
6104
+ Condition_OrderBy["Margin"] = "margin";
6102
6105
  Condition_OrderBy["MaxConditionPotentialLoss"] = "maxConditionPotentialLoss";
6103
6106
  Condition_OrderBy["MaxOutcomePotentialLoss"] = "maxOutcomePotentialLoss";
6104
6107
  Condition_OrderBy["Outcomes"] = "outcomes";
@@ -6162,6 +6165,7 @@ var Game_OrderBy;
6162
6165
  (function (Game_OrderBy) {
6163
6166
  Game_OrderBy["ProviderTitle"] = "_providerTitle";
6164
6167
  Game_OrderBy["UpdatedAt"] = "_updatedAt";
6168
+ Game_OrderBy["ActiveAndStoppedConditionsCount"] = "activeAndStoppedConditionsCount";
6165
6169
  Game_OrderBy["ActiveConditionsCount"] = "activeConditionsCount";
6166
6170
  Game_OrderBy["Conditions"] = "conditions";
6167
6171
  Game_OrderBy["ConditionsCount"] = "conditionsCount";
@@ -6350,7 +6354,7 @@ const getBetStatus = (props) => {
6350
6354
  const stateByOutcomeIds = {};
6351
6355
  for (let conditionIndex = 0; conditionIndex < conditions.length; conditionIndex++) {
6352
6356
  const condition = conditions[conditionIndex];
6353
- const { conditionId, outcomes: rawOutcomes, state, wonOutcomeIds, isExpressForbidden, title: customMarketName, game: { gameId }, } = condition;
6357
+ const { conditionId, outcomes: rawOutcomes, state, wonOutcomeIds, isExpressForbidden, title: customMarketName, margin, game: { gameId }, } = condition;
6354
6358
  const firstOutcomeId = rawOutcomes[0].outcomeId;
6355
6359
  const marketKey = getMarketKey(firstOutcomeId);
6356
6360
  const marketName = customMarketName && customMarketName !== 'null' ? customMarketName : getMarketName({ outcomeId: firstOutcomeId });
@@ -6389,6 +6393,7 @@ const getBetStatus = (props) => {
6389
6393
  conditionId,
6390
6394
  state,
6391
6395
  isExpressForbidden,
6396
+ margin: formatUnits(BigInt(margin), MARGIN_DECIMALS),
6392
6397
  outcomes: [],
6393
6398
  };
6394
6399
  new Array(...rawOutcomes).sort((a, b) => {
@@ -6897,4 +6902,4 @@ const createCashout = async (props) => {
6897
6902
  }
6898
6903
  const data = await response.json();
6899
6904
  return data;
6900
- };export{BET_DATA_TYPES,ConditionStatus as BetConditionStatus,BetFragmentDoc,BetResult,BetState,BetStatus,V3_Bet_OrderBy as Bet_OrderBy,BetsDocument,BettorFragmentDoc,BettorsDocument,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CLIENT_DATA_TYPES,COMBO_BET_DATA_TYPES,CashoutState,ConditionDocument,ConditionFragmentDoc,ConditionState,Condition_OrderBy,ConditionsBatchDocument,ConditionsDocument,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameInfoFragmentDoc,GameState,Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LegacyBetsDocument,GameStatus as LegacyGameStatus,LegacyLiveBetFragmentDoc,LegacyLiveGamesDocument,LegacyPrematchBetFragmentDoc,Bet_OrderBy as Legacy_Bet_OrderBy,MIN_BET_AMOUNT,NavigationDocument,ODDS_DECIMALS,OrderDirection,SelectionResult,SportsDocument,SportsNavigationDocument,TYPED_DATA_DOMAIN_NAME,TYPED_DATA_DOMAIN_VERSION,WaveLevelName,activateWave,azuroBetAbi,calcMindOdds,cashoutAbi,chainsData,chainsDataByEnv,coreAbi,createBet,createCashout,createComboBet,environments,FreeBet as freeBetAbi,getApiEndpoint,getBet,getBetFee,getBetStatus,getBetTypedData,getBetsGraphqlEndpoint,getCalculatedCashout,getCashout,getCashoutTypedData,getComboBetTypedData,getFeedGraphqlEndpoint,getFreeBets,getIsPendingResolution,getMaxBet,getPrecalculatedCashouts,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupConditionsByMarket,lpAbi,relayerAbi,setupContracts};
6905
+ };export{BET_DATA_TYPES,ConditionStatus as BetConditionStatus,BetFragmentDoc,BetResult,BetState,BetStatus,V3_Bet_OrderBy as Bet_OrderBy,BetsDocument,BettorFragmentDoc,BettorsDocument,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CLIENT_DATA_TYPES,COMBO_BET_DATA_TYPES,CashoutState,ConditionDocument,ConditionFragmentDoc,ConditionState,Condition_OrderBy,ConditionsBatchDocument,ConditionsDocument,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameInfoFragmentDoc,GameState,Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LegacyBetsDocument,GameStatus as LegacyGameStatus,LegacyLiveBetFragmentDoc,LegacyLiveGamesDocument,LegacyPrematchBetFragmentDoc,Bet_OrderBy as Legacy_Bet_OrderBy,MARGIN_DECIMALS,MIN_BET_AMOUNT,NavigationDocument,ODDS_DECIMALS,OrderDirection,SelectionResult,SportsDocument,SportsNavigationDocument,TYPED_DATA_DOMAIN_NAME,TYPED_DATA_DOMAIN_VERSION,WaveLevelName,activateWave,azuroBetAbi,calcMindOdds,cashoutAbi,chainsData,chainsDataByEnv,coreAbi,createBet,createCashout,createComboBet,environments,FreeBet as freeBetAbi,getApiEndpoint,getBet,getBetFee,getBetStatus,getBetTypedData,getBetsGraphqlEndpoint,getCalculatedCashout,getCashout,getCashoutTypedData,getComboBetTypedData,getFeedGraphqlEndpoint,getFreeBets,getIsPendingResolution,getMaxBet,getPrecalculatedCashouts,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupConditionsByMarket,lpAbi,relayerAbi,setupContracts};
@@ -17,6 +17,7 @@ type TMarket<C> = {
17
17
  type Condition = {
18
18
  conditionId: string;
19
19
  state: ConditionState;
20
+ margin: string;
20
21
  isExpressForbidden: boolean;
21
22
  outcomes: MarketOutcome[];
22
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/toolkit",
3
- "version": "5.0.0-beta.3",
3
+ "version": "5.0.0-beta.4",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",