@metamask-previews/core-backend 5.1.1-preview-e7b1aa6 → 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.
- package/CHANGELOG.md +0 -23
- package/README.md +55 -60
- package/dist/api/accounts/client.cjs +163 -358
- package/dist/api/accounts/client.cjs.map +1 -1
- package/dist/api/accounts/client.d.cts +12 -198
- package/dist/api/accounts/client.d.cts.map +1 -1
- package/dist/api/accounts/client.d.mts +12 -198
- package/dist/api/accounts/client.d.mts.map +1 -1
- package/dist/api/accounts/client.mjs +164 -359
- package/dist/api/accounts/client.mjs.map +1 -1
- package/dist/api/index.cjs +1 -2
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/prices/client.cjs +140 -398
- package/dist/api/prices/client.cjs.map +1 -1
- package/dist/api/prices/client.d.cts +3 -215
- package/dist/api/prices/client.d.cts.map +1 -1
- package/dist/api/prices/client.d.mts +3 -215
- package/dist/api/prices/client.d.mts.map +1 -1
- package/dist/api/prices/client.mjs +140 -398
- package/dist/api/prices/client.mjs.map +1 -1
- package/dist/api/shared-types.cjs +1 -18
- package/dist/api/shared-types.cjs.map +1 -1
- package/dist/api/shared-types.d.cts +3 -23
- package/dist/api/shared-types.d.cts.map +1 -1
- package/dist/api/shared-types.d.mts +3 -23
- package/dist/api/shared-types.d.mts.map +1 -1
- package/dist/api/shared-types.mjs +0 -16
- package/dist/api/shared-types.mjs.map +1 -1
- package/dist/api/token/client.cjs +77 -232
- package/dist/api/token/client.cjs.map +1 -1
- package/dist/api/token/client.d.cts +0 -165
- package/dist/api/token/client.d.cts.map +1 -1
- package/dist/api/token/client.d.mts +0 -165
- package/dist/api/token/client.d.mts.map +1 -1
- package/dist/api/token/client.mjs +77 -232
- package/dist/api/token/client.mjs.map +1 -1
- package/dist/api/tokens/client.cjs +23 -64
- package/dist/api/tokens/client.cjs.map +1 -1
- package/dist/api/tokens/client.d.cts +0 -24
- package/dist/api/tokens/client.d.cts.map +1 -1
- package/dist/api/tokens/client.d.mts +0 -24
- package/dist/api/tokens/client.d.mts.map +1 -1
- package/dist/api/tokens/client.mjs +23 -64
- package/dist/api/tokens/client.mjs.map +1 -1
- package/dist/index.cjs +1 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/ApiPlatformClientService-method-action-types.cjs +0 -7
- package/dist/ApiPlatformClientService-method-action-types.cjs.map +0 -1
- package/dist/ApiPlatformClientService-method-action-types.d.cts +0 -21
- package/dist/ApiPlatformClientService-method-action-types.d.cts.map +0 -1
- package/dist/ApiPlatformClientService-method-action-types.d.mts +0 -21
- package/dist/ApiPlatformClientService-method-action-types.d.mts.map +0 -1
- package/dist/ApiPlatformClientService-method-action-types.mjs +0 -6
- package/dist/ApiPlatformClientService-method-action-types.mjs.map +0 -1
- package/dist/ApiPlatformClientService.cjs +0 -82
- package/dist/ApiPlatformClientService.cjs.map +0 -1
- package/dist/ApiPlatformClientService.d.cts +0 -86
- package/dist/ApiPlatformClientService.d.cts.map +0 -1
- package/dist/ApiPlatformClientService.d.mts +0 -86
- package/dist/ApiPlatformClientService.d.mts.map +0 -1
- package/dist/ApiPlatformClientService.mjs +0 -78
- 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
|
|
459
|
-
|
|
|
460
|
-
| `fetchV1SupportedNetworks(
|
|
461
|
-
| `fetchV2SupportedNetworks(
|
|
462
|
-
| `fetchV2ActiveNetworks(accountIds,
|
|
463
|
-
| `fetchV2Balances(address,
|
|
464
|
-
| `
|
|
465
|
-
| `
|
|
466
|
-
| `
|
|
467
|
-
| `
|
|
468
|
-
| `
|
|
469
|
-
| `
|
|
470
|
-
| `
|
|
471
|
-
| `
|
|
472
|
-
| `
|
|
473
|
-
| `invalidateBalances()`
|
|
474
|
-
| `invalidateAccounts()`
|
|
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
|
|
481
|
-
|
|
|
482
|
-
| `fetchPriceV1SupportedNetworks(
|
|
483
|
-
| `fetchPriceV2SupportedNetworks(
|
|
484
|
-
| `fetchV1ExchangeRates(baseCurrency
|
|
485
|
-
| `fetchV1FiatExchangeRates(
|
|
486
|
-
| `fetchV1CryptoExchangeRates(
|
|
487
|
-
| `fetchV1SpotPricesByCoinIds(coinIds
|
|
488
|
-
| `fetchV1SpotPriceByCoinId(coinId, currency
|
|
489
|
-
| `fetchV1TokenPrices(chainId, addresses,
|
|
490
|
-
| `fetchV1TokenPrice(chainId, address, currency
|
|
491
|
-
| `fetchV2SpotPrices(chainId, addresses,
|
|
492
|
-
| `fetchV3SpotPrices(assetIds,
|
|
493
|
-
| `fetchV1HistoricalPricesByCoinId(coinId,
|
|
494
|
-
| `fetchV1HistoricalPricesByTokenAddresses(chainId, addresses,
|
|
495
|
-
| `fetchV1HistoricalPrices(chainId, address,
|
|
496
|
-
| `fetchV3HistoricalPrices(chainId, assetType,
|
|
497
|
-
| `fetchV1HistoricalPriceGraphByCoinId(coinId,
|
|
498
|
-
| `fetchV1HistoricalPriceGraphByTokenAddress(chainId, address,
|
|
499
|
-
| `
|
|
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
|
|
507
|
-
|
|
|
508
|
-
| `fetchNetworks(
|
|
509
|
-
| `fetchNetworkByChainId(chainId
|
|
510
|
-
| `fetchTokenList(chainId,
|
|
511
|
-
| `fetchV1TokenMetadata(chainId, address,
|
|
512
|
-
| `fetchTokenDescription(chainId, address
|
|
513
|
-
| `fetchV3TrendingTokens(chainIds,
|
|
514
|
-
| `fetchV3TopGainers(chainIds,
|
|
515
|
-
| `fetchV3PopularTokens(chainIds,
|
|
516
|
-
| `fetchTopAssets(chainId
|
|
517
|
-
| `fetchV1SuggestedOccurrenceFloors(
|
|
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
|
|
525
|
-
|
|
|
526
|
-
| `fetchTokenV1SupportedNetworks(
|
|
527
|
-
| `fetchTokenV2SupportedNetworks(
|
|
528
|
-
| `fetchV3Assets(assetIds
|
|
529
|
-
| `
|
|
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
|
|