@azuro-org/toolkit 2.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.
- package/.eslintrc +166 -0
- package/README.md +7 -110
- package/codegen.ts +62 -0
- package/dist/abis/FreeBet.d.ts +426 -0
- package/dist/abis/LP.d.ts +1469 -0
- package/dist/abis/LiveCore.d.ts +694 -0
- package/dist/abis/PrematchComboCore.d.ts +740 -0
- package/dist/abis/PrematchCore.d.ts +819 -0
- package/dist/abis/ProxyFront.d.ts +137 -0
- package/dist/abis/index.d.ts +6 -0
- package/dist/config.d.ts +51 -0
- package/dist/docs/index.d.ts +22 -0
- package/dist/docs/live/condition.d.ts +28 -0
- package/dist/docs/live/conditions.d.ts +29 -0
- package/dist/docs/live/fragments/condition.d.ts +20 -0
- package/dist/docs/live/types.d.ts +1902 -0
- package/dist/docs/prematch/bettors.d.ts +21 -0
- package/dist/docs/prematch/condition.d.ts +38 -0
- package/dist/docs/prematch/conditions.d.ts +39 -0
- package/dist/docs/prematch/conditionsBatch.d.ts +22 -0
- package/dist/docs/prematch/fragments/bettor.d.ts +12 -0
- package/dist/docs/prematch/fragments/condition.d.ts +30 -0
- package/dist/docs/prematch/fragments/liveBet.d.ts +42 -0
- package/dist/docs/prematch/fragments/mainGameInfo.d.ts +31 -0
- package/dist/docs/prematch/fragments/prematchBet.d.ts +75 -0
- package/dist/docs/prematch/game.d.ts +39 -0
- package/dist/docs/prematch/gameBets.d.ts +54 -0
- package/dist/docs/prematch/games.d.ts +43 -0
- package/dist/docs/prematch/liveBets.d.ts +54 -0
- package/dist/docs/prematch/navigation.d.ts +34 -0
- package/dist/docs/prematch/prematchBets.d.ts +87 -0
- package/dist/docs/prematch/sports.d.ts +63 -0
- package/dist/docs/prematch/sportsNavigation.d.ts +22 -0
- package/dist/docs/prematch/types.d.ts +6307 -0
- package/dist/global.d.ts +6 -0
- package/dist/helpers/formatToFixed.d.ts +1 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.js +5705 -0
- package/dist/utils/calcMindOdds.d.ts +6 -0
- package/dist/utils/calcOdds.d.ts +28 -0
- package/dist/utils/deBridge/createDeBridgeBet.d.ts +65 -0
- package/dist/utils/deBridge/getDeBridgeOrder.d.ts +39 -0
- package/dist/utils/deBridge/getDeBridgeSupportedChains.d.ts +4 -0
- package/dist/utils/deBridge/getDeBridgeSupportedTokens.d.ts +8 -0
- package/dist/utils/getBetStatus.d.ts +17 -0
- package/dist/utils/getEndpoints.d.ts +5 -0
- package/dist/utils/getFreebets.d.ts +35 -0
- package/dist/utils/getGameStatus.d.ts +16 -0
- package/dist/utils/getLiveBetFee.d.ts +14 -0
- package/dist/utils/getPrematchBetDataBytes.d.ts +3 -0
- package/dist/utils/groupByConditionId.d.ts +5 -0
- package/dist/utils/groupConditionsByMarket.d.ts +23 -0
- package/dist/utils/setupContracts.d.ts +37 -0
- package/dist/utils/wave/activateWave.d.ts +10 -0
- package/dist/utils/wave/getWaveLeaderBoard.d.ts +22 -0
- package/dist/utils/wave/getWaveLevels.d.ts +26 -0
- package/dist/utils/wave/getWavePeriods.d.ts +18 -0
- package/dist/utils/wave/getWaveStats.d.ts +30 -0
- package/graphql.config.yml +21 -0
- package/package.json +24 -8
- package/tsconfig.json +25 -10
- package/dist/aggregateOutcomesByMarkets.d.ts +0 -27
- package/dist/index.es.js +0 -109
- package/lib/aggregateOutcomesByMarkets.d.ts +0 -27
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -109
package/dist/index.es.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {getMarketKey,getMarketName,getSelectionName}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, dictionaries = props.dictionaries;
|
|
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: outcomeId, dictionaries: dictionaries });
|
|
46
|
-
// we are obtaining the human-readable names of each market and the corresponding outcome selections
|
|
47
|
-
var marketName = getMarketName({ outcomeId: outcomeId, dictionaries: dictionaries });
|
|
48
|
-
var selectionName = getSelectionName({ outcomeId: outcomeId, dictionaries: dictionaries });
|
|
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,27 +0,0 @@
|
|
|
1
|
-
import { type Dictionaries } from '@azuro-org/dictionaries';
|
|
2
|
-
type Outcome<T> = T & {
|
|
3
|
-
conditionId: string;
|
|
4
|
-
outcomeId: string;
|
|
5
|
-
selectionName: string;
|
|
6
|
-
lpAddress: string;
|
|
7
|
-
coreAddress: string;
|
|
8
|
-
};
|
|
9
|
-
type FinalMarket<T> = {
|
|
10
|
-
marketName: string;
|
|
11
|
-
outcomes: Outcome<T>[][];
|
|
12
|
-
};
|
|
13
|
-
type Props = {
|
|
14
|
-
lpAddress: string;
|
|
15
|
-
conditions: {
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
conditionId: string;
|
|
18
|
-
coreAddress: string;
|
|
19
|
-
outcomes: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
outcomeId: string;
|
|
22
|
-
}[];
|
|
23
|
-
}[];
|
|
24
|
-
dictionaries: Dictionaries;
|
|
25
|
-
};
|
|
26
|
-
export default function aggregateOutcomesByMarkets<T extends {}>(props: Props): FinalMarket<T>[];
|
|
27
|
-
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, dictionaries$1 = props.dictionaries;
|
|
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: outcomeId, dictionaries: dictionaries$1 });
|
|
46
|
-
// we are obtaining the human-readable names of each market and the corresponding outcome selections
|
|
47
|
-
var marketName = dictionaries.getMarketName({ outcomeId: outcomeId, dictionaries: dictionaries$1 });
|
|
48
|
-
var selectionName = dictionaries.getSelectionName({ outcomeId: outcomeId, dictionaries: dictionaries$1 });
|
|
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$1.outcomes[a.outcomeId].selectionId;
|
|
70
|
-
var right = dictionaries$1.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;
|