@azuro-org/toolkit 4.1.6 → 4.2.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.
package/dist/config.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type Chain } from 'viem/chains';
2
2
  import { type Address } from 'viem';
3
+ import { Environment } from './envs';
3
4
  import { type Contracts } from './utils/setupContracts';
4
5
  export declare const ODDS_DECIMALS = 12;
5
6
  export declare const MIN_LIVE_BET_AMOUNT = 1;
@@ -7,20 +8,6 @@ export declare const deBridgeUrl = "https://api.dln.trade/v1.0";
7
8
  export declare const deBridgeTxUrl = "https://stats-api.dln.trade/api";
8
9
  export declare const liveHostAddress = "0x67Fca88E2f5F2C33b86bFa4EccfCb8dCD6a56D17";
9
10
  export declare const liveSupportedChains: ChainId[];
10
- export declare enum Environment {
11
- GnosisXDAI = "GnosisXDAI",
12
- PolygonUSDT = "PolygonUSDT",
13
- PolygonAmoyAZUSD = "PolygonAmoyAZUSD",
14
- ChilizWCHZ = "ChilizWCHZ",
15
- ChilizSpicyWCHZ = "ChilizSpicyWCHZ"
16
- }
17
- export declare const environments: {
18
- readonly 100: Environment.GnosisXDAI;
19
- readonly 137: Environment.PolygonUSDT;
20
- readonly 80002: Environment.PolygonAmoyAZUSD;
21
- readonly 88888: Environment.ChilizWCHZ;
22
- readonly 88882: Environment.ChilizSpicyWCHZ;
23
- };
24
11
  type BetToken = {
25
12
  address: Address;
26
13
  symbol: string;
@@ -41,11 +28,12 @@ export type ChainData = {
41
28
  betToken: BetToken;
42
29
  };
43
30
  export declare const chainsData: {
44
- readonly 100: ChainData;
45
- readonly 137: ChainData;
46
- readonly 80002: ChainData;
47
- readonly 88888: ChainData;
48
- readonly 88882: ChainData;
31
+ 100: ChainData;
32
+ 137: ChainData;
33
+ 80002: ChainData;
34
+ 88888: ChainData;
35
+ 88882: ChainData;
49
36
  };
37
+ export declare const chainsDataByEnv: Record<Environment, ChainData>;
50
38
  export type ChainId = keyof typeof chainsData;
51
39
  export {};
package/dist/envs.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ export declare const isDevEnabled: boolean;
2
+ export declare enum Environment {
3
+ GnosisDevXDAI = "GnosisDevXDAI",
4
+ GnosisXDAI = "GnosisXDAI",
5
+ PolygonUSDT = "PolygonUSDT",
6
+ PolygonAmoyAZUSD = "PolygonAmoyAZUSD",
7
+ PolygonAmoyUSDT = "PolygonAmoyUSDT",
8
+ ChilizWCHZ = "ChilizWCHZ",
9
+ ChilizSpicyWCHZ = "ChilizSpicyWCHZ"
10
+ }
11
+ export declare const environments: {
12
+ 100: Environment;
13
+ 137: Environment;
14
+ 80002: Environment;
15
+ 88888: Environment;
16
+ 88882: Environment;
17
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { ODDS_DECIMALS, MIN_LIVE_BET_AMOUNT, deBridgeUrl, deBridgeTxUrl, liveHostAddress, liveSupportedChains, Environment, environments, type ChainData, chainsData, type ChainId } from './config';
1
+ export { environments, Environment } from './envs';
2
+ export { ODDS_DECIMALS, MIN_LIVE_BET_AMOUNT, deBridgeUrl, deBridgeTxUrl, liveHostAddress, liveSupportedChains, type ChainData, chainsData, chainsDataByEnv, type ChainId, } from './config';
2
3
  export * from './global';
3
4
  export * from './abis';
4
5
  export * from './docs';
package/dist/index.js CHANGED
@@ -1,4 +1,21 @@
1
- import {gnosis,polygon,polygonAmoy,chiliz,spicy}from'viem/chains';import {gql}from'@apollo/client';import {readContracts,readContract}from'@wagmi/core';import {parseUnits,formatUnits,encodeAbiParameters,parseAbiParameters,encodeFunctionData}from'viem';import {dictionaries,getMarketKey,getMarketName,getSelectionName,getMarketDescription}from'@azuro-org/dictionaries';var lpAbi = [
1
+ import {gnosis,polygon,polygonAmoy,chiliz,spicy}from'viem/chains';import {gql}from'@apollo/client';import {readContracts,readContract}from'@wagmi/core';import {parseUnits,formatUnits,encodeAbiParameters,parseAbiParameters,encodeFunctionData}from'viem';import {dictionaries,getMarketKey,getMarketName,getSelectionName,getMarketDescription}from'@azuro-org/dictionaries';const isDevEnabled = Boolean(JSON.parse(process.env.AZURO_UNSTABLE_DEV_ENABLED || 'false'));
2
+ var Environment;
3
+ (function (Environment) {
4
+ Environment["GnosisDevXDAI"] = "GnosisDevXDAI";
5
+ Environment["GnosisXDAI"] = "GnosisXDAI";
6
+ Environment["PolygonUSDT"] = "PolygonUSDT";
7
+ Environment["PolygonAmoyAZUSD"] = "PolygonAmoyAZUSD";
8
+ Environment["PolygonAmoyUSDT"] = "PolygonAmoyUSDT";
9
+ Environment["ChilizWCHZ"] = "ChilizWCHZ";
10
+ Environment["ChilizSpicyWCHZ"] = "ChilizSpicyWCHZ";
11
+ })(Environment || (Environment = {}));
12
+ const environments = {
13
+ [gnosis.id]: isDevEnabled ? Environment.GnosisDevXDAI : Environment.GnosisXDAI,
14
+ [polygon.id]: Environment.PolygonUSDT,
15
+ [polygonAmoy.id]: isDevEnabled ? Environment.PolygonAmoyUSDT : Environment.PolygonAmoyAZUSD,
16
+ [chiliz.id]: Environment.ChilizWCHZ,
17
+ [spicy.id]: Environment.ChilizSpicyWCHZ,
18
+ };var lpAbi = [
2
19
  { 'inputs': [], 'name': 'BetExpired', 'type': 'error',
3
20
  },
4
21
  { 'inputs': [
@@ -3876,32 +3893,41 @@ import {gnosis,polygon,polygonAmoy,chiliz,spicy}from'viem/chains';import {gql}fr
3876
3893
  [chiliz.id]: 'chiliz',
3877
3894
  [spicy.id]: 'chiliz-spicy-dev',
3878
3895
  };
3896
+ if (isDevEnabled) {
3897
+ endpointNameByChainId[gnosis.id] = 'gnosis-dev';
3898
+ endpointNameByChainId[polygonAmoy.id] = 'polygon-amoy-dev';
3899
+ }
3900
+ const isDev = (chainId) => {
3901
+ return isDevEnabled && (chainId === polygonAmoy.id
3902
+ || chainId === gnosis.id
3903
+ || chainId === spicy.id);
3904
+ };
3879
3905
  const getPrematchGraphqlEndpoint = (chainId) => `https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`;
3880
3906
  const getLiveGraphqlEndpoint = (chainId) => {
3907
+ if (isDev(chainId)) {
3908
+ return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev';
3909
+ }
3881
3910
  if (chainId === polygonAmoy.id) {
3882
3911
  return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-preprod';
3883
3912
  }
3884
- if (chainId === spicy.id) {
3885
- return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev';
3886
- }
3887
3913
  return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed';
3888
3914
  };
3889
3915
  const getSocketEndpoint = (chainId) => {
3916
+ if (isDev(chainId)) {
3917
+ return 'wss://dev-streams.azuro.org/v1/streams/conditions';
3918
+ }
3890
3919
  if (chainId === polygonAmoy.id) {
3891
3920
  return 'wss://preprod-streams.azuro.org/v1/streams/conditions';
3892
3921
  }
3893
- if (chainId === spicy.id) {
3894
- return 'wss://dev-streams.azuro.org/v1/streams/conditions';
3895
- }
3896
3922
  return 'wss://streams.azuro.org/v1/streams/conditions';
3897
3923
  };
3898
3924
  const getApiEndpoint = (chainId) => {
3925
+ if (isDev(chainId)) {
3926
+ return 'https://dev-api.azuro.org/api/v1/public';
3927
+ }
3899
3928
  if (chainId === polygonAmoy.id) {
3900
3929
  return 'https://preprod-api.azuro.org/api/v1/public';
3901
3930
  }
3902
- if (chainId === spicy.id) {
3903
- return 'https://dev-api.azuro.org/api/v1/public';
3904
- }
3905
3931
  return 'https://api.azuro.org/api/v1/public';
3906
3932
  };const ODDS_DECIMALS = 12;
3907
3933
  const MIN_LIVE_BET_AMOUNT = 1;
@@ -3909,21 +3935,6 @@ const deBridgeUrl = 'https://api.dln.trade/v1.0';
3909
3935
  const deBridgeTxUrl = 'https://stats-api.dln.trade/api';
3910
3936
  const liveHostAddress = '0x67Fca88E2f5F2C33b86bFa4EccfCb8dCD6a56D17';
3911
3937
  const liveSupportedChains = [polygon.id, gnosis.id, polygonAmoy.id];
3912
- var Environment;
3913
- (function (Environment) {
3914
- Environment["GnosisXDAI"] = "GnosisXDAI";
3915
- Environment["PolygonUSDT"] = "PolygonUSDT";
3916
- Environment["PolygonAmoyAZUSD"] = "PolygonAmoyAZUSD";
3917
- Environment["ChilizWCHZ"] = "ChilizWCHZ";
3918
- Environment["ChilizSpicyWCHZ"] = "ChilizSpicyWCHZ";
3919
- })(Environment || (Environment = {}));
3920
- const environments = {
3921
- [gnosis.id]: Environment.GnosisXDAI,
3922
- [polygon.id]: Environment.PolygonUSDT,
3923
- [polygonAmoy.id]: Environment.PolygonAmoyAZUSD,
3924
- [chiliz.id]: Environment.ChilizWCHZ,
3925
- [spicy.id]: Environment.ChilizSpicyWCHZ,
3926
- };
3927
3938
  const gnosisData = {
3928
3939
  chain: gnosis,
3929
3940
  graphql: {
@@ -3947,6 +3958,29 @@ const gnosisData = {
3947
3958
  decimals: 18,
3948
3959
  },
3949
3960
  };
3961
+ const gnosisDevData = {
3962
+ chain: gnosis,
3963
+ graphql: {
3964
+ prematch: getPrematchGraphqlEndpoint(gnosis.id),
3965
+ live: getLiveGraphqlEndpoint(gnosis.id),
3966
+ },
3967
+ socket: getSocketEndpoint(gnosis.id),
3968
+ api: getApiEndpoint(gnosis.id),
3969
+ environment: environments[gnosis.id],
3970
+ contracts: setupContracts({
3971
+ lp: '0xe068Bf88317fA2eb3EAEcBfe1e486d8b2dDe7761',
3972
+ prematchCore: '0x0eaa5283990af9ca915b1d82261663d25d039d03',
3973
+ prematchComboCore: '0xdab6c085e2a24d3417875ea154c1d0abb5d427f9',
3974
+ proxyFront: '0xB02205C9e5DdFFa3EEa2731fE76e505B0d3eCCb0',
3975
+ liveRelayer: '0x3B0213eB35735A8E2b19F13C5Ec0a65a8226D5B2',
3976
+ liveCore: '0xFc4910f0E7523063f3640e249Fc0f25542b76899',
3977
+ }),
3978
+ betToken: {
3979
+ address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
3980
+ symbol: 'WXDAI',
3981
+ decimals: 18,
3982
+ },
3983
+ };
3950
3984
  const polygonData = {
3951
3985
  chain: polygon,
3952
3986
  graphql: {
@@ -3993,6 +4027,29 @@ const polygonAmoyData = {
3993
4027
  decimals: 6,
3994
4028
  },
3995
4029
  };
4030
+ const polygonAmoyDevData = {
4031
+ chain: polygonAmoy,
4032
+ graphql: {
4033
+ prematch: getPrematchGraphqlEndpoint(polygonAmoy.id),
4034
+ live: getLiveGraphqlEndpoint(polygonAmoy.id),
4035
+ },
4036
+ socket: getSocketEndpoint(polygonAmoy.id),
4037
+ api: getApiEndpoint(polygonAmoy.id),
4038
+ environment: environments[polygonAmoy.id],
4039
+ contracts: setupContracts({
4040
+ lp: '0xDAa095204aCc244020F8f8e915f36533150ACF4b',
4041
+ prematchCore: '0x87EBFFe283bE8dEd47c3C87451d1B89c8a2C441A',
4042
+ prematchComboCore: '0x471DaC1052248602fdF05377EF99B5b7b3a769a1',
4043
+ proxyFront: '0x7003CaA0847CA296EBF51C43D9021656a663304f',
4044
+ liveRelayer: '0x38633e7Cbd86959453445C170168855ed1151C22',
4045
+ liveCore: '0x00232f2dEEae4541da1C5eC265193C879B2304Eb',
4046
+ }),
4047
+ betToken: {
4048
+ address: '0x683026Eb1b912795E4Eb1e73Da7e38C3F2f830c4',
4049
+ symbol: 'USDT',
4050
+ decimals: 6,
4051
+ },
4052
+ };
3996
4053
  const chilizData = {
3997
4054
  chain: chiliz,
3998
4055
  graphql: {
@@ -4041,6 +4098,19 @@ const chainsData = {
4041
4098
  [polygonAmoy.id]: polygonAmoyData,
4042
4099
  [chiliz.id]: chilizData,
4043
4100
  [spicy.id]: spicyData,
4101
+ };
4102
+ if (isDevEnabled) {
4103
+ chainsData[gnosis.id] = gnosisDevData;
4104
+ chainsData[polygonAmoy.id] = polygonAmoyDevData;
4105
+ }
4106
+ const chainsDataByEnv = {
4107
+ [Environment.GnosisXDAI]: gnosisData,
4108
+ [Environment.GnosisDevXDAI]: gnosisDevData,
4109
+ [Environment.PolygonUSDT]: polygonData,
4110
+ [Environment.PolygonAmoyAZUSD]: polygonAmoyData,
4111
+ [Environment.PolygonAmoyUSDT]: polygonAmoyDevData,
4112
+ [Environment.ChilizWCHZ]: chilizData,
4113
+ [Environment.ChilizSpicyWCHZ]: spicyData,
4044
4114
  };const LiveConditionFragmentDoc = gql `
4045
4115
  fragment LiveCondition on Condition {
4046
4116
  id
@@ -5707,4 +5777,4 @@ const getDeBridgeOrder = async (orderId) => {
5707
5777
  }
5708
5778
  const data = await response.json();
5709
5779
  return data;
5710
- };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,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,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};
5780
+ };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,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};
@@ -1,5 +1,5 @@
1
1
  import { type ChainId } from '../config';
2
2
  export declare const getPrematchGraphqlEndpoint: (chainId: ChainId) => string;
3
- export declare const getLiveGraphqlEndpoint: (chainId: ChainId) => "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-preprod" | "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev" | "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed";
4
- export declare const getSocketEndpoint: (chainId: ChainId) => "wss://preprod-streams.azuro.org/v1/streams/conditions" | "wss://dev-streams.azuro.org/v1/streams/conditions" | "wss://streams.azuro.org/v1/streams/conditions";
5
- export declare const getApiEndpoint: (chainId: ChainId) => "https://preprod-api.azuro.org/api/v1/public" | "https://dev-api.azuro.org/api/v1/public" | "https://api.azuro.org/api/v1/public";
3
+ export declare const getLiveGraphqlEndpoint: (chainId: ChainId) => "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev" | "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-preprod" | "https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed";
4
+ export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.azuro.org/v1/streams/conditions" | "wss://preprod-streams.azuro.org/v1/streams/conditions" | "wss://streams.azuro.org/v1/streams/conditions";
5
+ export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.azuro.org/api/v1/public" | "https://preprod-api.azuro.org/api/v1/public" | "https://api.azuro.org/api/v1/public";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/toolkit",
3
- "version": "4.1.6",
3
+ "version": "4.2.0",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",