@metamask-previews/core-backend 5.0.0-preview-cd0d0950 → 5.0.0-preview-91e0d8c4

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 (147) hide show
  1. package/CHANGELOG.md +3 -12
  2. package/README.md +1 -252
  3. package/dist/index.cjs +4 -33
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +7 -6
  6. package/dist/index.d.cts.map +1 -1
  7. package/dist/index.d.mts +7 -6
  8. package/dist/index.d.mts.map +1 -1
  9. package/dist/index.mjs +5 -21
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +3 -4
  12. package/dist/api/ApiPlatformClient.cjs +0 -177
  13. package/dist/api/ApiPlatformClient.cjs.map +0 -1
  14. package/dist/api/ApiPlatformClient.d.cts +0 -127
  15. package/dist/api/ApiPlatformClient.d.cts.map +0 -1
  16. package/dist/api/ApiPlatformClient.d.mts +0 -127
  17. package/dist/api/ApiPlatformClient.d.mts.map +0 -1
  18. package/dist/api/ApiPlatformClient.mjs +0 -172
  19. package/dist/api/ApiPlatformClient.mjs.map +0 -1
  20. package/dist/api/accounts/client.cjs +0 -492
  21. package/dist/api/accounts/client.cjs.map +0 -1
  22. package/dist/api/accounts/client.d.cts +0 -213
  23. package/dist/api/accounts/client.d.cts.map +0 -1
  24. package/dist/api/accounts/client.d.mts +0 -213
  25. package/dist/api/accounts/client.d.mts.map +0 -1
  26. package/dist/api/accounts/client.mjs +0 -488
  27. package/dist/api/accounts/client.mjs.map +0 -1
  28. package/dist/api/accounts/index.cjs +0 -9
  29. package/dist/api/accounts/index.cjs.map +0 -1
  30. package/dist/api/accounts/index.d.cts +0 -6
  31. package/dist/api/accounts/index.d.cts.map +0 -1
  32. package/dist/api/accounts/index.d.mts +0 -6
  33. package/dist/api/accounts/index.d.mts.map +0 -1
  34. package/dist/api/accounts/index.mjs +0 -5
  35. package/dist/api/accounts/index.mjs.map +0 -1
  36. package/dist/api/accounts/types.cjs +0 -7
  37. package/dist/api/accounts/types.cjs.map +0 -1
  38. package/dist/api/accounts/types.d.cts +0 -195
  39. package/dist/api/accounts/types.d.cts.map +0 -1
  40. package/dist/api/accounts/types.d.mts +0 -195
  41. package/dist/api/accounts/types.d.mts.map +0 -1
  42. package/dist/api/accounts/types.mjs +0 -6
  43. package/dist/api/accounts/types.mjs.map +0 -1
  44. package/dist/api/base-client.cjs +0 -149
  45. package/dist/api/base-client.cjs.map +0 -1
  46. package/dist/api/base-client.d.cts +0 -54
  47. package/dist/api/base-client.d.cts.map +0 -1
  48. package/dist/api/base-client.d.mts +0 -54
  49. package/dist/api/base-client.d.mts.map +0 -1
  50. package/dist/api/base-client.mjs +0 -143
  51. package/dist/api/base-client.mjs.map +0 -1
  52. package/dist/api/index.cjs +0 -35
  53. package/dist/api/index.cjs.map +0 -1
  54. package/dist/api/index.d.cts +0 -18
  55. package/dist/api/index.d.cts.map +0 -1
  56. package/dist/api/index.d.mts +0 -18
  57. package/dist/api/index.d.mts.map +0 -1
  58. package/dist/api/index.mjs +0 -18
  59. package/dist/api/index.mjs.map +0 -1
  60. package/dist/api/prices/client.cjs +0 -521
  61. package/dist/api/prices/client.cjs.map +0 -1
  62. package/dist/api/prices/client.d.cts +0 -235
  63. package/dist/api/prices/client.d.cts.map +0 -1
  64. package/dist/api/prices/client.d.mts +0 -235
  65. package/dist/api/prices/client.d.mts.map +0 -1
  66. package/dist/api/prices/client.mjs +0 -517
  67. package/dist/api/prices/client.mjs.map +0 -1
  68. package/dist/api/prices/index.cjs +0 -9
  69. package/dist/api/prices/index.cjs.map +0 -1
  70. package/dist/api/prices/index.d.cts +0 -6
  71. package/dist/api/prices/index.d.cts.map +0 -1
  72. package/dist/api/prices/index.d.mts +0 -6
  73. package/dist/api/prices/index.d.mts.map +0 -1
  74. package/dist/api/prices/index.mjs +0 -5
  75. package/dist/api/prices/index.mjs.map +0 -1
  76. package/dist/api/prices/types.cjs +0 -7
  77. package/dist/api/prices/types.cjs.map +0 -1
  78. package/dist/api/prices/types.d.cts +0 -61
  79. package/dist/api/prices/types.d.cts.map +0 -1
  80. package/dist/api/prices/types.d.mts +0 -61
  81. package/dist/api/prices/types.d.mts.map +0 -1
  82. package/dist/api/prices/types.mjs +0 -6
  83. package/dist/api/prices/types.mjs.map +0 -1
  84. package/dist/api/shared-types.cjs +0 -93
  85. package/dist/api/shared-types.cjs.map +0 -1
  86. package/dist/api/shared-types.d.cts +0 -131
  87. package/dist/api/shared-types.d.cts.map +0 -1
  88. package/dist/api/shared-types.d.mts +0 -131
  89. package/dist/api/shared-types.d.mts.map +0 -1
  90. package/dist/api/shared-types.mjs +0 -87
  91. package/dist/api/shared-types.mjs.map +0 -1
  92. package/dist/api/test-utils.cjs +0 -70
  93. package/dist/api/test-utils.cjs.map +0 -1
  94. package/dist/api/test-utils.d.cts +0 -30
  95. package/dist/api/test-utils.d.cts.map +0 -1
  96. package/dist/api/test-utils.d.mts +0 -30
  97. package/dist/api/test-utils.d.mts.map +0 -1
  98. package/dist/api/test-utils.mjs +0 -64
  99. package/dist/api/test-utils.mjs.map +0 -1
  100. package/dist/api/token/client.cjs +0 -342
  101. package/dist/api/token/client.cjs.map +0 -1
  102. package/dist/api/token/client.d.cts +0 -193
  103. package/dist/api/token/client.d.cts.map +0 -1
  104. package/dist/api/token/client.d.mts +0 -193
  105. package/dist/api/token/client.d.mts.map +0 -1
  106. package/dist/api/token/client.mjs +0 -338
  107. package/dist/api/token/client.mjs.map +0 -1
  108. package/dist/api/token/index.cjs +0 -9
  109. package/dist/api/token/index.cjs.map +0 -1
  110. package/dist/api/token/index.d.cts +0 -6
  111. package/dist/api/token/index.d.cts.map +0 -1
  112. package/dist/api/token/index.d.mts +0 -6
  113. package/dist/api/token/index.d.mts.map +0 -1
  114. package/dist/api/token/index.mjs +0 -5
  115. package/dist/api/token/index.mjs.map +0 -1
  116. package/dist/api/token/types.cjs +0 -7
  117. package/dist/api/token/types.cjs.map +0 -1
  118. package/dist/api/token/types.d.cts +0 -75
  119. package/dist/api/token/types.d.cts.map +0 -1
  120. package/dist/api/token/types.d.mts +0 -75
  121. package/dist/api/token/types.d.mts.map +0 -1
  122. package/dist/api/token/types.mjs +0 -6
  123. package/dist/api/token/types.mjs.map +0 -1
  124. package/dist/api/tokens/client.cjs +0 -91
  125. package/dist/api/tokens/client.cjs.map +0 -1
  126. package/dist/api/tokens/client.d.cts +0 -45
  127. package/dist/api/tokens/client.d.cts.map +0 -1
  128. package/dist/api/tokens/client.d.mts +0 -45
  129. package/dist/api/tokens/client.d.mts.map +0 -1
  130. package/dist/api/tokens/client.mjs +0 -87
  131. package/dist/api/tokens/client.mjs.map +0 -1
  132. package/dist/api/tokens/index.cjs +0 -9
  133. package/dist/api/tokens/index.cjs.map +0 -1
  134. package/dist/api/tokens/index.d.cts +0 -6
  135. package/dist/api/tokens/index.d.cts.map +0 -1
  136. package/dist/api/tokens/index.d.mts +0 -6
  137. package/dist/api/tokens/index.d.mts.map +0 -1
  138. package/dist/api/tokens/index.mjs +0 -5
  139. package/dist/api/tokens/index.mjs.map +0 -1
  140. package/dist/api/tokens/types.cjs +0 -7
  141. package/dist/api/tokens/types.cjs.map +0 -1
  142. package/dist/api/tokens/types.d.cts +0 -83
  143. package/dist/api/tokens/types.d.cts.map +0 -1
  144. package/dist/api/tokens/types.d.mts +0 -83
  145. package/dist/api/tokens/types.d.mts.map +0 -1
  146. package/dist/api/tokens/types.mjs +0 -6
  147. package/dist/api/tokens/types.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,22 +7,13 @@ 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 `ApiPlatformClient` for unified access to MetaMask backend APIs with TanStack Query caching ([#7658](https://github.com/MetaMask/core/pull/7658))
13
- - Automatic request deduplication and intelligent caching
14
- - Automatic retries with exponential backoff for transient failures
15
- - Support for Accounts API, Price API, Token API, and Tokens API endpoints
16
- - Export helper functions `shouldRetry` and `calculateRetryDelay` for custom retry logic
17
- - Export API types for external consumers
18
-
19
10
  ### Changed
20
11
 
21
12
  - Upgrade `@metamask/utils` from `^11.8.1` to `^11.9.0` ([#7511](https://github.com/MetaMask/core/pull/7511))
22
- - Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209), [#7604](https://github.com/MetaMask/core/pull/7604), [#7642](https://github.com/MetaMask/core/pull/7642), [#7713](https://github.com/MetaMask/core/pull/7713))
13
+ - Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209))
23
14
  - The dependencies moved are:
24
- - `@metamask/accounts-controller` (^35.0.2)
25
- - `@metamask/keyring-controller` (^25.1.0)
15
+ - `@metamask/accounts-controller` (^35.0.0)
16
+ - `@metamask/keyring-controller` (^25.0.0)
26
17
  - In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
27
18
  - For example, this scenario would be valid: a client relies on `@metamask/controller-a` 1.0.0 and `@metamask/controller-b` 1.0.0, and `@metamask/controller-b` depends on `@metamask/controller-a` 1.1.0.
28
19
  - Note, however, that the versions specified in the client's `package.json` always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
package/README.md CHANGED
@@ -19,17 +19,6 @@ Core backend services for MetaMask, serving as the data layer between Backend se
19
19
  - [WebSocket Connection Management](#websocket-connection-management)
20
20
  - [Connection Requirements](#connection-requirements)
21
21
  - [Connection Behavior](#connection-behavior)
22
- - [HTTP API](#http-api)
23
- - [Overview](#overview)
24
- - [Features](#features)
25
- - [Quick Start](#quick-start-1)
26
- - [API Clients](#api-clients)
27
- - [AccountsApiClient](#accountsapiclient)
28
- - [PricesApiClient](#pricesapiclient)
29
- - [TokenApiClient](#tokenapiclient)
30
- - [TokensApiClient](#tokensapiclient)
31
- - [Configuration](#configuration)
32
- - [Cache Management](#cache-management)
33
22
  - [API Reference](#api-reference)
34
23
  - [BackendWebSocketService](#backendwebsocketservice)
35
24
  - [Constructor Options](#constructor-options)
@@ -55,8 +44,6 @@ npm install @metamask/core-backend
55
44
 
56
45
  ### Basic Usage
57
46
 
58
- **WebSocket for Real-time Updates:**
59
-
60
47
  ```typescript
61
48
  import {
62
49
  BackendWebSocketService,
@@ -95,28 +82,6 @@ messenger.subscribe(
95
82
  );
96
83
  ```
97
84
 
98
- **HTTP API for REST Requests:**
99
-
100
- ```typescript
101
- import { ApiPlatformClient } from '@metamask/core-backend';
102
-
103
- // Create API client
104
- const apiClient = new ApiPlatformClient({
105
- clientProduct: 'metamask-extension',
106
- getBearerToken: async () => authController.getBearerToken(),
107
- });
108
-
109
- // Fetch data with automatic caching and deduplication
110
- const balances = await apiClient.accounts.fetchV5MultiAccountBalances([
111
- 'eip155:1:0x742d35cc6634c0532925a3b8d40c4e0e2c6e4e6',
112
- ]);
113
-
114
- const prices = await apiClient.prices.fetchV3SpotPrices([
115
- 'eip155:1/slip44:60', // ETH
116
- 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
117
- ]);
118
- ```
119
-
120
85
  ### Integration with Controllers
121
86
 
122
87
  ```typescript
@@ -182,7 +147,7 @@ graph TD
182
147
 
183
148
  subgraph "Transport Layer"
184
149
  WSS[WebSocketService<br/>• Connection management<br/>• Automatic reconnection<br/>• Message routing<br/>• Subscription management]
185
- HTTP[HTTP API Clients<br/>• REST API calls<br/>• Automatic caching<br/>• Request deduplication<br/>• Retry with backoff]
150
+ HTTP[HTTP Service<br/>• REST API calls<br/>• Request/response handling<br/>• Error handling<br/>future]
186
151
  end
187
152
  end
188
153
  end
@@ -379,222 +344,6 @@ The WebSocket connects when **ALL 3 conditions are true**:
379
344
  - ✅ **Unexpected disconnects** (network issues, server restart) → Auto-reconnect
380
345
  - ❌ **Manual disconnects** (app backgrounds, wallet locks, user signs out) → Stay disconnected
381
346
 
382
- ## HTTP API
383
-
384
- ### Overview
385
-
386
- The HTTP API provides type-safe clients for accessing MetaMask backend REST APIs. It uses `@tanstack/query-core` for intelligent caching, request deduplication, and automatic retries.
387
-
388
- **Available APIs:**
389
-
390
- | API | Base URL | Purpose |
391
- | ------------ | ----------------------------- | ---------------------------------------------- |
392
- | **Accounts** | `accounts.api.cx.metamask.io` | Balances, transactions, NFTs, token discovery |
393
- | **Prices** | `price.api.cx.metamask.io` | Spot prices, exchange rates, historical prices |
394
- | **Token** | `token.api.cx.metamask.io` | Token metadata, trending, top gainers |
395
- | **Tokens** | `tokens.api.cx.metamask.io` | Bulk asset operations, supported networks |
396
-
397
- ### Features
398
-
399
- - ✅ **Automatic request deduplication** - Identical concurrent requests share a single network call
400
- - ✅ **Intelligent caching** - Configurable stale times per data type (prices: 30s, balances: 1min, networks: 30min)
401
- - ✅ **Automatic retries** - Exponential backoff with jitter, skips 4xx errors (except 429, 408)
402
- - ✅ **Type safety** - Full TypeScript support with response types
403
- - ✅ **Bearer token caching** - Auth tokens cached for 5 minutes
404
- - ✅ **Unified client** - Single entry point or individual API clients
405
-
406
- ### Quick Start
407
-
408
- ```typescript
409
- import {
410
- ApiPlatformClient,
411
- createApiPlatformClient,
412
- } from '@metamask/core-backend';
413
-
414
- // Create unified client
415
- const client = new ApiPlatformClient({
416
- clientProduct: 'metamask-extension',
417
- clientVersion: '12.0.0',
418
- getBearerToken: async () => authController.getBearerToken(),
419
- });
420
-
421
- // Access API methods through sub-clients
422
- const networks = await client.accounts.fetchV2SupportedNetworks();
423
- const balances = await client.accounts.fetchV5MultiAccountBalances([
424
- 'eip155:1:0x742d35cc6634c0532925a3b8d40c4e0e2c6e4e6',
425
- ]);
426
- const prices = await client.prices.fetchV3SpotPrices([
427
- 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
428
- ]);
429
- const tokenList = await client.token.fetchTokenList(1);
430
- const assets = await client.tokens.fetchV3Assets([
431
- 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
432
- ]);
433
- ```
434
-
435
- Or use individual clients:
436
-
437
- ```typescript
438
- import { AccountsApiClient, PricesApiClient } from '@metamask/core-backend';
439
-
440
- const accountsClient = new AccountsApiClient({
441
- clientProduct: 'metamask-extension',
442
- });
443
-
444
- const pricesClient = new PricesApiClient({
445
- clientProduct: 'metamask-extension',
446
- getBearerToken: async () => token,
447
- });
448
- ```
449
-
450
- ### API Clients
451
-
452
- #### AccountsApiClient
453
-
454
- Handles account-related operations including balances, transactions, NFTs, and token discovery.
455
-
456
- | Method | Description |
457
- | ------------------------------------------------------- | ------------------------------------------ |
458
- | `fetchV1SupportedNetworks()` | Get supported networks (v1) |
459
- | `fetchV2SupportedNetworks()` | Get supported networks (v2) |
460
- | `fetchV2ActiveNetworks(accountIds, options?)` | Get active networks by CAIP-10 account IDs |
461
- | `fetchV2Balances(address, options?)` | Get balances for single address |
462
- | `fetchV2BalancesWithOptions(address, options?)` | Get balances with filters |
463
- | `fetchV4MultiAccountBalances(addresses, options?)` | Get balances for multiple addresses |
464
- | `fetchV5MultiAccountBalances(accountIds, options?)` | Get balances using CAIP-10 IDs |
465
- | `fetchV1TransactionByHash(chainId, txHash, options?)` | Get transaction by hash |
466
- | `fetchV1AccountTransactions(address, options?)` | Get account transactions |
467
- | `fetchV4MultiAccountTransactions(accountIds, options?)` | Get multi-account transactions |
468
- | `fetchV1AccountRelationship(chainId, from, to)` | Get address relationship |
469
- | `fetchV2AccountNfts(address, options?)` | Get account NFTs |
470
- | `fetchV2AccountTokens(address, options?)` | Get detected ERC20 tokens |
471
- | `invalidateBalances()` | Invalidate all balance cache |
472
- | `invalidateAccounts()` | Invalidate all account cache |
473
-
474
- #### PricesApiClient
475
-
476
- Handles price-related operations including spot prices, exchange rates, and historical data.
477
-
478
- | Method | Description |
479
- | ----------------------------------------------------------------------- | ------------------------------------------------ |
480
- | `fetchPriceV1SupportedNetworks()` | Get price-supported networks (v1) |
481
- | `fetchPriceV2SupportedNetworks()` | Get price-supported networks in CAIP format (v2) |
482
- | `fetchV1ExchangeRates(baseCurrency)` | Get exchange rates for base currency |
483
- | `fetchV1FiatExchangeRates()` | Get fiat exchange rates |
484
- | `fetchV1CryptoExchangeRates()` | Get crypto exchange rates |
485
- | `fetchV1SpotPricesByCoinIds(coinIds)` | Get spot prices by CoinGecko IDs |
486
- | `fetchV1SpotPriceByCoinId(coinId, currency?)` | Get single coin spot price |
487
- | `fetchV1TokenPrices(chainId, addresses, options?)` | Get token prices on chain |
488
- | `fetchV1TokenPrice(chainId, address, currency?)` | Get single token price |
489
- | `fetchV2SpotPrices(chainId, addresses, options?)` | Get spot prices with market data |
490
- | `fetchV3SpotPrices(assetIds, options?)` | Get spot prices by CAIP-19 asset IDs |
491
- | `fetchV1HistoricalPricesByCoinId(coinId, options?)` | Get historical prices by CoinGecko ID |
492
- | `fetchV1HistoricalPricesByTokenAddresses(chainId, addresses, options?)` | Get historical prices for tokens |
493
- | `fetchV1HistoricalPrices(chainId, address, options?)` | Get historical prices for single token |
494
- | `fetchV3HistoricalPrices(chainId, assetType, options?)` | Get historical prices by CAIP-19 |
495
- | `fetchV1HistoricalPriceGraphByCoinId(coinId, options?)` | Get price graph by CoinGecko ID |
496
- | `fetchV1HistoricalPriceGraphByTokenAddress(chainId, address, options?)` | Get price graph by token address |
497
- | `invalidatePrices()` | Invalidate all price cache |
498
-
499
- #### TokenApiClient
500
-
501
- Handles token metadata, lists, and trending/popular token discovery.
502
-
503
- | Method | Description |
504
- | -------------------------------------------------- | ------------------------------- |
505
- | `fetchNetworks()` | Get all networks |
506
- | `fetchNetworkByChainId(chainId)` | Get network by chain ID |
507
- | `fetchTokenList(chainId, options?)` | Get token list for chain |
508
- | `fetchV1TokenMetadata(chainId, address, options?)` | Get token metadata |
509
- | `fetchTokenDescription(chainId, address)` | Get token description |
510
- | `fetchV3TrendingTokens(chainIds, options?)` | Get trending tokens |
511
- | `fetchV3TopGainers(chainIds, options?)` | Get top gainers/losers |
512
- | `fetchV3PopularTokens(chainIds, options?)` | Get popular tokens |
513
- | `fetchTopAssets(chainId)` | Get top assets for chain |
514
- | `fetchV1SuggestedOccurrenceFloors()` | Get suggested occurrence floors |
515
-
516
- #### TokensApiClient
517
-
518
- Handles bulk token operations and supported network queries.
519
-
520
- | Method | Description |
521
- | --------------------------------- | ----------------------------------------------------------- |
522
- | `fetchTokenV1SupportedNetworks()` | Get token-supported networks (v1) |
523
- | `fetchTokenV2SupportedNetworks()` | Get token-supported networks with full/partial support (v2) |
524
- | `fetchV3Assets(assetIds)` | Fetch assets by CAIP-19 IDs |
525
- | `invalidateTokens()` | Invalidate all token cache |
526
-
527
- ### Configuration
528
-
529
- ```typescript
530
- type ApiPlatformClientOptions = {
531
- /** Client product identifier (e.g., 'metamask-extension', 'metamask-mobile') */
532
- clientProduct: string;
533
- /** Optional client version (default: '1.0.0') */
534
- clientVersion?: string;
535
- /** Function to get bearer token for authenticated requests */
536
- getBearerToken?: () => Promise<string | undefined>;
537
- /** Optional custom QueryClient instance for shared caching */
538
- queryClient?: QueryClient;
539
- };
540
- ```
541
-
542
- **Default Stale Times:**
543
-
544
- | Data Type | Stale Time |
545
- | ------------------ | ---------- |
546
- | Prices | 30 seconds |
547
- | Balances | 1 minute |
548
- | Transactions | 30 seconds |
549
- | Networks | 10 minutes |
550
- | Supported Networks | 30 minutes |
551
- | Token Metadata | 5 minutes |
552
- | Token List | 10 minutes |
553
- | Exchange Rates | 5 minutes |
554
- | Trending | 2 minutes |
555
- | Auth Token | 5 minutes |
556
-
557
- **Override Stale Time:**
558
-
559
- ```typescript
560
- // Use custom stale time for specific request
561
- const balances = await client.accounts.fetchV5MultiAccountBalances(
562
- accountIds,
563
- { networks: ['eip155:1'] },
564
- { staleTime: 10000 }, // 10 seconds
565
- );
566
- ```
567
-
568
- ### Cache Management
569
-
570
- ```typescript
571
- // Invalidate all caches
572
- await client.invalidateAll();
573
-
574
- // Invalidate auth token (on logout)
575
- await client.invalidateAuthToken();
576
-
577
- // Domain-specific invalidation
578
- await client.accounts.invalidateBalances();
579
- await client.prices.invalidatePrices();
580
- await client.tokens.invalidateTokens();
581
-
582
- // Clear all cached data
583
- client.clear();
584
-
585
- // Check if query is fetching
586
- const isFetching = client.isFetching(['accounts', 'balances']);
587
-
588
- // Access cached data directly
589
- const cached = client.getCachedData(['accounts', 'balances', 'v5', { ... }]);
590
-
591
- // Set cached data
592
- client.setCachedData(queryKey, data);
593
-
594
- // Access underlying QueryClient for advanced usage
595
- const queryClient = client.queryClient;
596
- ```
597
-
598
347
  ## API Reference
599
348
 
600
349
  ### BackendWebSocketService
package/dist/index.cjs CHANGED
@@ -1,40 +1,11 @@
1
1
  "use strict";
2
- // Core Backend Package Exports
2
+ /**
3
+ * @file Backend platform services for MetaMask.
4
+ */
3
5
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.HttpError = exports.shouldRetry = exports.calculateRetryDelay = exports.GC_TIMES = exports.STALE_TIMES = exports.API_URLS = exports.TokensApiClient = exports.TokenApiClient = exports.PricesApiClient = exports.AccountsApiClient = exports.createApiPlatformClient = exports.ApiPlatformClient = 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
- // ============================================================================
6
- // BACKEND WEBSOCKET SERVICE
7
- // ============================================================================
6
+ exports.AccountActivityService = exports.BackendWebSocketService = void 0;
8
7
  var BackendWebSocketService_1 = require("./BackendWebSocketService.cjs");
9
8
  Object.defineProperty(exports, "BackendWebSocketService", { enumerable: true, get: function () { return BackendWebSocketService_1.BackendWebSocketService; } });
10
- Object.defineProperty(exports, "getCloseReason", { enumerable: true, get: function () { return BackendWebSocketService_1.getCloseReason; } });
11
- Object.defineProperty(exports, "WebSocketState", { enumerable: true, get: function () { return BackendWebSocketService_1.WebSocketState; } });
12
- Object.defineProperty(exports, "WebSocketEventType", { enumerable: true, get: function () { return BackendWebSocketService_1.WebSocketEventType; } });
13
- // ============================================================================
14
- // ACCOUNT ACTIVITY SERVICE
15
- // ============================================================================
16
9
  var AccountActivityService_1 = require("./AccountActivityService.cjs");
17
10
  Object.defineProperty(exports, "AccountActivityService", { enumerable: true, get: function () { return AccountActivityService_1.AccountActivityService; } });
18
- Object.defineProperty(exports, "ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS", { enumerable: true, get: function () { return AccountActivityService_1.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS; } });
19
- Object.defineProperty(exports, "ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS", { enumerable: true, get: function () { return AccountActivityService_1.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS; } });
20
- // ============================================================================
21
- // API PLATFORM CLIENT
22
- // ============================================================================
23
- var api_1 = require("./api/index.cjs");
24
- Object.defineProperty(exports, "ApiPlatformClient", { enumerable: true, get: function () { return api_1.ApiPlatformClient; } });
25
- Object.defineProperty(exports, "createApiPlatformClient", { enumerable: true, get: function () { return api_1.createApiPlatformClient; } });
26
- // Individual API clients
27
- Object.defineProperty(exports, "AccountsApiClient", { enumerable: true, get: function () { return api_1.AccountsApiClient; } });
28
- Object.defineProperty(exports, "PricesApiClient", { enumerable: true, get: function () { return api_1.PricesApiClient; } });
29
- Object.defineProperty(exports, "TokenApiClient", { enumerable: true, get: function () { return api_1.TokenApiClient; } });
30
- Object.defineProperty(exports, "TokensApiClient", { enumerable: true, get: function () { return api_1.TokensApiClient; } });
31
- // Constants
32
- Object.defineProperty(exports, "API_URLS", { enumerable: true, get: function () { return api_1.API_URLS; } });
33
- Object.defineProperty(exports, "STALE_TIMES", { enumerable: true, get: function () { return api_1.STALE_TIMES; } });
34
- Object.defineProperty(exports, "GC_TIMES", { enumerable: true, get: function () { return api_1.GC_TIMES; } });
35
- // Helpers
36
- Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return api_1.calculateRetryDelay; } });
37
- Object.defineProperty(exports, "shouldRetry", { enumerable: true, get: function () { return api_1.shouldRetry; } });
38
- // Errors
39
- Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return api_1.HttpError; } });
40
11
  //# sourceMappingURL=index.cjs.map
@@ -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,sBAAsB;AACtB,+EAA+E;AAE/E,uCAiBe;AAhBb,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,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\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 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;;GAEG;;;AAyBH,yEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAchC,uEAAkE;AAAzD,gIAAA,sBAAsB,OAAA","sourcesContent":["/**\n * @file Backend platform services for MetaMask.\n */\n\n// Transaction and balance update types\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// WebSocket Service - following MetaMask Data Services pattern\nexport type {\n BackendWebSocketServiceOptions,\n WebSocketMessage,\n WebSocketConnectionInfo,\n WebSocketSubscription,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceMessenger,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceConnectionStateChangedEvent,\n WebSocketState,\n WebSocketEventType,\n} from './BackendWebSocketService';\nexport { BackendWebSocketService } from './BackendWebSocketService';\n\n// Account Activity Service\nexport type {\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AccountActivityServiceMessenger,\n} from './AccountActivityService';\nexport { AccountActivityService } from './AccountActivityService';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,9 @@
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
+ /**
2
+ * @file Backend platform services for MetaMask.
3
+ */
5
4
  export type { Transaction, Asset, Balance, Transfer, BalanceUpdate, AccountActivityMessage, } from "./types.cjs";
6
- export { ApiPlatformClient, createApiPlatformClient, AccountsApiClient, PricesApiClient, TokenApiClient, TokensApiClient, API_URLS, STALE_TIMES, GC_TIMES, calculateRetryDelay, shouldRetry, HttpError, } from "./api/index.cjs";
7
- 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";
5
+ export type { BackendWebSocketServiceOptions, WebSocketMessage, WebSocketConnectionInfo, WebSocketSubscription, BackendWebSocketServiceActions, BackendWebSocketServiceMessenger, BackendWebSocketServiceEvents, BackendWebSocketServiceConnectionStateChangedEvent, WebSocketState, WebSocketEventType, } from "./BackendWebSocketService.cjs";
6
+ export { BackendWebSocketService } from "./BackendWebSocketService.cjs";
7
+ export type { SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AccountActivityServiceMessenger, } from "./AccountActivityService.cjs";
8
+ export { AccountActivityService } from "./AccountActivityService.cjs";
8
9
  //# 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,iBAAiB,EACjB,uBAAuB,EAEvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,WAAW,EACX,QAAQ,EAER,mBAAmB,EACnB,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":"AAAA;;GAEG;AAGH,YAAY,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,sBAAsB,GACvB,oBAAgB;AAGjB,YAAY,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,gCAAgC,EAChC,6BAA6B,EAC7B,kDAAkD,EAClD,cAAc,EACd,kBAAkB,GACnB,sCAAkC;AACnC,OAAO,EAAE,uBAAuB,EAAE,sCAAkC;AAGpE,YAAY,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,6CAA6C,EAC7C,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,OAAO,EAAE,sBAAsB,EAAE,qCAAiC"}
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
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
+ /**
2
+ * @file Backend platform services for MetaMask.
3
+ */
5
4
  export type { Transaction, Asset, Balance, Transfer, BalanceUpdate, AccountActivityMessage, } from "./types.mjs";
6
- export { ApiPlatformClient, createApiPlatformClient, AccountsApiClient, PricesApiClient, TokenApiClient, TokensApiClient, API_URLS, STALE_TIMES, GC_TIMES, calculateRetryDelay, shouldRetry, HttpError, } from "./api/index.mjs";
7
- 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";
5
+ export type { BackendWebSocketServiceOptions, WebSocketMessage, WebSocketConnectionInfo, WebSocketSubscription, BackendWebSocketServiceActions, BackendWebSocketServiceMessenger, BackendWebSocketServiceEvents, BackendWebSocketServiceConnectionStateChangedEvent, WebSocketState, WebSocketEventType, } from "./BackendWebSocketService.mjs";
6
+ export { BackendWebSocketService } from "./BackendWebSocketService.mjs";
7
+ export type { SubscriptionOptions, AccountActivityServiceOptions, AccountActivityServiceActions, AccountActivityServiceTransactionUpdatedEvent, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceSubscriptionErrorEvent, AccountActivityServiceStatusChangedEvent, AccountActivityServiceEvents, AccountActivityServiceMessenger, } from "./AccountActivityService.mjs";
8
+ export { AccountActivityService } from "./AccountActivityService.mjs";
8
9
  //# 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,iBAAiB,EACjB,uBAAuB,EAEvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EAEf,QAAQ,EACR,WAAW,EACX,QAAQ,EAER,mBAAmB,EACnB,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":"AAAA;;GAEG;AAGH,YAAY,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,sBAAsB,GACvB,oBAAgB;AAGjB,YAAY,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,gCAAgC,EAChC,6BAA6B,EAC7B,kDAAkD,EAClD,cAAc,EACd,kBAAkB,GACnB,sCAAkC;AACnC,OAAO,EAAE,uBAAuB,EAAE,sCAAkC;AAGpE,YAAY,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,6CAA6C,EAC7C,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,OAAO,EAAE,sBAAsB,EAAE,qCAAiC"}
package/dist/index.mjs CHANGED
@@ -1,22 +1,6 @@
1
- // Core Backend Package Exports
2
- // ============================================================================
3
- // BACKEND WEBSOCKET SERVICE
4
- // ============================================================================
5
- export { BackendWebSocketService, getCloseReason, WebSocketState, WebSocketEventType } from "./BackendWebSocketService.mjs";
6
- // ============================================================================
7
- // ACCOUNT ACTIVITY SERVICE
8
- // ============================================================================
9
- export { AccountActivityService, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS, ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS } from "./AccountActivityService.mjs";
10
- // ============================================================================
11
- // API PLATFORM CLIENT
12
- // ============================================================================
13
- export { ApiPlatformClient, createApiPlatformClient,
14
- // Individual API clients
15
- AccountsApiClient, PricesApiClient, TokenApiClient, TokensApiClient,
16
- // Constants
17
- API_URLS, STALE_TIMES, GC_TIMES,
18
- // Helpers
19
- calculateRetryDelay, shouldRetry,
20
- // Errors
21
- HttpError } from "./api/index.mjs";
1
+ /**
2
+ * @file Backend platform services for MetaMask.
3
+ */
4
+ export { BackendWebSocketService } from "./BackendWebSocketService.mjs";
5
+ export { AccountActivityService } from "./AccountActivityService.mjs";
22
6
  //# sourceMappingURL=index.mjs.map
@@ -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,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,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\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 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;;GAEG;AAyBH,OAAO,EAAE,uBAAuB,EAAE,sCAAkC;AAcpE,OAAO,EAAE,sBAAsB,EAAE,qCAAiC","sourcesContent":["/**\n * @file Backend platform services for MetaMask.\n */\n\n// Transaction and balance update types\nexport type {\n Transaction,\n Asset,\n Balance,\n Transfer,\n BalanceUpdate,\n AccountActivityMessage,\n} from './types';\n\n// WebSocket Service - following MetaMask Data Services pattern\nexport type {\n BackendWebSocketServiceOptions,\n WebSocketMessage,\n WebSocketConnectionInfo,\n WebSocketSubscription,\n BackendWebSocketServiceActions,\n BackendWebSocketServiceMessenger,\n BackendWebSocketServiceEvents,\n BackendWebSocketServiceConnectionStateChangedEvent,\n WebSocketState,\n WebSocketEventType,\n} from './BackendWebSocketService';\nexport { BackendWebSocketService } from './BackendWebSocketService';\n\n// Account Activity Service\nexport type {\n SubscriptionOptions,\n AccountActivityServiceOptions,\n AccountActivityServiceActions,\n AccountActivityServiceTransactionUpdatedEvent,\n AccountActivityServiceBalanceUpdatedEvent,\n AccountActivityServiceSubscriptionErrorEvent,\n AccountActivityServiceStatusChangedEvent,\n AccountActivityServiceEvents,\n AccountActivityServiceMessenger,\n} from './AccountActivityService';\nexport { AccountActivityService } from './AccountActivityService';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/core-backend",
3
- "version": "5.0.0-preview-cd0d0950",
3
+ "version": "5.0.0-preview-91e0d8c4",
4
4
  "description": "Core backend services for MetaMask",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -48,13 +48,12 @@
48
48
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
49
49
  },
50
50
  "dependencies": {
51
- "@metamask/accounts-controller": "^35.0.2",
51
+ "@metamask/accounts-controller": "^35.0.0",
52
52
  "@metamask/controller-utils": "^11.18.0",
53
- "@metamask/keyring-controller": "^25.1.0",
53
+ "@metamask/keyring-controller": "^25.0.0",
54
54
  "@metamask/messenger": "^0.3.0",
55
55
  "@metamask/profile-sync-controller": "^27.0.0",
56
56
  "@metamask/utils": "^11.9.0",
57
- "@tanstack/query-core": "^5.62.16",
58
57
  "uuid": "^8.3.2"
59
58
  },
60
59
  "devDependencies": {