@levrbet/shared 0.2.103 → 0.3.3
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/dist/core/config/urls.d.ts +0 -8
- package/dist/core/config/urls.js +12 -20
- package/dist/core/config/urls.js.map +1 -1
- package/dist/core/contracts/abis/LevrManager.d.ts +988 -1008
- package/dist/core/contracts/abis/LevrManager.js +497 -1536
- package/dist/core/contracts/abis/LevrManager.js.map +1 -1
- package/dist/core/contracts/abis/index.d.ts +988 -1008
- package/dist/core/contracts/addresses.d.ts +21 -21
- package/dist/core/contracts/addresses.js +19 -19
- package/dist/core/types/oracle/market/positions.types.d.ts +1 -7
- package/dist/react/hooks/contracts/useContracts.d.ts +19 -19
- package/dist/server/config/kms.js +1 -1
- package/dist/server/config/redis.d.ts +0 -5
- package/dist/server/config/redis.js +3 -13
- package/dist/server/config/redis.js.map +1 -1
- package/dist/server/config/urls.d.ts +0 -8
- package/dist/server/contracts/clients/ozRelayerService.d.ts +0 -1
- package/dist/server/contracts/clients/ozRelayerService.js +17 -110
- package/dist/server/contracts/clients/ozRelayerService.js.map +1 -1
- package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.d.ts +9 -9
- package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.js.map +1 -1
- package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.test.js +1 -1
- package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.test.js.map +1 -1
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.d.ts +0 -4
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js +1 -5
- package/dist/server/oracle/config/game-periods/providers/optic-odds.periods.js.map +1 -1
- package/dist/server/oracle/config/game-periods/sports.config.d.ts +1 -1
- package/dist/server/oracle/config/game-periods/sports.config.js +6 -56
- package/dist/server/oracle/config/game-periods/sports.config.js.map +1 -1
- package/dist/server/oracle/config/game-periods/types.d.ts +1 -9
- package/dist/server/oracle/config/game-periods/types.js +0 -5
- package/dist/server/oracle/config/game-periods/types.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.d.ts +45 -74
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js +65 -120
- package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/channels.d.ts +2 -2
- package/dist/server/oracle/redis-cache-manager/channels.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/game.progress.d.ts +4 -4
- package/dist/server/oracle/redis-cache-manager/game.progress.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/game.query.engine.d.ts +90 -0
- package/dist/server/oracle/redis-cache-manager/game.query.engine.js +436 -0
- package/dist/server/oracle/redis-cache-manager/game.query.engine.js.map +1 -0
- package/dist/server/oracle/redis-cache-manager/index.d.ts +2 -2
- package/dist/server/oracle/redis-cache-manager/index.js +2 -2
- package/dist/server/oracle/redis-cache-manager/index.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/leagues.cache.service.d.ts +3 -3
- package/dist/server/oracle/redis-cache-manager/leagues.cache.service.js +1 -5
- package/dist/server/oracle/redis-cache-manager/leagues.cache.service.js.map +1 -1
- package/dist/server/oracle/redis-cache-manager/market.query.engine.d.ts +50 -97
- package/dist/server/oracle/redis-cache-manager/market.query.engine.js +310 -467
- package/dist/server/oracle/redis-cache-manager/market.query.engine.js.map +1 -1
- package/dist/server/oracle/rmq-manager/base.queue.manager.d.ts +1 -1
- package/dist/server/oracle/rmq-manager/base.queue.manager.js +1 -1
- package/dist/server/oracle/rmq-manager/base.queue.manager.js.map +1 -1
- package/dist/server/services/presigned.urls.js +1 -1
- package/dist/server/services/presigned.urls.js.map +1 -1
- package/dist/server/utils/game_progress/caclulate.game.progress.d.ts +4 -132
- package/dist/server/utils/game_progress/caclulate.game.progress.js +24 -195
- package/dist/server/utils/game_progress/caclulate.game.progress.js.map +1 -1
- package/dist/server/utils/game_progress/game.utils.d.ts +1 -6
- package/dist/server/utils/game_progress/game.utils.js +52 -71
- package/dist/server/utils/game_progress/game.utils.js.map +1 -1
- package/dist/server/utils/game_progress/parser.js +0 -6
- package/dist/server/utils/game_progress/parser.js.map +1 -1
- package/package.json +5 -5
- package/prisma/schema.prisma +3 -39
- package/scripts/setup-prisma.js +0 -0
- package/dist/server/oracle/redis-cache-manager/game.cache.service.d.ts +0 -186
- package/dist/server/oracle/redis-cache-manager/game.cache.service.js +0 -712
- package/dist/server/oracle/redis-cache-manager/game.cache.service.js.map +0 -1
- package/dist/server/oracle/redis-cache-manager/market.cache.service.d.ts +0 -87
- package/dist/server/oracle/redis-cache-manager/market.cache.service.js +0 -139
- package/dist/server/oracle/redis-cache-manager/market.cache.service.js.map +0 -1
|
@@ -1,83 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGameProgressBPS =
|
|
3
|
+
exports.getGameProgressBPS = void 0;
|
|
4
4
|
const client_1 = require("@prisma/client");
|
|
5
|
-
const
|
|
6
|
-
/**
|
|
7
|
-
* Clamps a BPS value between 0 and MAX_BASIS_POINTS
|
|
8
|
-
*/
|
|
9
|
-
const clampBPS = (value) => Math.max(0, Math.min(Math.floor(value), MAX_BASIS_POINTS));
|
|
10
|
-
// Clamp per-period elapsed time to prevent exceeding max period duration
|
|
11
|
-
const clampPeriodElapsed = (elapsed, totalPeriodDurationInSeconds) => Math.max(0, Math.min(elapsed, totalPeriodDurationInSeconds));
|
|
12
|
-
/**
|
|
13
|
-
* Get elapsed seconds from game clock based on clock direction.
|
|
14
|
-
* For countdown: elapsed = total - remaining
|
|
15
|
-
* For count-up: elapsed = clock value directly
|
|
16
|
-
* Clamps per-period elapsed time to valid range [0, totalPeriodDurationInSeconds]
|
|
17
|
-
*/
|
|
18
|
-
const getElapsedSeconds = (gameClockInSeconds, totalPeriodDurationInSeconds, period, isCumulative, clockCountUp) => {
|
|
19
|
-
if (clockCountUp) {
|
|
20
|
-
if (isCumulative) {
|
|
21
|
-
//if it's soccer only clamp if the game clock exceeds duration for that specific period
|
|
22
|
-
if (gameClockInSeconds > totalPeriodDurationInSeconds * period)
|
|
23
|
-
return clampPeriodElapsed(gameClockInSeconds, totalPeriodDurationInSeconds);
|
|
24
|
-
return Math.max(0, gameClockInSeconds);
|
|
25
|
-
}
|
|
26
|
-
return clampPeriodElapsed(gameClockInSeconds, totalPeriodDurationInSeconds);
|
|
27
|
-
}
|
|
28
|
-
// Countdown clock: elapsed = total - remaining
|
|
29
|
-
const elapsedInCurrentPeriod = clampPeriodElapsed(totalPeriodDurationInSeconds - gameClockInSeconds, totalPeriodDurationInSeconds);
|
|
30
|
-
if (isCumulative) {
|
|
31
|
-
// Soccer with countdown: add completed periods
|
|
32
|
-
return (period - 1) * totalPeriodDurationInSeconds + elapsedInCurrentPeriod;
|
|
33
|
-
}
|
|
34
|
-
return elapsedInCurrentPeriod;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* For sports like Baseball where we only track period (inning) progress, not time.
|
|
38
|
-
* Baseball: 9 innings, each with top (0) and bottom (1) = 18 half-innings total.
|
|
39
|
-
*/
|
|
40
|
-
const calculateBaseballProgressBPS = (period, totalPeriods, isTopOfInning) => {
|
|
5
|
+
const calculateGameProgressBPSWithPeriodsOnly = (period, totalPeriods) => {
|
|
41
6
|
if (period > totalPeriods)
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const totalHalfInnings = totalPeriods * 2;
|
|
46
|
-
const currentHalfInning = (period - 1) * 2 + (isTopOfInning ? 1 : 2);
|
|
47
|
-
return clampBPS((currentHalfInning / totalHalfInnings) * MAX_BASIS_POINTS);
|
|
7
|
+
return 1e4;
|
|
8
|
+
const progress = period / totalPeriods;
|
|
9
|
+
return Math.round(progress * 1e4);
|
|
48
10
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* @param totalPeriodDurationInSeconds - Duration of each period
|
|
54
|
-
* @param totalPeriods - Total number of periods
|
|
55
|
-
* @param period - Current period (only used for non-soccer sports)
|
|
56
|
-
* @param isCumulative - Whether elapsedSeconds is cumulative (soccer) or per-period (others)
|
|
57
|
-
*/
|
|
58
|
-
const calculateProgressBPS = (elapsedSeconds, totalPeriodDurationInSeconds, totalPeriods, period, isCumulative) => {
|
|
11
|
+
//{ totalPeriods: 2, totalPeriodDurationInSeconds: 45 * 60 },
|
|
12
|
+
// gameClock: '57:20',
|
|
13
|
+
//levr-v1-dev-oracle-core | gamePeriod: 20,
|
|
14
|
+
const calculateGameProgressBPS = (elapsedSeconds, totalPeriodDurationInSeconds, totalPeriods, period) => {
|
|
59
15
|
if (totalPeriodDurationInSeconds === 0)
|
|
60
16
|
return 0;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
17
|
+
if (elapsedSeconds > totalPeriodDurationInSeconds)
|
|
18
|
+
elapsedSeconds = totalPeriodDurationInSeconds;
|
|
19
|
+
const progress = elapsedSeconds / totalPeriodDurationInSeconds;
|
|
20
|
+
const periodsPassed = period - 1;
|
|
21
|
+
const pastProgress = calculateGameProgressBPSWithPeriodsOnly(periodsPassed, totalPeriods);
|
|
22
|
+
const currentPeriodProgress = (progress * 1e4) / totalPeriods;
|
|
23
|
+
const value = Math.round(pastProgress + currentPeriodProgress);
|
|
24
|
+
//TODO: revise time tracking
|
|
25
|
+
if (value > 1e4)
|
|
26
|
+
return 1e4;
|
|
27
|
+
if (value < 0)
|
|
28
|
+
return 0;
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
// Example: { totalPeriods: 2, totalPeriodDurationInSeconds: 45 * 60 }, gameClock: '57:20', period: 2
|
|
32
|
+
// gameClock is cumulative (57:20 = 57 mins into game, which is 12:20 into period 2)
|
|
33
|
+
// Expected: elapsedInPeriod = 3440 - 2700 = 740 seconds → ~63.7% game progress
|
|
34
|
+
const calculateGameProgressBPSWithGameClockCountUp = (gameClockInSeconds, totalPeriodDurationInSeconds, totalPeriods, period) => {
|
|
35
|
+
const cumulativeElapsedSeconds = gameClockInSeconds;
|
|
36
|
+
if (cumulativeElapsedSeconds === null)
|
|
37
|
+
return null;
|
|
38
|
+
// Subtract time from previous periods since gameClock is cumulative
|
|
39
|
+
const previousPeriodsSeconds = (period - 1) * totalPeriodDurationInSeconds;
|
|
40
|
+
const elapsedSecondsInCurrentPeriod = cumulativeElapsedSeconds - previousPeriodsSeconds;
|
|
41
|
+
return calculateGameProgressBPS(elapsedSecondsInCurrentPeriod, totalPeriodDurationInSeconds, totalPeriods, period);
|
|
42
|
+
};
|
|
43
|
+
const calculateGameProgressBPSWithGameClockCountDown = (gameClockInSeconds, totalPeriodDurationInSeconds, totalPeriods, period) => {
|
|
44
|
+
const remainingSeconds = gameClockInSeconds;
|
|
45
|
+
if (remainingSeconds === null)
|
|
46
|
+
return null;
|
|
47
|
+
const elapsedSeconds = totalPeriodDurationInSeconds - remainingSeconds;
|
|
48
|
+
return calculateGameProgressBPS(elapsedSeconds, totalPeriodDurationInSeconds, totalPeriods, period);
|
|
73
49
|
};
|
|
74
|
-
const getGameProgressBPS = (gameClockInSeconds, totalPeriodDurationInSeconds, period, totalPeriods, sportGroup, clockCountUp
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
const getGameProgressBPS = (gameClockInSeconds, totalPeriodDurationInSeconds, period, totalPeriods, sportGroup, clockCountUp) => {
|
|
51
|
+
switch (sportGroup) {
|
|
52
|
+
case client_1.SportGroup.Baseball:
|
|
53
|
+
return calculateGameProgressBPSWithPeriodsOnly(period, totalPeriods);
|
|
54
|
+
default:
|
|
55
|
+
if (clockCountUp) {
|
|
56
|
+
return calculateGameProgressBPSWithGameClockCountUp(gameClockInSeconds, totalPeriodDurationInSeconds, totalPeriods, period);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return calculateGameProgressBPSWithGameClockCountDown(gameClockInSeconds, totalPeriodDurationInSeconds, totalPeriods, period);
|
|
60
|
+
}
|
|
77
61
|
}
|
|
78
|
-
const isCumulative = sportGroup === client_1.SportGroup.Soccer;
|
|
79
|
-
const elapsedSeconds = getElapsedSeconds(gameClockInSeconds, totalPeriodDurationInSeconds, period, isCumulative, clockCountUp);
|
|
80
|
-
return calculateProgressBPS(elapsedSeconds, totalPeriodDurationInSeconds, totalPeriods, period, isCumulative);
|
|
81
62
|
};
|
|
82
63
|
exports.getGameProgressBPS = getGameProgressBPS;
|
|
83
64
|
//# sourceMappingURL=game.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.utils.js","sourceRoot":"","sources":["../../../../src/server/utils/game_progress/game.utils.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C,MAAM,
|
|
1
|
+
{"version":3,"file":"game.utils.js","sourceRoot":"","sources":["../../../../src/server/utils/game_progress/game.utils.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAE3C,MAAM,uCAAuC,GAAG,CAAC,MAAc,EAAE,YAAoB,EAAU,EAAE;IAC7F,IAAI,MAAM,GAAG,YAAY;QAAE,OAAO,GAAG,CAAA;IACrC,MAAM,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAA;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAA;AACrC,CAAC,CAAA;AAED,6DAA6D;AAC7D,uBAAuB;AACvB,gDAAgD;AAEhD,MAAM,wBAAwB,GAAG,CAC7B,cAAsB,EACtB,4BAAoC,EACpC,YAAoB,EACpB,MAAc,EACD,EAAE;IACf,IAAI,4BAA4B,KAAK,CAAC;QAAE,OAAO,CAAC,CAAA;IAChD,IAAI,cAAc,GAAG,4BAA4B;QAAE,cAAc,GAAG,4BAA4B,CAAA;IAChG,MAAM,QAAQ,GAAG,cAAc,GAAG,4BAA4B,CAAA;IA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,MAAM,CAAC,CAAA;AACvG,CAAC,CAAA;AAEM,MAAM,kBAAkB,GAAG,CAC9B,kBAA0B,EAC1B,4BAAoC,EACpC,MAAc,EACd,YAAoB,EACpB,UAAsB,EACtB,YAAqB,EACR,EAAE;IACf,QAAQ,UAAU,EAAE,CAAC;QACjB,KAAK,mBAAU,CAAC,QAAQ;YACpB,OAAO,uCAAuC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QACxE;YACI,IAAI,YAAY,EAAE,CAAC;gBACf,OAAO,4CAA4C,CAC/C,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,MAAM,CACT,CAAA;YACL,CAAC;iBAAM,CAAC;gBACJ,OAAO,8CAA8C,CACjD,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACZ,MAAM,CACT,CAAA;YACL,CAAC;IACT,CAAC;AACL,CAAC,CAAA;AA5BY,QAAA,kBAAkB,sBA4B9B"}
|
|
@@ -61,8 +61,6 @@ const parseGameClockToSeconds = (gameClock) => {
|
|
|
61
61
|
if (match?.[1] && match?.[2]) {
|
|
62
62
|
const minutes = parseInt(match[1], 10);
|
|
63
63
|
const seconds = parseInt(match[2], 10);
|
|
64
|
-
if (seconds >= 60)
|
|
65
|
-
return null; // Invalid seconds
|
|
66
64
|
return minutes * 60 + seconds;
|
|
67
65
|
}
|
|
68
66
|
break;
|
|
@@ -72,8 +70,6 @@ const parseGameClockToSeconds = (gameClock) => {
|
|
|
72
70
|
if (match?.[1] && match?.[2]) {
|
|
73
71
|
const minutes = parseInt(match[1], 10);
|
|
74
72
|
const seconds = parseInt(match[2], 10);
|
|
75
|
-
if (seconds >= 60)
|
|
76
|
-
return null; // Invalid seconds
|
|
77
73
|
return minutes * 60 + seconds;
|
|
78
74
|
}
|
|
79
75
|
break;
|
|
@@ -83,8 +79,6 @@ const parseGameClockToSeconds = (gameClock) => {
|
|
|
83
79
|
if (match?.[1] && match?.[2]) {
|
|
84
80
|
const minutes = parseInt(match[1], 10);
|
|
85
81
|
const seconds = parseInt(match[2], 10);
|
|
86
|
-
if (seconds >= 60)
|
|
87
|
-
return null; // Invalid seconds
|
|
88
82
|
return minutes * 60 + seconds;
|
|
89
83
|
}
|
|
90
84
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../src/server/utils/game_progress/parser.ts"],"names":[],"mappings":";;;AAAA,yEAAgF;AAEhF;;GAEG;AACH,MAAM,cAAc,GAAG;IACnB,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,qBAAqB;IACpC,WAAW,EAAE,4BAA4B;IACzC,gBAAgB,EAAE,2BAA2B;CACvC,CAAA;AAEV;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAoB,EAAE;IAC1E,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzC,OAAO,wBAAgB,CAAC,cAAc,CAAA;IAC1C,CAAC;IACD,IAAI,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5C,OAAO,wBAAgB,CAAC,UAAU,CAAA;IACtC,CAAC;IACD,IAAI,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/C,OAAO,wBAAgB,CAAC,mBAAmB,CAAA;IAC/C,CAAC;IACD,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,OAAO,wBAAgB,CAAC,qBAAqB,CAAA;IACjD,CAAC;IACD,IAAI,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAClD,OAAO,wBAAgB,CAAC,0BAA0B,CAAA;IACtD,CAAC;IACD,OAAO,wBAAgB,CAAC,OAAO,CAAA;AACnC,CAAC,CAAA;AAjBY,QAAA,sBAAsB,0BAiBlC;AAED;;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AAC,CAAC;YAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;YAC9D,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBACtC,OAAO,OAAO,GAAG,EAAE,GAAG,OAAO,CAAA;YACjC,CAAC;YACD,MAAK;QACT,CAAC;QACD,KAAK,wBAAgB,CAAC,OAAO,CAAC;QAC9B;YACI,OAAO,IAAI,CAAA;IACnB,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AA/CY,QAAA,uBAAuB,2BA+CnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levrbet/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@biomejs/biome": "2.3.10",
|
|
69
|
-
"@prisma/client": "^6.
|
|
69
|
+
"@prisma/client": "^6.19.1",
|
|
70
70
|
"@privy-io/react-auth": ">=3.0.0",
|
|
71
71
|
"@swc-node/register": "^1.11.1",
|
|
72
72
|
"@tanstack/react-query": ">=5.0.0",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"@aws-sdk/client-s3": "^3.926.0",
|
|
90
90
|
"@aws-sdk/client-sts": "^3.913.0",
|
|
91
91
|
"@aws-sdk/s3-request-presigner": "^3.926.0",
|
|
92
|
+
"@levrbet/shared": "^0.2.77",
|
|
92
93
|
"@opentelemetry/api": "^1.9.0",
|
|
93
94
|
"@opentelemetry/auto-instrumentations-node": "0.65.0",
|
|
94
95
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.206.0",
|
|
@@ -97,12 +98,10 @@
|
|
|
97
98
|
"@opentelemetry/sdk-metrics": "^2.1.0",
|
|
98
99
|
"@opentelemetry/sdk-node": "^0.206.0",
|
|
99
100
|
"@openzeppelin/relayer-sdk": "^1.6.0",
|
|
100
|
-
"@prisma/client": "^6.0.0",
|
|
101
101
|
"@privy-io/node": "^0.3.0",
|
|
102
102
|
"@types/amqplib": "^0.10.7",
|
|
103
103
|
"amqplib": "^0.10.9",
|
|
104
104
|
"axios": "^1.12.2",
|
|
105
|
-
"axios-retry": "^4.5.0",
|
|
106
105
|
"bson": "^6.10.4",
|
|
107
106
|
"coralogix-logger": "^1.1.34",
|
|
108
107
|
"dayjs": "^1.11.18",
|
|
@@ -121,7 +120,8 @@
|
|
|
121
120
|
"typescript-memoize": "^1.1.1",
|
|
122
121
|
"viem": "2.38.3",
|
|
123
122
|
"winston": "3.18.3",
|
|
124
|
-
"zod": "^4.1.12"
|
|
123
|
+
"zod": "^4.1.12",
|
|
124
|
+
"@prisma/client": "^6.0.0"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|
package/prisma/schema.prisma
CHANGED
|
@@ -321,10 +321,9 @@ model User {
|
|
|
321
321
|
requireWithdrawalConfirmation Boolean @default(true)
|
|
322
322
|
|
|
323
323
|
// Inverse relations (these fix your P1012 errors)
|
|
324
|
-
referralsMade
|
|
325
|
-
referredBy
|
|
326
|
-
referralRewards
|
|
327
|
-
transactionHistory TransactionHistory[] @relation("TransactionHistory") // transaction history
|
|
324
|
+
referralsMade Referral[] @relation("ReferrerRelations") // users they referred
|
|
325
|
+
referredBy Referral[] @relation("ReferredRelations") // who referred them
|
|
326
|
+
referralRewards ReferralReward[] @relation("UserRewards") // their reward entries
|
|
328
327
|
|
|
329
328
|
createdAt DateTime @default(now())
|
|
330
329
|
updatedAt DateTime @updatedAt
|
|
@@ -467,38 +466,3 @@ model AuditLog {
|
|
|
467
466
|
@@index([timestamp])
|
|
468
467
|
@@index([userId])
|
|
469
468
|
}
|
|
470
|
-
|
|
471
|
-
enum TransactionHistoryType {
|
|
472
|
-
Deposit
|
|
473
|
-
Withdrawal
|
|
474
|
-
Wager
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
enum TransactionHistoryStatus {
|
|
478
|
-
Completed
|
|
479
|
-
Pending
|
|
480
|
-
Failed
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
enum TransactionHistoryDescription {
|
|
484
|
-
BetPlaced
|
|
485
|
-
Deposited
|
|
486
|
-
Withdrawn
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
model TransactionHistory {
|
|
490
|
-
objectId String @id @default(cuid()) @map("_id")
|
|
491
|
-
id String
|
|
492
|
-
type TransactionHistoryType
|
|
493
|
-
status TransactionHistoryStatus
|
|
494
|
-
timestamp DateTime @default(now())
|
|
495
|
-
balance Float
|
|
496
|
-
description TransactionHistoryDescription
|
|
497
|
-
amount Float
|
|
498
|
-
// Relations
|
|
499
|
-
walletAddress String
|
|
500
|
-
user User @relation("TransactionHistory", fields: [walletAddress], references: [walletAddress])
|
|
501
|
-
|
|
502
|
-
@@index([timestamp])
|
|
503
|
-
@@index([walletAddress])
|
|
504
|
-
}
|
package/scripts/setup-prisma.js
CHANGED
|
File without changes
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Game Cache Service - Manages Redis caching operations for game-related data
|
|
3
|
-
* This module provides functionality for caching and retrieving game data, including:
|
|
4
|
-
* - Game schedules
|
|
5
|
-
* - Active and post-game data
|
|
6
|
-
* - Game scores and period information
|
|
7
|
-
* - Fixture ID mappings between different providers
|
|
8
|
-
*
|
|
9
|
-
* @module game.cache.service
|
|
10
|
-
*/
|
|
11
|
-
import { GamePhase, LevrGame } from "@prisma/client";
|
|
12
|
-
import { type ChainableCommander } from "ioredis";
|
|
13
|
-
import type { RedisClient } from "../../config";
|
|
14
|
-
import { FixtureIdsType, LevrChain, LevrGameWithRelationsPeriphery, LevrScores } from "../../../core";
|
|
15
|
-
import { GameCollectionKeys } from "./cache.keys.utils";
|
|
16
|
-
/**
|
|
17
|
-
* Caches active games in Redis.
|
|
18
|
-
* @param {ChainableCommander} pipeline - Redis pipeline
|
|
19
|
-
* @param {string} levrFixtureId - Fixture identifier
|
|
20
|
-
* @param {LevrGame[]} games - Games to cache
|
|
21
|
-
* @returns {Promise<void>}
|
|
22
|
-
*/
|
|
23
|
-
export declare const setActiveGamesCache: (pipeline: ChainableCommander, games: LevrGame[]) => Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Caches post-game data in Redis.
|
|
26
|
-
* @param {ChainableCommander} pipeline - Redis pipeline
|
|
27
|
-
* @param {string} levrFixtureId - Fixture identifier
|
|
28
|
-
* @param {LevrGame[]} games - Games to cache
|
|
29
|
-
* @returns {Promise<void>}
|
|
30
|
-
*/
|
|
31
|
-
export declare const setPostGamesCache: (pipeline: ChainableCommander, games: LevrGame[]) => Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves a game from the Redis cache using its game ID.
|
|
34
|
-
* @param gameId - The ID of the game.
|
|
35
|
-
* @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
|
|
36
|
-
*/
|
|
37
|
-
export declare const getActiveGameCacheByGameId: (redis: RedisClient, gameId: number, chainId: LevrChain) => Promise<LevrGame | null>;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieves a game from the Redis cache using its game ID.
|
|
40
|
-
* @param gameId - The ID of the game.
|
|
41
|
-
* @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
|
|
42
|
-
*/
|
|
43
|
-
export declare const getPostGameCacheByGameId: (redis: RedisClient, gameId: number, chainId: LevrChain) => Promise<LevrGame | null>;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves all games for a given fixture ID from the Redis cache.
|
|
46
|
-
* @param redis
|
|
47
|
-
* @param levrFixtureId
|
|
48
|
-
* @param gameCollectionKey
|
|
49
|
-
* @returns {Promise<LevrGame[]>} - A promise that resolves with an array of LevrGame objects.
|
|
50
|
-
* @notice all games are related to the fixtureId across all chains.
|
|
51
|
-
*/
|
|
52
|
-
export declare const getGamesByFixtureId: (redis: RedisClient, levrFixtureId: string, gameCollectionKey: GameCollectionKeys) => Promise<LevrGame[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieves all active games for a given fixture ID from the Redis cache.
|
|
55
|
-
* @param redis - Redis client instance
|
|
56
|
-
* @param levrFixtureId - The unique identifier for the fixture
|
|
57
|
-
* @param gameCollectionKey - The Redis hash key under which the games are stored
|
|
58
|
-
* @returns {Promise<LevrGame[]>} - A promise that resolves with an array of LevrGame objects
|
|
59
|
-
* @notice all games are related to the fixtureId across all chains.
|
|
60
|
-
*/
|
|
61
|
-
export declare const getActiveGamesByFixtureId: (redis: RedisClient, levrFixtureId: string) => Promise<LevrGame[]>;
|
|
62
|
-
export declare const getPostGamesByFixtureId: (redis: RedisClient, levrFixtureId: string) => Promise<LevrGame[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves specific games from the cache based on game IDs
|
|
65
|
-
*
|
|
66
|
-
* @param redis - Redis client instance
|
|
67
|
-
* @param gameCollectionKey - Key for the game collection in Redis
|
|
68
|
-
* @param gameIds - Array of game IDs to retrieve
|
|
69
|
-
* @param chainId - Blockchain network chain ID
|
|
70
|
-
*
|
|
71
|
-
* @returns Promise containing array of LevrGame objects
|
|
72
|
-
*
|
|
73
|
-
* Process:
|
|
74
|
-
* 1. Uses Redis pipeline for batch operations
|
|
75
|
-
* 2. Looks up fixture IDs from gameIdsToLevrFixtureIdsMap using game IDs
|
|
76
|
-
* 3. Filters out null fixture IDs and creates cache keys for each fixture
|
|
77
|
-
* 4. Retrieves game data from gameCollectionKey using fixture cache keys
|
|
78
|
-
* 5. Parses JSON strings into LevrGame objects
|
|
79
|
-
* 6. Returns flattened array of games
|
|
80
|
-
*/
|
|
81
|
-
export declare const getSpecificGamesCacheByGameIds: (redis: RedisClient, gameCollectionKey: GameCollectionKeys, gameIds: string[], chainId: LevrChain, withRelations?: boolean) => Promise<LevrGame[] | LevrGameWithRelationsPeriphery[]>;
|
|
82
|
-
export declare const getSpecificGamesCacheByFixtureIds: (redis: RedisClient, fixtureIds: string[], chainId: LevrChain, withRelations?: boolean, active?: boolean) => Promise<LevrGame[] | LevrGameWithRelationsPeriphery[]>;
|
|
83
|
-
export declare const getActiveGamesCache: (redis: RedisClient, chainId: LevrChain) => Promise<LevrGame[]>;
|
|
84
|
-
export declare const getActiveGamesCacheWithRelations: (redis: RedisClient, chainId: LevrChain) => Promise<LevrGameWithRelationsPeriphery[]>;
|
|
85
|
-
export declare const getPostGamesCache: (redis: RedisClient, chainId: LevrChain) => Promise<LevrGame[]>;
|
|
86
|
-
/**
|
|
87
|
-
* Retrieves active games from the Redis cache using its fixture ID.
|
|
88
|
-
* @param fixtureId - The unique identifier for the fixture.
|
|
89
|
-
* @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
|
|
90
|
-
*/
|
|
91
|
-
export declare const getGameCacheByFixtureId: (redis: RedisClient, fixtureId: string) => Promise<LevrGame[] | null>;
|
|
92
|
-
/**
|
|
93
|
-
* Retrieves a game from the Redis cache using the provider's fixture ID.
|
|
94
|
-
* @param providerFixtureId - The fixture ID provided by the odds provider, e.g (lsports, rundown, optic odds)
|
|
95
|
-
* @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
|
|
96
|
-
*/
|
|
97
|
-
export declare const getGameCacheByFixtureIdWithProviderFixtureId: (redis: RedisClient, providerFixtureId: string) => Promise<LevrGame[] | null>;
|
|
98
|
-
export declare const removeActiveGamesCache: (redis: RedisClient, levrFixtureId: string, chainId: LevrChain) => Promise<void>;
|
|
99
|
-
export declare const removePostGamesCache: (redis: RedisClient, levrFixtureId: string, chainId: LevrChain) => Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Maps a game ID to a Levr fixture ID in Redis.
|
|
102
|
-
* @param gameId - The game ID to be mapped.
|
|
103
|
-
* @param levrFixtureId - The corresponding Levr fixture ID.
|
|
104
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
105
|
-
*/
|
|
106
|
-
export declare const mapGameIdToLevrFixtureId: (redis: RedisClient, gameId: number, levrFixtureId: string) => Promise<void>;
|
|
107
|
-
export declare const mapProviderFixtureIdToLevrFixtureId: (redis: RedisClient, fixtureIds: FixtureIdsType) => Promise<void>;
|
|
108
|
-
export declare const mapProviderFixtureIdToLevrFixtureIdMany: (pipeline: ChainableCommander, fixtureIdsList: FixtureIdsType[]) => Promise<void>;
|
|
109
|
-
/**
|
|
110
|
-
* Retrieves the Levr fixture ID using a game ID from Redis.
|
|
111
|
-
* @param gameId - The ID of the game.
|
|
112
|
-
* @returns {Promise<string | null>} - A promise that resolves with the Levr fixture ID or null if not found.
|
|
113
|
-
*/
|
|
114
|
-
export declare const getLevrFixtureIdUsingGameId: (redis: RedisClient, gameId: number) => Promise<string | null>;
|
|
115
|
-
/**
|
|
116
|
-
* Updates the game clock in the Redis cache or in the database if not found in cache.
|
|
117
|
-
* @param gameId - The ID of the game.
|
|
118
|
-
* @param gameClock - The current game clock value.
|
|
119
|
-
* @param gamePeriod - The current game period.
|
|
120
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
121
|
-
*/
|
|
122
|
-
export declare const updateGamesClockInCache: (redis: RedisClient, levrFixtureId: string, gameClock: string, gamePeriod: number) => Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Sets the game score in the Redis cache.
|
|
125
|
-
* @param gameId - The ID of the game.
|
|
126
|
-
* @param score - The Scores object to be cached.
|
|
127
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
128
|
-
*/
|
|
129
|
-
export declare const setGamesScoreCache: (redis: RedisClient, fixtureId: string, score: LevrScores) => Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Retrieves the game score from the Redis cache.
|
|
132
|
-
* @param gameId - The ID of the game.
|
|
133
|
-
* @returns {Promise<LevrScores | null>} - A promise that resolves with a Scores object or null if not found.
|
|
134
|
-
*/
|
|
135
|
-
export declare const getGameScoreCache: (redis: RedisClient, fixtureId: string) => Promise<LevrScores | null>;
|
|
136
|
-
/**
|
|
137
|
-
* Updates the game status in the Redis cache or in the database if not found in cache.
|
|
138
|
-
* @param gameId - The ID of the game.
|
|
139
|
-
* @param gamePhase - The new GamePhase value.
|
|
140
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
141
|
-
*/
|
|
142
|
-
export declare const updateGameStatusInCache: (redis: RedisClient, gameIds: number[], levrFixtureId: string, gamePhase: GamePhase) => Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* Deletes all sub-keys associated with a given Levr fixture ID.
|
|
145
|
-
* @param levrFixtureId - The Levr fixture ID.
|
|
146
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
147
|
-
*/
|
|
148
|
-
export declare const deleteAllSubKeys: (redis: RedisClient, levrFixtureId: string) => Promise<void>;
|
|
149
|
-
/**
|
|
150
|
-
* Invalidates the game score cache.
|
|
151
|
-
* @param gameId - The ID of the game.
|
|
152
|
-
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
153
|
-
*/
|
|
154
|
-
export declare const invalidateScoreCache: (redis: RedisClient, fixtureId: string, callbackPromise: () => Promise<void>) => Promise<void>;
|
|
155
|
-
/**
|
|
156
|
-
* Retrieves all provider fixture IDs associated with multiple Levr fixture IDs.
|
|
157
|
-
*
|
|
158
|
-
* This function queries Redis to find all provider-specific fixture IDs that correspond
|
|
159
|
-
* to the given Levr fixture IDs. It uses a Redis pipeline to efficiently batch
|
|
160
|
-
* multiple queries into a single network request.
|
|
161
|
-
*
|
|
162
|
-
* @param redis - The Redis client instance used to perform the queries
|
|
163
|
-
* @param levrFixtureIda - An array of Levr fixture IDs to look up
|
|
164
|
-
*
|
|
165
|
-
* @returns A Promise resolving to a Record/object where:
|
|
166
|
-
* - Keys are Levr fixture IDs from the input array
|
|
167
|
-
* - Values are arrays of provider-specific fixture IDs associated with each Levr ID
|
|
168
|
-
* - If a Levr ID has no associated provider IDs or doesn't exist, it will map to an empty array
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* Get provider IDs for two Levr fixture IDs
|
|
172
|
-
* const providerMap = await getAllProvidersIdsForLevrFixtureIds(redisClient, ['levr-123', 'levr-456']);
|
|
173
|
-
* Result might be: { 'levr-123': ['provider1-789', 'provider2-012'], 'levr-456': ['provider1-345'] }
|
|
174
|
-
*
|
|
175
|
-
* @throws Will throw an error if the Redis operation fails
|
|
176
|
-
*/
|
|
177
|
-
export declare const getAllProvidersIdsForLevrFixtureIds: (redis: RedisClient, levrFixtureIds: string[]) => Promise<Record<string, string[]>>;
|
|
178
|
-
/**
|
|
179
|
-
* Gets all fixture IDs associated with a list of game IDs from Redis
|
|
180
|
-
*
|
|
181
|
-
* @param redis - Redis client instance
|
|
182
|
-
* @param gameIds - Array of game IDs to lookup
|
|
183
|
-
* @returns Record mapping game IDs to arrays of fixture IDs
|
|
184
|
-
* @throws Will throw an error if the Redis operation fails
|
|
185
|
-
*/
|
|
186
|
-
export declare const getAllFixtureIdsForGameIds: (redis: RedisClient, gameIds: string[]) => Promise<Record<string, string[]>>;
|