@glowlabs-org/events-sdk 1.0.9 → 1.0.10
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 +65 -11
- package/dist/base-event.d.ts +28 -4
- package/dist/base-event.js +1 -1
- package/dist/event-registry.d.ts +1 -1
- package/dist/event-registry.js +16 -0
- package/dist/event-types.d.ts +2 -0
- package/dist/event-types.js +2 -0
- package/dist/schemas/application-price-quote.v2-alpha.d.ts +47 -0
- package/dist/schemas/application-price-quote.v2-alpha.js +17 -0
- package/dist/schemas/audit-pfees-paid.v2-alpha.d.ts +30 -0
- package/dist/schemas/audit-pfees-paid.v2-alpha.js +10 -0
- package/dist/schemas/audit-pushed.v2-alpha.d.ts +15 -0
- package/dist/schemas/audit-pushed.v2-alpha.js +10 -0
- package/dist/schemas/gctl-minted.v2-alpha.d.ts +21 -0
- package/dist/schemas/gctl-minted.v2-alpha.js +16 -0
- package/dist/types.d.ts +13 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -54,14 +54,18 @@ Both `createGlowEventListener` and `createGlowEventEmitter` accept the following
|
|
54
54
|
|
55
55
|
Currently supported event types and versions:
|
56
56
|
|
57
|
-
| Event Name
|
58
|
-
|
|
59
|
-
| `audit.pushed`
|
60
|
-
| `audit.slashed`
|
61
|
-
| `audit.pfees.paid`
|
62
|
-
| `audit.pfees.paid`
|
63
|
-
| `
|
64
|
-
| `
|
57
|
+
| Event Name | Version | Payload Type | Description |
|
58
|
+
| ------------------------- | ---------- | ------------------------------------- | --------------------------------------------------- |
|
59
|
+
| `audit.pushed` | "v1" | `AuditPushedV1Payload` | Emitted when an audit is pushed |
|
60
|
+
| `audit.slashed` | "v1" | `AuditSlashedV1Payload` | Emitted when a farm is slashed |
|
61
|
+
| `audit.pfees.paid` | "v1" | `AuditPfeesPaidV1Payload` | Paid (by applicationId) |
|
62
|
+
| `audit.pfees.paid` | "v2" | `AuditPfeesPaidV2Payload` | Paid (by farmId) |
|
63
|
+
| `audit.pfees.paid` | "v2-alpha" | `AuditPfeesPaidV2AlphaPayload` | Paid (by applicationId) + currency metadata |
|
64
|
+
| `application.created` | "v1" | `ApplicationCreatedV1Payload` | Emitted when an application is created |
|
65
|
+
| `audit.pushed` | "v2" | `AuditPushedV2Payload` | Emitted when an audit is pushed (farmId is bytes16) |
|
66
|
+
| `audit.pushed` | "v2-alpha" | `AuditPushedV2AlphaPayload` | Same as v1 but without protocol fee |
|
67
|
+
| `application.price.quote` | "v2-alpha" | `ApplicationPriceQuoteV2AlphaPayload` | Price quote for application |
|
68
|
+
| `gctl.minted` | "v2-alpha" | `GctlMintedV2AlphaPayload` | GCTL minted amount and metadata |
|
65
69
|
|
66
70
|
---
|
67
71
|
|
@@ -156,15 +160,65 @@ export interface AuditPfeesPaidV2Payload {
|
|
156
160
|
|
157
161
|
### `audit.pushed` v2
|
158
162
|
|
159
|
-
|
163
|
+
````ts
|
160
164
|
export interface AuditPushedV2Payload {
|
161
165
|
farmId: string; // bytes16 hex string (0x...)
|
162
166
|
protocolFeeUSDPrice_12Decimals: string; // uint256 (decimal) − 12 implied decimals
|
163
167
|
expectedProduction_12Decimals: string; // uint256 (decimal) − 12 implied decimals
|
164
168
|
txHash: string; // bytes32 hex string (0x...)
|
165
169
|
}
|
170
|
+
|
171
|
+
### `audit.pushed` v2-alpha
|
172
|
+
|
173
|
+
```ts
|
174
|
+
export interface AuditPushedV2AlphaPayload {
|
175
|
+
farmId: string; // UUID string
|
176
|
+
expectedProduction_12Decimals: string; // uint256 (decimal) − 12 implied decimals
|
177
|
+
txHash: string; // bytes32 hex string (0x...)
|
178
|
+
}
|
179
|
+
````
|
180
|
+
|
181
|
+
### `audit.pfees.paid` v2-alpha
|
182
|
+
|
183
|
+
```ts
|
184
|
+
export type PaymentCurrency = "GCTL" | "USDC" | "USDG" | "GLW";
|
185
|
+
export interface AuditPfeesPaidV2AlphaPayload {
|
186
|
+
applicationId: string; // UUID string
|
187
|
+
payer: string; // Ethereum address (0x...)
|
188
|
+
amount_6Decimals: string; // uint256 (decimal) − 6 implied decimals
|
189
|
+
txHash: string; // bytes32 hex string (0x...)
|
190
|
+
paymentCurrency: PaymentCurrency;
|
191
|
+
paymentEventType: string;
|
192
|
+
isSponsored: boolean;
|
193
|
+
}
|
166
194
|
```
|
167
195
|
|
196
|
+
### `application.price.quote` v2-alpha
|
197
|
+
|
198
|
+
```ts
|
199
|
+
export interface ApplicationPriceQuoteV2AlphaPayload {
|
200
|
+
applicationId: string; // UUID string
|
201
|
+
createdAt: string; // ISO-8601 datetime string
|
202
|
+
prices: { GCTL: string; GLW: string; USDC: string; USDG: string }; // uint256 decimal strings
|
203
|
+
signature: string; // bytes32 hex string (0x...)
|
204
|
+
gcaAddress: string; // Ethereum address (0x...)
|
205
|
+
}
|
206
|
+
```
|
207
|
+
|
208
|
+
### `gctl.minted` v2-alpha
|
209
|
+
|
210
|
+
```ts
|
211
|
+
export interface GctlMintedV2AlphaPayload {
|
212
|
+
usdcAmount_6Decimals: string; // uint256 (decimal) − 6 implied decimals
|
213
|
+
gctlAmount_6Decimals: string; // uint256 (decimal) − 6 implied decimals
|
214
|
+
timestamp: string; // ISO-8601 datetime string
|
215
|
+
minter: string; // Ethereum address (0x...)
|
216
|
+
txHash: string; // bytes32 hex string (0x...)
|
217
|
+
}
|
218
|
+
```
|
219
|
+
|
220
|
+
````
|
221
|
+
|
168
222
|
**Validation:**
|
169
223
|
|
170
224
|
- `farmId` must be a 16-byte hex string (e.g., `0x...`).
|
@@ -182,7 +236,7 @@ export interface ApplicationCreatedV1Payload {
|
|
182
236
|
estimatedKWhGeneratedPerYear: number;
|
183
237
|
installerCompanyName: string;
|
184
238
|
}
|
185
|
-
|
239
|
+
````
|
186
240
|
|
187
241
|
**Validation:**
|
188
242
|
|
@@ -341,7 +395,7 @@ await emitter.disconnect();
|
|
341
395
|
>
|
342
396
|
> - The emitter will automatically publish each event to both the global (zone 0) and the specific zone exchange.
|
343
397
|
> - You cannot construct an emitter for zoneId: 0, and you cannot specify zoneId per emit call.
|
344
|
-
> - `schemaVersion` is always a string (e.g., "v1", "v2").
|
398
|
+
> - `schemaVersion` is always a string (e.g., "v1", "v2", "v2-alpha").
|
345
399
|
> - **You can override the RabbitMQ host using the `host` option. Default is `turntable.proxy.rlwy.net:50784`.**
|
346
400
|
|
347
401
|
### 🌐 Listening to All Zones
|
package/dist/base-event.d.ts
CHANGED
@@ -4,21 +4,21 @@ export declare const baseEventZ: z.ZodObject<{
|
|
4
4
|
id: z.ZodString;
|
5
5
|
zoneId: z.ZodEffects<z.ZodNumber, number, number>;
|
6
6
|
zoneName: z.ZodEnum<[string, ...string[]]>;
|
7
|
-
schemaVersion: z.ZodEnum<["v1", "v2"]>;
|
7
|
+
schemaVersion: z.ZodEnum<["v1", "v2", "v2-alpha"]>;
|
8
8
|
eventType: z.ZodEnum<[EventType, ...EventType[]]>;
|
9
9
|
timeStamp: z.ZodNumber;
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
11
11
|
id: string;
|
12
12
|
zoneId: number;
|
13
13
|
zoneName: string;
|
14
|
-
schemaVersion: "v1" | "v2";
|
14
|
+
schemaVersion: "v1" | "v2" | "v2-alpha";
|
15
15
|
eventType: EventType;
|
16
16
|
timeStamp: number;
|
17
17
|
}, {
|
18
18
|
id: string;
|
19
19
|
zoneId: number;
|
20
20
|
zoneName: string;
|
21
|
-
schemaVersion: "v1" | "v2";
|
21
|
+
schemaVersion: "v1" | "v2" | "v2-alpha";
|
22
22
|
eventType: EventType;
|
23
23
|
timeStamp: number;
|
24
24
|
}>;
|
@@ -54,6 +54,14 @@ export interface BaseEventAuditPfeesPaidV2 {
|
|
54
54
|
eventType: "audit.pfees.paid";
|
55
55
|
timeStamp: number;
|
56
56
|
}
|
57
|
+
export interface BaseEventAuditPfeesPaidV2Alpha {
|
58
|
+
id: string;
|
59
|
+
zoneId: number;
|
60
|
+
zoneName: string;
|
61
|
+
schemaVersion: "v2-alpha";
|
62
|
+
eventType: "audit.pfees.paid";
|
63
|
+
timeStamp: number;
|
64
|
+
}
|
57
65
|
export interface BaseEventApplicationCreatedV1 {
|
58
66
|
id: string;
|
59
67
|
zoneId: number;
|
@@ -62,4 +70,20 @@ export interface BaseEventApplicationCreatedV1 {
|
|
62
70
|
eventType: "application.created";
|
63
71
|
timeStamp: number;
|
64
72
|
}
|
65
|
-
export
|
73
|
+
export interface BaseEventApplicationPriceQuoteV2Alpha {
|
74
|
+
id: string;
|
75
|
+
zoneId: number;
|
76
|
+
zoneName: string;
|
77
|
+
schemaVersion: "v2-alpha";
|
78
|
+
eventType: "application.price.quote";
|
79
|
+
timeStamp: number;
|
80
|
+
}
|
81
|
+
export interface BaseEventGctlMintedV2Alpha {
|
82
|
+
id: string;
|
83
|
+
zoneId: number;
|
84
|
+
zoneName: string;
|
85
|
+
schemaVersion: "v2-alpha";
|
86
|
+
eventType: "gctl.minted";
|
87
|
+
timeStamp: number;
|
88
|
+
}
|
89
|
+
export type BaseEvent = BaseEventAuditPushedV1 | BaseEventAuditSlashedV1 | BaseEventAuditPfeesPaidV1 | BaseEventAuditPfeesPaidV2 | BaseEventAuditPfeesPaidV2Alpha | BaseEventApplicationCreatedV1 | BaseEventApplicationPriceQuoteV2Alpha | BaseEventGctlMintedV2Alpha;
|
package/dist/base-event.js
CHANGED
@@ -12,7 +12,7 @@ exports.baseEventZ = zod_1.z.object({
|
|
12
12
|
message: "Invalid zoneId",
|
13
13
|
}),
|
14
14
|
zoneName: zod_1.z.enum(zoneNames),
|
15
|
-
schemaVersion: zod_1.z.enum(["v1", "v2"]),
|
15
|
+
schemaVersion: zod_1.z.enum(["v1", "v2", "v2-alpha"]),
|
16
16
|
eventType: zod_1.z.enum(Object.values(event_types_1.eventTypes)),
|
17
17
|
timeStamp: zod_1.z.number().int(),
|
18
18
|
});
|
package/dist/event-registry.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import { z } from "zod";
|
2
|
-
export declare function getEventSchema(eventType: string, version: "v1" | "v2"): z.ZodTypeAny;
|
2
|
+
export declare function getEventSchema(eventType: string, version: "v1" | "v2" | "v2-alpha"): z.ZodTypeAny;
|
package/dist/event-registry.js
CHANGED
@@ -9,6 +9,10 @@ const base_event_1 = require("./base-event");
|
|
9
9
|
const application_created_v1_1 = require("./schemas/application-created.v1");
|
10
10
|
const event_types_1 = require("./event-types");
|
11
11
|
const audit_pushed_v2_1 = require("./schemas/audit-pushed.v2");
|
12
|
+
const application_price_quote_v2_alpha_1 = require("./schemas/application-price-quote.v2-alpha");
|
13
|
+
const audit_pfees_paid_v2_alpha_1 = require("./schemas/audit-pfees-paid.v2-alpha");
|
14
|
+
const audit_pushed_v2_alpha_1 = require("./schemas/audit-pushed.v2-alpha");
|
15
|
+
const gctl_minted_v2_alpha_1 = require("./schemas/gctl-minted.v2-alpha");
|
12
16
|
const eventTypeRegistry = {
|
13
17
|
[`${event_types_1.eventTypes.auditPushed}:v1`]: base_event_1.baseEventZ.extend({
|
14
18
|
payload: audit_pushed_v1_1.auditPushedV1PayloadZ,
|
@@ -22,12 +26,24 @@ const eventTypeRegistry = {
|
|
22
26
|
[`${event_types_1.eventTypes.auditPfeesPaid}:v2`]: base_event_1.baseEventZ.extend({
|
23
27
|
payload: audit_pfees_paid_v2_1.auditPfeesPaidV2PayloadZ,
|
24
28
|
}),
|
29
|
+
[`${event_types_1.eventTypes.auditPfeesPaid}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
30
|
+
payload: audit_pfees_paid_v2_alpha_1.auditPfeesPaidV2AlphaPayloadZ,
|
31
|
+
}),
|
25
32
|
[`${event_types_1.eventTypes.applicationCreated}:v1`]: base_event_1.baseEventZ.extend({
|
26
33
|
payload: application_created_v1_1.applicationCreatedV1PayloadZ,
|
27
34
|
}),
|
28
35
|
[`${event_types_1.eventTypes.auditPushed}:v2`]: base_event_1.baseEventZ.extend({
|
29
36
|
payload: audit_pushed_v2_1.auditPushedV2PayloadZ,
|
30
37
|
}),
|
38
|
+
[`${event_types_1.eventTypes.auditPushed}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
39
|
+
payload: audit_pushed_v2_alpha_1.auditPushedV2AlphaPayloadZ,
|
40
|
+
}),
|
41
|
+
[`${event_types_1.eventTypes.applicationPriceQuote}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
42
|
+
payload: application_price_quote_v2_alpha_1.applicationPriceQuoteV2AlphaPayloadZ,
|
43
|
+
}),
|
44
|
+
[`${event_types_1.eventTypes.gctlMinted}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
45
|
+
payload: gctl_minted_v2_alpha_1.gctlMintedV2AlphaPayloadZ,
|
46
|
+
}),
|
31
47
|
// Add more event types/versions here
|
32
48
|
};
|
33
49
|
function getEventSchema(eventType, version) {
|
package/dist/event-types.d.ts
CHANGED
@@ -3,5 +3,7 @@ export declare const eventTypes: {
|
|
3
3
|
readonly auditSlashed: "audit.slashed";
|
4
4
|
readonly auditPfeesPaid: "audit.pfees.paid";
|
5
5
|
readonly applicationCreated: "application.created";
|
6
|
+
readonly applicationPriceQuote: "application.price.quote";
|
7
|
+
readonly gctlMinted: "gctl.minted";
|
6
8
|
};
|
7
9
|
export type EventType = (typeof eventTypes)[keyof typeof eventTypes];
|
package/dist/event-types.js
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const applicationPriceQuoteV2AlphaPayloadZ: z.ZodObject<{
|
3
|
+
applicationId: z.ZodString;
|
4
|
+
createdAt: z.ZodString;
|
5
|
+
prices: z.ZodObject<{
|
6
|
+
GCTL: z.ZodString;
|
7
|
+
GLW: z.ZodString;
|
8
|
+
USDC: z.ZodString;
|
9
|
+
USDG: z.ZodString;
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
11
|
+
GCTL: string;
|
12
|
+
GLW: string;
|
13
|
+
USDC: string;
|
14
|
+
USDG: string;
|
15
|
+
}, {
|
16
|
+
GCTL: string;
|
17
|
+
GLW: string;
|
18
|
+
USDC: string;
|
19
|
+
USDG: string;
|
20
|
+
}>;
|
21
|
+
signature: z.ZodString;
|
22
|
+
gcaAddress: z.ZodString;
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
24
|
+
applicationId: string;
|
25
|
+
gcaAddress: string;
|
26
|
+
createdAt: string;
|
27
|
+
prices: {
|
28
|
+
GCTL: string;
|
29
|
+
GLW: string;
|
30
|
+
USDC: string;
|
31
|
+
USDG: string;
|
32
|
+
};
|
33
|
+
signature: string;
|
34
|
+
}, {
|
35
|
+
applicationId: string;
|
36
|
+
gcaAddress: string;
|
37
|
+
createdAt: string;
|
38
|
+
prices: {
|
39
|
+
GCTL: string;
|
40
|
+
GLW: string;
|
41
|
+
USDC: string;
|
42
|
+
USDG: string;
|
43
|
+
};
|
44
|
+
signature: string;
|
45
|
+
}>;
|
46
|
+
export interface ApplicationPriceQuoteV2AlphaPayload extends z.infer<typeof applicationPriceQuoteV2AlphaPayloadZ> {
|
47
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.applicationPriceQuoteV2AlphaPayloadZ = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const patterns_1 = require("../patterns");
|
6
|
+
exports.applicationPriceQuoteV2AlphaPayloadZ = zod_1.z.object({
|
7
|
+
applicationId: zod_1.z.string().uuid("UUID string"),
|
8
|
+
createdAt: zod_1.z.string().datetime(),
|
9
|
+
prices: zod_1.z.object({
|
10
|
+
GCTL: zod_1.z.string().regex(patterns_1.uint256),
|
11
|
+
GLW: zod_1.z.string().regex(patterns_1.uint256),
|
12
|
+
USDC: zod_1.z.string().regex(patterns_1.uint256),
|
13
|
+
USDG: zod_1.z.string().regex(patterns_1.uint256),
|
14
|
+
}),
|
15
|
+
signature: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
16
|
+
gcaAddress: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
17
|
+
});
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export type PaymentCurrency = "GCTL" | "USDC" | "USDG" | "GLW";
|
3
|
+
export declare const auditPfeesPaidV2AlphaPayloadZ: z.ZodObject<{
|
4
|
+
applicationId: z.ZodString;
|
5
|
+
payer: z.ZodString;
|
6
|
+
amount_6Decimals: z.ZodString;
|
7
|
+
txHash: z.ZodString;
|
8
|
+
} & {
|
9
|
+
paymentCurrency: z.ZodEnum<["GCTL", "USDC", "USDG", "GLW"]>;
|
10
|
+
paymentEventType: z.ZodString;
|
11
|
+
isSponsored: z.ZodBoolean;
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
13
|
+
txHash: string;
|
14
|
+
applicationId: string;
|
15
|
+
payer: string;
|
16
|
+
amount_6Decimals: string;
|
17
|
+
paymentCurrency: "GCTL" | "GLW" | "USDC" | "USDG";
|
18
|
+
paymentEventType: string;
|
19
|
+
isSponsored: boolean;
|
20
|
+
}, {
|
21
|
+
txHash: string;
|
22
|
+
applicationId: string;
|
23
|
+
payer: string;
|
24
|
+
amount_6Decimals: string;
|
25
|
+
paymentCurrency: "GCTL" | "GLW" | "USDC" | "USDG";
|
26
|
+
paymentEventType: string;
|
27
|
+
isSponsored: boolean;
|
28
|
+
}>;
|
29
|
+
export interface AuditPfeesPaidV2AlphaPayload extends z.infer<typeof auditPfeesPaidV2AlphaPayloadZ> {
|
30
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.auditPfeesPaidV2AlphaPayloadZ = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const audit_pfees_paid_v1_1 = require("./audit-pfees-paid.v1");
|
6
|
+
exports.auditPfeesPaidV2AlphaPayloadZ = audit_pfees_paid_v1_1.auditPfeesPaidV1PayloadZ.extend({
|
7
|
+
paymentCurrency: zod_1.z.enum(["GCTL", "USDC", "USDG", "GLW"]),
|
8
|
+
paymentEventType: zod_1.z.string(),
|
9
|
+
isSponsored: zod_1.z.boolean(),
|
10
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const auditPushedV2AlphaPayloadZ: z.ZodObject<{
|
3
|
+
farmId: z.ZodString;
|
4
|
+
expectedProduction_12Decimals: z.ZodString;
|
5
|
+
txHash: z.ZodString;
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
7
|
+
farmId: string;
|
8
|
+
expectedProduction_12Decimals: string;
|
9
|
+
txHash: string;
|
10
|
+
}, {
|
11
|
+
farmId: string;
|
12
|
+
expectedProduction_12Decimals: string;
|
13
|
+
txHash: string;
|
14
|
+
}>;
|
15
|
+
export type AuditPushedV2AlphaPayload = z.infer<typeof auditPushedV2AlphaPayloadZ>;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.auditPushedV2AlphaPayloadZ = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const patterns_1 = require("../patterns");
|
6
|
+
exports.auditPushedV2AlphaPayloadZ = zod_1.z.object({
|
7
|
+
farmId: zod_1.z.string().uuid(),
|
8
|
+
expectedProduction_12Decimals: zod_1.z.string().regex(patterns_1.uint256),
|
9
|
+
txHash: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
10
|
+
});
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const gctlMintedV2AlphaPayloadZ: z.ZodObject<{
|
3
|
+
usdcAmount_6Decimals: z.ZodString;
|
4
|
+
gctlAmount_6Decimals: z.ZodString;
|
5
|
+
timestamp: z.ZodString;
|
6
|
+
minter: z.ZodString;
|
7
|
+
txHash: z.ZodString;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
txHash: string;
|
10
|
+
usdcAmount_6Decimals: string;
|
11
|
+
gctlAmount_6Decimals: string;
|
12
|
+
timestamp: string;
|
13
|
+
minter: string;
|
14
|
+
}, {
|
15
|
+
txHash: string;
|
16
|
+
usdcAmount_6Decimals: string;
|
17
|
+
gctlAmount_6Decimals: string;
|
18
|
+
timestamp: string;
|
19
|
+
minter: string;
|
20
|
+
}>;
|
21
|
+
export type GctlMintedV2AlphaPayload = z.infer<typeof gctlMintedV2AlphaPayloadZ>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.gctlMintedV2AlphaPayloadZ = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const patterns_1 = require("../patterns");
|
6
|
+
exports.gctlMintedV2AlphaPayloadZ = zod_1.z.object({
|
7
|
+
usdcAmount_6Decimals: zod_1.z
|
8
|
+
.string()
|
9
|
+
.regex(patterns_1.uint256, "uint256 (decimal) − 6 implied decimals"),
|
10
|
+
gctlAmount_6Decimals: zod_1.z
|
11
|
+
.string()
|
12
|
+
.regex(patterns_1.uint256, "uint256 (decimal) − 6 implied decimals"),
|
13
|
+
timestamp: zod_1.z.string().datetime(),
|
14
|
+
minter: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
15
|
+
txHash: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
16
|
+
});
|
package/dist/types.d.ts
CHANGED
@@ -3,15 +3,20 @@ import type { AuditPushedV1Payload } from "./schemas/audit-pushed.v1";
|
|
3
3
|
import type { AuditSlashedV1Payload } from "./schemas/audit-slashed.v1";
|
4
4
|
import type { AuditPfeesPaidV1Payload } from "./schemas/audit-pfees-paid.v1";
|
5
5
|
import type { AuditPfeesPaidV2Payload } from "./schemas/audit-pfees-paid.v2";
|
6
|
+
import type { AuditPfeesPaidV2AlphaPayload } from "./schemas/audit-pfees-paid.v2-alpha";
|
6
7
|
import type { ApplicationCreatedV1Payload } from "./schemas/application-created.v1";
|
8
|
+
import type { ApplicationPriceQuoteV2AlphaPayload } from "./schemas/application-price-quote.v2-alpha";
|
7
9
|
import type { AuditPushedV2Payload } from "./schemas/audit-pushed.v2";
|
10
|
+
import type { AuditPushedV2AlphaPayload } from "./schemas/audit-pushed.v2-alpha";
|
8
11
|
import { eventTypes, EventType } from "./event-types";
|
12
|
+
import type { GctlMintedV2AlphaPayload } from "./schemas/gctl-minted.v2-alpha";
|
9
13
|
export { EventType, eventTypes };
|
10
|
-
export type EventVersion = "v1" | "v2";
|
14
|
+
export type EventVersion = "v1" | "v2" | "v2-alpha";
|
11
15
|
export interface EventPayloadMap {
|
12
16
|
[eventTypes.auditPushed]: {
|
13
17
|
v1: AuditPushedV1Payload;
|
14
18
|
v2: AuditPushedV2Payload;
|
19
|
+
"v2-alpha": AuditPushedV2AlphaPayload;
|
15
20
|
};
|
16
21
|
[eventTypes.auditSlashed]: {
|
17
22
|
v1: AuditSlashedV1Payload;
|
@@ -19,10 +24,17 @@ export interface EventPayloadMap {
|
|
19
24
|
[eventTypes.auditPfeesPaid]: {
|
20
25
|
v1: AuditPfeesPaidV1Payload;
|
21
26
|
v2: AuditPfeesPaidV2Payload;
|
27
|
+
"v2-alpha": AuditPfeesPaidV2AlphaPayload;
|
22
28
|
};
|
23
29
|
[eventTypes.applicationCreated]: {
|
24
30
|
v1: ApplicationCreatedV1Payload;
|
25
31
|
};
|
32
|
+
[eventTypes.applicationPriceQuote]: {
|
33
|
+
"v2-alpha": ApplicationPriceQuoteV2AlphaPayload;
|
34
|
+
};
|
35
|
+
[eventTypes.gctlMinted]: {
|
36
|
+
"v2-alpha": GctlMintedV2AlphaPayload;
|
37
|
+
};
|
26
38
|
}
|
27
39
|
export type EventPayload<T extends EventType, V extends keyof EventPayloadMap[T]> = T extends keyof EventPayloadMap ? V extends keyof EventPayloadMap[T] ? EventPayloadMap[T][V] : never : never;
|
28
40
|
export interface GlowEvent<TPayload> extends Omit<BaseEvent, "payload"> {
|
package/dist/utils.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { EventVersion } from "./types";
|
1
2
|
/**
|
2
3
|
* Validates that the zoneName matches the zoneId using the zoneMap.
|
3
4
|
* Throws an error if the values are inconsistent.
|
@@ -7,7 +8,7 @@ export declare function validateZoneNameAndId(zoneId: number, zoneName: string):
|
|
7
8
|
* Validates the event payload against the schema for the given eventType and schemaVersion.
|
8
9
|
* Throws an error if the schema does not exist or the payload is invalid.
|
9
10
|
*/
|
10
|
-
export declare function validateEventPayload(eventType: string, schemaVersion:
|
11
|
+
export declare function validateEventPayload(eventType: string, schemaVersion: EventVersion, payload: any): void;
|
11
12
|
/**
|
12
13
|
* Processes a message object as the listener would, validating zone and schema.
|
13
14
|
* Throws if validation fails, returns the parsed event otherwise.
|