@azuro-org/toolkit 5.0.0-beta.9 → 5.0.1

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/README.md CHANGED
@@ -13,9 +13,9 @@ npm i --save @azuro-org/toolkit
13
13
 
14
14
  ```
15
15
  @azuro-org/dictionaries@^3.0.26
16
- @wagmi/core@^2.16.7
17
- viem@^2.24.3
18
16
  graphql-tag@^2.12.6
17
+ @wagmi/core@^2.17.1
18
+ viem@^2.29.0
19
19
  ```
20
20
 
21
21
  Package information can be found in our [Doc](https://gem.azuro.org/hub/apps/toolkit/overview)
@@ -11,6 +11,7 @@ export type BetsQuery = {
11
11
  v3Bets: Array<{
12
12
  __typename?: 'V3_Bet';
13
13
  id: string;
14
+ actor: string;
14
15
  amount: string;
15
16
  status: Types.BetStatus;
16
17
  potentialPayout: string;
@@ -18,12 +19,14 @@ export type BetsQuery = {
18
19
  result?: Types.BetResult | null;
19
20
  odds: string;
20
21
  settledOdds?: string | null;
22
+ redeemedTxHash?: string | null;
21
23
  affiliate: string;
22
24
  isRedeemed: boolean;
23
25
  isRedeemable: boolean;
24
26
  isCashedOut: boolean;
25
27
  tokenId: string;
26
28
  createdAt: string;
29
+ resolvedAt?: string | null;
27
30
  txHash: string;
28
31
  core: {
29
32
  __typename?: 'CoreContract';
@@ -48,6 +51,7 @@ export type BetsQuery = {
48
51
  title?: string | null;
49
52
  status: Types.ConditionStatus;
50
53
  gameId: string;
54
+ wonOutcomeIds?: Array<string> | null;
51
55
  };
52
56
  };
53
57
  }>;
@@ -2,6 +2,7 @@ import * as Types from '../types';
2
2
  export type BetFragment = {
3
3
  __typename?: 'V3_Bet';
4
4
  id: string;
5
+ actor: string;
5
6
  amount: string;
6
7
  status: Types.BetStatus;
7
8
  potentialPayout: string;
@@ -9,12 +10,14 @@ export type BetFragment = {
9
10
  result?: Types.BetResult | null;
10
11
  odds: string;
11
12
  settledOdds?: string | null;
13
+ redeemedTxHash?: string | null;
12
14
  affiliate: string;
13
15
  isRedeemed: boolean;
14
16
  isRedeemable: boolean;
15
17
  isCashedOut: boolean;
16
18
  tokenId: string;
17
19
  createdAt: string;
20
+ resolvedAt?: string | null;
18
21
  txHash: string;
19
22
  core: {
20
23
  __typename?: 'CoreContract';
@@ -39,6 +42,7 @@ export type BetFragment = {
39
42
  title?: string | null;
40
43
  status: Types.ConditionStatus;
41
44
  gameId: string;
45
+ wonOutcomeIds?: Array<string> | null;
42
46
  };
43
47
  };
44
48
  }>;
@@ -2,6 +2,7 @@ import * as Types from '../types';
2
2
  export type LegacyLiveBetFragment = {
3
3
  __typename?: 'LiveBet';
4
4
  id: string;
5
+ actor: string;
5
6
  amount: string;
6
7
  status: Types.BetStatus;
7
8
  potentialPayout: string;
@@ -9,12 +10,14 @@ export type LegacyLiveBetFragment = {
9
10
  result?: Types.BetResult | null;
10
11
  odds: string;
11
12
  settledOdds?: string | null;
13
+ redeemedTxHash?: string | null;
12
14
  affiliate?: string | null;
13
15
  isRedeemed: boolean;
14
16
  isRedeemable: boolean;
15
17
  isCashedOut: boolean;
16
18
  tokenId: string;
17
19
  createdAt: string;
20
+ resolvedAt?: string | null;
18
21
  txHash: string;
19
22
  core: {
20
23
  __typename?: 'CoreContract';
@@ -36,6 +39,7 @@ export type LegacyLiveBetFragment = {
36
39
  conditionId: string;
37
40
  status: Types.ConditionStatus;
38
41
  gameId: string;
42
+ wonOutcomeIds?: Array<string> | null;
39
43
  };
40
44
  };
41
45
  }>;
@@ -2,6 +2,7 @@ import * as Types from '../types';
2
2
  export type LegacyPrematchBetFragment = {
3
3
  __typename?: 'Bet';
4
4
  id: string;
5
+ actor: string;
5
6
  amount: string;
6
7
  status: Types.BetStatus;
7
8
  potentialPayout: string;
@@ -9,12 +10,14 @@ export type LegacyPrematchBetFragment = {
9
10
  result?: Types.BetResult | null;
10
11
  odds: string;
11
12
  settledOdds?: string | null;
13
+ redeemedTxHash?: string | null;
12
14
  affiliate?: string | null;
13
15
  isRedeemed: boolean;
14
16
  isRedeemable: boolean;
15
17
  isCashedOut: boolean;
16
18
  tokenId: string;
17
19
  createdAt: string;
20
+ resolvedAt?: string | null;
18
21
  txHash: string;
19
22
  core: {
20
23
  __typename?: 'CoreContract';
@@ -37,6 +40,7 @@ export type LegacyPrematchBetFragment = {
37
40
  conditionId: string;
38
41
  status: Types.ConditionStatus;
39
42
  title?: string | null;
43
+ wonOutcomeIds?: Array<string> | null;
40
44
  game: {
41
45
  __typename?: 'Game';
42
46
  id: string;
@@ -10,6 +10,7 @@ export type GameBetsQuery = {
10
10
  rawAmount: string;
11
11
  rawPotentialPayout: string;
12
12
  result?: Types.BetResult | null;
13
+ status: Types.BetStatus;
13
14
  isCashedOut: boolean;
14
15
  selections: Array<{
15
16
  __typename?: 'Selection';
@@ -37,6 +38,7 @@ export type GameBetsQuery = {
37
38
  rawAmount: string;
38
39
  rawPotentialPayout: string;
39
40
  result?: Types.BetResult | null;
41
+ status: Types.BetStatus;
40
42
  isCashedOut: boolean;
41
43
  selections: Array<{
42
44
  __typename?: 'LiveSelection';
@@ -55,6 +57,7 @@ export type GameBetsQuery = {
55
57
  rawAmount: string;
56
58
  rawPotentialPayout: string;
57
59
  result?: Types.BetResult | null;
60
+ status: Types.BetStatus;
58
61
  isCashedOut: boolean;
59
62
  selections: Array<{
60
63
  __typename?: 'V3_Selection';
@@ -11,6 +11,7 @@ export type LegacyBetsQuery = {
11
11
  bets: Array<{
12
12
  __typename?: 'Bet';
13
13
  id: string;
14
+ actor: string;
14
15
  amount: string;
15
16
  status: Types.BetStatus;
16
17
  potentialPayout: string;
@@ -18,12 +19,14 @@ export type LegacyBetsQuery = {
18
19
  result?: Types.BetResult | null;
19
20
  odds: string;
20
21
  settledOdds?: string | null;
22
+ redeemedTxHash?: string | null;
21
23
  affiliate?: string | null;
22
24
  isRedeemed: boolean;
23
25
  isRedeemable: boolean;
24
26
  isCashedOut: boolean;
25
27
  tokenId: string;
26
28
  createdAt: string;
29
+ resolvedAt?: string | null;
27
30
  txHash: string;
28
31
  core: {
29
32
  __typename?: 'CoreContract';
@@ -46,6 +49,7 @@ export type LegacyBetsQuery = {
46
49
  conditionId: string;
47
50
  status: Types.ConditionStatus;
48
51
  title?: string | null;
52
+ wonOutcomeIds?: Array<string> | null;
49
53
  game: {
50
54
  __typename?: 'Game';
51
55
  id: string;
@@ -97,6 +101,7 @@ export type LegacyBetsQuery = {
97
101
  liveBets: Array<{
98
102
  __typename?: 'LiveBet';
99
103
  id: string;
104
+ actor: string;
100
105
  amount: string;
101
106
  status: Types.BetStatus;
102
107
  potentialPayout: string;
@@ -104,12 +109,14 @@ export type LegacyBetsQuery = {
104
109
  result?: Types.BetResult | null;
105
110
  odds: string;
106
111
  settledOdds?: string | null;
112
+ redeemedTxHash?: string | null;
107
113
  affiliate?: string | null;
108
114
  isRedeemed: boolean;
109
115
  isRedeemable: boolean;
110
116
  isCashedOut: boolean;
111
117
  tokenId: string;
112
118
  createdAt: string;
119
+ resolvedAt?: string | null;
113
120
  txHash: string;
114
121
  core: {
115
122
  __typename?: 'CoreContract';
@@ -131,6 +138,7 @@ export type LegacyBetsQuery = {
131
138
  conditionId: string;
132
139
  status: Types.ConditionStatus;
133
140
  gameId: string;
141
+ wonOutcomeIds?: Array<string> | null;
134
142
  };
135
143
  };
136
144
  }>;
@@ -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 = {
@@ -88,6 +88,7 @@ export type Condition = {
88
88
  game: Game;
89
89
  /** Condition Id */
90
90
  id: Scalars['ID']['output'];
91
+ isCashoutEnabled: Scalars['Boolean']['output'];
91
92
  isExpressForbidden: Scalars['Boolean']['output'];
92
93
  isLiveEnabled: Scalars['Boolean']['output'];
93
94
  isPrematchEnabled: Scalars['Boolean']['output'];
@@ -243,6 +244,10 @@ export type Condition_Filter = {
243
244
  id_lte?: InputMaybe<Scalars['ID']['input']>;
244
245
  id_not?: InputMaybe<Scalars['ID']['input']>;
245
246
  id_not_in?: InputMaybe<Array<Scalars['ID']['input']>>;
247
+ isCashoutEnabled?: InputMaybe<Scalars['Boolean']['input']>;
248
+ isCashoutEnabled_in?: InputMaybe<Array<Scalars['Boolean']['input']>>;
249
+ isCashoutEnabled_not?: InputMaybe<Scalars['Boolean']['input']>;
250
+ isCashoutEnabled_not_in?: InputMaybe<Array<Scalars['Boolean']['input']>>;
246
251
  isExpressForbidden?: InputMaybe<Scalars['Boolean']['input']>;
247
252
  isExpressForbidden_in?: InputMaybe<Array<Scalars['Boolean']['input']>>;
248
253
  isExpressForbidden_not?: InputMaybe<Scalars['Boolean']['input']>;
@@ -401,6 +406,7 @@ export declare enum Condition_OrderBy {
401
406
  Description = "description",
402
407
  Game = "game",
403
408
  Id = "id",
409
+ IsCashoutEnabled = "isCashoutEnabled",
404
410
  IsExpressForbidden = "isExpressForbidden",
405
411
  IsLiveEnabled = "isLiveEnabled",
406
412
  IsPrematchEnabled = "isPrematchEnabled",
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,8 @@ 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) => (`https://thegraph-1.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
4833
+ const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.onchainfeed.org/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
4834
4834
  /**
4835
4835
  * @deprecated Only for v2 feed
4836
4836
  */
@@ -4859,7 +4859,7 @@ const getApiEndpoint = (chainId) => {
4859
4859
  // if (chainId === polygonAmoy.id) {
4860
4860
  // return 'https://preprod-api.azuro.org/api/v1/public'
4861
4861
  // }
4862
- return 'https://api.azuro.org/api/v1/public';
4862
+ return 'https://api.onchainfeed.org/api/v1/public';
4863
4863
  };const ODDS_DECIMALS = 12;
4864
4864
  const MIN_BET_AMOUNT = 1;
4865
4865
  const CLIENT_DATA_TYPES = [
@@ -4929,11 +4929,11 @@ const gnosisData = {
4929
4929
  api: getApiEndpoint(gnosis.id),
4930
4930
  environment: environments[gnosis.id],
4931
4931
  contracts: setupContracts({
4932
- lp: '0x204e7371Ade792c5C006fb52711c50a7efC843ed',
4933
- core: '0x7f3F3f19c4e4015fd9Db2f22e653c766154091EF',
4934
- relayer: '0x936c02503A32aA23BCF7CFaF5c29100b0F93FCfe',
4935
- azuroBet: '0xA3A1B460c68dc91c5B3f71f5487A76fac42858bf',
4936
- cashout: '0x7145e4690A8846d5457D7352625e26b6A605a5AF',
4932
+ lp: '0xeb7cDA87D00d677A6Dc73EB569723b0fA51D97E7',
4933
+ core: '0x0e00E6ffcb5E207B800eec9e02999D1Fd9e448f2',
4934
+ relayer: '0x40eb85018fA18dDd10a433C8c40ca8D6744d8B32',
4935
+ azuroBet: '0xd7cd9342A14962C2dCB14569CB6fcA2759999089',
4936
+ cashout: '0x25de227af58188e656524d1C32cCf7C078cdC891',
4937
4937
  }),
4938
4938
  betToken: {
4939
4939
  address: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
@@ -4975,11 +4975,11 @@ const polygonData = {
4975
4975
  api: getApiEndpoint(polygon.id),
4976
4976
  environment: environments[polygon.id],
4977
4977
  contracts: setupContracts({
4978
- lp: '0x7043E4e1c4045424858ECBCED80989FeAfC11B36',
4979
- core: '0xA40F8D69D412b79b49EAbdD5cf1b5706395bfCf7',
4980
- relayer: '0xC6BB817a7f02874F360d135D880200A2E440207D',
4981
- azuroBet: '0x8ed7296b5CAe379d07C70280Af622BC410F01Ed7',
4982
- cashout: '0x365f97EE637f7a9260838F7d2a3601EA800627bE',
4978
+ lp: '0x0FA7FB5407eA971694652E6E16C12A52625DE1b8',
4979
+ core: '0xF9548Be470A4e130c90ceA8b179FCD66D2972AC7',
4980
+ relayer: '0x8dA05c0021e6b35865FDC959c54dCeF3A4AbBa9d',
4981
+ azuroBet: '0x7A1c3FEf712753374C4DCe34254B96faF2B7265B',
4982
+ cashout: '0x4a2BB4211cCF9b9eA6eF01D0a61448154ED19095',
4983
4983
  }),
4984
4984
  betToken: {
4985
4985
  address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
@@ -5044,14 +5044,14 @@ const chilizData = {
5044
5044
  api: getApiEndpoint(chiliz.id),
5045
5045
  environment: environments[chiliz.id],
5046
5046
  contracts: setupContracts({
5047
- lp: '0x431A0993d29eEb0fF7e3FE351A303eF72195431a',
5048
- core: '0x524994dcA5EA2bc979ac5506E7195F28B4c16932',
5049
- relayer: '0x725ec0A9eC9dC993A86d0eFD7fD78929d226AbE7',
5050
- azuroBet: '0xF7815889e5d0635A31eca34390b25d8D2cEeD902',
5051
- cashout: '0x7c771a200EcD61A01af992360303f7b1465Cd8e3',
5047
+ lp: '0xEf6b12580301b04CD2551182C88623524B6e47b8',
5048
+ core: '0xa5061617Ee6565CF48d7f0FEF06910b9fb9dE2b0',
5049
+ relayer: '0x81F72B93ABaf061535aaF5D831F05e0CC4084b32',
5050
+ azuroBet: '0x3777B4F27F4B36f14454dbB1f79278bcba694B52',
5051
+ cashout: '0x3995eebB51793Ee353162E7400DB455B17dE3692',
5052
5052
  }),
5053
5053
  betToken: {
5054
- address: '0x721EF6871f1c4Efe730Dce047D40D1743B886946',
5054
+ address: '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47',
5055
5055
  symbol: 'WCHZ',
5056
5056
  decimals: 18,
5057
5057
  },
@@ -5113,11 +5113,11 @@ const baseData = {
5113
5113
  api: getApiEndpoint(base.id),
5114
5114
  environment: environments[base.id],
5115
5115
  contracts: setupContracts({
5116
- lp: '0xF22E9e29728d6592eB54b916Ba9f464d9F237dB1',
5117
- core: '0xf5A6B7940cbdb80F294f1eAc59575562966aa3FC',
5118
- relayer: '0x4731Bb0D12c4f992Cf02BDc7A48e8656d0E382Ed',
5119
- azuroBet: '0x9Ce099D680401763f9Cb160c8eAc3E5f8307314e',
5120
- cashout: '0xFffF9220288787B24276135E58C0BF68D803F0ad',
5116
+ lp: '0x1eD7368bc515E928A4007cEa61FB8a6F8863Af87',
5117
+ core: '0xF40cF1dD7d16C098cff5F8B5650A8FaEf1F4640d',
5118
+ relayer: '0xD2D508d66dB4fCE4B384e4C3EA2fa53BA43e73b5',
5119
+ azuroBet: '0xF328404Dbc8c997d12dC55a1A179AF7F8cb7df90',
5120
+ cashout: '0x6EDff24761F4473611B45BDAe4a779ff31af14Be',
5121
5121
  }),
5122
5122
  betToken: {
5123
5123
  address: '0x4200000000000000000000000000000000000006',
@@ -5170,6 +5170,7 @@ const chainsDataByEnv = {
5170
5170
  fragment LegacyLiveBet on LiveBet {
5171
5171
  id
5172
5172
  tokenId: betId
5173
+ actor
5173
5174
  amount
5174
5175
  status
5175
5176
  potentialPayout
@@ -5178,7 +5179,9 @@ const chainsDataByEnv = {
5178
5179
  odds
5179
5180
  settledOdds
5180
5181
  createdAt: createdBlockTimestamp
5182
+ resolvedAt: resolvedBlockTimestamp
5181
5183
  txHash: createdTxHash
5184
+ redeemedTxHash
5182
5185
  affiliate
5183
5186
  isRedeemed
5184
5187
  isRedeemable
@@ -5198,6 +5201,7 @@ const chainsDataByEnv = {
5198
5201
  conditionId
5199
5202
  status
5200
5203
  gameId
5204
+ wonOutcomeIds
5201
5205
  }
5202
5206
  }
5203
5207
  }
@@ -5209,6 +5213,7 @@ const chainsDataByEnv = {
5209
5213
  fragment LegacyPrematchBet on Bet {
5210
5214
  id
5211
5215
  tokenId: betId
5216
+ actor
5212
5217
  amount
5213
5218
  status
5214
5219
  potentialPayout
@@ -5217,7 +5222,9 @@ const chainsDataByEnv = {
5217
5222
  odds
5218
5223
  settledOdds
5219
5224
  createdAt: createdBlockTimestamp
5225
+ resolvedAt: resolvedBlockTimestamp
5220
5226
  txHash: createdTxHash
5227
+ redeemedTxHash
5221
5228
  affiliate
5222
5229
  isRedeemed
5223
5230
  isRedeemable
@@ -5238,6 +5245,7 @@ const chainsDataByEnv = {
5238
5245
  conditionId
5239
5246
  status
5240
5247
  title
5248
+ wonOutcomeIds
5241
5249
  game {
5242
5250
  id
5243
5251
  gameId
@@ -5282,6 +5290,7 @@ const chainsDataByEnv = {
5282
5290
  fragment Bet on V3_Bet {
5283
5291
  id
5284
5292
  tokenId: betId
5293
+ actor
5285
5294
  amount
5286
5295
  status
5287
5296
  potentialPayout
@@ -5290,7 +5299,9 @@ const chainsDataByEnv = {
5290
5299
  odds
5291
5300
  settledOdds
5292
5301
  createdAt: createdBlockTimestamp
5302
+ resolvedAt: resolvedBlockTimestamp
5293
5303
  txHash: createdTxHash
5304
+ redeemedTxHash
5294
5305
  affiliate
5295
5306
  isRedeemed
5296
5307
  isRedeemable
@@ -5313,6 +5324,7 @@ const chainsDataByEnv = {
5313
5324
  title
5314
5325
  status
5315
5326
  gameId
5327
+ wonOutcomeIds
5316
5328
  }
5317
5329
  }
5318
5330
  }
@@ -5360,6 +5372,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5360
5372
  rawAmount
5361
5373
  rawPotentialPayout
5362
5374
  result
5375
+ status
5363
5376
  isCashedOut
5364
5377
  selections {
5365
5378
  rawOdds
@@ -5381,6 +5394,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5381
5394
  rawAmount
5382
5395
  rawPotentialPayout
5383
5396
  result
5397
+ status
5384
5398
  isCashedOut
5385
5399
  selections {
5386
5400
  outcome {
@@ -5391,10 +5405,11 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5391
5405
  }
5392
5406
  }
5393
5407
  }
5394
- v3Bets(where: {_gamesIds: [$gameId], actor: $actor}) {
5408
+ v3Bets(where: {_gamesIds_contains: [$gameId], actor: $actor}) {
5395
5409
  rawAmount
5396
5410
  rawPotentialPayout
5397
5411
  result
5412
+ status
5398
5413
  isCashedOut
5399
5414
  selections {
5400
5415
  rawOdds
@@ -5528,7 +5543,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5528
5543
  }
5529
5544
  }
5530
5545
  ${GameInfoFragmentDoc}`;const NavigationDocument = gql `
5531
- query Navigation($first: Int, $sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
5546
+ query Navigation($sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
5532
5547
  sports(where: $sportFilter, subgraphError: allow) {
5533
5548
  id
5534
5549
  slug
@@ -5595,7 +5610,7 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
5595
5610
  }
5596
5611
  }
5597
5612
  ${GameInfoFragmentDoc}`;const SportsNavigationDocument = gql `
5598
- query SportsNavigation($first: Int, $sportFilter: Sport_filter) {
5613
+ query SportsNavigation($sportFilter: Sport_filter) {
5599
5614
  sports(where: $sportFilter, subgraphError: allow) {
5600
5615
  id
5601
5616
  slug
@@ -6441,6 +6456,7 @@ var Condition_OrderBy;
6441
6456
  Condition_OrderBy["Description"] = "description";
6442
6457
  Condition_OrderBy["Game"] = "game";
6443
6458
  Condition_OrderBy["Id"] = "id";
6459
+ Condition_OrderBy["IsCashoutEnabled"] = "isCashoutEnabled";
6444
6460
  Condition_OrderBy["IsExpressForbidden"] = "isExpressForbidden";
6445
6461
  Condition_OrderBy["IsLiveEnabled"] = "isLiveEnabled";
6446
6462
  Condition_OrderBy["IsPrematchEnabled"] = "isPrematchEnabled";
@@ -6937,10 +6953,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
6937
6953
  if (response.status === 404) {
6938
6954
  return null;
6939
6955
  }
6956
+ const data = await response.json();
6940
6957
  if (!response.ok) {
6941
- throw new Error(`Status ${response.status}: ${response.statusText}`);
6958
+ const error = new Error(data?.errorMessage || `Status: ${response.status}`);
6959
+ if (data?.error) {
6960
+ error.cause = new Error(data.error);
6961
+ }
6962
+ throw error;
6942
6963
  }
6943
- const data = await response.json();
6944
6964
  return data;
6945
6965
  };const createComboBet = async (props) => {
6946
6966
  const { account, amount, minOdds, nonce, clientData, bets, signature } = props;
@@ -6973,10 +6993,14 @@ const getFreeBets = async ({ chainId, account, affiliate }) => {
6973
6993
  if (response.status === 404) {
6974
6994
  return null;
6975
6995
  }
6996
+ const data = await response.json();
6976
6997
  if (!response.ok) {
6977
- throw new Error(`Status ${response.status}: ${response.statusText}`);
6998
+ const error = new Error(data?.errorMessage || `Status: ${response.status}`);
6999
+ if (data?.error) {
7000
+ error.cause = new Error(data.error);
7001
+ }
7002
+ throw error;
6978
7003
  }
6979
- const data = await response.json();
6980
7004
  return data;
6981
7005
  };const getBet = async ({ chainId, orderId }) => {
6982
7006
  const { api } = chainsData[chainId];
@@ -7118,7 +7142,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7118
7142
  if (!contracts.cashout?.address) {
7119
7143
  throw new Error('provided chainId is not supported for cashout');
7120
7144
  }
7121
- const response = await fetch(`${api}/cashout/get-multipliers`, {
7145
+ const response = await fetch(`${api}/cashout/get-available`, {
7122
7146
  method: 'POST',
7123
7147
  headers: {
7124
7148
  'Accept': 'application/json',
@@ -7134,10 +7158,10 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7134
7158
  if (!response.ok) {
7135
7159
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7136
7160
  }
7137
- const { multipliers } = await response.json();
7138
- return multipliers;
7161
+ const data = await response.json();
7162
+ return data;
7139
7163
  };const getCalculatedCashout = async (props) => {
7140
- const { chainId, account, graphBetId, isLive } = props;
7164
+ const { chainId, account, graphBetId } = props;
7141
7165
  const { api, environment, contracts } = chainsData[chainId];
7142
7166
  if (!contracts.cashout?.address) {
7143
7167
  throw new Error('provided chainId is not supported for cashout');
@@ -7152,7 +7176,6 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7152
7176
  environment,
7153
7177
  owner: account,
7154
7178
  betId: graphBetId,
7155
- isLive,
7156
7179
  }),
7157
7180
  });
7158
7181
  if (response.status === 404) {
@@ -7161,15 +7184,14 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7161
7184
  if (!response.ok) {
7162
7185
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7163
7186
  }
7164
- const { cashoutOdds, owner, betId, ...rest } = await response.json();
7187
+ const { owner, betId, ...rest } = await response.json();
7165
7188
  return {
7166
- multiplier: cashoutOdds,
7167
7189
  account: owner,
7168
7190
  tokenId: betId,
7169
7191
  ...rest,
7170
7192
  };
7171
7193
  };const getCashoutTypedData = (props) => {
7172
- const { account, chainId, attention, tokenId, betCoreAddress, multiplier, expiredAt } = props;
7194
+ const { account, chainId, attention, tokenId, cashoutOdds, expiredAt } = props;
7173
7195
  const { contracts } = chainsData[chainId];
7174
7196
  if (!contracts.cashout?.address) {
7175
7197
  throw new Error('provided chainId is not supported for cashout');
@@ -7191,8 +7213,8 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7191
7213
  items: [
7192
7214
  {
7193
7215
  betId: BigInt(tokenId),
7194
- bettingContract: betCoreAddress,
7195
- minOdds: typeof multiplier === 'string' ? (parseUnits(multiplier, ODDS_DECIMALS)) : multiplier,
7216
+ bettingContract: contracts.core.address,
7217
+ minOdds: typeof cashoutOdds === 'string' ? (parseUnits(cashoutOdds, ODDS_DECIMALS)) : cashoutOdds,
7196
7218
  },
7197
7219
  ],
7198
7220
  expiresAt: BigInt(expiredAt),
@@ -7206,7 +7228,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7206
7228
  CashoutState["Open"] = "OPEN";
7207
7229
  })(CashoutState || (CashoutState = {}));
7208
7230
  const createCashout = async (props) => {
7209
- const { chainId, calculationId, betCoreAddress, attention, signature } = props;
7231
+ const { chainId, calculationId, attention, signature } = props;
7210
7232
  const { api, contracts } = chainsData[chainId];
7211
7233
  if (!contracts.cashout?.address) {
7212
7234
  throw new Error('provided chainId is not supported for cashout');
@@ -7215,7 +7237,7 @@ const createCashout = async (props) => {
7215
7237
  calculationId,
7216
7238
  signature: {
7217
7239
  verifyingContract: contracts.cashout.address,
7218
- bettingContract: betCoreAddress,
7240
+ bettingContract: contracts.core.address,
7219
7241
  attention,
7220
7242
  chainId,
7221
7243
  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.9",
3
+ "version": "5.0.1",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,8 +41,8 @@
41
41
  "peerDependencies": {
42
42
  "@azuro-org/dictionaries": "^3.0.26",
43
43
  "graphql-tag": "^2.12.6",
44
- "@wagmi/core": "^2.16.7",
45
- "viem": "^2.24.3"
44
+ "@wagmi/core": "^2.17.1",
45
+ "viem": "^2.29.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@babel/core": "^7.17.0",