@azuro-org/toolkit 4.5.4 → 5.0.0-beta.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.
Files changed (67) hide show
  1. package/README.md +3 -3
  2. package/dist/abis/{PrematchComboCore.d.ts → AzuroBet.d.ts} +158 -319
  3. package/dist/abis/Cashback.d.ts +302 -0
  4. package/dist/abis/Cashout.d.ts +424 -0
  5. package/dist/abis/{PrematchCore.d.ts → Core.d.ts} +548 -340
  6. package/dist/abis/LP.d.ts +218 -650
  7. package/dist/abis/Relayer.d.ts +393 -0
  8. package/dist/abis/index.d.ts +4 -4
  9. package/dist/config.d.ts +78 -15
  10. package/dist/docs/bets/bets.d.ts +64 -0
  11. package/dist/docs/bets/fragments/bet.d.ts +54 -0
  12. package/dist/docs/{prematch/fragments/liveBet.d.ts → bets/fragments/legacyLiveBet.d.ts} +2 -2
  13. package/dist/docs/{prematch/fragments/prematchBet.d.ts → bets/fragments/legacyPrematchBet.d.ts} +2 -2
  14. package/dist/docs/{prematch → bets}/gameBets.d.ts +2 -0
  15. package/dist/docs/{prematch/liveBets.d.ts → bets/legacyLiveBets.d.ts} +3 -3
  16. package/dist/docs/{prematch/prematchBets.d.ts → bets/legacyPrematchBets.d.ts} +3 -3
  17. package/dist/docs/{prematch → bets}/types.d.ts +1719 -15
  18. package/dist/docs/{prematch → feed}/condition.d.ts +6 -13
  19. package/dist/docs/{live → feed}/conditions.d.ts +10 -4
  20. package/dist/docs/{prematch → feed}/conditionsBatch.d.ts +4 -4
  21. package/dist/docs/{prematch → feed}/fragments/condition.d.ts +5 -12
  22. package/dist/docs/feed/fragments/gameInfo.d.ts +31 -0
  23. package/dist/docs/{prematch → feed}/game.d.ts +10 -10
  24. package/dist/docs/{prematch → feed}/games.d.ts +7 -7
  25. package/dist/docs/{prematch → feed}/navigation.d.ts +13 -6
  26. package/dist/docs/{prematch → feed}/sports.d.ts +7 -7
  27. package/dist/docs/{prematch → feed}/sportsNavigation.d.ts +3 -6
  28. package/dist/docs/{live → feed}/types.d.ts +1024 -462
  29. package/dist/docs/index.d.ts +21 -22
  30. package/dist/global.d.ts +16 -10
  31. package/dist/index.d.ts +9 -13
  32. package/dist/index.js +3817 -3199
  33. package/dist/utils/cashback/createCashbackTransaction.d.ts +0 -0
  34. package/dist/utils/cashback/getCashbackBalance.d.ts +0 -0
  35. package/dist/utils/createBet.d.ts +16 -0
  36. package/dist/utils/createComboBet.d.ts +16 -0
  37. package/dist/utils/getBet.d.ts +23 -0
  38. package/dist/utils/{getLiveBetFee.d.ts → getBetFee.d.ts} +2 -2
  39. package/dist/utils/getBetStatus.d.ts +6 -4
  40. package/dist/utils/getBetTypedData.d.ts +16 -0
  41. package/dist/utils/getComboBetTypedData.d.ts +16 -0
  42. package/dist/utils/getEndpoints.d.ts +4 -4
  43. package/dist/utils/getFreebets.d.ts +1 -1
  44. package/dist/utils/getIsPendingResolution.d.ts +7 -0
  45. package/dist/utils/getMaxBet.d.ts +17 -0
  46. package/dist/utils/groupConditionsByMarket.d.ts +13 -11
  47. package/dist/utils/setupContracts.d.ts +11 -24
  48. package/package.json +4 -4
  49. package/dist/abis/LiveCore.d.ts +0 -694
  50. package/dist/abis/ProxyFront.d.ts +0 -137
  51. package/dist/docs/live/condition.d.ts +0 -26
  52. package/dist/docs/live/fragments/condition.d.ts +0 -20
  53. package/dist/docs/prematch/conditions.d.ts +0 -42
  54. package/dist/utils/calcOdds.d.ts +0 -28
  55. package/dist/utils/createLiveBet.d.ts +0 -23
  56. package/dist/utils/deBridge/createDeBridgeBet.d.ts +0 -65
  57. package/dist/utils/deBridge/getDeBridgeOrder.d.ts +0 -39
  58. package/dist/utils/deBridge/getDeBridgeSupportedChains.d.ts +0 -11
  59. package/dist/utils/deBridge/getDeBridgeSupportedTokens.d.ts +0 -13
  60. package/dist/utils/getGameStatus.d.ts +0 -16
  61. package/dist/utils/getLiveBet.d.ts +0 -13
  62. package/dist/utils/getLiveBetTypedData.d.ts +0 -10
  63. package/dist/utils/getPrematchBetDataBytes.d.ts +0 -3
  64. package/dist/utils/groupByConditionId.d.ts +0 -5
  65. /package/dist/docs/{prematch → bets}/bettors.d.ts +0 -0
  66. /package/dist/docs/{prematch → bets}/fragments/bettor.d.ts +0 -0
  67. /package/dist/docs/{prematch → bets}/fragments/mainGameInfo.d.ts +0 -0
File without changes
@@ -0,0 +1,16 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ import { type CreateBetResponse, type BetClientData } from '../global';
3
+ type Props = {
4
+ account: Address;
5
+ clientData: BetClientData;
6
+ bet: {
7
+ conditionId: string | bigint;
8
+ outcomeId: string | number | bigint;
9
+ minOdds: string | bigint;
10
+ amount: string | bigint;
11
+ nonce: string | number | bigint;
12
+ };
13
+ signature: Hex;
14
+ };
15
+ export declare const createBet: (props: Props) => Promise<CreateBetResponse | null>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ import { type CreateBetResponse, type BetClientData } from '../global';
3
+ type Props = {
4
+ account: Address;
5
+ amount: string | bigint;
6
+ minOdds: string | bigint;
7
+ nonce: string | number | bigint;
8
+ clientData: BetClientData;
9
+ bets: {
10
+ conditionId: string | bigint;
11
+ outcomeId: string | number | bigint;
12
+ }[];
13
+ signature: Hex;
14
+ };
15
+ export declare const createComboBet: (props: Props) => Promise<CreateBetResponse | null>;
16
+ export {};
@@ -0,0 +1,23 @@
1
+ import { type CreateBetResponse } from '../global';
2
+ import { type ChainId } from '../config';
3
+ import { type Environment } from '../envs';
4
+ export type GetBetResponse = {
5
+ txHash: string;
6
+ odds: number;
7
+ clearOdds: number;
8
+ betId: number;
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ core: string;
12
+ bettor: string;
13
+ affiliate: string;
14
+ stake: number;
15
+ maxStake: number;
16
+ environment: Environment;
17
+ } & CreateBetResponse;
18
+ type Props = {
19
+ chainId: ChainId;
20
+ orderId: string;
21
+ };
22
+ export declare const getBet: ({ chainId, orderId }: Props) => Promise<GetBetResponse | null>;
23
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { type ChainId } from '../config';
2
- export type LiveBetFeeResponse = {
2
+ export type BetFeeResponse = {
3
3
  gasLimit: number;
4
4
  gasPrice: number;
5
5
  betTokenRate: number;
@@ -11,4 +11,4 @@ export type LiveBetFeeResponse = {
11
11
  symbol: string;
12
12
  decimals: number;
13
13
  };
14
- export declare const getLiveBetFee: (chainId: ChainId) => Promise<LiveBetFeeResponse>;
14
+ export declare const getBetFee: (chainId: ChainId) => Promise<BetFeeResponse>;
@@ -1,5 +1,5 @@
1
- import { BetStatus as GraphBetStatus } from '../docs/prematch/types';
2
- import { type GameQuery } from '../docs/prematch/game';
1
+ import { GameState } from '../docs/feed/types';
2
+ import { BetStatus as GraphBetStatus } from '../docs/bets/types';
3
3
  export declare enum BetStatus {
4
4
  Accepted = 0,
5
5
  Live = 1,
@@ -7,11 +7,13 @@ export declare enum BetStatus {
7
7
  Resolved = 3,
8
8
  Canceled = 4
9
9
  }
10
- type Game = Pick<GameQuery['games'][0], 'status' | 'startsAt'>;
10
+ type Game = {
11
+ state: GameState;
12
+ startsAt: string;
13
+ };
11
14
  type Props = {
12
15
  games: Game[];
13
16
  graphStatus: GraphBetStatus;
14
- isLiveBet: boolean;
15
17
  };
16
18
  export declare const getBetStatus: (props: Props) => BetStatus;
17
19
  export {};
@@ -0,0 +1,16 @@
1
+ import { type SignTypedDataParameters, type Address } from 'viem';
2
+ import { BET_DATA_TYPES } from '../config';
3
+ import { type BetClientData } from '../global';
4
+ type Props = {
5
+ account: Address;
6
+ clientData: BetClientData;
7
+ bet: {
8
+ conditionId: string | bigint;
9
+ outcomeId: string | bigint;
10
+ minOdds: string | bigint;
11
+ amount: string | bigint;
12
+ nonce: string | bigint;
13
+ };
14
+ };
15
+ export declare const getBetTypedData: (props: Props) => SignTypedDataParameters<typeof BET_DATA_TYPES>;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type SignTypedDataParameters, type Address } from 'viem';
2
+ import { COMBO_BET_DATA_TYPES } from '../config';
3
+ import { type BetClientData } from '../global';
4
+ type Props = {
5
+ account: Address;
6
+ minOdds: string | bigint;
7
+ amount: string | bigint;
8
+ nonce: string | bigint;
9
+ clientData: BetClientData;
10
+ bets: {
11
+ conditionId: string | bigint;
12
+ outcomeId: string | bigint;
13
+ }[];
14
+ };
15
+ export declare const getComboBetTypedData: (props: Props) => SignTypedDataParameters<typeof COMBO_BET_DATA_TYPES>;
16
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { type ChainId } from '../config';
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-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" | "wss://preprod-streams.azuro.org/v1/streams" | "wss://streams.azuro.org/v1/streams";
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";
2
+ export declare const getFeedGraphqlEndpoint: (chainId: ChainId) => string;
3
+ export declare const getBetsGraphqlEndpoint: (chainId: ChainId) => string;
4
+ export declare const getSocketEndpoint: (chainId: ChainId) => "wss://dev-streams.onchainfeed.org/v1/streams" | "wss://preprod-streams.azuro.org/v1/streams" | "wss://streams.onchainfeed.org/v1/streams";
5
+ export declare const getApiEndpoint: (chainId: ChainId) => "https://dev-api.onchainfeed.org/api/v1/public" | "https://preprod-api.azuro.org/api/v1/public" | "https://api.azuro.org/api/v1/public";
@@ -31,5 +31,5 @@ type Props = {
31
31
  account: Address;
32
32
  affiliate: Address;
33
33
  };
34
- export declare const getFreeBets: ({ chainId, account, affiliate }: Props) => Promise<FreeBet[] | null>;
34
+ export declare const getFreeBets: ({ chainId, account, affiliate }: Props) => Promise<never[]>;
35
35
  export {};
@@ -0,0 +1,7 @@
1
+ import { GameState } from '../docs/feed/types';
2
+ type Props = {
3
+ state: GameState;
4
+ startsAt: string;
5
+ };
6
+ export declare const getIsPendingResolution: ({ state, startsAt }: Props) => boolean;
7
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type ChainId } from '../config';
2
+ import { type Selection } from '../global';
3
+ export type GetMaxBetResponse = {
4
+ response: {
5
+ maxBet: string;
6
+ maxPayout: string;
7
+ };
8
+ };
9
+ type Props = {
10
+ chainId: ChainId;
11
+ selections: Selection[];
12
+ };
13
+ export declare const getMaxBet: (props: Props) => Promise<{
14
+ maxBet: string;
15
+ maxPayout: string;
16
+ } | null>;
17
+ export {};
@@ -1,24 +1,26 @@
1
- import type { ConditionStatus } from '../docs/prematch/types';
2
- import { type PrematchConditionsQuery } from '../docs/prematch/conditions';
3
- import { type LiveConditionsQuery } from '../docs/live/conditions';
1
+ import { type ConditionsQuery } from '../docs/feed/conditions';
2
+ import { ConditionState } from '../docs/feed/types';
4
3
  import type { Selection } from '../global';
5
- export type ConditionsQuery = PrematchConditionsQuery | LiveConditionsQuery;
6
4
  export type MarketOutcome = {
7
5
  selectionName: string;
8
- odds?: number;
9
- lpAddress: string;
10
- coreAddress: string;
11
- status: ConditionStatus;
6
+ odds: number;
12
7
  gameId: string;
13
8
  isExpressForbidden: boolean;
14
- margin?: string;
15
9
  isWon?: boolean;
16
10
  } & Selection;
17
- export type Market = {
11
+ type TMarket<C> = {
18
12
  marketKey: string;
19
13
  name: string;
20
14
  description: string;
21
- outcomeRows: MarketOutcome[][];
15
+ conditions: C;
22
16
  };
17
+ type Condition = {
18
+ conditionId: string;
19
+ state: ConditionState;
20
+ isExpressForbidden: boolean;
21
+ outcomes: MarketOutcome[];
22
+ };
23
+ export type Market = TMarket<Condition[]>;
23
24
  export type GameMarkets = Market[];
24
25
  export declare const groupConditionsByMarket: (conditions: ConditionsQuery["conditions"]) => GameMarkets;
26
+ export {};
@@ -1,46 +1,33 @@
1
- import { type Address, erc721Abi } from 'viem';
2
- import { liveCoreAbi, lpAbi, prematchComboCoreAbi, prematchCoreAbi, proxyFrontAbi } from '../abis';
1
+ import { type Address } from 'viem';
2
+ import { lpAbi, coreAbi, azuroBetAbi, relayerAbi, cashoutAbi } from '../abis';
3
3
  export type Contracts = {
4
4
  lp: {
5
5
  address: Address;
6
6
  abi: typeof lpAbi;
7
7
  };
8
- prematchCore: {
8
+ core: {
9
9
  address: Address;
10
- abi: typeof prematchCoreAbi;
10
+ abi: typeof coreAbi;
11
11
  };
12
- prematchComboCore: {
12
+ relayer: {
13
13
  address: Address;
14
- abi: typeof prematchComboCoreAbi;
15
- };
16
- proxyFront: {
17
- address: Address;
18
- abi: typeof proxyFrontAbi;
14
+ abi: typeof relayerAbi;
19
15
  };
20
16
  azuroBet: {
21
17
  address: Address;
22
- abi: typeof erc721Abi;
18
+ abi: typeof azuroBetAbi;
23
19
  };
24
20
  cashout?: {
25
21
  address: Address;
26
- };
27
- liveRelayer?: {
28
- address: Address;
29
- };
30
- liveCore?: {
31
- address: Address;
32
- abi: typeof liveCoreAbi;
22
+ abi: typeof cashoutAbi;
33
23
  };
34
24
  };
35
25
  type Props = {
36
26
  lp: Address;
37
- prematchCore: Address;
38
- prematchComboCore: Address;
39
- proxyFront: Address;
27
+ core: Address;
28
+ relayer: Address;
40
29
  azuroBet: Address;
41
30
  cashout?: Address;
42
- liveRelayer?: Address;
43
- liveCore?: Address;
44
31
  };
45
- export declare const setupContracts: ({ lp, prematchCore, prematchComboCore, proxyFront, azuroBet, cashout, liveRelayer, liveCore, }: Props) => Contracts;
32
+ export declare const setupContracts: ({ lp, core, relayer, azuroBet, cashout, }: Props) => Contracts;
46
33
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/toolkit",
3
- "version": "4.5.4",
3
+ "version": "5.0.0-beta.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",
@@ -40,9 +40,9 @@
40
40
  "homepage": "https://github.com/Azuro-protocol/toolkit#readme",
41
41
  "peerDependencies": {
42
42
  "@azuro-org/dictionaries": "^3.0.26",
43
- "graphql-tag": "^2.12.0",
44
- "@wagmi/core": "^2.16.4",
45
- "viem": "^2.23.2"
43
+ "graphql-tag": "^2.12.6",
44
+ "@wagmi/core": "^2.16.7",
45
+ "viem": "^2.24.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@babel/core": "^7.17.0",