@numen-crypto/contract 0.18.2 → 0.19.0

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/index.cjs CHANGED
@@ -173,7 +173,8 @@ var TransactionTypeSchema = zod.z.enum([
173
173
  "SELL",
174
174
  "COMMISSION",
175
175
  "BONUS",
176
- "ADJUSTMENT"
176
+ "ADJUSTMENT",
177
+ "PREDICTION"
177
178
  ]);
178
179
  var TransactionStatusSchema = zod.z.enum(["PENDING", "PROCESSING", "COMPLETED", "FAILED", "CANCELLED"]);
179
180
  var TransactionSchema = zod.z.object({
@@ -1271,6 +1272,68 @@ exports.TicketAttachmentUploadCommand = void 0;
1271
1272
  fileKey: zod.z.string()
1272
1273
  });
1273
1274
  })(exports.TicketAttachmentUploadCommand || (exports.TicketAttachmentUploadCommand = {}));
1275
+ var PredictionSideSchema = zod.z.enum(["YES", "NO"]);
1276
+ var PredictionStatusSchema = zod.z.enum(["OPEN", "LOCKED", "RESOLVING", "RESOLVED", "VOID"]);
1277
+ var PredictionSchema = zod.z.object({
1278
+ id: zod.z.string().uuid(),
1279
+ slug: zod.z.string(),
1280
+ title: zod.z.string(),
1281
+ description: zod.z.string().nullable(),
1282
+ category: zod.z.string(),
1283
+ imageUrl: zod.z.string().nullable(),
1284
+ status: PredictionStatusSchema,
1285
+ outcome: PredictionSideSchema.nullable(),
1286
+ asset: AssetSymbolSchema,
1287
+ betsCloseAt: zod.z.string(),
1288
+ resolvesAt: zod.z.string(),
1289
+ poolYes: MoneyStringSchema,
1290
+ poolNo: MoneyStringSchema,
1291
+ poolTotal: MoneyStringSchema,
1292
+ /** Share of the total pool sitting on YES, in basis points. */
1293
+ yesShareBp: zod.z.number().int().min(0).max(1e4),
1294
+ participants: zod.z.number().int().nonnegative(),
1295
+ minStake: MoneyStringSchema.nullable(),
1296
+ maxStake: MoneyStringSchema.nullable(),
1297
+ feeBp: zod.z.number().int().min(0).max(1e4)
1298
+ });
1299
+ var PredictionPositionSchema = zod.z.object({
1300
+ side: PredictionSideSchema,
1301
+ staked: MoneyStringSchema,
1302
+ /** What the position pays out right now if this side wins, stake included. */
1303
+ projectedPayout: MoneyStringSchema,
1304
+ settled: zod.z.boolean(),
1305
+ payout: MoneyStringSchema.nullable()
1306
+ });
1307
+ var PredictionDetailSchema = PredictionSchema.extend({
1308
+ position: PredictionPositionSchema.nullable()
1309
+ });
1310
+ exports.ListPredictionsCommand = void 0;
1311
+ ((ListPredictionsCommand2) => {
1312
+ ListPredictionsCommand2.endpointDetails = endpoint(
1313
+ "GET",
1314
+ "/predictions",
1315
+ "Predictions open for betting and recently resolved"
1316
+ );
1317
+ ListPredictionsCommand2.QuerySchema = zod.z.object({
1318
+ status: zod.z.enum(["active", "resolved", "mine"]).optional()
1319
+ });
1320
+ ListPredictionsCommand2.ResponseSchema = zod.z.object({ items: zod.z.array(PredictionDetailSchema) });
1321
+ })(exports.ListPredictionsCommand || (exports.ListPredictionsCommand = {}));
1322
+ exports.GetPredictionCommand = void 0;
1323
+ ((GetPredictionCommand2) => {
1324
+ GetPredictionCommand2.endpointDetails = endpoint("GET", "/predictions/:slug", "One prediction with the caller position");
1325
+ GetPredictionCommand2.ResponseSchema = PredictionDetailSchema;
1326
+ })(exports.GetPredictionCommand || (exports.GetPredictionCommand = {}));
1327
+ exports.PlacePredictionBetCommand = void 0;
1328
+ ((PlacePredictionBetCommand2) => {
1329
+ PlacePredictionBetCommand2.endpointDetails = endpoint("POST", "/predictions/:slug/bet", "Stake on one side of a prediction");
1330
+ PlacePredictionBetCommand2.BodySchema = zod.z.object({
1331
+ side: PredictionSideSchema,
1332
+ amount: MoneyStringSchema,
1333
+ idempotencyKey: zod.z.string().min(8).max(128)
1334
+ });
1335
+ PlacePredictionBetCommand2.ResponseSchema = PredictionDetailSchema;
1336
+ })(exports.PlacePredictionBetCommand || (exports.PlacePredictionBetCommand = {}));
1274
1337
 
1275
1338
  // src/api/routes.ts
1276
1339
  var REST_API = {
@@ -1373,6 +1436,11 @@ var REST_API = {
1373
1436
  REPLY: "/tickets/:id/messages",
1374
1437
  ATTACHMENT_UPLOAD_URL: "/tickets/attachments/upload-url"
1375
1438
  },
1439
+ PREDICTIONS: {
1440
+ LIST: "/predictions",
1441
+ GET: "/predictions/:slug",
1442
+ BET: "/predictions/:slug/bet"
1443
+ },
1376
1444
  SUPPORT_TICKETS: {
1377
1445
  LIST: "/support/tickets",
1378
1446
  STREAM: "/support/tickets/stream",
@@ -1443,6 +1511,11 @@ exports.PartnerNodeSchema = PartnerNodeSchema;
1443
1511
  exports.PartnersOverviewSchema = PartnersOverviewSchema;
1444
1512
  exports.PeriodSchema = PeriodSchema;
1445
1513
  exports.PositiveMoneyStringSchema = PositiveMoneyStringSchema;
1514
+ exports.PredictionDetailSchema = PredictionDetailSchema;
1515
+ exports.PredictionPositionSchema = PredictionPositionSchema;
1516
+ exports.PredictionSchema = PredictionSchema;
1517
+ exports.PredictionSideSchema = PredictionSideSchema;
1518
+ exports.PredictionStatusSchema = PredictionStatusSchema;
1446
1519
  exports.PublicTradeSchema = PublicTradeSchema;
1447
1520
  exports.REST_API = REST_API;
1448
1521
  exports.RankDefSchema = RankDefSchema;