overtime-live-trading-utils 2.0.55 → 2.0.57-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.
@@ -1,6 +1,6 @@
1
1
  import bytes32 from 'bytes32';
2
+ import { getLeagueOpticOddsName, LeagueMap } from 'overtime-utils';
2
3
  import { OPTIC_ODDS_ID_SEPARATOR, OVERTIME_ID_SEPARATOR } from '../constants/common';
3
- import { LeagueIdMapOpticOdds } from '../constants/sports';
4
4
  import { Fixture, OddsObject, ScoresObject } from '../types/odds';
5
5
 
6
6
  export const mapOpticOddsApiFixtures = (fixturesData: any[]): Fixture[] =>
@@ -85,9 +85,10 @@ export const mapFromOpticOddsToOvertimeFormat = (fixtureId: string) => {
85
85
  return fixtureId;
86
86
  }
87
87
  const [leagueName, id] = fixtureId.split(OPTIC_ODDS_ID_SEPARATOR);
88
- const overtimeLeagueId = Object.keys(LeagueIdMapOpticOdds).find(
89
- (key) => formatOpticOddsLeagueName(LeagueIdMapOpticOdds[Number(key)]) === leagueName
90
- );
88
+ console.log('Mapping from Optic Odds to Overtime format:', { leagueName, id });
89
+ const overtimeLeagueId = Object.values(LeagueMap).find(
90
+ (league) => formatOpticOddsLeagueName(league.opticOddsName || '') === leagueName
91
+ )?.id;
91
92
  if (!overtimeLeagueId) {
92
93
  throw `Optic Odds league ${leagueName} not mapped.`;
93
94
  }
@@ -99,7 +100,7 @@ export const mapFromOvertimeToOpticOddsFormat = (gameId: string) => {
99
100
  return gameId;
100
101
  }
101
102
  const [leagueId, id] = gameId.split(OVERTIME_ID_SEPARATOR);
102
- const opticOddsLeagueName = LeagueIdMapOpticOdds[Number(leagueId)];
103
+ const opticOddsLeagueName = getLeagueOpticOddsName(Number(leagueId));
103
104
  if (!opticOddsLeagueName) {
104
105
  throw `Overtime league ID ${leagueId} not mapped.`;
105
106
  }