@azuro-org/toolkit 5.2.0-beta.1 → 6.0.0-beta.0
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 +6 -4
- package/dist/docs/bets/fragments/legacyLiveBet.d.ts +1 -0
- package/dist/docs/bets/fragments/legacyPrematchBet.d.ts +1 -0
- package/dist/docs/bets/legacyBets.d.ts +2 -0
- package/dist/docs/index.d.ts +0 -13
- package/dist/global.d.ts +33 -3
- package/dist/helpers/normalizeTimestampToMs.d.ts +9 -0
- package/dist/helpers/serializeApiParams.d.ts +4 -0
- package/dist/index.d.ts +27 -18
- package/dist/index.js +942 -605
- package/dist/index.js.map +1 -1
- package/dist/utils/bet/createBet.d.ts +39 -0
- package/dist/utils/bet/createComboBet.d.ts +44 -0
- package/dist/utils/bet/getBet.d.ts +28 -0
- package/dist/utils/{getBetCalculation.d.ts → bet/getBetCalculation.d.ts} +10 -15
- package/dist/utils/bet/getBetFee.d.ts +32 -0
- package/dist/utils/bet/getBetStatus.d.ts +43 -0
- package/dist/utils/bet/getBetTypedData.d.ts +38 -0
- package/dist/utils/bet/getBetsByBettor.d.ts +44 -0
- package/dist/utils/bet/getComboBetTypedData.d.ts +42 -0
- package/dist/utils/bet/types.d.ts +128 -0
- package/dist/utils/bonus/getAvailableFreebets.d.ts +26 -3
- package/dist/utils/bonus/getBonuses.d.ts +23 -3
- package/dist/utils/calcMinOdds.d.ts +20 -0
- package/dist/utils/cashout/createCashout.d.ts +26 -3
- package/dist/utils/cashout/getCalculatedCashout.d.ts +29 -4
- package/dist/utils/cashout/getCashout.d.ts +22 -3
- package/dist/utils/cashout/getCashoutTypedData.d.ts +30 -3
- package/dist/utils/cashout/getPrecalculatedCashouts.d.ts +31 -3
- package/dist/utils/feed/getConditionsByGameIds.d.ts +52 -0
- package/dist/utils/feed/getConditionsState.d.ts +34 -0
- package/dist/utils/feed/getGamesByFilters.d.ts +35 -0
- package/dist/utils/feed/getGamesByIds.d.ts +26 -0
- package/dist/utils/feed/getNavigation.d.ts +58 -0
- package/dist/utils/feed/getSports.d.ts +57 -0
- package/dist/utils/feed/searchGames.d.ts +29 -0
- package/dist/utils/feed/types.d.ts +46 -0
- package/dist/utils/getEndpoints.d.ts +1 -0
- package/dist/utils/getIsPendingResolution.d.ts +17 -4
- package/dist/utils/getProviderFromId.d.ts +12 -0
- package/dist/utils/groupConditionsByMarket.d.ts +22 -4
- package/package.json +1 -1
- package/dist/docs/bets/bets.d.ts +0 -67
- package/dist/docs/bets/fragments/bet.d.ts +0 -57
- package/dist/utils/calcMindOdds.d.ts +0 -6
- package/dist/utils/createBet.d.ts +0 -17
- package/dist/utils/createComboBet.d.ts +0 -17
- package/dist/utils/getBet.d.ts +0 -23
- package/dist/utils/getBetFee.d.ts +0 -14
- package/dist/utils/getBetStatus.d.ts +0 -19
- package/dist/utils/getBetTypedData.d.ts +0 -16
- package/dist/utils/getBetsHistory.d.ts +0 -71
- package/dist/utils/getComboBetTypedData.d.ts +0 -16
- package/dist/utils/getMaxBet.d.ts +0 -18
package/dist/index.js
CHANGED
|
@@ -5844,6 +5844,7 @@ const isDevChain = (chainId) => {
|
|
|
5844
5844
|
chainId === baseSepolia.id ||
|
|
5845
5845
|
chainId === bscTestnet.id);
|
|
5846
5846
|
};
|
|
5847
|
+
/** @deprecated Use REST API instead */
|
|
5847
5848
|
const getFeedGraphqlEndpoint = (chainId) => (`https://thegraph-1.chainfeedon.com/subgraphs/name/azuro-protocol/azuro-data-feed-${endpointNameByChainId[chainId]}`);
|
|
5848
5849
|
const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.chainfeedon.com/subgraphs/name/azuro-protocol/azuro-api-${endpointNameByChainId[chainId]}-v3`);
|
|
5849
5850
|
/**
|
|
@@ -6233,15 +6234,47 @@ const chainsDataByEnv = {
|
|
|
6233
6234
|
[Environment.BaseSepoliaWETH]: baseSepoliaData,
|
|
6234
6235
|
[Environment.BscDevUSDT]: bscTestnetData,
|
|
6235
6236
|
[Environment.BscUSDT]: bscData,
|
|
6236
|
-
};var
|
|
6237
|
-
(function (
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6237
|
+
};var BetOrderState;
|
|
6238
|
+
(function (BetOrderState) {
|
|
6239
|
+
BetOrderState["Created"] = "Created";
|
|
6240
|
+
BetOrderState["Placed"] = "Placed";
|
|
6241
|
+
BetOrderState["Sent"] = "Sent";
|
|
6242
|
+
BetOrderState["Pending"] = "Pending";
|
|
6243
|
+
BetOrderState["Accepted"] = "Accepted";
|
|
6244
|
+
BetOrderState["Rejected"] = "Rejected";
|
|
6245
|
+
BetOrderState["PendingCancel"] = "PendingCancel";
|
|
6246
|
+
BetOrderState["Canceled"] = "Canceled";
|
|
6247
|
+
BetOrderState["CancelFailed"] = "CancelFailed";
|
|
6248
|
+
BetOrderState["Settled"] = "Settled";
|
|
6249
|
+
})(BetOrderState || (BetOrderState = {}));
|
|
6250
|
+
var BetOrderResult;
|
|
6251
|
+
(function (BetOrderResult) {
|
|
6252
|
+
BetOrderResult["Won"] = "Won";
|
|
6253
|
+
BetOrderResult["Lost"] = "Lost";
|
|
6254
|
+
BetOrderResult["Canceled"] = "Canceled";
|
|
6255
|
+
})(BetOrderResult || (BetOrderResult = {}));
|
|
6256
|
+
var GameState;
|
|
6257
|
+
(function (GameState) {
|
|
6258
|
+
GameState["Finished"] = "Finished";
|
|
6259
|
+
GameState["Live"] = "Live";
|
|
6260
|
+
GameState["Prematch"] = "Prematch";
|
|
6261
|
+
GameState["Stopped"] = "Stopped";
|
|
6262
|
+
GameState["Canceled"] = "Canceled";
|
|
6263
|
+
})(GameState || (GameState = {}));
|
|
6264
|
+
var ConditionState;
|
|
6265
|
+
(function (ConditionState) {
|
|
6266
|
+
ConditionState["Active"] = "Active";
|
|
6267
|
+
ConditionState["Canceled"] = "Canceled";
|
|
6268
|
+
ConditionState["Removed"] = "Removed";
|
|
6269
|
+
ConditionState["Resolved"] = "Resolved";
|
|
6270
|
+
ConditionState["Stopped"] = "Stopped";
|
|
6271
|
+
})(ConditionState || (ConditionState = {}));
|
|
6272
|
+
/** Defines the order direction, either ascending or descending */
|
|
6273
|
+
var OrderDirection$1;
|
|
6274
|
+
(function (OrderDirection) {
|
|
6275
|
+
OrderDirection["Asc"] = "asc";
|
|
6276
|
+
OrderDirection["Desc"] = "desc";
|
|
6277
|
+
})(OrderDirection$1 || (OrderDirection$1 = {}));
|
|
6245
6278
|
var BonusType;
|
|
6246
6279
|
(function (BonusType) {
|
|
6247
6280
|
BonusType["FreeBet"] = "FreeBet";
|
|
@@ -6292,6 +6325,7 @@ var EventRestrictionState;
|
|
|
6292
6325
|
resolvedAt: resolvedBlockTimestamp
|
|
6293
6326
|
txHash: createdTxHash
|
|
6294
6327
|
redeemedTxHash
|
|
6328
|
+
redeemedAt: redeemedBlockTimestamp
|
|
6295
6329
|
affiliate
|
|
6296
6330
|
isRedeemed
|
|
6297
6331
|
isRedeemable
|
|
@@ -6335,6 +6369,7 @@ var EventRestrictionState;
|
|
|
6335
6369
|
resolvedAt: resolvedBlockTimestamp
|
|
6336
6370
|
txHash: createdTxHash
|
|
6337
6371
|
redeemedTxHash
|
|
6372
|
+
redeemedAt: redeemedBlockTimestamp
|
|
6338
6373
|
affiliate
|
|
6339
6374
|
isRedeemed
|
|
6340
6375
|
isRedeemable
|
|
@@ -6397,55 +6432,6 @@ var EventRestrictionState;
|
|
|
6397
6432
|
cashout {
|
|
6398
6433
|
payout
|
|
6399
6434
|
}
|
|
6400
|
-
}
|
|
6401
|
-
`;const BetFragmentDoc = gql `
|
|
6402
|
-
fragment Bet on V3_Bet {
|
|
6403
|
-
id
|
|
6404
|
-
tokenId: betId
|
|
6405
|
-
actor
|
|
6406
|
-
amount
|
|
6407
|
-
status
|
|
6408
|
-
potentialPayout
|
|
6409
|
-
payout
|
|
6410
|
-
result
|
|
6411
|
-
odds
|
|
6412
|
-
settledOdds
|
|
6413
|
-
createdAt: createdBlockTimestamp
|
|
6414
|
-
resolvedAt: resolvedBlockTimestamp
|
|
6415
|
-
txHash: createdTxHash
|
|
6416
|
-
redeemedTxHash
|
|
6417
|
-
affiliate
|
|
6418
|
-
isRedeemed
|
|
6419
|
-
isRedeemable
|
|
6420
|
-
isCashedOut
|
|
6421
|
-
core {
|
|
6422
|
-
address
|
|
6423
|
-
liquidityPool {
|
|
6424
|
-
address
|
|
6425
|
-
}
|
|
6426
|
-
}
|
|
6427
|
-
selections {
|
|
6428
|
-
odds
|
|
6429
|
-
result
|
|
6430
|
-
conditionKind
|
|
6431
|
-
outcome {
|
|
6432
|
-
outcomeId
|
|
6433
|
-
title
|
|
6434
|
-
condition {
|
|
6435
|
-
conditionId
|
|
6436
|
-
title
|
|
6437
|
-
status
|
|
6438
|
-
gameId
|
|
6439
|
-
wonOutcomeIds
|
|
6440
|
-
}
|
|
6441
|
-
}
|
|
6442
|
-
}
|
|
6443
|
-
freebetId
|
|
6444
|
-
isFreebetAmountReturnable
|
|
6445
|
-
paymasterContractAddress
|
|
6446
|
-
cashout {
|
|
6447
|
-
payout
|
|
6448
|
-
}
|
|
6449
6435
|
}
|
|
6450
6436
|
`;const BettorsDocument = gql `
|
|
6451
6437
|
query Bettors($where: Bettor_filter!) {
|
|
@@ -6536,207 +6522,6 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
|
|
|
6536
6522
|
id
|
|
6537
6523
|
}
|
|
6538
6524
|
}
|
|
6539
|
-
}
|
|
6540
|
-
`;const BetsDocument = gql `
|
|
6541
|
-
query Bets($first: Int, $skip: Int, $where: V3_Bet_filter!, $orderBy: V3_Bet_orderBy, $orderDirection: OrderDirection) {
|
|
6542
|
-
v3Bets(
|
|
6543
|
-
first: $first
|
|
6544
|
-
skip: $skip
|
|
6545
|
-
where: $where
|
|
6546
|
-
orderBy: $orderBy
|
|
6547
|
-
orderDirection: $orderDirection
|
|
6548
|
-
subgraphError: allow
|
|
6549
|
-
) {
|
|
6550
|
-
...Bet
|
|
6551
|
-
}
|
|
6552
|
-
}
|
|
6553
|
-
${BetFragmentDoc}`;const ConditionFragmentDoc = gql `
|
|
6554
|
-
fragment Condition on Condition {
|
|
6555
|
-
id
|
|
6556
|
-
conditionId
|
|
6557
|
-
state
|
|
6558
|
-
title
|
|
6559
|
-
isExpressForbidden
|
|
6560
|
-
isPrematchEnabled
|
|
6561
|
-
isLiveEnabled
|
|
6562
|
-
margin
|
|
6563
|
-
outcomes {
|
|
6564
|
-
title
|
|
6565
|
-
outcomeId
|
|
6566
|
-
odds: currentOdds
|
|
6567
|
-
}
|
|
6568
|
-
game {
|
|
6569
|
-
gameId
|
|
6570
|
-
sport {
|
|
6571
|
-
sportId
|
|
6572
|
-
}
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
`;const GameInfoFragmentDoc = gql `
|
|
6576
|
-
fragment GameInfo on Game {
|
|
6577
|
-
id
|
|
6578
|
-
gameId
|
|
6579
|
-
slug
|
|
6580
|
-
title
|
|
6581
|
-
startsAt
|
|
6582
|
-
state
|
|
6583
|
-
turnover
|
|
6584
|
-
sport {
|
|
6585
|
-
sportId
|
|
6586
|
-
slug
|
|
6587
|
-
name
|
|
6588
|
-
sporthub {
|
|
6589
|
-
id
|
|
6590
|
-
slug
|
|
6591
|
-
}
|
|
6592
|
-
}
|
|
6593
|
-
league {
|
|
6594
|
-
id
|
|
6595
|
-
slug
|
|
6596
|
-
name
|
|
6597
|
-
}
|
|
6598
|
-
country {
|
|
6599
|
-
id
|
|
6600
|
-
slug
|
|
6601
|
-
name
|
|
6602
|
-
}
|
|
6603
|
-
participants {
|
|
6604
|
-
image
|
|
6605
|
-
name
|
|
6606
|
-
}
|
|
6607
|
-
}
|
|
6608
|
-
`;const ConditionDocument = gql `
|
|
6609
|
-
query Condition($id: ID!) {
|
|
6610
|
-
condition(id: $id, subgraphError: allow) {
|
|
6611
|
-
...Condition
|
|
6612
|
-
}
|
|
6613
|
-
}
|
|
6614
|
-
${ConditionFragmentDoc}`;const ConditionsDocument = gql `
|
|
6615
|
-
query Conditions($where: Condition_filter!, $orderBy: Condition_orderBy, $orderDirection: OrderDirection) {
|
|
6616
|
-
conditions(
|
|
6617
|
-
where: $where
|
|
6618
|
-
first: 1000
|
|
6619
|
-
orderBy: $orderBy
|
|
6620
|
-
orderDirection: $orderDirection
|
|
6621
|
-
subgraphError: allow
|
|
6622
|
-
) {
|
|
6623
|
-
...Condition
|
|
6624
|
-
wonOutcomeIds
|
|
6625
|
-
}
|
|
6626
|
-
}
|
|
6627
|
-
${ConditionFragmentDoc}`;const ConditionsBatchDocument = gql `
|
|
6628
|
-
query ConditionsBatch($conditionFilter: Condition_filter) {
|
|
6629
|
-
conditions(where: $conditionFilter, first: 1000, subgraphError: allow) {
|
|
6630
|
-
state
|
|
6631
|
-
conditionId
|
|
6632
|
-
outcomes {
|
|
6633
|
-
id
|
|
6634
|
-
outcomeId
|
|
6635
|
-
odds: currentOdds
|
|
6636
|
-
}
|
|
6637
|
-
}
|
|
6638
|
-
}
|
|
6639
|
-
`;const GameDocument = gql `
|
|
6640
|
-
query Game($id: ID!) {
|
|
6641
|
-
game(id: $id, subgraphError: allow) {
|
|
6642
|
-
...GameInfo
|
|
6643
|
-
}
|
|
6644
|
-
}
|
|
6645
|
-
${GameInfoFragmentDoc}`;const GamesDocument = gql `
|
|
6646
|
-
query Games($first: Int, $skip: Int, $where: Game_filter!, $orderBy: Game_orderBy, $orderDirection: OrderDirection) {
|
|
6647
|
-
games(
|
|
6648
|
-
first: $first
|
|
6649
|
-
skip: $skip
|
|
6650
|
-
where: $where
|
|
6651
|
-
orderBy: $orderBy
|
|
6652
|
-
orderDirection: $orderDirection
|
|
6653
|
-
subgraphError: allow
|
|
6654
|
-
) {
|
|
6655
|
-
...GameInfo
|
|
6656
|
-
}
|
|
6657
|
-
}
|
|
6658
|
-
${GameInfoFragmentDoc}`;const NavigationDocument = gql `
|
|
6659
|
-
query Navigation($sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter) {
|
|
6660
|
-
sports(where: $sportFilter, subgraphError: allow) {
|
|
6661
|
-
id
|
|
6662
|
-
slug
|
|
6663
|
-
name
|
|
6664
|
-
sportId
|
|
6665
|
-
sporthub {
|
|
6666
|
-
id
|
|
6667
|
-
slug
|
|
6668
|
-
}
|
|
6669
|
-
activeGamesCount
|
|
6670
|
-
activeLiveGamesCount
|
|
6671
|
-
activePrematchGamesCount
|
|
6672
|
-
countries(where: $countryFilter) {
|
|
6673
|
-
id
|
|
6674
|
-
slug
|
|
6675
|
-
name
|
|
6676
|
-
turnover
|
|
6677
|
-
activeGamesCount
|
|
6678
|
-
activeLiveGamesCount
|
|
6679
|
-
activePrematchGamesCount
|
|
6680
|
-
leagues(where: $leagueFilter) {
|
|
6681
|
-
id
|
|
6682
|
-
slug
|
|
6683
|
-
name
|
|
6684
|
-
turnover
|
|
6685
|
-
activeGamesCount
|
|
6686
|
-
activeLiveGamesCount
|
|
6687
|
-
activePrematchGamesCount
|
|
6688
|
-
}
|
|
6689
|
-
}
|
|
6690
|
-
}
|
|
6691
|
-
}
|
|
6692
|
-
`;const SportsDocument = gql `
|
|
6693
|
-
query Sports($first: Int, $sportFilter: Sport_filter, $countryFilter: Country_filter, $leagueFilter: League_filter, $gameFilter: Game_filter, $gameOrderBy: Game_orderBy, $gameOrderDirection: OrderDirection) {
|
|
6694
|
-
sports(
|
|
6695
|
-
where: $sportFilter
|
|
6696
|
-
orderBy: turnover
|
|
6697
|
-
orderDirection: desc
|
|
6698
|
-
subgraphError: allow
|
|
6699
|
-
) {
|
|
6700
|
-
id
|
|
6701
|
-
slug
|
|
6702
|
-
name
|
|
6703
|
-
sportId
|
|
6704
|
-
turnover
|
|
6705
|
-
countries(where: $countryFilter, orderBy: turnover, orderDirection: desc) {
|
|
6706
|
-
slug
|
|
6707
|
-
name
|
|
6708
|
-
turnover
|
|
6709
|
-
leagues(where: $leagueFilter, orderBy: turnover, orderDirection: desc) {
|
|
6710
|
-
slug
|
|
6711
|
-
name
|
|
6712
|
-
turnover
|
|
6713
|
-
games(
|
|
6714
|
-
where: $gameFilter
|
|
6715
|
-
first: $first
|
|
6716
|
-
orderBy: $gameOrderBy
|
|
6717
|
-
orderDirection: $gameOrderDirection
|
|
6718
|
-
) {
|
|
6719
|
-
...GameInfo
|
|
6720
|
-
}
|
|
6721
|
-
}
|
|
6722
|
-
}
|
|
6723
|
-
}
|
|
6724
|
-
}
|
|
6725
|
-
${GameInfoFragmentDoc}`;const SportsNavigationDocument = gql `
|
|
6726
|
-
query SportsNavigation($sportFilter: Sport_filter) {
|
|
6727
|
-
sports(where: $sportFilter, subgraphError: allow) {
|
|
6728
|
-
id
|
|
6729
|
-
slug
|
|
6730
|
-
name
|
|
6731
|
-
sportId
|
|
6732
|
-
sporthub {
|
|
6733
|
-
id
|
|
6734
|
-
slug
|
|
6735
|
-
}
|
|
6736
|
-
activeGamesCount
|
|
6737
|
-
activeLiveGamesCount
|
|
6738
|
-
activePrematchGamesCount
|
|
6739
|
-
}
|
|
6740
6525
|
}
|
|
6741
6526
|
`;const LegacyLiveGamesDocument = gql `
|
|
6742
6527
|
query LegacyLiveGames($first: Int, $skip: Int, $where: Game_filter!, $orderBy: Game_orderBy, $orderDirection: OrderDirection) {
|
|
@@ -6788,11 +6573,11 @@ ${LegacyLiveBetFragmentDoc}`;const GameBetsDocument = gql `
|
|
|
6788
6573
|
AffiliateMonthly_OrderBy["Month"] = "month";
|
|
6789
6574
|
AffiliateMonthly_OrderBy["Year"] = "year";
|
|
6790
6575
|
})(AffiliateMonthly_OrderBy || (AffiliateMonthly_OrderBy = {}));
|
|
6791
|
-
var Aggregation_Interval
|
|
6576
|
+
var Aggregation_Interval;
|
|
6792
6577
|
(function (Aggregation_Interval) {
|
|
6793
6578
|
Aggregation_Interval["Day"] = "day";
|
|
6794
6579
|
Aggregation_Interval["Hour"] = "hour";
|
|
6795
|
-
})(Aggregation_Interval
|
|
6580
|
+
})(Aggregation_Interval || (Aggregation_Interval = {}));
|
|
6796
6581
|
var AzuroBetContract_OrderBy;
|
|
6797
6582
|
(function (AzuroBetContract_OrderBy) {
|
|
6798
6583
|
AzuroBetContract_OrderBy["Address"] = "address";
|
|
@@ -6977,7 +6762,7 @@ var ConditionStatus;
|
|
|
6977
6762
|
ConditionStatus["Paused"] = "Paused";
|
|
6978
6763
|
ConditionStatus["Resolved"] = "Resolved";
|
|
6979
6764
|
})(ConditionStatus || (ConditionStatus = {}));
|
|
6980
|
-
var Condition_OrderBy
|
|
6765
|
+
var Condition_OrderBy;
|
|
6981
6766
|
(function (Condition_OrderBy) {
|
|
6982
6767
|
Condition_OrderBy["OutcomesKey"] = "_outcomesKey";
|
|
6983
6768
|
Condition_OrderBy["UpdatedAt"] = "_updatedAt";
|
|
@@ -7006,7 +6791,7 @@ var Condition_OrderBy$1;
|
|
|
7006
6791
|
Condition_OrderBy["Turnover"] = "turnover";
|
|
7007
6792
|
Condition_OrderBy["WonOutcomeIds"] = "wonOutcomeIds";
|
|
7008
6793
|
Condition_OrderBy["WonOutcomes"] = "wonOutcomes";
|
|
7009
|
-
})(Condition_OrderBy
|
|
6794
|
+
})(Condition_OrderBy || (Condition_OrderBy = {}));
|
|
7010
6795
|
var CoreContract_OrderBy;
|
|
7011
6796
|
(function (CoreContract_OrderBy) {
|
|
7012
6797
|
CoreContract_OrderBy["Address"] = "address";
|
|
@@ -7014,7 +6799,7 @@ var CoreContract_OrderBy;
|
|
|
7014
6799
|
CoreContract_OrderBy["LiquidityPool"] = "liquidityPool";
|
|
7015
6800
|
CoreContract_OrderBy["Type"] = "type";
|
|
7016
6801
|
})(CoreContract_OrderBy || (CoreContract_OrderBy = {}));
|
|
7017
|
-
var Country_OrderBy
|
|
6802
|
+
var Country_OrderBy;
|
|
7018
6803
|
(function (Country_OrderBy) {
|
|
7019
6804
|
Country_OrderBy["ActiveLeaguesEntityIds"] = "activeLeaguesEntityIds";
|
|
7020
6805
|
Country_OrderBy["HasActiveLeagues"] = "hasActiveLeagues";
|
|
@@ -7024,8 +6809,8 @@ var Country_OrderBy$1;
|
|
|
7024
6809
|
Country_OrderBy["Slug"] = "slug";
|
|
7025
6810
|
Country_OrderBy["Sport"] = "sport";
|
|
7026
6811
|
Country_OrderBy["Turnover"] = "turnover";
|
|
7027
|
-
})(Country_OrderBy
|
|
7028
|
-
var EventName
|
|
6812
|
+
})(Country_OrderBy || (Country_OrderBy = {}));
|
|
6813
|
+
var EventName;
|
|
7029
6814
|
(function (EventName) {
|
|
7030
6815
|
EventName["AzuroBetTransfer"] = "AzuroBetTransfer";
|
|
7031
6816
|
EventName["BetCashedOut"] = "BetCashedOut";
|
|
@@ -7061,8 +6846,8 @@ var EventName$1;
|
|
|
7061
6846
|
EventName["V3ConditionResolved"] = "V3_ConditionResolved";
|
|
7062
6847
|
EventName["V3FreebetRedeemed"] = "V3_FreebetRedeemed";
|
|
7063
6848
|
EventName["V3NewBet"] = "V3_NewBet";
|
|
7064
|
-
})(EventName
|
|
7065
|
-
var Event_OrderBy
|
|
6849
|
+
})(EventName || (EventName = {}));
|
|
6850
|
+
var Event_OrderBy;
|
|
7066
6851
|
(function (Event_OrderBy) {
|
|
7067
6852
|
Event_OrderBy["Affiliate"] = "affiliate";
|
|
7068
6853
|
Event_OrderBy["BetId"] = "betId";
|
|
@@ -7082,7 +6867,7 @@ var Event_OrderBy$1;
|
|
|
7082
6867
|
Event_OrderBy["SortOrder"] = "sortOrder";
|
|
7083
6868
|
Event_OrderBy["TransactionIndex"] = "transactionIndex";
|
|
7084
6869
|
Event_OrderBy["TxHash"] = "txHash";
|
|
7085
|
-
})(Event_OrderBy
|
|
6870
|
+
})(Event_OrderBy || (Event_OrderBy = {}));
|
|
7086
6871
|
var ExpressPrematchRelation_OrderBy;
|
|
7087
6872
|
(function (ExpressPrematchRelation_OrderBy) {
|
|
7088
6873
|
ExpressPrematchRelation_OrderBy["Id"] = "id";
|
|
@@ -7137,7 +6922,7 @@ var GameStatus;
|
|
|
7137
6922
|
GameStatus["Paused"] = "Paused";
|
|
7138
6923
|
GameStatus["Resolved"] = "Resolved";
|
|
7139
6924
|
})(GameStatus || (GameStatus = {}));
|
|
7140
|
-
var Game_OrderBy
|
|
6925
|
+
var Game_OrderBy;
|
|
7141
6926
|
(function (Game_OrderBy) {
|
|
7142
6927
|
Game_OrderBy["ActiveConditionsEntityIds"] = "_activeConditionsEntityIds";
|
|
7143
6928
|
Game_OrderBy["CanceledConditionsEntityIds"] = "_canceledConditionsEntityIds";
|
|
@@ -7169,8 +6954,8 @@ var Game_OrderBy$1;
|
|
|
7169
6954
|
Game_OrderBy["Status"] = "status";
|
|
7170
6955
|
Game_OrderBy["Title"] = "title";
|
|
7171
6956
|
Game_OrderBy["Turnover"] = "turnover";
|
|
7172
|
-
})(Game_OrderBy
|
|
7173
|
-
var League_OrderBy
|
|
6957
|
+
})(Game_OrderBy || (Game_OrderBy = {}));
|
|
6958
|
+
var League_OrderBy;
|
|
7174
6959
|
(function (League_OrderBy) {
|
|
7175
6960
|
League_OrderBy["ActiveGamesEntityIds"] = "activeGamesEntityIds";
|
|
7176
6961
|
League_OrderBy["Country"] = "country";
|
|
@@ -7180,7 +6965,7 @@ var League_OrderBy$1;
|
|
|
7180
6965
|
League_OrderBy["Name"] = "name";
|
|
7181
6966
|
League_OrderBy["Slug"] = "slug";
|
|
7182
6967
|
League_OrderBy["Turnover"] = "turnover";
|
|
7183
|
-
})(League_OrderBy
|
|
6968
|
+
})(League_OrderBy || (League_OrderBy = {}));
|
|
7184
6969
|
var LiquidityPoolContractType;
|
|
7185
6970
|
(function (LiquidityPoolContractType) {
|
|
7186
6971
|
LiquidityPoolContractType["V1"] = "V1";
|
|
@@ -7361,17 +7146,17 @@ var LiveSelection_OrderBy;
|
|
|
7361
7146
|
LiveSelection_OrderBy["Result"] = "result";
|
|
7362
7147
|
})(LiveSelection_OrderBy || (LiveSelection_OrderBy = {}));
|
|
7363
7148
|
/** Defines the order direction, either ascending or descending */
|
|
7364
|
-
var OrderDirection
|
|
7149
|
+
var OrderDirection;
|
|
7365
7150
|
(function (OrderDirection) {
|
|
7366
7151
|
OrderDirection["Asc"] = "asc";
|
|
7367
7152
|
OrderDirection["Desc"] = "desc";
|
|
7368
|
-
})(OrderDirection
|
|
7369
|
-
var OutcomeResult
|
|
7153
|
+
})(OrderDirection || (OrderDirection = {}));
|
|
7154
|
+
var OutcomeResult;
|
|
7370
7155
|
(function (OutcomeResult) {
|
|
7371
7156
|
OutcomeResult["Lost"] = "Lost";
|
|
7372
7157
|
OutcomeResult["Won"] = "Won";
|
|
7373
|
-
})(OutcomeResult
|
|
7374
|
-
var Outcome_OrderBy
|
|
7158
|
+
})(OutcomeResult || (OutcomeResult = {}));
|
|
7159
|
+
var Outcome_OrderBy;
|
|
7375
7160
|
(function (Outcome_OrderBy) {
|
|
7376
7161
|
Outcome_OrderBy["BetsEntityIds"] = "_betsEntityIds";
|
|
7377
7162
|
Outcome_OrderBy["UpdatedAt"] = "_updatedAt";
|
|
@@ -7386,20 +7171,20 @@ var Outcome_OrderBy$1;
|
|
|
7386
7171
|
Outcome_OrderBy["Selections"] = "selections";
|
|
7387
7172
|
Outcome_OrderBy["SortOrder"] = "sortOrder";
|
|
7388
7173
|
Outcome_OrderBy["Title"] = "title";
|
|
7389
|
-
})(Outcome_OrderBy
|
|
7174
|
+
})(Outcome_OrderBy || (Outcome_OrderBy = {}));
|
|
7390
7175
|
var OutcomesKeyConditionRelation_OrderBy;
|
|
7391
7176
|
(function (OutcomesKeyConditionRelation_OrderBy) {
|
|
7392
7177
|
OutcomesKeyConditionRelation_OrderBy["ConditionEntityId"] = "conditionEntityId";
|
|
7393
7178
|
OutcomesKeyConditionRelation_OrderBy["Id"] = "id";
|
|
7394
7179
|
})(OutcomesKeyConditionRelation_OrderBy || (OutcomesKeyConditionRelation_OrderBy = {}));
|
|
7395
|
-
var Participant_OrderBy
|
|
7180
|
+
var Participant_OrderBy;
|
|
7396
7181
|
(function (Participant_OrderBy) {
|
|
7397
7182
|
Participant_OrderBy["Game"] = "game";
|
|
7398
7183
|
Participant_OrderBy["Id"] = "id";
|
|
7399
7184
|
Participant_OrderBy["Image"] = "image";
|
|
7400
7185
|
Participant_OrderBy["Name"] = "name";
|
|
7401
7186
|
Participant_OrderBy["SortOrder"] = "sortOrder";
|
|
7402
|
-
})(Participant_OrderBy
|
|
7187
|
+
})(Participant_OrderBy || (Participant_OrderBy = {}));
|
|
7403
7188
|
var SelectionResult;
|
|
7404
7189
|
(function (SelectionResult) {
|
|
7405
7190
|
SelectionResult["Lost"] = "Lost";
|
|
@@ -7418,14 +7203,14 @@ var Selection_OrderBy;
|
|
|
7418
7203
|
Selection_OrderBy["RawOdds"] = "rawOdds";
|
|
7419
7204
|
Selection_OrderBy["Result"] = "result";
|
|
7420
7205
|
})(Selection_OrderBy || (Selection_OrderBy = {}));
|
|
7421
|
-
var SportHub_OrderBy
|
|
7206
|
+
var SportHub_OrderBy;
|
|
7422
7207
|
(function (SportHub_OrderBy) {
|
|
7423
7208
|
SportHub_OrderBy["Id"] = "id";
|
|
7424
7209
|
SportHub_OrderBy["Name"] = "name";
|
|
7425
7210
|
SportHub_OrderBy["Slug"] = "slug";
|
|
7426
7211
|
SportHub_OrderBy["Sports"] = "sports";
|
|
7427
|
-
})(SportHub_OrderBy
|
|
7428
|
-
var Sport_OrderBy
|
|
7212
|
+
})(SportHub_OrderBy || (SportHub_OrderBy = {}));
|
|
7213
|
+
var Sport_OrderBy;
|
|
7429
7214
|
(function (Sport_OrderBy) {
|
|
7430
7215
|
Sport_OrderBy["Countries"] = "countries";
|
|
7431
7216
|
Sport_OrderBy["Games"] = "games";
|
|
@@ -7434,7 +7219,7 @@ var Sport_OrderBy$1;
|
|
|
7434
7219
|
Sport_OrderBy["Slug"] = "slug";
|
|
7435
7220
|
Sport_OrderBy["SportId"] = "sportId";
|
|
7436
7221
|
Sport_OrderBy["Sporthub"] = "sporthub";
|
|
7437
|
-
})(Sport_OrderBy
|
|
7222
|
+
})(Sport_OrderBy || (Sport_OrderBy = {}));
|
|
7438
7223
|
var V3_BetMetadata_OrderBy;
|
|
7439
7224
|
(function (V3_BetMetadata_OrderBy) {
|
|
7440
7225
|
V3_BetMetadata_OrderBy["FreebetId"] = "freebetId";
|
|
@@ -7561,234 +7346,25 @@ var V3_Selection_OrderBy;
|
|
|
7561
7346
|
V3_Selection_OrderBy["Result"] = "result";
|
|
7562
7347
|
V3_Selection_OrderBy["SettledMargin"] = "settledMargin";
|
|
7563
7348
|
})(V3_Selection_OrderBy || (V3_Selection_OrderBy = {}));
|
|
7564
|
-
var _SubgraphErrorPolicy_
|
|
7565
|
-
(function (_SubgraphErrorPolicy_) {
|
|
7566
|
-
/** Data will be returned even if the subgraph has indexing errors */
|
|
7567
|
-
_SubgraphErrorPolicy_["Allow"] = "allow";
|
|
7568
|
-
/** If the subgraph has indexing errors, data will be omitted. The default. */
|
|
7569
|
-
_SubgraphErrorPolicy_["Deny"] = "deny";
|
|
7570
|
-
})(_SubgraphErrorPolicy_$1 || (_SubgraphErrorPolicy_$1 = {}));var Aggregation_Interval;
|
|
7571
|
-
(function (Aggregation_Interval) {
|
|
7572
|
-
Aggregation_Interval["Day"] = "day";
|
|
7573
|
-
Aggregation_Interval["Hour"] = "hour";
|
|
7574
|
-
})(Aggregation_Interval || (Aggregation_Interval = {}));
|
|
7575
|
-
var ConditionState;
|
|
7576
|
-
(function (ConditionState) {
|
|
7577
|
-
ConditionState["Active"] = "Active";
|
|
7578
|
-
ConditionState["Canceled"] = "Canceled";
|
|
7579
|
-
ConditionState["Removed"] = "Removed";
|
|
7580
|
-
ConditionState["Resolved"] = "Resolved";
|
|
7581
|
-
ConditionState["Stopped"] = "Stopped";
|
|
7582
|
-
})(ConditionState || (ConditionState = {}));
|
|
7583
|
-
var Condition_OrderBy;
|
|
7584
|
-
(function (Condition_OrderBy) {
|
|
7585
|
-
Condition_OrderBy["IsCustomSettings"] = "_isCustomSettings";
|
|
7586
|
-
Condition_OrderBy["MaxLiveConditionPotentialLoss"] = "_maxLiveConditionPotentialLoss";
|
|
7587
|
-
Condition_OrderBy["MaxLiveOutcomePotentialLoss"] = "_maxLiveOutcomePotentialLoss";
|
|
7588
|
-
Condition_OrderBy["UpdatedAt"] = "_updatedAt";
|
|
7589
|
-
Condition_OrderBy["ConditionId"] = "conditionId";
|
|
7590
|
-
Condition_OrderBy["CreatedBlockNumber"] = "createdBlockNumber";
|
|
7591
|
-
Condition_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
|
|
7592
|
-
Condition_OrderBy["CurrentConditionPotentialLoss"] = "currentConditionPotentialLoss";
|
|
7593
|
-
Condition_OrderBy["Description"] = "description";
|
|
7594
|
-
Condition_OrderBy["Game"] = "game";
|
|
7595
|
-
Condition_OrderBy["Id"] = "id";
|
|
7596
|
-
Condition_OrderBy["IsCashoutEnabled"] = "isCashoutEnabled";
|
|
7597
|
-
Condition_OrderBy["IsExpressForbidden"] = "isExpressForbidden";
|
|
7598
|
-
Condition_OrderBy["IsLiveEnabled"] = "isLiveEnabled";
|
|
7599
|
-
Condition_OrderBy["IsPrematchEnabled"] = "isPrematchEnabled";
|
|
7600
|
-
Condition_OrderBy["Margin"] = "margin";
|
|
7601
|
-
Condition_OrderBy["MaxConditionPotentialLoss"] = "maxConditionPotentialLoss";
|
|
7602
|
-
Condition_OrderBy["MaxOutcomePotentialLoss"] = "maxOutcomePotentialLoss";
|
|
7603
|
-
Condition_OrderBy["Outcomes"] = "outcomes";
|
|
7604
|
-
Condition_OrderBy["OutcomesIds"] = "outcomesIds";
|
|
7605
|
-
Condition_OrderBy["RawCurrentConditionPotentialLoss"] = "rawCurrentConditionPotentialLoss";
|
|
7606
|
-
Condition_OrderBy["RawMaxConditionPotentialLoss"] = "rawMaxConditionPotentialLoss";
|
|
7607
|
-
Condition_OrderBy["RawMaxOutcomePotentialLoss"] = "rawMaxOutcomePotentialLoss";
|
|
7608
|
-
Condition_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7609
|
-
Condition_OrderBy["SettledBlockNumber"] = "settledBlockNumber";
|
|
7610
|
-
Condition_OrderBy["SettledBlockTimestamp"] = "settledBlockTimestamp";
|
|
7611
|
-
Condition_OrderBy["State"] = "state";
|
|
7612
|
-
Condition_OrderBy["Title"] = "title";
|
|
7613
|
-
Condition_OrderBy["Turnover"] = "turnover";
|
|
7614
|
-
Condition_OrderBy["WinningOutcomesCount"] = "winningOutcomesCount";
|
|
7615
|
-
Condition_OrderBy["WonOutcomeIds"] = "wonOutcomeIds";
|
|
7616
|
-
Condition_OrderBy["WonOutcomes"] = "wonOutcomes";
|
|
7617
|
-
})(Condition_OrderBy || (Condition_OrderBy = {}));
|
|
7618
|
-
var Country_OrderBy;
|
|
7619
|
-
(function (Country_OrderBy) {
|
|
7620
|
-
Country_OrderBy["ActiveGamesCount"] = "activeGamesCount";
|
|
7621
|
-
Country_OrderBy["ActiveLeaguesCount"] = "activeLeaguesCount";
|
|
7622
|
-
Country_OrderBy["ActiveLiveGamesCount"] = "activeLiveGamesCount";
|
|
7623
|
-
Country_OrderBy["ActiveLiveLeaguesCount"] = "activeLiveLeaguesCount";
|
|
7624
|
-
Country_OrderBy["ActivePrematchGamesCount"] = "activePrematchGamesCount";
|
|
7625
|
-
Country_OrderBy["ActivePrematchLeaguesCount"] = "activePrematchLeaguesCount";
|
|
7626
|
-
Country_OrderBy["Games"] = "games";
|
|
7627
|
-
Country_OrderBy["Id"] = "id";
|
|
7628
|
-
Country_OrderBy["Leagues"] = "leagues";
|
|
7629
|
-
Country_OrderBy["Name"] = "name";
|
|
7630
|
-
Country_OrderBy["RawTotalTurnover"] = "rawTotalTurnover";
|
|
7631
|
-
Country_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7632
|
-
Country_OrderBy["Slug"] = "slug";
|
|
7633
|
-
Country_OrderBy["Sport"] = "sport";
|
|
7634
|
-
Country_OrderBy["TotalTurnover"] = "totalTurnover";
|
|
7635
|
-
Country_OrderBy["Turnover"] = "turnover";
|
|
7636
|
-
})(Country_OrderBy || (Country_OrderBy = {}));
|
|
7637
|
-
var EventName;
|
|
7638
|
-
(function (EventName) {
|
|
7639
|
-
EventName["ConditionCreated"] = "ConditionCreated";
|
|
7640
|
-
EventName["ConditionUpdated"] = "ConditionUpdated";
|
|
7641
|
-
EventName["GameCreated"] = "GameCreated";
|
|
7642
|
-
EventName["GameUpdated"] = "GameUpdated";
|
|
7643
|
-
})(EventName || (EventName = {}));
|
|
7644
|
-
var Event_OrderBy;
|
|
7645
|
-
(function (Event_OrderBy) {
|
|
7646
|
-
Event_OrderBy["BlockNumber"] = "blockNumber";
|
|
7647
|
-
Event_OrderBy["BlockTimestamp"] = "blockTimestamp";
|
|
7648
|
-
Event_OrderBy["ConditionId"] = "conditionId";
|
|
7649
|
-
Event_OrderBy["GameId"] = "gameId";
|
|
7650
|
-
Event_OrderBy["Id"] = "id";
|
|
7651
|
-
Event_OrderBy["Name"] = "name";
|
|
7652
|
-
})(Event_OrderBy || (Event_OrderBy = {}));
|
|
7653
|
-
var GameState;
|
|
7654
|
-
(function (GameState) {
|
|
7655
|
-
GameState["Finished"] = "Finished";
|
|
7656
|
-
GameState["Live"] = "Live";
|
|
7657
|
-
GameState["Prematch"] = "Prematch";
|
|
7658
|
-
GameState["Stopped"] = "Stopped";
|
|
7659
|
-
})(GameState || (GameState = {}));
|
|
7660
|
-
var Game_OrderBy;
|
|
7661
|
-
(function (Game_OrderBy) {
|
|
7662
|
-
Game_OrderBy["ProviderTitle"] = "_providerTitle";
|
|
7663
|
-
Game_OrderBy["UpdatedAt"] = "_updatedAt";
|
|
7664
|
-
Game_OrderBy["ActiveAndStoppedConditionsCount"] = "activeAndStoppedConditionsCount";
|
|
7665
|
-
Game_OrderBy["ActiveConditionsCount"] = "activeConditionsCount";
|
|
7666
|
-
Game_OrderBy["Conditions"] = "conditions";
|
|
7667
|
-
Game_OrderBy["ConditionsCount"] = "conditionsCount";
|
|
7668
|
-
Game_OrderBy["Country"] = "country";
|
|
7669
|
-
Game_OrderBy["CreatedBlockNumber"] = "createdBlockNumber";
|
|
7670
|
-
Game_OrderBy["CreatedBlockTimestamp"] = "createdBlockTimestamp";
|
|
7671
|
-
Game_OrderBy["Description"] = "description";
|
|
7672
|
-
Game_OrderBy["FinishedBlockNumber"] = "finishedBlockNumber";
|
|
7673
|
-
Game_OrderBy["FinishedBlockTimestamp"] = "finishedBlockTimestamp";
|
|
7674
|
-
Game_OrderBy["GameId"] = "gameId";
|
|
7675
|
-
Game_OrderBy["Id"] = "id";
|
|
7676
|
-
Game_OrderBy["League"] = "league";
|
|
7677
|
-
Game_OrderBy["Participants"] = "participants";
|
|
7678
|
-
Game_OrderBy["RawTotalTurnover"] = "rawTotalTurnover";
|
|
7679
|
-
Game_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7680
|
-
Game_OrderBy["SettledBlockNumber"] = "settledBlockNumber";
|
|
7681
|
-
Game_OrderBy["SettledBlockTimestamp"] = "settledBlockTimestamp";
|
|
7682
|
-
Game_OrderBy["SettledConditionsCount"] = "settledConditionsCount";
|
|
7683
|
-
Game_OrderBy["Slug"] = "slug";
|
|
7684
|
-
Game_OrderBy["Sport"] = "sport";
|
|
7685
|
-
Game_OrderBy["StartsAt"] = "startsAt";
|
|
7686
|
-
Game_OrderBy["State"] = "state";
|
|
7687
|
-
Game_OrderBy["Title"] = "title";
|
|
7688
|
-
Game_OrderBy["TotalTurnover"] = "totalTurnover";
|
|
7689
|
-
Game_OrderBy["Turnover"] = "turnover";
|
|
7690
|
-
})(Game_OrderBy || (Game_OrderBy = {}));
|
|
7691
|
-
var League_OrderBy;
|
|
7692
|
-
(function (League_OrderBy) {
|
|
7693
|
-
League_OrderBy["ActiveGamesCount"] = "activeGamesCount";
|
|
7694
|
-
League_OrderBy["ActiveLiveGamesCount"] = "activeLiveGamesCount";
|
|
7695
|
-
League_OrderBy["ActivePrematchGamesCount"] = "activePrematchGamesCount";
|
|
7696
|
-
League_OrderBy["Country"] = "country";
|
|
7697
|
-
League_OrderBy["Games"] = "games";
|
|
7698
|
-
League_OrderBy["Id"] = "id";
|
|
7699
|
-
League_OrderBy["Name"] = "name";
|
|
7700
|
-
League_OrderBy["RawTotalTurnover"] = "rawTotalTurnover";
|
|
7701
|
-
League_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7702
|
-
League_OrderBy["Slug"] = "slug";
|
|
7703
|
-
League_OrderBy["Sport"] = "sport";
|
|
7704
|
-
League_OrderBy["TotalTurnover"] = "totalTurnover";
|
|
7705
|
-
League_OrderBy["Turnover"] = "turnover";
|
|
7706
|
-
})(League_OrderBy || (League_OrderBy = {}));
|
|
7707
|
-
/** Defines the order direction, either ascending or descending */
|
|
7708
|
-
var OrderDirection;
|
|
7709
|
-
(function (OrderDirection) {
|
|
7710
|
-
OrderDirection["Asc"] = "asc";
|
|
7711
|
-
OrderDirection["Desc"] = "desc";
|
|
7712
|
-
})(OrderDirection || (OrderDirection = {}));
|
|
7713
|
-
var OutcomeResult;
|
|
7714
|
-
(function (OutcomeResult) {
|
|
7715
|
-
OutcomeResult["Lost"] = "Lost";
|
|
7716
|
-
OutcomeResult["Won"] = "Won";
|
|
7717
|
-
})(OutcomeResult || (OutcomeResult = {}));
|
|
7718
|
-
var Outcome_OrderBy;
|
|
7719
|
-
(function (Outcome_OrderBy) {
|
|
7720
|
-
Outcome_OrderBy["IsCustomPrice"] = "_isCustomPrice";
|
|
7721
|
-
Outcome_OrderBy["UpdatedAt"] = "_updatedAt";
|
|
7722
|
-
Outcome_OrderBy["Condition"] = "condition";
|
|
7723
|
-
Outcome_OrderBy["CurrentOdds"] = "currentOdds";
|
|
7724
|
-
Outcome_OrderBy["Id"] = "id";
|
|
7725
|
-
Outcome_OrderBy["OutcomeId"] = "outcomeId";
|
|
7726
|
-
Outcome_OrderBy["PotentialLoss"] = "potentialLoss";
|
|
7727
|
-
Outcome_OrderBy["RawCurrentOdds"] = "rawCurrentOdds";
|
|
7728
|
-
Outcome_OrderBy["RawPotentialLoss"] = "rawPotentialLoss";
|
|
7729
|
-
Outcome_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7730
|
-
Outcome_OrderBy["Result"] = "result";
|
|
7731
|
-
Outcome_OrderBy["SortOrder"] = "sortOrder";
|
|
7732
|
-
Outcome_OrderBy["Title"] = "title";
|
|
7733
|
-
Outcome_OrderBy["Turnover"] = "turnover";
|
|
7734
|
-
})(Outcome_OrderBy || (Outcome_OrderBy = {}));
|
|
7735
|
-
var Participant_OrderBy;
|
|
7736
|
-
(function (Participant_OrderBy) {
|
|
7737
|
-
Participant_OrderBy["Game"] = "game";
|
|
7738
|
-
Participant_OrderBy["Id"] = "id";
|
|
7739
|
-
Participant_OrderBy["Image"] = "image";
|
|
7740
|
-
Participant_OrderBy["Name"] = "name";
|
|
7741
|
-
Participant_OrderBy["SortOrder"] = "sortOrder";
|
|
7742
|
-
})(Participant_OrderBy || (Participant_OrderBy = {}));
|
|
7743
|
-
var SportHub_OrderBy;
|
|
7744
|
-
(function (SportHub_OrderBy) {
|
|
7745
|
-
SportHub_OrderBy["Id"] = "id";
|
|
7746
|
-
SportHub_OrderBy["Name"] = "name";
|
|
7747
|
-
SportHub_OrderBy["Slug"] = "slug";
|
|
7748
|
-
SportHub_OrderBy["Sports"] = "sports";
|
|
7749
|
-
})(SportHub_OrderBy || (SportHub_OrderBy = {}));
|
|
7750
|
-
var Sport_OrderBy;
|
|
7751
|
-
(function (Sport_OrderBy) {
|
|
7752
|
-
Sport_OrderBy["ActiveCountriesCount"] = "activeCountriesCount";
|
|
7753
|
-
Sport_OrderBy["ActiveGamesCount"] = "activeGamesCount";
|
|
7754
|
-
Sport_OrderBy["ActiveLeaguesCount"] = "activeLeaguesCount";
|
|
7755
|
-
Sport_OrderBy["ActiveLiveCountriesCount"] = "activeLiveCountriesCount";
|
|
7756
|
-
Sport_OrderBy["ActiveLiveGamesCount"] = "activeLiveGamesCount";
|
|
7757
|
-
Sport_OrderBy["ActiveLiveLeaguesCount"] = "activeLiveLeaguesCount";
|
|
7758
|
-
Sport_OrderBy["ActivePrematchCountriesCount"] = "activePrematchCountriesCount";
|
|
7759
|
-
Sport_OrderBy["ActivePrematchGamesCount"] = "activePrematchGamesCount";
|
|
7760
|
-
Sport_OrderBy["ActivePrematchLeaguesCount"] = "activePrematchLeaguesCount";
|
|
7761
|
-
Sport_OrderBy["Countries"] = "countries";
|
|
7762
|
-
Sport_OrderBy["Games"] = "games";
|
|
7763
|
-
Sport_OrderBy["Id"] = "id";
|
|
7764
|
-
Sport_OrderBy["Leagues"] = "leagues";
|
|
7765
|
-
Sport_OrderBy["Name"] = "name";
|
|
7766
|
-
Sport_OrderBy["RawTotalTurnover"] = "rawTotalTurnover";
|
|
7767
|
-
Sport_OrderBy["RawTurnover"] = "rawTurnover";
|
|
7768
|
-
Sport_OrderBy["Slug"] = "slug";
|
|
7769
|
-
Sport_OrderBy["SportId"] = "sportId";
|
|
7770
|
-
Sport_OrderBy["Sporthub"] = "sporthub";
|
|
7771
|
-
Sport_OrderBy["TotalTurnover"] = "totalTurnover";
|
|
7772
|
-
Sport_OrderBy["Turnover"] = "turnover";
|
|
7773
|
-
})(Sport_OrderBy || (Sport_OrderBy = {}));
|
|
7774
|
-
var VirtualCondition_OrderBy;
|
|
7775
|
-
(function (VirtualCondition_OrderBy) {
|
|
7776
|
-
VirtualCondition_OrderBy["Data"] = "data";
|
|
7777
|
-
VirtualCondition_OrderBy["Game"] = "game";
|
|
7778
|
-
VirtualCondition_OrderBy["Id"] = "id";
|
|
7779
|
-
})(VirtualCondition_OrderBy || (VirtualCondition_OrderBy = {}));
|
|
7780
|
-
var VirtualGame_OrderBy;
|
|
7781
|
-
(function (VirtualGame_OrderBy) {
|
|
7782
|
-
VirtualGame_OrderBy["Conditions"] = "conditions";
|
|
7783
|
-
VirtualGame_OrderBy["Id"] = "id";
|
|
7784
|
-
})(VirtualGame_OrderBy || (VirtualGame_OrderBy = {}));
|
|
7785
|
-
var _SubgraphErrorPolicy_;
|
|
7349
|
+
var _SubgraphErrorPolicy_;
|
|
7786
7350
|
(function (_SubgraphErrorPolicy_) {
|
|
7787
7351
|
/** Data will be returned even if the subgraph has indexing errors */
|
|
7788
7352
|
_SubgraphErrorPolicy_["Allow"] = "allow";
|
|
7789
7353
|
/** If the subgraph has indexing errors, data will be omitted. The default. */
|
|
7790
7354
|
_SubgraphErrorPolicy_["Deny"] = "deny";
|
|
7791
7355
|
})(_SubgraphErrorPolicy_ || (_SubgraphErrorPolicy_ = {}));const CONDITION_PROVIDER_LENGTH = 3;
|
|
7356
|
+
/**
|
|
7357
|
+
* Extracts the provider ID from a condition ID string.
|
|
7358
|
+
* The provider ID is encoded in characters 2-4 of the condition ID.
|
|
7359
|
+
*
|
|
7360
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/getProviderFromId
|
|
7361
|
+
*
|
|
7362
|
+
* @example
|
|
7363
|
+
* import { getProviderFromId } from '@azuro-org/toolkit'
|
|
7364
|
+
*
|
|
7365
|
+
* const providerId = getProviderFromId('C001234567890')
|
|
7366
|
+
* console.log(providerId) // 001
|
|
7367
|
+
* */
|
|
7792
7368
|
const getProviderFromId = (id) => {
|
|
7793
7369
|
return +(id.slice(1, 1 + CONDITION_PROVIDER_LENGTH));
|
|
7794
7370
|
};const formatToFixed = (value, digitsCount) => {
|
|
@@ -7797,70 +7373,102 @@ const getProviderFromId = (id) => {
|
|
|
7797
7373
|
return +value;
|
|
7798
7374
|
}
|
|
7799
7375
|
const [int, digits] = value.split('.');
|
|
7800
|
-
|
|
7376
|
+
if (!digitsCount || digitsCount < 0 || !digits?.length || digits.length < digitsCount) {
|
|
7377
|
+
return +(int || 0);
|
|
7378
|
+
}
|
|
7379
|
+
return +`${int}.${digits.slice(0, digitsCount)}`;
|
|
7801
7380
|
};const adjustSubBetOdds = (value) => Math.ceil(+value / ODDS_COMBO_FEE_MODIFIER * 100) / 100;
|
|
7802
|
-
|
|
7381
|
+
/**
|
|
7382
|
+
* Calculates the minimum acceptable odds considering slippage for single or combo bets.
|
|
7383
|
+
* For combo bets, applies fee modifiers and multiplies individual odds to calculate total odds.
|
|
7384
|
+
*
|
|
7385
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/calcMinOdds
|
|
7386
|
+
*
|
|
7387
|
+
* @example
|
|
7388
|
+
* import { calcMindOdds } from '@azuro-org/toolkit'
|
|
7389
|
+
*
|
|
7390
|
+
* // Single bet with 5% slippage
|
|
7391
|
+
* const minOdds = calcMindOdds({ odds: 1.5, slippage: 5 })
|
|
7392
|
+
*
|
|
7393
|
+
* // Combo bet with multiple odds
|
|
7394
|
+
* const comboMinOdds = calcMindOdds({ odds: [1.5, 2.0, 1.8], slippage: 5 })
|
|
7395
|
+
* */
|
|
7396
|
+
const calcMinOdds = (props) => {
|
|
7397
|
+
if (props.slippage && props.slippage >= 100) {
|
|
7398
|
+
return (1).toFixed(ODDS_DECIMALS);
|
|
7399
|
+
}
|
|
7803
7400
|
let totalOdds;
|
|
7804
7401
|
if (typeof props.odds === 'number') {
|
|
7805
|
-
totalOdds = props.odds;
|
|
7402
|
+
totalOdds = formatToFixed(props.odds, 2);
|
|
7806
7403
|
}
|
|
7807
7404
|
else {
|
|
7808
7405
|
const comboOdds = props.odds.reduce((acc, odds) => acc * adjustSubBetOdds(odds), 1);
|
|
7809
7406
|
totalOdds = formatToFixed(comboOdds * ODDS_COMBO_FEE_MODIFIER, 2);
|
|
7810
7407
|
}
|
|
7408
|
+
if (!props.slippage) {
|
|
7409
|
+
return totalOdds.toFixed(ODDS_DECIMALS);
|
|
7410
|
+
}
|
|
7811
7411
|
const minOdds = formatToFixed(1 + (totalOdds - 1) * (100 - props.slippage) / 100, 2);
|
|
7812
7412
|
return minOdds.toFixed(ODDS_DECIMALS);
|
|
7813
|
-
}
|
|
7413
|
+
};/**
|
|
7414
|
+
* Normalize events timestamp (ISO String, unix time in seconds or ms) to milliseconds.
|
|
7415
|
+
*
|
|
7416
|
+
* As a reasonable threshold for whether to count the number in seconds or milliseconds,
|
|
7417
|
+
* it takes the value 32_503_680_000 (which equals January 12, 1971 in ms and Jan 01, 3000 in seconds).
|
|
7418
|
+
*
|
|
7419
|
+
* So it isn't applicable to dates before January 12, 1971.
|
|
7420
|
+
* */
|
|
7421
|
+
const normalizeTimestampToMs = (timestamp) => {
|
|
7422
|
+
if (typeof timestamp === 'string' && isNaN(+timestamp)) {
|
|
7423
|
+
return Date.parse(timestamp);
|
|
7424
|
+
}
|
|
7425
|
+
const numericValue = +timestamp;
|
|
7426
|
+
// If the value is less than a reasonable milliseconds threshold,
|
|
7427
|
+
// treat it as seconds, otherwise as milliseconds
|
|
7428
|
+
return numericValue < 32_503_680_000 ? numericValue * 1000 : numericValue;
|
|
7429
|
+
};/**
|
|
7430
|
+
* Determines if a game is pending resolution after completion.
|
|
7431
|
+
* Returns true if the game is in Live state but has exceeded the expected resolution window (100 minutes after start).
|
|
7432
|
+
*
|
|
7433
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/getIsPendingResolution
|
|
7434
|
+
*
|
|
7435
|
+
* @example
|
|
7436
|
+
* import { getIsPendingResolution, GameState } from '@azuro-org/toolkit'
|
|
7437
|
+
*
|
|
7438
|
+
* const isPending = getIsPendingResolution({
|
|
7439
|
+
* state: GameState.Live,
|
|
7440
|
+
* startsAt: '1640000000'
|
|
7441
|
+
* })
|
|
7442
|
+
* */
|
|
7443
|
+
const getIsPendingResolution = ({ state, startsAt }) => {
|
|
7814
7444
|
if (state !== GameState.Live) {
|
|
7815
7445
|
return false;
|
|
7816
7446
|
}
|
|
7817
|
-
const startDate =
|
|
7447
|
+
const startDate = normalizeTimestampToMs(startsAt);
|
|
7818
7448
|
const now = Date.now();
|
|
7819
7449
|
const isStarted = startDate < now;
|
|
7820
7450
|
const pendingResolutionDate = startDate + 6000000;
|
|
7821
7451
|
return isStarted && pendingResolutionDate < now;
|
|
7822
|
-
}
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
if (graphStatus === BetStatus$1.Resolved) {
|
|
7843
|
-
return BetStatus.Resolved;
|
|
7844
|
-
}
|
|
7845
|
-
const isExpress = games.length > 1;
|
|
7846
|
-
const isPendingResolution = isExpress
|
|
7847
|
-
? getExpressIsPendingResolution(games)
|
|
7848
|
-
: getIsPendingResolution(games[0]);
|
|
7849
|
-
if (isPendingResolution) {
|
|
7850
|
-
return BetStatus.PendingResolution;
|
|
7851
|
-
}
|
|
7852
|
-
const isLive = games.some(game => game.state === GameState.Live);
|
|
7853
|
-
if (isLive) {
|
|
7854
|
-
return BetStatus.Live;
|
|
7855
|
-
}
|
|
7856
|
-
return BetStatus.Accepted;
|
|
7857
|
-
};const getBetFee = async (chainId) => {
|
|
7858
|
-
const api = getApiEndpoint(chainId);
|
|
7859
|
-
const environment = environments[chainId];
|
|
7860
|
-
const response = await fetch(`${api}/bet/gas-info?environment=${environment}`);
|
|
7861
|
-
const data = await response.json();
|
|
7862
|
-
return data;
|
|
7863
|
-
};const groupConditionsByMarket = (conditions) => {
|
|
7452
|
+
};/**
|
|
7453
|
+
* Groups game conditions by their market types and sorts them according to sport-specific ordering.
|
|
7454
|
+
* It processes outcomes to include selection names, handles duplicate conditions, and organizes data for display.
|
|
7455
|
+
*
|
|
7456
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/groupConditionsByMarket
|
|
7457
|
+
*
|
|
7458
|
+
* @example
|
|
7459
|
+
* import { groupConditionsByMarket } from '@azuro-org/toolkit'
|
|
7460
|
+
*
|
|
7461
|
+
* const conditions = await getConditionsByGameIds({ gameIds: ['123'] })
|
|
7462
|
+
* const markets = groupConditionsByMarket(conditions)
|
|
7463
|
+
*
|
|
7464
|
+
* markets.forEach(market => {
|
|
7465
|
+
* console.log(market.name) // e.g., "Match Winner", "Total Goals"
|
|
7466
|
+
* market.conditions.forEach(condition => {
|
|
7467
|
+
* console.log(condition.outcomes) // outcomes with odds and selection names
|
|
7468
|
+
* })
|
|
7469
|
+
* })
|
|
7470
|
+
* */
|
|
7471
|
+
const groupConditionsByMarket = (conditions) => {
|
|
7864
7472
|
const sportId = conditions[0].game.sport.sportId;
|
|
7865
7473
|
const markets = {};
|
|
7866
7474
|
const stateByOutcomeIds = {};
|
|
@@ -7978,7 +7586,119 @@ const getBetStatus = (props) => {
|
|
|
7978
7586
|
}
|
|
7979
7587
|
return 0;
|
|
7980
7588
|
});
|
|
7981
|
-
};
|
|
7589
|
+
};var BetStatus;
|
|
7590
|
+
(function (BetStatus) {
|
|
7591
|
+
BetStatus[BetStatus["Accepted"] = 0] = "Accepted";
|
|
7592
|
+
BetStatus[BetStatus["Live"] = 1] = "Live";
|
|
7593
|
+
BetStatus[BetStatus["PendingResolution"] = 2] = "PendingResolution";
|
|
7594
|
+
BetStatus[BetStatus["Resolved"] = 3] = "Resolved";
|
|
7595
|
+
BetStatus[BetStatus["Canceled"] = 4] = "Canceled";
|
|
7596
|
+
BetStatus[BetStatus["Preparing"] = 5] = "Preparing";
|
|
7597
|
+
BetStatus[BetStatus["Rejected"] = 6] = "Rejected";
|
|
7598
|
+
})(BetStatus || (BetStatus = {}));
|
|
7599
|
+
const filterLastGames = (games) => {
|
|
7600
|
+
const lastStartDate = Math.max(...games.map(({ startsAt }) => +startsAt));
|
|
7601
|
+
return games.filter(({ startsAt }) => +startsAt === lastStartDate);
|
|
7602
|
+
};
|
|
7603
|
+
/**
|
|
7604
|
+
* Determines the current status of a bet based on order state, on-chain status, and game states.
|
|
7605
|
+
* Returns a unified bet status that combines API order state and blockchain data.
|
|
7606
|
+
*
|
|
7607
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBetStatus
|
|
7608
|
+
*
|
|
7609
|
+
* @example
|
|
7610
|
+
* import { getBetStatus, BetStatus } from '@azuro-org/toolkit'
|
|
7611
|
+
*
|
|
7612
|
+
* const games = [
|
|
7613
|
+
* { state: GameState.Live, startsAt: '1234567890' },
|
|
7614
|
+
* ]
|
|
7615
|
+
* const orderState = BetOrderState.Sent
|
|
7616
|
+
* const graphStatus = GraphBetStatus.Accepted
|
|
7617
|
+
*
|
|
7618
|
+
* const status = getBetStatus({ games, orderState, graphStatus })
|
|
7619
|
+
*
|
|
7620
|
+
* if (status === BetStatus.Live) {
|
|
7621
|
+
* console.log('Bet is live!')
|
|
7622
|
+
* }
|
|
7623
|
+
* */
|
|
7624
|
+
const getBetStatus = (props) => {
|
|
7625
|
+
const { games, graphStatus, orderState } = props;
|
|
7626
|
+
if ((!orderState && !graphStatus)
|
|
7627
|
+
|| orderState === BetOrderState.Pending
|
|
7628
|
+
|| orderState === BetOrderState.Created
|
|
7629
|
+
|| orderState === BetOrderState.Placed
|
|
7630
|
+
|| (orderState === BetOrderState.Sent && !graphStatus)) {
|
|
7631
|
+
return BetStatus.Preparing;
|
|
7632
|
+
}
|
|
7633
|
+
if (orderState === BetOrderState.Rejected) {
|
|
7634
|
+
return BetStatus.Rejected;
|
|
7635
|
+
}
|
|
7636
|
+
if (graphStatus === BetStatus$1.Canceled
|
|
7637
|
+
|| orderState === BetOrderState.Canceled) {
|
|
7638
|
+
return BetStatus.Canceled;
|
|
7639
|
+
}
|
|
7640
|
+
if (graphStatus === BetStatus$1.Resolved) {
|
|
7641
|
+
return BetStatus.Resolved;
|
|
7642
|
+
}
|
|
7643
|
+
const lastGames = filterLastGames(games);
|
|
7644
|
+
if (lastGames.every((game) => game.state === GameState.Finished)
|
|
7645
|
+
|| lastGames.some((game) => getIsPendingResolution(game))) {
|
|
7646
|
+
return BetStatus.PendingResolution;
|
|
7647
|
+
}
|
|
7648
|
+
const isLive = games.some(game => game.state === GameState.Live);
|
|
7649
|
+
if (isLive) {
|
|
7650
|
+
return BetStatus.Live;
|
|
7651
|
+
}
|
|
7652
|
+
return BetStatus.Accepted;
|
|
7653
|
+
};/**
|
|
7654
|
+
* Retrieves the current relayer fee information for placing bets on a specific chain.
|
|
7655
|
+
* Returns gas price, bet token rate, and calculated relayer fee amount.
|
|
7656
|
+
*
|
|
7657
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBetFee
|
|
7658
|
+
*
|
|
7659
|
+
* @example
|
|
7660
|
+
* import { getBetFee } from '@azuro-org/toolkit'
|
|
7661
|
+
*
|
|
7662
|
+
* const chainId = 137
|
|
7663
|
+
*
|
|
7664
|
+
* const feeInfo = await getBetFee(chainId)
|
|
7665
|
+
*
|
|
7666
|
+
* console.log('Relayer fee:', feeInfo.beautyRelayerFeeAmount, feeInfo.symbol)
|
|
7667
|
+
* console.log('Gas limit:', feeInfo.gasLimit)
|
|
7668
|
+
* */
|
|
7669
|
+
const getBetFee = async (chainId) => {
|
|
7670
|
+
const api = getApiEndpoint(chainId);
|
|
7671
|
+
const environment = environments[chainId];
|
|
7672
|
+
const response = await fetch(`${api}/bet/gas-info?environment=${environment}`);
|
|
7673
|
+
if (!response.ok) {
|
|
7674
|
+
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
7675
|
+
}
|
|
7676
|
+
const data = await response.json();
|
|
7677
|
+
return data;
|
|
7678
|
+
};/**
|
|
7679
|
+
* Generates EIP-712 typed data for signing a single (ordinary) bet.
|
|
7680
|
+
* This typed data is used with wallet signing methods to create a bet signature.
|
|
7681
|
+
*
|
|
7682
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBetTypedData
|
|
7683
|
+
*
|
|
7684
|
+
* @example
|
|
7685
|
+
* import { getBetTypedData } from '@azuro-org/toolkit'
|
|
7686
|
+
* import { signTypedData } from 'viem/actions'
|
|
7687
|
+
*
|
|
7688
|
+
* const account = '0x...'
|
|
7689
|
+
* const clientData = { chainId: 137, core: '0x...', ... }
|
|
7690
|
+
* const bet = {
|
|
7691
|
+
* conditionId: '1',
|
|
7692
|
+
* outcomeId: '1',
|
|
7693
|
+
* minOdds: '1500000000000',
|
|
7694
|
+
* amount: '1000000',
|
|
7695
|
+
* nonce: '1',
|
|
7696
|
+
* }
|
|
7697
|
+
*
|
|
7698
|
+
* const typedData = getBetTypedData({ account, clientData, bet })
|
|
7699
|
+
* const signature = await signTypedData(walletClient, typedData)
|
|
7700
|
+
* */
|
|
7701
|
+
const getBetTypedData = (props) => {
|
|
7982
7702
|
const { account, clientData, bet } = props;
|
|
7983
7703
|
const { chainId, core } = clientData;
|
|
7984
7704
|
const EIP712Domain = {
|
|
@@ -8015,7 +7735,34 @@ const getBetStatus = (props) => {
|
|
|
8015
7735
|
],
|
|
8016
7736
|
},
|
|
8017
7737
|
};
|
|
8018
|
-
}
|
|
7738
|
+
};/**
|
|
7739
|
+
* Generates EIP-712 typed data for signing a combo (parlay) bet.
|
|
7740
|
+
* This typed data is used with wallet signing methods to create a combo bet signature.
|
|
7741
|
+
*
|
|
7742
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getComboBetTypedData
|
|
7743
|
+
*
|
|
7744
|
+
* @example
|
|
7745
|
+
* import { getComboBetTypedData } from '@azuro-org/toolkit'
|
|
7746
|
+
* import { signTypedData } from 'viem/actions'
|
|
7747
|
+
*
|
|
7748
|
+
* const account = '0x...'
|
|
7749
|
+
* const clientData = { chainId: 137, core: '0x...', ... }
|
|
7750
|
+
* const bets = [
|
|
7751
|
+
* { conditionId: '1', outcomeId: '1' },
|
|
7752
|
+
* { conditionId: '2', outcomeId: '2' },
|
|
7753
|
+
* ]
|
|
7754
|
+
*
|
|
7755
|
+
* const typedData = getComboBetTypedData({
|
|
7756
|
+
* account,
|
|
7757
|
+
* clientData,
|
|
7758
|
+
* bets,
|
|
7759
|
+
* amount: '1000000',
|
|
7760
|
+
* minOdds: '3000000000000',
|
|
7761
|
+
* nonce: '1',
|
|
7762
|
+
* })
|
|
7763
|
+
* const signature = await signTypedData(walletClient, typedData)
|
|
7764
|
+
* */
|
|
7765
|
+
const getComboBetTypedData = (props) => {
|
|
8019
7766
|
const { account, amount, minOdds, nonce, clientData, bets } = props;
|
|
8020
7767
|
const { chainId, core } = clientData;
|
|
8021
7768
|
const EIP712Domain = {
|
|
@@ -8050,7 +7797,29 @@ const getBetStatus = (props) => {
|
|
|
8050
7797
|
})),
|
|
8051
7798
|
},
|
|
8052
7799
|
};
|
|
8053
|
-
}
|
|
7800
|
+
};/**
|
|
7801
|
+
* Creates a single (ordinary) bet by submitting signed bet data to the Azuro API.
|
|
7802
|
+
* This function sends the bet order to the relayer which will then place the bet on-chain.
|
|
7803
|
+
*
|
|
7804
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/createBet
|
|
7805
|
+
*
|
|
7806
|
+
* @example
|
|
7807
|
+
* import { createBet } from '@azuro-org/toolkit'
|
|
7808
|
+
*
|
|
7809
|
+
* const account = '0x...'
|
|
7810
|
+
* const clientData = { chainId: 137, core: '0x...', ... }
|
|
7811
|
+
* const bet = {
|
|
7812
|
+
* conditionId: '1',
|
|
7813
|
+
* outcomeId: '1',
|
|
7814
|
+
* minOdds: '1500000000000',
|
|
7815
|
+
* amount: '1000000',
|
|
7816
|
+
* nonce: '1',
|
|
7817
|
+
* }
|
|
7818
|
+
* const signature = '0x...'
|
|
7819
|
+
*
|
|
7820
|
+
* const result = await createBet({ account, clientData, bet, signature })
|
|
7821
|
+
* */
|
|
7822
|
+
const createBet = async (props) => {
|
|
8054
7823
|
const { account, clientData, bet, signature, bonusId } = props;
|
|
8055
7824
|
const { chainId } = clientData;
|
|
8056
7825
|
const { api, environment } = chainsData[chainId];
|
|
@@ -8079,9 +7848,6 @@ const getBetStatus = (props) => {
|
|
|
8079
7848
|
},
|
|
8080
7849
|
body: JSON.stringify(signedBet),
|
|
8081
7850
|
});
|
|
8082
|
-
if (response.status === 404) {
|
|
8083
|
-
return null;
|
|
8084
|
-
}
|
|
8085
7851
|
const data = await response.json();
|
|
8086
7852
|
if (!response.ok) {
|
|
8087
7853
|
const error = new Error(data?.errorMessage || `Status: ${response.status}`);
|
|
@@ -8091,7 +7857,34 @@ const getBetStatus = (props) => {
|
|
|
8091
7857
|
throw error;
|
|
8092
7858
|
}
|
|
8093
7859
|
return data;
|
|
8094
|
-
}
|
|
7860
|
+
};/**
|
|
7861
|
+
* Creates a combo (parlay) bet by submitting signed bet data to the Azuro API.
|
|
7862
|
+
* This function sends the combo bet order to the relayer which will then place the bet on-chain.
|
|
7863
|
+
*
|
|
7864
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/createComboBet
|
|
7865
|
+
*
|
|
7866
|
+
* @example
|
|
7867
|
+
* import { createComboBet } from '@azuro-org/toolkit'
|
|
7868
|
+
*
|
|
7869
|
+
* const account = '0x...'
|
|
7870
|
+
* const clientData = { chainId: 137, core: '0x...', ... }
|
|
7871
|
+
* const bets = [
|
|
7872
|
+
* { conditionId: '1', outcomeId: '1' },
|
|
7873
|
+
* { conditionId: '2', outcomeId: '2' },
|
|
7874
|
+
* ]
|
|
7875
|
+
* const signature = '0x...'
|
|
7876
|
+
*
|
|
7877
|
+
* const result = await createComboBet({
|
|
7878
|
+
* account,
|
|
7879
|
+
* clientData,
|
|
7880
|
+
* bets,
|
|
7881
|
+
* amount: '1000000',
|
|
7882
|
+
* minOdds: '3000000000000',
|
|
7883
|
+
* nonce: '1',
|
|
7884
|
+
* signature,
|
|
7885
|
+
* })
|
|
7886
|
+
* */
|
|
7887
|
+
const createComboBet = async (props) => {
|
|
8095
7888
|
const { account, amount, minOdds, nonce, clientData, bets, signature, bonusId } = props;
|
|
8096
7889
|
const { chainId } = clientData;
|
|
8097
7890
|
const { api, environment } = chainsData[chainId];
|
|
@@ -8120,9 +7913,6 @@ const getBetStatus = (props) => {
|
|
|
8120
7913
|
},
|
|
8121
7914
|
body: JSON.stringify(signedBet),
|
|
8122
7915
|
});
|
|
8123
|
-
if (response.status === 404) {
|
|
8124
|
-
return null;
|
|
8125
|
-
}
|
|
8126
7916
|
const data = await response.json();
|
|
8127
7917
|
if (!response.ok) {
|
|
8128
7918
|
const error = new Error(data?.errorMessage || `Status: ${response.status}`);
|
|
@@ -8132,7 +7922,26 @@ const getBetStatus = (props) => {
|
|
|
8132
7922
|
throw error;
|
|
8133
7923
|
}
|
|
8134
7924
|
return data;
|
|
8135
|
-
}
|
|
7925
|
+
};/**
|
|
7926
|
+
* Retrieves bet order data by order ID from the Azuro API.
|
|
7927
|
+
* Returns null if the bet order is not found.
|
|
7928
|
+
*
|
|
7929
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBet
|
|
7930
|
+
*
|
|
7931
|
+
* @example
|
|
7932
|
+
* import { getBet } from '@azuro-org/toolkit'
|
|
7933
|
+
*
|
|
7934
|
+
* const orderId = '0x123...'
|
|
7935
|
+
* const chainId = 137
|
|
7936
|
+
*
|
|
7937
|
+
* const bet = await getBet({ chainId, orderId })
|
|
7938
|
+
*
|
|
7939
|
+
* if (bet) {
|
|
7940
|
+
* console.log('Bet state:', bet.state)
|
|
7941
|
+
* console.log('Bet result:', bet.result)
|
|
7942
|
+
* }
|
|
7943
|
+
* */
|
|
7944
|
+
const getBet = async ({ chainId, orderId }) => {
|
|
8136
7945
|
const { api } = chainsData[chainId];
|
|
8137
7946
|
const response = await fetch(`${api}/bet/orders/${orderId}`);
|
|
8138
7947
|
if (response.status === 404) {
|
|
@@ -8143,38 +7952,12 @@ const getBetStatus = (props) => {
|
|
|
8143
7952
|
}
|
|
8144
7953
|
const data = await response.json();
|
|
8145
7954
|
return data;
|
|
8146
|
-
};/** @deprecated use `getBetCalculation` instead */
|
|
8147
|
-
const getMaxBet = async (props) => {
|
|
8148
|
-
const { chainId, selections } = props;
|
|
8149
|
-
const { api, environment } = chainsData[chainId];
|
|
8150
|
-
const response = await fetch(`${api}/bet/calculation`, {
|
|
8151
|
-
method: 'POST',
|
|
8152
|
-
headers: {
|
|
8153
|
-
'Accept': 'application/json',
|
|
8154
|
-
'Content-Type': 'application/json',
|
|
8155
|
-
},
|
|
8156
|
-
body: JSON.stringify({
|
|
8157
|
-
bets: selections.map(({ conditionId, outcomeId }) => ({
|
|
8158
|
-
conditionId,
|
|
8159
|
-
outcomeId: +outcomeId,
|
|
8160
|
-
})),
|
|
8161
|
-
environment,
|
|
8162
|
-
}),
|
|
8163
|
-
});
|
|
8164
|
-
if (response.status === 404) {
|
|
8165
|
-
return null;
|
|
8166
|
-
}
|
|
8167
|
-
if (!response.ok) {
|
|
8168
|
-
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
8169
|
-
}
|
|
8170
|
-
const data = await response.json();
|
|
8171
|
-
return data.response;
|
|
8172
7955
|
};/**
|
|
8173
7956
|
* Calculates the minimum and maximum bet amount for given selections.
|
|
8174
7957
|
* User's account is required to provide the **correct** maximum bet amount.
|
|
8175
7958
|
* It may be undefined if the user isn't logged in.
|
|
8176
7959
|
*
|
|
8177
|
-
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/getBetCalculation
|
|
7960
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBetCalculation
|
|
8178
7961
|
*
|
|
8179
7962
|
* @example
|
|
8180
7963
|
* import { getBetCalculation } from '@azuro-org/toolkit'
|
|
@@ -8207,15 +7990,411 @@ const getBetCalculation = async (props) => {
|
|
|
8207
7990
|
},
|
|
8208
7991
|
body: JSON.stringify(params),
|
|
8209
7992
|
});
|
|
7993
|
+
if (!response.ok) {
|
|
7994
|
+
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
7995
|
+
}
|
|
7996
|
+
const data = await response.json();
|
|
7997
|
+
return data.response;
|
|
7998
|
+
};/** Serialize an object to URLSearchParams, filtering undefined values, and handling arrays to the expected format */
|
|
7999
|
+
function serializeApiParams(struct) {
|
|
8000
|
+
const params = new URLSearchParams();
|
|
8001
|
+
const append = (key, value) => {
|
|
8002
|
+
if (value !== undefined) {
|
|
8003
|
+
params.append(key, String(value));
|
|
8004
|
+
}
|
|
8005
|
+
};
|
|
8006
|
+
Object.entries(struct).forEach(([key, value]) => {
|
|
8007
|
+
if (Array.isArray(value)) {
|
|
8008
|
+
return value.forEach(subValue => {
|
|
8009
|
+
append(key, subValue);
|
|
8010
|
+
});
|
|
8011
|
+
}
|
|
8012
|
+
append(key, String(value));
|
|
8013
|
+
});
|
|
8014
|
+
return params;
|
|
8015
|
+
}/**
|
|
8016
|
+
* Retrieves all bet orders for a specific bettor address with optional filtering.
|
|
8017
|
+
* Supports pagination and filtering by state, result, affiliate, and redemption status.
|
|
8018
|
+
*
|
|
8019
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/bet/getBetsByBettor
|
|
8020
|
+
*
|
|
8021
|
+
* @example
|
|
8022
|
+
* import { getBetsByBettor } from '@azuro-org/toolkit'
|
|
8023
|
+
*
|
|
8024
|
+
* const chainId = 137
|
|
8025
|
+
* const bettor = '0x...'
|
|
8026
|
+
*
|
|
8027
|
+
* // Get all bets
|
|
8028
|
+
* const allBets = await getBetsByBettor({ chainId, bettor })
|
|
8029
|
+
*
|
|
8030
|
+
* // Get only resolved bets
|
|
8031
|
+
* const resolvedBets = await getBetsByBettor({
|
|
8032
|
+
* chainId,
|
|
8033
|
+
* bettor,
|
|
8034
|
+
* state: 'Sent',
|
|
8035
|
+
* result: 'Won',
|
|
8036
|
+
* limit: 50,
|
|
8037
|
+
* })
|
|
8038
|
+
* */
|
|
8039
|
+
const getBetsByBettor = async (props) => {
|
|
8040
|
+
const { chainId, bettor, offset, limit, result, affiliate, isRedeemed, state } = props;
|
|
8041
|
+
const { api, environment } = chainsData[chainId];
|
|
8042
|
+
if (!bettor) {
|
|
8043
|
+
throw new Error('getBetsByBettor: "bettor" param is required');
|
|
8044
|
+
}
|
|
8045
|
+
const params = serializeApiParams({
|
|
8046
|
+
environment,
|
|
8047
|
+
offset: offset || 0,
|
|
8048
|
+
limit: limit || 100,
|
|
8049
|
+
state,
|
|
8050
|
+
result,
|
|
8051
|
+
affiliate,
|
|
8052
|
+
isRedeemed,
|
|
8053
|
+
});
|
|
8054
|
+
const response = await fetch(`${api}/bet/orders/bettor/${bettor}?${params}`);
|
|
8210
8055
|
if (response.status === 404) {
|
|
8211
8056
|
return null;
|
|
8212
8057
|
}
|
|
8213
8058
|
if (!response.ok) {
|
|
8214
|
-
throw new Error(`
|
|
8059
|
+
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
8215
8060
|
}
|
|
8216
8061
|
const data = await response.json();
|
|
8217
|
-
return data.
|
|
8218
|
-
}
|
|
8062
|
+
return data.orders;
|
|
8063
|
+
};/**
|
|
8064
|
+
* Fetches detailed conditions data for a given list of game IDs.
|
|
8065
|
+
* Returns comprehensive condition information including outcomes, odds, and game relationships.
|
|
8066
|
+
*
|
|
8067
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getConditionsByGameIds
|
|
8068
|
+
*
|
|
8069
|
+
* @example
|
|
8070
|
+
* import { getConditionsByGameIds } from '@azuro-org/toolkit'
|
|
8071
|
+
*
|
|
8072
|
+
* const conditions = await getConditionsByGameIds({
|
|
8073
|
+
* chainId: 137,
|
|
8074
|
+
* gameIds: ['1006000000000077484167'],
|
|
8075
|
+
* })
|
|
8076
|
+
* */
|
|
8077
|
+
const getConditionsByGameIds = async (props) => {
|
|
8078
|
+
// TODO requested to be OPTIONAL in api because of other requested filters, not implemented yet
|
|
8079
|
+
if (!props.gameIds?.length) {
|
|
8080
|
+
return [];
|
|
8081
|
+
}
|
|
8082
|
+
const api = getApiEndpoint(props.chainId);
|
|
8083
|
+
const environment = environments[props.chainId];
|
|
8084
|
+
const params = serializeApiParams({
|
|
8085
|
+
environment,
|
|
8086
|
+
gameIds: props.gameIds,
|
|
8087
|
+
// TODO requested to be in api, not implemented yet
|
|
8088
|
+
states: props.states,
|
|
8089
|
+
outcomeIds: props.outcomeIds,
|
|
8090
|
+
maxMargin: props.maxMargin,
|
|
8091
|
+
orderBy: props.orderBy,
|
|
8092
|
+
orderDir: props.orderDir,
|
|
8093
|
+
});
|
|
8094
|
+
const response = await fetch(`${api}/market-manager/conditions-by-game-ids?${params}`, {
|
|
8095
|
+
method: 'GET',
|
|
8096
|
+
headers: {
|
|
8097
|
+
'Accept': 'application/json',
|
|
8098
|
+
},
|
|
8099
|
+
cache: 'no-cache',
|
|
8100
|
+
});
|
|
8101
|
+
if (!response.ok) {
|
|
8102
|
+
throw new Error(`getConditionsByGameIds API request failed: ${response.status} ${response.statusText}`);
|
|
8103
|
+
}
|
|
8104
|
+
const data = await response.json();
|
|
8105
|
+
return data.conditions;
|
|
8106
|
+
};/**
|
|
8107
|
+
* Fetches up-to-date condition states and outcome odds for a list of conditions.
|
|
8108
|
+
*
|
|
8109
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getConditionsState
|
|
8110
|
+
*
|
|
8111
|
+
* @example
|
|
8112
|
+
* import { getConditionsState } from '@azuro-org/toolkit'
|
|
8113
|
+
*
|
|
8114
|
+
* const conditions = await getConditionsState({
|
|
8115
|
+
* chainId: 137,
|
|
8116
|
+
* conditionIds: ['300610060000000000635055340000000000000000387193'],
|
|
8117
|
+
* })
|
|
8118
|
+
* */
|
|
8119
|
+
const getConditionsState = async (props) => {
|
|
8120
|
+
const conditionIds = props.conditionIds?.filter(Boolean);
|
|
8121
|
+
if (!conditionIds?.length) {
|
|
8122
|
+
console.warn('getConditionsState: no conditionIds provided, skipping request');
|
|
8123
|
+
return [];
|
|
8124
|
+
}
|
|
8125
|
+
const api = getApiEndpoint(props.chainId);
|
|
8126
|
+
const response = await fetch(`${api}/market-manager/condition-batch`, {
|
|
8127
|
+
method: 'POST',
|
|
8128
|
+
headers: {
|
|
8129
|
+
'Accept': 'application/json',
|
|
8130
|
+
'Content-Type': 'application/json',
|
|
8131
|
+
},
|
|
8132
|
+
body: JSON.stringify({
|
|
8133
|
+
conditionIds,
|
|
8134
|
+
}),
|
|
8135
|
+
});
|
|
8136
|
+
if (!response.ok) {
|
|
8137
|
+
throw new Error(`getConditionsState API request failed: ${response.status} ${response.statusText}`);
|
|
8138
|
+
}
|
|
8139
|
+
const data = await response.json();
|
|
8140
|
+
return data.conditions;
|
|
8141
|
+
};/**
|
|
8142
|
+
* Fetches games by applying various filters such as sport, league, or game state.
|
|
8143
|
+
* Returns paginated results ideal for building sport/country/league listing pages.
|
|
8144
|
+
*
|
|
8145
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getGamesByFilters
|
|
8146
|
+
*
|
|
8147
|
+
* @example
|
|
8148
|
+
* import { GameState, getGamesByFilters } from '@azuro-org/toolkit'
|
|
8149
|
+
*
|
|
8150
|
+
* const games = await getGamesByFilters({
|
|
8151
|
+
* chainId: 137,
|
|
8152
|
+
* state: GameState.Prematch,
|
|
8153
|
+
* page: 2,
|
|
8154
|
+
* perPage: 50,
|
|
8155
|
+
* })
|
|
8156
|
+
* */
|
|
8157
|
+
const getGamesByFilters = async (props) => {
|
|
8158
|
+
const api = getApiEndpoint(props.chainId);
|
|
8159
|
+
const environment = environments[props.chainId];
|
|
8160
|
+
const params = serializeApiParams({
|
|
8161
|
+
environment,
|
|
8162
|
+
perPage: props.perPage || 1000,
|
|
8163
|
+
page: props.page || 1,
|
|
8164
|
+
// TODO requested to be in api, not implemented yet
|
|
8165
|
+
state: props.state,
|
|
8166
|
+
sportIds: props.sportIds,
|
|
8167
|
+
leagueSlugs: props.leagueSlugs,
|
|
8168
|
+
sportHub: props.sportHub,
|
|
8169
|
+
// maxMargin: props.maxMargin,
|
|
8170
|
+
conditionsState: props.conditionsState,
|
|
8171
|
+
orderBy: props.orderBy,
|
|
8172
|
+
orderDir: props.orderDir,
|
|
8173
|
+
});
|
|
8174
|
+
const response = await fetch(`${api}/market-manager/games-by-filters?${params}`, {
|
|
8175
|
+
method: 'GET',
|
|
8176
|
+
headers: {
|
|
8177
|
+
'Accept': 'application/json',
|
|
8178
|
+
},
|
|
8179
|
+
cache: 'no-cache',
|
|
8180
|
+
});
|
|
8181
|
+
if (!response.ok) {
|
|
8182
|
+
throw new Error(`getGamesByFilters API request failed: ${response.status} ${response.statusText}`);
|
|
8183
|
+
}
|
|
8184
|
+
const data = await response.json();
|
|
8185
|
+
return {
|
|
8186
|
+
...data,
|
|
8187
|
+
games: data.games.map(game => ({
|
|
8188
|
+
...game,
|
|
8189
|
+
gameId: game.id,
|
|
8190
|
+
})),
|
|
8191
|
+
};
|
|
8192
|
+
};/**
|
|
8193
|
+
* Fetches game data for a specific list of game IDs.
|
|
8194
|
+
* Returns detailed information for each requested game including participants, timing, and league data.
|
|
8195
|
+
*
|
|
8196
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getGamesByIds
|
|
8197
|
+
*
|
|
8198
|
+
* @example
|
|
8199
|
+
* import { getGamesByIds } from '@azuro-org/toolkit'
|
|
8200
|
+
*
|
|
8201
|
+
* const games = await getGamesByIds({
|
|
8202
|
+
* chainId: 137,
|
|
8203
|
+
* gameIds: ['1006000000000080373237'],
|
|
8204
|
+
* })
|
|
8205
|
+
*
|
|
8206
|
+
* const gameData = games[0]
|
|
8207
|
+
* */
|
|
8208
|
+
const getGamesByIds = async (props) => {
|
|
8209
|
+
const gameIds = props.gameIds.filter(Boolean);
|
|
8210
|
+
if (!gameIds.length) {
|
|
8211
|
+
console.warn('getGamesByFilters: no gameIds provided, skipping request');
|
|
8212
|
+
return [];
|
|
8213
|
+
}
|
|
8214
|
+
const api = getApiEndpoint(props.chainId);
|
|
8215
|
+
const environment = environments[props.chainId];
|
|
8216
|
+
const response = await fetch(`${api}/market-manager/games-batch`, {
|
|
8217
|
+
method: 'POST',
|
|
8218
|
+
headers: {
|
|
8219
|
+
'Accept': 'application/json',
|
|
8220
|
+
'Content-Type': 'application/json',
|
|
8221
|
+
},
|
|
8222
|
+
body: JSON.stringify({
|
|
8223
|
+
environment,
|
|
8224
|
+
gameIds,
|
|
8225
|
+
}),
|
|
8226
|
+
});
|
|
8227
|
+
if (!response.ok) {
|
|
8228
|
+
throw new Error(`getGamesByFilters API request failed: ${response.status} ${response.statusText}`);
|
|
8229
|
+
}
|
|
8230
|
+
const data = await response.json();
|
|
8231
|
+
return data;
|
|
8232
|
+
};/**
|
|
8233
|
+
* Fetches navigation structure with sports, countries, and leagues hierarchy.
|
|
8234
|
+
* Returns active game counts at each level for building navigation menus.
|
|
8235
|
+
*
|
|
8236
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getNavigation
|
|
8237
|
+
*
|
|
8238
|
+
* @example
|
|
8239
|
+
* import { getNavigation } from '@azuro-org/toolkit'
|
|
8240
|
+
*
|
|
8241
|
+
* const sports = await getNavigation({
|
|
8242
|
+
* chainId: 137,
|
|
8243
|
+
* sportHub: 'sports',
|
|
8244
|
+
* })
|
|
8245
|
+
* */
|
|
8246
|
+
const getNavigation = async (props) => {
|
|
8247
|
+
const api = getApiEndpoint(props.chainId);
|
|
8248
|
+
const environment = environments[props.chainId];
|
|
8249
|
+
const params = serializeApiParams({
|
|
8250
|
+
environment,
|
|
8251
|
+
sportHub: props.sportHub,
|
|
8252
|
+
sportIds: props.sportIds,
|
|
8253
|
+
});
|
|
8254
|
+
const response = await fetch(`${api}/market-manager/navigation?${params}`, {
|
|
8255
|
+
method: 'GET',
|
|
8256
|
+
headers: {
|
|
8257
|
+
'Accept': 'application/json',
|
|
8258
|
+
},
|
|
8259
|
+
cache: 'no-cache',
|
|
8260
|
+
});
|
|
8261
|
+
if (!response.ok) {
|
|
8262
|
+
throw new Error(`getNavigation API request failed: ${response.status} ${response.statusText}`);
|
|
8263
|
+
}
|
|
8264
|
+
const data = await response.json();
|
|
8265
|
+
return data.sports;
|
|
8266
|
+
};/**
|
|
8267
|
+
* Fetches a complete sports hierarchy including countries, leagues, and games.
|
|
8268
|
+
* Returns nested structure with all games organized by sport, country, and league.
|
|
8269
|
+
*
|
|
8270
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/getSports
|
|
8271
|
+
*
|
|
8272
|
+
* @example
|
|
8273
|
+
* import { GameState, getSports } from '@azuro-org/toolkit'
|
|
8274
|
+
*
|
|
8275
|
+
* const sports = await getSports({
|
|
8276
|
+
* chainId: 137,
|
|
8277
|
+
* states: [GameState.Prematch, GameState.Live],
|
|
8278
|
+
* page: 1,
|
|
8279
|
+
* perPage: 50,
|
|
8280
|
+
* })
|
|
8281
|
+
* */
|
|
8282
|
+
const getSports = async (props) => {
|
|
8283
|
+
const api = getApiEndpoint(props.chainId);
|
|
8284
|
+
const environment = environments[props.chainId];
|
|
8285
|
+
const params = serializeApiParams({
|
|
8286
|
+
environment,
|
|
8287
|
+
perPage: props.perPage || 100,
|
|
8288
|
+
page: props.page || 1,
|
|
8289
|
+
states: props.states,
|
|
8290
|
+
// TODO requested to be in api, not implemented yet
|
|
8291
|
+
sportIds: props.sportIds,
|
|
8292
|
+
sportHub: props.sportHub,
|
|
8293
|
+
countrySlug: props.countrySlug,
|
|
8294
|
+
leagueSlug: props.leagueSlug,
|
|
8295
|
+
orderBy: props.orderBy,
|
|
8296
|
+
orderDir: props.orderDir,
|
|
8297
|
+
});
|
|
8298
|
+
const response = await fetch(`${api}/market-manager/sports?${params}`, {
|
|
8299
|
+
method: 'GET',
|
|
8300
|
+
headers: {
|
|
8301
|
+
'Accept': 'application/json',
|
|
8302
|
+
},
|
|
8303
|
+
cache: 'no-cache',
|
|
8304
|
+
});
|
|
8305
|
+
if (!response.ok) {
|
|
8306
|
+
throw new Error(`getSports API request failed: ${response.status} ${response.statusText}`);
|
|
8307
|
+
}
|
|
8308
|
+
const data = await response.json();
|
|
8309
|
+
// return data.sports.map((sport) => {
|
|
8310
|
+
// const sportId = String(sport.id)
|
|
8311
|
+
//
|
|
8312
|
+
// return {
|
|
8313
|
+
// ...sport,
|
|
8314
|
+
// sportId,
|
|
8315
|
+
// countries: sport.countries.map((country) => {
|
|
8316
|
+
// return {
|
|
8317
|
+
// ...country,
|
|
8318
|
+
// leagues: country.leagues.map((league) => {
|
|
8319
|
+
// return {
|
|
8320
|
+
// ...league,
|
|
8321
|
+
// games: league.games.map(game => {
|
|
8322
|
+
// const sportInfo: GameData['sport'] = {
|
|
8323
|
+
// ...game.sport,
|
|
8324
|
+
// sportId,
|
|
8325
|
+
// sporthub: {
|
|
8326
|
+
// id: (game.sport as any).sportHub.id,
|
|
8327
|
+
// slug: (game.sport as any).sportHub.slug,
|
|
8328
|
+
// },
|
|
8329
|
+
// }
|
|
8330
|
+
//
|
|
8331
|
+
// return {
|
|
8332
|
+
// ...game,
|
|
8333
|
+
// gameId: game.id,
|
|
8334
|
+
// sport: sportInfo,
|
|
8335
|
+
// }
|
|
8336
|
+
// }),
|
|
8337
|
+
// }
|
|
8338
|
+
// }),
|
|
8339
|
+
// }
|
|
8340
|
+
// }),
|
|
8341
|
+
// }
|
|
8342
|
+
// })
|
|
8343
|
+
return data.sports;
|
|
8344
|
+
};const minQueryLength = 3;
|
|
8345
|
+
/**
|
|
8346
|
+
* Searches for games by text query across game titles, leagues, and countries.
|
|
8347
|
+
* Minimum query length is 3 characters. Returns paginated results.
|
|
8348
|
+
*
|
|
8349
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/feed/searchGames
|
|
8350
|
+
*
|
|
8351
|
+
* @example
|
|
8352
|
+
* import { searchGames } from '@azuro-org/toolkit'
|
|
8353
|
+
*
|
|
8354
|
+
* const { games } = await searchGames({
|
|
8355
|
+
* chainId: 137,
|
|
8356
|
+
* query: 'Manchester',
|
|
8357
|
+
* page: 1,
|
|
8358
|
+
* perPage: 10,
|
|
8359
|
+
* })
|
|
8360
|
+
* */
|
|
8361
|
+
const searchGames = async (props) => {
|
|
8362
|
+
const query = props.query?.trim();
|
|
8363
|
+
if (query?.length < minQueryLength) {
|
|
8364
|
+
console.warn(`searchGames: query param must be at least ${minQueryLength} characters long, got: '${props.query}', skipping request`);
|
|
8365
|
+
return {
|
|
8366
|
+
games: [],
|
|
8367
|
+
page: 1,
|
|
8368
|
+
perPage: 10,
|
|
8369
|
+
total: 0,
|
|
8370
|
+
totalPages: 0,
|
|
8371
|
+
};
|
|
8372
|
+
}
|
|
8373
|
+
const api = getApiEndpoint(props.chainId);
|
|
8374
|
+
const environment = environments[props.chainId];
|
|
8375
|
+
const params = serializeApiParams({
|
|
8376
|
+
environment,
|
|
8377
|
+
// perPage: props.perPage || 1000,
|
|
8378
|
+
// page: props.page || 1,
|
|
8379
|
+
request: props.query,
|
|
8380
|
+
});
|
|
8381
|
+
const response = await fetch(`${api}/market-manager/search?${params}`, {
|
|
8382
|
+
method: 'GET',
|
|
8383
|
+
headers: {
|
|
8384
|
+
'Accept': 'application/json',
|
|
8385
|
+
},
|
|
8386
|
+
cache: 'no-cache',
|
|
8387
|
+
});
|
|
8388
|
+
if (!response.ok) {
|
|
8389
|
+
throw new Error(`searchGames API request failed: ${response.status} ${response.statusText}`);
|
|
8390
|
+
}
|
|
8391
|
+
const data = await response.json();
|
|
8392
|
+
return data;
|
|
8393
|
+
};var GameOrderBy;
|
|
8394
|
+
(function (GameOrderBy) {
|
|
8395
|
+
GameOrderBy["StartsAt"] = "startsAt";
|
|
8396
|
+
GameOrderBy["Turnover"] = "turnover";
|
|
8397
|
+
})(GameOrderBy || (GameOrderBy = {}));var WaveLevelName;
|
|
8219
8398
|
(function (WaveLevelName) {
|
|
8220
8399
|
WaveLevelName["Grey"] = "Grey";
|
|
8221
8400
|
WaveLevelName["Mist"] = "Mist";
|
|
@@ -8313,7 +8492,33 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
8313
8492
|
const api = getApiEndpoint(chainId);
|
|
8314
8493
|
const response = await fetch(`${api}/waves/${waveId}/participants/${account?.toLowerCase()}/activate`);
|
|
8315
8494
|
await response.json();
|
|
8316
|
-
}
|
|
8495
|
+
};/**
|
|
8496
|
+
* Retrieves precalculated cashout availability and prices for specified conditions.
|
|
8497
|
+
* Returns margin information and outcome prices for each available condition.
|
|
8498
|
+
*
|
|
8499
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getPrecalculatedCashouts
|
|
8500
|
+
*
|
|
8501
|
+
* @example
|
|
8502
|
+
* import { getPrecalculatedCashouts } from '@azuro-org/toolkit'
|
|
8503
|
+
*
|
|
8504
|
+
* const chainId = 100
|
|
8505
|
+
* const conditionIds = ['123', '456', '789']
|
|
8506
|
+
*
|
|
8507
|
+
* const cashouts = await getPrecalculatedCashouts({
|
|
8508
|
+
* chainId,
|
|
8509
|
+
* conditionIds,
|
|
8510
|
+
* })
|
|
8511
|
+
*
|
|
8512
|
+
* if (cashouts) {
|
|
8513
|
+
* cashouts.availables.forEach(({ conditionId, available, outcomes }) => {
|
|
8514
|
+
* console.log(`Condition ${conditionId} available: ${available}`)
|
|
8515
|
+
* outcomes.forEach(({ outcomeId, price }) => {
|
|
8516
|
+
* console.log(` Outcome ${outcomeId}: ${price}`)
|
|
8517
|
+
* })
|
|
8518
|
+
* })
|
|
8519
|
+
* }
|
|
8520
|
+
* */
|
|
8521
|
+
const getPrecalculatedCashouts = async (props) => {
|
|
8317
8522
|
const { chainId, conditionIds } = props;
|
|
8318
8523
|
const { api, contracts } = chainsData[chainId];
|
|
8319
8524
|
if (!contracts.cashout?.address) {
|
|
@@ -8337,7 +8542,31 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
8337
8542
|
}
|
|
8338
8543
|
const data = await response.json();
|
|
8339
8544
|
return data;
|
|
8340
|
-
}
|
|
8545
|
+
};/**
|
|
8546
|
+
* Retrieves the calculated cashout information for a specific bet, including the cashout amount and odds.
|
|
8547
|
+
* Returns null if no cashout calculation is available for the bet.
|
|
8548
|
+
*
|
|
8549
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getCalculatedCashout
|
|
8550
|
+
*
|
|
8551
|
+
* @example
|
|
8552
|
+
* import { getCalculatedCashout } from '@azuro-org/toolkit'
|
|
8553
|
+
*
|
|
8554
|
+
* const chainId = 100
|
|
8555
|
+
* const account = '0x123...'
|
|
8556
|
+
* const graphBetId = '456'
|
|
8557
|
+
*
|
|
8558
|
+
* const cashout = await getCalculatedCashout({
|
|
8559
|
+
* chainId,
|
|
8560
|
+
* account,
|
|
8561
|
+
* graphBetId,
|
|
8562
|
+
* })
|
|
8563
|
+
*
|
|
8564
|
+
* if (cashout) {
|
|
8565
|
+
* console.log(`Cashout amount: ${cashout.cashoutAmount}`)
|
|
8566
|
+
* console.log(`Cashout odds: ${cashout.cashoutOdds}`)
|
|
8567
|
+
* }
|
|
8568
|
+
* */
|
|
8569
|
+
const getCalculatedCashout = async (props) => {
|
|
8341
8570
|
const { chainId, account, graphBetId } = props;
|
|
8342
8571
|
const { api, environment, contracts } = chainsData[chainId];
|
|
8343
8572
|
if (!contracts.cashout?.address) {
|
|
@@ -8367,7 +8596,35 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
8367
8596
|
tokenId: betId,
|
|
8368
8597
|
...rest,
|
|
8369
8598
|
};
|
|
8370
|
-
}
|
|
8599
|
+
};/**
|
|
8600
|
+
* Generates EIP-712 typed data for signing a cashout order.
|
|
8601
|
+
* This typed data must be signed by the user before submitting the cashout.
|
|
8602
|
+
*
|
|
8603
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getCashoutTypedData
|
|
8604
|
+
*
|
|
8605
|
+
* @example
|
|
8606
|
+
* import { getCashoutTypedData } from '@azuro-org/toolkit'
|
|
8607
|
+
* import { signTypedData } from 'viem/accounts'
|
|
8608
|
+
*
|
|
8609
|
+
* const chainId = 100
|
|
8610
|
+
* const account = '0x123...'
|
|
8611
|
+
* const tokenId = '456'
|
|
8612
|
+
* const cashoutOdds = '1.85'
|
|
8613
|
+
* const expiredAt = Math.floor(Date.now() / 1000) + 3600
|
|
8614
|
+
* const attention = 'By signing this transaction, I agree to cash out on Azuro'
|
|
8615
|
+
*
|
|
8616
|
+
* const typedData = getCashoutTypedData({
|
|
8617
|
+
* chainId,
|
|
8618
|
+
* account,
|
|
8619
|
+
* attention,
|
|
8620
|
+
* tokenId,
|
|
8621
|
+
* cashoutOdds,
|
|
8622
|
+
* expiredAt,
|
|
8623
|
+
* })
|
|
8624
|
+
*
|
|
8625
|
+
* const signature = await signTypedData(typedData)
|
|
8626
|
+
* */
|
|
8627
|
+
const getCashoutTypedData = (props) => {
|
|
8371
8628
|
const { account, chainId, attention, tokenId, cashoutOdds, expiredAt } = props;
|
|
8372
8629
|
const { contracts } = chainsData[chainId];
|
|
8373
8630
|
if (!contracts.cashout?.address) {
|
|
@@ -8404,6 +8661,29 @@ const getWaveLevels = async ({ waveId, chainId } = { waveId: 'active', chainId:
|
|
|
8404
8661
|
CashoutState["Rejected"] = "REJECTED";
|
|
8405
8662
|
CashoutState["Open"] = "OPEN";
|
|
8406
8663
|
})(CashoutState || (CashoutState = {}));
|
|
8664
|
+
/**
|
|
8665
|
+
* Creates a cashout order for an existing bet by submitting the signed cashout calculation to the Azuro API.
|
|
8666
|
+
* This finalizes the cashout process after obtaining a calculation and signing the typed data.
|
|
8667
|
+
*
|
|
8668
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/createCashout
|
|
8669
|
+
*
|
|
8670
|
+
* @example
|
|
8671
|
+
* import { createCashout } from '@azuro-org/toolkit'
|
|
8672
|
+
*
|
|
8673
|
+
* const chainId = 100
|
|
8674
|
+
* const calculationId = 'gnosis_0x123_456'
|
|
8675
|
+
* const attention = 'By signing this transaction, I agree to cash out on Azuro'
|
|
8676
|
+
* const signature = '0xabc...'
|
|
8677
|
+
*
|
|
8678
|
+
* const result = await createCashout({
|
|
8679
|
+
* chainId,
|
|
8680
|
+
* calculationId,
|
|
8681
|
+
* attention,
|
|
8682
|
+
* signature,
|
|
8683
|
+
* })
|
|
8684
|
+
*
|
|
8685
|
+
* console.log(result.state) // 'PROCESSING', 'ACCEPTED', 'REJECTED', or 'OPEN'
|
|
8686
|
+
* */
|
|
8407
8687
|
const createCashout = async (props) => {
|
|
8408
8688
|
const { chainId, calculationId, attention, signature } = props;
|
|
8409
8689
|
const { api, contracts } = chainsData[chainId];
|
|
@@ -8428,15 +8708,31 @@ const createCashout = async (props) => {
|
|
|
8428
8708
|
},
|
|
8429
8709
|
body: JSON.stringify(signedCashout),
|
|
8430
8710
|
});
|
|
8431
|
-
if (response.status === 404) {
|
|
8432
|
-
return null;
|
|
8433
|
-
}
|
|
8434
8711
|
if (!response.ok) {
|
|
8435
8712
|
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
8436
8713
|
}
|
|
8437
8714
|
const data = await response.json();
|
|
8438
8715
|
return data;
|
|
8439
|
-
}
|
|
8716
|
+
};/**
|
|
8717
|
+
* Retrieves the status and details of a cashout order by its order ID.
|
|
8718
|
+
* Returns null if the cashout order is not found.
|
|
8719
|
+
*
|
|
8720
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/utils/cashout/getCashout
|
|
8721
|
+
*
|
|
8722
|
+
* @example
|
|
8723
|
+
* import { getCashout } from '@azuro-org/toolkit'
|
|
8724
|
+
*
|
|
8725
|
+
* const chainId = 100
|
|
8726
|
+
* const orderId = 'abc123'
|
|
8727
|
+
*
|
|
8728
|
+
* const cashout = await getCashout({ chainId, orderId })
|
|
8729
|
+
*
|
|
8730
|
+
* if (cashout) {
|
|
8731
|
+
* console.log(`State: ${cashout.state}`)
|
|
8732
|
+
* console.log(`Transaction hash: ${cashout.txHash}`)
|
|
8733
|
+
* }
|
|
8734
|
+
* */
|
|
8735
|
+
const getCashout = async ({ chainId, orderId }) => {
|
|
8440
8736
|
const { api, contracts } = chainsData[chainId];
|
|
8441
8737
|
if (!contracts.cashout?.address) {
|
|
8442
8738
|
throw new Error('provided chainId is not supported for cashout');
|
|
@@ -8450,7 +8746,26 @@ const createCashout = async (props) => {
|
|
|
8450
8746
|
}
|
|
8451
8747
|
const data = await response.json();
|
|
8452
8748
|
return data;
|
|
8453
|
-
}
|
|
8749
|
+
};/**
|
|
8750
|
+
* Fetches all bonuses for a bettor account filtered by status.
|
|
8751
|
+
* By default, retrieves only available bonuses. Returns null if no bonuses are found.
|
|
8752
|
+
*
|
|
8753
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/bonus/getBonuses
|
|
8754
|
+
*
|
|
8755
|
+
* @example
|
|
8756
|
+
* import { getBonuses, BonusStatus } from '@azuro-org/toolkit'
|
|
8757
|
+
*
|
|
8758
|
+
* const account = userWallet?.address
|
|
8759
|
+
* const affiliate = '0x123...'
|
|
8760
|
+
*
|
|
8761
|
+
* const bonuses = await getBonuses({
|
|
8762
|
+
* chainId: 100,
|
|
8763
|
+
* account,
|
|
8764
|
+
* affiliate,
|
|
8765
|
+
* bonusStatus: BonusStatus.Available
|
|
8766
|
+
* })
|
|
8767
|
+
* */
|
|
8768
|
+
const getBonuses = async (props) => {
|
|
8454
8769
|
const { chainId, account, affiliate, bonusStatus = BonusStatus.Available } = props;
|
|
8455
8770
|
const { api } = chainsData[chainId];
|
|
8456
8771
|
const response = await fetch(`${api}/bonus/get-by-addresses`, {
|
|
@@ -8511,7 +8826,29 @@ const createCashout = async (props) => {
|
|
|
8511
8826
|
}
|
|
8512
8827
|
return acc;
|
|
8513
8828
|
}, []);
|
|
8514
|
-
}
|
|
8829
|
+
};/**
|
|
8830
|
+
* Retrieves available freebets for a bettor that can be applied to specific bet selections.
|
|
8831
|
+
* Returns null if no freebets are available for the given selections.
|
|
8832
|
+
*
|
|
8833
|
+
* - Docs: https://gem.azuro.org/hub/apps/toolkit/bonus/getAvailableFreebets
|
|
8834
|
+
*
|
|
8835
|
+
* @example
|
|
8836
|
+
* import { getAvailableFreebets } from '@azuro-org/toolkit'
|
|
8837
|
+
*
|
|
8838
|
+
* const account = userWallet?.address
|
|
8839
|
+
* const affiliate = affiliateAddress
|
|
8840
|
+
* const selections = [
|
|
8841
|
+
* { conditionId: '1', outcomeId: '1' },
|
|
8842
|
+
* ]
|
|
8843
|
+
*
|
|
8844
|
+
* const freebets = await getAvailableFreebets({
|
|
8845
|
+
* chainId: 100,
|
|
8846
|
+
* account,
|
|
8847
|
+
* affiliate,
|
|
8848
|
+
* selections
|
|
8849
|
+
* })
|
|
8850
|
+
* */
|
|
8851
|
+
const getAvailableFreebets = async ({ chainId, account, affiliate, selections }) => {
|
|
8515
8852
|
const { api, environment, betToken } = chainsData[chainId];
|
|
8516
8853
|
const response = await fetch(`${api}/bonus/freebet/get-available`, {
|
|
8517
8854
|
method: 'POST',
|
|
@@ -8570,4 +8907,4 @@ const createCashout = async (props) => {
|
|
|
8570
8907
|
publicCustomData: bonus.publicCustomData,
|
|
8571
8908
|
};
|
|
8572
8909
|
});
|
|
8573
|
-
};export{
|
|
8910
|
+
};export{BET_DATA_TYPES,ConditionStatus as BetConditionStatus,BetOrderResult,BetOrderState,BetRestrictionType,BetResult,BetStatus,V3_Bet_OrderBy as Bet_OrderBy,BettorFragmentDoc,BettorsDocument,BonusStatus,BonusType,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CLIENT_DATA_TYPES,COMBO_BET_DATA_TYPES,CashoutState,ConditionState,Environment,EventRestrictionState,FreebetType,GameBetsDocument,GameOrderBy,GameState,BetStatus$1 as GraphBetStatus,LegacyBetsDocument,GameStatus as LegacyGameStatus,LegacyLiveBetFragmentDoc,LegacyLiveGamesDocument,LegacyPrematchBetFragmentDoc,Bet_OrderBy as Legacy_Bet_OrderBy,ODDS_COMBO_FEE_MODIFIER,ODDS_DECIMALS,OrderDirection$1 as OrderDirection,V3_SelectionConditionKind as SelectionKind,SelectionResult,TYPED_DATA_DOMAIN_NAME,TYPED_DATA_DOMAIN_VERSION,WaveLevelName,activateWave,azuroBetAbi,baseData,baseSepoliaData,bscData,bscTestnetData,calcMinOdds,cashoutAbi,chainsData,chainsDataByEnv,chilizData,coreAbi,createBet,createCashout,createComboBet,environments,getApiEndpoint,getAvailableFreebets,getBet,getBetCalculation,getBetFee,getBetStatus,getBetTypedData,getBetsByBettor,getBetsGraphqlEndpoint,getBonuses,getCalculatedCashout,getCashout,getCashoutTypedData,getComboBetTypedData,getConditionsByGameIds,getConditionsState,getFeedGraphqlEndpoint,getGamesByFilters,getGamesByIds,getIsPendingResolution,getNavigation,getPrecalculatedCashouts,getProviderFromId,getSocketEndpoint,getSports,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,gnosisData,gnosisDevData,groupConditionsByMarket,lpAbi,paymasterAbi,polygonAmoyData,polygonData,relayerAbi,searchGames,setupContracts,spicyData,vaultAbi};//# sourceMappingURL=index.js.map
|