@explorins/pers-shared 2.1.115 → 2.1.117

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.
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from './shared-lib/enum';
6
6
  export type * from './shared-lib/interfaces';
7
+ export { isServerMessage, isEventMessage, isConnectedMessage, isSubscribedMessage, isUnsubscribedMessage, isErrorMessage, isPingMessage } from './shared-lib/interfaces/ws-relay.types';
7
8
  export type * from './shared-lib/dto';
8
9
  export * from './shared-lib/types';
9
10
  export * from '@explorins/web3-types';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,mBAAmB,yBAAyB,CAAC;AAG7C,mBAAmB,kBAAkB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAEtC,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,mBAAmB,yBAAyB,CAAC;AAG7C,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACd,MAAM,wCAAwC,CAAC;AAGhD,mBAAmB,kBAAkB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAEtC,mBAAmB,qBAAqB,CAAC"}
@@ -18,8 +18,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.isPingMessage = exports.isErrorMessage = exports.isUnsubscribedMessage = exports.isSubscribedMessage = exports.isConnectedMessage = exports.isEventMessage = exports.isServerMessage = void 0;
21
22
  // Export enums - these are safe for browser use (barrel export)
22
23
  __exportStar(require("./shared-lib/enum"), exports);
24
+ // Export WS Relay type guards (runtime functions)
25
+ var ws_relay_types_1 = require("./shared-lib/interfaces/ws-relay.types");
26
+ Object.defineProperty(exports, "isServerMessage", { enumerable: true, get: function () { return ws_relay_types_1.isServerMessage; } });
27
+ Object.defineProperty(exports, "isEventMessage", { enumerable: true, get: function () { return ws_relay_types_1.isEventMessage; } });
28
+ Object.defineProperty(exports, "isConnectedMessage", { enumerable: true, get: function () { return ws_relay_types_1.isConnectedMessage; } });
29
+ Object.defineProperty(exports, "isSubscribedMessage", { enumerable: true, get: function () { return ws_relay_types_1.isSubscribedMessage; } });
30
+ Object.defineProperty(exports, "isUnsubscribedMessage", { enumerable: true, get: function () { return ws_relay_types_1.isUnsubscribedMessage; } });
31
+ Object.defineProperty(exports, "isErrorMessage", { enumerable: true, get: function () { return ws_relay_types_1.isErrorMessage; } });
32
+ Object.defineProperty(exports, "isPingMessage", { enumerable: true, get: function () { return ws_relay_types_1.isPingMessage; } });
23
33
  // Export types and constants (runtime exports) - browser-safe only
24
34
  __exportStar(require("./shared-lib/types"), exports);
25
35
  // Re-export web3 types for convenience
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,gEAAgE;AAChE,oDAAkC;AAQlC,mEAAmE;AACnE,qDAAmC;AAEnC,uCAAuC;AACvC,wDAAsC;AAItC,0FAA0F"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,gEAAgE;AAChE,oDAAkC;AAKlC,kDAAkD;AAClD,yEAQgD;AAP9C,iHAAA,eAAe,OAAA;AACf,gHAAA,cAAc,OAAA;AACd,oHAAA,kBAAkB,OAAA;AAClB,qHAAA,mBAAmB,OAAA;AACnB,uHAAA,qBAAqB,OAAA;AACrB,gHAAA,cAAc,OAAA;AACd,+GAAA,aAAa,OAAA;AAMf,mEAAmE;AACnE,qDAAmC;AAEnC,uCAAuC;AACvC,wDAAsC;AAItC,0FAA0F"}
@@ -19,4 +19,5 @@ export * from './counterfactual-wallet-response.interface';
19
19
  export * from './campaign';
20
20
  export * from './ai-prompt-config.interface';
21
21
  export * from './balance-filter-options.interface';
22
+ export * from './ws-relay.types';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,kBAAkB,CAAC"}
@@ -36,4 +36,5 @@ __exportStar(require("./counterfactual-wallet-response.interface"), exports);
36
36
  __exportStar(require("./campaign"), exports);
37
37
  __exportStar(require("./ai-prompt-config.interface"), exports);
38
38
  __exportStar(require("./balance-filter-options.interface"), exports);
39
+ __exportStar(require("./ws-relay.types"), exports);
39
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAkD;AAClD,mEAAiD;AACjD,uEAAqD;AACrD,iEAA+C;AAC/C,iEAA+C;AAC/C,0DAAwC;AACxC,+DAA6C;AAC7C,2EAAyD;AACzD,iEAA+C;AAC/C,qDAAmC;AACnC,gEAA8C;AAC9C,kEAAgD;AAChD,sEAAoD;AACpD,8DAA4C;AAC5C,kEAAgD;AAChD,4EAA0D;AAC1D,mEAAiD;AAEjD,0DAAwC;AAExC,6EAA2D;AAE3D,6CAA2B;AAE3B,+DAA6C;AAC7C,qEAAmD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAkD;AAClD,mEAAiD;AACjD,uEAAqD;AACrD,iEAA+C;AAC/C,iEAA+C;AAC/C,0DAAwC;AACxC,+DAA6C;AAC7C,2EAAyD;AACzD,iEAA+C;AAC/C,qDAAmC;AACnC,gEAA8C;AAC9C,kEAAgD;AAChD,sEAAoD;AACpD,8DAA4C;AAC5C,kEAAgD;AAChD,4EAA0D;AAC1D,mEAAiD;AAEjD,0DAAwC;AAExC,6EAA2D;AAE3D,6CAA2B;AAE3B,+DAA6C;AAC7C,qEAAmD;AAEnD,mDAAiC"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * PERS WS-Relay Shared Types
3
+ *
4
+ * Type-safe WebSocket communication types for the PERS event relay system.
5
+ *
6
+ * @version 1.2.0
7
+ */
8
+ /**
9
+ * Wallet information for subscription
10
+ */
11
+ export interface WalletInfo {
12
+ /** Ethereum address (0x...) */
13
+ address: string;
14
+ /** Chain ID (e.g., 39123 for PERS testnet) */
15
+ chainId: number;
16
+ }
17
+ /**
18
+ * Base client message
19
+ */
20
+ export interface WSClientMessageBase {
21
+ type: 'subscribe' | 'unsubscribe' | 'pong';
22
+ }
23
+ /**
24
+ * Subscribe to wallet addresses (filtered events) or chains (all events)
25
+ *
26
+ * @example Subscribe to wallets (User SDK)
27
+ * ```typescript
28
+ * ws.send(JSON.stringify({
29
+ * type: 'subscribe',
30
+ * wallets: [{ address: '0x...', chainId: 39123 }]
31
+ * }));
32
+ * ```
33
+ *
34
+ * @example Subscribe to chains (Admin Dashboard - all events)
35
+ * ```typescript
36
+ * ws.send(JSON.stringify({
37
+ * type: 'subscribe',
38
+ * chains: [39123]
39
+ * }));
40
+ * ```
41
+ */
42
+ export interface SubscribeMessage extends WSClientMessageBase {
43
+ type: 'subscribe';
44
+ /** Wallet addresses to subscribe (filtered events) */
45
+ wallets?: WalletInfo[];
46
+ /** Chain IDs for full chain subscription (all events - admin mode) */
47
+ chains?: number[];
48
+ }
49
+ /**
50
+ * Unsubscribe from wallets or chains
51
+ */
52
+ export interface UnsubscribeMessage extends WSClientMessageBase {
53
+ type: 'unsubscribe';
54
+ /** Wallet addresses to unsubscribe */
55
+ wallets?: WalletInfo[];
56
+ /** Chain IDs to unsubscribe */
57
+ chains?: number[];
58
+ }
59
+ /**
60
+ * Pong response to server ping
61
+ */
62
+ export interface PongMessage extends WSClientMessageBase {
63
+ type: 'pong';
64
+ }
65
+ /**
66
+ * All client message types
67
+ */
68
+ export type WSClientMessage = SubscribeMessage | UnsubscribeMessage | PongMessage;
69
+ /**
70
+ * Connection confirmation (sent immediately after auth)
71
+ */
72
+ export interface ConnectedPayload {
73
+ userId: string;
74
+ wallets: WalletInfo[];
75
+ activeChains: number[];
76
+ }
77
+ /**
78
+ * Subscription confirmation
79
+ */
80
+ export interface SubscribedPayload {
81
+ /** Currently subscribed wallets */
82
+ wallets: WalletInfo[];
83
+ /** Currently subscribed chains (admin mode) */
84
+ chains: number[];
85
+ /** All active chain IDs */
86
+ activeChains: number[];
87
+ }
88
+ /**
89
+ * Unsubscription confirmation
90
+ */
91
+ export interface UnsubscribedPayload {
92
+ /** Remaining subscribed wallets */
93
+ wallets: WalletInfo[];
94
+ /** Remaining subscribed chains */
95
+ chains: number[];
96
+ /** All active chain IDs */
97
+ activeChains: number[];
98
+ }
99
+ /**
100
+ * Error payload
101
+ */
102
+ export interface ErrorPayload {
103
+ code: string;
104
+ message: string;
105
+ details?: unknown;
106
+ }
107
+ /**
108
+ * Blockchain event types
109
+ */
110
+ export type BlockchainEventType = 'Transfer' | 'Approval' | 'Mint' | 'Burn' | 'Swap' | 'Unknown';
111
+ /**
112
+ * Blockchain event payload
113
+ */
114
+ export interface BlockchainEvent {
115
+ chainId: number;
116
+ type: BlockchainEventType;
117
+ txHash: string;
118
+ blockNumber: number;
119
+ timestamp: number;
120
+ contractAddress: string;
121
+ data: {
122
+ from?: string;
123
+ to?: string;
124
+ value?: string;
125
+ [key: string]: unknown;
126
+ };
127
+ userMessage: string;
128
+ }
129
+ /**
130
+ * Server message types
131
+ */
132
+ export interface WSServerMessageConnected {
133
+ type: 'connected';
134
+ payload: ConnectedPayload;
135
+ timestamp: number;
136
+ }
137
+ export interface WSServerMessageSubscribed {
138
+ type: 'subscribed';
139
+ payload: SubscribedPayload;
140
+ timestamp: number;
141
+ }
142
+ export interface WSServerMessageUnsubscribed {
143
+ type: 'unsubscribed';
144
+ payload: UnsubscribedPayload;
145
+ timestamp: number;
146
+ }
147
+ export interface WSServerMessageEvent {
148
+ type: 'event';
149
+ payload: BlockchainEvent;
150
+ timestamp: number;
151
+ }
152
+ export interface WSServerMessageError {
153
+ type: 'error';
154
+ payload: ErrorPayload;
155
+ timestamp: number;
156
+ }
157
+ export interface WSServerMessagePing {
158
+ type: 'ping';
159
+ timestamp: number;
160
+ }
161
+ /**
162
+ * All server message types
163
+ */
164
+ export type WSServerMessage = WSServerMessageConnected | WSServerMessageSubscribed | WSServerMessageUnsubscribed | WSServerMessageEvent | WSServerMessageError | WSServerMessagePing;
165
+ /**
166
+ * Type guard for server messages
167
+ */
168
+ export declare function isServerMessage(data: unknown): data is WSServerMessage;
169
+ /**
170
+ * Type guard for event messages
171
+ */
172
+ export declare function isEventMessage(msg: WSServerMessage): msg is WSServerMessageEvent;
173
+ /**
174
+ * Type guard for connected messages
175
+ */
176
+ export declare function isConnectedMessage(msg: WSServerMessage): msg is WSServerMessageConnected;
177
+ /**
178
+ * Type guard for subscribed messages
179
+ */
180
+ export declare function isSubscribedMessage(msg: WSServerMessage): msg is WSServerMessageSubscribed;
181
+ /**
182
+ * Type guard for unsubscribed messages
183
+ */
184
+ export declare function isUnsubscribedMessage(msg: WSServerMessage): msg is WSServerMessageUnsubscribed;
185
+ /**
186
+ * Type guard for error messages
187
+ */
188
+ export declare function isErrorMessage(msg: WSServerMessage): msg is WSServerMessageError;
189
+ /**
190
+ * Type guard for ping messages
191
+ */
192
+ export declare function isPingMessage(msg: WSServerMessage): msg is WSServerMessagePing;
193
+ //# sourceMappingURL=ws-relay.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-relay.types.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/ws-relay.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,WAAW,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,IAAI,EAAE,aAAa,CAAC;IACpB,sCAAsC;IACtC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACtD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAMlF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,+CAA+C;IAC/C,MAAM,EAAE,M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strict";
2
+ /**
3
+ * PERS WS-Relay Shared Types
4
+ *
5
+ * Type-safe WebSocket communication types for the PERS event relay system.
6
+ *
7
+ * @version 1.2.0
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.isServerMessage = isServerMessage;
11
+ exports.isEventMessage = isEventMessage;
12
+ exports.isConnectedMessage = isConnectedMessage;
13
+ exports.isSubscribedMessage = isSubscribedMessage;
14
+ exports.isUnsubscribedMessage = isUnsubscribedMessage;
15
+ exports.isErrorMessage = isErrorMessage;
16
+ exports.isPingMessage = isPingMessage;
17
+ // =============================================================================
18
+ // HELPER FUNCTIONS (TYPE GUARDS)
19
+ // =============================================================================
20
+ /**
21
+ * Type guard for server messages
22
+ */
23
+ function isServerMessage(data) {
24
+ return (typeof data === 'object' &&
25
+ data !== null &&
26
+ 'type' in data &&
27
+ 'timestamp' in data);
28
+ }
29
+ /**
30
+ * Type guard for event messages
31
+ */
32
+ function isEventMessage(msg) {
33
+ return msg.type === 'event';
34
+ }
35
+ /**
36
+ * Type guard for connected messages
37
+ */
38
+ function isConnectedMessage(msg) {
39
+ return msg.type === 'connected';
40
+ }
41
+ /**
42
+ * Type guard for subscribed messages
43
+ */
44
+ function isSubscribedMessage(msg) {
45
+ return msg.type === 'subscribed';
46
+ }
47
+ /**
48
+ * Type guard for unsubscribed messages
49
+ */
50
+ function isUnsubscribedMessage(msg) {
51
+ return msg.type === 'unsubscribed';
52
+ }
53
+ /**
54
+ * Type guard for error messages
55
+ */
56
+ function isErrorMessage(msg) {
57
+ return msg.type === 'error';
58
+ }
59
+ /**
60
+ * Type guard for ping messages
61
+ */
62
+ function isPingMessage(msg) {
63
+ return msg.type === 'ping';
64
+ }
65
+ //# sourceMappingURL=ws-relay.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-relay.types.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/ws-relay.types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAiNH,0CAOC;AAKD,wCAEC;AAKD,gDAEC;AAKD,kDAEC;AAKD,sDAEC;AAKD,wCAEC;AAKD,sCAEC;AAxDD,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAa;IAC3C,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,MAAM,IAAI,IAAI;QACd,WAAW,IAAI,IAAI,CACpB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAoB;IACjD,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,GAAoB;IACrD,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,GAAoB;IACtD,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,GAAoB;IACxD,OAAO,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAoB;IACjD,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,GAAoB;IAChD,OAAO,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7B,CAAC"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from './shared-lib/enum';
6
6
  export type * from './shared-lib/interfaces';
7
+ export { isServerMessage, isEventMessage, isConnectedMessage, isSubscribedMessage, isUnsubscribedMessage, isErrorMessage, isPingMessage } from './shared-lib/interfaces/ws-relay.types';
7
8
  export type * from './shared-lib/dto';
8
9
  export * from './shared-lib/types';
9
10
  export * from '@explorins/web3-types';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,mBAAmB,yBAAyB,CAAC;AAG7C,mBAAmB,kBAAkB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAEtC,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,mBAAmB,yBAAyB,CAAC;AAG7C,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACd,MAAM,wCAAwC,CAAC;AAGhD,mBAAmB,kBAAkB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAEtC,mBAAmB,qBAAqB,CAAC"}
@@ -4,6 +4,8 @@
4
4
  */
5
5
  // Export enums - these are safe for browser use (barrel export)
6
6
  export * from './shared-lib/enum/index.js';
7
+ // Export WS Relay type guards (runtime functions)
8
+ export { isServerMessage, isEventMessage, isConnectedMessage, isSubscribedMessage, isUnsubscribedMessage, isErrorMessage, isPingMessage } from './shared-lib/interfaces/ws-relay.types.js';
7
9
  // Export types and constants (runtime exports) - browser-safe only
8
10
  export * from './shared-lib/types/index.js';
9
11
  // Re-export web3 types for convenience
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gEAAgE;AAChE,cAAc,mBAAmB,CAAC;AAQlC,mEAAmE;AACnE,cAAc,oBAAoB,CAAC;AAEnC,uCAAuC;AACvC,cAAc,uBAAuB,CAAC;AAItC,0FAA0F"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gEAAgE;AAChE,cAAc,mBAAmB,CAAC;AAKlC,kDAAkD;AAClD,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACd,MAAM,wCAAwC,CAAC;AAKhD,mEAAmE;AACnE,cAAc,oBAAoB,CAAC;AAEnC,uCAAuC;AACvC,cAAc,uBAAuB,CAAC;AAItC,0FAA0F"}
@@ -19,4 +19,5 @@ export * from './counterfactual-wallet-response.interface';
19
19
  export * from './campaign';
20
20
  export * from './ai-prompt-config.interface';
21
21
  export * from './balance-filter-options.interface';
22
+ export * from './ws-relay.types';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,kBAAkB,CAAC"}
@@ -20,4 +20,5 @@ export * from './counterfactual-wallet-response.interface.js';
20
20
  export * from './campaign/index.js';
21
21
  export * from './ai-prompt-config.interface.js';
22
22
  export * from './balance-filter-options.interface.js';
23
+ export * from './ws-relay.types.js';
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AAExC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,YAAY,CAAC;AAE3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * PERS WS-Relay Shared Types
3
+ *
4
+ * Type-safe WebSocket communication types for the PERS event relay system.
5
+ *
6
+ * @version 1.2.0
7
+ */
8
+ /**
9
+ * Wallet information for subscription
10
+ */
11
+ export interface WalletInfo {
12
+ /** Ethereum address (0x...) */
13
+ address: string;
14
+ /** Chain ID (e.g., 39123 for PERS testnet) */
15
+ chainId: number;
16
+ }
17
+ /**
18
+ * Base client message
19
+ */
20
+ export interface WSClientMessageBase {
21
+ type: 'subscribe' | 'unsubscribe' | 'pong';
22
+ }
23
+ /**
24
+ * Subscribe to wallet addresses (filtered events) or chains (all events)
25
+ *
26
+ * @example Subscribe to wallets (User SDK)
27
+ * ```typescript
28
+ * ws.send(JSON.stringify({
29
+ * type: 'subscribe',
30
+ * wallets: [{ address: '0x...', chainId: 39123 }]
31
+ * }));
32
+ * ```
33
+ *
34
+ * @example Subscribe to chains (Admin Dashboard - all events)
35
+ * ```typescript
36
+ * ws.send(JSON.stringify({
37
+ * type: 'subscribe',
38
+ * chains: [39123]
39
+ * }));
40
+ * ```
41
+ */
42
+ export interface SubscribeMessage extends WSClientMessageBase {
43
+ type: 'subscribe';
44
+ /** Wallet addresses to subscribe (filtered events) */
45
+ wallets?: WalletInfo[];
46
+ /** Chain IDs for full chain subscription (all events - admin mode) */
47
+ chains?: number[];
48
+ }
49
+ /**
50
+ * Unsubscribe from wallets or chains
51
+ */
52
+ export interface UnsubscribeMessage extends WSClientMessageBase {
53
+ type: 'unsubscribe';
54
+ /** Wallet addresses to unsubscribe */
55
+ wallets?: WalletInfo[];
56
+ /** Chain IDs to unsubscribe */
57
+ chains?: number[];
58
+ }
59
+ /**
60
+ * Pong response to server ping
61
+ */
62
+ export interface PongMessage extends WSClientMessageBase {
63
+ type: 'pong';
64
+ }
65
+ /**
66
+ * All client message types
67
+ */
68
+ export type WSClientMessage = SubscribeMessage | UnsubscribeMessage | PongMessage;
69
+ /**
70
+ * Connection confirmation (sent immediately after auth)
71
+ */
72
+ export interface ConnectedPayload {
73
+ userId: string;
74
+ wallets: WalletInfo[];
75
+ activeChains: number[];
76
+ }
77
+ /**
78
+ * Subscription confirmation
79
+ */
80
+ export interface SubscribedPayload {
81
+ /** Currently subscribed wallets */
82
+ wallets: WalletInfo[];
83
+ /** Currently subscribed chains (admin mode) */
84
+ chains: number[];
85
+ /** All active chain IDs */
86
+ activeChains: number[];
87
+ }
88
+ /**
89
+ * Unsubscription confirmation
90
+ */
91
+ export interface UnsubscribedPayload {
92
+ /** Remaining subscribed wallets */
93
+ wallets: WalletInfo[];
94
+ /** Remaining subscribed chains */
95
+ chains: number[];
96
+ /** All active chain IDs */
97
+ activeChains: number[];
98
+ }
99
+ /**
100
+ * Error payload
101
+ */
102
+ export interface ErrorPayload {
103
+ code: string;
104
+ message: string;
105
+ details?: unknown;
106
+ }
107
+ /**
108
+ * Blockchain event types
109
+ */
110
+ export type BlockchainEventType = 'Transfer' | 'Approval' | 'Mint' | 'Burn' | 'Swap' | 'Unknown';
111
+ /**
112
+ * Blockchain event payload
113
+ */
114
+ export interface BlockchainEvent {
115
+ chainId: number;
116
+ type: BlockchainEventType;
117
+ txHash: string;
118
+ blockNumber: number;
119
+ timestamp: number;
120
+ contractAddress: string;
121
+ data: {
122
+ from?: string;
123
+ to?: string;
124
+ value?: string;
125
+ [key: string]: unknown;
126
+ };
127
+ userMessage: string;
128
+ }
129
+ /**
130
+ * Server message types
131
+ */
132
+ export interface WSServerMessageConnected {
133
+ type: 'connected';
134
+ payload: ConnectedPayload;
135
+ timestamp: number;
136
+ }
137
+ export interface WSServerMessageSubscribed {
138
+ type: 'subscribed';
139
+ payload: SubscribedPayload;
140
+ timestamp: number;
141
+ }
142
+ export interface WSServerMessageUnsubscribed {
143
+ type: 'unsubscribed';
144
+ payload: UnsubscribedPayload;
145
+ timestamp: number;
146
+ }
147
+ export interface WSServerMessageEvent {
148
+ type: 'event';
149
+ payload: BlockchainEvent;
150
+ timestamp: number;
151
+ }
152
+ export interface WSServerMessageError {
153
+ type: 'error';
154
+ payload: ErrorPayload;
155
+ timestamp: number;
156
+ }
157
+ export interface WSServerMessagePing {
158
+ type: 'ping';
159
+ timestamp: number;
160
+ }
161
+ /**
162
+ * All server message types
163
+ */
164
+ export type WSServerMessage = WSServerMessageConnected | WSServerMessageSubscribed | WSServerMessageUnsubscribed | WSServerMessageEvent | WSServerMessageError | WSServerMessagePing;
165
+ /**
166
+ * Type guard for server messages
167
+ */
168
+ export declare function isServerMessage(data: unknown): data is WSServerMessage;
169
+ /**
170
+ * Type guard for event messages
171
+ */
172
+ export declare function isEventMessage(msg: WSServerMessage): msg is WSServerMessageEvent;
173
+ /**
174
+ * Type guard for connected messages
175
+ */
176
+ export declare function isConnectedMessage(msg: WSServerMessage): msg is WSServerMessageConnected;
177
+ /**
178
+ * Type guard for subscribed messages
179
+ */
180
+ export declare function isSubscribedMessage(msg: WSServerMessage): msg is WSServerMessageSubscribed;
181
+ /**
182
+ * Type guard for unsubscribed messages
183
+ */
184
+ export declare function isUnsubscribedMessage(msg: WSServerMessage): msg is WSServerMessageUnsubscribed;
185
+ /**
186
+ * Type guard for error messages
187
+ */
188
+ export declare function isErrorMessage(msg: WSServerMessage): msg is WSServerMessageError;
189
+ /**
190
+ * Type guard for ping messages
191
+ */
192
+ export declare function isPingMessage(msg: WSServerMessage): msg is WSServerMessagePing;
193
+ //# sourceMappingURL=ws-relay.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-relay.types.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/ws-relay.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,WAAW,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,IAAI,EAAE,aAAa,CAAC;IACpB,sCAAsC;IACtC,OAAO,CAAC,EAAE,UAAU,EAA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G,GAAG,IAAI,oBAAoB,CAEhF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,IAAI,wBAAwB,CAExF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,IAAI,yBAAyB,CAE1F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,IAAI,2BAA2B,CAE9F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,IAAI,oBAAoB,CAEhF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,IAAI,mBAAmB,CAE9E"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * PERS WS-Relay Shared Types
3
+ *
4
+ * Type-safe WebSocket communication types for the PERS event relay system.
5
+ *
6
+ * @version 1.2.0
7
+ */
8
+ // =============================================================================
9
+ // HELPER FUNCTIONS (TYPE GUARDS)
10
+ // =============================================================================
11
+ /**
12
+ * Type guard for server messages
13
+ */
14
+ export function isServerMessage(data) {
15
+ return (typeof data === 'object' &&
16
+ data !== null &&
17
+ 'type' in data &&
18
+ 'timestamp' in data);
19
+ }
20
+ /**
21
+ * Type guard for event messages
22
+ */
23
+ export function isEventMessage(msg) {
24
+ return msg.type === 'event';
25
+ }
26
+ /**
27
+ * Type guard for connected messages
28
+ */
29
+ export function isConnectedMessage(msg) {
30
+ return msg.type === 'connected';
31
+ }
32
+ /**
33
+ * Type guard for subscribed messages
34
+ */
35
+ export function isSubscribedMessage(msg) {
36
+ return msg.type === 'subscribed';
37
+ }
38
+ /**
39
+ * Type guard for unsubscribed messages
40
+ */
41
+ export function isUnsubscribedMessage(msg) {
42
+ return msg.type === 'unsubscribed';
43
+ }
44
+ /**
45
+ * Type guard for error messages
46
+ */
47
+ export function isErrorMessage(msg) {
48
+ return msg.type === 'error';
49
+ }
50
+ /**
51
+ * Type guard for ping messages
52
+ */
53
+ export function isPingMessage(msg) {
54
+ return msg.type === 'ping';
55
+ }
56
+ //# sourceMappingURL=ws-relay.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-relay.types.js","sourceRoot":"","sources":["../../../../src/shared-lib/interfaces/ws-relay.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0MH,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,MAAM,IAAI,IAAI;QACd,WAAW,IAAI,IAAI,CACpB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAoB;IACjD,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAoB;IACrD,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAoB;IACtD,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAoB;IACxD,OAAO,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAoB;IACjD,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAoB;IAChD,OAAO,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorins/pers-shared",
3
- "version": "2.1.115",
3
+ "version": "2.1.117",
4
4
  "scripts": {
5
5
  "clean": "find dist -type f -delete 2>/dev/null || true",
6
6
  "build:esm": "tsc -p tsconfig.esm.json && node scripts/add-js-extensions.js",