Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump @metamask/{preferences,assets}-controllers #12579

Merged
merged 11 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"@metamask/accounts-controller": "^20.0.1",
"@metamask/address-book-controller": "^6.0.1",
"@metamask/approval-controller": "^7.1.0",
"@metamask/assets-controllers": "^44.1.0",
"@metamask/assets-controllers": "^45.1.1",
"@metamask/base-controller": "^7.0.1",
"@metamask/bitcoin-wallet-snap": "^0.8.2",
"@metamask/composable-controller": "^3.0.0",
Expand Down Expand Up @@ -176,7 +176,7 @@
"@metamask/phishing-controller": "^12.0.3",
"@metamask/post-message-stream": "^8.0.0",
"@metamask/ppom-validator": "0.35.1",
"@metamask/preferences-controller": "^14.0.0",
"@metamask/preferences-controller": "^15.0.1",
"@metamask/profile-sync-controller": "^1.0.0",
"@metamask/react-native-actionsheet": "2.4.2",
"@metamask/react-native-button": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@metamask/assets-controllers/dist/NftController.cjs b/node_modules/@metamask/assets-controllers/dist/NftController.cjs
index 6ccbe9c..49270d6 100644
index 6ccbe9c..f725852 100644
--- a/node_modules/@metamask/assets-controllers/dist/NftController.cjs
+++ b/node_modules/@metamask/assets-controllers/dist/NftController.cjs
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
Expand Down Expand Up @@ -150,7 +150,7 @@ index 6ccbe9c..49270d6 100644
}
}
diff --git a/node_modules/@metamask/assets-controllers/dist/NftController.d.cts b/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
index a34725f..21e9d20 100644
index a34725f..12487d6 100644
--- a/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
+++ b/node_modules/@metamask/assets-controllers/dist/NftController.d.cts
@@ -108,6 +108,7 @@ export type NftMetadata = {
Expand All @@ -161,77 +161,3 @@ index a34725f..21e9d20 100644
collection?: Collection;
address?: string;
attributes?: Attributes[];
diff --git a/node_modules/@metamask/assets-controllers/dist/TokensController.cjs b/node_modules/@metamask/assets-controllers/dist/TokensController.cjs
index 343b343..c2e2fd0 100644
--- a/node_modules/@metamask/assets-controllers/dist/TokensController.cjs
+++ b/node_modules/@metamask/assets-controllers/dist/TokensController.cjs
@@ -270,36 +270,39 @@ class TokensController extends base_controller_1.BaseController {
* @param networkClientId - Optional network client ID used to determine interacting chain ID.
*/
ignoreTokens(tokenAddressesToIgnore, networkClientId) {
- const { ignoredTokens, detectedTokens, tokens } = this.state;
Gudahtt marked this conversation as resolved.
Show resolved Hide resolved
- const ignoredTokensMap = {};
- let newIgnoredTokens = [...ignoredTokens];
- let interactingChainId;
- if (networkClientId) {
- interactingChainId = this.messagingSystem.call('NetworkController:getNetworkClientById', networkClientId).configuration.chainId;
- }
- const checksummedTokenAddresses = tokenAddressesToIgnore.map((address) => {
- const checksumAddress = (0, controller_utils_1.toChecksumHexAddress)(address);
- ignoredTokensMap[address.toLowerCase()] = true;
- return checksumAddress;
- });
- newIgnoredTokens = [...ignoredTokens, ...checksummedTokenAddresses];
- const newDetectedTokens = detectedTokens.filter((token) => !ignoredTokensMap[token.address.toLowerCase()]);
- const newTokens = tokens.filter((token) => !ignoredTokensMap[token.address.toLowerCase()]);
- const { newAllIgnoredTokens, newAllDetectedTokens, newAllTokens } = __classPrivateFieldGet(this, _TokensController_instances, "m", _TokensController_getNewAllTokensState).call(this, {
- newIgnoredTokens,
- newDetectedTokens,
- newTokens,
- interactingChainId,
- });
- this.update((state) => {
- state.ignoredTokens = newIgnoredTokens;
- state.tokens = newTokens;
- state.detectedTokens = newDetectedTokens;
- state.allIgnoredTokens = newAllIgnoredTokens;
- state.allDetectedTokens = newAllDetectedTokens;
- state.allTokens = newAllTokens;
- });
- }
+ let interactingChainId;
+ if (networkClientId) {
+ interactingChainId = this.messagingSystem.call('NetworkController:getNetworkClientById', networkClientId).configuration.chainId;
+ }
+ const { allTokens, allDetectedTokens, allIgnoredTokens } = this.state;
+ const ignoredTokensMap = {};
+ const ignoredTokens = allIgnoredTokens[interactingChainId ?? __classPrivateFieldGet(this, _TokensController_chainId, "f")]?.[__classPrivateFieldGet(this, _TokensController_instances, "m", _TokensController_getSelectedAddress).call(this)] || [];
+ let newIgnoredTokens = [...ignoredTokens];
+ const tokens = allTokens[interactingChainId ?? __classPrivateFieldGet(this, _TokensController_chainId, "f")]?.[__classPrivateFieldGet(this, _TokensController_instances, "m", _TokensController_getSelectedAddress).call(this)] || [];
+ const detectedTokens = allDetectedTokens[interactingChainId ?? __classPrivateFieldGet(this, _TokensController_chainId, "f")]?.[__classPrivateFieldGet(this, _TokensController_instances, "m", _TokensController_getSelectedAddress).call(this)] || [];
+ const checksummedTokenAddresses = tokenAddressesToIgnore.map((address) => {
+ const checksumAddress = (0, controller_utils_1.toChecksumHexAddress)(address);
+ ignoredTokensMap[address.toLowerCase()] = true;
+ return checksumAddress;
+ });
+ newIgnoredTokens = [...ignoredTokens, ...checksummedTokenAddresses];
+ const newDetectedTokens = detectedTokens.filter((token) => !ignoredTokensMap[token.address.toLowerCase()]);
+ const newTokens = tokens.filter((token) => !ignoredTokensMap[token.address.toLowerCase()]);
+ const { newAllIgnoredTokens, newAllDetectedTokens, newAllTokens } = __classPrivateFieldGet(this, _TokensController_instances, "m", _TokensController_getNewAllTokensState).call(this, {
+ newIgnoredTokens,
+ newDetectedTokens,
+ newTokens,
+ interactingChainId,
+ });
+ this.update((state) => {
+ state.ignoredTokens = newIgnoredTokens;
+ state.tokens = newTokens;
+ state.detectedTokens = newDetectedTokens;
+ state.allIgnoredTokens = newAllIgnoredTokens;
+ state.allDetectedTokens = newAllDetectedTokens;
+ state.allTokens = newAllTokens;
+ });
+ }
/**
* Adds a batch of detected tokens to the stored token list.
*
34 changes: 17 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4116,10 +4116,10 @@
"@metamask/utils" "^10.0.0"
nanoid "^3.1.31"

"@metamask/assets-controllers@^44.1.0":
version "44.1.0"
resolved "https://registry.yarnpkg.com/@metamask/assets-controllers/-/assets-controllers-44.1.0.tgz#92d460b8926b138feacfff0cdf0c3efcc66091aa"
integrity sha512-YbEUoGSJciIrPjSxk4VJktcSEGxHUaK48OOLOjA8BMXWTlMJ1ac8OQeHwciPbTCGriwUa4QsxsequsuSGWNs/g==
"@metamask/assets-controllers@^45.1.1":
version "45.1.1"
resolved "https://registry.yarnpkg.com/@metamask/assets-controllers/-/assets-controllers-45.1.1.tgz#365be66cbd14a0fb5be57b3ec30d54f3314d70ec"
integrity sha512-zKMIKv9w4sZu0S/flbgYLAy3wgoL11GuL5RW8AF6n2/jKlMxEA0ImIK0EZGhmkJAB78ZrcVIdoLeEEvSsGuO/w==
dependencies:
"@ethereumjs/util" "^8.1.0"
"@ethersproject/abi" "^5.7.0"
Expand All @@ -4130,10 +4130,10 @@
"@metamask/abi-utils" "^2.0.3"
"@metamask/base-controller" "^7.0.2"
"@metamask/contract-metadata" "^2.4.0"
"@metamask/controller-utils" "^11.4.3"
"@metamask/controller-utils" "^11.4.4"
"@metamask/eth-query" "^4.0.0"
"@metamask/metamask-eth-abis" "^3.1.1"
"@metamask/polling-controller" "^12.0.1"
"@metamask/polling-controller" "^12.0.2"
"@metamask/rpc-errors" "^7.0.1"
"@metamask/utils" "^10.0.0"
"@types/bn.js" "^5.1.5"
Expand Down Expand Up @@ -4202,7 +4202,7 @@
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.5.0.tgz#33921fa9c15eb1863f55dcd5f75467ae15614ebb"
integrity sha512-+j7jEcp0P1OUMEpa/OIwfJs/ahBC/akwgWxaRTSWX2SWABvlUKBVRMtslfL94Qj2wN2xw8xjaUy5nSHqrznqDA==

"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.1", "@metamask/controller-utils@^11.4.2", "@metamask/controller-utils@^11.4.3", "@metamask/controller-utils@^11.4.4":
"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.3.0", "@metamask/controller-utils@^11.4.1", "@metamask/controller-utils@^11.4.3", "@metamask/controller-utils@^11.4.4":
version "11.4.4"
resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.4.4.tgz#6e43e4cf53d34dad225bab8aaf4e7efcb1fe7623"
integrity sha512-0/gKC6jxlj8KRzi0RjGDQnml6l4b46Da/AIqnGJMOC59zl4qD5UN1GM+mq7L5duw/m8sSHa7VbL1hL0l7Cw1pg==
Expand Down Expand Up @@ -4840,13 +4840,13 @@
fast-json-stable-stringify "^2.1.0"
uuid "^8.3.2"

"@metamask/polling-controller@^12.0.0", "@metamask/polling-controller@^12.0.1":
version "12.0.1"
resolved "https://registry.yarnpkg.com/@metamask/polling-controller/-/polling-controller-12.0.1.tgz#89593c892d7fbbc93ccb6fe45dd2d820839f3d93"
integrity sha512-ZCF7UBuyxk9utdmOAh9/VBT780OxRPN5pD0wJaRwsFnFM3FFOFmvmojqnw8Kz4lSglyETtOBBMvzyQsnqoXQEQ==
"@metamask/polling-controller@^12.0.0", "@metamask/polling-controller@^12.0.2":
version "12.0.2"
resolved "https://registry.yarnpkg.com/@metamask/polling-controller/-/polling-controller-12.0.2.tgz#de37ff5f4f997d57d4da34b0c6574d2eba3184e0"
integrity sha512-TYplREQMrhPcsJn+b7WS2oZqMwt4jKcyL/tDmygVv90RcvESBBhXxz7D0Brm5UAirnkE3TPRq8fnVWwVSQAVcA==
dependencies:
"@metamask/base-controller" "^7.0.2"
"@metamask/controller-utils" "^11.4.2"
"@metamask/controller-utils" "^11.4.4"
"@metamask/utils" "^10.0.0"
"@types/uuid" "^8.3.0"
fast-json-stable-stringify "^2.1.0"
Expand Down Expand Up @@ -4874,13 +4874,13 @@
eslint-plugin-n "^16.6.2"
json-rpc-random-id "^1.0.1"

"@metamask/preferences-controller@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@metamask/preferences-controller/-/preferences-controller-14.0.0.tgz#1ec10cf7d2091962345dfc99fa050339a997e467"
integrity sha512-rh0kWWIDCa1V/zAfC3pA+0I3JSiQp23kpi838uMqCDMBIB0ifFbWX+qjnZlxZp77R1bvJiSqtHGlYLl60/Y7FA==
"@metamask/preferences-controller@^15.0.1":
version "15.0.1"
resolved "https://registry.yarnpkg.com/@metamask/preferences-controller/-/preferences-controller-15.0.1.tgz#4306099e4659591636304d81ed0954afb160ab81"
integrity sha512-y2rGKMr9fY2LCwEjvX7QKxOqxy5Tz6vA+QK8YEXuczeHd3n2jrh9DNBeM+BZzzOO2cXJgmbn0Jeotl09kDD94g==
dependencies:
"@metamask/base-controller" "^7.0.2"
"@metamask/controller-utils" "^11.4.3"
"@metamask/controller-utils" "^11.4.4"

"@metamask/profile-sync-controller@^1.0.0":
version "1.0.2"
Expand Down
Loading