@azuro-org/toolkit 4.4.1 → 4.5.0-beta.2

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/global.d.ts CHANGED
@@ -1,5 +1,26 @@
1
- import { type Address } from 'viem';
1
+ import { type Address, type Chain } from 'viem';
2
+ import { type Environment } from './envs';
3
+ import { type Contracts } from './utils/setupContracts';
2
4
  import { type ChainId } from './config';
5
+ type BetToken = {
6
+ address: Address;
7
+ symbol: string;
8
+ decimals: number;
9
+ };
10
+ export type ChainData = {
11
+ chain: Omit<Chain, 'id'> & {
12
+ id: ChainId;
13
+ };
14
+ graphql: {
15
+ prematch: string;
16
+ live: string;
17
+ };
18
+ socket: string;
19
+ api: string;
20
+ environment: Environment;
21
+ contracts: Contracts;
22
+ betToken: BetToken;
23
+ };
3
24
  export type Selection = {
4
25
  outcomeId: string;
5
26
  conditionId: string;
@@ -19,3 +40,4 @@ export type LiveBet = {
19
40
  expiresAt: number;
20
41
  relayerFeeAmount: string;
21
42
  };
43
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { environments, Environment } from './envs';
2
- export { ODDS_DECIMALS, MARGIN_DECIMALS, MIN_LIVE_BET_AMOUNT, deBridgeUrl, deBridgeTxUrl, liveHostAddress, liveSupportedChains, type ChainData, chainsData, chainsDataByEnv, type ChainId, } from './config';
2
+ export * from './config';
3
3
  export * from './global';
4
4
  export * from './abis';
5
5
  export * from './docs';
6
+ export { getProviderFromId } from './utils/getProviderFromId';
6
7
  export { calcMindOdds } from './utils/calcMindOdds';
7
8
  export { calcLiveOdds, calcPrematchOdds } from './utils/calcOdds';
8
9
  export { getGameStatus, GameStatus } from './utils/getGameStatus';
@@ -26,3 +27,8 @@ export { createDeBridgeBet, type DeBridgeCreateTxResponse } from './utils/deBrid
26
27
  export { getDeBridgeSupportedChains, deBridgeChainIdByOriginalChainId, type DeBridgeSupportedChains } from './utils/deBridge/getDeBridgeSupportedChains';
27
28
  export { getDeBridgeSupportedTokens, type DeBridgeSupportedTokens } from './utils/deBridge/getDeBridgeSupportedTokens';
28
29
  export { getDeBridgeOrder, DeBridgeOrderStatus, DeBridgeExternalCallStatus } from './utils/deBridge/getDeBridgeOrder';
30
+ export { getPrecalculatedCashouts, type GetPrecalculatedCashouts } from './utils/cashout/getPrecalculatedCashouts';
31
+ export { getCalculatedCashout, type GetCalculatedCashout } from './utils/cashout/getCalculatedCashout';
32
+ export { getCashoutTypedData } from './utils/cashout/getCashoutTypedData';
33
+ export { createCashout, CashoutState, type CreateCashoutResponse } from './utils/cashout/createCashout';
34
+ export { getCashout, type GetCashoutResponse } from './utils/cashout/getCashout';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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'));
1
+ import {gnosis,polygon,polygonAmoy,chiliz,spicy}from'viem/chains';import {erc721Abi,parseUnits,formatUnits,encodeAbiParameters,parseAbiParameters,encodeFunctionData}from'viem';import {gql}from'@apollo/client';import {readContracts,readContract}from'@wagmi/core';import {dictionaries,getMarketKey,getMarketName,getSelectionName,getMarketDescription}from'@azuro-org/dictionaries';const isDevEnabled = Boolean(JSON.parse(process.env.AZURO_UNSTABLE_DEV_ENABLED || 'false'));
2
2
  var Environment;
3
3
  (function (Environment) {
4
4
  Environment["GnosisDevXDAI"] = "GnosisDevXDAI";
@@ -3855,7 +3855,7 @@ const environments = {
3855
3855
  'stateMutability': 'payable',
3856
3856
  'type': 'receive',
3857
3857
  },
3858
- ];var FreeBet = [{ 'inputs': [], 'name': 'AlreadyResolved', 'type': 'error' }, { 'inputs': [], 'name': 'BetAlreadyClaimed', 'type': 'error' }, { 'inputs': [], 'name': 'BetExpired', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectChainId', 'type': 'error' }, { 'inputs': [], 'name': 'InsufficientContractBalance', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidSignature', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyFreeBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyManager', 'type': 'error' }, { 'inputs': [], 'name': 'SmallMinOdds', 'type': 'error' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newAffiliate', 'type': 'address' }], 'name': 'AffiliateChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'BettorWin', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint8', 'name': 'version', 'type': 'uint8' }], 'name': 'Initialized', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'newLp', 'type': 'address' }], 'name': 'LpChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newManager', 'type': 'address' }], 'name': 'ManagerChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'name': 'NewBet', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'previousOwner', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'OwnershipTransferred', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint256[]', 'name': 'azuroBetId', 'type': 'uint256[]' }], 'name': 'PayoutsResolved', 'type': 'event' }, { 'inputs': [], 'name': 'affiliate', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'internalType': 'struct IFreeBet.FreeBetData', 'name': 'freeBetData', 'type': 'tuple' }, { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'conditionId', 'type': 'uint256' }, { 'internalType': 'uint64', 'name': 'outcomeId', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'deadline', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }], 'name': 'bet', 'outputs': [{ 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'account', 'type': 'address' }], 'name': 'checkOwner', 'outputs': [], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'name': 'freeBets', 'outputs': [{ 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint128', 'name': 'payout', 'type': 'uint128' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lpAddress', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }, { 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'initialize', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'lockedReserve', 'outputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'lp', 'outputs': [{ 'internalType': 'contract ILP', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'manager', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'owner', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256[]', 'name': 'freeBetIds', 'type': 'uint256[]' }], 'name': 'resolvePayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }], 'name': 'setAffiliate', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lp_', 'type': 'address' }], 'name': 'setLp', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'setManager', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'token', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'transferOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }], 'name': 'withdrawPayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'withdrawReserve', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'stateMutability': 'payable', 'type': 'receive' }];const setupContracts = ({ lp, prematchCore, prematchComboCore, proxyFront, liveRelayer, liveCore }) => {
3858
+ ];var FreeBet = [{ 'inputs': [], 'name': 'AlreadyResolved', 'type': 'error' }, { 'inputs': [], 'name': 'BetAlreadyClaimed', 'type': 'error' }, { 'inputs': [], 'name': 'BetExpired', 'type': 'error' }, { 'inputs': [], 'name': 'IncorrectChainId', 'type': 'error' }, { 'inputs': [], 'name': 'InsufficientContractBalance', 'type': 'error' }, { 'inputs': [], 'name': 'InvalidSignature', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyFreeBetOwner', 'type': 'error' }, { 'inputs': [], 'name': 'OnlyManager', 'type': 'error' }, { 'inputs': [], 'name': 'SmallMinOdds', 'type': 'error' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newAffiliate', 'type': 'address' }], 'name': 'AffiliateChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'BettorWin', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint8', 'name': 'version', 'type': 'uint8' }], 'name': 'Initialized', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'newLp', 'type': 'address' }], 'name': 'LpChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'address', 'name': 'newManager', 'type': 'address' }], 'name': 'ManagerChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'bettor', 'type': 'address' }, { 'indexed': true, 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'indexed': false, 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'indexed': false, 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'name': 'NewBet', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'internalType': 'address', 'name': 'previousOwner', 'type': 'address' }, { 'indexed': true, 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'OwnershipTransferred', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': false, 'internalType': 'uint256[]', 'name': 'azuroBetId', 'type': 'uint256[]' }], 'name': 'PayoutsResolved', 'type': 'event' }, { 'inputs': [], 'name': 'affiliate', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'components': [{ 'internalType': 'uint256', 'name': 'chainId', 'type': 'uint256' }, { 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }, { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'expiresAt', 'type': 'uint64' }], 'internalType': 'struct IFreeBet.FreeBetData', 'name': 'freeBetData', 'type': 'tuple' }, { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'conditionId', 'type': 'uint256' }, { 'internalType': 'uint64', 'name': 'outcomeId', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'deadline', 'type': 'uint64' }, { 'internalType': 'uint64', 'name': 'minOdds', 'type': 'uint64' }], 'name': 'bet', 'outputs': [{ 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'account', 'type': 'address' }], 'name': 'checkOwner', 'outputs': [], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'name': 'freeBets', 'outputs': [{ 'internalType': 'address', 'name': 'owner', 'type': 'address' }, { 'internalType': 'address', 'name': 'core', 'type': 'address' }, { 'internalType': 'uint256', 'name': 'azuroBetId', 'type': 'uint256' }, { 'internalType': 'uint128', 'name': 'amount', 'type': 'uint128' }, { 'internalType': 'uint128', 'name': 'payout', 'type': 'uint128' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lpAddress', 'type': 'address' }, { 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }, { 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'initialize', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'lockedReserve', 'outputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'lp', 'outputs': [{ 'internalType': 'contract ILP', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'manager', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [], 'name': 'owner', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256[]', 'name': 'freeBetIds', 'type': 'uint256[]' }], 'name': 'resolvePayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'affiliate_', 'type': 'address' }], 'name': 'setAffiliate', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'lp_', 'type': 'address' }], 'name': 'setLp', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'manager_', 'type': 'address' }], 'name': 'setManager', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [], 'name': 'token', 'outputs': [{ 'internalType': 'address', 'name': '', 'type': 'address' }], 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'internalType': 'address', 'name': 'newOwner', 'type': 'address' }], 'name': 'transferOwnership', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'freeBetId', 'type': 'uint256' }], 'name': 'withdrawPayout', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'internalType': 'uint256', 'name': 'amount', 'type': 'uint256' }], 'name': 'withdrawReserve', 'outputs': [], 'stateMutability': 'nonpayable', 'type': 'function' }, { 'stateMutability': 'payable', 'type': 'receive' }];const setupContracts = ({ lp, prematchCore, prematchComboCore, proxyFront, azuroBet, cashout, liveRelayer, liveCore, }) => {
3859
3859
  const contracts = {
3860
3860
  lp: {
3861
3861
  address: lp,
@@ -3873,12 +3873,21 @@ const environments = {
3873
3873
  address: proxyFront,
3874
3874
  abi: proxyFrontAbi,
3875
3875
  },
3876
+ azuroBet: {
3877
+ address: azuroBet,
3878
+ abi: erc721Abi,
3879
+ },
3876
3880
  };
3877
3881
  if (liveRelayer) {
3878
3882
  contracts.liveRelayer = {
3879
3883
  address: liveRelayer,
3880
3884
  };
3881
3885
  }
3886
+ if (cashout) {
3887
+ contracts.cashout = {
3888
+ address: cashout,
3889
+ };
3890
+ }
3882
3891
  if (liveCore) {
3883
3892
  contracts.liveCore = {
3884
3893
  address: liveCore,
@@ -3914,12 +3923,12 @@ const getLiveGraphqlEndpoint = (chainId) => {
3914
3923
  };
3915
3924
  const getSocketEndpoint = (chainId) => {
3916
3925
  if (isDev(chainId)) {
3917
- return 'wss://dev-streams.azuro.org/v1/streams/conditions';
3926
+ return 'wss://dev-streams.azuro.org/v1/streams';
3918
3927
  }
3919
3928
  if (chainId === polygonAmoy.id) {
3920
- return 'wss://preprod-streams.azuro.org/v1/streams/conditions';
3929
+ return 'wss://preprod-streams.azuro.org/v1/streams';
3921
3930
  }
3922
- return 'wss://streams.azuro.org/v1/streams/conditions';
3931
+ return 'wss://streams.azuro.org/v1/streams';
3923
3932
  };
3924
3933
  const getApiEndpoint = (chainId) => {
3925
3934
  if (isDev(chainId)) {
@@ -3949,6 +3958,21 @@ const LIVE_BET_DATA_TYPES = {
3949
3958
  };
3950
3959
  const LIVE_TYPED_DATA_DOMAIN_NAME = 'Live Betting';
3951
3960
  const LIVE_TYPED_DATA_DOMAIN_VERSION = '1.0.0';
3961
+ const CASHOUT_DATA_TYPES = {
3962
+ CashOutItem: [
3963
+ { name: 'betId', type: 'uint256' },
3964
+ { name: 'bettingContract', type: 'address' },
3965
+ { name: 'minOdds', type: 'uint64' },
3966
+ ],
3967
+ CashOutOrder: [
3968
+ { name: 'attention', type: 'string' },
3969
+ { name: 'chainId', type: 'uint256' },
3970
+ { name: 'items', type: 'CashOutItem[]' },
3971
+ { name: 'expiresAt', type: 'uint64' },
3972
+ ],
3973
+ };
3974
+ const CASHOUT_TYPED_DATA_DOMAIN_NAME = 'Cash Out';
3975
+ const CASHOUT_TYPED_DATA_DOMAIN_VERSION = '1.0.0';
3952
3976
  const deBridgeUrl = 'https://api.dln.trade/v1.0';
3953
3977
  const deBridgeTxUrl = 'https://stats-api.dln.trade/api';
3954
3978
  const liveHostAddress = '0x67Fca88E2f5F2C33b86bFa4EccfCb8dCD6a56D17';
@@ -3967,6 +3991,7 @@ const gnosisData = {
3967
3991
  prematchCore: '0x7f3F3f19c4e4015fd9Db2f22e653c766154091EF',
3968
3992
  prematchComboCore: '0xDbC3BE2DDB53e1a288F7b7a4d020F8056D3b0F7C',
3969
3993
  proxyFront: '0x3A1c6640daeAc3513726F06A9f03911CC1080251',
3994
+ azuroBet: '0xA3A1B460c68dc91c5B3f71f5487A76fac42858bf',
3970
3995
  liveRelayer: '0x936c02503A32aA23BCF7CFaF5c29100b0F93FCfe',
3971
3996
  liveCore: '0x0223ff7efca5aec919c471fa2eb44cda466f1500',
3972
3997
  }),
@@ -3990,6 +4015,8 @@ const gnosisDevData = {
3990
4015
  prematchCore: '0x0eaa5283990af9ca915b1d82261663d25d039d03',
3991
4016
  prematchComboCore: '0xdab6c085e2a24d3417875ea154c1d0abb5d427f9',
3992
4017
  proxyFront: '0xB02205C9e5DdFFa3EEa2731fE76e505B0d3eCCb0',
4018
+ azuroBet: '0x9AEb928E13b989d5F013b33c14853d8a944Acbf1',
4019
+ cashout: '0x483779Ff0F54Be733F513c14AA3a8382AB1cE019',
3993
4020
  liveRelayer: '0x3B0213eB35735A8E2b19F13C5Ec0a65a8226D5B2',
3994
4021
  liveCore: '0xFc4910f0E7523063f3640e249Fc0f25542b76899',
3995
4022
  }),
@@ -4013,6 +4040,7 @@ const polygonData = {
4013
4040
  prematchCore: '0xA40F8D69D412b79b49EAbdD5cf1b5706395bfCf7',
4014
4041
  prematchComboCore: '0x92a4e8Bc6B92a2e1ced411f41013B5FE6BE07613',
4015
4042
  proxyFront: '0x0DEE52b98ba8326DaD4C346a4F806Fd871360a00',
4043
+ azuroBet: '0x8ed7296b5CAe379d07C70280Af622BC410F01Ed7',
4016
4044
  liveRelayer: '0xC6BB817a7f02874F360d135D880200A2E440207D',
4017
4045
  liveCore: '0xc389558Faca41bC747F763cf8616704187CDcD04',
4018
4046
  }),
@@ -4036,6 +4064,7 @@ const polygonAmoyData = {
4036
4064
  prematchCore: '0x2477B960080B3439b4684df3D9CE53B2ACe64315',
4037
4065
  prematchComboCore: '0xdF71998f7931caD24439A12A2F56D7326C3D0295',
4038
4066
  proxyFront: '0x7003CaA0847CA296EBF51C43D9021656a663304f',
4067
+ azuroBet: '0x5E59ee1b09Cb2Cf031e4Beaa8dB48D4B8b7e38AD',
4039
4068
  liveRelayer: '0x355B8493380fA5D57E4d3aFBF7C5f38b64AD5eA9',
4040
4069
  liveCore: '0x51eD5C2596d9AE32cE53ac1915Cb9333AFeF3156',
4041
4070
  }),
@@ -4059,6 +4088,8 @@ const polygonAmoyDevData = {
4059
4088
  prematchCore: '0x87EBFFe283bE8dEd47c3C87451d1B89c8a2C441A',
4060
4089
  prematchComboCore: '0x471DaC1052248602fdF05377EF99B5b7b3a769a1',
4061
4090
  proxyFront: '0x7003CaA0847CA296EBF51C43D9021656a663304f',
4091
+ azuroBet: '0x68af5E36EF6474036604702B33014D3b4dcc93f2',
4092
+ cashout: '0x914669F2BE69b1FE2a4927E9C84d1F0b4E933Ab6',
4062
4093
  liveRelayer: '0x38633e7Cbd86959453445C170168855ed1151C22',
4063
4094
  liveCore: '0x00232f2dEEae4541da1C5eC265193C879B2304Eb',
4064
4095
  }),
@@ -4082,6 +4113,7 @@ const chilizData = {
4082
4113
  prematchCore: '0x1a21C681Cc83889f4b213485aB6cF4971C43114B',
4083
4114
  prematchComboCore: '0x724fa8931428D5B636F7191d3e848f28Ab23C425',
4084
4115
  proxyFront: '0x45779134E5091756601Cb5bA389f9C76b914E520',
4116
+ azuroBet: '0x8609D1c8610D7F24d826FB76ea878d240537A8B8',
4085
4117
  }),
4086
4118
  betToken: {
4087
4119
  address: '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47',
@@ -4103,6 +4135,10 @@ const spicyData = {
4103
4135
  prematchCore: '0x035AB843C9F6dCB9D9bDeAC18c191dEc6c975fB7',
4104
4136
  prematchComboCore: '0xF94a49F0D78eAfeda81c785131eb6419EB18b33A',
4105
4137
  proxyFront: '0x67f3228fD58f5A26D93a5dd0c6989b69c95618eB',
4138
+ azuroBet: '0x6FA69dD52B5BF761030d3201B1DbE04039bF0BDe',
4139
+ cashout: '0xB1E54209e224218A03BFd89f830cCE0414a1921E',
4140
+ liveRelayer: '0x699A817E9414698Afc761dCBA83d158894EA7dd4',
4141
+ liveCore: '0xC6B38c80427E4038e91798847b5C5b056C358817',
4106
4142
  }),
4107
4143
  betToken: {
4108
4144
  address: '0x721ef6871f1c4efe730dce047d40d1743b886946',
@@ -4209,13 +4245,14 @@ const chainsDataByEnv = {
4209
4245
  potentialPayout
4210
4246
  payout
4211
4247
  result
4212
- isRedeemed
4213
- isRedeemable
4214
4248
  odds
4215
4249
  settledOdds
4216
4250
  createdAt: createdBlockTimestamp
4217
4251
  txHash: createdTxHash
4218
4252
  affiliate
4253
+ isRedeemed
4254
+ isRedeemable
4255
+ isCashedOut
4219
4256
  core {
4220
4257
  address
4221
4258
  liquidityPool {
@@ -4269,13 +4306,14 @@ const chainsDataByEnv = {
4269
4306
  potentialPayout
4270
4307
  payout
4271
4308
  result
4272
- isRedeemed
4273
- isRedeemable
4274
4309
  odds
4275
4310
  settledOdds
4276
4311
  createdAt: createdBlockTimestamp
4277
4312
  txHash: createdTxHash
4278
4313
  affiliate
4314
+ isRedeemed
4315
+ isRedeemable
4316
+ isCashedOut
4279
4317
  core {
4280
4318
  address
4281
4319
  liquidityPool {
@@ -4483,7 +4521,21 @@ const chainsDataByEnv = {
4483
4521
  }
4484
4522
  }
4485
4523
  }
4486
- `;var AzuroBetContract_OrderBy;
4524
+ `;var AffiliateMonthly_OrderBy;
4525
+ (function (AffiliateMonthly_OrderBy) {
4526
+ AffiliateMonthly_OrderBy["Affiliate"] = "affiliate";
4527
+ AffiliateMonthly_OrderBy["BetsCount"] = "betsCount";
4528
+ AffiliateMonthly_OrderBy["Id"] = "id";
4529
+ AffiliateMonthly_OrderBy["LastAnyBetCreatedTimestamp"] = "lastAnyBetCreatedTimestamp";
4530
+ AffiliateMonthly_OrderBy["Month"] = "month";
4531
+ AffiliateMonthly_OrderBy["Year"] = "year";
4532
+ })(AffiliateMonthly_OrderBy || (AffiliateMonthly_OrderBy = {}));
4533
+ var Aggregation_Interval$1;
4534
+ (function (Aggregation_Interval) {
4535
+ Aggregation_Interval["Day"] = "day";
4536
+ Aggregation_Interval["Hour"] = "hour";
4537
+ })(Aggregation_Interval$1 || (Aggregation_Interval$1 = {}));
4538
+ var AzuroBetContract_OrderBy;
4487
4539
  (function (AzuroBetContract_OrderBy) {
4488
4540
  AzuroBetContract_OrderBy["Address"] = "address";
4489
4541
  AzuroBetContract_OrderBy["Core"] = "core";
@@ -4530,12 +4582,14 @@ var Bet_OrderBy;
4530
4582
  Bet_OrderBy["ApproxSettledAt"] = "approxSettledAt";
4531
4583
  Bet_OrderBy["BetId"] = "betId";
4532
4584
  Bet_OrderBy["Bettor"] = "bettor";
4585
+ Bet_OrderBy["Cashout"] = "cashout";
4533
4586
  Bet_OrderBy["Core"] = "core";
4534
4587
  Bet_OrderBy["CreatedBlockNumber"] = "createdBlockNumber";
4535
4588
  Bet_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4536
4589
  Bet_OrderBy["CreatedTxHash"] = "createdTxHash";
4537
4590
  Bet_OrderBy["Freebet"] = "freebet";
4538
4591
  Bet_OrderBy["Id"] = "id";
4592
+ Bet_OrderBy["IsCashedOut"] = "isCashedOut";
4539
4593
  Bet_OrderBy["IsRedeemable"] = "isRedeemable";
4540
4594
  Bet_OrderBy["IsRedeemed"] = "isRedeemed";
4541
4595
  Bet_OrderBy["Odds"] = "odds";
@@ -4589,6 +4643,9 @@ var Bettor_OrderBy;
4589
4643
  Bettor_OrderBy["RawTotalProfit"] = "rawTotalProfit";
4590
4644
  Bettor_OrderBy["RawTurnover"] = "rawTurnover";
4591
4645
  Bettor_OrderBy["RedeemedBetsCount"] = "redeemedBetsCount";
4646
+ Bettor_OrderBy["RedeemedCanceledBetsCount"] = "redeemedCanceledBetsCount";
4647
+ Bettor_OrderBy["RedeemedLostBetsCount"] = "redeemedLostBetsCount";
4648
+ Bettor_OrderBy["RedeemedWonBetsCount"] = "redeemedWonBetsCount";
4592
4649
  Bettor_OrderBy["SettledBetsCount"] = "settledBetsCount";
4593
4650
  Bettor_OrderBy["ToPayout"] = "toPayout";
4594
4651
  Bettor_OrderBy["TotalPayout"] = "totalPayout";
@@ -4596,6 +4653,41 @@ var Bettor_OrderBy;
4596
4653
  Bettor_OrderBy["Turnover"] = "turnover";
4597
4654
  Bettor_OrderBy["WonBetsCount"] = "wonBetsCount";
4598
4655
  })(Bettor_OrderBy || (Bettor_OrderBy = {}));
4656
+ var Cashout_OrderBy;
4657
+ (function (Cashout_OrderBy) {
4658
+ Cashout_OrderBy["OddsDecimals"] = "_oddsDecimals";
4659
+ Cashout_OrderBy["TokenDecimals"] = "_tokenDecimals";
4660
+ Cashout_OrderBy["UpdatedAt"] = "_updatedAt";
4661
+ Cashout_OrderBy["BetContractAddress"] = "betContractAddress";
4662
+ Cashout_OrderBy["BetId"] = "betId";
4663
+ Cashout_OrderBy["CashoutContractAddress"] = "cashoutContractAddress";
4664
+ Cashout_OrderBy["Core"] = "core";
4665
+ Cashout_OrderBy["CreatedBlockNumber"] = "createdBlockNumber";
4666
+ Cashout_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4667
+ Cashout_OrderBy["CreatedTxHash"] = "createdTxHash";
4668
+ Cashout_OrderBy["Id"] = "id";
4669
+ Cashout_OrderBy["Odds"] = "odds";
4670
+ Cashout_OrderBy["Owner"] = "owner";
4671
+ Cashout_OrderBy["Payout"] = "payout";
4672
+ Cashout_OrderBy["RawOdds"] = "rawOdds";
4673
+ Cashout_OrderBy["RawPayout"] = "rawPayout";
4674
+ })(Cashout_OrderBy || (Cashout_OrderBy = {}));
4675
+ var ConditionLogStatus;
4676
+ (function (ConditionLogStatus) {
4677
+ ConditionLogStatus["Canceled"] = "Canceled";
4678
+ ConditionLogStatus["Created"] = "Created";
4679
+ ConditionLogStatus["Paused"] = "Paused";
4680
+ ConditionLogStatus["Resolved"] = "Resolved";
4681
+ ConditionLogStatus["Unpaused"] = "Unpaused";
4682
+ })(ConditionLogStatus || (ConditionLogStatus = {}));
4683
+ var ConditionLog_OrderBy;
4684
+ (function (ConditionLog_OrderBy) {
4685
+ ConditionLog_OrderBy["ConditionId"] = "conditionId";
4686
+ ConditionLog_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4687
+ ConditionLog_OrderBy["Id"] = "id";
4688
+ ConditionLog_OrderBy["IsLive"] = "isLive";
4689
+ ConditionLog_OrderBy["Status"] = "status";
4690
+ })(ConditionLog_OrderBy || (ConditionLog_OrderBy = {}));
4599
4691
  var ConditionStatus$1;
4600
4692
  (function (ConditionStatus) {
4601
4693
  ConditionStatus["Canceled"] = "Canceled";
@@ -4605,6 +4697,7 @@ var ConditionStatus$1;
4605
4697
  })(ConditionStatus$1 || (ConditionStatus$1 = {}));
4606
4698
  var Condition_OrderBy$1;
4607
4699
  (function (Condition_OrderBy) {
4700
+ Condition_OrderBy["OutcomesKey"] = "_outcomesKey";
4608
4701
  Condition_OrderBy["UpdatedAt"] = "_updatedAt";
4609
4702
  Condition_OrderBy["WinningOutcomesCount"] = "_winningOutcomesCount";
4610
4703
  Condition_OrderBy["ConditionId"] = "conditionId";
@@ -4614,6 +4707,7 @@ var Condition_OrderBy$1;
4614
4707
  Condition_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4615
4708
  Condition_OrderBy["CreatedTxHash"] = "createdTxHash";
4616
4709
  Condition_OrderBy["Game"] = "game";
4710
+ Condition_OrderBy["Hidden"] = "hidden";
4617
4711
  Condition_OrderBy["Id"] = "id";
4618
4712
  Condition_OrderBy["InternalStartsAt"] = "internalStartsAt";
4619
4713
  Condition_OrderBy["IsExpressForbidden"] = "isExpressForbidden";
@@ -4652,6 +4746,7 @@ var Country_OrderBy$1;
4652
4746
  var EventName$1;
4653
4747
  (function (EventName) {
4654
4748
  EventName["AzuroBetTransfer"] = "AzuroBetTransfer";
4749
+ EventName["BetCashedOut"] = "BetCashedOut";
4655
4750
  EventName["BetSettled"] = "BetSettled";
4656
4751
  EventName["BettorWin"] = "BettorWin";
4657
4752
  EventName["ConditionCreated"] = "ConditionCreated";
@@ -4663,6 +4758,7 @@ var EventName$1;
4663
4758
  EventName["FreeBetRedeemed"] = "FreeBetRedeemed";
4664
4759
  EventName["FreeBetReissued"] = "FreeBetReissued";
4665
4760
  EventName["FreeBetTransfer"] = "FreeBetTransfer";
4761
+ EventName["GameCanceled"] = "GameCanceled";
4666
4762
  EventName["GameShifted"] = "GameShifted";
4667
4763
  EventName["LiquidityAdded"] = "LiquidityAdded";
4668
4764
  EventName["LiquidityRemoved"] = "LiquidityRemoved";
@@ -4753,6 +4849,7 @@ var Game_OrderBy$1;
4753
4849
  Game_OrderBy["ActiveConditionsEntityIds"] = "_activeConditionsEntityIds";
4754
4850
  Game_OrderBy["CanceledConditionsEntityIds"] = "_canceledConditionsEntityIds";
4755
4851
  Game_OrderBy["PausedConditionsEntityIds"] = "_pausedConditionsEntityIds";
4852
+ Game_OrderBy["ProviderTitle"] = "_providerTitle";
4756
4853
  Game_OrderBy["ResolvedConditionsEntityIds"] = "_resolvedConditionsEntityIds";
4757
4854
  Game_OrderBy["UpdatedAt"] = "_updatedAt";
4758
4855
  Game_OrderBy["Conditions"] = "conditions";
@@ -4882,12 +4979,14 @@ var LiveBet_OrderBy;
4882
4979
  LiveBet_OrderBy["Amount"] = "amount";
4883
4980
  LiveBet_OrderBy["BetId"] = "betId";
4884
4981
  LiveBet_OrderBy["Bettor"] = "bettor";
4982
+ LiveBet_OrderBy["Cashout"] = "cashout";
4885
4983
  LiveBet_OrderBy["Core"] = "core";
4886
4984
  LiveBet_OrderBy["CreatedBlockNumber"] = "createdBlockNumber";
4887
4985
  LiveBet_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4888
4986
  LiveBet_OrderBy["CreatedTxHash"] = "createdTxHash";
4889
4987
  LiveBet_OrderBy["Freebet"] = "freebet";
4890
4988
  LiveBet_OrderBy["Id"] = "id";
4989
+ LiveBet_OrderBy["IsCashedOut"] = "isCashedOut";
4891
4990
  LiveBet_OrderBy["IsRedeemable"] = "isRedeemable";
4892
4991
  LiveBet_OrderBy["IsRedeemed"] = "isRedeemed";
4893
4992
  LiveBet_OrderBy["Nonce"] = "nonce";
@@ -4926,6 +5025,7 @@ var LiveCondition_OrderBy;
4926
5025
  LiveCondition_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
4927
5026
  LiveCondition_OrderBy["CreatedTxHash"] = "createdTxHash";
4928
5027
  LiveCondition_OrderBy["GameId"] = "gameId";
5028
+ LiveCondition_OrderBy["Hidden"] = "hidden";
4929
5029
  LiveCondition_OrderBy["Id"] = "id";
4930
5030
  LiveCondition_OrderBy["Outcomes"] = "outcomes";
4931
5031
  LiveCondition_OrderBy["OutcomesIds"] = "outcomesIds";
@@ -4991,6 +5091,11 @@ var Outcome_OrderBy$1;
4991
5091
  Outcome_OrderBy["SortOrder"] = "sortOrder";
4992
5092
  Outcome_OrderBy["Title"] = "title";
4993
5093
  })(Outcome_OrderBy$1 || (Outcome_OrderBy$1 = {}));
5094
+ var OutcomesKeyConditionRelation_OrderBy;
5095
+ (function (OutcomesKeyConditionRelation_OrderBy) {
5096
+ OutcomesKeyConditionRelation_OrderBy["ConditionEntityId"] = "conditionEntityId";
5097
+ OutcomesKeyConditionRelation_OrderBy["Id"] = "id";
5098
+ })(OutcomesKeyConditionRelation_OrderBy || (OutcomesKeyConditionRelation_OrderBy = {}));
4994
5099
  var Participant_OrderBy$1;
4995
5100
  (function (Participant_OrderBy) {
4996
5101
  Participant_OrderBy["Game"] = "game";
@@ -5040,7 +5145,12 @@ var _SubgraphErrorPolicy_$1;
5040
5145
  _SubgraphErrorPolicy_["Allow"] = "allow";
5041
5146
  /** If the subgraph has indexing errors, data will be omitted. The default. */
5042
5147
  _SubgraphErrorPolicy_["Deny"] = "deny";
5043
- })(_SubgraphErrorPolicy_$1 || (_SubgraphErrorPolicy_$1 = {}));var ConditionStatus;
5148
+ })(_SubgraphErrorPolicy_$1 || (_SubgraphErrorPolicy_$1 = {}));var Aggregation_Interval;
5149
+ (function (Aggregation_Interval) {
5150
+ Aggregation_Interval["Day"] = "day";
5151
+ Aggregation_Interval["Hour"] = "hour";
5152
+ })(Aggregation_Interval || (Aggregation_Interval = {}));
5153
+ var ConditionStatus;
5044
5154
  (function (ConditionStatus) {
5045
5155
  ConditionStatus["Canceled"] = "Canceled";
5046
5156
  ConditionStatus["Created"] = "Created";
@@ -5209,7 +5319,10 @@ var _SubgraphErrorPolicy_;
5209
5319
  _SubgraphErrorPolicy_["Allow"] = "allow";
5210
5320
  /** If the subgraph has indexing errors, data will be omitted. The default. */
5211
5321
  _SubgraphErrorPolicy_["Deny"] = "deny";
5212
- })(_SubgraphErrorPolicy_ || (_SubgraphErrorPolicy_ = {}));const calcMindOdds = (props) => {
5322
+ })(_SubgraphErrorPolicy_ || (_SubgraphErrorPolicy_ = {}));const CONDITION_PROVIDER_LENGTH = 3;
5323
+ const getProviderFromId = (id) => {
5324
+ return +(id.slice(1, 1 + CONDITION_PROVIDER_LENGTH));
5325
+ };const calcMindOdds = (props) => {
5213
5326
  const totalOdds = typeof props.odds === 'number' ? props.odds : props.odds.reduce((acc, odds) => acc * +odds, 1);
5214
5327
  const minOdds = 1 + (totalOdds - 1) * (100 - props.slippage) / 100;
5215
5328
  return minOdds.toFixed(ODDS_DECIMALS);
@@ -5419,9 +5532,7 @@ const getBetStatus = (props) => {
5419
5532
  if (isPendingResolution) {
5420
5533
  return BetStatus.PendingResolution;
5421
5534
  }
5422
- const isLive = isExpress
5423
- ? getExpressIsLive(games)
5424
- : getGameStatus({ graphStatus: games[0].status, startsAt: +games[0].startsAt, isGameInLive: isLiveBet }) === GameStatus.Live;
5535
+ const isLive = isExpress ? getExpressIsLive(games) : (getGameStatus({ graphStatus: games[0].status, startsAt: +games[0].startsAt, isGameInLive: isLiveBet }) === GameStatus.Live);
5425
5536
  if (isLive) {
5426
5537
  return BetStatus.Live;
5427
5538
  }
@@ -5904,4 +6015,143 @@ const getDeBridgeOrder = async (orderId) => {
5904
6015
  }
5905
6016
  const data = await response.json();
5906
6017
  return data;
5907
- };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,LiveBetState,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,Condition_OrderBy as LiveConditionOrderBy,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,Condition_OrderBy$1 as PrematchConditionOrderBy,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,chainsData,chainsDataByEnv,createDeBridgeBet,createLiveBet,deBridgeChainIdByOriginalChainId,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBet,getLiveBetFee,getLiveBetTypedData,getLiveGraphqlEndpoint,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
6018
+ };const getPrecalculatedCashouts = async (props) => {
6019
+ const { chainId, conditionIds } = props;
6020
+ const { api, contracts } = chainsData[chainId];
6021
+ if (!contracts.cashout?.address) {
6022
+ throw new Error('provided chainId is not supported for cashout');
6023
+ }
6024
+ const response = await fetch(`${api}/cashout/get-multipliers`, {
6025
+ method: 'POST',
6026
+ headers: {
6027
+ 'Accept': 'application/json',
6028
+ 'Content-Type': 'application/json',
6029
+ },
6030
+ body: JSON.stringify({
6031
+ conditionIds,
6032
+ }),
6033
+ });
6034
+ if (response.status === 404) {
6035
+ return null;
6036
+ }
6037
+ if (!response.ok) {
6038
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6039
+ }
6040
+ const { multipliers } = await response.json();
6041
+ return multipliers;
6042
+ };const getCalculatedCashout = async (props) => {
6043
+ const { chainId, account, graphBetId, isLive } = props;
6044
+ const { api, environment, contracts } = chainsData[chainId];
6045
+ if (!contracts.cashout?.address) {
6046
+ throw new Error('provided chainId is not supported for cashout');
6047
+ }
6048
+ const response = await fetch(`${api}/cashout/get-calculation`, {
6049
+ method: 'POST',
6050
+ headers: {
6051
+ 'Accept': 'application/json',
6052
+ 'Content-Type': 'application/json',
6053
+ },
6054
+ body: JSON.stringify({
6055
+ environment,
6056
+ owner: account,
6057
+ betId: graphBetId,
6058
+ isLive,
6059
+ }),
6060
+ });
6061
+ if (response.status === 404) {
6062
+ return null;
6063
+ }
6064
+ if (!response.ok) {
6065
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6066
+ }
6067
+ const { cashoutOdds, owner, betId, ...rest } = await response.json();
6068
+ return {
6069
+ multiplier: cashoutOdds,
6070
+ account: owner,
6071
+ tokenId: betId,
6072
+ ...rest,
6073
+ };
6074
+ };const getCashoutTypedData = (props) => {
6075
+ const { account, chainId, attention, tokenId, betCoreAddress, multiplier, expiredAt } = props;
6076
+ const { contracts } = chainsData[chainId];
6077
+ if (!contracts.cashout?.address) {
6078
+ throw new Error('provided chainId is not supported for cashout');
6079
+ }
6080
+ const EIP712Domain = {
6081
+ name: CASHOUT_TYPED_DATA_DOMAIN_NAME,
6082
+ version: CASHOUT_TYPED_DATA_DOMAIN_VERSION,
6083
+ chainId,
6084
+ verifyingContract: contracts.cashout.address,
6085
+ };
6086
+ return {
6087
+ account: account,
6088
+ domain: EIP712Domain,
6089
+ primaryType: 'CashOutOrder',
6090
+ types: CASHOUT_DATA_TYPES,
6091
+ message: {
6092
+ attention: attention || 'By signing this transaction, I agree to cash out on \'Azuro SDK Example',
6093
+ chainId: BigInt(chainId),
6094
+ items: [
6095
+ {
6096
+ betId: BigInt(tokenId),
6097
+ bettingContract: betCoreAddress,
6098
+ minOdds: typeof multiplier === 'string' ? (parseUnits(multiplier, ODDS_DECIMALS)) : multiplier,
6099
+ },
6100
+ ],
6101
+ expiresAt: BigInt(expiredAt),
6102
+ },
6103
+ };
6104
+ };var CashoutState;
6105
+ (function (CashoutState) {
6106
+ CashoutState["Processing"] = "PROCESSING";
6107
+ CashoutState["Accepted"] = "ACCEPTED";
6108
+ CashoutState["Rejected"] = "REJECTED";
6109
+ CashoutState["Open"] = "OPEN";
6110
+ })(CashoutState || (CashoutState = {}));
6111
+ const createCashout = async (props) => {
6112
+ const { chainId, calculationId, betCoreAddress, attention, signature } = props;
6113
+ const { api, contracts } = chainsData[chainId];
6114
+ if (!contracts.cashout?.address) {
6115
+ throw new Error('provided chainId is not supported for cashout');
6116
+ }
6117
+ const signedCashout = {
6118
+ calculationId,
6119
+ signature: {
6120
+ verifyingContract: contracts.cashout.address,
6121
+ bettingContract: betCoreAddress,
6122
+ attention,
6123
+ chainId,
6124
+ ownerSignature: signature,
6125
+ },
6126
+ };
6127
+ const response = await fetch(`${api}/cashout/create`, {
6128
+ method: 'POST',
6129
+ headers: {
6130
+ 'Accept': 'application/json',
6131
+ 'Content-Type': 'application/json',
6132
+ },
6133
+ body: JSON.stringify(signedCashout),
6134
+ });
6135
+ if (response.status === 404) {
6136
+ return null;
6137
+ }
6138
+ if (!response.ok) {
6139
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6140
+ }
6141
+ const data = await response.json();
6142
+ return data;
6143
+ };const getCashout = async ({ chainId, orderId }) => {
6144
+ const { api, contracts } = chainsData[chainId];
6145
+ if (!contracts.cashout?.address) {
6146
+ throw new Error('provided chainId is not supported for cashout');
6147
+ }
6148
+ const response = await fetch(`${api}/cashout/${orderId}`);
6149
+ if (response.status === 404) {
6150
+ return null;
6151
+ }
6152
+ if (!response.ok) {
6153
+ throw new Error(`Status ${response.status}: ${response.statusText}`);
6154
+ }
6155
+ const data = await response.json();
6156
+ return data;
6157
+ };export{BetResult,BetStatus,Bet_OrderBy,BettorFragmentDoc,BettorsDocument,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CashoutState,ConditionStatus$1 as ConditionStatus,DeBridgeExternalCallStatus,DeBridgeOrderStatus,Environment,FreeBetStatus,GameBetsDocument,GameDocument,GameStatus,Game_OrderBy$1 as Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,LIVE_BET_DATA_TYPES,LIVE_TYPED_DATA_DOMAIN_NAME,LIVE_TYPED_DATA_DOMAIN_VERSION,LiveBetFragmentDoc,LiveBetState,LiveBetsDocument,LiveConditionDocument,LiveConditionFragmentDoc,Condition_OrderBy as LiveConditionOrderBy,LiveConditionsDocument,GameStatus$1 as LiveGraphGameStatus,MARGIN_DECIMALS,MIN_LIVE_BET_AMOUNT,MainGameInfoFragmentDoc,NavigationDocument,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,PrematchBetFragmentDoc,PrematchBetsDocument,PrematchConditionDocument,PrematchConditionFragmentDoc,Condition_OrderBy$1 as PrematchConditionOrderBy,PrematchConditionsBatchDocument,PrematchConditionsDocument,GameStatus$2 as PrematchGraphGameStatus,SelectionResult$1 as SelectionResult,SportsDocument,SportsNavigationDocument,WaveLevelName,activateWave,calcLiveOdds,calcMindOdds,calcPrematchOdds,chainsData,chainsDataByEnv,createCashout,createDeBridgeBet,createLiveBet,deBridgeChainIdByOriginalChainId,deBridgeTxUrl,deBridgeUrl,environments,FreeBet as freeBetAbi,getApiEndpoint,getBetStatus,getCalculatedCashout,getCashout,getCashoutTypedData,getDeBridgeOrder,getDeBridgeSupportedChains,getDeBridgeSupportedTokens,getFreeBets,getGameStatus,getLiveBet,getLiveBetFee,getLiveBetTypedData,getLiveGraphqlEndpoint,getPrecalculatedCashouts,getPrematchBetDataBytes,getPrematchGraphqlEndpoint,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,groupByConditionId,groupConditionsByMarket,liveCoreAbi,liveHostAddress,liveSupportedChains,lpAbi,prematchComboCoreAbi,prematchCoreAbi,proxyFrontAbi,setupContracts};
@@ -0,0 +1,22 @@
1
+ import { type Hex, type Address } from 'viem';
2
+ import { type ChainId } from '../../config';
3
+ export declare enum CashoutState {
4
+ Processing = "PROCESSING",
5
+ Accepted = "ACCEPTED",
6
+ Rejected = "REJECTED",
7
+ Open = "OPEN"
8
+ }
9
+ export type CreateCashoutResponse = {
10
+ id: string;
11
+ state: CashoutState;
12
+ errorMessage?: string;
13
+ };
14
+ type Props = {
15
+ chainId: ChainId;
16
+ calculationId: string;
17
+ betCoreAddress: Address | string;
18
+ attention: string;
19
+ signature: Hex;
20
+ };
21
+ export declare const createCashout: (props: Props) => Promise<CreateCashoutResponse | null>;
22
+ export {};