@glowlabs-org/events-sdk 1.0.15 → 1.0.18
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 +82 -13
- package/dist/base-event.d.ts +41 -1
- package/dist/base-event.js +1 -0
- package/dist/emitter.d.ts +2 -1
- package/dist/emitter.js +2 -1
- package/dist/event-registry.js +12 -0
- package/dist/event-types.d.ts +3 -0
- package/dist/event-types.js +3 -0
- package/dist/schemas/fraction-closed.v2-alpha.d.ts +27 -0
- package/dist/schemas/fraction-closed.v2-alpha.js +14 -0
- package/dist/schemas/fraction-created.v2-alpha.d.ts +30 -0
- package/dist/schemas/fraction-created.v2-alpha.js +15 -0
- package/dist/schemas/fraction-sold.v2-alpha.d.ts +33 -0
- package/dist/schemas/fraction-sold.v2-alpha.js +16 -0
- package/dist/types.d.ts +12 -0
- package/dist/zones.d.ts +6 -2
- package/dist/zones.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,11 @@ Currently supported event types and versions:
|
|
|
68
68
|
| `application.price.quote` | "v2-alpha" | `ApplicationPriceQuoteV2AlphaPayload` | Price quote for application |
|
|
69
69
|
| `gctl.minted` | "v2-alpha" | `GctlMintedV2AlphaPayload` | GCTL minted amount and metadata |
|
|
70
70
|
| `auditor.fees.paid` | "v2-alpha" | `AuditorFeesPaidV2AlphaPayload` | Auditor fee paid (by applicationId) |
|
|
71
|
+
| `fraction.created` | "v2-alpha" | `FractionCreatedV2AlphaPayload` | Fraction created with token and ownership details |
|
|
72
|
+
| `fraction.sold` | "v2-alpha" | `FractionSoldV2AlphaPayload` | Fraction sold between creator and buyer |
|
|
73
|
+
| `fraction.closed` | "v2-alpha" | `FractionClosedV2AlphaPayload` | Fraction closed/cancelled |
|
|
74
|
+
|
|
75
|
+
> **Environment:** All events include an `environment` field that defaults to `"production"`. You can set it to `"staging"` when creating an emitter.
|
|
71
76
|
|
|
72
77
|
---
|
|
73
78
|
|
|
@@ -229,26 +234,89 @@ export interface AuditorFeesPaidV2AlphaPayload {
|
|
|
229
234
|
}
|
|
230
235
|
```
|
|
231
236
|
|
|
232
|
-
|
|
237
|
+
### `fraction.created` v2-alpha
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
export interface FractionCreatedV2AlphaPayload {
|
|
241
|
+
fractionId: string;
|
|
242
|
+
transactionHash: string; // bytes32 hex string (0x...)
|
|
243
|
+
blockNumber: string; // uint256 (decimal)
|
|
244
|
+
logIndex: number;
|
|
245
|
+
token: string; // Ethereum address (0x...)
|
|
246
|
+
owner: string; // Ethereum address (0x...)
|
|
247
|
+
step: string; // uint256 (decimal)
|
|
248
|
+
totalSteps: string; // uint256 (decimal)
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### `fraction.sold` v2-alpha
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
export interface FractionSoldV2AlphaPayload {
|
|
256
|
+
fractionId: string;
|
|
257
|
+
transactionHash: string; // bytes32 hex string (0x...)
|
|
258
|
+
blockNumber: string; // uint256 (decimal)
|
|
259
|
+
logIndex: number;
|
|
260
|
+
creator: string; // Ethereum address (0x...)
|
|
261
|
+
buyer: string; // Ethereum address (0x...)
|
|
262
|
+
step: string; // uint256 (decimal)
|
|
263
|
+
amount: string; // uint256 (decimal)
|
|
264
|
+
timestamp: number;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### `fraction.closed` v2-alpha
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
export interface FractionClosedV2AlphaPayload {
|
|
272
|
+
fractionId: string;
|
|
273
|
+
transactionHash: string; // bytes32 hex string (0x...)
|
|
274
|
+
blockNumber: string; // uint256 (decimal)
|
|
275
|
+
logIndex: number;
|
|
276
|
+
token: string; // Ethereum address (0x...)
|
|
277
|
+
owner: string; // Ethereum address (0x...)
|
|
278
|
+
timestamp: number;
|
|
279
|
+
}
|
|
280
|
+
```
|
|
233
281
|
|
|
234
282
|
**Validation:**
|
|
235
283
|
|
|
236
|
-
- `
|
|
237
|
-
- `
|
|
238
|
-
- `
|
|
284
|
+
- `fractionId` is a string identifier.
|
|
285
|
+
- `transactionHash` must be a 32-byte hex string.
|
|
286
|
+
- `blockNumber`, `step`, `totalSteps`, and `amount` must be decimal strings representing unsigned big integers.
|
|
287
|
+
- `token`, `owner`, `creator`, and `buyer` must be valid Ethereum addresses.
|
|
239
288
|
|
|
240
|
-
|
|
289
|
+
---
|
|
241
290
|
|
|
242
291
|
```ts
|
|
243
|
-
export interface
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
292
|
+
export interface FractionSoldV2AlphaPayload {
|
|
293
|
+
fractionId: string;
|
|
294
|
+
transactionHash: string; // bytes32 hex string (0x...)
|
|
295
|
+
blockNumber: string; // uint256 (decimal)
|
|
296
|
+
logIndex: number;
|
|
297
|
+
creator: string; // Ethereum address (0x...)
|
|
298
|
+
buyer: string; // Ethereum address (0x...)
|
|
299
|
+
step: string; // uint256 (decimal)
|
|
300
|
+
amount: string; // uint256 (decimal)
|
|
301
|
+
timestamp: number;
|
|
250
302
|
}
|
|
251
|
-
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### `fraction.closed` v2-alpha
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
export interface FractionClosedV2AlphaPayload {
|
|
309
|
+
fractionId: string;
|
|
310
|
+
transactionHash: string; // bytes32 hex string (0x...)
|
|
311
|
+
blockNumber: string; // uint256 (decimal)
|
|
312
|
+
logIndex: number;
|
|
313
|
+
token: string; // Ethereum address (0x...)
|
|
314
|
+
owner: string; // Ethereum address (0x...)
|
|
315
|
+
timestamp: number;
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
252
320
|
|
|
253
321
|
### `application.created` v2-alpha
|
|
254
322
|
|
|
@@ -355,6 +423,7 @@ const emitter = createGlowEventEmitter({
|
|
|
355
423
|
password: "your-password-here",
|
|
356
424
|
zoneId: getZoneId("CleanGridProject"), // must be a specific zone
|
|
357
425
|
host: "my.rabbitmq.host:5672", // Optional: override the default host
|
|
426
|
+
environment: "staging", // Optional: defaults to "production"
|
|
358
427
|
});
|
|
359
428
|
|
|
360
429
|
await emitter.emit({
|
package/dist/base-event.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const baseEventZ: z.ZodObject<{
|
|
|
7
7
|
schemaVersion: z.ZodEnum<["v1", "v2", "v2-alpha"]>;
|
|
8
8
|
eventType: z.ZodEnum<[EventType, ...EventType[]]>;
|
|
9
9
|
timeStamp: z.ZodNumber;
|
|
10
|
+
environment: z.ZodDefault<z.ZodEnum<["staging", "production"]>>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
id: string;
|
|
12
13
|
zoneId: number;
|
|
@@ -14,6 +15,7 @@ export declare const baseEventZ: z.ZodObject<{
|
|
|
14
15
|
schemaVersion: "v1" | "v2" | "v2-alpha";
|
|
15
16
|
eventType: EventType;
|
|
16
17
|
timeStamp: number;
|
|
18
|
+
environment: "staging" | "production";
|
|
17
19
|
}, {
|
|
18
20
|
id: string;
|
|
19
21
|
zoneId: number;
|
|
@@ -21,6 +23,7 @@ export declare const baseEventZ: z.ZodObject<{
|
|
|
21
23
|
schemaVersion: "v1" | "v2" | "v2-alpha";
|
|
22
24
|
eventType: EventType;
|
|
23
25
|
timeStamp: number;
|
|
26
|
+
environment?: "staging" | "production" | undefined;
|
|
24
27
|
}>;
|
|
25
28
|
export interface BaseEventAuditPushedV1 {
|
|
26
29
|
id: string;
|
|
@@ -29,6 +32,7 @@ export interface BaseEventAuditPushedV1 {
|
|
|
29
32
|
schemaVersion: "v1";
|
|
30
33
|
eventType: "audit.pushed";
|
|
31
34
|
timeStamp: number;
|
|
35
|
+
environment: "staging" | "production";
|
|
32
36
|
}
|
|
33
37
|
export interface BaseEventAuditSlashedV1 {
|
|
34
38
|
id: string;
|
|
@@ -37,6 +41,7 @@ export interface BaseEventAuditSlashedV1 {
|
|
|
37
41
|
schemaVersion: "v1";
|
|
38
42
|
eventType: "audit.slashed";
|
|
39
43
|
timeStamp: number;
|
|
44
|
+
environment: "staging" | "production";
|
|
40
45
|
}
|
|
41
46
|
export interface BaseEventAuditPfeesPaidV1 {
|
|
42
47
|
id: string;
|
|
@@ -45,6 +50,7 @@ export interface BaseEventAuditPfeesPaidV1 {
|
|
|
45
50
|
schemaVersion: "v1";
|
|
46
51
|
eventType: "audit.pfees.paid";
|
|
47
52
|
timeStamp: number;
|
|
53
|
+
environment: "staging" | "production";
|
|
48
54
|
}
|
|
49
55
|
export interface BaseEventAuditPfeesPaidV2 {
|
|
50
56
|
id: string;
|
|
@@ -53,6 +59,7 @@ export interface BaseEventAuditPfeesPaidV2 {
|
|
|
53
59
|
schemaVersion: "v2";
|
|
54
60
|
eventType: "audit.pfees.paid";
|
|
55
61
|
timeStamp: number;
|
|
62
|
+
environment: "staging" | "production";
|
|
56
63
|
}
|
|
57
64
|
export interface BaseEventAuditPfeesPaidV2Alpha {
|
|
58
65
|
id: string;
|
|
@@ -61,6 +68,7 @@ export interface BaseEventAuditPfeesPaidV2Alpha {
|
|
|
61
68
|
schemaVersion: "v2-alpha";
|
|
62
69
|
eventType: "audit.pfees.paid";
|
|
63
70
|
timeStamp: number;
|
|
71
|
+
environment: "staging" | "production";
|
|
64
72
|
}
|
|
65
73
|
export interface BaseEventApplicationCreatedV1 {
|
|
66
74
|
id: string;
|
|
@@ -69,6 +77,7 @@ export interface BaseEventApplicationCreatedV1 {
|
|
|
69
77
|
schemaVersion: "v1";
|
|
70
78
|
eventType: "application.created";
|
|
71
79
|
timeStamp: number;
|
|
80
|
+
environment: "staging" | "production";
|
|
72
81
|
}
|
|
73
82
|
export interface BaseEventApplicationCreatedV2Alpha {
|
|
74
83
|
id: string;
|
|
@@ -77,6 +86,7 @@ export interface BaseEventApplicationCreatedV2Alpha {
|
|
|
77
86
|
schemaVersion: "v2-alpha";
|
|
78
87
|
eventType: "application.created";
|
|
79
88
|
timeStamp: number;
|
|
89
|
+
environment: "staging" | "production";
|
|
80
90
|
}
|
|
81
91
|
export interface BaseEventApplicationPriceQuoteV2Alpha {
|
|
82
92
|
id: string;
|
|
@@ -85,6 +95,7 @@ export interface BaseEventApplicationPriceQuoteV2Alpha {
|
|
|
85
95
|
schemaVersion: "v2-alpha";
|
|
86
96
|
eventType: "application.price.quote";
|
|
87
97
|
timeStamp: number;
|
|
98
|
+
environment: "staging" | "production";
|
|
88
99
|
}
|
|
89
100
|
export interface BaseEventGctlMintedV2Alpha {
|
|
90
101
|
id: string;
|
|
@@ -93,6 +104,7 @@ export interface BaseEventGctlMintedV2Alpha {
|
|
|
93
104
|
schemaVersion: "v2-alpha";
|
|
94
105
|
eventType: "gctl.minted";
|
|
95
106
|
timeStamp: number;
|
|
107
|
+
environment: "staging" | "production";
|
|
96
108
|
}
|
|
97
109
|
export interface BaseEventAuditorFeesPaidV2Alpha {
|
|
98
110
|
id: string;
|
|
@@ -101,5 +113,33 @@ export interface BaseEventAuditorFeesPaidV2Alpha {
|
|
|
101
113
|
schemaVersion: "v2-alpha";
|
|
102
114
|
eventType: "auditor.fees.paid";
|
|
103
115
|
timeStamp: number;
|
|
116
|
+
environment: "staging" | "production";
|
|
104
117
|
}
|
|
105
|
-
export
|
|
118
|
+
export interface BaseEventFractionCreatedV2Alpha {
|
|
119
|
+
id: string;
|
|
120
|
+
zoneId: number;
|
|
121
|
+
zoneName: string;
|
|
122
|
+
schemaVersion: "v2-alpha";
|
|
123
|
+
eventType: "fraction.created";
|
|
124
|
+
timeStamp: number;
|
|
125
|
+
environment: "staging" | "production";
|
|
126
|
+
}
|
|
127
|
+
export interface BaseEventFractionSoldV2Alpha {
|
|
128
|
+
id: string;
|
|
129
|
+
zoneId: number;
|
|
130
|
+
zoneName: string;
|
|
131
|
+
schemaVersion: "v2-alpha";
|
|
132
|
+
eventType: "fraction.sold";
|
|
133
|
+
timeStamp: number;
|
|
134
|
+
environment: "staging" | "production";
|
|
135
|
+
}
|
|
136
|
+
export interface BaseEventFractionClosedV2Alpha {
|
|
137
|
+
id: string;
|
|
138
|
+
zoneId: number;
|
|
139
|
+
zoneName: string;
|
|
140
|
+
schemaVersion: "v2-alpha";
|
|
141
|
+
eventType: "fraction.closed";
|
|
142
|
+
timeStamp: number;
|
|
143
|
+
environment: "staging" | "production";
|
|
144
|
+
}
|
|
145
|
+
export type BaseEvent = BaseEventAuditPushedV1 | BaseEventAuditSlashedV1 | BaseEventAuditPfeesPaidV1 | BaseEventAuditPfeesPaidV2 | BaseEventAuditPfeesPaidV2Alpha | BaseEventApplicationCreatedV1 | BaseEventApplicationCreatedV2Alpha | BaseEventApplicationPriceQuoteV2Alpha | BaseEventGctlMintedV2Alpha | BaseEventAuditorFeesPaidV2Alpha | BaseEventFractionCreatedV2Alpha | BaseEventFractionSoldV2Alpha | BaseEventFractionClosedV2Alpha;
|
package/dist/base-event.js
CHANGED
|
@@ -15,4 +15,5 @@ exports.baseEventZ = zod_1.z.object({
|
|
|
15
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
|
+
environment: zod_1.z.enum(["staging", "production"]).default("production"),
|
|
18
19
|
});
|
package/dist/emitter.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ interface CreateGlowEventEmitterOptions {
|
|
|
5
5
|
zoneId: number;
|
|
6
6
|
exchangePrefix?: string;
|
|
7
7
|
host?: string;
|
|
8
|
+
environment?: "staging" | "production";
|
|
8
9
|
}
|
|
9
10
|
interface EmitEventArgs<T extends EventType, V extends keyof EventPayloadMap[T]> {
|
|
10
11
|
eventType: T;
|
|
11
12
|
schemaVersion: V;
|
|
12
13
|
payload: EventPayload<T, V>;
|
|
13
14
|
}
|
|
14
|
-
export declare function createGlowEventEmitter({ username, password, zoneId, exchangePrefix, host, }: CreateGlowEventEmitterOptions): {
|
|
15
|
+
export declare function createGlowEventEmitter({ username, password, zoneId, exchangePrefix, host, environment, }: CreateGlowEventEmitterOptions): {
|
|
15
16
|
emit: <T extends EventType, V extends keyof import("./types").EventPayloadMap[T]>(args: EmitEventArgs<T, V>) => Promise<void>;
|
|
16
17
|
disconnect: () => Promise<void>;
|
|
17
18
|
};
|
package/dist/emitter.js
CHANGED
|
@@ -8,7 +8,7 @@ const amqplib_1 = __importDefault(require("amqplib"));
|
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
9
|
const uuid_1 = require("uuid");
|
|
10
10
|
const zones_1 = require("./zones");
|
|
11
|
-
function createGlowEventEmitter({ username, password, zoneId, exchangePrefix = "glow.zone-", host = "turntable.proxy.rlwy.net:50784", }) {
|
|
11
|
+
function createGlowEventEmitter({ username, password, zoneId, exchangePrefix = "glow.zone-", host = "turntable.proxy.rlwy.net:50784", environment = "production", }) {
|
|
12
12
|
let amqpConnection = null;
|
|
13
13
|
let amqpChannel = null;
|
|
14
14
|
// Exchanges for global and specific zone
|
|
@@ -50,6 +50,7 @@ function createGlowEventEmitter({ username, password, zoneId, exchangePrefix = "
|
|
|
50
50
|
zoneId,
|
|
51
51
|
zoneName,
|
|
52
52
|
timeStamp: Date.now(),
|
|
53
|
+
environment,
|
|
53
54
|
payload,
|
|
54
55
|
};
|
|
55
56
|
(0, utils_1.validateZoneNameAndId)(event.zoneId, event.zoneName);
|
package/dist/event-registry.js
CHANGED
|
@@ -15,6 +15,9 @@ 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
17
|
const application_created_v2_alpha_1 = require("./schemas/application-created.v2-alpha");
|
|
18
|
+
const fraction_created_v2_alpha_1 = require("./schemas/fraction-created.v2-alpha");
|
|
19
|
+
const fraction_sold_v2_alpha_1 = require("./schemas/fraction-sold.v2-alpha");
|
|
20
|
+
const fraction_closed_v2_alpha_1 = require("./schemas/fraction-closed.v2-alpha");
|
|
18
21
|
const eventTypeRegistry = {
|
|
19
22
|
[`${event_types_1.eventTypes.auditPushed}:v1`]: base_event_1.baseEventZ.extend({
|
|
20
23
|
payload: audit_pushed_v1_1.auditPushedV1PayloadZ,
|
|
@@ -52,6 +55,15 @@ const eventTypeRegistry = {
|
|
|
52
55
|
[`${event_types_1.eventTypes.auditorFeesPaid}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
|
53
56
|
payload: auditor_fees_paid_v2_alpha_1.auditorFeesPaidV2AlphaPayloadZ,
|
|
54
57
|
}),
|
|
58
|
+
[`${event_types_1.eventTypes.fractionCreated}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
|
59
|
+
payload: fraction_created_v2_alpha_1.fractionCreatedV2AlphaPayloadZ,
|
|
60
|
+
}),
|
|
61
|
+
[`${event_types_1.eventTypes.fractionSold}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
|
62
|
+
payload: fraction_sold_v2_alpha_1.fractionSoldV2AlphaPayloadZ,
|
|
63
|
+
}),
|
|
64
|
+
[`${event_types_1.eventTypes.fractionClosed}:v2-alpha`]: base_event_1.baseEventZ.extend({
|
|
65
|
+
payload: fraction_closed_v2_alpha_1.fractionClosedV2AlphaPayloadZ,
|
|
66
|
+
}),
|
|
55
67
|
// Add more event types/versions here
|
|
56
68
|
};
|
|
57
69
|
function getEventSchema(eventType, version) {
|
package/dist/event-types.d.ts
CHANGED
|
@@ -6,5 +6,8 @@ export declare const eventTypes: {
|
|
|
6
6
|
readonly applicationPriceQuote: "application.price.quote";
|
|
7
7
|
readonly gctlMinted: "gctl.minted";
|
|
8
8
|
readonly auditorFeesPaid: "auditor.fees.paid";
|
|
9
|
+
readonly fractionCreated: "fraction.created";
|
|
10
|
+
readonly fractionSold: "fraction.sold";
|
|
11
|
+
readonly fractionClosed: "fraction.closed";
|
|
9
12
|
};
|
|
10
13
|
export type EventType = (typeof eventTypes)[keyof typeof eventTypes];
|
package/dist/event-types.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const fractionClosedV2AlphaPayloadZ: z.ZodObject<{
|
|
3
|
+
fractionId: z.ZodString;
|
|
4
|
+
transactionHash: z.ZodString;
|
|
5
|
+
blockNumber: z.ZodString;
|
|
6
|
+
logIndex: z.ZodNumber;
|
|
7
|
+
token: z.ZodString;
|
|
8
|
+
owner: z.ZodString;
|
|
9
|
+
timestamp: z.ZodNumber;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
timestamp: number;
|
|
12
|
+
fractionId: string;
|
|
13
|
+
transactionHash: string;
|
|
14
|
+
blockNumber: string;
|
|
15
|
+
logIndex: number;
|
|
16
|
+
token: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
}, {
|
|
19
|
+
timestamp: number;
|
|
20
|
+
fractionId: string;
|
|
21
|
+
transactionHash: string;
|
|
22
|
+
blockNumber: string;
|
|
23
|
+
logIndex: number;
|
|
24
|
+
token: string;
|
|
25
|
+
owner: string;
|
|
26
|
+
}>;
|
|
27
|
+
export type FractionClosedV2AlphaPayload = z.infer<typeof fractionClosedV2AlphaPayloadZ>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fractionClosedV2AlphaPayloadZ = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const patterns_1 = require("../patterns");
|
|
6
|
+
exports.fractionClosedV2AlphaPayloadZ = zod_1.z.object({
|
|
7
|
+
fractionId: zod_1.z.string(),
|
|
8
|
+
transactionHash: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
|
9
|
+
blockNumber: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
10
|
+
logIndex: zod_1.z.number().int(),
|
|
11
|
+
token: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
12
|
+
owner: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
13
|
+
timestamp: zod_1.z.number().int(),
|
|
14
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const fractionCreatedV2AlphaPayloadZ: z.ZodObject<{
|
|
3
|
+
fractionId: z.ZodString;
|
|
4
|
+
transactionHash: z.ZodString;
|
|
5
|
+
blockNumber: z.ZodString;
|
|
6
|
+
logIndex: z.ZodNumber;
|
|
7
|
+
token: z.ZodString;
|
|
8
|
+
owner: z.ZodString;
|
|
9
|
+
step: z.ZodString;
|
|
10
|
+
totalSteps: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
fractionId: string;
|
|
13
|
+
transactionHash: string;
|
|
14
|
+
blockNumber: string;
|
|
15
|
+
logIndex: number;
|
|
16
|
+
token: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
step: string;
|
|
19
|
+
totalSteps: string;
|
|
20
|
+
}, {
|
|
21
|
+
fractionId: string;
|
|
22
|
+
transactionHash: string;
|
|
23
|
+
blockNumber: string;
|
|
24
|
+
logIndex: number;
|
|
25
|
+
token: string;
|
|
26
|
+
owner: string;
|
|
27
|
+
step: string;
|
|
28
|
+
totalSteps: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type FractionCreatedV2AlphaPayload = z.infer<typeof fractionCreatedV2AlphaPayloadZ>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fractionCreatedV2AlphaPayloadZ = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const patterns_1 = require("../patterns");
|
|
6
|
+
exports.fractionCreatedV2AlphaPayloadZ = zod_1.z.object({
|
|
7
|
+
fractionId: zod_1.z.string(),
|
|
8
|
+
transactionHash: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
|
9
|
+
blockNumber: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
10
|
+
logIndex: zod_1.z.number().int(),
|
|
11
|
+
token: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
12
|
+
owner: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
13
|
+
step: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
14
|
+
totalSteps: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
15
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const fractionSoldV2AlphaPayloadZ: z.ZodObject<{
|
|
3
|
+
fractionId: z.ZodString;
|
|
4
|
+
transactionHash: z.ZodString;
|
|
5
|
+
blockNumber: z.ZodString;
|
|
6
|
+
logIndex: z.ZodNumber;
|
|
7
|
+
creator: z.ZodString;
|
|
8
|
+
buyer: z.ZodString;
|
|
9
|
+
step: z.ZodString;
|
|
10
|
+
amount: z.ZodString;
|
|
11
|
+
timestamp: z.ZodNumber;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
timestamp: number;
|
|
14
|
+
fractionId: string;
|
|
15
|
+
transactionHash: string;
|
|
16
|
+
blockNumber: string;
|
|
17
|
+
logIndex: number;
|
|
18
|
+
step: string;
|
|
19
|
+
creator: string;
|
|
20
|
+
buyer: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
}, {
|
|
23
|
+
timestamp: number;
|
|
24
|
+
fractionId: string;
|
|
25
|
+
transactionHash: string;
|
|
26
|
+
blockNumber: string;
|
|
27
|
+
logIndex: number;
|
|
28
|
+
step: string;
|
|
29
|
+
creator: string;
|
|
30
|
+
buyer: string;
|
|
31
|
+
amount: string;
|
|
32
|
+
}>;
|
|
33
|
+
export type FractionSoldV2AlphaPayload = z.infer<typeof fractionSoldV2AlphaPayloadZ>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fractionSoldV2AlphaPayloadZ = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const patterns_1 = require("../patterns");
|
|
6
|
+
exports.fractionSoldV2AlphaPayloadZ = zod_1.z.object({
|
|
7
|
+
fractionId: zod_1.z.string(),
|
|
8
|
+
transactionHash: zod_1.z.string().regex(patterns_1.hexBytes32, "bytes32 hex string"),
|
|
9
|
+
blockNumber: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
10
|
+
logIndex: zod_1.z.number().int(),
|
|
11
|
+
creator: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
12
|
+
buyer: zod_1.z.string().regex(patterns_1.ethAddress, "Ethereum address"),
|
|
13
|
+
step: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
14
|
+
amount: zod_1.z.string().regex(patterns_1.uint256, "uint256 (decimal)"),
|
|
15
|
+
timestamp: zod_1.z.number().int(),
|
|
16
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ import type { AuditPushedV2AlphaPayload } from "./schemas/audit-pushed.v2-alpha"
|
|
|
12
12
|
import { eventTypes, EventType } from "./event-types";
|
|
13
13
|
import type { AuditorFeesPaidV2AlphaPayload } from "./schemas/auditor-fees-paid.v2-alpha";
|
|
14
14
|
import type { GctlMintedV2AlphaPayload } from "./schemas/gctl-minted.v2-alpha";
|
|
15
|
+
import type { FractionCreatedV2AlphaPayload } from "./schemas/fraction-created.v2-alpha";
|
|
16
|
+
import type { FractionSoldV2AlphaPayload } from "./schemas/fraction-sold.v2-alpha";
|
|
17
|
+
import type { FractionClosedV2AlphaPayload } from "./schemas/fraction-closed.v2-alpha";
|
|
15
18
|
export { EventType, eventTypes };
|
|
16
19
|
export type EventVersion = "v1" | "v2" | "v2-alpha";
|
|
17
20
|
export interface EventPayloadMap {
|
|
@@ -41,6 +44,15 @@ export interface EventPayloadMap {
|
|
|
41
44
|
[eventTypes.auditorFeesPaid]: {
|
|
42
45
|
"v2-alpha": AuditorFeesPaidV2AlphaPayload;
|
|
43
46
|
};
|
|
47
|
+
[eventTypes.fractionCreated]: {
|
|
48
|
+
"v2-alpha": FractionCreatedV2AlphaPayload;
|
|
49
|
+
};
|
|
50
|
+
[eventTypes.fractionSold]: {
|
|
51
|
+
"v2-alpha": FractionSoldV2AlphaPayload;
|
|
52
|
+
};
|
|
53
|
+
[eventTypes.fractionClosed]: {
|
|
54
|
+
"v2-alpha": FractionClosedV2AlphaPayload;
|
|
55
|
+
};
|
|
44
56
|
}
|
|
45
57
|
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;
|
|
46
58
|
export interface GlowEvent<TPayload> extends Omit<BaseEvent, "payload"> {
|
package/dist/zones.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
export declare const zoneMap: {
|
|
2
2
|
readonly 0: "All Zones";
|
|
3
3
|
readonly 1: "Clean Grid Project";
|
|
4
|
-
readonly 2: "
|
|
4
|
+
readonly 2: "Utah";
|
|
5
|
+
readonly 3: "Missouri";
|
|
6
|
+
readonly 4: "Colorado";
|
|
5
7
|
};
|
|
6
8
|
export type ZoneId = keyof typeof zoneMap;
|
|
7
9
|
export type ZoneName = (typeof zoneMap)[ZoneId];
|
|
8
10
|
export declare const zoneKeyToId: {
|
|
9
11
|
readonly AllZones: 0;
|
|
10
12
|
readonly CleanGridProject: 1;
|
|
11
|
-
readonly
|
|
13
|
+
readonly Utah: 2;
|
|
14
|
+
readonly Missouri: 3;
|
|
15
|
+
readonly Colorado: 4;
|
|
12
16
|
};
|
|
13
17
|
export type ZoneKey = keyof typeof zoneKeyToId;
|
|
14
18
|
export declare function getZoneId(name: ZoneKey): number;
|
package/dist/zones.js
CHANGED
|
@@ -5,13 +5,17 @@ exports.getZoneId = getZoneId;
|
|
|
5
5
|
exports.zoneMap = {
|
|
6
6
|
0: "All Zones",
|
|
7
7
|
1: "Clean Grid Project",
|
|
8
|
-
2: "
|
|
8
|
+
2: "Utah",
|
|
9
|
+
3: "Missouri",
|
|
10
|
+
4: "Colorado",
|
|
9
11
|
};
|
|
10
12
|
// Stable keys for zone lookup (do not change these keys, only the display names in zoneMap)
|
|
11
13
|
exports.zoneKeyToId = {
|
|
12
14
|
AllZones: 0,
|
|
13
15
|
CleanGridProject: 1,
|
|
14
|
-
|
|
16
|
+
Utah: 2,
|
|
17
|
+
Missouri: 3,
|
|
18
|
+
Colorado: 4,
|
|
15
19
|
};
|
|
16
20
|
function getZoneId(name) {
|
|
17
21
|
return exports.zoneKeyToId[name];
|