@moneypot/hub 1.9.0-dev.11 → 1.9.0-dev.13

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.
@@ -196,6 +196,7 @@ export function MakeOutcomeBetPlugin({ betConfigs }) {
196
196
  riskPolicy: betConfig.riskPolicy,
197
197
  displayUnitName: dbCurrency.display_unit_name,
198
198
  displayUnitScale: dbCurrency.display_unit_scale,
199
+ outcomes: input.outcomes,
199
200
  });
200
201
  if (!riskResult.ok) {
201
202
  throw new GraphQLError(riskResult.error);
@@ -1,15 +1,16 @@
1
+ import { DbOutcome } from "./db/types.js";
1
2
  import { Result } from "./util.js";
2
3
  export type RiskPolicyArgs = {
3
4
  currency: string;
4
5
  wager: number;
5
6
  bankroll: number;
6
7
  maxPotentialPayout: number;
8
+ outcomes: DbOutcome[];
7
9
  };
8
- type AtLeastOneKey<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Required<Pick<T, Keys>> & Partial<Omit<T, Keys>> : never;
9
- export type RiskLimits = AtLeastOneKey<{
10
+ export type RiskLimits = {
10
11
  maxWager?: number;
11
- maxPayout?: number;
12
- }>;
12
+ maxPayout: number;
13
+ };
13
14
  export type RiskPolicy = (args: RiskPolicyArgs) => RiskLimits;
14
15
  export declare function validateRisk(options: RiskPolicyArgs & {
15
16
  riskPolicy: RiskPolicy;
@@ -17,4 +18,3 @@ export declare function validateRisk(options: RiskPolicyArgs & {
17
18
  displayUnitName: string;
18
19
  displayUnitScale: number;
19
20
  }): Result<void, string>;
20
- export {};
@@ -4,12 +4,9 @@ import { z } from "zod";
4
4
  const RiskLimitsSchema = z
5
5
  .object({
6
6
  maxWager: z.number().positive().optional(),
7
- maxPayout: z.number().positive().optional(),
7
+ maxPayout: z.number().positive(),
8
8
  })
9
- .strict()
10
- .refine((v) => v.maxWager !== undefined || v.maxPayout !== undefined, {
11
- message: "Provide at least one of maxWager or maxPayout.",
12
- });
9
+ .strict();
13
10
  export function validateRisk(options) {
14
11
  const { wager, bankroll, maxPotentialPayout, riskPolicy } = options;
15
12
  if (maxPotentialPayout > bankroll) {
@@ -48,7 +45,7 @@ export function validateRisk(options) {
48
45
  })})`,
49
46
  };
50
47
  }
51
- if (limits.maxPayout !== undefined && maxPotentialPayout > limits.maxPayout) {
48
+ if (maxPotentialPayout > limits.maxPayout) {
52
49
  return {
53
50
  ok: false,
54
51
  error: `Payout (${formatCurrency(maxPotentialPayout, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneypot/hub",
3
- "version": "1.9.0-dev.11",
3
+ "version": "1.9.0-dev.13",
4
4
  "author": "moneypot.com",
5
5
  "homepage": "https://moneypot.com/hub",
6
6
  "keywords": [