@metamask-previews/core-backend 4.1.0-preview-4cd9da8d → 5.0.0-preview-e3eb8eca
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/CHANGELOG.md +11 -6
- package/dist/BackendWebSocketService-method-action-types.cjs.map +1 -1
- package/dist/BackendWebSocketService-method-action-types.d.cts +106 -20
- package/dist/BackendWebSocketService-method-action-types.d.cts.map +1 -1
- package/dist/BackendWebSocketService-method-action-types.d.mts +106 -20
- package/dist/BackendWebSocketService-method-action-types.d.mts.map +1 -1
- package/dist/BackendWebSocketService-method-action-types.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [5.0.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/profile-sync-controller` from `^26.0.0` to `^27.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
15
|
+
- Bump `@metamask/controller-utils` from `^11.15.0` to `^11.16.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
16
|
+
- **BREAKING:** Bump `@metamask/keyring-controller` from `^24.0.0` to `^25.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
17
|
+
- **BREAKING:** Bump `@metamask/accounts-controller` from `^34.0.0` to `^35.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
18
|
+
|
|
10
19
|
## [4.1.0]
|
|
11
20
|
|
|
12
21
|
### Changed
|
|
@@ -22,17 +31,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
22
31
|
- Centralize all disconnection logic in `ws.onclose` handler for single source of truth
|
|
23
32
|
- Centralize all state changes within `#establishConnection` method - state transitions only occur in `onopen` (CONNECTING → CONNECTED) and `onclose` (any state → DISCONNECTED)
|
|
24
33
|
- Add `MANUAL_DISCONNECT_CODE` (4999) and `MANUAL_DISCONNECT_REASON` constants to distinguish manual from unexpected disconnects
|
|
25
|
-
- Update `typescript` to v5.3 ([#7081](https://github.com/MetaMask/core/pull/7081))
|
|
26
34
|
- Bump `@ts-bridge/cli` from `^0.6.1` to `^0.6.4` ([#7039](https://github.com/MetaMask/core/pull/7039))
|
|
27
35
|
|
|
28
36
|
### Removed
|
|
29
37
|
|
|
30
38
|
- Remove `BackendWebSocketService Channel Message` trace as it provided no useful performance insights ([#7101](https://github.com/MetaMask/core/pull/7101))
|
|
31
39
|
|
|
32
|
-
### Fixed
|
|
33
|
-
|
|
34
|
-
- Fix build script not working because of missing `@ts-bridge/cli` dependency ([#7040](https://github.com/MetaMask/core/pull/7040))
|
|
35
|
-
|
|
36
40
|
## [4.0.0]
|
|
37
41
|
|
|
38
42
|
### Changed
|
|
@@ -159,7 +163,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
159
163
|
- **Type definitions** - Comprehensive TypeScript types for transactions, balances, WebSocket messages, and service configurations
|
|
160
164
|
- **Logging infrastructure** - Structured logging with module-specific loggers for debugging and monitoring
|
|
161
165
|
|
|
162
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/core-backend@
|
|
166
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/core-backend@5.0.0...HEAD
|
|
167
|
+
[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/core-backend@4.1.0...@metamask/core-backend@5.0.0
|
|
163
168
|
[4.1.0]: https://github.com/MetaMask/core/compare/@metamask/core-backend@4.0.0...@metamask/core-backend@4.1.0
|
|
164
169
|
[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/core-backend@3.0.0...@metamask/core-backend@4.0.0
|
|
165
170
|
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/core-backend@2.1.0...@metamask/core-backend@3.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendWebSocketService-method-action-types.cjs","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { BackendWebSocketService } from './BackendWebSocketService';\n\n/**\n * Establishes WebSocket connection\n *\n * @returns Promise that resolves when connection is established\n */\nexport type BackendWebSocketServiceConnectAction = {\n type: `BackendWebSocketService:connect`;\n handler: BackendWebSocketService['connect'];\n};\n\n/**\n * Closes WebSocket connection\n *\n * @returns Promise that resolves when disconnection is complete\n */\nexport type BackendWebSocketServiceDisconnectAction = {\n type: `BackendWebSocketService:disconnect`;\n handler: BackendWebSocketService['disconnect'];\n};\n\n/**\n * Forces a WebSocket reconnection to clean up subscription state\n *\n * This method is useful when subscription state may be out of sync and needs to be reset.\n * It performs a controlled disconnect-then-reconnect sequence:\n * - Disconnects cleanly to trigger subscription cleanup\n * - Schedules reconnection with exponential backoff to prevent rapid loops\n * - All subscriptions will be cleaned up automatically on disconnect\n *\n * Use cases:\n * - Recovering from subscription/unsubscription issues\n * - Cleaning up orphaned subscriptions\n * - Forcing a fresh subscription state\n *\n * @returns Promise that resolves when disconnection is complete (reconnection is scheduled)\n */\nexport type BackendWebSocketServiceForceReconnectionAction = {\n type: `BackendWebSocketService:forceReconnection`;\n handler: BackendWebSocketService['forceReconnection'];\n};\n\n/**\n * Sends a message through the WebSocket\n *\n * @param message - The message to send\n * @returns Promise that resolves when message is sent\n */\nexport type BackendWebSocketServiceSendMessageAction = {\n type: `BackendWebSocketService:sendMessage`;\n handler: BackendWebSocketService['sendMessage'];\n};\n\n/**\n * Sends a request and waits for a correlated response\n *\n * @param message - The request message\n * @returns Promise that resolves with the response data\n */\nexport type BackendWebSocketServiceSendRequestAction = {\n type: `BackendWebSocketService:sendRequest`;\n handler: BackendWebSocketService['sendRequest'];\n};\n\n/**\n * Gets current connection information\n *\n * @returns Current connection status and details\n */\nexport type BackendWebSocketServiceGetConnectionInfoAction = {\n type: `BackendWebSocketService:getConnectionInfo`;\n handler: BackendWebSocketService['getConnectionInfo'];\n};\n\n/**\n * Gets all subscription information for a specific channel\n *\n * @param channel - The channel name to look up\n * @returns Array of subscription details for all subscriptions containing the channel\n */\nexport type BackendWebSocketServiceGetSubscriptionsByChannelAction = {\n type: `BackendWebSocketService:getSubscriptionsByChannel`;\n handler: BackendWebSocketService['getSubscriptionsByChannel'];\n};\n\n/**\n * Checks if a channel has a subscription\n *\n * @param channel - The channel name to check\n * @returns True if the channel has a subscription, false otherwise\n */\nexport type BackendWebSocketServiceChannelHasSubscriptionAction = {\n type: `BackendWebSocketService:channelHasSubscription`;\n handler: BackendWebSocketService['channelHasSubscription'];\n};\n\n/**\n * Finds all subscriptions that have channels starting with the specified prefix\n *\n * @param channelPrefix - The channel prefix to search for (e.g., \"account-activity.v1\")\n * @returns Array of subscription info for matching subscriptions\n */\nexport type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {\n type: `BackendWebSocketService:findSubscriptionsByChannelPrefix`;\n handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];\n};\n\n/**\n * Register a callback for specific channels\n *\n * @param options - Channel callback configuration\n * @param options.channelName - Channel name to match exactly\n * @param options.callback - Function to call when channel matches\n *\n * @example\n * ```typescript\n * // Listen to specific account activity channel\n * webSocketService.addChannelCallback({\n * channelName: 'account-activity.v1.eip155:0:0x1234...',\n * callback: (notification) => {\n * console.log('Account activity:', notification.data);\n * }\n * });\n *\n * // Listen to system notifications channel\n * webSocketService.addChannelCallback({\n * channelName: 'system-notifications.v1',\n * callback: (notification) => {\n * console.log('System notification:', notification.data);\n * }\n * });\n * ```\n */\nexport type BackendWebSocketServiceAddChannelCallbackAction = {\n type: `BackendWebSocketService:addChannelCallback`;\n handler: BackendWebSocketService['addChannelCallback'];\n};\n\n/**\n * Remove a channel callback\n *\n * @param channelName - The channel name to remove callback for\n * @returns True if callback was found and removed, false otherwise\n */\nexport type BackendWebSocketServiceRemoveChannelCallbackAction = {\n type: `BackendWebSocketService:removeChannelCallback`;\n handler: BackendWebSocketService['removeChannelCallback'];\n};\n\n/**\n * Get all registered channel callbacks (for debugging)\n */\nexport type BackendWebSocketServiceGetChannelCallbacksAction = {\n type: `BackendWebSocketService:getChannelCallbacks`;\n handler: BackendWebSocketService['getChannelCallbacks'];\n};\n\n/**\n * Create and manage a subscription with direct callback routing\n *\n * @param options - Subscription configuration\n * @param options.channels - Array of channel names to subscribe to\n * @param options.callback - Callback function for handling notifications\n * @returns Promise that resolves with subscription object containing unsubscribe method\n */\nexport type BackendWebSocketServiceSubscribeAction = {\n type: `BackendWebSocketService:subscribe`;\n handler: BackendWebSocketService['subscribe'];\n};\n\n/**\n * Union of all BackendWebSocketService action types.\n */\nexport type BackendWebSocketServiceMethodActions =\n | BackendWebSocketServiceConnectAction\n | BackendWebSocketServiceDisconnectAction\n | BackendWebSocketServiceForceReconnectionAction\n | BackendWebSocketServiceSendMessageAction\n | BackendWebSocketServiceSendRequestAction\n | BackendWebSocketServiceGetConnectionInfoAction\n | BackendWebSocketServiceGetSubscriptionsByChannelAction\n | BackendWebSocketServiceChannelHasSubscriptionAction\n | BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction\n | BackendWebSocketServiceAddChannelCallbackAction\n | BackendWebSocketServiceRemoveChannelCallbackAction\n | BackendWebSocketServiceGetChannelCallbacksAction\n | BackendWebSocketServiceSubscribeAction;\n"]}
|
|
1
|
+
{"version":3,"file":"BackendWebSocketService-method-action-types.cjs","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { BackendWebSocketService } from './BackendWebSocketService';\n\n/**\n * Establishes WebSocket connection with smart reconnection behavior\n *\n * Connection Requirements (all must be true):\n * 1. Feature enabled (isEnabled() = true)\n * 2. Wallet unlocked (checked by getBearerToken)\n * 3. User signed in (checked by getBearerToken)\n *\n * Platform code should call this when app opens/foregrounds.\n * Automatically called on KeyringController:unlock event.\n *\n * @returns Promise that resolves when connection is established\n */\nexport type BackendWebSocketServiceConnectAction = {\n type: `BackendWebSocketService:connect`;\n handler: BackendWebSocketService['connect'];\n};\n\n/**\n * Closes WebSocket connection\n */\nexport type BackendWebSocketServiceDisconnectAction = {\n type: `BackendWebSocketService:disconnect`;\n handler: BackendWebSocketService['disconnect'];\n};\n\n/**\n * Forces a WebSocket reconnection to clean up subscription state\n *\n * This method is useful when subscription state may be out of sync and needs to be reset.\n * It performs a controlled disconnect-then-reconnect sequence:\n * - Disconnects cleanly to trigger subscription cleanup\n * - Schedules reconnection with exponential backoff to prevent rapid loops\n * - All subscriptions will be cleaned up automatically on disconnect\n *\n * Use cases:\n * - Recovering from subscription/unsubscription issues\n * - Cleaning up orphaned subscriptions\n * - Forcing a fresh subscription state\n *\n * @returns Promise that resolves when disconnection is complete (reconnection is scheduled)\n */\nexport type BackendWebSocketServiceForceReconnectionAction = {\n type: `BackendWebSocketService:forceReconnection`;\n handler: BackendWebSocketService['forceReconnection'];\n};\n\n/**\n * Sends a message through the WebSocket (fire-and-forget, no response expected)\n *\n * This is a low-level method for sending messages without waiting for a response.\n * Most consumers should use `sendRequest()` instead, which handles request-response\n * correlation and provides proper error handling with timeouts.\n *\n * Use this method only when:\n * - You don't need a response from the server\n * - You're implementing custom message protocols\n * - You need fine-grained control over message timing\n *\n * @param message - The message to send\n * @throws Error if WebSocket is not connected or send fails\n *\n * @see sendRequest for request-response pattern with automatic correlation\n */\nexport type BackendWebSocketServiceSendMessageAction = {\n type: `BackendWebSocketService:sendMessage`;\n handler: BackendWebSocketService['sendMessage'];\n};\n\n/**\n * Sends a request and waits for a correlated response (recommended for most use cases)\n *\n * This is the recommended high-level method for request-response communication.\n * It automatically handles:\n * - Request ID generation and correlation\n * - Response matching with timeout protection\n * - Automatic reconnection on timeout\n * - Proper cleanup of pending requests\n *\n * @param message - The request message (can include optional requestId for testing)\n * @returns Promise that resolves with the response data\n * @throws Error if WebSocket is not connected, request times out, or response indicates failure\n *\n * @see sendMessage for fire-and-forget messaging without response handling\n */\nexport type BackendWebSocketServiceSendRequestAction = {\n type: `BackendWebSocketService:sendRequest`;\n handler: BackendWebSocketService['sendRequest'];\n};\n\n/**\n * Gets current connection information\n *\n * @returns Current connection status and details\n */\nexport type BackendWebSocketServiceGetConnectionInfoAction = {\n type: `BackendWebSocketService:getConnectionInfo`;\n handler: BackendWebSocketService['getConnectionInfo'];\n};\n\n/**\n * Gets all subscription information for a specific channel\n *\n * @param channel - The channel name to look up\n * @returns Array of subscription details for all subscriptions containing the channel\n */\nexport type BackendWebSocketServiceGetSubscriptionsByChannelAction = {\n type: `BackendWebSocketService:getSubscriptionsByChannel`;\n handler: BackendWebSocketService['getSubscriptionsByChannel'];\n};\n\n/**\n * Checks if a channel has a subscription\n *\n * @param channel - The channel name to check\n * @returns True if the channel has a subscription, false otherwise\n */\nexport type BackendWebSocketServiceChannelHasSubscriptionAction = {\n type: `BackendWebSocketService:channelHasSubscription`;\n handler: BackendWebSocketService['channelHasSubscription'];\n};\n\n/**\n * Finds all subscriptions that have channels starting with the specified prefix\n *\n * @param channelPrefix - The channel prefix to search for (e.g., \"account-activity.v1\")\n * @returns Array of subscription info for matching subscriptions\n */\nexport type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {\n type: `BackendWebSocketService:findSubscriptionsByChannelPrefix`;\n handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];\n};\n\n/**\n * Register a callback for specific channels (local callback only, no server subscription)\n *\n * **Key Difference from `subscribe()`:**\n * - `addChannelCallback()`: Registers a local callback without creating a server-side subscription.\n * The callback triggers on ANY message matching the channel name, regardless of subscriptionId.\n * Useful for system-wide notifications or when you don't control the subscription lifecycle.\n *\n * - `subscribe()`: Creates a proper server-side subscription with a subscriptionId.\n * The callback only triggers for messages with the matching subscriptionId.\n * Includes proper lifecycle management (unsubscribe, automatic cleanup on disconnect).\n *\n * **When to use `addChannelCallback()`:**\n * - Listening to system-wide notifications (e.g., 'system-notifications.v1')\n * - Monitoring channels where subscriptions are managed elsewhere\n * - Debug/logging scenarios where you want to observe all channel messages\n *\n * **When to use `subscribe()` instead:**\n * - Creating new subscriptions that need server-side registration\n * - When you need proper cleanup via unsubscribe\n * - Most application use cases (recommended approach)\n *\n * @param options - Channel callback configuration\n * @param options.channelName - Channel name to match exactly\n * @param options.callback - Function to call when channel matches\n *\n * @example\n * ```typescript\n * // Listen to system notifications (no server subscription needed)\n * webSocketService.addChannelCallback({\n * channelName: 'system-notifications.v1',\n * callback: (notification) => {\n * console.log('System notification:', notification.data);\n * }\n * });\n *\n * // For account-specific subscriptions, use subscribe() instead:\n * // const sub = await webSocketService.subscribe({\n * // channels: ['account-activity.v1.eip155:0:0x1234...'],\n * // callback: (notification) => { ... }\n * // });\n * ```\n *\n * @see subscribe for creating proper server-side subscriptions with lifecycle management\n */\nexport type BackendWebSocketServiceAddChannelCallbackAction = {\n type: `BackendWebSocketService:addChannelCallback`;\n handler: BackendWebSocketService['addChannelCallback'];\n};\n\n/**\n * Remove a channel callback\n *\n * @param channelName - The channel name returned from addChannelCallback\n * @returns True if callback was found and removed, false otherwise\n */\nexport type BackendWebSocketServiceRemoveChannelCallbackAction = {\n type: `BackendWebSocketService:removeChannelCallback`;\n handler: BackendWebSocketService['removeChannelCallback'];\n};\n\n/**\n * Get all registered channel callbacks (for debugging)\n *\n * @returns Array of all registered channel callbacks\n */\nexport type BackendWebSocketServiceGetChannelCallbacksAction = {\n type: `BackendWebSocketService:getChannelCallbacks`;\n handler: BackendWebSocketService['getChannelCallbacks'];\n};\n\n/**\n * Create and manage a subscription with server-side registration (recommended for most use cases)\n *\n * This is the recommended subscription API for high-level services. It creates a proper\n * server-side subscription and routes notifications based on subscriptionId.\n *\n * **Key Features:**\n * - Creates server-side subscription with unique subscriptionId\n * - Callback triggered only for messages with matching subscriptionId\n * - Automatic lifecycle management (cleanup on disconnect)\n * - Includes unsubscribe method for proper cleanup\n * - Request-response pattern with error handling\n *\n * **When to use `subscribe()`:**\n * - Creating new subscriptions (account activity, price updates, etc.)\n * - When you need proper cleanup/unsubscribe functionality\n * - Most application use cases\n *\n * **When to use `addChannelCallback()` instead:**\n * - System-wide notifications without server-side subscription\n * - Observing channels managed elsewhere\n * - Debug/logging scenarios\n *\n * @param options - Subscription configuration\n * @param options.channels - Array of channel names to subscribe to\n * @param options.callback - Callback function for handling notifications\n * @param options.requestId - Optional request ID for testing (will generate UUID if not provided)\n * @param options.channelType - Channel type identifier\n * @returns Subscription object with unsubscribe method\n *\n * @example\n * ```typescript\n * // AccountActivityService usage\n * const subscription = await webSocketService.subscribe({\n * channels: ['account-activity.v1.eip155:0:0x1234...'],\n * callback: (notification) => {\n * this.handleAccountActivity(notification.data);\n * }\n * });\n *\n * // Later, clean up\n * await subscription.unsubscribe();\n * ```\n *\n * @see addChannelCallback for local callbacks without server-side subscription\n */\nexport type BackendWebSocketServiceSubscribeAction = {\n type: `BackendWebSocketService:subscribe`;\n handler: BackendWebSocketService['subscribe'];\n};\n\n/**\n * Union of all BackendWebSocketService action types.\n */\nexport type BackendWebSocketServiceMethodActions =\n | BackendWebSocketServiceConnectAction\n | BackendWebSocketServiceDisconnectAction\n | BackendWebSocketServiceForceReconnectionAction\n | BackendWebSocketServiceSendMessageAction\n | BackendWebSocketServiceSendRequestAction\n | BackendWebSocketServiceGetConnectionInfoAction\n | BackendWebSocketServiceGetSubscriptionsByChannelAction\n | BackendWebSocketServiceChannelHasSubscriptionAction\n | BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction\n | BackendWebSocketServiceAddChannelCallbackAction\n | BackendWebSocketServiceRemoveChannelCallbackAction\n | BackendWebSocketServiceGetChannelCallbacksAction\n | BackendWebSocketServiceSubscribeAction;\n"]}
|
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { BackendWebSocketService } from "./BackendWebSocketService.cjs";
|
|
6
6
|
/**
|
|
7
|
-
* Establishes WebSocket connection
|
|
7
|
+
* Establishes WebSocket connection with smart reconnection behavior
|
|
8
|
+
*
|
|
9
|
+
* Connection Requirements (all must be true):
|
|
10
|
+
* 1. Feature enabled (isEnabled() = true)
|
|
11
|
+
* 2. Wallet unlocked (checked by getBearerToken)
|
|
12
|
+
* 3. User signed in (checked by getBearerToken)
|
|
13
|
+
*
|
|
14
|
+
* Platform code should call this when app opens/foregrounds.
|
|
15
|
+
* Automatically called on KeyringController:unlock event.
|
|
8
16
|
*
|
|
9
17
|
* @returns Promise that resolves when connection is established
|
|
10
18
|
*/
|
|
@@ -14,8 +22,6 @@ export type BackendWebSocketServiceConnectAction = {
|
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
16
24
|
* Closes WebSocket connection
|
|
17
|
-
*
|
|
18
|
-
* @returns Promise that resolves when disconnection is complete
|
|
19
25
|
*/
|
|
20
26
|
export type BackendWebSocketServiceDisconnectAction = {
|
|
21
27
|
type: `BackendWebSocketService:disconnect`;
|
|
@@ -42,20 +48,41 @@ export type BackendWebSocketServiceForceReconnectionAction = {
|
|
|
42
48
|
handler: BackendWebSocketService['forceReconnection'];
|
|
43
49
|
};
|
|
44
50
|
/**
|
|
45
|
-
* Sends a message through the WebSocket
|
|
51
|
+
* Sends a message through the WebSocket (fire-and-forget, no response expected)
|
|
52
|
+
*
|
|
53
|
+
* This is a low-level method for sending messages without waiting for a response.
|
|
54
|
+
* Most consumers should use `sendRequest()` instead, which handles request-response
|
|
55
|
+
* correlation and provides proper error handling with timeouts.
|
|
56
|
+
*
|
|
57
|
+
* Use this method only when:
|
|
58
|
+
* - You don't need a response from the server
|
|
59
|
+
* - You're implementing custom message protocols
|
|
60
|
+
* - You need fine-grained control over message timing
|
|
46
61
|
*
|
|
47
62
|
* @param message - The message to send
|
|
48
|
-
* @
|
|
63
|
+
* @throws Error if WebSocket is not connected or send fails
|
|
64
|
+
*
|
|
65
|
+
* @see sendRequest for request-response pattern with automatic correlation
|
|
49
66
|
*/
|
|
50
67
|
export type BackendWebSocketServiceSendMessageAction = {
|
|
51
68
|
type: `BackendWebSocketService:sendMessage`;
|
|
52
69
|
handler: BackendWebSocketService['sendMessage'];
|
|
53
70
|
};
|
|
54
71
|
/**
|
|
55
|
-
* Sends a request and waits for a correlated response
|
|
72
|
+
* Sends a request and waits for a correlated response (recommended for most use cases)
|
|
73
|
+
*
|
|
74
|
+
* This is the recommended high-level method for request-response communication.
|
|
75
|
+
* It automatically handles:
|
|
76
|
+
* - Request ID generation and correlation
|
|
77
|
+
* - Response matching with timeout protection
|
|
78
|
+
* - Automatic reconnection on timeout
|
|
79
|
+
* - Proper cleanup of pending requests
|
|
56
80
|
*
|
|
57
|
-
* @param message - The request message
|
|
81
|
+
* @param message - The request message (can include optional requestId for testing)
|
|
58
82
|
* @returns Promise that resolves with the response data
|
|
83
|
+
* @throws Error if WebSocket is not connected, request times out, or response indicates failure
|
|
84
|
+
*
|
|
85
|
+
* @see sendMessage for fire-and-forget messaging without response handling
|
|
59
86
|
*/
|
|
60
87
|
export type BackendWebSocketServiceSendRequestAction = {
|
|
61
88
|
type: `BackendWebSocketService:sendRequest`;
|
|
@@ -101,7 +128,26 @@ export type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {
|
|
|
101
128
|
handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];
|
|
102
129
|
};
|
|
103
130
|
/**
|
|
104
|
-
* Register a callback for specific channels
|
|
131
|
+
* Register a callback for specific channels (local callback only, no server subscription)
|
|
132
|
+
*
|
|
133
|
+
* **Key Difference from `subscribe()`:**
|
|
134
|
+
* - `addChannelCallback()`: Registers a local callback without creating a server-side subscription.
|
|
135
|
+
* The callback triggers on ANY message matching the channel name, regardless of subscriptionId.
|
|
136
|
+
* Useful for system-wide notifications or when you don't control the subscription lifecycle.
|
|
137
|
+
*
|
|
138
|
+
* - `subscribe()`: Creates a proper server-side subscription with a subscriptionId.
|
|
139
|
+
* The callback only triggers for messages with the matching subscriptionId.
|
|
140
|
+
* Includes proper lifecycle management (unsubscribe, automatic cleanup on disconnect).
|
|
141
|
+
*
|
|
142
|
+
* **When to use `addChannelCallback()`:**
|
|
143
|
+
* - Listening to system-wide notifications (e.g., 'system-notifications.v1')
|
|
144
|
+
* - Monitoring channels where subscriptions are managed elsewhere
|
|
145
|
+
* - Debug/logging scenarios where you want to observe all channel messages
|
|
146
|
+
*
|
|
147
|
+
* **When to use `subscribe()` instead:**
|
|
148
|
+
* - Creating new subscriptions that need server-side registration
|
|
149
|
+
* - When you need proper cleanup via unsubscribe
|
|
150
|
+
* - Most application use cases (recommended approach)
|
|
105
151
|
*
|
|
106
152
|
* @param options - Channel callback configuration
|
|
107
153
|
* @param options.channelName - Channel name to match exactly
|
|
@@ -109,22 +155,22 @@ export type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {
|
|
|
109
155
|
*
|
|
110
156
|
* @example
|
|
111
157
|
* ```typescript
|
|
112
|
-
* // Listen to
|
|
113
|
-
* webSocketService.addChannelCallback({
|
|
114
|
-
* channelName: 'account-activity.v1.eip155:0:0x1234...',
|
|
115
|
-
* callback: (notification) => {
|
|
116
|
-
* console.log('Account activity:', notification.data);
|
|
117
|
-
* }
|
|
118
|
-
* });
|
|
119
|
-
*
|
|
120
|
-
* // Listen to system notifications channel
|
|
158
|
+
* // Listen to system notifications (no server subscription needed)
|
|
121
159
|
* webSocketService.addChannelCallback({
|
|
122
160
|
* channelName: 'system-notifications.v1',
|
|
123
161
|
* callback: (notification) => {
|
|
124
162
|
* console.log('System notification:', notification.data);
|
|
125
163
|
* }
|
|
126
164
|
* });
|
|
165
|
+
*
|
|
166
|
+
* // For account-specific subscriptions, use subscribe() instead:
|
|
167
|
+
* // const sub = await webSocketService.subscribe({
|
|
168
|
+
* // channels: ['account-activity.v1.eip155:0:0x1234...'],
|
|
169
|
+
* // callback: (notification) => { ... }
|
|
170
|
+
* // });
|
|
127
171
|
* ```
|
|
172
|
+
*
|
|
173
|
+
* @see subscribe for creating proper server-side subscriptions with lifecycle management
|
|
128
174
|
*/
|
|
129
175
|
export type BackendWebSocketServiceAddChannelCallbackAction = {
|
|
130
176
|
type: `BackendWebSocketService:addChannelCallback`;
|
|
@@ -133,7 +179,7 @@ export type BackendWebSocketServiceAddChannelCallbackAction = {
|
|
|
133
179
|
/**
|
|
134
180
|
* Remove a channel callback
|
|
135
181
|
*
|
|
136
|
-
* @param channelName - The channel name
|
|
182
|
+
* @param channelName - The channel name returned from addChannelCallback
|
|
137
183
|
* @returns True if callback was found and removed, false otherwise
|
|
138
184
|
*/
|
|
139
185
|
export type BackendWebSocketServiceRemoveChannelCallbackAction = {
|
|
@@ -142,18 +188,58 @@ export type BackendWebSocketServiceRemoveChannelCallbackAction = {
|
|
|
142
188
|
};
|
|
143
189
|
/**
|
|
144
190
|
* Get all registered channel callbacks (for debugging)
|
|
191
|
+
*
|
|
192
|
+
* @returns Array of all registered channel callbacks
|
|
145
193
|
*/
|
|
146
194
|
export type BackendWebSocketServiceGetChannelCallbacksAction = {
|
|
147
195
|
type: `BackendWebSocketService:getChannelCallbacks`;
|
|
148
196
|
handler: BackendWebSocketService['getChannelCallbacks'];
|
|
149
197
|
};
|
|
150
198
|
/**
|
|
151
|
-
* Create and manage a subscription with
|
|
199
|
+
* Create and manage a subscription with server-side registration (recommended for most use cases)
|
|
200
|
+
*
|
|
201
|
+
* This is the recommended subscription API for high-level services. It creates a proper
|
|
202
|
+
* server-side subscription and routes notifications based on subscriptionId.
|
|
203
|
+
*
|
|
204
|
+
* **Key Features:**
|
|
205
|
+
* - Creates server-side subscription with unique subscriptionId
|
|
206
|
+
* - Callback triggered only for messages with matching subscriptionId
|
|
207
|
+
* - Automatic lifecycle management (cleanup on disconnect)
|
|
208
|
+
* - Includes unsubscribe method for proper cleanup
|
|
209
|
+
* - Request-response pattern with error handling
|
|
210
|
+
*
|
|
211
|
+
* **When to use `subscribe()`:**
|
|
212
|
+
* - Creating new subscriptions (account activity, price updates, etc.)
|
|
213
|
+
* - When you need proper cleanup/unsubscribe functionality
|
|
214
|
+
* - Most application use cases
|
|
215
|
+
*
|
|
216
|
+
* **When to use `addChannelCallback()` instead:**
|
|
217
|
+
* - System-wide notifications without server-side subscription
|
|
218
|
+
* - Observing channels managed elsewhere
|
|
219
|
+
* - Debug/logging scenarios
|
|
152
220
|
*
|
|
153
221
|
* @param options - Subscription configuration
|
|
154
222
|
* @param options.channels - Array of channel names to subscribe to
|
|
155
223
|
* @param options.callback - Callback function for handling notifications
|
|
156
|
-
* @
|
|
224
|
+
* @param options.requestId - Optional request ID for testing (will generate UUID if not provided)
|
|
225
|
+
* @param options.channelType - Channel type identifier
|
|
226
|
+
* @returns Subscription object with unsubscribe method
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* // AccountActivityService usage
|
|
231
|
+
* const subscription = await webSocketService.subscribe({
|
|
232
|
+
* channels: ['account-activity.v1.eip155:0:0x1234...'],
|
|
233
|
+
* callback: (notification) => {
|
|
234
|
+
* this.handleAccountActivity(notification.data);
|
|
235
|
+
* }
|
|
236
|
+
* });
|
|
237
|
+
*
|
|
238
|
+
* // Later, clean up
|
|
239
|
+
* await subscription.unsubscribe();
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @see addChannelCallback for local callbacks without server-side subscription
|
|
157
243
|
*/
|
|
158
244
|
export type BackendWebSocketServiceSubscribeAction = {
|
|
159
245
|
type: `BackendWebSocketService:subscribe`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendWebSocketService-method-action-types.d.cts","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAkC;AAEzE
|
|
1
|
+
{"version":3,"file":"BackendWebSocketService-method-action-types.d.cts","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAkC;AAEzE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,uBAAuB,CAAC,2BAA2B,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,uBAAuB,CAAC,wBAAwB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6DAA6D,GAAG;IAC1E,IAAI,EAAE,0DAA0D,CAAC;IACjE,OAAO,EAAE,uBAAuB,CAAC,kCAAkC,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,uBAAuB,CAAC,uBAAuB,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAC5C,oCAAoC,GACpC,uCAAuC,GACvC,8CAA8C,GAC9C,wCAAwC,GACxC,wCAAwC,GACxC,8CAA8C,GAC9C,sDAAsD,GACtD,mDAAmD,GACnD,6DAA6D,GAC7D,+CAA+C,GAC/C,kDAAkD,GAClD,gDAAgD,GAChD,sCAAsC,CAAC"}
|
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { BackendWebSocketService } from "./BackendWebSocketService.mjs";
|
|
6
6
|
/**
|
|
7
|
-
* Establishes WebSocket connection
|
|
7
|
+
* Establishes WebSocket connection with smart reconnection behavior
|
|
8
|
+
*
|
|
9
|
+
* Connection Requirements (all must be true):
|
|
10
|
+
* 1. Feature enabled (isEnabled() = true)
|
|
11
|
+
* 2. Wallet unlocked (checked by getBearerToken)
|
|
12
|
+
* 3. User signed in (checked by getBearerToken)
|
|
13
|
+
*
|
|
14
|
+
* Platform code should call this when app opens/foregrounds.
|
|
15
|
+
* Automatically called on KeyringController:unlock event.
|
|
8
16
|
*
|
|
9
17
|
* @returns Promise that resolves when connection is established
|
|
10
18
|
*/
|
|
@@ -14,8 +22,6 @@ export type BackendWebSocketServiceConnectAction = {
|
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
16
24
|
* Closes WebSocket connection
|
|
17
|
-
*
|
|
18
|
-
* @returns Promise that resolves when disconnection is complete
|
|
19
25
|
*/
|
|
20
26
|
export type BackendWebSocketServiceDisconnectAction = {
|
|
21
27
|
type: `BackendWebSocketService:disconnect`;
|
|
@@ -42,20 +48,41 @@ export type BackendWebSocketServiceForceReconnectionAction = {
|
|
|
42
48
|
handler: BackendWebSocketService['forceReconnection'];
|
|
43
49
|
};
|
|
44
50
|
/**
|
|
45
|
-
* Sends a message through the WebSocket
|
|
51
|
+
* Sends a message through the WebSocket (fire-and-forget, no response expected)
|
|
52
|
+
*
|
|
53
|
+
* This is a low-level method for sending messages without waiting for a response.
|
|
54
|
+
* Most consumers should use `sendRequest()` instead, which handles request-response
|
|
55
|
+
* correlation and provides proper error handling with timeouts.
|
|
56
|
+
*
|
|
57
|
+
* Use this method only when:
|
|
58
|
+
* - You don't need a response from the server
|
|
59
|
+
* - You're implementing custom message protocols
|
|
60
|
+
* - You need fine-grained control over message timing
|
|
46
61
|
*
|
|
47
62
|
* @param message - The message to send
|
|
48
|
-
* @
|
|
63
|
+
* @throws Error if WebSocket is not connected or send fails
|
|
64
|
+
*
|
|
65
|
+
* @see sendRequest for request-response pattern with automatic correlation
|
|
49
66
|
*/
|
|
50
67
|
export type BackendWebSocketServiceSendMessageAction = {
|
|
51
68
|
type: `BackendWebSocketService:sendMessage`;
|
|
52
69
|
handler: BackendWebSocketService['sendMessage'];
|
|
53
70
|
};
|
|
54
71
|
/**
|
|
55
|
-
* Sends a request and waits for a correlated response
|
|
72
|
+
* Sends a request and waits for a correlated response (recommended for most use cases)
|
|
73
|
+
*
|
|
74
|
+
* This is the recommended high-level method for request-response communication.
|
|
75
|
+
* It automatically handles:
|
|
76
|
+
* - Request ID generation and correlation
|
|
77
|
+
* - Response matching with timeout protection
|
|
78
|
+
* - Automatic reconnection on timeout
|
|
79
|
+
* - Proper cleanup of pending requests
|
|
56
80
|
*
|
|
57
|
-
* @param message - The request message
|
|
81
|
+
* @param message - The request message (can include optional requestId for testing)
|
|
58
82
|
* @returns Promise that resolves with the response data
|
|
83
|
+
* @throws Error if WebSocket is not connected, request times out, or response indicates failure
|
|
84
|
+
*
|
|
85
|
+
* @see sendMessage for fire-and-forget messaging without response handling
|
|
59
86
|
*/
|
|
60
87
|
export type BackendWebSocketServiceSendRequestAction = {
|
|
61
88
|
type: `BackendWebSocketService:sendRequest`;
|
|
@@ -101,7 +128,26 @@ export type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {
|
|
|
101
128
|
handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];
|
|
102
129
|
};
|
|
103
130
|
/**
|
|
104
|
-
* Register a callback for specific channels
|
|
131
|
+
* Register a callback for specific channels (local callback only, no server subscription)
|
|
132
|
+
*
|
|
133
|
+
* **Key Difference from `subscribe()`:**
|
|
134
|
+
* - `addChannelCallback()`: Registers a local callback without creating a server-side subscription.
|
|
135
|
+
* The callback triggers on ANY message matching the channel name, regardless of subscriptionId.
|
|
136
|
+
* Useful for system-wide notifications or when you don't control the subscription lifecycle.
|
|
137
|
+
*
|
|
138
|
+
* - `subscribe()`: Creates a proper server-side subscription with a subscriptionId.
|
|
139
|
+
* The callback only triggers for messages with the matching subscriptionId.
|
|
140
|
+
* Includes proper lifecycle management (unsubscribe, automatic cleanup on disconnect).
|
|
141
|
+
*
|
|
142
|
+
* **When to use `addChannelCallback()`:**
|
|
143
|
+
* - Listening to system-wide notifications (e.g., 'system-notifications.v1')
|
|
144
|
+
* - Monitoring channels where subscriptions are managed elsewhere
|
|
145
|
+
* - Debug/logging scenarios where you want to observe all channel messages
|
|
146
|
+
*
|
|
147
|
+
* **When to use `subscribe()` instead:**
|
|
148
|
+
* - Creating new subscriptions that need server-side registration
|
|
149
|
+
* - When you need proper cleanup via unsubscribe
|
|
150
|
+
* - Most application use cases (recommended approach)
|
|
105
151
|
*
|
|
106
152
|
* @param options - Channel callback configuration
|
|
107
153
|
* @param options.channelName - Channel name to match exactly
|
|
@@ -109,22 +155,22 @@ export type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {
|
|
|
109
155
|
*
|
|
110
156
|
* @example
|
|
111
157
|
* ```typescript
|
|
112
|
-
* // Listen to
|
|
113
|
-
* webSocketService.addChannelCallback({
|
|
114
|
-
* channelName: 'account-activity.v1.eip155:0:0x1234...',
|
|
115
|
-
* callback: (notification) => {
|
|
116
|
-
* console.log('Account activity:', notification.data);
|
|
117
|
-
* }
|
|
118
|
-
* });
|
|
119
|
-
*
|
|
120
|
-
* // Listen to system notifications channel
|
|
158
|
+
* // Listen to system notifications (no server subscription needed)
|
|
121
159
|
* webSocketService.addChannelCallback({
|
|
122
160
|
* channelName: 'system-notifications.v1',
|
|
123
161
|
* callback: (notification) => {
|
|
124
162
|
* console.log('System notification:', notification.data);
|
|
125
163
|
* }
|
|
126
164
|
* });
|
|
165
|
+
*
|
|
166
|
+
* // For account-specific subscriptions, use subscribe() instead:
|
|
167
|
+
* // const sub = await webSocketService.subscribe({
|
|
168
|
+
* // channels: ['account-activity.v1.eip155:0:0x1234...'],
|
|
169
|
+
* // callback: (notification) => { ... }
|
|
170
|
+
* // });
|
|
127
171
|
* ```
|
|
172
|
+
*
|
|
173
|
+
* @see subscribe for creating proper server-side subscriptions with lifecycle management
|
|
128
174
|
*/
|
|
129
175
|
export type BackendWebSocketServiceAddChannelCallbackAction = {
|
|
130
176
|
type: `BackendWebSocketService:addChannelCallback`;
|
|
@@ -133,7 +179,7 @@ export type BackendWebSocketServiceAddChannelCallbackAction = {
|
|
|
133
179
|
/**
|
|
134
180
|
* Remove a channel callback
|
|
135
181
|
*
|
|
136
|
-
* @param channelName - The channel name
|
|
182
|
+
* @param channelName - The channel name returned from addChannelCallback
|
|
137
183
|
* @returns True if callback was found and removed, false otherwise
|
|
138
184
|
*/
|
|
139
185
|
export type BackendWebSocketServiceRemoveChannelCallbackAction = {
|
|
@@ -142,18 +188,58 @@ export type BackendWebSocketServiceRemoveChannelCallbackAction = {
|
|
|
142
188
|
};
|
|
143
189
|
/**
|
|
144
190
|
* Get all registered channel callbacks (for debugging)
|
|
191
|
+
*
|
|
192
|
+
* @returns Array of all registered channel callbacks
|
|
145
193
|
*/
|
|
146
194
|
export type BackendWebSocketServiceGetChannelCallbacksAction = {
|
|
147
195
|
type: `BackendWebSocketService:getChannelCallbacks`;
|
|
148
196
|
handler: BackendWebSocketService['getChannelCallbacks'];
|
|
149
197
|
};
|
|
150
198
|
/**
|
|
151
|
-
* Create and manage a subscription with
|
|
199
|
+
* Create and manage a subscription with server-side registration (recommended for most use cases)
|
|
200
|
+
*
|
|
201
|
+
* This is the recommended subscription API for high-level services. It creates a proper
|
|
202
|
+
* server-side subscription and routes notifications based on subscriptionId.
|
|
203
|
+
*
|
|
204
|
+
* **Key Features:**
|
|
205
|
+
* - Creates server-side subscription with unique subscriptionId
|
|
206
|
+
* - Callback triggered only for messages with matching subscriptionId
|
|
207
|
+
* - Automatic lifecycle management (cleanup on disconnect)
|
|
208
|
+
* - Includes unsubscribe method for proper cleanup
|
|
209
|
+
* - Request-response pattern with error handling
|
|
210
|
+
*
|
|
211
|
+
* **When to use `subscribe()`:**
|
|
212
|
+
* - Creating new subscriptions (account activity, price updates, etc.)
|
|
213
|
+
* - When you need proper cleanup/unsubscribe functionality
|
|
214
|
+
* - Most application use cases
|
|
215
|
+
*
|
|
216
|
+
* **When to use `addChannelCallback()` instead:**
|
|
217
|
+
* - System-wide notifications without server-side subscription
|
|
218
|
+
* - Observing channels managed elsewhere
|
|
219
|
+
* - Debug/logging scenarios
|
|
152
220
|
*
|
|
153
221
|
* @param options - Subscription configuration
|
|
154
222
|
* @param options.channels - Array of channel names to subscribe to
|
|
155
223
|
* @param options.callback - Callback function for handling notifications
|
|
156
|
-
* @
|
|
224
|
+
* @param options.requestId - Optional request ID for testing (will generate UUID if not provided)
|
|
225
|
+
* @param options.channelType - Channel type identifier
|
|
226
|
+
* @returns Subscription object with unsubscribe method
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* // AccountActivityService usage
|
|
231
|
+
* const subscription = await webSocketService.subscribe({
|
|
232
|
+
* channels: ['account-activity.v1.eip155:0:0x1234...'],
|
|
233
|
+
* callback: (notification) => {
|
|
234
|
+
* this.handleAccountActivity(notification.data);
|
|
235
|
+
* }
|
|
236
|
+
* });
|
|
237
|
+
*
|
|
238
|
+
* // Later, clean up
|
|
239
|
+
* await subscription.unsubscribe();
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @see addChannelCallback for local callbacks without server-side subscription
|
|
157
243
|
*/
|
|
158
244
|
export type BackendWebSocketServiceSubscribeAction = {
|
|
159
245
|
type: `BackendWebSocketService:subscribe`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendWebSocketService-method-action-types.d.mts","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAkC;AAEzE
|
|
1
|
+
{"version":3,"file":"BackendWebSocketService-method-action-types.d.mts","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAkC;AAEzE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,uBAAuB,CAAC,2BAA2B,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,uBAAuB,CAAC,wBAAwB,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6DAA6D,GAAG;IAC1E,IAAI,EAAE,0DAA0D,CAAC;IACjE,OAAO,EAAE,uBAAuB,CAAC,kCAAkC,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,uBAAuB,CAAC,uBAAuB,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAC5C,oCAAoC,GACpC,uCAAuC,GACvC,8CAA8C,GAC9C,wCAAwC,GACxC,wCAAwC,GACxC,8CAA8C,GAC9C,sDAAsD,GACtD,mDAAmD,GACnD,6DAA6D,GAC7D,+CAA+C,GAC/C,kDAAkD,GAClD,gDAAgD,GAChD,sCAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendWebSocketService-method-action-types.mjs","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { BackendWebSocketService } from './BackendWebSocketService';\n\n/**\n * Establishes WebSocket connection\n *\n * @returns Promise that resolves when connection is established\n */\nexport type BackendWebSocketServiceConnectAction = {\n type: `BackendWebSocketService:connect`;\n handler: BackendWebSocketService['connect'];\n};\n\n/**\n * Closes WebSocket connection\n *\n * @returns Promise that resolves when disconnection is complete\n */\nexport type BackendWebSocketServiceDisconnectAction = {\n type: `BackendWebSocketService:disconnect`;\n handler: BackendWebSocketService['disconnect'];\n};\n\n/**\n * Forces a WebSocket reconnection to clean up subscription state\n *\n * This method is useful when subscription state may be out of sync and needs to be reset.\n * It performs a controlled disconnect-then-reconnect sequence:\n * - Disconnects cleanly to trigger subscription cleanup\n * - Schedules reconnection with exponential backoff to prevent rapid loops\n * - All subscriptions will be cleaned up automatically on disconnect\n *\n * Use cases:\n * - Recovering from subscription/unsubscription issues\n * - Cleaning up orphaned subscriptions\n * - Forcing a fresh subscription state\n *\n * @returns Promise that resolves when disconnection is complete (reconnection is scheduled)\n */\nexport type BackendWebSocketServiceForceReconnectionAction = {\n type: `BackendWebSocketService:forceReconnection`;\n handler: BackendWebSocketService['forceReconnection'];\n};\n\n/**\n * Sends a message through the WebSocket\n *\n * @param message - The message to send\n * @returns Promise that resolves when message is sent\n */\nexport type BackendWebSocketServiceSendMessageAction = {\n type: `BackendWebSocketService:sendMessage`;\n handler: BackendWebSocketService['sendMessage'];\n};\n\n/**\n * Sends a request and waits for a correlated response\n *\n * @param message - The request message\n * @returns Promise that resolves with the response data\n */\nexport type BackendWebSocketServiceSendRequestAction = {\n type: `BackendWebSocketService:sendRequest`;\n handler: BackendWebSocketService['sendRequest'];\n};\n\n/**\n * Gets current connection information\n *\n * @returns Current connection status and details\n */\nexport type BackendWebSocketServiceGetConnectionInfoAction = {\n type: `BackendWebSocketService:getConnectionInfo`;\n handler: BackendWebSocketService['getConnectionInfo'];\n};\n\n/**\n * Gets all subscription information for a specific channel\n *\n * @param channel - The channel name to look up\n * @returns Array of subscription details for all subscriptions containing the channel\n */\nexport type BackendWebSocketServiceGetSubscriptionsByChannelAction = {\n type: `BackendWebSocketService:getSubscriptionsByChannel`;\n handler: BackendWebSocketService['getSubscriptionsByChannel'];\n};\n\n/**\n * Checks if a channel has a subscription\n *\n * @param channel - The channel name to check\n * @returns True if the channel has a subscription, false otherwise\n */\nexport type BackendWebSocketServiceChannelHasSubscriptionAction = {\n type: `BackendWebSocketService:channelHasSubscription`;\n handler: BackendWebSocketService['channelHasSubscription'];\n};\n\n/**\n * Finds all subscriptions that have channels starting with the specified prefix\n *\n * @param channelPrefix - The channel prefix to search for (e.g., \"account-activity.v1\")\n * @returns Array of subscription info for matching subscriptions\n */\nexport type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {\n type: `BackendWebSocketService:findSubscriptionsByChannelPrefix`;\n handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];\n};\n\n/**\n * Register a callback for specific channels\n *\n * @param options - Channel callback configuration\n * @param options.channelName - Channel name to match exactly\n * @param options.callback - Function to call when channel matches\n *\n * @example\n * ```typescript\n * // Listen to specific account activity channel\n * webSocketService.addChannelCallback({\n * channelName: 'account-activity.v1.eip155:0:0x1234...',\n * callback: (notification) => {\n * console.log('Account activity:', notification.data);\n * }\n * });\n *\n * // Listen to system notifications channel\n * webSocketService.addChannelCallback({\n * channelName: 'system-notifications.v1',\n * callback: (notification) => {\n * console.log('System notification:', notification.data);\n * }\n * });\n * ```\n */\nexport type BackendWebSocketServiceAddChannelCallbackAction = {\n type: `BackendWebSocketService:addChannelCallback`;\n handler: BackendWebSocketService['addChannelCallback'];\n};\n\n/**\n * Remove a channel callback\n *\n * @param channelName - The channel name to remove callback for\n * @returns True if callback was found and removed, false otherwise\n */\nexport type BackendWebSocketServiceRemoveChannelCallbackAction = {\n type: `BackendWebSocketService:removeChannelCallback`;\n handler: BackendWebSocketService['removeChannelCallback'];\n};\n\n/**\n * Get all registered channel callbacks (for debugging)\n */\nexport type BackendWebSocketServiceGetChannelCallbacksAction = {\n type: `BackendWebSocketService:getChannelCallbacks`;\n handler: BackendWebSocketService['getChannelCallbacks'];\n};\n\n/**\n * Create and manage a subscription with direct callback routing\n *\n * @param options - Subscription configuration\n * @param options.channels - Array of channel names to subscribe to\n * @param options.callback - Callback function for handling notifications\n * @returns Promise that resolves with subscription object containing unsubscribe method\n */\nexport type BackendWebSocketServiceSubscribeAction = {\n type: `BackendWebSocketService:subscribe`;\n handler: BackendWebSocketService['subscribe'];\n};\n\n/**\n * Union of all BackendWebSocketService action types.\n */\nexport type BackendWebSocketServiceMethodActions =\n | BackendWebSocketServiceConnectAction\n | BackendWebSocketServiceDisconnectAction\n | BackendWebSocketServiceForceReconnectionAction\n | BackendWebSocketServiceSendMessageAction\n | BackendWebSocketServiceSendRequestAction\n | BackendWebSocketServiceGetConnectionInfoAction\n | BackendWebSocketServiceGetSubscriptionsByChannelAction\n | BackendWebSocketServiceChannelHasSubscriptionAction\n | BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction\n | BackendWebSocketServiceAddChannelCallbackAction\n | BackendWebSocketServiceRemoveChannelCallbackAction\n | BackendWebSocketServiceGetChannelCallbacksAction\n | BackendWebSocketServiceSubscribeAction;\n"]}
|
|
1
|
+
{"version":3,"file":"BackendWebSocketService-method-action-types.mjs","sourceRoot":"","sources":["../src/BackendWebSocketService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { BackendWebSocketService } from './BackendWebSocketService';\n\n/**\n * Establishes WebSocket connection with smart reconnection behavior\n *\n * Connection Requirements (all must be true):\n * 1. Feature enabled (isEnabled() = true)\n * 2. Wallet unlocked (checked by getBearerToken)\n * 3. User signed in (checked by getBearerToken)\n *\n * Platform code should call this when app opens/foregrounds.\n * Automatically called on KeyringController:unlock event.\n *\n * @returns Promise that resolves when connection is established\n */\nexport type BackendWebSocketServiceConnectAction = {\n type: `BackendWebSocketService:connect`;\n handler: BackendWebSocketService['connect'];\n};\n\n/**\n * Closes WebSocket connection\n */\nexport type BackendWebSocketServiceDisconnectAction = {\n type: `BackendWebSocketService:disconnect`;\n handler: BackendWebSocketService['disconnect'];\n};\n\n/**\n * Forces a WebSocket reconnection to clean up subscription state\n *\n * This method is useful when subscription state may be out of sync and needs to be reset.\n * It performs a controlled disconnect-then-reconnect sequence:\n * - Disconnects cleanly to trigger subscription cleanup\n * - Schedules reconnection with exponential backoff to prevent rapid loops\n * - All subscriptions will be cleaned up automatically on disconnect\n *\n * Use cases:\n * - Recovering from subscription/unsubscription issues\n * - Cleaning up orphaned subscriptions\n * - Forcing a fresh subscription state\n *\n * @returns Promise that resolves when disconnection is complete (reconnection is scheduled)\n */\nexport type BackendWebSocketServiceForceReconnectionAction = {\n type: `BackendWebSocketService:forceReconnection`;\n handler: BackendWebSocketService['forceReconnection'];\n};\n\n/**\n * Sends a message through the WebSocket (fire-and-forget, no response expected)\n *\n * This is a low-level method for sending messages without waiting for a response.\n * Most consumers should use `sendRequest()` instead, which handles request-response\n * correlation and provides proper error handling with timeouts.\n *\n * Use this method only when:\n * - You don't need a response from the server\n * - You're implementing custom message protocols\n * - You need fine-grained control over message timing\n *\n * @param message - The message to send\n * @throws Error if WebSocket is not connected or send fails\n *\n * @see sendRequest for request-response pattern with automatic correlation\n */\nexport type BackendWebSocketServiceSendMessageAction = {\n type: `BackendWebSocketService:sendMessage`;\n handler: BackendWebSocketService['sendMessage'];\n};\n\n/**\n * Sends a request and waits for a correlated response (recommended for most use cases)\n *\n * This is the recommended high-level method for request-response communication.\n * It automatically handles:\n * - Request ID generation and correlation\n * - Response matching with timeout protection\n * - Automatic reconnection on timeout\n * - Proper cleanup of pending requests\n *\n * @param message - The request message (can include optional requestId for testing)\n * @returns Promise that resolves with the response data\n * @throws Error if WebSocket is not connected, request times out, or response indicates failure\n *\n * @see sendMessage for fire-and-forget messaging without response handling\n */\nexport type BackendWebSocketServiceSendRequestAction = {\n type: `BackendWebSocketService:sendRequest`;\n handler: BackendWebSocketService['sendRequest'];\n};\n\n/**\n * Gets current connection information\n *\n * @returns Current connection status and details\n */\nexport type BackendWebSocketServiceGetConnectionInfoAction = {\n type: `BackendWebSocketService:getConnectionInfo`;\n handler: BackendWebSocketService['getConnectionInfo'];\n};\n\n/**\n * Gets all subscription information for a specific channel\n *\n * @param channel - The channel name to look up\n * @returns Array of subscription details for all subscriptions containing the channel\n */\nexport type BackendWebSocketServiceGetSubscriptionsByChannelAction = {\n type: `BackendWebSocketService:getSubscriptionsByChannel`;\n handler: BackendWebSocketService['getSubscriptionsByChannel'];\n};\n\n/**\n * Checks if a channel has a subscription\n *\n * @param channel - The channel name to check\n * @returns True if the channel has a subscription, false otherwise\n */\nexport type BackendWebSocketServiceChannelHasSubscriptionAction = {\n type: `BackendWebSocketService:channelHasSubscription`;\n handler: BackendWebSocketService['channelHasSubscription'];\n};\n\n/**\n * Finds all subscriptions that have channels starting with the specified prefix\n *\n * @param channelPrefix - The channel prefix to search for (e.g., \"account-activity.v1\")\n * @returns Array of subscription info for matching subscriptions\n */\nexport type BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction = {\n type: `BackendWebSocketService:findSubscriptionsByChannelPrefix`;\n handler: BackendWebSocketService['findSubscriptionsByChannelPrefix'];\n};\n\n/**\n * Register a callback for specific channels (local callback only, no server subscription)\n *\n * **Key Difference from `subscribe()`:**\n * - `addChannelCallback()`: Registers a local callback without creating a server-side subscription.\n * The callback triggers on ANY message matching the channel name, regardless of subscriptionId.\n * Useful for system-wide notifications or when you don't control the subscription lifecycle.\n *\n * - `subscribe()`: Creates a proper server-side subscription with a subscriptionId.\n * The callback only triggers for messages with the matching subscriptionId.\n * Includes proper lifecycle management (unsubscribe, automatic cleanup on disconnect).\n *\n * **When to use `addChannelCallback()`:**\n * - Listening to system-wide notifications (e.g., 'system-notifications.v1')\n * - Monitoring channels where subscriptions are managed elsewhere\n * - Debug/logging scenarios where you want to observe all channel messages\n *\n * **When to use `subscribe()` instead:**\n * - Creating new subscriptions that need server-side registration\n * - When you need proper cleanup via unsubscribe\n * - Most application use cases (recommended approach)\n *\n * @param options - Channel callback configuration\n * @param options.channelName - Channel name to match exactly\n * @param options.callback - Function to call when channel matches\n *\n * @example\n * ```typescript\n * // Listen to system notifications (no server subscription needed)\n * webSocketService.addChannelCallback({\n * channelName: 'system-notifications.v1',\n * callback: (notification) => {\n * console.log('System notification:', notification.data);\n * }\n * });\n *\n * // For account-specific subscriptions, use subscribe() instead:\n * // const sub = await webSocketService.subscribe({\n * // channels: ['account-activity.v1.eip155:0:0x1234...'],\n * // callback: (notification) => { ... }\n * // });\n * ```\n *\n * @see subscribe for creating proper server-side subscriptions with lifecycle management\n */\nexport type BackendWebSocketServiceAddChannelCallbackAction = {\n type: `BackendWebSocketService:addChannelCallback`;\n handler: BackendWebSocketService['addChannelCallback'];\n};\n\n/**\n * Remove a channel callback\n *\n * @param channelName - The channel name returned from addChannelCallback\n * @returns True if callback was found and removed, false otherwise\n */\nexport type BackendWebSocketServiceRemoveChannelCallbackAction = {\n type: `BackendWebSocketService:removeChannelCallback`;\n handler: BackendWebSocketService['removeChannelCallback'];\n};\n\n/**\n * Get all registered channel callbacks (for debugging)\n *\n * @returns Array of all registered channel callbacks\n */\nexport type BackendWebSocketServiceGetChannelCallbacksAction = {\n type: `BackendWebSocketService:getChannelCallbacks`;\n handler: BackendWebSocketService['getChannelCallbacks'];\n};\n\n/**\n * Create and manage a subscription with server-side registration (recommended for most use cases)\n *\n * This is the recommended subscription API for high-level services. It creates a proper\n * server-side subscription and routes notifications based on subscriptionId.\n *\n * **Key Features:**\n * - Creates server-side subscription with unique subscriptionId\n * - Callback triggered only for messages with matching subscriptionId\n * - Automatic lifecycle management (cleanup on disconnect)\n * - Includes unsubscribe method for proper cleanup\n * - Request-response pattern with error handling\n *\n * **When to use `subscribe()`:**\n * - Creating new subscriptions (account activity, price updates, etc.)\n * - When you need proper cleanup/unsubscribe functionality\n * - Most application use cases\n *\n * **When to use `addChannelCallback()` instead:**\n * - System-wide notifications without server-side subscription\n * - Observing channels managed elsewhere\n * - Debug/logging scenarios\n *\n * @param options - Subscription configuration\n * @param options.channels - Array of channel names to subscribe to\n * @param options.callback - Callback function for handling notifications\n * @param options.requestId - Optional request ID for testing (will generate UUID if not provided)\n * @param options.channelType - Channel type identifier\n * @returns Subscription object with unsubscribe method\n *\n * @example\n * ```typescript\n * // AccountActivityService usage\n * const subscription = await webSocketService.subscribe({\n * channels: ['account-activity.v1.eip155:0:0x1234...'],\n * callback: (notification) => {\n * this.handleAccountActivity(notification.data);\n * }\n * });\n *\n * // Later, clean up\n * await subscription.unsubscribe();\n * ```\n *\n * @see addChannelCallback for local callbacks without server-side subscription\n */\nexport type BackendWebSocketServiceSubscribeAction = {\n type: `BackendWebSocketService:subscribe`;\n handler: BackendWebSocketService['subscribe'];\n};\n\n/**\n * Union of all BackendWebSocketService action types.\n */\nexport type BackendWebSocketServiceMethodActions =\n | BackendWebSocketServiceConnectAction\n | BackendWebSocketServiceDisconnectAction\n | BackendWebSocketServiceForceReconnectionAction\n | BackendWebSocketServiceSendMessageAction\n | BackendWebSocketServiceSendRequestAction\n | BackendWebSocketServiceGetConnectionInfoAction\n | BackendWebSocketServiceGetSubscriptionsByChannelAction\n | BackendWebSocketServiceChannelHasSubscriptionAction\n | BackendWebSocketServiceFindSubscriptionsByChannelPrefixAction\n | BackendWebSocketServiceAddChannelCallbackAction\n | BackendWebSocketServiceRemoveChannelCallbackAction\n | BackendWebSocketServiceGetChannelCallbacksAction\n | BackendWebSocketServiceSubscribeAction;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/core-backend",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-preview-e3eb8eca",
|
|
4
4
|
"description": "Core backend services for MetaMask",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@metamask/controller-utils": "^11.
|
|
51
|
+
"@metamask/controller-utils": "^11.16.0",
|
|
52
52
|
"@metamask/messenger": "^0.3.0",
|
|
53
|
-
"@metamask/profile-sync-controller": "^
|
|
53
|
+
"@metamask/profile-sync-controller": "^27.0.0",
|
|
54
54
|
"@metamask/utils": "^11.8.1",
|
|
55
55
|
"uuid": "^8.3.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@metamask/accounts-controller": "^
|
|
58
|
+
"@metamask/accounts-controller": "^35.0.0",
|
|
59
59
|
"@metamask/auto-changelog": "^3.4.4",
|
|
60
|
-
"@metamask/keyring-controller": "^
|
|
60
|
+
"@metamask/keyring-controller": "^25.0.0",
|
|
61
61
|
"@ts-bridge/cli": "^0.6.4",
|
|
62
62
|
"@types/jest": "^27.4.1",
|
|
63
63
|
"deepmerge": "^4.2.2",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"typescript": "~5.3.3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@metamask/accounts-controller": "^
|
|
73
|
-
"@metamask/keyring-controller": "^
|
|
72
|
+
"@metamask/accounts-controller": "^35.0.0",
|
|
73
|
+
"@metamask/keyring-controller": "^25.0.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": "^18.18 || >=20"
|