@azuro-org/toolkit 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,12 +12,14 @@ type Markets = {
|
|
|
12
12
|
}[];
|
|
13
13
|
type Props = {
|
|
14
14
|
lpAddress: string;
|
|
15
|
-
coreAddress: string;
|
|
16
15
|
conditions: {
|
|
17
16
|
[key: string]: any;
|
|
18
17
|
outcomes: {
|
|
19
18
|
[key: string]: any;
|
|
20
19
|
outcomeId: string;
|
|
20
|
+
core: {
|
|
21
|
+
address: string;
|
|
22
|
+
};
|
|
21
23
|
}[];
|
|
22
24
|
}[];
|
|
23
25
|
dictionaries: Dictionaries;
|
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {getMarketKey,getMarketName,assembleSelectionName}from'@azuro-org/dictionaries';function aggregateOutcomesByMarkets(props) {
|
|
2
|
-
var lpAddress = props.lpAddress,
|
|
2
|
+
var lpAddress = props.lpAddress, conditions = props.conditions, dictionaries = props.dictionaries;
|
|
3
3
|
// group conditions by marketId
|
|
4
4
|
var outcomesByMarketKey = {};
|
|
5
5
|
var result = {};
|
|
6
6
|
conditions.forEach(function (_a) {
|
|
7
7
|
var conditionId = _a.conditionId, outcomes = _a.outcomes;
|
|
8
8
|
outcomes.forEach(function (_a) {
|
|
9
|
-
var outcomeId = _a.outcomeId;
|
|
9
|
+
var outcomeId = _a.outcomeId, core = _a.core;
|
|
10
10
|
var marketKey = getMarketKey(outcomeId, dictionaries);
|
|
11
11
|
var marketName = getMarketName(outcomeId, dictionaries);
|
|
12
12
|
var selectionName = assembleSelectionName(outcomeId, dictionaries);
|
|
@@ -15,7 +15,7 @@ import {getMarketKey,getMarketName,assembleSelectionName}from'@azuro-org/diction
|
|
|
15
15
|
outcomeId: outcomeId,
|
|
16
16
|
selectionName: selectionName,
|
|
17
17
|
lpAddress: lpAddress,
|
|
18
|
-
coreAddress:
|
|
18
|
+
coreAddress: core.address,
|
|
19
19
|
};
|
|
20
20
|
// it's important to use "marketKey" because it's unique
|
|
21
21
|
// on other hand "marketId" can be same for different groups of conditions
|
|
@@ -12,12 +12,14 @@ type Markets = {
|
|
|
12
12
|
}[];
|
|
13
13
|
type Props = {
|
|
14
14
|
lpAddress: string;
|
|
15
|
-
coreAddress: string;
|
|
16
15
|
conditions: {
|
|
17
16
|
[key: string]: any;
|
|
18
17
|
outcomes: {
|
|
19
18
|
[key: string]: any;
|
|
20
19
|
outcomeId: string;
|
|
20
|
+
core: {
|
|
21
|
+
address: string;
|
|
22
|
+
};
|
|
21
23
|
}[];
|
|
22
24
|
}[];
|
|
23
25
|
dictionaries: Dictionaries;
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var dictionaries=require('@azuro-org/dictionaries');function aggregateOutcomesByMarkets(props) {
|
|
2
|
-
var lpAddress = props.lpAddress,
|
|
2
|
+
var lpAddress = props.lpAddress, conditions = props.conditions, dictionaries$1 = props.dictionaries;
|
|
3
3
|
// group conditions by marketId
|
|
4
4
|
var outcomesByMarketKey = {};
|
|
5
5
|
var result = {};
|
|
6
6
|
conditions.forEach(function (_a) {
|
|
7
7
|
var conditionId = _a.conditionId, outcomes = _a.outcomes;
|
|
8
8
|
outcomes.forEach(function (_a) {
|
|
9
|
-
var outcomeId = _a.outcomeId;
|
|
9
|
+
var outcomeId = _a.outcomeId, core = _a.core;
|
|
10
10
|
var marketKey = dictionaries.getMarketKey(outcomeId, dictionaries$1);
|
|
11
11
|
var marketName = dictionaries.getMarketName(outcomeId, dictionaries$1);
|
|
12
12
|
var selectionName = dictionaries.assembleSelectionName(outcomeId, dictionaries$1);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
outcomeId: outcomeId,
|
|
16
16
|
selectionName: selectionName,
|
|
17
17
|
lpAddress: lpAddress,
|
|
18
|
-
coreAddress:
|
|
18
|
+
coreAddress: core.address,
|
|
19
19
|
};
|
|
20
20
|
// it's important to use "marketKey" because it's unique
|
|
21
21
|
// on other hand "marketId" can be same for different groups of conditions
|