gambling-bot-shared 0.1.37 → 0.1.39
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/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -22,3 +22,4 @@ __exportStar(require("./generateId"), exports);
|
|
|
22
22
|
__exportStar(require("./parseTimeToSeconds"), exports);
|
|
23
23
|
__exportStar(require("./validateBetAmount"), exports);
|
|
24
24
|
__exportStar(require("./bonusStreak"), exports);
|
|
25
|
+
__exportStar(require("./validatePredictionBet"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PredictionBetValidationError = 'BELOW_MIN_BET' | 'ABOVE_MAX_PER_CHOICE';
|
|
2
|
+
export type PredictionBetValidationResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
} | {
|
|
5
|
+
ok: false;
|
|
6
|
+
error: PredictionBetValidationError;
|
|
7
|
+
};
|
|
8
|
+
export declare const validatePredictionChoiceBet: ({ userChoiceTotal, parsedBetAmount, maxBet, minBet }: {
|
|
9
|
+
userChoiceTotal: number;
|
|
10
|
+
parsedBetAmount: number;
|
|
11
|
+
maxBet: number;
|
|
12
|
+
minBet: number;
|
|
13
|
+
}) => PredictionBetValidationResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePredictionChoiceBet = void 0;
|
|
4
|
+
const validatePredictionChoiceBet = ({ userChoiceTotal, parsedBetAmount, maxBet, minBet }) => {
|
|
5
|
+
if (minBet > 0 && parsedBetAmount < minBet) {
|
|
6
|
+
return { ok: false, error: 'BELOW_MIN_BET' };
|
|
7
|
+
}
|
|
8
|
+
const newChoiceTotal = userChoiceTotal + parsedBetAmount;
|
|
9
|
+
if (maxBet > 0 && newChoiceTotal > maxBet) {
|
|
10
|
+
return { ok: false, error: 'ABOVE_MAX_PER_CHOICE' };
|
|
11
|
+
}
|
|
12
|
+
return { ok: true };
|
|
13
|
+
};
|
|
14
|
+
exports.validatePredictionChoiceBet = validatePredictionChoiceBet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gambling-bot-shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsc -p tsconfig.json",
|
|
27
|
-
"
|
|
27
|
+
"publish-and-bump-projects": "bash scripts/publish-to-npm.sh",
|
|
28
28
|
"release": "pnpm build && npm version patch && npm publish"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|