@azuro-org/toolkit 3.0.0 → 4.0.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.
Files changed (66) hide show
  1. package/.eslintrc +166 -0
  2. package/README.md +7 -110
  3. package/codegen.ts +62 -0
  4. package/dist/abis/FreeBet.d.ts +426 -0
  5. package/dist/abis/LP.d.ts +1469 -0
  6. package/dist/abis/LiveCore.d.ts +694 -0
  7. package/dist/abis/PrematchComboCore.d.ts +740 -0
  8. package/dist/abis/PrematchCore.d.ts +819 -0
  9. package/dist/abis/ProxyFront.d.ts +137 -0
  10. package/dist/abis/index.d.ts +6 -0
  11. package/dist/config.d.ts +51 -0
  12. package/dist/docs/index.d.ts +22 -0
  13. package/dist/docs/live/condition.d.ts +28 -0
  14. package/dist/docs/live/conditions.d.ts +29 -0
  15. package/dist/docs/live/fragments/condition.d.ts +20 -0
  16. package/dist/docs/live/types.d.ts +1902 -0
  17. package/dist/docs/prematch/bettors.d.ts +21 -0
  18. package/dist/docs/prematch/condition.d.ts +38 -0
  19. package/dist/docs/prematch/conditions.d.ts +39 -0
  20. package/dist/docs/prematch/conditionsBatch.d.ts +22 -0
  21. package/dist/docs/prematch/fragments/bettor.d.ts +12 -0
  22. package/dist/docs/prematch/fragments/condition.d.ts +30 -0
  23. package/dist/docs/prematch/fragments/liveBet.d.ts +42 -0
  24. package/dist/docs/prematch/fragments/mainGameInfo.d.ts +31 -0
  25. package/dist/docs/prematch/fragments/prematchBet.d.ts +75 -0
  26. package/dist/docs/prematch/game.d.ts +39 -0
  27. package/dist/docs/prematch/gameBets.d.ts +54 -0
  28. package/dist/docs/prematch/games.d.ts +43 -0
  29. package/dist/docs/prematch/liveBets.d.ts +54 -0
  30. package/dist/docs/prematch/navigation.d.ts +34 -0
  31. package/dist/docs/prematch/prematchBets.d.ts +87 -0
  32. package/dist/docs/prematch/sports.d.ts +63 -0
  33. package/dist/docs/prematch/sportsNavigation.d.ts +22 -0
  34. package/dist/docs/prematch/types.d.ts +6307 -0
  35. package/dist/global.d.ts +6 -0
  36. package/dist/helpers/formatToFixed.d.ts +1 -0
  37. package/dist/index.d.ts +24 -1
  38. package/dist/index.js +5705 -0
  39. package/dist/utils/calcMindOdds.d.ts +6 -0
  40. package/dist/utils/calcOdds.d.ts +28 -0
  41. package/dist/utils/deBridge/createDeBridgeBet.d.ts +65 -0
  42. package/dist/utils/deBridge/getDeBridgeOrder.d.ts +39 -0
  43. package/dist/utils/deBridge/getDeBridgeSupportedChains.d.ts +4 -0
  44. package/dist/utils/deBridge/getDeBridgeSupportedTokens.d.ts +8 -0
  45. package/dist/utils/getBetStatus.d.ts +17 -0
  46. package/dist/utils/getEndpoints.d.ts +5 -0
  47. package/dist/utils/getFreebets.d.ts +35 -0
  48. package/dist/utils/getGameStatus.d.ts +16 -0
  49. package/dist/utils/getLiveBetFee.d.ts +14 -0
  50. package/dist/utils/getPrematchBetDataBytes.d.ts +3 -0
  51. package/dist/utils/groupByConditionId.d.ts +5 -0
  52. package/dist/utils/groupConditionsByMarket.d.ts +23 -0
  53. package/dist/utils/setupContracts.d.ts +37 -0
  54. package/dist/utils/wave/activateWave.d.ts +10 -0
  55. package/dist/utils/wave/getWaveLeaderBoard.d.ts +22 -0
  56. package/dist/utils/wave/getWaveLevels.d.ts +26 -0
  57. package/dist/utils/wave/getWavePeriods.d.ts +18 -0
  58. package/dist/utils/wave/getWaveStats.d.ts +30 -0
  59. package/graphql.config.yml +21 -0
  60. package/package.json +24 -8
  61. package/tsconfig.json +25 -10
  62. package/dist/aggregateOutcomesByMarkets.d.ts +0 -25
  63. package/dist/index.es.js +0 -109
  64. package/lib/aggregateOutcomesByMarkets.d.ts +0 -25
  65. package/lib/index.d.ts +0 -1
  66. package/lib/index.js +0 -109
package/dist/index.es.js DELETED
@@ -1,109 +0,0 @@
1
- import {getMarketKey,getMarketName,getSelectionName,dictionaries}from'@azuro-org/dictionaries';/******************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
-
16
- var __assign = function() {
17
- __assign = Object.assign || function __assign(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
-
27
- function __rest(s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- }function aggregateOutcomesByMarkets(props) {
38
- var lpAddress = props.lpAddress, conditions = props.conditions;
39
- var marketsMap = {};
40
- conditions.forEach(function (_a) {
41
- var conditionId = _a.conditionId, outcomes = _a.outcomes, coreAddress = _a.coreAddress;
42
- outcomes.forEach(function (_a) {
43
- var outcomeId = _a.outcomeId, rest = __rest(_a, ["outcomeId"]);
44
- // we are using the same key format that was discussed earlier
45
- var marketKey = getMarketKey(outcomeId);
46
- // we are obtaining the human-readable names of each market and the corresponding outcome selections
47
- var marketName = getMarketName({ outcomeId: outcomeId });
48
- var selectionName = getSelectionName({ outcomeId: outcomeId });
49
- var outcome = __assign({ conditionId: conditionId, outcomeId: outcomeId, lpAddress: lpAddress, coreAddress: coreAddress, selectionName: selectionName }, rest);
50
- if (!marketsMap[marketKey]) {
51
- marketsMap[marketKey] = {
52
- marketName: marketName,
53
- outcomes: [],
54
- };
55
- }
56
- marketsMap[marketKey].outcomes.push(outcome);
57
- });
58
- });
59
- var finalMarketsMap = {};
60
- // sort by outcomeId and group by conditionId
61
- Object.keys(marketsMap).forEach(function (marketKey) {
62
- var _a = marketsMap[marketKey], marketName = _a.marketName, outcomes = _a.outcomes;
63
- finalMarketsMap[marketKey] = {
64
- marketName: marketName,
65
- outcomes: null,
66
- };
67
- // sort the outcomes by `selectionId` (outcome's selection reference)
68
- outcomes.sort(function (a, b) {
69
- var left = dictionaries.outcomes[a.outcomeId].selectionId;
70
- var right = dictionaries.outcomes[b.outcomeId].selectionId;
71
- return left - right;
72
- });
73
- // "Full Time Result" and "Double Chance" are the markets whose outcomes don't require sorting
74
- var MARKETS_THAT_DONT_NEED_GROUPING = [1, 2];
75
- var marketId = marketKey.split('-')[0];
76
- if (MARKETS_THAT_DONT_NEED_GROUPING.includes(+marketId)) {
77
- // it's worth noting that the outcomes are wrapped within an array here due to the "rows" that are presented below
78
- finalMarketsMap[marketKey].outcomes = [outcomes];
79
- }
80
- else {
81
- // group the outcomes by condition ID, which will allow us to display the draw outcomes in separate rows
82
- //
83
- // Handicap:
84
- // H1 (-0.5) H2 (0.5)
85
- // H1 (0.5) H2 (-0.5)
86
- var outcomesByConditionId_1 = {};
87
- outcomes.forEach(function (outcome) {
88
- var key = outcome.conditionId;
89
- if (!outcomesByConditionId_1[key]) {
90
- outcomesByConditionId_1[key] = [];
91
- }
92
- outcomesByConditionId_1[key].push(outcome);
93
- });
94
- var rows = Object.values(outcomesByConditionId_1);
95
- finalMarketsMap[marketKey].outcomes = rows.sort(function (a, b) {
96
- var aSum = a.reduce(function (acc, _a) {
97
- var outcomeId = _a.outcomeId;
98
- return acc + +outcomeId;
99
- }, 0);
100
- var bSum = b.reduce(function (acc, _a) {
101
- var outcomeId = _a.outcomeId;
102
- return acc + +outcomeId;
103
- }, 0);
104
- return aSum - bSum;
105
- });
106
- }
107
- });
108
- return Object.values(finalMarketsMap);
109
- }export{aggregateOutcomesByMarkets};
@@ -1,25 +0,0 @@
1
- type Outcome<T> = T & {
2
- conditionId: string;
3
- outcomeId: string;
4
- selectionName: string;
5
- lpAddress: string;
6
- coreAddress: string;
7
- };
8
- type FinalMarket<T> = {
9
- marketName: string;
10
- outcomes: Outcome<T>[][];
11
- };
12
- type Props = {
13
- lpAddress: string;
14
- conditions: {
15
- [key: string]: any;
16
- conditionId: string;
17
- coreAddress: string;
18
- outcomes: {
19
- [key: string]: any;
20
- outcomeId: string;
21
- }[];
22
- }[];
23
- };
24
- export default function aggregateOutcomesByMarkets<T extends {}>(props: Props): FinalMarket<T>[];
25
- export {};
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default as aggregateOutcomesByMarkets } from './aggregateOutcomesByMarkets';
package/lib/index.js DELETED
@@ -1,109 +0,0 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var dictionaries=require('@azuro-org/dictionaries');/******************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
-
16
- var __assign = function() {
17
- __assign = Object.assign || function __assign(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
-
27
- function __rest(s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- }function aggregateOutcomesByMarkets(props) {
38
- var lpAddress = props.lpAddress, conditions = props.conditions;
39
- var marketsMap = {};
40
- conditions.forEach(function (_a) {
41
- var conditionId = _a.conditionId, outcomes = _a.outcomes, coreAddress = _a.coreAddress;
42
- outcomes.forEach(function (_a) {
43
- var outcomeId = _a.outcomeId, rest = __rest(_a, ["outcomeId"]);
44
- // we are using the same key format that was discussed earlier
45
- var marketKey = dictionaries.getMarketKey(outcomeId);
46
- // we are obtaining the human-readable names of each market and the corresponding outcome selections
47
- var marketName = dictionaries.getMarketName({ outcomeId: outcomeId });
48
- var selectionName = dictionaries.getSelectionName({ outcomeId: outcomeId });
49
- var outcome = __assign({ conditionId: conditionId, outcomeId: outcomeId, lpAddress: lpAddress, coreAddress: coreAddress, selectionName: selectionName }, rest);
50
- if (!marketsMap[marketKey]) {
51
- marketsMap[marketKey] = {
52
- marketName: marketName,
53
- outcomes: [],
54
- };
55
- }
56
- marketsMap[marketKey].outcomes.push(outcome);
57
- });
58
- });
59
- var finalMarketsMap = {};
60
- // sort by outcomeId and group by conditionId
61
- Object.keys(marketsMap).forEach(function (marketKey) {
62
- var _a = marketsMap[marketKey], marketName = _a.marketName, outcomes = _a.outcomes;
63
- finalMarketsMap[marketKey] = {
64
- marketName: marketName,
65
- outcomes: null,
66
- };
67
- // sort the outcomes by `selectionId` (outcome's selection reference)
68
- outcomes.sort(function (a, b) {
69
- var left = dictionaries.dictionaries.outcomes[a.outcomeId].selectionId;
70
- var right = dictionaries.dictionaries.outcomes[b.outcomeId].selectionId;
71
- return left - right;
72
- });
73
- // "Full Time Result" and "Double Chance" are the markets whose outcomes don't require sorting
74
- var MARKETS_THAT_DONT_NEED_GROUPING = [1, 2];
75
- var marketId = marketKey.split('-')[0];
76
- if (MARKETS_THAT_DONT_NEED_GROUPING.includes(+marketId)) {
77
- // it's worth noting that the outcomes are wrapped within an array here due to the "rows" that are presented below
78
- finalMarketsMap[marketKey].outcomes = [outcomes];
79
- }
80
- else {
81
- // group the outcomes by condition ID, which will allow us to display the draw outcomes in separate rows
82
- //
83
- // Handicap:
84
- // H1 (-0.5) H2 (0.5)
85
- // H1 (0.5) H2 (-0.5)
86
- var outcomesByConditionId_1 = {};
87
- outcomes.forEach(function (outcome) {
88
- var key = outcome.conditionId;
89
- if (!outcomesByConditionId_1[key]) {
90
- outcomesByConditionId_1[key] = [];
91
- }
92
- outcomesByConditionId_1[key].push(outcome);
93
- });
94
- var rows = Object.values(outcomesByConditionId_1);
95
- finalMarketsMap[marketKey].outcomes = rows.sort(function (a, b) {
96
- var aSum = a.reduce(function (acc, _a) {
97
- var outcomeId = _a.outcomeId;
98
- return acc + +outcomeId;
99
- }, 0);
100
- var bSum = b.reduce(function (acc, _a) {
101
- var outcomeId = _a.outcomeId;
102
- return acc + +outcomeId;
103
- }, 0);
104
- return aSum - bSum;
105
- });
106
- }
107
- });
108
- return Object.values(finalMarketsMap);
109
- }exports.aggregateOutcomesByMarkets=aggregateOutcomesByMarkets;