Skip to content

Commit

Permalink
feat: migrate to latest Token rates controller to release 7.12.4 (#8156)
Browse files Browse the repository at this point in the history
## **Description**

Copy of this [PR](#8143)
 
sanity check: https://recordit.co/X2MSnKAwo7

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
tommasini authored Dec 19, 2023
1 parent de1b549 commit 296d6d5
Show file tree
Hide file tree
Showing 6 changed files with 1,157 additions and 202 deletions.
2 changes: 2 additions & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
ignores:
- '@metamask/oss-attribution-generator'
- 'webpack-cli'
# This is used on the patch for TokenRatesController of Assets controllers, for we to be able to use the last version of it
- cockatiel

# Note: Everything below this line should be removed after investigation
# TODO: Investigate each dependency to see whether it's used
Expand Down
6 changes: 5 additions & 1 deletion app/core/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
TokenRatesState,
TokensController,
TokensState,
CodefiTokenPricesServiceV2,
} from '@metamask/assets-controllers';
import {
AddressBookController,
Expand Down Expand Up @@ -450,6 +451,8 @@ class Engine {
keyringBuilders: [qrKeyringBuilder],
});

const codefiTokenApiV2 = new CodefiTokenPricesServiceV2();

const controllers = [
keyringController,
new AccountTrackerController({
Expand Down Expand Up @@ -543,7 +546,8 @@ class Engine {
chainId: networkController.state.providerConfig.chainId,
ticker: networkController.state.providerConfig.ticker ?? 'ETH',
selectedAddress: preferencesController.state.selectedAddress,
coinGeckoHeader: process.env.COIN_GECKO_HEADER as string,
tokenPricesService: codefiTokenApiV2,
interval: 30 * 60 * 1000,
}),
new TransactionController({
blockTracker:
Expand Down
3 changes: 2 additions & 1 deletion app/util/test/initial-background-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
"contractBalances": {}
},
"TokenRatesController": {
"contractExchangeRates": {}
"contractExchangeRates": {},
"contractExchangeRatesByChainId": {}
},
"TransactionController": {
"lastFetchedBlockNumbers": {},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@
"uuid": "^8.3.2",
"valid-url": "1.0.9",
"vm-browserify": "1.1.2",
"zxcvbn": "4.4.2"
"zxcvbn": "4.4.2",
"cockatiel": "^3.1.1"
},
"devDependencies": {
"@actions/core": "^1.10.0",
Expand Down
Loading

0 comments on commit 296d6d5

Please sign in to comment.