@azuro-org/toolkit 5.0.0-beta.10 → 5.0.0-beta.12

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.
@@ -1,6 +1,5 @@
1
1
  import * as Types from './types';
2
2
  export type NavigationQueryVariables = Types.Exact<{
3
- first?: Types.InputMaybe<Types.Scalars['Int']['input']>;
4
3
  sportFilter?: Types.InputMaybe<Types.Sport_Filter>;
5
4
  countryFilter?: Types.InputMaybe<Types.Country_Filter>;
6
5
  leagueFilter?: Types.InputMaybe<Types.League_Filter>;
@@ -1,6 +1,5 @@
1
1
  import * as Types from './types';
2
2
  export type SportsNavigationQueryVariables = Types.Exact<{
3
- first?: Types.InputMaybe<Types.Scalars['Int']['input']>;
4
3
  sportFilter?: Types.InputMaybe<Types.Sport_Filter>;
5
4
  }>;
6
5
  export type SportsNavigationQuery = {
package/dist/global.d.ts CHANGED
@@ -41,6 +41,7 @@ export type CreateBetResponse = {
41
41
  id: string;
42
42
  state: BetState;
43
43
  errorMessage?: string;
44
+ error?: string;
44
45
  };
45
46
  export type BetClientData = {
46
47
  attention: string;
package/dist/index.js CHANGED
@@ -4829,8 +4829,18 @@ const isDev = (chainId) => {
4829
4829
  chainId === spicy.id ||
4830
4830
  chainId === baseSepolia.id);
4831
4831
  };
4832
- const getFeedGraphqlEndpoint = (chainId) => (`https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
4833
- const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
4832
+ const getFeedGraphqlEndpoint = (chainId) => {
4833
+ if (isDev(chainId)) {
4834
+ return (`https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
4835
+ }
4836
+ return (`https://thegraph-1.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
4837
+ };
4838
+ const getBetsGraphqlEndpoint = (chainId) => {
4839
+ if (isDev(chainId)) {
4840
+ return (`https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
4841
+ }
4842
+ return (`https://thegraph-0.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
4843
+ };
4834
4844
  /**
4835
4845
  * @deprecated Only for v2 feed
4836
4846
  */
@@ -4859,7 +4869,7 @@ const getApiEndpoint = (chainId) => {
4859
4869
  // if (chainId === polygonAmoy.id) {
4860
4870
  // return 'https://preprod-api.azuro.org/api/v1/public'
4861
4871
  // }
4862
- return 'https://api.azuro.org/api/v1/public';
4872
+ return 'https://api.onchainfeed.org/api/v1/public';
4863
4873
  };const ODDS_DECIMALS = 12;
4864
4874
  const MIN_BET_AMOUNT = 1;
4865
4875
  const CLIENT_DATA_TYPES = [
@@ -4929,11 +4939,11 @@ const gnosisData = {
4929
4939
  api: getApiEndpoint(gnosis.id),
4930
4940
  environment: environments[gnosis.id],
4931
4941
  contracts: setupContracts({
4932
- lp: '0x204e7371Ade792c5C006fb52711c50a7efC843ed',
4933
- core: '0x7f3F3f19c4e4015fd9Db2f22e653c766154091EF',
4934
- relayer: '0x936c02503A32aA23BCF7CFaF5c29100b0F93FCfe',
4935
- azuroBet: '0xA3A1B460c68dc91c5B3f71f5487A76fac42858bf',
4936
- cashout: '0x7145e4690A8846d5457D7352625e26b6A605a5AF',
4942
+ lp: '0xeb7cDA87D00d677A6Dc73EB569723b0fA51D97E7',
4943
+ core: '0x0e00E6ffcb5E207B800eec9e02999D1Fd9e448f2',
4944
+ relayer: '0x40eb85018fA18dDd10a433C8c40ca8D6744d8B32',
4945
+ azuroBet: '0xd7cd9342A14962C2dCB14569CB6fcA2759999089',
4946
+ cashout: '0x25de227af58188e656524d1C32cCf7C078cdC891',
4937
4947
  }),
4938
4948
  betToken: {
4939
4949
  address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
@@ -4975,11 +4985,11 @@ const polygonData = {
4975
4985
  api: getApiEndpoint(polygon.id),
4976
4986
  environment: environments[polygon.id],
4977
4987
  contracts: setupContracts({
4978
- lp: '0x7043E4e1c4045424858ECBCED80989FeAfC11B36',
4979
- core: '0xA40F8D69D412b79b49EAbdD5cf1b5706395bfCf7',
4980
- relayer: '0xC6BB817a7f02874F360d135D880200A2E440207D',
4981
- azuroBet: '0x8ed7296b5CAe379d07C70280Af622BC410F01Ed7',
4982
- cashout: '0x365f97EE637f7a9260838F7d2a3601EA800627bE',
4988
+ lp: '0x0FA7FB5407eA971694652E6E16C12A52625DE1b8',
4989
+ core: '0xF9548Be470A4e130c90ceA8b179FCD66D2972AC7',
4990
+ relayer: '0x8dA05c0021e6b35865FDC959c54dCeF3A4AbBa9d',
4991
+ azuroBet: '0x7A1c3FEf712753374C4DCe34254B96faF2B7265B',
4992
+ cashout: '0x4a2BB4211cCF9b9eA6eF01D0a61448154ED19095',
4983
4993
  }),
4984
4994
  betToken: {
4985
4995
  address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
@@ -5044,14 +5054,14 @@ const chilizData = {
5044
5054
  api: getApiEndpoint(chiliz.id),
5045
5055
  environment: environments[chiliz.id],
5046
5056
  contracts: setupContracts({
5047
- lp: '0x431A0993d29eEb0fF7e3FE351A303eF72195431a',
5048
- core: '0x524994dcA5EA2bc979ac5506E7195F28B4c16932',
5049
- relayer: '0x725ec0A9eC9dC993A86d0eFD7fD78929d226AbE7',
5050
- azuroBet: '0xF7815889e5d0635A31eca34390b25d8D2cEeD902',
5051
- cashout: '0x7c771a200EcD61A01af992360303f7b1465Cd8e3',
5057
+ lp: '0xEf6b12580301b04CD2551182C88623524B6e47b8',
5058
+ core: '0xa5061617Ee6565CF48d7f0FEF06910b9fb9dE2b0',
5059
+ relayer: '0x81F72B93ABaf061535aaF5D831F05e0CC4084b32',
5060
+ azuroBet: '0x3777B4F27F4B36f14454dbB1f79278bcba694B52',
5061
+ cashout: '0x3995eebB51793Ee353162E7400DB455B17dE3692',
5052
5062
  }),
5053
5063
  betToken: {
5054
- address: '0x721EF6871f1c4Efe730Dce047D40D1743B886946',
5064
+ address: '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47',
5055
5065
  symbol: 'WCHZ',
5056
5066
  decimals: 18,
5057
5067
  },
@@ -5113,11 +5123,11 @@ const baseData = {
5113
5123
  api: getApiEndpoint(base.id),
5114
5124
  environment: environments[base.id],
5115
5125
  contracts: setupContracts({
5116
- lp: '0xF22E9e29728d6592eB54b916Ba9f464d9F237dB1',
5117
- core: '0xf5A6B7940cbdb80F294f1eAc59575562966aa3FC',
5118
- relayer: '0x4731Bb0D12c4f992Cf02BDc7A48e8656d0E382Ed',
5119
- azuroBet: '0x9Ce099D680401763f9Cb160c8eAc3E5f8307314e',
5120
- cashout: '0xFffF9220288787B24276135E58C0BF68D803F0ad',
5126
+ lp: '0x1eD7368bc515E928A4007cEa61FB8a6F8863Af87',
5127
+ core: '0xF40cF1dD7d16C098cff5F8B5650A8FaEf1F4640d',
5128
+ relayer: '0xD2D508d66dB4fCE4B384e4C3EA2fa53BA43e73b5',
5129
+ azuroBet: '0xF328404Dbc8c997d12dC55a1A179AF7F8cb7df90',
5130
+ cashout: '0x6EDff24761F4473611B45BDAe4a779ff31af14Be',
5121
5131
  }),
5122
5132
  betToken: {
5123
5133
  address: '0x4200000000000000000000000000000000000006',
@@ -5540,7 +5550,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5540
5550
  }
5541
5551
  }
5542
5552
  ${GameInfoFragmentDoc}`;const NavigationDocument = gql `
5543
- query Navigation($first: Int, $sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
5553
+ query Navigation($sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
5544
5554
  sports(where: $sportFilter, subgraphError: allow) {
5545
5555
  id
5546
5556
  slug
@@ -5607,7 +5617,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5607
5617
  }
5608
5618
  }
5609
5619
  ${GameInfoFragmentDoc}`;const SportsNavigationDocument = gql `
5610
- query SportsNavigation($first: Int, $sportFilter: Sport_filter) {
5620
+ query SportsNavigation($sportFilter: Sport_filter) {
5611
5621
  sports(where: $sportFilter, subgraphError: allow) {
5612
5622
  id
5613
5623
  slug
@@ -6950,10 +6960,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
6950
6960
  if (response.status === 404) {
6951
6961
  return null;
6952
6962
  }
6963
+ const data = await response.json();
6953
6964
  if (!response.ok) {
6954
- throw new Error(`Status ${response.status}: ${response.statusText}`);
6965
+ const error = new Error(data?.errorMessage || `Status: ${response.status}`);
6966
+ if (data?.error) {
6967
+ error.cause = new Error(data.error);
6968
+ }
6969
+ throw error;
6955
6970
  }
6956
- const data = await response.json();
6957
6971
  return data;
6958
6972
  };const createComboBet = async (props) => {
6959
6973
  const { account, amount, minOdds, nonce, clientData, bets, signature } = props;
@@ -6986,10 +7000,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
6986
7000
  if (response.status === 404) {
6987
7001
  return null;
6988
7002
  }
7003
+ const data = await response.json();
6989
7004
  if (!response.ok) {
6990
- throw new Error(`Status ${response.status}: ${response.statusText}`);
7005
+ const error = new Error(data?.errorMessage || `Status: ${response.status}`);
7006
+ if (data?.error) {
7007
+ error.cause = new Error(data.error);
7008
+ }
7009
+ throw error;
6991
7010
  }
6992
- const data = await response.json();
6993
7011
  return data;
6994
7012
  };const getBet = async ({ chainId, orderId }) => {
6995
7013
  const { api } = chainsData[chainId];
@@ -7131,7 +7149,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7131
7149
  if (!contracts.cashout?.address) {
7132
7150
  throw new Error('provided chainId is not supported for cashout');
7133
7151
  }
7134
- const response = await fetch(`${api}/cashout/get-multipliers`, {
7152
+ const response = await fetch(`${api}/cashout/get-available`, {
7135
7153
  method: 'POST',
7136
7154
  headers: {
7137
7155
  'Accept': 'application/json',
@@ -7147,10 +7165,10 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7147
7165
  if (!response.ok) {
7148
7166
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7149
7167
  }
7150
- const { multipliers } = await response.json();
7151
- return multipliers;
7168
+ const data = await response.json();
7169
+ return data;
7152
7170
  };const getCalculatedCashout = async (props) => {
7153
- const { chainId, account, graphBetId, isLive } = props;
7171
+ const { chainId, account, graphBetId } = props;
7154
7172
  const { api, environment, contracts } = chainsData[chainId];
7155
7173
  if (!contracts.cashout?.address) {
7156
7174
  throw new Error('provided chainId is not supported for cashout');
@@ -7165,7 +7183,6 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7165
7183
  environment,
7166
7184
  owner: account,
7167
7185
  betId: graphBetId,
7168
- isLive,
7169
7186
  }),
7170
7187
  });
7171
7188
  if (response.status === 404) {
@@ -7174,15 +7191,14 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7174
7191
  if (!response.ok) {
7175
7192
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7176
7193
  }
7177
- const { cashoutOdds, owner, betId, ...rest } = await response.json();
7194
+ const { owner, betId, ...rest } = await response.json();
7178
7195
  return {
7179
- multiplier: cashoutOdds,
7180
7196
  account: owner,
7181
7197
  tokenId: betId,
7182
7198
  ...rest,
7183
7199
  };
7184
7200
  };const getCashoutTypedData = (props) => {
7185
- const { account, chainId, attention, tokenId, betCoreAddress, multiplier, expiredAt } = props;
7201
+ const { account, chainId, attention, tokenId, cashoutOdds, expiredAt } = props;
7186
7202
  const { contracts } = chainsData[chainId];
7187
7203
  if (!contracts.cashout?.address) {
7188
7204
  throw new Error('provided chainId is not supported for cashout');
@@ -7204,8 +7220,8 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7204
7220
  items: [
7205
7221
  {
7206
7222
  betId: BigInt(tokenId),
7207
- bettingContract: betCoreAddress,
7208
- minOdds: typeof multiplier === 'string' ? (parseUnits(multiplier, ODDS_DECIMALS)) : multiplier,
7223
+ bettingContract: contracts.core.address,
7224
+ minOdds: typeof cashoutOdds === 'string' ? (parseUnits(cashoutOdds, ODDS_DECIMALS)) : cashoutOdds,
7209
7225
  },
7210
7226
  ],
7211
7227
  expiresAt: BigInt(expiredAt),
@@ -7219,7 +7235,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7219
7235
  CashoutState["Open"] = "OPEN";
7220
7236
  })(CashoutState || (CashoutState = {}));
7221
7237
  const createCashout = async (props) => {
7222
- const { chainId, calculationId, betCoreAddress, attention, signature } = props;
7238
+ const { chainId, calculationId, attention, signature } = props;
7223
7239
  const { api, contracts } = chainsData[chainId];
7224
7240
  if (!contracts.cashout?.address) {
7225
7241
  throw new Error('provided chainId is not supported for cashout');
@@ -7228,7 +7244,7 @@ const createCashout = async (props) => {
7228
7244
  calculationId,
7229
7245
  signature: {
7230
7246
  verifyingContract: contracts.cashout.address,
7231
- bettingContract: betCoreAddress,
7247
+ bettingContract: contracts.core.address,
7232
7248
  attention,
7233
7249
  chainId,
7234
7250
  ownerSignature: signature,
@@ -1,4 +1,4 @@
1
- import { type Hex, type Address } from 'viem';
1
+ import { type Hex } from 'viem';
2
2
  import { type ChainId } from '../../config';
3
3
  export declare enum CashoutState {
4
4
  Processing = "PROCESSING",
@@ -14,7 +14,6 @@ export type CreateCashoutResponse = {
14
14
  type Props = {
15
15
  chainId: ChainId;
16
16
  calculationId: string;
17
- betCoreAddress: Address | string;
18
17
  attention: string;
19
18
  signature: Hex;
20
19
  };
@@ -7,7 +7,7 @@ export type GetCalculatedCashout = {
7
7
  environment: Environment;
8
8
  tokenId: string;
9
9
  cashoutAmount: string;
10
- multiplier: string;
10
+ cashoutOdds: string;
11
11
  expiredAt: number;
12
12
  approveExpiredAt: number;
13
13
  isLive: boolean;
@@ -16,7 +16,6 @@ type Props = {
16
16
  chainId: ChainId;
17
17
  account: Address;
18
18
  graphBetId: string;
19
- isLive: boolean;
20
19
  };
21
20
  export declare const getCalculatedCashout: (props: Props) => Promise<GetCalculatedCashout>;
22
21
  export {};
@@ -5,8 +5,7 @@ type Props = {
5
5
  account: Address;
6
6
  attention: string;
7
7
  tokenId: string | bigint;
8
- betCoreAddress: Address;
9
- multiplier: string | bigint;
8
+ cashoutOdds: string | bigint;
10
9
  expiredAt: number;
11
10
  };
12
11
  export declare const getCashoutTypedData: (props: Props) => SignTypedDataParameters<typeof CASHOUT_DATA_TYPES>;
@@ -1,15 +1,17 @@
1
1
  import { type ChainId } from '../../config';
2
2
  type GetPrecalculatedCashoutsResponse = {
3
- multipliers: {
3
+ margin: string;
4
+ marginMin: string;
5
+ availables: {
4
6
  conditionId: string;
5
7
  available: boolean;
6
8
  outcomes: {
7
9
  outcomeId: number;
8
- multiplier: string;
10
+ price: string;
9
11
  }[];
10
12
  }[];
11
13
  };
12
- export type GetPrecalculatedCashouts = GetPrecalculatedCashoutsResponse['multipliers'] | null;
14
+ export type GetPrecalculatedCashouts = GetPrecalculatedCashoutsResponse | null;
13
15
  type Props = {
14
16
  chainId: ChainId;
15
17
  conditionIds: string[];
@@ -6,4 +6,4 @@ export declare const getBetsGraphqlEndpoint: (chainId: ChainId) => string;
6
6
  */
7
7
  export declare const getLegacyLiveGraphqlEndpoint: (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";
8
8
  export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.onchainfeed.org/v1/streams" | "wss://streams.onchainfeed.org/v1/streams";
9
- export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.onchainfeed.org/api/v1/public" | "https://api.azuro.org/api/v1/public";
9
+ 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": "5.0.0-beta.10",
3
+ "version": "5.0.0-beta.12",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",