@azuro-org/toolkit 4.3.0 → 4.3.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.
@@ -18,5 +18,5 @@ export * from './prematch/navigation';
18
18
  export * from './prematch/prematchBets';
19
19
  export * from './prematch/sports';
20
20
  export * from './prematch/sportsNavigation';
21
- export { type Condition_Filter, BetResult, Game_OrderBy, Bet_OrderBy, ConditionStatus, OrderDirection, SelectionResult, BetStatus as GraphBetStatus, GameStatus as PrematchGraphGameStatus } from './prematch/types';
22
- export { GameStatus as LiveGraphGameStatus } from './live/types';
21
+ export { type Condition_Filter, BetResult, Game_OrderBy, Bet_OrderBy, ConditionStatus, OrderDirection, SelectionResult, BetStatus as GraphBetStatus, GameStatus as PrematchGraphGameStatus, Condition_OrderBy as PrematchConditionOrderBy, } from './prematch/types';
22
+ export { GameStatus as LiveGraphGameStatus, Condition_OrderBy as LiveConditionOrderBy } from './live/types';
@@ -2,6 +2,8 @@ import * as Types from './types';
2
2
  import * as Apollo from '@apollo/client';
3
3
  export type LiveConditionsQueryVariables = Types.Exact<{
4
4
  where: Types.Condition_Filter;
5
+ orderBy?: Types.InputMaybe<Types.Condition_OrderBy>;
6
+ orderDirection?: Types.InputMaybe<Types.OrderDirection>;
5
7
  }>;
6
8
  export type LiveConditionsQuery = {
7
9
  __typename?: 'Query';
@@ -12,6 +12,7 @@ export type PrematchConditionQuery = {
12
12
  status: Types.ConditionStatus;
13
13
  title?: string | null;
14
14
  isExpressForbidden: boolean;
15
+ margin: string;
15
16
  outcomes: Array<{
16
17
  __typename?: 'Outcome';
17
18
  title?: string | null;
@@ -2,6 +2,8 @@ import * as Types from './types';
2
2
  import * as Apollo from '@apollo/client';
3
3
  export type PrematchConditionsQueryVariables = Types.Exact<{
4
4
  where: Types.Condition_Filter;
5
+ orderBy?: Types.InputMaybe<Types.Condition_OrderBy>;
6
+ orderDirection?: Types.InputMaybe<Types.OrderDirection>;
5
7
  }>;
6
8
  export type PrematchConditionsQuery = {
7
9
  __typename?: 'Query';
@@ -13,6 +15,7 @@ export type PrematchConditionsQuery = {
13
15
  status: Types.ConditionStatus;
14
16
  title?: string | null;
15
17
  isExpressForbidden: boolean;
18
+ margin: string;
16
19
  outcomes: Array<{
17
20
  __typename?: 'Outcome';
18
21
  title?: string | null;
@@ -6,6 +6,7 @@ export type PrematchConditionFragment = {
6
6
  status: Types.ConditionStatus;
7
7
  title?: string | null;
8
8
  isExpressForbidden: boolean;
9
+ margin: string;
9
10
  outcomes: Array<{
10
11
  __typename?: 'Outcome';
11
12
  title?: string | null;
package/dist/index.d.ts CHANGED
@@ -20,6 +20,6 @@ export { getWavePeriods, type WavePeriodsResponse } from './utils/wave/getWavePe
20
20
  export { getWaveLeaderBoard, type WaveLeaderBoardItem } from './utils/wave/getWaveLeaderBoard';
21
21
  export { activateWave } from './utils/wave/activateWave';
22
22
  export { createDeBridgeBet, type DeBridgeCreateTxResponse } from './utils/deBridge/createDeBridgeBet';
23
- export { getDeBridgeSupportedChains } from './utils/deBridge/getDeBridgeSupportedChains';
24
- export { getDeBridgeSupportedTokens } from './utils/deBridge/getDeBridgeSupportedTokens';
23
+ export { getDeBridgeSupportedChains, deBridgeChainIdByOriginalChainId, type DeBridgeSupportedChains } from './utils/deBridge/getDeBridgeSupportedChains';
24
+ export { getDeBridgeSupportedTokens, type DeBridgeSupportedTokens } from './utils/deBridge/getDeBridgeSupportedTokens';
25
25
  export { getDeBridgeOrder, DeBridgeOrderStatus, DeBridgeExternalCallStatus } from './utils/deBridge/getDeBridgeOrder';
package/dist/index.js CHANGED
@@ -4134,8 +4134,14 @@ const chainsDataByEnv = {
4134
4134
  }
4135
4135
  }
4136
4136
  ${LiveConditionFragmentDoc}`;const LiveConditionsDocument = gql `
4137
- query LiveConditions($where: Condition_filter!) {
4138
- conditions(where: $where, first: 1000, subgraphError: allow) {
4137
+ query LiveConditions($where: Condition_filter!, $orderBy: Condition_orderBy, $orderDirection: OrderDirection) {
4138
+ conditions(
4139
+ where: $where
4140
+ first: 1000
4141
+ orderBy: $orderBy
4142
+ orderDirection: $orderDirection
4143
+ subgraphError: allow
4144
+ ) {
4139
4145
  ...LiveCondition
4140
4146
  wonOutcomeIds
4141
4147
  }
@@ -4158,6 +4164,7 @@ const chainsDataByEnv = {
4158
4164
  status
4159
4165
  title
4160
4166
  isExpressForbidden
4167
+ margin
4161
4168
  outcomes {
4162
4169
  title
4163
4170
  outcomeId
@@ -4292,8 +4299,14 @@ const chainsDataByEnv = {
4292
4299
  }
4293
4300
  }
4294
4301
  ${PrematchConditionFragmentDoc}`;const PrematchConditionsDocument = gql `
4295
- query PrematchConditions($where: Condition_filter!) {
4296
- conditions(where: $where, first: 1000, subgraphError: allow) {
4302
+ query PrematchConditions($where: Condition_filter!, $orderBy: Condition_orderBy, $orderDirection: OrderDirection) {
4303
+ conditions(
4304
+ where: $where
4305
+ first: 1000
4306
+ orderBy: $orderBy
4307
+ orderDirection: $orderDirection
4308
+ subgraphError: allow
4309
+ ) {
4297
4310
  ...PrematchCondition
4298
4311
  wonOutcomeIds
4299
4312
  }
@@ -5436,6 +5449,7 @@ const getBetStatus = (props) => {
5436
5449
  const lpAddress = condition.core?.liquidityPool?.address || '';
5437
5450
  const isExpressForbidden = condition.isExpressForbidden ?? true;
5438
5451
  const customMarketName = condition.title;
5452
+ const margin = condition.margin;
5439
5453
  rawOutcomes.forEach((rawOutcome) => {
5440
5454
  const { outcomeId } = rawOutcome;
5441
5455
  const odds = rawOutcome.odds;
@@ -5458,6 +5472,7 @@ const getBetStatus = (props) => {
5458
5472
  status,
5459
5473
  gameId,
5460
5474
  isExpressForbidden,
5475
+ margin: Boolean(margin) ? formatUnits(BigInt(margin), MARGIN_DECIMALS) : undefined,
5461
5476
  };
5462
5477
  if (Array.isArray(wonOutcomeIds)) {
5463
5478
  outcome.isWon = wonOutcomeIds.includes(outcomeId);
@@ -5678,6 +5693,23 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
5678
5693
  const api = getApiEndpoint(chainId);
5679
5694
  const response = await fetch(`${api}/waves/${waveId}/participants/${account?.toLowerCase()}/activate`);
5680
5695
  await response.json();
5696
+ };const deBridgeChainIdByOriginalChainId = {
5697
+ 245022934: 100000001, // Neon
5698
+ 100: 100000002, // Gnosis
5699
+ 1890: 100000003, // LightLink
5700
+ 1088: 100000004, // Metis
5701
+ 7171: 100000005, // Bitrock
5702
+ };
5703
+ const getDeBridgeSupportedChains = async () => {
5704
+ const response = await fetch(`${deBridgeUrl}/supported-chains-info`);
5705
+ if (response.status === 404) {
5706
+ return null;
5707
+ }
5708
+ if (!response.ok) {
5709
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
5710
+ }
5711
+ const { chains } = await response.json();
5712
+ return chains;
5681
5713
  };const DE_BRIDGE_DEFAULT_DEADLINE = 300; // 5 min
5682
5714
  const createDeBridgeBet = async (props) => {
5683
5715
  const { account, betAmount, dstChainId, selections, totalOdds, slippage, srcChainId, srcChainTokenIn, affiliate, referralCode, deadline, } = props;
@@ -5690,10 +5722,10 @@ const createDeBridgeBet = async (props) => {
5690
5722
  const rawMinOdds = parseUnits(fixedMinOdds, ODDS_DECIMALS);
5691
5723
  const rawDeadline = BigInt(Math.floor(Date.now() / 1000) + (deadline || DE_BRIDGE_DEFAULT_DEADLINE));
5692
5724
  const params = new URLSearchParams({
5693
- dstChainId: String(dstChainId),
5725
+ dstChainId: String(deBridgeChainIdByOriginalChainId[dstChainId] || dstChainId),
5694
5726
  srcChainOrderAuthorityAddress: account,
5695
5727
  prependOperatingExpenses: 'false',
5696
- srcChainId: String(srcChainId),
5728
+ srcChainId: String(deBridgeChainIdByOriginalChainId[srcChainId] || srcChainId),
5697
5729
  srcChainTokenIn,
5698
5730
  srcChainTokenInAmount: 'auto',
5699
5731
  dstChainTokenOut: betToken.address,
@@ -5732,16 +5764,6 @@ const createDeBridgeBet = async (props) => {
5732
5764
  }
5733
5765
  const data = await response.json();
5734
5766
  return data;
5735
- };const getDeBridgeSupportedChains = async () => {
5736
- const response = await fetch(`${deBridgeUrl}/supported-chains-info`);
5737
- if (response.status === 404) {
5738
- return null;
5739
- }
5740
- if (!response.ok) {
5741
- throw new Error(`Status ${response.status}: ${response.statusText}`);
5742
- }
5743
- const { chains } = await response.json();
5744
- return chains;
5745
5767
  };const getDeBridgeSupportedTokens = async (chainId) => {
5746
5768
  const response = await fetch(`${deBridgeUrl}/token-list?chainId=${chainId}`);
5747
5769
  if (response.status === 404) {
@@ -5783,4 +5805,4 @@ const getDeBridgeOrder = async (orderId) => {
5783
5805
  }
5784
5806
  const data = await response.json();
5785
5807
  return data;
5786
- };export{BetResult,BetStatus,Bet_OrderBy,BettorFragmentDoc,BettorsDocument,ConditionStatus$1 as ConditionStatus,DeBridgeExternalCallStatus,DeBridgeOrderStatus,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameStatus,Game_OrderBy$1 as Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LiveBetFragmentDoc,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,chainsData,chainsDataByEnv,createDeBridgeBet,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBetFee,getLiveGraphqlEndpoint,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
5808
+ };export{BetResult,BetStatus,Bet_OrderBy,BettorFragmentDoc,BettorsDocument,ConditionStatus$1 as ConditionStatus,DeBridgeExternalCallStatus,DeBridgeOrderStatus,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameStatus,Game_OrderBy$1 as Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LiveBetFragmentDoc,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,Condition_OrderBy as LiveConditionOrderBy,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,Condition_OrderBy$1 as PrematchConditionOrderBy,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,chainsData,chainsDataByEnv,createDeBridgeBet,deBridgeChainIdByOriginalChainId,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBetFee,getLiveGraphqlEndpoint,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
@@ -1,4 +1,11 @@
1
- export declare const getDeBridgeSupportedChains: () => Promise<{
2
- chainId: number;
3
- chainName: string;
4
- }[] | null>;
1
+ type SupportedChainsResponse = {
2
+ chains: {
3
+ chainId: number;
4
+ originalChainId: number;
5
+ chainName: string;
6
+ }[];
7
+ };
8
+ export declare const deBridgeChainIdByOriginalChainId: Record<number, number>;
9
+ export type DeBridgeSupportedChains = SupportedChainsResponse['chains'] | null;
10
+ export declare const getDeBridgeSupportedChains: () => Promise<DeBridgeSupportedChains>;
11
+ export {};
@@ -1,8 +1,13 @@
1
- export declare const getDeBridgeSupportedTokens: (chainId: number) => Promise<Record<string, {
2
- address: string;
3
- symbol: string;
4
- decimals: number;
5
- name: string;
6
- logoURI: string;
7
- tags: Array<string>;
8
- }> | null>;
1
+ type SupportedTokensResponse = {
2
+ tokens: Record<string, {
3
+ address: string;
4
+ symbol: string;
5
+ decimals: number;
6
+ name: string;
7
+ logoURI: string;
8
+ tags: Array<string>;
9
+ }>;
10
+ };
11
+ export type DeBridgeSupportedTokens = SupportedTokensResponse['tokens'] | null;
12
+ export declare const getDeBridgeSupportedTokens: (chainId: number) => Promise<DeBridgeSupportedTokens>;
13
+ export {};
@@ -11,6 +11,7 @@ export type MarketOutcome = {
11
11
  status: ConditionStatus;
12
12
  gameId: string;
13
13
  isExpressForbidden: boolean;
14
+ margin?: string;
14
15
  isWon?: boolean;
15
16
  } & Selection;
16
17
  export type Market = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/toolkit",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",