@glowlabs-org/events-sdk 1.0.13 → 1.0.14

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/README.md CHANGED
@@ -62,6 +62,7 @@ Currently supported event types and versions:
62
62
  | `audit.pfees.paid` | "v2" | `AuditPfeesPaidV2Payload` | Paid (by farmId) |
63
63
  | `audit.pfees.paid` | "v2-alpha" | `AuditPfeesPaidV2AlphaPayload` | Paid (by applicationId) + currency metadata |
64
64
  | `application.created` | "v1" | `ApplicationCreatedV1Payload` | Emitted when an application is created |
65
+ | `application.created` | "v2-alpha" | `ApplicationCreatedV2AlphaPayload` | V2-alpha: adds protocol fee price, omits installer |
65
66
  | `audit.pushed` | "v2" | `AuditPushedV2Payload` | Emitted when an audit is pushed (farmId is bytes16) |
66
67
  | `audit.pushed` | "v2-alpha" | `AuditPushedV2AlphaPayload` | Same as v1 but without protocol fee |
67
68
  | `application.price.quote` | "v2-alpha" | `ApplicationPriceQuoteV2AlphaPayload` | Price quote for application |
@@ -249,6 +250,19 @@ export interface ApplicationCreatedV1Payload {
249
250
  }
250
251
  ````
251
252
 
253
+ ### `application.created` v2-alpha
254
+
255
+ ```ts
256
+ export interface ApplicationCreatedV2AlphaPayload {
257
+ gcaAddress: string; // Ethereum address (0x...)
258
+ lat: number;
259
+ lng: number;
260
+ estimatedCostOfPowerPerKWh: number;
261
+ estimatedKWhGeneratedPerYear: number;
262
+ estimatedProtocolFeeUSDPrice_6Decimals: string; // uint256 (decimal) − 6 implied decimals
263
+ }
264
+ ```
265
+
252
266
  **Validation:**
253
267
 
254
268
  - `gcaAddress` must be a valid Ethereum address (0x...40 hex chars).
@@ -70,6 +70,14 @@ export interface BaseEventApplicationCreatedV1 {
70
70
  eventType: "application.created";
71
71
  timeStamp: number;
72
72
  }
73
+ export interface BaseEventApplicationCreatedV2Alpha {
74
+ id: string;
75
+ zoneId: number;
76
+ zoneName: string;
77
+ schemaVersion: "v2-alpha";
78
+ eventType: "application.created";
79
+ timeStamp: number;
80
+ }
73
81
  export interface BaseEventApplicationPriceQuoteV2Alpha {
74
82
  id: string;
75
83
  zoneId: number;
@@ -94,4 +102,4 @@ export interface BaseEventAuditorFeesPaidV2Alpha {
94
102
  eventType: "auditor.fees.paid";
95
103
  timeStamp: number;
96
104
  }
97
- export type BaseEvent = BaseEventAuditPushedV1 | BaseEventAuditSlashedV1 | BaseEventAuditPfeesPaidV1 | BaseEventAuditPfeesPaidV2 | BaseEventAuditPfeesPaidV2Alpha | BaseEventApplicationCreatedV1 | BaseEventApplicationPriceQuoteV2Alpha | BaseEventGctlMintedV2Alpha | BaseEventAuditorFeesPaidV2Alpha;
105
+ export type BaseEvent = BaseEventAuditPushedV1 | BaseEventAuditSlashedV1 | BaseEventAuditPfeesPaidV1 | BaseEventAuditPfeesPaidV2 | BaseEventAuditPfeesPaidV2Alpha | BaseEventApplicationCreatedV1 | BaseEventApplicationCreatedV2Alpha | BaseEventApplicationPriceQuoteV2Alpha | BaseEventGctlMintedV2Alpha | BaseEventAuditorFeesPaidV2Alpha;
@@ -14,6 +14,7 @@ const audit_pfees_paid_v2_alpha_1 = require("./schemas/audit-pfees-paid.v2-alpha
14
14
  const audit_pushed_v2_alpha_1 = require("./schemas/audit-pushed.v2-alpha");
15
15
  const gctl_minted_v2_alpha_1 = require("./schemas/gctl-minted.v2-alpha");
16
16
  const auditor_fees_paid_v2_alpha_1 = require("./schemas/auditor-fees-paid.v2-alpha");
17
+ const application_created_v2_alpha_1 = require("./schemas/application-created.v2-alpha");
17
18
  const eventTypeRegistry = {
18
19
  [`${event_types_1.eventTypes.auditPushed}:v1`]: base_event_1.baseEventZ.extend({
19
20
  payload: audit_pushed_v1_1.auditPushedV1PayloadZ,
@@ -33,6 +34,9 @@ const eventTypeRegistry = {
33
34
  [`${event_types_1.eventTypes.applicationCreated}:v1`]: base_event_1.baseEventZ.extend({
34
35
  payload: application_created_v1_1.applicationCreatedV1PayloadZ,
35
36
  }),
37
+ [`${event_types_1.eventTypes.applicationCreated}:v2-alpha`]: base_event_1.baseEventZ.extend({
38
+ payload: application_created_v2_alpha_1.applicationCreatedV2AlphaPayloadZ,
39
+ }),
36
40
  [`${event_types_1.eventTypes.auditPushed}:v2`]: base_event_1.baseEventZ.extend({
37
41
  payload: audit_pushed_v2_1.auditPushedV2PayloadZ,
38
42
  }),
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export declare const applicationCreatedV2AlphaPayloadZ: z.ZodObject<{
3
+ gcaAddress: z.ZodString;
4
+ lat: z.ZodNumber;
5
+ lng: z.ZodNumber;
6
+ estimatedCostOfPowerPerKWh: z.ZodNumber;
7
+ estimatedKWhGeneratedPerYear: z.ZodNumber;
8
+ estimatedProtocolFeeUSDPrice_6Decimals: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ gcaAddress: string;
11
+ lat: number;
12
+ lng: number;
13
+ estimatedCostOfPowerPerKWh: number;
14
+ estimatedKWhGeneratedPerYear: number;
15
+ estimatedProtocolFeeUSDPrice_6Decimals: string;
16
+ }, {
17
+ gcaAddress: string;
18
+ lat: number;
19
+ lng: number;
20
+ estimatedCostOfPowerPerKWh: number;
21
+ estimatedKWhGeneratedPerYear: number;
22
+ estimatedProtocolFeeUSDPrice_6Decimals: string;
23
+ }>;
24
+ export interface ApplicationCreatedV2AlphaPayload extends z.infer<typeof applicationCreatedV2AlphaPayloadZ> {
25
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applicationCreatedV2AlphaPayloadZ = void 0;
4
+ const zod_1 = require("zod");
5
+ const patterns_1 = require("../patterns");
6
+ exports.applicationCreatedV2AlphaPayloadZ = zod_1.z.object({
7
+ gcaAddress: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
8
+ lat: zod_1.z.number(),
9
+ lng: zod_1.z.number(),
10
+ estimatedCostOfPowerPerKWh: zod_1.z.number(),
11
+ estimatedKWhGeneratedPerYear: zod_1.z.number(),
12
+ estimatedProtocolFeeUSDPrice_6Decimals: zod_1.z
13
+ .string()
14
+ .regex(patterns_1.uint256, "uint256 (decimal) − 6 implied decimals"),
15
+ });
package/dist/types.d.ts CHANGED
@@ -5,6 +5,7 @@ import type { AuditPfeesPaidV1Payload } from "./schemas/audit-pfees-paid.v1";
5
5
  import type { AuditPfeesPaidV2Payload } from "./schemas/audit-pfees-paid.v2";
6
6
  import type { AuditPfeesPaidV2AlphaPayload } from "./schemas/audit-pfees-paid.v2-alpha";
7
7
  import type { ApplicationCreatedV1Payload } from "./schemas/application-created.v1";
8
+ import type { ApplicationCreatedV2AlphaPayload } from "./schemas/application-created.v2-alpha";
8
9
  import type { ApplicationPriceQuoteV2AlphaPayload } from "./schemas/application-price-quote.v2-alpha";
9
10
  import type { AuditPushedV2Payload } from "./schemas/audit-pushed.v2";
10
11
  import type { AuditPushedV2AlphaPayload } from "./schemas/audit-pushed.v2-alpha";
@@ -29,6 +30,7 @@ export interface EventPayloadMap {
29
30
  };
30
31
  [eventTypes.applicationCreated]: {
31
32
  v1: ApplicationCreatedV1Payload;
33
+ "v2-alpha": ApplicationCreatedV2AlphaPayload;
32
34
  };
33
35
  [eventTypes.applicationPriceQuote]: {
34
36
  "v2-alpha": ApplicationPriceQuoteV2AlphaPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glowlabs-org/events-sdk",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Typed event SDK for Glow, powered by RabbitMQ and Zod.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",