@metamask-previews/core-backend 6.2.2-preview-fbc0aed37 → 6.2.2-preview-e5cef32c6

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/base-client.cjs +5 -3
  3. package/dist/api/base-client.cjs.map +1 -1
  4. package/dist/api/base-client.d.cts +1 -1
  5. package/dist/api/base-client.d.cts.map +1 -1
  6. package/dist/api/base-client.d.mts +1 -1
  7. package/dist/api/base-client.d.mts.map +1 -1
  8. package/dist/api/base-client.mjs +5 -3
  9. package/dist/api/base-client.mjs.map +1 -1
  10. package/dist/index.cjs +10 -3
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +6 -4
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +6 -4
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +6 -2
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/ws/AccountActivityService-method-action-types.cjs.map +1 -0
  19. package/dist/ws/AccountActivityService-method-action-types.d.cts.map +1 -0
  20. package/dist/ws/AccountActivityService-method-action-types.d.mts.map +1 -0
  21. package/dist/ws/AccountActivityService-method-action-types.mjs.map +1 -0
  22. package/dist/{AccountActivityService.cjs → ws/AccountActivityService.cjs} +1 -1
  23. package/dist/ws/AccountActivityService.cjs.map +1 -0
  24. package/dist/{AccountActivityService.d.cts → ws/AccountActivityService.d.cts} +1 -1
  25. package/dist/ws/AccountActivityService.d.cts.map +1 -0
  26. package/dist/{AccountActivityService.d.mts → ws/AccountActivityService.d.mts} +1 -1
  27. package/dist/ws/AccountActivityService.d.mts.map +1 -0
  28. package/dist/{AccountActivityService.mjs → ws/AccountActivityService.mjs} +1 -1
  29. package/dist/ws/AccountActivityService.mjs.map +1 -0
  30. package/dist/ws/BackendWebSocketService-method-action-types.cjs.map +1 -0
  31. package/dist/ws/BackendWebSocketService-method-action-types.d.cts.map +1 -0
  32. package/dist/ws/BackendWebSocketService-method-action-types.d.mts.map +1 -0
  33. package/dist/ws/BackendWebSocketService-method-action-types.mjs.map +1 -0
  34. package/dist/{BackendWebSocketService.cjs → ws/BackendWebSocketService.cjs} +1 -1
  35. package/dist/ws/BackendWebSocketService.cjs.map +1 -0
  36. package/dist/ws/BackendWebSocketService.d.cts.map +1 -0
  37. package/dist/ws/BackendWebSocketService.d.mts.map +1 -0
  38. package/dist/{BackendWebSocketService.mjs → ws/BackendWebSocketService.mjs} +1 -1
  39. package/dist/ws/BackendWebSocketService.mjs.map +1 -0
  40. package/dist/ws/ohlcv/OHLCVService-method-action-types.cjs +7 -0
  41. package/dist/ws/ohlcv/OHLCVService-method-action-types.cjs.map +1 -0
  42. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.cts +35 -0
  43. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.cts.map +1 -0
  44. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.mts +35 -0
  45. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.mts.map +1 -0
  46. package/dist/ws/ohlcv/OHLCVService-method-action-types.mjs +6 -0
  47. package/dist/ws/ohlcv/OHLCVService-method-action-types.mjs.map +1 -0
  48. package/dist/ws/ohlcv/OHLCVService.cjs +359 -0
  49. package/dist/ws/ohlcv/OHLCVService.cjs.map +1 -0
  50. package/dist/ws/ohlcv/OHLCVService.d.cts +109 -0
  51. package/dist/ws/ohlcv/OHLCVService.d.cts.map +1 -0
  52. package/dist/ws/ohlcv/OHLCVService.d.mts +109 -0
  53. package/dist/ws/ohlcv/OHLCVService.d.mts.map +1 -0
  54. package/dist/ws/ohlcv/OHLCVService.mjs +355 -0
  55. package/dist/ws/ohlcv/OHLCVService.mjs.map +1 -0
  56. package/dist/ws/ohlcv/index.cjs +9 -0
  57. package/dist/ws/ohlcv/index.cjs.map +1 -0
  58. package/dist/ws/ohlcv/index.d.cts +5 -0
  59. package/dist/ws/ohlcv/index.d.cts.map +1 -0
  60. package/dist/ws/ohlcv/index.d.mts +5 -0
  61. package/dist/ws/ohlcv/index.d.mts.map +1 -0
  62. package/dist/ws/ohlcv/index.mjs +3 -0
  63. package/dist/ws/ohlcv/index.mjs.map +1 -0
  64. package/dist/ws/ohlcv/types.cjs +6 -0
  65. package/dist/ws/ohlcv/types.cjs.map +1 -0
  66. package/dist/ws/ohlcv/types.d.cts +32 -0
  67. package/dist/ws/ohlcv/types.d.cts.map +1 -0
  68. package/dist/ws/ohlcv/types.d.mts +32 -0
  69. package/dist/ws/ohlcv/types.d.mts.map +1 -0
  70. package/dist/ws/ohlcv/types.mjs +5 -0
  71. package/dist/ws/ohlcv/types.mjs.map +1 -0
  72. package/package.json +3 -2
  73. package/dist/AccountActivityService-method-action-types.cjs.map +0 -1
  74. package/dist/AccountActivityService-method-action-types.d.cts.map +0 -1
  75. package/dist/AccountActivityService-method-action-types.d.mts.map +0 -1
  76. package/dist/AccountActivityService-method-action-types.mjs.map +0 -1
  77. package/dist/AccountActivityService.cjs.map +0 -1
  78. package/dist/AccountActivityService.d.cts.map +0 -1
  79. package/dist/AccountActivityService.d.mts.map +0 -1
  80. package/dist/AccountActivityService.mjs.map +0 -1
  81. package/dist/BackendWebSocketService-method-action-types.cjs.map +0 -1
  82. package/dist/BackendWebSocketService-method-action-types.d.cts.map +0 -1
  83. package/dist/BackendWebSocketService-method-action-types.d.mts.map +0 -1
  84. package/dist/BackendWebSocketService-method-action-types.mjs.map +0 -1
  85. package/dist/BackendWebSocketService.cjs.map +0 -1
  86. package/dist/BackendWebSocketService.d.cts.map +0 -1
  87. package/dist/BackendWebSocketService.d.mts.map +0 -1
  88. package/dist/BackendWebSocketService.mjs.map +0 -1
  89. /package/dist/{AccountActivityService-method-action-types.cjs → ws/AccountActivityService-method-action-types.cjs} +0 -0
  90. /package/dist/{AccountActivityService-method-action-types.d.cts → ws/AccountActivityService-method-action-types.d.cts} +0 -0
  91. /package/dist/{AccountActivityService-method-action-types.d.mts → ws/AccountActivityService-method-action-types.d.mts} +0 -0
  92. /package/dist/{AccountActivityService-method-action-types.mjs → ws/AccountActivityService-method-action-types.mjs} +0 -0
  93. /package/dist/{BackendWebSocketService-method-action-types.cjs → ws/BackendWebSocketService-method-action-types.cjs} +0 -0
  94. /package/dist/{BackendWebSocketService-method-action-types.d.cts → ws/BackendWebSocketService-method-action-types.d.cts} +0 -0
  95. /package/dist/{BackendWebSocketService-method-action-types.d.mts → ws/BackendWebSocketService-method-action-types.d.mts} +0 -0
  96. /package/dist/{BackendWebSocketService-method-action-types.mjs → ws/BackendWebSocketService-method-action-types.mjs} +0 -0
  97. /package/dist/{BackendWebSocketService.d.cts → ws/BackendWebSocketService.d.cts} +0 -0
  98. /package/dist/{BackendWebSocketService.d.mts → ws/BackendWebSocketService.d.mts} +0 -0
package/CHANGELOG.md CHANGED
@@ -7,10 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add `OHLCVService` for real-time OHLCV (candlestick) data streaming via WebSocket ([#8695](https://github.com/MetaMask/core/pull/8695))
13
+ - Wraps `BackendWebSocketService` through the messenger pattern to provide subscribe/unsubscribe semantics for market-data OHLCV channels
14
+ - Includes reference counting, grace-period unsubscribe, idempotency checks, chain-status forwarding, and automatic resubscription on reconnect
15
+ - Export new types `OHLCVBar`, `OHLCVSubscriptionOptions`, `OHLCVSystemNotificationData`, `OHLCVServiceOptions`, `OHLCVServiceActions`, `OHLCVServiceAllowedActions`, `OHLCVServiceBarUpdatedEvent`, `OHLCVServiceChainStatusChangedEvent`, `OHLCVServiceSubscriptionErrorEvent`, `OHLCVServiceEvents`, `OHLCVServiceAllowedEvents`, and `OHLCVServiceMessenger` ([#8695](https://github.com/MetaMask/core/pull/8695))
16
+ - Export new constants `OHLCV_SERVICE_ALLOWED_ACTIONS` and `OHLCV_SERVICE_ALLOWED_EVENTS` for configuring the messenger ([#8695](https://github.com/MetaMask/core/pull/8695))
17
+
10
18
  ### Changed
11
19
 
12
20
  - Bump `@metamask/accounts-controller` from `^38.1.0` to `^38.1.1` ([#8774](https://github.com/MetaMask/core/pull/8774))
13
21
  - Bump `@metamask/controller-utils` from `^12.0.0` to `^12.1.0` ([#8774](https://github.com/MetaMask/core/pull/8774))
22
+ - Bump `@metamask/profile-sync-controller` from `^28.0.2` to `^28.1.0` ([#8783](https://github.com/MetaMask/core/pull/8783))
23
+
24
+ ### Fixed
25
+
26
+ - Update HTTP headers from `X-Client-Product`/`X-Client-Version` to `x-metamask-clientproduct`/`x-metamask-clientversion` ([#8798](https://github.com/MetaMask/core/pull/8798))
27
+ - Remove default `clientVersion` value of `1.0.0`; the `x-metamask-clientversion` header is now only sent when `clientVersion` is explicitly provided ([#8798](https://github.com/MetaMask/core/pull/8798))
14
28
 
15
29
  ## [6.2.2]
16
30
 
@@ -55,7 +55,7 @@ class BaseApiClient {
55
55
  constructor(options) {
56
56
  _BaseApiClient_queryClientInstance.set(this, void 0);
57
57
  this.clientProduct = options.clientProduct;
58
- this.clientVersion = options.clientVersion ?? '1.0.0';
58
+ this.clientVersion = options.clientVersion;
59
59
  this.getBearerToken = options.getBearerToken;
60
60
  __classPrivateFieldSet(this, _BaseApiClient_queryClientInstance, options.queryClient ??
61
61
  new query_core_1.QueryClient({
@@ -97,9 +97,11 @@ class BaseApiClient {
97
97
  }
98
98
  const headers = {
99
99
  'Content-Type': 'application/json',
100
- 'X-Client-Product': this.clientProduct,
101
- 'X-Client-Version': this.clientVersion,
100
+ 'x-metamask-clientproduct': this.clientProduct,
102
101
  };
102
+ if (this.clientVersion) {
103
+ headers['x-metamask-clientversion'] = this.clientVersion;
104
+ }
103
105
  // Get bearer token using fetchQuery for automatic deduplication
104
106
  if (this.getBearerToken) {
105
107
  const queryKey = exports.authQueryKeys.bearerToken();
@@ -1 +1 @@
1
- {"version":3,"file":"base-client.cjs","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;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,KAAK,CAAC,2BAA2B,CAAC,CAAC;wBAC/C,CAAC;wBACD,OAAO,MAAM,CAAC;oBAChB,CAAC;oBACD,SAAS,EAAE,0BAAW,CAAC,UAAU;oBACjC,KAAK,EAAE,KAAK,EAAE,4BAA4B;iBAC3C,CAAC,CAAC;gBAEH,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,oDAAoD;YACtD,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;YAC3C,MAAM,EAAE,KAAK;YACb,OAAO;YACP,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,IAAI,IAAa,CAAC;YAClB,IAAI,CAAC;gBACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,iEAAiE;YACnE,CAAC;YACD,MAAM,IAAI,wBAAS,CACjB,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,EACjD,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,UAAU,EACnB,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;AA5ID,sCA4IC","sourcesContent":["/**\n * Base API Client - Shared HTTP functionality for all API clients.\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\nimport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\n\n// Auth query keys - shared for token management across clients\nexport const authQueryKeys = {\n bearerToken: (): QueryKey => ['auth', 'bearerToken'],\n} as const;\n\nexport type { ApiPlatformClientOptions };\n\n/**\n * Internal fetch options for HTTP requests.\n */\nexport type InternalFetchOptions = {\n signal?: AbortSignal;\n params?: Record<\n string,\n string | string[] | number | number[] | boolean | undefined\n >;\n};\n\n/**\n * Base API Client with shared HTTP and caching functionality.\n * Extended by all specific API clients.\n */\nexport class BaseApiClient {\n protected readonly clientProduct: string;\n\n protected readonly clientVersion: string;\n\n protected readonly getBearerToken?: () => Promise<string | undefined>;\n\n readonly #queryClientInstance: QueryClient;\n\n /**\n * Get the underlying QueryClient instance.\n * Exposed for cache management operations.\n *\n * @returns The QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#queryClientInstance;\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#queryClientInstance.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n\n constructor(options: ApiPlatformClientOptions) {\n this.clientProduct = options.clientProduct;\n this.clientVersion = options.clientVersion ?? '1.0.0';\n this.getBearerToken = options.getBearerToken;\n\n this.#queryClientInstance =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n }\n\n /**\n * Internal HTTP fetch method with authentication and error handling.\n *\n * @param baseUrl - The base URL for the API.\n * @param path - The API endpoint path.\n * @param options - Optional fetch configuration.\n * @returns The parsed JSON response.\n */\n protected async fetch<ResponseType>(\n baseUrl: string,\n path: string,\n options?: InternalFetchOptions,\n ): Promise<ResponseType> {\n const url = new URL(path, baseUrl);\n\n if (options?.params) {\n for (const [key, value] of Object.entries(options.params)) {\n if (value === undefined) {\n continue;\n }\n if (Array.isArray(value)) {\n // Convert array values (including number[]) to comma-separated string\n url.searchParams.set(key, value.map(String).join(','));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'X-Client-Product': this.clientProduct,\n 'X-Client-Version': this.clientVersion,\n };\n\n // Get bearer token using fetchQuery for automatic deduplication\n if (this.getBearerToken) {\n const queryKey = authQueryKeys.bearerToken();\n const { getBearerToken } = this;\n\n try {\n // fetchQuery handles caching and deduplicates concurrent requests\n const token = await this.#queryClientInstance.fetchQuery({\n queryKey,\n queryFn: async () => {\n const result = await getBearerToken();\n // Throw if no token - prevents caching null/undefined\n // so subsequent requests can retry (e.g., after user logs in)\n if (!result) {\n throw new Error('No bearer token available');\n }\n return result;\n },\n staleTime: STALE_TIMES.AUTH_TOKEN,\n retry: false, // Don't retry auth failures\n });\n\n headers.Authorization = `Bearer ${token}`;\n } catch {\n // No token available - continue without auth header\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n // Response body is not JSON or is empty, leave body as undefined\n }\n throw new HttpError(\n `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n url.toString(),\n body,\n );\n }\n\n return response.json() as Promise<ResponseType>;\n }\n}\n\n// Re-export constants for use by API clients\nexport { API_URLS, STALE_TIMES, GC_TIMES, HttpError };\n"]}
1
+ {"version":3,"file":"base-client.cjs","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;AAEH,qDAAmD;AAGnD,qDAOwB;AA2Kf,yFAjLP,uBAAQ,OAiLO;AAAE,4FAhLjB,0BAAW,OAgLiB;AAAE,yFA/K9B,uBAAQ,OA+K8B;AAAE,0FA5KxC,wBAAS,OA4KwC;AAxKnD,+DAA+D;AAClD,QAAA,aAAa,GAAG;IAC3B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EAAE,4BAA4B;iBAC3C,CAAC,CAAC;gBAEH,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,oDAAoD;YACtD,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;YAC3C,MAAM,EAAE,KAAK;YACb,OAAO;YACP,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,IAAI,IAAa,CAAC;YAClB,IAAI,CAAC;gBACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,iEAAiE;YACnE,CAAC;YACD,MAAM,IAAI,wBAAS,CACjB,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,EACjD,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,UAAU,EACnB,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;AA/ID,sCA+IC","sourcesContent":["/**\n * Base API Client - Shared HTTP functionality for all API clients.\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\nimport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\n\n// Auth query keys - shared for token management across clients\nexport const authQueryKeys = {\n bearerToken: (): QueryKey => ['auth', 'bearerToken'],\n} as const;\n\nexport type { ApiPlatformClientOptions };\n\n/**\n * Internal fetch options for HTTP requests.\n */\nexport type InternalFetchOptions = {\n signal?: AbortSignal;\n params?: Record<\n string,\n string | string[] | number | number[] | boolean | undefined\n >;\n};\n\n/**\n * Base API Client with shared HTTP and caching functionality.\n * Extended by all specific API clients.\n */\nexport class BaseApiClient {\n protected readonly clientProduct: string;\n\n protected readonly clientVersion?: string;\n\n protected readonly getBearerToken?: () => Promise<string | undefined>;\n\n readonly #queryClientInstance: QueryClient;\n\n /**\n * Get the underlying QueryClient instance.\n * Exposed for cache management operations.\n *\n * @returns The QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#queryClientInstance;\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#queryClientInstance.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n\n constructor(options: ApiPlatformClientOptions) {\n this.clientProduct = options.clientProduct;\n this.clientVersion = options.clientVersion;\n this.getBearerToken = options.getBearerToken;\n\n this.#queryClientInstance =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n }\n\n /**\n * Internal HTTP fetch method with authentication and error handling.\n *\n * @param baseUrl - The base URL for the API.\n * @param path - The API endpoint path.\n * @param options - Optional fetch configuration.\n * @returns The parsed JSON response.\n */\n protected async fetch<ResponseType>(\n baseUrl: string,\n path: string,\n options?: InternalFetchOptions,\n ): Promise<ResponseType> {\n const url = new URL(path, baseUrl);\n\n if (options?.params) {\n for (const [key, value] of Object.entries(options.params)) {\n if (value === undefined) {\n continue;\n }\n if (Array.isArray(value)) {\n // Convert array values (including number[]) to comma-separated string\n url.searchParams.set(key, value.map(String).join(','));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'x-metamask-clientproduct': this.clientProduct,\n };\n\n if (this.clientVersion) {\n headers['x-metamask-clientversion'] = this.clientVersion;\n }\n\n // Get bearer token using fetchQuery for automatic deduplication\n if (this.getBearerToken) {\n const queryKey = authQueryKeys.bearerToken();\n const { getBearerToken } = this;\n\n try {\n // fetchQuery handles caching and deduplicates concurrent requests\n const token = await this.#queryClientInstance.fetchQuery({\n queryKey,\n queryFn: async () => {\n const result = await getBearerToken();\n // Throw if no token - prevents caching null/undefined\n // so subsequent requests can retry (e.g., after user logs in)\n if (!result) {\n throw new Error('No bearer token available');\n }\n return result;\n },\n staleTime: STALE_TIMES.AUTH_TOKEN,\n retry: false, // Don't retry auth failures\n });\n\n headers.Authorization = `Bearer ${token}`;\n } catch {\n // No token available - continue without auth header\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n // Response body is not JSON or is empty, leave body as undefined\n }\n throw new HttpError(\n `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n url.toString(),\n body,\n );\n }\n\n return response.json() as Promise<ResponseType>;\n }\n}\n\n// Re-export constants for use by API clients\nexport { API_URLS, STALE_TIMES, GC_TIMES, HttpError };\n"]}
@@ -22,7 +22,7 @@ export type InternalFetchOptions = {
22
22
  export declare class BaseApiClient {
23
23
  #private;
24
24
  protected readonly clientProduct: string;
25
- protected readonly clientVersion: string;
25
+ protected readonly clientVersion?: string;
26
26
  protected readonly getBearerToken?: () => Promise<string | undefined>;
27
27
  /**
28
28
  * Get the underlying QueryClient instance.
@@ -1 +1 @@
1
- {"version":3,"file":"base-client.d.cts","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,6BAA6B;AAGnD,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EAGR,SAAS,EACV,2BAAuB;AACxB,OAAO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AM,aAAa;;CAEhB,CAAC;AAEX,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CACb,MAAM,EACN,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAC5D,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,qBAAa,aAAa;;IACxB,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAEzC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAE1C,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAItE;;;;;OAKG;IACH,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;gBAM9B,OAAO,EAAE,wBAAwB;IAqB7C;;;;;;;OAOG;cACa,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,CAAC;CA8EzB;AAGD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
@@ -22,7 +22,7 @@ export type InternalFetchOptions = {
22
22
  export declare class BaseApiClient {
23
23
  #private;
24
24
  protected readonly clientProduct: string;
25
- protected readonly clientVersion: string;
25
+ protected readonly clientVersion?: string;
26
26
  protected readonly getBearerToken?: () => Promise<string | undefined>;
27
27
  /**
28
28
  * Get the underlying QueryClient instance.
@@ -1 +1 @@
1
- {"version":3,"file":"base-client.d.mts","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":"AAAA;;GAEG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,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EAGR,SAAS,EACV,2BAAuB;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,2BAAuB;AAG/D,eAAO,MAAM,aAAa;;CAEhB,CAAC;AAEX,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CACb,MAAM,EACN,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAC5D,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,qBAAa,aAAa;;IACxB,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAEzC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAE1C,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAItE;;;;;OAKG;IACH,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;gBAM9B,OAAO,EAAE,wBAAwB;IAqB7C;;;;;;;OAOG;cACa,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,YAAY,CAAC;CA8EzB;AAGD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC"}
@@ -48,7 +48,7 @@ export class BaseApiClient {
48
48
  constructor(options) {
49
49
  _BaseApiClient_queryClientInstance.set(this, void 0);
50
50
  this.clientProduct = options.clientProduct;
51
- this.clientVersion = options.clientVersion ?? '1.0.0';
51
+ this.clientVersion = options.clientVersion;
52
52
  this.getBearerToken = options.getBearerToken;
53
53
  __classPrivateFieldSet(this, _BaseApiClient_queryClientInstance, options.queryClient ??
54
54
  new QueryClient({
@@ -90,9 +90,11 @@ export class BaseApiClient {
90
90
  }
91
91
  const headers = {
92
92
  'Content-Type': 'application/json',
93
- 'X-Client-Product': this.clientProduct,
94
- 'X-Client-Version': this.clientVersion,
93
+ 'x-metamask-clientproduct': this.clientProduct,
95
94
  };
95
+ if (this.clientVersion) {
96
+ headers['x-metamask-clientversion'] = this.clientVersion;
97
+ }
96
98
  // Get bearer token using fetchQuery for automatic deduplication
97
99
  if (this.getBearerToken) {
98
100
  const queryKey = authQueryKeys.bearerToken();
@@ -1 +1 @@
1
- {"version":3,"file":"base-client.mjs","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,6BAA6B;AAGnD,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,2BAAuB;AAGxB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,GAAa,EAAE,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC;CAC5C,CAAC;AAeX;;;GAGG;AACH,MAAM,OAAO,aAAa;IASxB;;;;;OAKG;IACH,IAAI,WAAW;QACb,OAAO,uBAAA,IAAI,0CAAqB,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,uBAAA,IAAI,0CAAqB,CAAC,YAAY,CAAC;YAC3C,QAAQ,EAAE,aAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,OAAiC;QAzBpC,qDAAkC;QA0BzC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,OAAO,C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AAQ,CAAC,UAAU,EAAE,EACjD,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,UAAU,EACnB,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;;AAED,6CAA6C;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n * Base API Client - Shared HTTP functionality for all API clients.\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\nimport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\n\n// Auth query keys - shared for token management across clients\nexport const authQueryKeys = {\n bearerToken: (): QueryKey => ['auth', 'bearerToken'],\n} as const;\n\nexport type { ApiPlatformClientOptions };\n\n/**\n * Internal fetch options for HTTP requests.\n */\nexport type InternalFetchOptions = {\n signal?: AbortSignal;\n params?: Record<\n string,\n string | string[] | number | number[] | boolean | undefined\n >;\n};\n\n/**\n * Base API Client with shared HTTP and caching functionality.\n * Extended by all specific API clients.\n */\nexport class BaseApiClient {\n protected readonly clientProduct: string;\n\n protected readonly clientVersion: string;\n\n protected readonly getBearerToken?: () => Promise<string | undefined>;\n\n readonly #queryClientInstance: QueryClient;\n\n /**\n * Get the underlying QueryClient instance.\n * Exposed for cache management operations.\n *\n * @returns The QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#queryClientInstance;\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#queryClientInstance.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n\n constructor(options: ApiPlatformClientOptions) {\n this.clientProduct = options.clientProduct;\n this.clientVersion = options.clientVersion ?? '1.0.0';\n this.getBearerToken = options.getBearerToken;\n\n this.#queryClientInstance =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n }\n\n /**\n * Internal HTTP fetch method with authentication and error handling.\n *\n * @param baseUrl - The base URL for the API.\n * @param path - The API endpoint path.\n * @param options - Optional fetch configuration.\n * @returns The parsed JSON response.\n */\n protected async fetch<ResponseType>(\n baseUrl: string,\n path: string,\n options?: InternalFetchOptions,\n ): Promise<ResponseType> {\n const url = new URL(path, baseUrl);\n\n if (options?.params) {\n for (const [key, value] of Object.entries(options.params)) {\n if (value === undefined) {\n continue;\n }\n if (Array.isArray(value)) {\n // Convert array values (including number[]) to comma-separated string\n url.searchParams.set(key, value.map(String).join(','));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'X-Client-Product': this.clientProduct,\n 'X-Client-Version': this.clientVersion,\n };\n\n // Get bearer token using fetchQuery for automatic deduplication\n if (this.getBearerToken) {\n const queryKey = authQueryKeys.bearerToken();\n const { getBearerToken } = this;\n\n try {\n // fetchQuery handles caching and deduplicates concurrent requests\n const token = await this.#queryClientInstance.fetchQuery({\n queryKey,\n queryFn: async () => {\n const result = await getBearerToken();\n // Throw if no token - prevents caching null/undefined\n // so subsequent requests can retry (e.g., after user logs in)\n if (!result) {\n throw new Error('No bearer token available');\n }\n return result;\n },\n staleTime: STALE_TIMES.AUTH_TOKEN,\n retry: false, // Don't retry auth failures\n });\n\n headers.Authorization = `Bearer ${token}`;\n } catch {\n // No token available - continue without auth header\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n // Response body is not JSON or is empty, leave body as undefined\n }\n throw new HttpError(\n `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n url.toString(),\n body,\n );\n }\n\n return response.json() as Promise<ResponseType>;\n }\n}\n\n// Re-export constants for use by API clients\nexport { API_URLS, STALE_TIMES, GC_TIMES, HttpError };\n"]}
1
+ {"version":3,"file":"base-client.mjs","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,6BAA6B;AAGnD,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,2BAAuB;AAGxB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,GAAa,EAAE,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC;CAC5C,CAAC;AAeX;;;GAGG;AACH,MAAM,OAAO,aAAa;IASxB;;;;;OAKG;IACH,IAAI,WAAW;QACb,OAAO,uBAAA,IAAI,0CAAqB,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,uBAAA,IAAI,0CAAqB,CAAC,YAAY,CAAC;YAC3C,QAAQ,EAAE,aAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,OAAiC;QAzBpC,qDAAkC;QA0BzC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAE7C,uBAAA,IAAI,sCACF,OAAO,CAAC,WAAW;YACnB,IAAI,WAAW,CAAC;gBACd,cAAc,EAAE;oBACd,OAAO,EAAE;wBACP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C,QAAQ,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;;AAED,6CAA6C;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n * Base API Client - Shared HTTP functionality for all API clients.\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\nimport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\n\n// Auth query keys - shared for token management across clients\nexport const authQueryKeys = {\n bearerToken: (): QueryKey => ['auth', 'bearerToken'],\n} as const;\n\nexport type { ApiPlatformClientOptions };\n\n/**\n * Internal fetch options for HTTP requests.\n */\nexport type InternalFetchOptions = {\n signal?: AbortSignal;\n params?: Record<\n string,\n string | string[] | number | number[] | boolean | undefined\n >;\n};\n\n/**\n * Base API Client with shared HTTP and caching functionality.\n * Extended by all specific API clients.\n */\nexport class BaseApiClient {\n protected readonly clientProduct: string;\n\n protected readonly clientVersion?: string;\n\n protected readonly getBearerToken?: () => Promise<string | undefined>;\n\n readonly #queryClientInstance: QueryClient;\n\n /**\n * Get the underlying QueryClient instance.\n * Exposed for cache management operations.\n *\n * @returns The QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#queryClientInstance;\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#queryClientInstance.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n\n constructor(options: ApiPlatformClientOptions) {\n this.clientProduct = options.clientProduct;\n this.clientVersion = options.clientVersion;\n this.getBearerToken = options.getBearerToken;\n\n this.#queryClientInstance =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n }\n\n /**\n * Internal HTTP fetch method with authentication and error handling.\n *\n * @param baseUrl - The base URL for the API.\n * @param path - The API endpoint path.\n * @param options - Optional fetch configuration.\n * @returns The parsed JSON response.\n */\n protected async fetch<ResponseType>(\n baseUrl: string,\n path: string,\n options?: InternalFetchOptions,\n ): Promise<ResponseType> {\n const url = new URL(path, baseUrl);\n\n if (options?.params) {\n for (const [key, value] of Object.entries(options.params)) {\n if (value === undefined) {\n continue;\n }\n if (Array.isArray(value)) {\n // Convert array values (including number[]) to comma-separated string\n url.searchParams.set(key, value.map(String).join(','));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'x-metamask-clientproduct': this.clientProduct,\n };\n\n if (this.clientVersion) {\n headers['x-metamask-clientversion'] = this.clientVersion;\n }\n\n // Get bearer token using fetchQuery for automatic deduplication\n if (this.getBearerToken) {\n const queryKey = authQueryKeys.bearerToken();\n const { getBearerToken } = this;\n\n try {\n // fetchQuery handles caching and deduplicates concurrent requests\n const token = await this.#queryClientInstance.fetchQuery({\n queryKey,\n queryFn: async () => {\n const result = await getBearerToken();\n // Throw if no token - prevents caching null/undefined\n // so subsequent requests can retry (e.g., after user logs in)\n if (!result) {\n throw new Error('No bearer token available');\n }\n return result;\n },\n staleTime: STALE_TIMES.AUTH_TOKEN,\n retry: false, // Don't retry auth failures\n });\n\n headers.Authorization = `Bearer ${token}`;\n } catch {\n // No token available - continue without auth header\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n // Response body is not JSON or is empty, leave body as undefined\n }\n throw new HttpError(\n `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n url.toString(),\n body,\n );\n }\n\n return response.json() as Promise<ResponseType>;\n }\n}\n\n// Re-export constants for use by API clients\nexport { API_URLS, STALE_TIMES, GC_TIMES, HttpError };\n"]}
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  // Core Backend Package Exports
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.HttpError = exports.shouldRetry = exports.getQueryOptionsOverrides = exports.calculateRetryDelay = exports.GC_TIMES = exports.STALE_TIMES = exports.API_URLS = exports.TokensApiClient = exports.TokenApiClient = exports.PricesApiClient = exports.AccountsApiClient = exports.createApiPlatformClient = exports.ApiPlatformClient = exports.apiPlatformClientServiceName = exports.ApiPlatformClientService = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS = exports.AccountActivityService = exports.WebSocketEventType = exports.WebSocketState = exports.getCloseReason = exports.BackendWebSocketService = void 0;
4
+ exports.HttpError = exports.shouldRetry = exports.getQueryOptionsOverrides = exports.calculateRetryDelay = exports.GC_TIMES = exports.STALE_TIMES = exports.API_URLS = exports.TokensApiClient = exports.TokenApiClient = exports.PricesApiClient = exports.AccountsApiClient = exports.createApiPlatformClient = exports.ApiPlatformClient = exports.OHLCV_SERVICE_ALLOWED_EVENTS = exports.OHLCV_SERVICE_ALLOWED_ACTIONS = exports.OHLCVService = exports.apiPlatformClientServiceName = exports.ApiPlatformClientService = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS = exports.AccountActivityService = exports.WebSocketEventType = exports.WebSocketState = exports.getCloseReason = exports.BackendWebSocketService = void 0;
5
5
  // ============================================================================
6
6
  // BACKEND WEBSOCKET SERVICE
7
7
  // ============================================================================
8
- var BackendWebSocketService_1 = require("./BackendWebSocketService.cjs");
8
+ var BackendWebSocketService_1 = require("./ws/BackendWebSocketService.cjs");
9
9
  Object.defineProperty(exports, "BackendWebSocketService", { enumerable: true, get: function () { return BackendWebSocketService_1.BackendWebSocketService; } });
10
10
  Object.defineProperty(exports, "getCloseReason", { enumerable: true, get: function () { return BackendWebSocketService_1.getCloseReason; } });
11
11
  Object.defineProperty(exports, "WebSocketState", { enumerable: true, get: function () { return BackendWebSocketService_1.WebSocketState; } });
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "WebSocketEventType", { enumerable: true, get: fu
13
13
  // ============================================================================
14
14
  // ACCOUNT ACTIVITY SERVICE
15
15
  // ============================================================================
16
- var AccountActivityService_1 = require("./AccountActivityService.cjs");
16
+ var AccountActivityService_1 = require("./ws/AccountActivityService.cjs");
17
17
  Object.defineProperty(exports, "AccountActivityService", { enumerable: true, get: function () { return AccountActivityService_1.AccountActivityService; } });
18
18
  Object.defineProperty(exports, "ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS", { enumerable: true, get: function () { return AccountActivityService_1.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS; } });
19
19
  Object.defineProperty(exports, "ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS", { enumerable: true, get: function () { return AccountActivityService_1.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS; } });
@@ -24,6 +24,13 @@ var ApiPlatformClientService_1 = require("./ApiPlatformClientService.cjs");
24
24
  Object.defineProperty(exports, "ApiPlatformClientService", { enumerable: true, get: function () { return ApiPlatformClientService_1.ApiPlatformClientService; } });
25
25
  Object.defineProperty(exports, "apiPlatformClientServiceName", { enumerable: true, get: function () { return ApiPlatformClientService_1.apiPlatformClientServiceName; } });
26
26
  // ============================================================================
27
+ // OHLCV SERVICE
28
+ // ============================================================================
29
+ var ohlcv_1 = require("./ws/ohlcv/index.cjs");
30
+ Object.defineProperty(exports, "OHLCVService", { enumerable: true, get: function () { return ohlcv_1.OHLCVService; } });
31
+ Object.defineProperty(exports, "OHLCV_SERVICE_ALLOWED_ACTIONS", { enumerable: true, get: function () { return ohlcv_1.OHLCV_SERVICE_ALLOWED_ACTIONS; } });
32
+ Object.defineProperty(exports, "OHLCV_SERVICE_ALLOWED_EVENTS", { enumerable: true, get: function () { return ohlcv_1.OHLCV_SERVICE_ALLOWED_EVENTS; } });
33
+ // ============================================================================
27
34
  // API PLATFORM CLIENT
28
35
  // ============================================================================
29
36
  var api_1 = require("./api/index.cjs");
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAE/B,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,yEAKmC;AAJjC,kIAAA,uBAAuB,OAAA;AACvB,yHAAA,cAAc,OAAA;AACd,yHAAA,cAAc,OAAA;AACd,6HAAA,kBAAkB,OAAA;AAkBpB,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,uEAIkC;AAHhC,gIAAA,sBAAsB,OAAA;AACtB,kJAAA,wCAAwC,OAAA;AACxC,iJAAA,uCAAuC,OAAA;AA+BzC,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,2EAGoC;AAFlC,oIAAA,wBAAwB,OAAA;AACxB,wIAAA,4BAA4B,OAAA;AAU9B,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,uCAkBe;AAjBb,wGAAA,iBAAiB,OAAA;AACjB,8GAAA,uBAAuB,OAAA;AACvB,yBAAyB;AACzB,wGAAA,iBAAiB,OAAA;AACjB,sGAAA,eAAe,OAAA;AACf,qGAAA,cAAc,OAAA;AACd,sGAAA,eAAe,OAAA;AACf,YAAY;AACZ,+FAAA,QAAQ,OAAA;AACR,kGAAA,WAAW,OAAA;AACX,+FAAA,QAAQ,OAAA;AACR,UAAU;AACV,0GAAA,mBAAmB,OAAA;AACnB,+GAAA,wBAAwB,OAAA;AACxB,kGAAA,WAAW,OAAA;AACX,SAAS;AACT,gGAAA,SAAS,OAAA","sourcesContent":["// Core Backend Package Exports\n\n// ============================================================================\n// BACKEND WEBSOCKET SERVICE\n// ============================================================================\n\nexport {\n BackendWebSocketService,\n getCloseReason,\n WebSocketState,\n WebSocketEventType,\n} from './BackendWebSocketService';\n\nexport type {\n BackendWebSocketServiceOptions,\n ClientRequestMessage,\n ServerResponseMessage,\n ServerNotificationMessage,\n WebSocketMessage,\n ChannelCallback,\n WebSocketSubscription,\n WebSocketConnectionInfo,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceConnectionStateChangedEvent,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceMessenger,\n} from './BackendWebSocketService';\n\n// ============================================================================\n// ACCOUNT ACTIVITY SERVICE\n// ============================================================================\n\nexport {\n AccountActivityService,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS,\n} from './AccountActivityService';\n\nexport type {\n SystemNotificationData,\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AllowedActions as AccountActivityServiceAllowedActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AllowedEvents as AccountActivityServiceAllowedEvents,\n AccountActivityServiceMessenger,\n} from './AccountActivityService';\n\n// ============================================================================\n// SHARED TYPES\n// ============================================================================\n\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// ============================================================================\n// API PLATFORM CLIENT SERVICE\n// ============================================================================\n\nexport {\n ApiPlatformClientService,\n apiPlatformClientServiceName,\n} from './ApiPlatformClientService';\n\nexport type {\n ApiPlatformClientServiceOptions,\n ApiPlatformClientServiceActions,\n ApiPlatformClientServiceEvents,\n ApiPlatformClientServiceMessenger,\n} from './ApiPlatformClientService';\n\n// ============================================================================\n// API PLATFORM CLIENT\n// ============================================================================\n\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n // Individual API clients\n AccountsApiClient,\n PricesApiClient,\n TokenApiClient,\n TokensApiClient,\n // Constants\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n // Helpers\n calculateRetryDelay,\n getQueryOptionsOverrides,\n shouldRetry,\n // Errors\n HttpError,\n} from './api';\n\n// ============================================================================\n// API PLATFORM CLIENT TYPES\n// ============================================================================\n\nexport type {\n // Client options\n ApiPlatformClientOptions,\n FetchOptions,\n // Shared types\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n // Accounts API types\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n // Prices API types\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n // Token API types\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n // Tokens API types\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './api';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAE/B,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,4EAKsC;AAJpC,kIAAA,uBAAuB,OAAA;AACvB,yHAAA,cAAc,OAAA;AACd,yHAAA,cAAc,OAAA;AACd,6HAAA,kBAAkB,OAAA;AAkBpB,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,0EAIqC;AAHnC,gIAAA,sBAAsB,OAAA;AACtB,kJAAA,wCAAwC,OAAA;AACxC,iJAAA,uCAAuC,OAAA;AA+BzC,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,2EAGoC;AAFlC,oIAAA,wBAAwB,OAAA;AACxB,wIAAA,4BAA4B,OAAA;AAU9B,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,8CAIoB;AAHlB,qGAAA,YAAY,OAAA;AACZ,sHAAA,6BAA6B,OAAA;AAC7B,qHAAA,4BAA4B,OAAA;AAkB9B,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,uCAkBe;AAjBb,wGAAA,iBAAiB,OAAA;AACjB,8GAAA,uBAAuB,OAAA;AACvB,yBAAyB;AACzB,wGAAA,iBAAiB,OAAA;AACjB,sGAAA,eAAe,OAAA;AACf,qGAAA,cAAc,OAAA;AACd,sGAAA,eAAe,OAAA;AACf,YAAY;AACZ,+FAAA,QAAQ,OAAA;AACR,kGAAA,WAAW,OAAA;AACX,+FAAA,QAAQ,OAAA;AACR,UAAU;AACV,0GAAA,mBAAmB,OAAA;AACnB,+GAAA,wBAAwB,OAAA;AACxB,kGAAA,WAAW,OAAA;AACX,SAAS;AACT,gGAAA,SAAS,OAAA","sourcesContent":["// Core Backend Package Exports\n\n// ============================================================================\n// BACKEND WEBSOCKET SERVICE\n// ============================================================================\n\nexport {\n BackendWebSocketService,\n getCloseReason,\n WebSocketState,\n WebSocketEventType,\n} from './ws/BackendWebSocketService';\n\nexport type {\n BackendWebSocketServiceOptions,\n ClientRequestMessage,\n ServerResponseMessage,\n ServerNotificationMessage,\n WebSocketMessage,\n ChannelCallback,\n WebSocketSubscription,\n WebSocketConnectionInfo,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceConnectionStateChangedEvent,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceMessenger,\n} from './ws/BackendWebSocketService';\n\n// ============================================================================\n// ACCOUNT ACTIVITY SERVICE\n// ============================================================================\n\nexport {\n AccountActivityService,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS,\n} from './ws/AccountActivityService';\n\nexport type {\n SystemNotificationData,\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AllowedActions as AccountActivityServiceAllowedActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AllowedEvents as AccountActivityServiceAllowedEvents,\n AccountActivityServiceMessenger,\n} from './ws/AccountActivityService';\n\n// ============================================================================\n// SHARED TYPES\n// ============================================================================\n\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// ============================================================================\n// API PLATFORM CLIENT SERVICE\n// ============================================================================\n\nexport {\n ApiPlatformClientService,\n apiPlatformClientServiceName,\n} from './ApiPlatformClientService';\n\nexport type {\n ApiPlatformClientServiceOptions,\n ApiPlatformClientServiceActions,\n ApiPlatformClientServiceEvents,\n ApiPlatformClientServiceMessenger,\n} from './ApiPlatformClientService';\n\n// ============================================================================\n// OHLCV SERVICE\n// ============================================================================\n\nexport {\n OHLCVService,\n OHLCV_SERVICE_ALLOWED_ACTIONS,\n OHLCV_SERVICE_ALLOWED_EVENTS,\n} from './ws/ohlcv';\n\nexport type {\n OHLCVBar,\n OHLCVSubscriptionOptions,\n OHLCVSystemNotificationData,\n OHLCVServiceOptions,\n OHLCVServiceActions,\n OHLCVServiceAllowedActions,\n OHLCVServiceBarUpdatedEvent,\n OHLCVServiceChainStatusChangedEvent,\n OHLCVServiceSubscriptionErrorEvent,\n OHLCVServiceEvents,\n OHLCVServiceAllowedEvents,\n OHLCVServiceMessenger,\n} from './ws/ohlcv';\n\n// ============================================================================\n// API PLATFORM CLIENT\n// ============================================================================\n\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n // Individual API clients\n AccountsApiClient,\n PricesApiClient,\n TokenApiClient,\n TokensApiClient,\n // Constants\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n // Helpers\n calculateRetryDelay,\n getQueryOptionsOverrides,\n shouldRetry,\n // Errors\n HttpError,\n} from './api';\n\n// ============================================================================\n// API PLATFORM CLIENT TYPES\n// ============================================================================\n\nexport type {\n // Client options\n ApiPlatformClientOptions,\n FetchOptions,\n // Shared types\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n // Accounts API types\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n // Prices API types\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n // Token API types\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n // Tokens API types\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './api';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,10 +1,12 @@
1
- export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType, } from "./BackendWebSocketService.cjs";
2
- export type { BackendWebSocketServiceOptions, ClientRequestMessage, ServerResponseMessage, ServerNotificationMessage, WebSocketMessage, ChannelCallback, WebSocketSubscription, WebSocketConnectionInfo, BackendWebSocketServiceActions, BackendWebSocketServiceConnectionStateChangedEvent, BackendWebSocketServiceEvents, BackendWebSocketServiceMessenger, } from "./BackendWebSocketService.cjs";
3
- export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS, } from "./AccountActivityService.cjs";
4
- export type { SystemNotificationData, SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AllowedActions as AccountActivityServiceAllowedActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AllowedEvents as AccountActivityServiceAllowedEvents, AccountActivityServiceMessenger, } from "./AccountActivityService.cjs";
1
+ export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType, } from "./ws/BackendWebSocketService.cjs";
2
+ export type { BackendWebSocketServiceOptions, ClientRequestMessage, ServerResponseMessage, ServerNotificationMessage, WebSocketMessage, ChannelCallback, WebSocketSubscription, WebSocketConnectionInfo, BackendWebSocketServiceActions, BackendWebSocketServiceConnectionStateChangedEvent, BackendWebSocketServiceEvents, BackendWebSocketServiceMessenger, } from "./ws/BackendWebSocketService.cjs";
3
+ export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS, } from "./ws/AccountActivityService.cjs";
4
+ export type { SystemNotificationData, SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AllowedActions as AccountActivityServiceAllowedActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AllowedEvents as AccountActivityServiceAllowedEvents, AccountActivityServiceMessenger, } from "./ws/AccountActivityService.cjs";
5
5
  export type { Transaction, Asset, Balance, Transfer, BalanceUpdate, AccountActivityMessage, } from "./types.cjs";
6
6
  export { ApiPlatformClientService, apiPlatformClientServiceName, } from "./ApiPlatformClientService.cjs";
7
7
  export type { ApiPlatformClientServiceOptions, ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents, ApiPlatformClientServiceMessenger, } from "./ApiPlatformClientService.cjs";
8
+ export { OHLCVService, OHLCV_SERVICE_ALLOWED_ACTIONS, OHLCV_SERVICE_ALLOWED_EVENTS, } from "./ws/ohlcv/index.cjs";
9
+ export type { OHLCVBar, OHLCVSubscriptionOptions, OHLCVSystemNotificationData, OHLCVServiceOptions, OHLCVServiceActions, OHLCVServiceAllowedActions, OHLCVServiceBarUpdatedEvent, OHLCVServiceChainStatusChangedEvent, OHLCVServiceSubscriptionErrorEvent, OHLCVServiceEvents, OHLCVServiceAllowedEvents, OHLCVServiceMessenger, } from "./ws/ohlcv/index.cjs";
8
10
  export { ApiPlatformClient, createApiPlatformClient, AccountsApiClient, PricesApiClient, TokenApiClient, TokensApiClient, API_URLS, STALE_TIMES, GC_TIMES, calculateRetryDelay, getQueryOptionsOverrides, shouldRetry, HttpError, } from "./api/index.cjs";
9
11
  export type { ApiPlatformClientOptions, FetchOptions, PageInfo, SupportedCurrency, MarketDataDetails, V5BalanceItem, V5BalancesResponse, V2BalanceItem, V2BalancesResponse, V4BalancesResponse, V1SupportedNetworksResponse, V2SupportedNetworksResponse, V2ActiveNetworksResponse, V1TransactionByHashResponse, V1AccountTransactionsResponse, V4MultiAccountTransactionsResponse, ValueTransfer, V1AccountRelationshipResult, NftItem, V2NftsResponse, TokenDiscoveryItem, V2TokensResponse, V3SpotPricesResponse, CoinGeckoSpotPrice, ExchangeRateInfo, V1ExchangeRatesResponse, PriceSupportedNetworksResponse, V1HistoricalPricesResponse, V3HistoricalPricesResponse, TokenMetadata, V1TokenDescriptionResponse, NetworkInfo, TopAsset, TrendingSortBy, TrendingToken, TopGainersSortOption, TrendingSortOption, V1SuggestedOccurrenceFloorsResponse, V1TokenSupportedNetworksResponse, V2TokenSupportedNetworksResponse, V3AssetResponse, } from "./api/index.cjs";
10
12
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,sCAAkC;AAEnC,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,kDAAkD,EAClD,6BAA6B,EAC7B,gCAAgC,GACjC,sCAAkC;AAMnC,OAAO,EACL,sBAAsB,EACtB,wCAAwC,EACxC,uCAAuC,GACxC,qCAAiC;AAElC,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,IAAI,oCAAoC,EACtD,6CAA6C,EAC7C,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,4BAA4B,EAC5B,aAAa,IAAI,mCAAmC,EACpD,+BAA+B,GAChC,qCAAiC;AAMlC,YAAY,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,sBAAsB,GACvB,oBAAgB;AAMjB,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,uCAAmC;AAEpC,YAAY,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,GAClC,uCAAmC;AAMpC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EAEvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,WAAW,EACX,QAAQ,EAER,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EAEX,SAAS,GACV,wBAAc;AAMf,YAAY,EAEV,wBAAwB,EACxB,YAAY,EAEZ,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EAEjB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,aAAa,EACb,2BAA2B,EAC3B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAEhB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAE1B,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,EAEnC,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,wBAAc"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,yCAAqC;AAEtC,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,kDAAkD,EAClD,6BAA6B,EAC7B,gCAAgC,GACjC,yCAAqC;AAMtC,OAAO,EACL,sBAAsB,EACtB,wCAAwC,EACxC,uCAAuC,GACxC,wCAAoC;AAErC,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,IAAI,oCAAoC,EACtD,6CAA6C,EAC7C,yCAAyC,EACzC,4CAA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AA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,EAEnC,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,wBAAc"}
package/dist/index.d.mts CHANGED
@@ -1,10 +1,12 @@
1
- export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType, } from "./BackendWebSocketService.mjs";
2
- export type { BackendWebSocketServiceOptions, ClientRequestMessage, ServerResponseMessage, ServerNotificationMessage, WebSocketMessage, ChannelCallback, WebSocketSubscription, WebSocketConnectionInfo, BackendWebSocketServiceActions, BackendWebSocketServiceConnectionStateChangedEvent, BackendWebSocketServiceEvents, BackendWebSocketServiceMessenger, } from "./BackendWebSocketService.mjs";
3
- export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS, } from "./AccountActivityService.mjs";
4
- export type { SystemNotificationData, SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AllowedActions as AccountActivityServiceAllowedActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AllowedEvents as AccountActivityServiceAllowedEvents, AccountActivityServiceMessenger, } from "./AccountActivityService.mjs";
1
+ export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType, } from "./ws/BackendWebSocketService.mjs";
2
+ export type { BackendWebSocketServiceOptions, ClientRequestMessage, ServerResponseMessage, ServerNotificationMessage, WebSocketMessage, ChannelCallback, WebSocketSubscription, WebSocketConnectionInfo, BackendWebSocketServiceActions, BackendWebSocketServiceConnectionStateChangedEvent, BackendWebSocketServiceEvents, BackendWebSocketServiceMessenger, } from "./ws/BackendWebSocketService.mjs";
3
+ export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS, } from "./ws/AccountActivityService.mjs";
4
+ export type { SystemNotificationData, SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AllowedActions as AccountActivityServiceAllowedActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AllowedEvents as AccountActivityServiceAllowedEvents, AccountActivityServiceMessenger, } from "./ws/AccountActivityService.mjs";
5
5
  export type { Transaction, Asset, Balance, Transfer, BalanceUpdate, AccountActivityMessage, } from "./types.mjs";
6
6
  export { ApiPlatformClientService, apiPlatformClientServiceName, } from "./ApiPlatformClientService.mjs";
7
7
  export type { ApiPlatformClientServiceOptions, ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents, ApiPlatformClientServiceMessenger, } from "./ApiPlatformClientService.mjs";
8
+ export { OHLCVService, OHLCV_SERVICE_ALLOWED_ACTIONS, OHLCV_SERVICE_ALLOWED_EVENTS, } from "./ws/ohlcv/index.mjs";
9
+ export type { OHLCVBar, OHLCVSubscriptionOptions, OHLCVSystemNotificationData, OHLCVServiceOptions, OHLCVServiceActions, OHLCVServiceAllowedActions, OHLCVServiceBarUpdatedEvent, OHLCVServiceChainStatusChangedEvent, OHLCVServiceSubscriptionErrorEvent, OHLCVServiceEvents, OHLCVServiceAllowedEvents, OHLCVServiceMessenger, } from "./ws/ohlcv/index.mjs";
8
10
  export { ApiPlatformClient, createApiPlatformClient, AccountsApiClient, PricesApiClient, TokenApiClient, TokensApiClient, API_URLS, STALE_TIMES, GC_TIMES, calculateRetryDelay, getQueryOptionsOverrides, shouldRetry, HttpError, } from "./api/index.mjs";
9
11
  export type { ApiPlatformClientOptions, FetchOptions, PageInfo, SupportedCurrency, MarketDataDetails, V5BalanceItem, V5BalancesResponse, V2BalanceItem, V2BalancesResponse, V4BalancesResponse, V1SupportedNetworksResponse, V2SupportedNetworksResponse, V2ActiveNetworksResponse, V1TransactionByHashResponse, V1AccountTransactionsResponse, V4MultiAccountTransactionsResponse, ValueTransfer, V1AccountRelationshipResult, NftItem, V2NftsResponse, TokenDiscoveryItem, V2TokensResponse, V3SpotPricesResponse, CoinGeckoSpotPrice, ExchangeRateInfo, V1ExchangeRatesResponse, PriceSupportedNetworksResponse, V1HistoricalPricesResponse, V3HistoricalPricesResponse, TokenMetadata, V1TokenDescriptionResponse, NetworkInfo, TopAsset, TrendingSortBy, TrendingToken, TopGainersSortOption, TrendingSortOption, V1SuggestedOccurrenceFloorsResponse, V1TokenSupportedNetworksResponse, V2TokenSupportedNetworksResponse, V3AssetResponse, } from "./api/index.mjs";
10
12
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,sCAAkC;AAEnC,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,kDAAkD,EAClD,6BAA6B,EAC7B,gCAAgC,GACjC,sCAAkC;AAMnC,OAAO,EACL,sBAAsB,EACtB,wCAAwC,EACxC,uCAAuC,GACxC,qCAAiC;AAElC,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,IAAI,oCAAoC,EACtD,6CAA6C,EAC7C,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,4BAA4B,EAC5B,aAAa,IAAI,mCAAmC,EACpD,+BAA+B,GAChC,qCAAiC;AAMlC,YAAY,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,sBAAsB,GACvB,oBAAgB;AAMjB,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,uCAAmC;AAEpC,YAAY,EACV,+BAA+B,EAC/B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,GAClC,uCAAmC;AAMpC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EAEvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,WAAW,EACX,QAAQ,EAER,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EAEX,SAAS,GACV,wBAAc;AAMf,YAAY,EAEV,wBAAwB,EACxB,YAAY,EAEZ,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EAEjB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,aAAa,EACb,2BAA2B,EAC3B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAEhB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAE1B,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,EAEnC,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,wBAAc"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,yCAAqC;AAEtC,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,kDAAkD,EAClD,6BAA6B,EAC7B,gCAAgC,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A6B,EAC7B,kCAAkC,EAClC,aAAa,EACb,2BAA2B,EAC3B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAEhB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAE1B,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,EAEnC,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,wBAAc"}
package/dist/index.mjs CHANGED
@@ -2,16 +2,20 @@
2
2
  // ============================================================================
3
3
  // BACKEND WEBSOCKET SERVICE
4
4
  // ============================================================================
5
- export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType } from "./BackendWebSocketService.mjs";
5
+ export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType } from "./ws/BackendWebSocketService.mjs";
6
6
  // ============================================================================
7
7
  // ACCOUNT ACTIVITY SERVICE
8
8
  // ============================================================================
9
- export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS } from "./AccountActivityService.mjs";
9
+ export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS } from "./ws/AccountActivityService.mjs";
10
10
  // ============================================================================
11
11
  // API PLATFORM CLIENT SERVICE
12
12
  // ============================================================================
13
13
  export { ApiPlatformClientService, apiPlatformClientServiceName } from "./ApiPlatformClientService.mjs";
14
14
  // ============================================================================
15
+ // OHLCV SERVICE
16
+ // ============================================================================
17
+ export { OHLCVService, OHLCV_SERVICE_ALLOWED_ACTIONS, OHLCV_SERVICE_ALLOWED_EVENTS } from "./ws/ohlcv/index.mjs";
18
+ // ============================================================================
15
19
  // API PLATFORM CLIENT
16
20
  // ============================================================================
17
21
  export { ApiPlatformClient, createApiPlatformClient,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,sCAAkC;AAiBnC,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,OAAO,EACL,sBAAsB,EACtB,wCAAwC,EACxC,uCAAuC,EACxC,qCAAiC;AA8BlC,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC7B,uCAAmC;AASpC,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,OAAO,EACL,iBAAiB,EACjB,uBAAuB;AACvB,yBAAyB;AACzB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe;AACf,YAAY;AACZ,QAAQ,EACR,WAAW,EACX,QAAQ;AACR,UAAU;AACV,mBAAmB,EACnB,wBAAwB,EACxB,WAAW;AACX,SAAS;AACT,SAAS,EACV,wBAAc","sourcesContent":["// Core Backend Package Exports\n\n// ============================================================================\n// BACKEND WEBSOCKET SERVICE\n// ============================================================================\n\nexport {\n BackendWebSocketService,\n getCloseReason,\n WebSocketState,\n WebSocketEventType,\n} from './BackendWebSocketService';\n\nexport type {\n BackendWebSocketServiceOptions,\n ClientRequestMessage,\n ServerResponseMessage,\n ServerNotificationMessage,\n WebSocketMessage,\n ChannelCallback,\n WebSocketSubscription,\n WebSocketConnectionInfo,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceConnectionStateChangedEvent,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceMessenger,\n} from './BackendWebSocketService';\n\n// ============================================================================\n// ACCOUNT ACTIVITY SERVICE\n// ============================================================================\n\nexport {\n AccountActivityService,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS,\n} from './AccountActivityService';\n\nexport type {\n SystemNotificationData,\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AllowedActions as AccountActivityServiceAllowedActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AllowedEvents as AccountActivityServiceAllowedEvents,\n AccountActivityServiceMessenger,\n} from './AccountActivityService';\n\n// ============================================================================\n// SHARED TYPES\n// ============================================================================\n\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// ============================================================================\n// API PLATFORM CLIENT SERVICE\n// ============================================================================\n\nexport {\n ApiPlatformClientService,\n apiPlatformClientServiceName,\n} from './ApiPlatformClientService';\n\nexport type {\n ApiPlatformClientServiceOptions,\n ApiPlatformClientServiceActions,\n ApiPlatformClientServiceEvents,\n ApiPlatformClientServiceMessenger,\n} from './ApiPlatformClientService';\n\n// ============================================================================\n// API PLATFORM CLIENT\n// ============================================================================\n\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n // Individual API clients\n AccountsApiClient,\n PricesApiClient,\n TokenApiClient,\n TokensApiClient,\n // Constants\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n // Helpers\n calculateRetryDelay,\n getQueryOptionsOverrides,\n shouldRetry,\n // Errors\n HttpError,\n} from './api';\n\n// ============================================================================\n// API PLATFORM CLIENT TYPES\n// ============================================================================\n\nexport type {\n // Client options\n ApiPlatformClientOptions,\n FetchOptions,\n // Shared types\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n // Accounts API types\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n // Prices API types\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n // Token API types\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n // Tokens API types\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './api';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,yCAAqC;AAiBtC,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,OAAO,EACL,sBAAsB,EACtB,wCAAwC,EACxC,uCAAuC,EACxC,wCAAoC;AA8BrC,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC7B,uCAAmC;AASpC,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,OAAO,EACL,YAAY,EACZ,6BAA6B,EAC7B,4BAA4B,EAC7B,6BAAmB;AAiBpB,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,OAAO,EACL,iBAAiB,EACjB,uBAAuB;AACvB,yBAAyB;AACzB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe;AACf,YAAY;AACZ,QAAQ,EACR,WAAW,EACX,QAAQ;AACR,UAAU;AACV,mBAAmB,EACnB,wBAAwB,EACxB,WAAW;AACX,SAAS;AACT,SAAS,EACV,wBAAc","sourcesContent":["// Core Backend Package Exports\n\n// ============================================================================\n// BACKEND WEBSOCKET SERVICE\n// ============================================================================\n\nexport {\n BackendWebSocketService,\n getCloseReason,\n WebSocketState,\n WebSocketEventType,\n} from './ws/BackendWebSocketService';\n\nexport type {\n BackendWebSocketServiceOptions,\n ClientRequestMessage,\n ServerResponseMessage,\n ServerNotificationMessage,\n WebSocketMessage,\n ChannelCallback,\n WebSocketSubscription,\n WebSocketConnectionInfo,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceConnectionStateChangedEvent,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceMessenger,\n} from './ws/BackendWebSocketService';\n\n// ============================================================================\n// ACCOUNT ACTIVITY SERVICE\n// ============================================================================\n\nexport {\n AccountActivityService,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS,\n ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS,\n} from './ws/AccountActivityService';\n\nexport type {\n SystemNotificationData,\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AllowedActions as AccountActivityServiceAllowedActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AllowedEvents as AccountActivityServiceAllowedEvents,\n AccountActivityServiceMessenger,\n} from './ws/AccountActivityService';\n\n// ============================================================================\n// SHARED TYPES\n// ============================================================================\n\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// ============================================================================\n// API PLATFORM CLIENT SERVICE\n// ============================================================================\n\nexport {\n ApiPlatformClientService,\n apiPlatformClientServiceName,\n} from './ApiPlatformClientService';\n\nexport type {\n ApiPlatformClientServiceOptions,\n ApiPlatformClientServiceActions,\n ApiPlatformClientServiceEvents,\n ApiPlatformClientServiceMessenger,\n} from './ApiPlatformClientService';\n\n// ============================================================================\n// OHLCV SERVICE\n// ============================================================================\n\nexport {\n OHLCVService,\n OHLCV_SERVICE_ALLOWED_ACTIONS,\n OHLCV_SERVICE_ALLOWED_EVENTS,\n} from './ws/ohlcv';\n\nexport type {\n OHLCVBar,\n OHLCVSubscriptionOptions,\n OHLCVSystemNotificationData,\n OHLCVServiceOptions,\n OHLCVServiceActions,\n OHLCVServiceAllowedActions,\n OHLCVServiceBarUpdatedEvent,\n OHLCVServiceChainStatusChangedEvent,\n OHLCVServiceSubscriptionErrorEvent,\n OHLCVServiceEvents,\n OHLCVServiceAllowedEvents,\n OHLCVServiceMessenger,\n} from './ws/ohlcv';\n\n// ============================================================================\n// API PLATFORM CLIENT\n// ============================================================================\n\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n // Individual API clients\n AccountsApiClient,\n PricesApiClient,\n TokenApiClient,\n TokensApiClient,\n // Constants\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n // Helpers\n calculateRetryDelay,\n getQueryOptionsOverrides,\n shouldRetry,\n // Errors\n HttpError,\n} from './api';\n\n// ============================================================================\n// API PLATFORM CLIENT TYPES\n// ============================================================================\n\nexport type {\n // Client options\n ApiPlatformClientOptions,\n FetchOptions,\n // Shared types\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n // Accounts API types\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n // Prices API types\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n // Token API types\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n // Tokens API types\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './api';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService-method-action-types.cjs","sourceRoot":"","sources":["../../src/ws/AccountActivityService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AccountActivityService } from './AccountActivityService';\n\n/**\n * Subscribe to account activity (transactions and balance updates)\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address\n */\nexport type AccountActivityServiceSubscribeAction = {\n type: `AccountActivityService:subscribe`;\n handler: AccountActivityService['subscribe'];\n};\n\n/**\n * Unsubscribe from account activity for specified address\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address to unsubscribe\n */\nexport type AccountActivityServiceUnsubscribeAction = {\n type: `AccountActivityService:unsubscribe`;\n handler: AccountActivityService['unsubscribe'];\n};\n\n/**\n * Union of all AccountActivityService action types.\n */\nexport type AccountActivityServiceMethodActions =\n | AccountActivityServiceSubscribeAction\n | AccountActivityServiceUnsubscribeAction;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService-method-action-types.d.cts","sourceRoot":"","sources":["../../src/ws/AccountActivityService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,qCAAiC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,qCAAqC,GACrC,uCAAuC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService-method-action-types.d.mts","sourceRoot":"","sources":["../../src/ws/AccountActivityService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,qCAAiC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,qCAAqC,GACrC,uCAAuC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService-method-action-types.mjs","sourceRoot":"","sources":["../../src/ws/AccountActivityService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AccountActivityService } from './AccountActivityService';\n\n/**\n * Subscribe to account activity (transactions and balance updates)\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address\n */\nexport type AccountActivityServiceSubscribeAction = {\n type: `AccountActivityService:subscribe`;\n handler: AccountActivityService['subscribe'];\n};\n\n/**\n * Unsubscribe from account activity for specified address\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address to unsubscribe\n */\nexport type AccountActivityServiceUnsubscribeAction = {\n type: `AccountActivityService:unsubscribe`;\n handler: AccountActivityService['unsubscribe'];\n};\n\n/**\n * Union of all AccountActivityService action types.\n */\nexport type AccountActivityServiceMethodActions =\n | AccountActivityServiceSubscribeAction\n | AccountActivityServiceUnsubscribeAction;\n"]}
@@ -19,8 +19,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
19
19
  var _AccountActivityService_instances, _AccountActivityService_messenger, _AccountActivityService_options, _AccountActivityService_trace, _AccountActivityService_chainsUp, _AccountActivityService_handleAccountActivityUpdate, _AccountActivityService_handleSelectedAccountChange, _AccountActivityService_handleSystemNotification, _AccountActivityService_handleWebSocketStateChange, _AccountActivityService_subscribeToSelectedAccount, _AccountActivityService_unsubscribeFromAllAccountActivity, _AccountActivityService_convertToCaip10Address, _AccountActivityService_forceReconnection;
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.AccountActivityService = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS = exports.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS = void 0;
22
+ const logger_1 = require("../logger.cjs");
22
23
  const BackendWebSocketService_1 = require("./BackendWebSocketService.cjs");
23
- const logger_1 = require("./logger.cjs");
24
24
  const SERVICE_NAME = 'AccountActivityService';
25
25
  const log = (0, logger_1.createModuleLogger)(logger_1.projectLogger, SERVICE_NAME);
26
26
  const MESSENGER_EXPOSED_METHODS = ['subscribe', 'unsubscribe'];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService.cjs","sourceRoot":"","sources":["../../src/ws/Acc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AG,CAAC,+DAA+D,CAAC,CAAC;IAErE,yEAAyE;IACzE,kEAAkE;IAClE,MAAM,uBAAA,IAAI,yCAAW,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * Account Activity Service for monitoring account transactions and balance changes\n *\n * This service subscribes to account activity and receives all transactions\n * and balance updates for those accounts via the comprehensive AccountActivityMessage format.\n */\n\nimport type {\n AccountsControllerGetSelectedAccountAction,\n AccountsControllerSelectedAccountChangeEvent,\n} from '@metamask/accounts-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { Messenger } from '@metamask/messenger';\n\nimport { projectLogger, createModuleLogger } from '../logger';\nimport type {\n Transaction,\n AccountActivityMessage,\n BalanceUpdate,\n} from '../types';\nimport type { AccountActivityServiceMethodActions } from './AccountActivityService-method-action-types';\nimport type {\n WebSocketConnectionInfo,\n BackendWebSocketServiceConnectionStateChangedEvent,\n ServerNotificationMessage,\n} from './BackendWebSocketService';\nimport { WebSocketState } from './BackendWebSocketService';\nimport type { BackendWebSocketServiceMethodActions } from './BackendWebSocketService-method-action-types';\n\n// =============================================================================\n// Types and Constants\n// =============================================================================\n\n/**\n * System notification data for chain status updates\n */\nexport type SystemNotificationData = {\n /** Array of chain IDs affected (e.g., ['eip155:137', 'eip155:1']) */\n chainIds: string[];\n /** Status of the chains: 'down' or 'up' */\n status: 'down' | 'up';\n /** Timestamp of the notification */\n timestamp?: number;\n};\n\nconst SERVICE_NAME = 'AccountActivityService';\n\nconst log = createModuleLogger(projectLogger, SERVICE_NAME);\n\nconst MESSENGER_EXPOSED_METHODS = ['subscribe', 'unsubscribe'] as const;\n\nconst SUBSCRIPTION_NAMESPACE = 'account-activity.v1';\n\n/**\n * Account subscription options\n */\nexport type SubscriptionOptions = {\n address: string; // Should be in CAIP-10 format, e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\"\n};\n\n/**\n * Configuration options for the account activity service\n */\nexport type AccountActivityServiceOptions = {\n /** Custom subscription namespace (default: 'account-activity.v1') */\n subscriptionNamespace?: string;\n /** Optional callback to trace performance of account activity operations (default: no-op) */\n traceFn?: TraceCallback;\n};\n\n// =============================================================================\n// Action and Event Types\n// =============================================================================\n\n// Action types for the messaging system - using generated method actions\nexport type AccountActivityServiceActions = AccountActivityServiceMethodActions;\n\n// Allowed actions that AccountActivityService can call on other controllers\nexport const ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS = [\n 'AccountsController:getSelectedAccount',\n 'BackendWebSocketService:connect',\n 'BackendWebSocketService:forceReconnection',\n 'BackendWebSocketService:subscribe',\n 'BackendWebSocketService:getConnectionInfo',\n 'BackendWebSocketService:channelHasSubscription',\n 'BackendWebSocketService:getSubscriptionsByChannel',\n 'BackendWebSocketService:findSubscriptionsByChannelPrefix',\n 'BackendWebSocketService:addChannelCallback',\n 'BackendWebSocketService:removeChannelCallback',\n] as const;\n\n// Allowed events that AccountActivityService can listen to\nexport const ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS = [\n 'AccountsController:selectedAccountChange',\n 'BackendWebSocketService:connectionStateChanged',\n] as const;\n\nexport type AllowedActions =\n | AccountsControllerGetSelectedAccountAction\n | BackendWebSocketServiceMethodActions;\n\n// Event types for the messaging system\n\nexport type AccountActivityServiceTransactionUpdatedEvent = {\n type: `AccountActivityService:transactionUpdated`;\n payload: [Transaction];\n};\n\nexport type AccountActivityServiceBalanceUpdatedEvent = {\n type: `AccountActivityService:balanceUpdated`;\n payload: [{ address: string; chain: string; updates: BalanceUpdate[] }];\n};\n\nexport type AccountActivityServiceSubscriptionErrorEvent = {\n type: `AccountActivityService:subscriptionError`;\n payload: [{ addresses: string[]; error: string; operation: string }];\n};\n\nexport type AccountActivityServiceStatusChangedEvent = {\n type: `AccountActivityService:statusChanged`;\n payload: [\n {\n chainIds: string[];\n status: 'up' | 'down';\n timestamp?: number;\n },\n ];\n};\n\nexport type AccountActivityServiceEvents =\n | AccountActivityServiceTransactionUpdatedEvent\n | AccountActivityServiceBalanceUpdatedEvent\n | AccountActivityServiceSubscriptionErrorEvent\n | AccountActivityServiceStatusChangedEvent;\n\nexport type AllowedEvents =\n | AccountsControllerSelectedAccountChangeEvent\n | BackendWebSocketServiceConnectionStateChangedEvent;\n\nexport type AccountActivityServiceMessenger = Messenger<\n typeof SERVICE_NAME,\n AccountActivityServiceActions | AllowedActions,\n AccountActivityServiceEvents | AllowedEvents\n>;\n\n// =============================================================================\n// Main Service Class\n// =============================================================================\n\n/**\n * High-performance service for real-time account activity monitoring using optimized\n * WebSocket subscriptions with direct callback routing. Automatically subscribes to\n * the currently selected account and switches subscriptions when the selected account changes.\n * Receives transactions and balance updates using the comprehensive AccountActivityMessage format.\n *\n * Performance Features:\n * - Direct callback routing (no EventEmitter overhead)\n * - Minimal subscription tracking (no duplication with BackendWebSocketService)\n * - Optimized cleanup for mobile environments\n * - Single-account subscription (only selected account)\n * - Comprehensive balance updates with transfer tracking\n *\n * Architecture:\n * - Uses messenger pattern to communicate with BackendWebSocketService\n * - AccountActivityService tracks channel-to-subscriptionId mappings via messenger calls\n * - Automatically subscribes to selected account on initialization\n * - Switches subscriptions when selected account changes\n * - No direct dependency on BackendWebSocketService (uses messenger instead)\n *\n * @example\n * ```typescript\n * const service = new AccountActivityService({\n * messenger: activityMessenger,\n * });\n *\n * // Service automatically subscribes to the currently selected account\n * // When user switches accounts, service automatically resubscribes\n *\n * // All transactions and balance updates are received via optimized\n * // WebSocket callbacks and processed with zero-allocation routing\n * // Balance updates include comprehensive transfer details and post-transaction balances\n * ```\n */\nexport class AccountActivityService {\n /**\n * The name of the service.\n */\n readonly name = SERVICE_NAME;\n\n readonly #messenger: AccountActivityServiceMessenger;\n\n readonly #options: Required<Omit<AccountActivityServiceOptions, 'traceFn'>>;\n\n readonly #trace: TraceCallback;\n\n // Track chains that are currently up (based on system notifications)\n readonly #chainsUp: Set<string> = new Set();\n\n // =============================================================================\n // Constructor and Initialization\n // =============================================================================\n\n /**\n * Creates a new Account Activity service instance\n *\n * @param options - Configuration options including messenger\n */\n constructor(\n options: AccountActivityServiceOptions & {\n messenger: AccountActivityServiceMessenger;\n },\n ) {\n this.#messenger = options.messenger;\n\n // Set configuration with defaults\n this.#options = {\n subscriptionNamespace:\n options.subscriptionNamespace ?? SUBSCRIPTION_NAMESPACE,\n };\n\n // Default to no-op trace function to keep core platform-agnostic\n this.#trace =\n options.traceFn ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (((_request: any, fn?: any) => fn?.()) as TraceCallback);\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n this.#messenger.subscribe(\n 'AccountsController:selectedAccountChange',\n // Promise result intentionally not awaited\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (account: InternalAccount) =>\n await this.#handleSelectedAccountChange(account),\n );\n this.#messenger.subscribe(\n 'BackendWebSocketService:connectionStateChanged',\n // Promise result intentionally not awaited\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n (connectionInfo: WebSocketConnectionInfo) =>\n this.#handleWebSocketStateChange(connectionInfo),\n );\n this.#messenger.call('BackendWebSocketService:addChannelCallback', {\n channelName: `system-notifications.v1.${this.#options.subscriptionNamespace}`,\n callback: (notification: ServerNotificationMessage) =>\n this.#handleSystemNotification(notification),\n });\n }\n\n // =============================================================================\n // Account Subscription Methods\n // =============================================================================\n\n /**\n * Subscribe to account activity (transactions and balance updates)\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address\n */\n async subscribe(subscription: SubscriptionOptions): Promise<void> {\n try {\n await this.#messenger.call('BackendWebSocketService:connect');\n\n // Create channel name from address\n const channel = `${this.#options.subscriptionNamespace}.${subscription.address}`;\n\n // Check if already subscribed\n if (\n this.#messenger.call(\n 'BackendWebSocketService:channelHasSubscription',\n channel,\n )\n ) {\n return;\n }\n\n // Create subscription using the proper subscribe method (this will be stored in WebSocketService's internal tracking)\n await this.#messenger.call('BackendWebSocketService:subscribe', {\n channels: [channel],\n channelType: this.#options.subscriptionNamespace, // e.g., 'account-activity.v1'\n callback: (notification: ServerNotificationMessage) => {\n this.#handleAccountActivityUpdate(\n notification.data as AccountActivityMessage,\n );\n },\n });\n } catch (error) {\n log('Subscription failed, forcing reconnection', { error });\n await this.#forceReconnection();\n }\n }\n\n /**\n * Unsubscribe from account activity for specified address\n * Address should be in CAIP-10 format (e.g., \"eip155:0:0x1234...\" or \"solana:0:ABC123...\")\n *\n * @param subscription - Account subscription configuration with address to unsubscribe\n */\n async unsubscribe(subscription: SubscriptionOptions): Promise<void> {\n const { address } = subscription;\n try {\n // Find channel for the specified address\n const channel = `${this.#options.subscriptionNamespace}.${address}`;\n const subscriptions = this.#messenger.call(\n 'BackendWebSocketService:getSubscriptionsByChannel',\n channel,\n );\n\n if (subscriptions.length === 0) {\n return;\n }\n\n // Fast path: Direct unsubscribe using stored unsubscribe function\n // Unsubscribe from all matching subscriptions\n for (const subscriptionInfo of subscriptions) {\n await subscriptionInfo.unsubscribe();\n }\n } catch (error) {\n log('Unsubscription failed, forcing reconnection', { error });\n await this.#forceReconnection();\n }\n }\n\n // =============================================================================\n // Private Methods - Event Handlers\n // =============================================================================\n\n /**\n * Handle account activity updates (transactions + balance changes)\n * Processes the comprehensive AccountActivityMessage format with detailed balance updates and transfers\n *\n * @param payload - The account activity message containing transaction and balance updates\n * @example AccountActivityMessage format handling:\n * Input: {\n * address: \"0xd14b52362b5b777ffa754c666ddec6722aaeee08\",\n * tx: { id: \"0x1cde...\", chain: \"eip155:8453\", status: \"confirmed\", timestamp: 1760099871, ... },\n * updates: [{\n * asset: { fungible: true, type: \"eip155:8453/erc20:0x833...\", unit: \"USDC\", decimals: 6 },\n * postBalance: { amount: \"0xc350\" },\n * transfers: [{ from: \"0x7b07...\", to: \"0xd14b...\", amount: \"0x2710\" }]\n * }]\n * }\n * Output: Transaction and balance updates published separately\n */\n #handleAccountActivityUpdate(payload: AccountActivityMessage): void {\n const { address, tx, updates } = payload;\n\n // Calculate time elapsed between transaction time and message receipt\n const txTimestampMs = tx.timestamp * 1000; // Convert Unix timestamp (seconds) to milliseconds\n const elapsedMs = Date.now() - txTimestampMs;\n\n log('Handling account activity update', {\n address,\n updateCount: updates.length,\n elapsedMs,\n });\n\n // Trace message receipt with latency from transaction time to now\n // Promise result intentionally not awaited\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.#trace(\n {\n name: `${SERVICE_NAME} Transaction Message`,\n data: {\n chain: tx.chain,\n status: tx.status,\n elapsed_ms: elapsedMs,\n },\n tags: {\n service: SERVICE_NAME,\n notification_type: this.#options.subscriptionNamespace,\n },\n },\n () => {\n // Process transaction update\n this.#messenger.publish(\n `AccountActivityService:transactionUpdated`,\n tx,\n );\n\n // Publish comprehensive balance updates with transfer details\n this.#messenger.publish(`AccountActivityService:balanceUpdated`, {\n address,\n chain: tx.chain,\n updates,\n });\n },\n );\n }\n\n /**\n * Handle selected account change event\n *\n * @param newAccount - The newly selected account\n */\n async #handleSelectedAccountChange(\n newAccount: InternalAccount | null,\n ): Promise<void> {\n if (!newAccount?.address) {\n return;\n }\n\n try {\n // Convert new account to CAIP-10 format\n const newAddress = this.#convertToCaip10Address(newAccount);\n\n // First, unsubscribe from all current account activity subscriptions to avoid multiple subscriptions\n await this.#unsubscribeFromAllAccountActivity();\n\n // Then, subscribe to the new selected account\n await this.subscribe({ address: newAddress });\n } catch (error) {\n log('Account change failed', { error });\n }\n }\n\n /**\n * Handle system notification for chain status changes\n * Publishes only the status change (delta) for affected chains\n *\n * @param notification - Server notification message containing chain status updates and timestamp\n */\n #handleSystemNotification(notification: ServerNotificationMessage): void {\n const data = notification.data as SystemNotificationData;\n const { timestamp } = notification;\n\n // Validate required fields\n if (!data.chainIds || !Array.isArray(data.chainIds) || !data.status) {\n throw new Error(\n 'Invalid system notification data: missing chainIds or status',\n );\n }\n\n // Track chain status\n if (data.status === 'up') {\n for (const chainId of data.chainIds) {\n this.#chainsUp.add(chainId);\n }\n } else {\n for (const chainId of data.chainIds) {\n this.#chainsUp.delete(chainId);\n }\n }\n\n // Publish status change directly (delta update)\n this.#messenger.publish(`AccountActivityService:statusChanged`, {\n chainIds: data.chainIds,\n status: data.status,\n timestamp,\n });\n\n log(\n `WebSocket status change - Published tracked chains as ${data.status}`,\n {\n count: data.chainIds.length,\n chains: data.chainIds,\n status: data.status,\n },\n );\n }\n\n /**\n * Handle WebSocket connection state changes for fallback polling and resubscription\n *\n * @param connectionInfo - WebSocket connection state information\n */\n async #handleWebSocketStateChange(\n connectionInfo: WebSocketConnectionInfo,\n ): Promise<void> {\n const { state } = connectionInfo;\n\n if (state === WebSocketState.CONNECTED) {\n // WebSocket connected - resubscribe to selected account\n // The system notification will automatically provide the list of chains that are up\n await this.#subscribeToSelectedAccount();\n } else if (state === WebSocketState.DISCONNECTED) {\n // On disconnect, flush all tracked chains as down\n const chainsToMarkDown = Array.from(this.#chainsUp);\n\n if (chainsToMarkDown.length > 0) {\n this.#messenger.publish(`AccountActivityService:statusChanged`, {\n chainIds: chainsToMarkDown,\n status: 'down',\n timestamp: Date.now(),\n });\n\n log('WebSocket disconnection - Published tracked chains as down', {\n count: chainsToMarkDown.length,\n chains: chainsToMarkDown,\n });\n\n // Clear the tracking set since all chains are now down\n this.#chainsUp.clear();\n }\n }\n }\n\n // =============================================================================\n // Private Methods - Subscription Management\n // =============================================================================\n\n /**\n * Subscribe to the currently selected account only\n */\n async #subscribeToSelectedAccount(): Promise<void> {\n const selectedAccount = this.#messenger.call(\n 'AccountsController:getSelectedAccount',\n );\n\n if (!selectedAccount?.address) {\n return;\n }\n\n // Convert to CAIP-10 format and subscribe\n const address = this.#convertToCaip10Address(selectedAccount);\n await this.subscribe({ address });\n }\n\n /**\n * Unsubscribe from all account activity subscriptions for this service\n * Finds all channels matching the service's namespace and unsubscribes from them\n */\n async #unsubscribeFromAllAccountActivity(): Promise<void> {\n const accountActivitySubscriptions = this.#messenger.call(\n 'BackendWebSocketService:findSubscriptionsByChannelPrefix',\n this.#options.subscriptionNamespace,\n );\n\n // Unsubscribe from all matching subscriptions\n for (const subscription of accountActivitySubscriptions) {\n await subscription.unsubscribe();\n }\n }\n\n // =============================================================================\n // Private Methods - Utility Functions\n // =============================================================================\n\n /**\n * Convert an InternalAccount address to CAIP-10 format or raw address\n *\n * @param account - The internal account to convert\n * @returns The CAIP-10 formatted address or raw address\n */\n #convertToCaip10Address(account: InternalAccount): string {\n // Check if account has EVM scopes\n if (account.scopes.some((scope) => scope.startsWith('eip155:'))) {\n // CAIP-10 format: eip155:0:address (subscribe to all EVM chains)\n return `eip155:0:${account.address}`;\n }\n\n // Check if account has Solana scopes\n if (account.scopes.some((scope) => scope.startsWith('solana:'))) {\n // CAIP-10 format: solana:0:address (subscribe to all Solana chains)\n return `solana:0:${account.address}`;\n }\n\n // For other chains or unknown scopes, return raw address\n return account.address;\n }\n\n /**\n * Force WebSocket reconnection to clean up subscription state\n */\n async #forceReconnection(): Promise<void> {\n log('Forcing WebSocket reconnection to clean up subscription state');\n\n // Use the dedicated forceReconnection method which performs a controlled\n // disconnect-then-connect sequence to clean up subscription state\n await this.#messenger.call('BackendWebSocketService:forceReconnection');\n }\n\n // =============================================================================\n // Public Methods - Cleanup\n // =============================================================================\n\n /**\n * Destroy the service and clean up all resources\n * Optimized for fast cleanup during service destruction or mobile app termination\n */\n destroy(): void {\n // Clean up system notification callback\n this.#messenger.call(\n 'BackendWebSocketService:removeChannelCallback',\n `system-notifications.v1.${this.#options.subscriptionNamespace}`,\n );\n }\n}\n"]}
@@ -7,10 +7,10 @@
7
7
  import type { AccountsControllerGetSelectedAccountAction, AccountsControllerSelectedAccountChangeEvent } from "@metamask/accounts-controller";
8
8
  import type { TraceCallback } from "@metamask/controller-utils";
9
9
  import type { Messenger } from "@metamask/messenger";
10
+ import type { Transaction, BalanceUpdate } from "../types.cjs";
10
11
  import type { AccountActivityServiceMethodActions } from "./AccountActivityService-method-action-types.cjs";
11
12
  import type { BackendWebSocketServiceConnectionStateChangedEvent } from "./BackendWebSocketService.cjs";
12
13
  import type { BackendWebSocketServiceMethodActions } from "./BackendWebSocketService-method-action-types.cjs";
13
- import type { Transaction, BalanceUpdate } from "./types.cjs";
14
14
  /**
15
15
  * System notification data for chain status updates
16
16
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService.d.cts","sourceRoot":"","sources":["../../src/ws/AccountActivityService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,0CAA0C,EAC1C,4CAA4C,EAC7C,sCAAsC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAGrD,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EACd,qBAAiB;AAClB,OAAO,KAAK,EAAE,mCAAmC,EAAE,yDAAqD;AACxG,OAAO,KAAK,EAEV,kDAAkD,EAEnD,sCAAkC;AAEnC,OAAO,KAAK,EAAE,oCAAoC,EAAE,0DAAsD;AAM1G;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,YAAY,2BAA2B,CAAC;AAQ9C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,qEAAqE;IACrE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6FAA6F;IAC7F,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAOF,MAAM,MAAM,6BAA6B,GAAG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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,sBAAsB;;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,4BAAgB;IAe7B;;;;OAIG;gBAED,OAAO,EAAE,6BAA6B,GAAG;QACvC,SAAS,EAAE,+BAA+B,CAAC;KAC5C;IA6CH;;;;;OAKG;IACG,SAAS,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCjE;;;;;OAKG;IACG,WAAW,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsRnE;;;OAGG;IACH,OAAO,IAAI,IAAI;CAOhB"}
@@ -7,10 +7,10 @@
7
7
  import type { AccountsControllerGetSelectedAccountAction, AccountsControllerSelectedAccountChangeEvent } from "@metamask/accounts-controller";
8
8
  import type { TraceCallback } from "@metamask/controller-utils";
9
9
  import type { Messenger } from "@metamask/messenger";
10
+ import type { Transaction, BalanceUpdate } from "../types.mjs";
10
11
  import type { AccountActivityServiceMethodActions } from "./AccountActivityService-method-action-types.mjs";
11
12
  import type { BackendWebSocketServiceConnectionStateChangedEvent } from "./BackendWebSocketService.mjs";
12
13
  import type { BackendWebSocketServiceMethodActions } from "./BackendWebSocketService-method-action-types.mjs";
13
- import type { Transaction, BalanceUpdate } from "./types.mjs";
14
14
  /**
15
15
  * System notification data for chain status updates
16
16
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountActivityService.d.mts","sourceRoot":"","sources":["../../src/ws/AccountActivityService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,0CAA0C,EAC1C,4CAA4C,EAC7C,sCAAsC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAGrD,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EACd,qBAAiB;AAClB,OAAO,KAAK,EAAE,mCAAmC,EAAE,yD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E,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE;QACP;YACE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;YACtB,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB;KACF,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC,6CAA6C,GAC7C,yCAAyC,GACzC,4CAA4C,GAC5C,wCAAwC,CAAC;AAE7C,MAAM,MAAM,aAAa,GACrB,4CAA4C,GAC5C,kDAAkD,CAAC;AAEvD,MAAM,MAAM,+BAA+B,GAAG,SAAS,CACrD,OAAO,YAAY,EACnB,6BAA6B,GAAG,cAAc,EAC9C,4BAA4B,GAAG,aAAa,CAC7C,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,sBAAsB;;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,4BAAgB;IAe7B;;;;OAIG;gBAED,OAAO,EAAE,6BAA6B,GAAG;QACvC,SAAS,EAAE,+BAA+B,CAAC;KAC5C;IA6CH;;;;;OAKG;IACG,SAAS,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCjE;;;;;OAKG;IACG,WAAW,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsRnE;;;OAGG;IACH,OAAO,IAAI,IAAI;CAOhB"}
@@ -16,8 +16,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
17
  };
18
18
  var _AccountActivityService_instances, _AccountActivityService_messenger, _AccountActivityService_options, _AccountActivityService_trace, _AccountActivityService_chainsUp, _AccountActivityService_handleAccountActivityUpdate, _AccountActivityService_handleSelectedAccountChange, _AccountActivityService_handleSystemNotification, _AccountActivityService_handleWebSocketStateChange, _AccountActivityService_subscribeToSelectedAccount, _AccountActivityService_unsubscribeFromAllAccountActivity, _AccountActivityService_convertToCaip10Address, _AccountActivityService_forceReconnection;
19
+ import { projectLogger, createModuleLogger } from "../logger.mjs";
19
20
  import { WebSocketState } from "./BackendWebSocketService.mjs";
20
- import { projectLogger, createModuleLogger } from "./logger.mjs";
21
21
  const SERVICE_NAME = 'AccountActivityService';
22
22
  const log = createModuleLogger(projectLogger, SERVICE_NAME);
23
23
  const MESSENGER_EXPOSED_METHODS = ['subscribe', 'unsubscribe'];