@metamask-previews/core-backend 5.1.1-preview-e8f4442d4 → 5.1.1-preview-27e39dd44

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 (75) hide show
  1. package/CHANGELOG.md +0 -23
  2. package/README.md +55 -60
  3. package/dist/api/accounts/client.cjs +163 -358
  4. package/dist/api/accounts/client.cjs.map +1 -1
  5. package/dist/api/accounts/client.d.cts +12 -198
  6. package/dist/api/accounts/client.d.cts.map +1 -1
  7. package/dist/api/accounts/client.d.mts +12 -198
  8. package/dist/api/accounts/client.d.mts.map +1 -1
  9. package/dist/api/accounts/client.mjs +164 -359
  10. package/dist/api/accounts/client.mjs.map +1 -1
  11. package/dist/api/index.cjs +1 -2
  12. package/dist/api/index.cjs.map +1 -1
  13. package/dist/api/index.d.cts +1 -1
  14. package/dist/api/index.d.cts.map +1 -1
  15. package/dist/api/index.d.mts +1 -1
  16. package/dist/api/index.d.mts.map +1 -1
  17. package/dist/api/index.mjs +1 -1
  18. package/dist/api/index.mjs.map +1 -1
  19. package/dist/api/prices/client.cjs +140 -398
  20. package/dist/api/prices/client.cjs.map +1 -1
  21. package/dist/api/prices/client.d.cts +3 -215
  22. package/dist/api/prices/client.d.cts.map +1 -1
  23. package/dist/api/prices/client.d.mts +3 -215
  24. package/dist/api/prices/client.d.mts.map +1 -1
  25. package/dist/api/prices/client.mjs +140 -398
  26. package/dist/api/prices/client.mjs.map +1 -1
  27. package/dist/api/shared-types.cjs +1 -18
  28. package/dist/api/shared-types.cjs.map +1 -1
  29. package/dist/api/shared-types.d.cts +3 -23
  30. package/dist/api/shared-types.d.cts.map +1 -1
  31. package/dist/api/shared-types.d.mts +3 -23
  32. package/dist/api/shared-types.d.mts.map +1 -1
  33. package/dist/api/shared-types.mjs +0 -16
  34. package/dist/api/shared-types.mjs.map +1 -1
  35. package/dist/api/token/client.cjs +77 -232
  36. package/dist/api/token/client.cjs.map +1 -1
  37. package/dist/api/token/client.d.cts +0 -165
  38. package/dist/api/token/client.d.cts.map +1 -1
  39. package/dist/api/token/client.d.mts +0 -165
  40. package/dist/api/token/client.d.mts.map +1 -1
  41. package/dist/api/token/client.mjs +77 -232
  42. package/dist/api/token/client.mjs.map +1 -1
  43. package/dist/api/tokens/client.cjs +23 -64
  44. package/dist/api/tokens/client.cjs.map +1 -1
  45. package/dist/api/tokens/client.d.cts +0 -24
  46. package/dist/api/tokens/client.d.cts.map +1 -1
  47. package/dist/api/tokens/client.d.mts +0 -24
  48. package/dist/api/tokens/client.d.mts.map +1 -1
  49. package/dist/api/tokens/client.mjs +23 -64
  50. package/dist/api/tokens/client.mjs.map +1 -1
  51. package/dist/index.cjs +1 -8
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +1 -3
  54. package/dist/index.d.cts.map +1 -1
  55. package/dist/index.d.mts +1 -3
  56. package/dist/index.d.mts.map +1 -1
  57. package/dist/index.mjs +1 -5
  58. package/dist/index.mjs.map +1 -1
  59. package/package.json +2 -1
  60. package/dist/ApiPlatformClientService-method-action-types.cjs +0 -7
  61. package/dist/ApiPlatformClientService-method-action-types.cjs.map +0 -1
  62. package/dist/ApiPlatformClientService-method-action-types.d.cts +0 -21
  63. package/dist/ApiPlatformClientService-method-action-types.d.cts.map +0 -1
  64. package/dist/ApiPlatformClientService-method-action-types.d.mts +0 -21
  65. package/dist/ApiPlatformClientService-method-action-types.d.mts.map +0 -1
  66. package/dist/ApiPlatformClientService-method-action-types.mjs +0 -6
  67. package/dist/ApiPlatformClientService-method-action-types.mjs.map +0 -1
  68. package/dist/ApiPlatformClientService.cjs +0 -82
  69. package/dist/ApiPlatformClientService.cjs.map +0 -1
  70. package/dist/ApiPlatformClientService.d.cts +0 -86
  71. package/dist/ApiPlatformClientService.d.cts.map +0 -1
  72. package/dist/ApiPlatformClientService.d.mts +0 -86
  73. package/dist/ApiPlatformClientService.d.mts.map +0 -1
  74. package/dist/ApiPlatformClientService.mjs +0 -78
  75. package/dist/ApiPlatformClientService.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,29 +7,6 @@ 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 `ApiPlatformClientService` to expose `ApiPlatformClient` via the messenger without a controller ([#7928](https://github.com/MetaMask/core/pull/7928))
13
- - Consumers call `messenger.call('ApiPlatformClientService:getApiPlatformClient')` to obtain the shared client for accounts, prices, token, and tokens APIs
14
- - Export TanStack Query options for all API endpoints via `get*QueryOptions` helpers ([#7928](https://github.com/MetaMask/core/pull/7928))
15
- - Each fetch method (e.g. `fetchV5MultiAccountBalances`) has a corresponding `get*QueryOptions` (e.g. `getV5MultiAccountBalancesQueryOptions`) returning the same options object used internally
16
- - Enables reuse with `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, and other TanStack Query APIs
17
- - Extend `FetchOptions` to allow TanStack Query options (e.g. `select`, `initialPageParam`, `retry`, `initialData`) to be passed through to `get*QueryOptions` and merged into the returned query options
18
- - Export `getQueryOptionsOverrides` helper for stripping `queryKey`/`queryFn` from options when merging
19
- - All API clients (accounts, prices, token, tokens) merge user overrides first, then apply `staleTime`/`gcTime` defaults so cache timing is consistent and extra options (e.g. `select`) are preserved
20
-
21
- ### Changed
22
-
23
- - **BREAKING:** Merge `fetchV2BalancesWithOptions` into `fetchV2Balances` ([#7928](https://github.com/MetaMask/core/pull/7928))
24
- - `fetchV2Balances(address, queryOptions?, options?)` now accepts the full query options: `networks`, `filterSupportedTokens`, `includeTokenAddresses`, `includeStakedAssets`
25
- - `getV2BalancesQueryOptions` accepts the same full query options for use with TanStack Query
26
- - `fetchV2BalancesWithOptions` and `getV2BalancesWithOptionsQueryOptions` have been removed; use `fetchV2Balances` and `getV2BalancesQueryOptions` with the desired options instead
27
- - **BREAKING:** Align v4 multi-account transactions with API ([#7928](https://github.com/MetaMask/core/pull/7928))
28
- - First parameter renamed from `accountIds` to `accountAddresses` in `fetchV4MultiAccountTransactions` and `getV4MultiAccountTransactionsQueryOptions`
29
- - Query options now include: `startTimestamp`, `endTimestamp`, `limit`, `after`, `before`, `maxLogsPerTx`, `lang` in addition to `networks`, `cursor`, `sortDirection`, `includeLogs`, `includeTxMetadata`
30
- - `includeValueTransfers` has been removed from the options (not in API spec)
31
- - Accounts, prices, and tokens clients: `fetch*` and `get*QueryOptions` now short-circuit on empty required inputs (e.g. empty address, empty account IDs or asset lists) and return empty results without calling the API ([#7928](https://github.com/MetaMask/core/pull/7928))
32
-
33
10
  ## [5.1.1]
34
11
 
35
12
  ### Changed
package/README.md CHANGED
@@ -449,85 +449,80 @@ const pricesClient = new PricesApiClient({
449
449
 
450
450
  ### API Clients
451
451
 
452
- Optional parameters: `options` is `FetchOptions` (e.g. `staleTime`, `gcTime`). `queryOptions` are API-specific filters (e.g. `networks`, `cursor`). Each `fetch*` method has a matching `get*QueryOptions` that returns the TanStack Query options object for use with `useQuery`, `useInfiniteQuery`, `useSuspenseQuery`, etc.
453
-
454
452
  #### AccountsApiClient
455
453
 
456
454
  Handles account-related operations including balances, transactions, NFTs, and token discovery.
457
455
 
458
- | Method | Description |
459
- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
460
- | `fetchV1SupportedNetworks(options?)` | Get supported networks (v1) |
461
- | `fetchV2SupportedNetworks(options?)` | Get supported networks (v2) |
462
- | `fetchV2ActiveNetworks(accountIds, queryOptions?, options?)` | Get active networks by CAIP-10 account IDs |
463
- | `fetchV2Balances(address, queryOptions?, options?)` | Get balances for single address (supports networks, filterSupportedTokens, includeTokenAddresses, includeStakedAssets) |
464
- | `fetchV4MultiAccountBalances(addresses, queryOptions?, options?)` | Get balances for multiple addresses |
465
- | `fetchV5MultiAccountBalances(accountIds, queryOptions?, options?)` | Get balances using CAIP-10 IDs |
466
- | `fetchV1TransactionByHash(chainId, txHash, queryOptions?, options?)` | Get transaction by hash |
467
- | `fetchV1AccountTransactions(address, queryOptions?, options?)` | Get account transactions |
468
- | `fetchV4MultiAccountTransactions(accountAddresses, queryOptions?, options?)` | Get multi-account transactions |
469
- | `fetchV1AccountRelationship(chainId, from, to, options?)` | Get address relationship |
470
- | `fetchV2AccountNfts(address, queryOptions?, options?)` | Get account NFTs |
471
- | `fetchV2AccountTokens(address, queryOptions?, options?)` | Get detected ERC20 tokens |
472
- | `getV1SupportedNetworksQueryOptions(options?)` … `getV2AccountTokensQueryOptions(...)` | Return TanStack Query options for each fetch (use with useQuery, useInfiniteQuery, etc.) |
473
- | `invalidateBalances()` | Invalidate all balance cache |
474
- | `invalidateAccounts()` | Invalidate all account cache |
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 |
475
473
 
476
474
  #### PricesApiClient
477
475
 
478
476
  Handles price-related operations including spot prices, exchange rates, and historical data.
479
477
 
480
- | Method | Description |
481
- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
482
- | `fetchPriceV1SupportedNetworks(options?)` | Get price-supported networks (v1) |
483
- | `fetchPriceV2SupportedNetworks(options?)` | Get price-supported networks in CAIP format (v2) |
484
- | `fetchV1ExchangeRates(baseCurrency, options?)` | Get exchange rates for base currency |
485
- | `fetchV1FiatExchangeRates(options?)` | Get fiat exchange rates |
486
- | `fetchV1CryptoExchangeRates(options?)` | Get crypto exchange rates |
487
- | `fetchV1SpotPricesByCoinIds(coinIds, options?)` | Get spot prices by CoinGecko IDs |
488
- | `fetchV1SpotPriceByCoinId(coinId, currency?, options?)` | Get single coin spot price |
489
- | `fetchV1TokenPrices(chainId, addresses, queryOptions?, options?)` | Get token prices on chain |
490
- | `fetchV1TokenPrice(chainId, address, currency?, options?)` | Get single token price |
491
- | `fetchV2SpotPrices(chainId, addresses, queryOptions?, options?)` | Get spot prices with market data |
492
- | `fetchV3SpotPrices(assetIds, queryOptions?, options?)` | Get spot prices by CAIP-19 asset IDs |
493
- | `fetchV1HistoricalPricesByCoinId(coinId, queryOptions?, options?)` | Get historical prices by CoinGecko ID |
494
- | `fetchV1HistoricalPricesByTokenAddresses(chainId, addresses, queryOptions?, options?)` | Get historical prices for tokens |
495
- | `fetchV1HistoricalPrices(chainId, address, queryOptions?, options?)` | Get historical prices for single token |
496
- | `fetchV3HistoricalPrices(chainId, assetType, queryOptions?, options?)` | Get historical prices by CAIP-19 |
497
- | `fetchV1HistoricalPriceGraphByCoinId(coinId, queryOptions?, options?)` | Get price graph by CoinGecko ID |
498
- | `fetchV1HistoricalPriceGraphByTokenAddress(chainId, address, queryOptions?, options?)` | Get price graph by token address |
499
- | `getPriceV1SupportedNetworksQueryOptions(options?)` … `getV1HistoricalPriceGraphByTokenAddressQueryOptions(...)` | Return TanStack Query options for each fetch |
500
- | `invalidatePrices()` | Invalidate all price cache |
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 |
501
498
 
502
499
  #### TokenApiClient
503
500
 
504
501
  Handles token metadata, lists, and trending/popular token discovery.
505
502
 
506
- | Method | Description |
507
- | --------------------------------------------------------------------------------------- | -------------------------------------------- |
508
- | `fetchNetworks(options?)` | Get all networks |
509
- | `fetchNetworkByChainId(chainId, options?)` | Get network by chain ID |
510
- | `fetchTokenList(chainId, queryOptions?, options?)` | Get token list for chain |
511
- | `fetchV1TokenMetadata(chainId, address, queryOptions?, options?)` | Get token metadata |
512
- | `fetchTokenDescription(chainId, address, options?)` | Get token description |
513
- | `fetchV3TrendingTokens(chainIds, queryOptions?, options?)` | Get trending tokens |
514
- | `fetchV3TopGainers(chainIds, queryOptions?, options?)` | Get top gainers/losers |
515
- | `fetchV3PopularTokens(chainIds, queryOptions?, options?)` | Get popular tokens |
516
- | `fetchTopAssets(chainId, options?)` | Get top assets for chain |
517
- | `fetchV1SuggestedOccurrenceFloors(options?)` | Get suggested occurrence floors |
518
- | `getNetworksQueryOptions(options?)` … `getV1SuggestedOccurrenceFloorsQueryOptions(...)` | Return TanStack Query options for each fetch |
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 |
519
515
 
520
516
  #### TokensApiClient
521
517
 
522
518
  Handles bulk token operations and supported network queries.
523
519
 
524
- | Method | Description |
525
- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
526
- | `fetchTokenV1SupportedNetworks(options?)` | Get token-supported networks (v1) |
527
- | `fetchTokenV2SupportedNetworks(options?)` | Get token-supported networks with full/partial support (v2) |
528
- | `fetchV3Assets(assetIds, queryOptions?, fetchOptions?)` | Fetch assets by CAIP-19 IDs |
529
- | `getTokenV1SupportedNetworksQueryOptions(options?)` … `getV3AssetsQueryOptions(...)` | Return TanStack Query options for each fetch |
530
- | `invalidateTokens()` | Invalidate all token cache |
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 |
531
526
 
532
527
  ### Configuration
533
528