@azuro-org/toolkit 6.0.0-beta.0 → 6.0.0-beta.2
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/index.d.ts +2 -2
- package/dist/index.js +50 -53
- package/dist/index.js.map +1 -1
- package/dist/utils/feed/getConditionsByGameIds.d.ts +1 -6
- package/dist/utils/feed/getGamesByFilters.d.ts +5 -6
- package/dist/utils/feed/getNavigation.d.ts +9 -6
- package/dist/utils/feed/getSports.d.ts +8 -11
- package/dist/utils/feed/searchGames.d.ts +1 -1
- package/dist/utils/feed/types.d.ts +3 -2
- package/dist/utils/getEndpoints.d.ts +3 -3
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './global';
|
|
|
4
4
|
export * from './abis';
|
|
5
5
|
export * from './docs';
|
|
6
6
|
export { getProviderFromId } from './utils/getProviderFromId';
|
|
7
|
-
export { calcMinOdds, type CalcMinOddsParams } from '
|
|
7
|
+
export { calcMinOdds, type CalcMinOddsParams } from './utils/calcMinOdds';
|
|
8
8
|
export { getIsPendingResolution, type GetIsPendingResolutionParams } from './utils/getIsPendingResolution';
|
|
9
9
|
export { groupConditionsByMarket, type GameMarkets, type MarketOutcome, type Market } from './utils/groupConditionsByMarket';
|
|
10
10
|
export { setupContracts, type Contracts } from './utils/setupContracts';
|
|
@@ -17,7 +17,7 @@ export { createBet, type CreateBetParams, type CreateBetResult } from './utils/b
|
|
|
17
17
|
export { createComboBet, type CreateComboBetParams, type CreateComboBetResult } from './utils/bet/createComboBet';
|
|
18
18
|
export { getBet, type GetBetParams, type GetBetResponse, type GetBetResult } from './utils/bet/getBet';
|
|
19
19
|
export { getBetCalculation, type GetBetCalculationParams, type GetBetCalculationResult } from './utils/bet/getBetCalculation';
|
|
20
|
-
export { getBetsByBettor, type GetBetsByBettorParams, type GetBetsByBettorResult } from '
|
|
20
|
+
export { getBetsByBettor, type GetBetsByBettorParams, type GetBetsByBettorResult } from './utils/bet/getBetsByBettor';
|
|
21
21
|
export { type BetOrderData, type BetOrderConditionData, type BetMetaData } from './utils/bet/types';
|
|
22
22
|
export { getConditionsByGameIds, type GetConditionsByGameIdsParams, type GetConditionsByGameIdsResponseResult, type ConditionDetailedData } from './utils/feed/getConditionsByGameIds';
|
|
23
23
|
export { getConditionsState, type GetConditionsStateParams, type GetConditionsStateResult, type ConditionStateData } from './utils/feed/getConditionsState';
|
package/dist/index.js
CHANGED
|
@@ -5845,37 +5845,37 @@ const isDevChain = (chainId) => {
|
|
|
5845
5845
|
chainId === bscTestnet.id);
|
|
5846
5846
|
};
|
|
5847
5847
|
/** @deprecated Use REST API instead */
|
|
5848
|
-
const getFeedGraphqlEndpoint = (chainId) => (`https://thegraph-1.
|
|
5849
|
-
const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.
|
|
5848
|
+
const getFeedGraphqlEndpoint = (chainId) => (`https://thegraph-1.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
|
|
5849
|
+
const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
|
|
5850
5850
|
/**
|
|
5851
5851
|
* @deprecated Only for v2 feed
|
|
5852
5852
|
*/
|
|
5853
5853
|
const getLegacyLiveGraphqlEndpoint = (chainId) => {
|
|
5854
5854
|
if (isDevChain(chainId)) {
|
|
5855
|
-
return 'https://thegraph.
|
|
5855
|
+
return 'https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev';
|
|
5856
5856
|
}
|
|
5857
5857
|
// if (chainId === polygonAmoy.id) {
|
|
5858
|
-
// return 'https://thegraph.
|
|
5858
|
+
// return 'https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-preprod'
|
|
5859
5859
|
// }
|
|
5860
|
-
return 'https://thegraph.
|
|
5860
|
+
return 'https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed';
|
|
5861
5861
|
};
|
|
5862
5862
|
const getSocketEndpoint = (chainId) => {
|
|
5863
5863
|
if (isDevChain(chainId)) {
|
|
5864
|
-
return 'wss://dev-streams.
|
|
5864
|
+
return 'wss://dev-streams.onchainfeed.org/v1/streams';
|
|
5865
5865
|
}
|
|
5866
5866
|
// if (chainId === polygonAmoy.id) {
|
|
5867
5867
|
// return 'wss://preprod-streams.azuro.org/v1/streams'
|
|
5868
5868
|
// }
|
|
5869
|
-
return 'wss://streams.
|
|
5869
|
+
return 'wss://streams.onchainfeed.org/v1/streams';
|
|
5870
5870
|
};
|
|
5871
5871
|
const getApiEndpoint = (chainId) => {
|
|
5872
5872
|
if (isDevChain(chainId)) {
|
|
5873
|
-
return 'https://dev-api.
|
|
5873
|
+
return 'https://dev-api.onchainfeed.org/api/v1/public';
|
|
5874
5874
|
}
|
|
5875
5875
|
// if (chainId === polygonAmoy.id) {
|
|
5876
5876
|
// return 'https://preprod-api.azuro.org/api/v1/public'
|
|
5877
5877
|
// }
|
|
5878
|
-
return 'https://api.
|
|
5878
|
+
return 'https://api.onchainfeed.org/api/v1/public';
|
|
5879
5879
|
};const ODDS_DECIMALS = 12;
|
|
5880
5880
|
const ODDS_COMBO_FEE_MODIFIER = 0.99;
|
|
5881
5881
|
const CLIENT_DATA_TYPES = [
|
|
@@ -8075,28 +8075,22 @@ const getBetsByBettor = async (props) => {
|
|
|
8075
8075
|
* })
|
|
8076
8076
|
* */
|
|
8077
8077
|
const getConditionsByGameIds = async (props) => {
|
|
8078
|
-
|
|
8079
|
-
if (!
|
|
8078
|
+
const gameIds = Array.isArray(props.gameIds) ? props.gameIds.filter(Boolean) : [props.gameIds];
|
|
8079
|
+
if (!gameIds.length) {
|
|
8080
8080
|
return [];
|
|
8081
8081
|
}
|
|
8082
8082
|
const api = getApiEndpoint(props.chainId);
|
|
8083
8083
|
const environment = environments[props.chainId];
|
|
8084
|
-
const
|
|
8085
|
-
|
|
8086
|
-
gameIds: props.gameIds,
|
|
8087
|
-
// TODO requested to be in api, not implemented yet
|
|
8088
|
-
states: props.states,
|
|
8089
|
-
outcomeIds: props.outcomeIds,
|
|
8090
|
-
maxMargin: props.maxMargin,
|
|
8091
|
-
orderBy: props.orderBy,
|
|
8092
|
-
orderDir: props.orderDir,
|
|
8093
|
-
});
|
|
8094
|
-
const response = await fetch(`${api}/market-manager/conditions-by-game-ids?${params}`, {
|
|
8095
|
-
method: 'GET',
|
|
8084
|
+
const response = await fetch(`${api}/market-manager/conditions-by-game-ids`, {
|
|
8085
|
+
method: 'POST',
|
|
8096
8086
|
headers: {
|
|
8097
8087
|
'Accept': 'application/json',
|
|
8088
|
+
'Content-Type': 'application/json',
|
|
8098
8089
|
},
|
|
8099
|
-
|
|
8090
|
+
body: JSON.stringify({
|
|
8091
|
+
gameIds: props.gameIds,
|
|
8092
|
+
environment,
|
|
8093
|
+
}),
|
|
8100
8094
|
});
|
|
8101
8095
|
if (!response.ok) {
|
|
8102
8096
|
throw new Error(`getConditionsByGameIds API request failed: ${response.status} ${response.statusText}`);
|
|
@@ -8138,7 +8132,11 @@ const getConditionsState = async (props) => {
|
|
|
8138
8132
|
}
|
|
8139
8133
|
const data = await response.json();
|
|
8140
8134
|
return data.conditions;
|
|
8141
|
-
}
|
|
8135
|
+
};var GameOrderBy;
|
|
8136
|
+
(function (GameOrderBy) {
|
|
8137
|
+
GameOrderBy["StartsAt"] = "startsAt";
|
|
8138
|
+
GameOrderBy["Turnover"] = "turnover";
|
|
8139
|
+
})(GameOrderBy || (GameOrderBy = {}));/**
|
|
8142
8140
|
* Fetches games by applying various filters such as sport, league, or game state.
|
|
8143
8141
|
* Returns paginated results ideal for building sport/country/league listing pages.
|
|
8144
8142
|
*
|
|
@@ -8159,17 +8157,15 @@ const getGamesByFilters = async (props) => {
|
|
|
8159
8157
|
const environment = environments[props.chainId];
|
|
8160
8158
|
const params = serializeApiParams({
|
|
8161
8159
|
environment,
|
|
8162
|
-
perPage: props.perPage || 1000,
|
|
8163
|
-
page: props.page || 1,
|
|
8164
|
-
// TODO requested to be in api, not implemented yet
|
|
8165
8160
|
state: props.state,
|
|
8166
|
-
|
|
8167
|
-
|
|
8161
|
+
sportId: props.sportIds,
|
|
8162
|
+
leagueSlug: props.leagueSlug,
|
|
8168
8163
|
sportHub: props.sportHub,
|
|
8169
|
-
//
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8164
|
+
// conditionState: props.conditionsState,
|
|
8165
|
+
orderBy: props.orderBy || GameOrderBy.StartsAt,
|
|
8166
|
+
orderDir: props.orderDir || OrderDirection$1.Asc,
|
|
8167
|
+
perPage: props.perPage || 1000,
|
|
8168
|
+
page: props.page || 1,
|
|
8173
8169
|
});
|
|
8174
8170
|
const response = await fetch(`${api}/market-manager/games-by-filters?${params}`, {
|
|
8175
8171
|
method: 'GET',
|
|
@@ -8262,7 +8258,13 @@ const getNavigation = async (props) => {
|
|
|
8262
8258
|
throw new Error(`getNavigation API request failed: ${response.status} ${response.statusText}`);
|
|
8263
8259
|
}
|
|
8264
8260
|
const data = await response.json();
|
|
8265
|
-
return data.sports
|
|
8261
|
+
return data.sports.map(({ sportHub, ...rest }) => {
|
|
8262
|
+
return {
|
|
8263
|
+
...rest,
|
|
8264
|
+
// to align with previous graphql based versions
|
|
8265
|
+
sporthub: sportHub,
|
|
8266
|
+
};
|
|
8267
|
+
});
|
|
8266
8268
|
};/**
|
|
8267
8269
|
* Fetches a complete sports hierarchy including countries, leagues, and games.
|
|
8268
8270
|
* Returns nested structure with all games organized by sport, country, and league.
|
|
@@ -8284,16 +8286,15 @@ const getSports = async (props) => {
|
|
|
8284
8286
|
const environment = environments[props.chainId];
|
|
8285
8287
|
const params = serializeApiParams({
|
|
8286
8288
|
environment,
|
|
8287
|
-
|
|
8288
|
-
page: props.page || 1,
|
|
8289
|
-
states: props.states,
|
|
8290
|
-
// TODO requested to be in api, not implemented yet
|
|
8291
|
-
sportIds: props.sportIds,
|
|
8292
|
-
sportHub: props.sportHub,
|
|
8289
|
+
sportId: props.sportIds,
|
|
8293
8290
|
countrySlug: props.countrySlug,
|
|
8294
8291
|
leagueSlug: props.leagueSlug,
|
|
8292
|
+
numberOfGames: props.numberOfGames ? Math.max(props.numberOfGames, 10) : 10,
|
|
8295
8293
|
orderBy: props.orderBy,
|
|
8296
8294
|
orderDir: props.orderDir,
|
|
8295
|
+
// TODO requested to be in api, not implemented yet
|
|
8296
|
+
gameState: props.gameState,
|
|
8297
|
+
// sportHub: props.sportHub,
|
|
8297
8298
|
});
|
|
8298
8299
|
const response = await fetch(`${api}/market-manager/sports?${params}`, {
|
|
8299
8300
|
method: 'GET',
|
|
@@ -8303,7 +8304,7 @@ const getSports = async (props) => {
|
|
|
8303
8304
|
cache: 'no-cache',
|
|
8304
8305
|
});
|
|
8305
8306
|
if (!response.ok) {
|
|
8306
|
-
throw new Error(`
|
|
8307
|
+
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
8307
8308
|
}
|
|
8308
8309
|
const data = await response.json();
|
|
8309
8310
|
// return data.sports.map((sport) => {
|
|
@@ -8344,7 +8345,7 @@ const getSports = async (props) => {
|
|
|
8344
8345
|
};const minQueryLength = 3;
|
|
8345
8346
|
/**
|
|
8346
8347
|
* Searches for games by text query across game titles, leagues, and countries.
|
|
8347
|
-
*
|
|
8348
|
+
* The minimum query length is 3 characters. Returns paginated results.
|
|
8348
8349
|
*
|
|
8349
8350
|
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/searchGames
|
|
8350
8351
|
*
|
|
@@ -8374,8 +8375,8 @@ const searchGames = async (props) => {
|
|
|
8374
8375
|
const environment = environments[props.chainId];
|
|
8375
8376
|
const params = serializeApiParams({
|
|
8376
8377
|
environment,
|
|
8377
|
-
|
|
8378
|
-
|
|
8378
|
+
perPage: props.perPage || 10,
|
|
8379
|
+
page: props.page || 1,
|
|
8379
8380
|
request: props.query,
|
|
8380
8381
|
});
|
|
8381
8382
|
const response = await fetch(`${api}/market-manager/search?${params}`, {
|
|
@@ -8390,11 +8391,7 @@ const searchGames = async (props) => {
|
|
|
8390
8391
|
}
|
|
8391
8392
|
const data = await response.json();
|
|
8392
8393
|
return data;
|
|
8393
|
-
};var
|
|
8394
|
-
(function (GameOrderBy) {
|
|
8395
|
-
GameOrderBy["StartsAt"] = "startsAt";
|
|
8396
|
-
GameOrderBy["Turnover"] = "turnover";
|
|
8397
|
-
})(GameOrderBy || (GameOrderBy = {}));var WaveLevelName;
|
|
8394
|
+
};var WaveLevelName;
|
|
8398
8395
|
(function (WaveLevelName) {
|
|
8399
8396
|
WaveLevelName["Grey"] = "Grey";
|
|
8400
8397
|
WaveLevelName["Mist"] = "Mist";
|
|
@@ -8901,9 +8898,9 @@ const getAvailableFreebets = async ({ chainId, account, affiliate, selections })
|
|
|
8901
8898
|
},
|
|
8902
8899
|
status: bonus.status,
|
|
8903
8900
|
chainId: chainsDataByEnv[environment].chain.id,
|
|
8904
|
-
expiresAt:
|
|
8905
|
-
usedAt:
|
|
8906
|
-
createdAt:
|
|
8901
|
+
expiresAt: Date.parse(bonus.expiresAt),
|
|
8902
|
+
usedAt: Date.parse(bonus.usedAt),
|
|
8903
|
+
createdAt: Date.parse(bonus.createdAt),
|
|
8907
8904
|
publicCustomData: bonus.publicCustomData,
|
|
8908
8905
|
};
|
|
8909
8906
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,12 +2,7 @@ import type { ConditionState } from '../../global';
|
|
|
2
2
|
import type { ChainId } from '../../config';
|
|
3
3
|
export type GetConditionsByGameIdsParams = {
|
|
4
4
|
chainId: ChainId;
|
|
5
|
-
gameIds
|
|
6
|
-
states?: ConditionState | ConditionState[];
|
|
7
|
-
outcomeIds?: string | string[];
|
|
8
|
-
maxMargin?: number | string;
|
|
9
|
-
orderBy?: string;
|
|
10
|
-
orderDir?: 'asc' | 'desc';
|
|
5
|
+
gameIds: string | string[];
|
|
11
6
|
};
|
|
12
7
|
export type ConditionDetailedData = {
|
|
13
8
|
id: string;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import type { GameState, ConditionState } from '../../global';
|
|
2
1
|
import type { ChainId } from '../../config';
|
|
3
|
-
import
|
|
2
|
+
import { type GameState, OrderDirection } from '../../global';
|
|
3
|
+
import { GameOrderBy, type PaginatedGamesResponse, type SportHubSlug } from './types';
|
|
4
4
|
export type GetGamesByFiltersParams = {
|
|
5
5
|
chainId: ChainId;
|
|
6
6
|
state?: GameState.Live | GameState.Prematch;
|
|
7
|
-
sportIds?: string | number | (string | number)[];
|
|
8
|
-
leagueSlugs?: string | string[];
|
|
9
7
|
sportHub?: SportHubSlug;
|
|
10
|
-
|
|
8
|
+
sportIds?: string | number | (string | number)[];
|
|
9
|
+
leagueSlug?: string;
|
|
11
10
|
orderBy?: GameOrderBy;
|
|
12
|
-
orderDir?:
|
|
11
|
+
orderDir?: OrderDirection;
|
|
13
12
|
/** 1-based, default: 1 */
|
|
14
13
|
page?: number;
|
|
15
14
|
/** 1-based, default: 10 */
|
|
@@ -5,13 +5,13 @@ export type GetNavigationParams = {
|
|
|
5
5
|
sportHub?: SportHubSlug;
|
|
6
6
|
sportIds?: string | number | (string | number)[];
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type NavigationSportDataResponse = {
|
|
9
9
|
id: number;
|
|
10
10
|
slug: string;
|
|
11
11
|
name: string;
|
|
12
12
|
sportId: string;
|
|
13
|
-
|
|
14
|
-
id:
|
|
13
|
+
sportHub: {
|
|
14
|
+
id: string;
|
|
15
15
|
slug: SportHubSlug;
|
|
16
16
|
};
|
|
17
17
|
activeGamesCount: number;
|
|
@@ -36,10 +36,13 @@ export type NavigationSportData = {
|
|
|
36
36
|
}[];
|
|
37
37
|
}[];
|
|
38
38
|
};
|
|
39
|
-
type
|
|
40
|
-
|
|
39
|
+
export type NavigationSportData = Omit<NavigationSportDataResponse, 'sportHub'> & {
|
|
40
|
+
sporthub: {
|
|
41
|
+
id: string;
|
|
42
|
+
slug: SportHubSlug;
|
|
43
|
+
};
|
|
41
44
|
};
|
|
42
|
-
export type GetNavigationResult =
|
|
45
|
+
export type GetNavigationResult = NavigationSportData[];
|
|
43
46
|
/**
|
|
44
47
|
* Fetches navigation structure with sports, countries, and leagues hierarchy.
|
|
45
48
|
* Returns active game counts at each level for building navigation menus.
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type GameState, type OrderDirection } from '../../global';
|
|
2
2
|
import type { ChainId } from '../../config';
|
|
3
|
-
import type
|
|
3
|
+
import { type GameData, type GameOrderBy } from './types';
|
|
4
4
|
export type GetSportsParams = {
|
|
5
5
|
chainId: ChainId;
|
|
6
|
-
|
|
7
|
-
/** 1-based, default: 1 */
|
|
8
|
-
page?: number;
|
|
9
|
-
/** default: 100 */
|
|
10
|
-
perPage?: number;
|
|
11
|
-
sportIds?: (string | number)[];
|
|
12
|
-
sportHub?: SportHubSlug;
|
|
6
|
+
sportIds?: (string | number) | (string | number)[];
|
|
13
7
|
countrySlug?: string;
|
|
14
8
|
leagueSlug?: string;
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/** Number of games per league, default: 10 */
|
|
10
|
+
numberOfGames?: number;
|
|
11
|
+
orderBy?: GameOrderBy;
|
|
12
|
+
orderDir?: OrderDirection;
|
|
13
|
+
gameState?: GameState.Live | GameState.Prematch;
|
|
17
14
|
};
|
|
18
15
|
export type SportData = {
|
|
19
16
|
id: number;
|
|
@@ -12,7 +12,7 @@ export type SearchGamesParams = {
|
|
|
12
12
|
export type SearchGamesResult = PaginatedGamesResponse;
|
|
13
13
|
/**
|
|
14
14
|
* Searches for games by text query across game titles, leagues, and countries.
|
|
15
|
-
*
|
|
15
|
+
* The minimum query length is 3 characters. Returns paginated results.
|
|
16
16
|
*
|
|
17
17
|
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/searchGames
|
|
18
18
|
*
|
|
@@ -7,12 +7,13 @@ export type GameParticipant = {
|
|
|
7
7
|
image: string | null | undefined;
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
|
-
export type SportHubSlug =
|
|
10
|
+
export type SportHubSlug = 'sports' | 'esports';
|
|
11
11
|
export type GameData = {
|
|
12
12
|
id: string;
|
|
13
13
|
gameId: string;
|
|
14
14
|
slug: string;
|
|
15
15
|
title: string;
|
|
16
|
+
/** to align with the legacy from the subgraph, it's the unix timestamp in seconds, e.g. `"1771707600"` */
|
|
16
17
|
startsAt: string;
|
|
17
18
|
state: GameState;
|
|
18
19
|
turnover: string;
|
|
@@ -21,7 +22,7 @@ export type GameData = {
|
|
|
21
22
|
slug: string;
|
|
22
23
|
name: string;
|
|
23
24
|
sporthub: {
|
|
24
|
-
id:
|
|
25
|
+
id: string;
|
|
25
26
|
slug: SportHubSlug;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
@@ -5,6 +5,6 @@ export declare const getBetsGraphqlEndpoint: (chainId: ChainId) => string;
|
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Only for v2 feed
|
|
7
7
|
*/
|
|
8
|
-
export declare const getLegacyLiveGraphqlEndpoint: (chainId: ChainId) => "https://thegraph.
|
|
9
|
-
export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.
|
|
10
|
-
export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.
|
|
8
|
+
export declare const getLegacyLiveGraphqlEndpoint: (chainId: ChainId) => "https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev" | "https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed";
|
|
9
|
+
export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.onchainfeed.org/v1/streams" | "wss://streams.onchainfeed.org/v1/streams";
|
|
10
|
+
export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.onchainfeed.org/api/v1/public" | "https://api.onchainfeed.org/api/v1/public";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azuro-org/toolkit",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.2",
|
|
4
4
|
"description": "This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"@graphql-codegen/typescript": "^4.1.2",
|
|
53
53
|
"@graphql-codegen/typescript-document-nodes": "^4.0.12",
|
|
54
54
|
"@graphql-codegen/typescript-operations": "^4.4.0",
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
55
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
56
56
|
"@rollup/plugin-json": "^4.1.0",
|
|
57
57
|
"@types/node": "^17.0.21",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
59
59
|
"builtin-modules": "^3.3.0",
|
|
60
|
-
"eslint": "
|
|
60
|
+
"eslint": "9.39.2",
|
|
61
61
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
62
|
-
"eslint-plugin-import": "^
|
|
62
|
+
"eslint-plugin-import": "^1.14.0",
|
|
63
63
|
"minimist": "^1.2.7",
|
|
64
|
-
"rimraf": "^
|
|
64
|
+
"rimraf": "^6.1.3",
|
|
65
65
|
"rollup": "^2.79.2",
|
|
66
66
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
67
67
|
"tslib": "^2.4.1",
|