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

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.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',
@@ -7131,7 +7141,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7131
7141
  if (!contracts.cashout?.address) {
7132
7142
  throw new Error('provided chainId is not supported for cashout');
7133
7143
  }
7134
- const response = await fetch(`${api}/cashout/get-multipliers`, {
7144
+ const response = await fetch(`${api}/cashout/get-available`, {
7135
7145
  method: 'POST',
7136
7146
  headers: {
7137
7147
  'Accept': 'application/json',
@@ -7147,10 +7157,10 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7147
7157
  if (!response.ok) {
7148
7158
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7149
7159
  }
7150
- const { multipliers } = await response.json();
7151
- return multipliers;
7160
+ const data = await response.json();
7161
+ return data;
7152
7162
  };const getCalculatedCashout = async (props) => {
7153
- const { chainId, account, graphBetId, isLive } = props;
7163
+ const { chainId, account, graphBetId } = props;
7154
7164
  const { api, environment, contracts } = chainsData[chainId];
7155
7165
  if (!contracts.cashout?.address) {
7156
7166
  throw new Error('provided chainId is not supported for cashout');
@@ -7165,7 +7175,6 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7165
7175
  environment,
7166
7176
  owner: account,
7167
7177
  betId: graphBetId,
7168
- isLive,
7169
7178
  }),
7170
7179
  });
7171
7180
  if (response.status === 404) {
@@ -7174,15 +7183,14 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7174
7183
  if (!response.ok) {
7175
7184
  throw new Error(`Status ${response.status}: ${response.statusText}`);
7176
7185
  }
7177
- const { cashoutOdds, owner, betId, ...rest } = await response.json();
7186
+ const { owner, betId, ...rest } = await response.json();
7178
7187
  return {
7179
- multiplier: cashoutOdds,
7180
7188
  account: owner,
7181
7189
  tokenId: betId,
7182
7190
  ...rest,
7183
7191
  };
7184
7192
  };const getCashoutTypedData = (props) => {
7185
- const { account, chainId, attention, tokenId, betCoreAddress, multiplier, expiredAt } = props;
7193
+ const { account, chainId, attention, tokenId, cashoutOdds, expiredAt } = props;
7186
7194
  const { contracts } = chainsData[chainId];
7187
7195
  if (!contracts.cashout?.address) {
7188
7196
  throw new Error('provided chainId is not supported for cashout');
@@ -7204,8 +7212,8 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7204
7212
  items: [
7205
7213
  {
7206
7214
  betId: BigInt(tokenId),
7207
- bettingContract: betCoreAddress,
7208
- minOdds: typeof multiplier === 'string' ? (parseUnits(multiplier, ODDS_DECIMALS)) : multiplier,
7215
+ bettingContract: contracts.core.address,
7216
+ minOdds: typeof cashoutOdds === 'string' ? (parseUnits(cashoutOdds, ODDS_DECIMALS)) : cashoutOdds,
7209
7217
  },
7210
7218
  ],
7211
7219
  expiresAt: BigInt(expiredAt),
@@ -7219,7 +7227,7 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
7219
7227
  CashoutState["Open"] = "OPEN";
7220
7228
  })(CashoutState || (CashoutState = {}));
7221
7229
  const createCashout = async (props) => {
7222
- const { chainId, calculationId, betCoreAddress, attention, signature } = props;
7230
+ const { chainId, calculationId, attention, signature } = props;
7223
7231
  const { api, contracts } = chainsData[chainId];
7224
7232
  if (!contracts.cashout?.address) {
7225
7233
  throw new Error('provided chainId is not supported for cashout');
@@ -7228,7 +7236,7 @@ const createCashout = async (props) => {
7228
7236
  calculationId,
7229
7237
  signature: {
7230
7238
  verifyingContract: contracts.cashout.address,
7231
- bettingContract: betCoreAddress,
7239
+ bettingContract: contracts.core.address,
7232
7240
  attention,
7233
7241
  chainId,
7234
7242
  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.11",
4
4
  "description": "Set of helpers to work with Azuro protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",