Skip to content

Commit

Permalink
Merge branch 'remove-provider-config' into group-network-configuratio…
Browse files Browse the repository at this point in the history
…ns-by-chain
  • Loading branch information
mcmire authored Jun 5, 2024
2 parents d0152a7 + 3e582c8 commit 5897b85
Show file tree
Hide file tree
Showing 64 changed files with 4,929 additions and 1,860 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/core-monorepo",
"version": "151.0.0",
"version": "154.0.0",
"private": true,
"description": "Monorepo for packages shared between MetaMask clients",
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Uncategorized

- **BREAKING:** The NftController messenger must now allow the `NetworkController:getNetworkClientById` action ([#4305](https://github.com/MetaMask/core/pull/4305))
- NftControllerMessenger now makes use of `selectedNetworkClientId` when responding to changes in NetworkController state to capture the currently selected chain rather than `providerConfig` ([#4305](https://github.com/MetaMask/core/pull/4305))
- This should be functionally equivalent, but is being noted anyway.
- NftDetectionController now makes use of `selectedNetworkClientId` when responding to changes in NetworkController state to capture the currently selected chain rather than `providerConfig` ([#4307](https://github.com/MetaMask/core/pull/4307))
- This should be functionally equivalent, but is being noted anyway.

## [29.0.0]

### Added
Expand Down
29 changes: 29 additions & 0 deletions packages/assets-controllers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,41 @@ This package features the following controllers:
- [**CollectibleDetectionController**](src/CollectibleDetectionController.ts) keeps a periodically updated list of ERC-721 tokens assigned to the currently selected address.
- [**CollectiblesController**](src/CollectiblesController.ts) tracks ERC-721 and ERC-1155 tokens assigned to the currently selected address, using OpenSea to retrieve token information.
- [**CurrencyRateController**](src/CurrencyRateController.ts) keeps a periodically updated value of the exchange rate from the currently selected "native" currency to another (handling testnet tokens specially).
- [**RatesController**](src/RatesController/RatesController.ts) keeps a periodically updated value for the exchange rates for different cryptocurrencies. The difference between the `RatesController` and `CurrencyRateController` is that the second one is coupled to the `NetworksController` and is EVM specific, whilst the first one can handle different blockchain currencies like BTC and SOL.
- [**TokenBalancesController**](src/TokenBalancesController.ts) keeps a periodically updated set of balances for the current set of ERC-20 tokens.
- [**TokenDetectionController**](src/TokenDetectionController.ts) keeps a periodically updated list of ERC-20 tokens assigned to the currently selected address.
- [**TokenListController**](src/TokenListController.ts) uses the MetaSwap API to keep a periodically updated list of known ERC-20 tokens along with their metadata.
- [**TokenRatesController**](src/TokenRatesController.ts) keeps a periodically updated list of exchange rates for known ERC-20 tokens relative to the currently selected native currency.
- [**TokensController**](src/TokensController.ts) stores the ERC-20 and ERC-721 tokens, along with their metadata, that are listed in the wallet under the currently selected address on the currently selected chain.

### `RatesController`

The `RatesController` is responsible for managing the state related to cryptocurrency exchange rates and periodically updating these rates by fetching new data from an external API.

```ts
// Initialize the RatesController
const ratesController = new RatesController({
interval: 180000,
includeUsdRate: true,
state: {
fiatCurrency: 'eur',
cryptocurrencies: [Cryptocurrency.Btc],
},
});

// Start the polling process
ratesController.start().then(() => {
console.log('Polling for exchange rates has started.');
});

// Stop the polling process after some time
setTimeout(() => {
ratesController.stop().then(() => {
console.log('Polling for exchange rates has stopped.');
});
}, 300000);
```

## Contributing

This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
2 changes: 1 addition & 1 deletion packages/assets-controllers/src/CurrencyRateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
import { StaticIntervalPollingController } from '@metamask/polling-controller';
import { Mutex } from 'async-mutex';

import { fetchExchangeRate as defaultFetchExchangeRate } from './crypto-compare';
import { fetchExchangeRate as defaultFetchExchangeRate } from './crypto-compare-service';

/**
* @type CurrencyRateState
Expand Down
Loading

0 comments on commit 5897b85

Please sign in to comment.