From be4ed7e6c69318317c57fa5dbe31e9bfa5d2c898 Mon Sep 17 00:00:00 2001 From: sahar-fehri Date: Wed, 23 Oct 2024 11:58:41 +0200 Subject: [PATCH] chore: upgrade assets-controllers to v36.0.0 --- package.json | 2 +- ...@metamask+assets-controllers+36.0.0.patch} | 354 ++++-------------- yarn.lock | 22 +- 3 files changed, 82 insertions(+), 296 deletions(-) rename patches/{@metamask+assets-controllers+35.0.0.patch => @metamask+assets-controllers+36.0.0.patch} (67%) diff --git a/package.json b/package.json index 7ce3e5e67fe..f3ea6fecb9e 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "@metamask/accounts-controller": "^18.2.1", "@metamask/address-book-controller": "^6.0.1", "@metamask/approval-controller": "^7.0.1", - "@metamask/assets-controllers": "^35.0.0", + "@metamask/assets-controllers": "^36.0.0", "@metamask/base-controller": "^7.0.1", "@metamask/composable-controller": "^3.0.0", "@metamask/contract-metadata": "^2.1.0", diff --git a/patches/@metamask+assets-controllers+35.0.0.patch b/patches/@metamask+assets-controllers+36.0.0.patch similarity index 67% rename from patches/@metamask+assets-controllers+35.0.0.patch rename to patches/@metamask+assets-controllers+36.0.0.patch index f731509033c..af8d00e058a 100644 --- a/patches/@metamask+assets-controllers+35.0.0.patch +++ b/patches/@metamask+assets-controllers+36.0.0.patch @@ -1,10 +1,10 @@ -diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-2NQRWANM.js b/node_modules/@metamask/assets-controllers/dist/chunk-2NQRWANM.js -index c164c90..bd2fe09 100644 ---- a/node_modules/@metamask/assets-controllers/dist/chunk-2NQRWANM.js -+++ b/node_modules/@metamask/assets-controllers/dist/chunk-2NQRWANM.js -@@ -189,6 +189,19 @@ var TokensController = class extends _basecontroller.BaseController { - } - ); +diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-DSDI75PJ.js b/node_modules/@metamask/assets-controllers/dist/chunk-DSDI75PJ.js +index f95d90f..3c33263 100644 +--- a/node_modules/@metamask/assets-controllers/dist/chunk-DSDI75PJ.js ++++ b/node_modules/@metamask/assets-controllers/dist/chunk-DSDI75PJ.js +@@ -173,6 +173,17 @@ var TokenRatesController = class extends _pollingcontroller.StaticIntervalPollin + _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _subscribeToNetworkStateChange, subscribeToNetworkStateChange_fn).call(this); + _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _subscribeToAccountChange, subscribeToAccountChange_fn).call(this); } + + /** @@ -13,104 +13,18 @@ index c164c90..bd2fe09 100644 + */ + reset() { + this.update((state) => { -+ state.allTokens = {}; -+ state.allIgnoredTokens = {}; -+ state.ignoredTokens = []; -+ state.tokens = []; ++ state.marketData = {}; + }); + } ++ /** - * Adds a token to the stored token list. - * -diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-354SINOH.js b/node_modules/@metamask/assets-controllers/dist/chunk-354SINOH.js -index 7f87776..0100806 100644 ---- a/node_modules/@metamask/assets-controllers/dist/chunk-354SINOH.js -+++ b/node_modules/@metamask/assets-controllers/dist/chunk-354SINOH.js -@@ -10,7 +10,7 @@ var _basecontroller = require('@metamask/base-controller'); - - - -- -+var _chunkNYVA7ZTQjs = require('./chunk-NYVA7ZTQ.js'); - - - -@@ -25,6 +25,7 @@ var BlockaidResultType = /* @__PURE__ */ ((BlockaidResultType2) => { - BlockaidResultType2["Malicious"] = "Malicious"; - return BlockaidResultType2; - })(BlockaidResultType || {}); -+var MAX_GET_COLLECTION_BATCH_SIZE = 20; - var _disabled, _addNft, _getNftState, _inProcessNftFetchingUpdates, _onPreferencesControllerStateChange, onPreferencesControllerStateChange_fn, _getOwnerNftApi, getOwnerNftApi_fn, _getOwnerNfts, getOwnerNfts_fn; - var NftDetectionController = class extends _basecontroller.BaseController { - /** -@@ -134,6 +135,62 @@ var NftDetectionController = class extends _basecontroller.BaseController { - apiNfts = resultNftApi.tokens.filter( - (elm) => elm.token.isSpam === false && (elm.blockaidResult?.result_type ? elm.blockaidResult?.result_type === "Benign" /* Benign */ : true) - ); -+ -+ const collections = apiNfts.reduce((acc, currValue) => { -+ if (!acc.includes(currValue.token.contract) && currValue.token.contract === currValue?.token?.collection?.id) { -+ acc.push(currValue.token.contract); -+ } -+ return acc; -+ }, []); -+ if (collections.length !== 0) { -+ const collectionResponse = await _chunkNYVA7ZTQjs.reduceInBatchesSerially.call(void 0, { -+ values: collections, -+ batchSize: MAX_GET_COLLECTION_BATCH_SIZE, -+ eachBatch: async (allResponses, batch) => { -+ const params = new URLSearchParams( -+ batch.map((s) => ["contract", s]) -+ ); -+ params.append("chainId", "1"); -+ const collectionResponseForBatch = await _controllerutils.fetchWithErrorHandling.call(void 0, -+ { -+ url: `${_controllerutils.NFT_API_BASE_URL}/collections?${params.toString()}`, -+ options: { -+ headers: { -+ Version: '1' -+ } -+ }, -+ timeout: 15000 -+ } -+ ); -+ return { -+ ...allResponses, -+ ...collectionResponseForBatch -+ }; -+ }, -+ initialResult: {} -+ }); -+ if (collectionResponse.collections?.length) { -+ apiNfts.forEach((singleNFT) => { -+ const found = collectionResponse.collections.find( -+ (elm) => elm.id?.toLowerCase() === singleNFT.token.contract.toLowerCase() -+ ); -+ if (found) { -+ singleNFT.token = { -+ ...singleNFT.token, -+ collection: { -+ ...singleNFT.token.collection ?? {}, -+ creator: found?.creator, -+ openseaVerificationStatus: found?.openseaVerificationStatus, -+ contractDeployedAt: found.contractDeployedAt, -+ ownerCount: found.ownerCount, -+ topBid: found.topBid -+ } -+ }; -+ } -+ }); -+ } -+ } -+ - const addNftPromises = apiNfts.map(async (nft) => { - const { - tokenId, -diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-3GGCHDRG.js b/node_modules/@metamask/assets-controllers/dist/chunk-3GGCHDRG.js -index 5a6e21d..121d2db 100644 ---- a/node_modules/@metamask/assets-controllers/dist/chunk-3GGCHDRG.js -+++ b/node_modules/@metamask/assets-controllers/dist/chunk-3GGCHDRG.js -@@ -44,7 +44,7 @@ var getDefaultNftControllerState = () => ({ + * Allows controller to make active and passive polling requests + */ +diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-HTIZ4JKG.js b/node_modules/@metamask/assets-controllers/dist/chunk-HTIZ4JKG.js +index a9f6736..ecd98e7 100644 +--- a/node_modules/@metamask/assets-controllers/dist/chunk-HTIZ4JKG.js ++++ b/node_modules/@metamask/assets-controllers/dist/chunk-HTIZ4JKG.js +@@ -46,7 +46,7 @@ var getDefaultNftControllerState = () => ({ allNfts: {}, ignoredNfts: [] }); @@ -119,7 +33,7 @@ index 5a6e21d..121d2db 100644 var NftController = class extends _basecontroller.BaseController { /** * Creates an NftController instance. -@@ -52,7 +52,7 @@ var NftController = class extends _basecontroller.BaseController { +@@ -54,7 +54,7 @@ var NftController = class extends _basecontroller.BaseController { * @param options - The controller options. * @param options.chainId - The chain ID of the current network. * @param options.ipfsGateway - The configured IPFS gateway. @@ -128,7 +42,7 @@ index 5a6e21d..121d2db 100644 * @param options.useIpfsSubdomains - Controls whether IPFS subdomains are used. * @param options.isIpfsGatewayEnabled - Controls whether IPFS is enabled or not. * @param options.getERC721AssetName - Gets the name of the asset at the given address. -@@ -69,7 +69,7 @@ var NftController = class extends _basecontroller.BaseController { +@@ -71,7 +71,7 @@ var NftController = class extends _basecontroller.BaseController { constructor({ chainId: initialChainId, ipfsGateway = _controllerutils.IPFS_DEFAULT_GATEWAY_URL, @@ -137,7 +51,7 @@ index 5a6e21d..121d2db 100644 useIpfsSubdomains = true, isIpfsGatewayEnabled = true, getERC721AssetName, -@@ -101,7 +101,7 @@ var NftController = class extends _basecontroller.BaseController { +@@ -103,7 +103,7 @@ var NftController = class extends _basecontroller.BaseController { * Handles the state change of the preference controller. * @param preferencesState - The new state of the preference controller. * @param preferencesState.ipfsGateway - The configured IPFS gateway. @@ -146,7 +60,7 @@ index 5a6e21d..121d2db 100644 * @param preferencesState.isIpfsGatewayEnabled - Controls whether IPFS is enabled or not. */ _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _onPreferencesControllerStateChange); -@@ -237,7 +237,7 @@ var NftController = class extends _basecontroller.BaseController { +@@ -239,7 +239,7 @@ var NftController = class extends _basecontroller.BaseController { _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _selectedAccountId, void 0); _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _chainId, void 0); _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _ipfsGateway, void 0); @@ -155,7 +69,7 @@ index 5a6e21d..121d2db 100644 _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _useIpfsSubdomains, void 0); _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _isIpfsGatewayEnabled, void 0); _chunkZ4BLTVTBjs.__privateAdd.call(void 0, this, _getERC721AssetName, void 0); -@@ -252,7 +252,7 @@ var NftController = class extends _basecontroller.BaseController { +@@ -254,7 +254,7 @@ var NftController = class extends _basecontroller.BaseController { ).id); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _chainId, initialChainId); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _ipfsGateway, ipfsGateway); @@ -164,10 +78,11 @@ index 5a6e21d..121d2db 100644 _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _useIpfsSubdomains, useIpfsSubdomains); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isIpfsGatewayEnabled, isIpfsGatewayEnabled); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _getERC721AssetName, getERC721AssetName); -@@ -279,6 +279,17 @@ var NftController = class extends _basecontroller.BaseController { +@@ -281,6 +281,19 @@ var NftController = class extends _basecontroller.BaseController { _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _onSelectedAccountChange, onSelectedAccountChange_fn).bind(this) ); } ++ + /** + * THIS FUNCTIONS IS CURRENTLY PATCHED AND STILL NEEDS TO BE IMPLEMENTED ON THE CORE REPO + * Resets to the default state @@ -179,10 +94,11 @@ index 5a6e21d..121d2db 100644 + state.ignoredNfts = []; + }); + } ++ getNftApi() { return `${_controllerutils.NFT_API_BASE_URL}/tokens`; } -@@ -797,7 +808,7 @@ _mutex = new WeakMap(); +@@ -799,7 +812,7 @@ _mutex = new WeakMap(); _selectedAccountId = new WeakMap(); _chainId = new WeakMap(); _ipfsGateway = new WeakMap(); @@ -191,7 +107,7 @@ index 5a6e21d..121d2db 100644 _useIpfsSubdomains = new WeakMap(); _isIpfsGatewayEnabled = new WeakMap(); _getERC721AssetName = new WeakMap(); -@@ -822,7 +833,7 @@ onNetworkControllerNetworkDidChange_fn = function({ +@@ -824,7 +837,7 @@ onNetworkControllerNetworkDidChange_fn = function({ _onPreferencesControllerStateChange = new WeakSet(); onPreferencesControllerStateChange_fn = async function({ ipfsGateway, @@ -200,7 +116,7 @@ index 5a6e21d..121d2db 100644 isIpfsGatewayEnabled }) { const selectedAccount = this.messagingSystem.call( -@@ -830,9 +841,9 @@ onPreferencesControllerStateChange_fn = async function({ +@@ -832,9 +845,9 @@ onPreferencesControllerStateChange_fn = async function({ ); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _selectedAccountId, selectedAccount.id); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _ipfsGateway, ipfsGateway); @@ -212,7 +128,7 @@ index 5a6e21d..121d2db 100644 if (needsUpdateNftMetadata && selectedAccount) { await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateNftUpdateForAccount, updateNftUpdateForAccount_fn).call(this, selectedAccount); } -@@ -841,7 +852,7 @@ _onSelectedAccountChange = new WeakSet(); +@@ -843,7 +856,7 @@ _onSelectedAccountChange = new WeakSet(); onSelectedAccountChange_fn = async function(internalAccount) { const oldSelectedAccountId = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _selectedAccountId); _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _selectedAccountId, internalAccount.id); @@ -221,43 +137,7 @@ index 5a6e21d..121d2db 100644 if (needsUpdateNftMetadata) { await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _updateNftUpdateForAccount, updateNftUpdateForAccount_fn).call(this, internalAccount); } -@@ -865,9 +876,14 @@ updateNestedNftState_fn = function(newCollection, baseStateKey, { userAddress, c - }); - }; - _getNftInformationFromApi = new WeakSet(); --getNftInformationFromApi_fn = async function(contractAddress, tokenId) { -+getNftInformationFromApi_fn = async function(contractAddress, tokenId, networkClientId) { -+ const chainId = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getCorrectChainId, getCorrectChainId_fn).call(this, { -+ networkClientId -+ }); -+ // Convert hex chainId to number -+ const convertedChainId = (0, _controllerutils.convertHexToDecimal)(chainId).toString(); - const urlParams = new URLSearchParams({ -- chainIds: "1", -+ chainIds: convertedChainId, - tokens: `${contractAddress}:${tokenId}`, - includeTopBid: "true", - includeAttributes: "true", -@@ -881,12 +897,27 @@ getNftInformationFromApi_fn = async function(contractAddress, tokenId) { - } - } - }); -+ -+ const getCollectionParams = new URLSearchParams({ -+ chainId: convertedChainId, -+ id: `${nftInformation?.tokens[0]?.token?.collection?.id}` -+ }).toString(); -+ -+ const collectionInformation = await _controllerutils.fetchWithErrorHandling.call(void 0, { -+ url: `${_controllerutils.NFT_API_BASE_URL}/collections?${getCollectionParams}`, -+ options: { -+ headers: { -+ Version: '1' -+ } -+ } -+ }); - if (!nftInformation?.tokens?.[0]?.token) { - return { +@@ -900,7 +913,8 @@ getNftInformationFromApi_fn = async function(contractAddress, tokenId) { name: null, description: null, image: null, @@ -267,25 +147,7 @@ index 5a6e21d..121d2db 100644 }; } const { -@@ -918,7 +949,16 @@ getNftInformationFromApi_fn = async function(contractAddress, tokenId) { - }, - rarityRank && { rarityRank }, - rarity && { rarity }, -- collection && { collection } -+ (collection || collectionInformation) && { -+ collection: { -+ ...collection || {}, -+ creator: collection?.creator || collectionInformation?.collections[0].creator, -+ openseaVerificationStatus: collectionInformation?.collections[0].openseaVerificationStatus, -+ contractDeployedAt: collectionInformation?.collections[0].contractDeployedAt, -+ ownerCount: collectionInformation?.collections[0].ownerCount, -+ topBid: collectionInformation?.collections[0].topBid -+ } -+ } - ); - return nftMetadata; - }; -@@ -938,7 +978,7 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw +@@ -961,7 +975,7 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw tokenURI: tokenURI ?? null }; } @@ -294,7 +156,7 @@ index 5a6e21d..121d2db 100644 if (!hasIpfsTokenURI && !isDisplayNFTMediaToggleEnabled) { return { image: null, -@@ -946,7 +986,8 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw +@@ -969,7 +983,8 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw description: null, standard: standard || null, favorite: false, @@ -304,7 +166,7 @@ index 5a6e21d..121d2db 100644 }; } if (hasIpfsTokenURI) { -@@ -987,7 +1028,8 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw +@@ -1010,7 +1025,8 @@ getNftInformationFromTokenURI_fn = async function(contractAddress, tokenId, netw description: null, standard: standard || null, favorite: false, @@ -314,14 +176,13 @@ index 5a6e21d..121d2db 100644 }; } }; -@@ -1018,10 +1060,21 @@ getNftInformation_fn = async function(contractAddress, tokenId, networkClientId) +@@ -1041,10 +1057,21 @@ getNftInformation_fn = async function(contractAddress, tokenId, networkClientId) _controllerutils.safelyExecute.call(void 0, () => _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNftInformationFromTokenURI, getNftInformationFromTokenURI_fn).call(this, contractAddress, tokenId, networkClientId) ), - _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _openSeaEnabled) && chainId === "0x1" ? _controllerutils.safelyExecute.call(void 0, -- () => _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNftInformationFromApi, getNftInformationFromApi_fn).call(this, contractAddress, tokenId) + _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _displayNftMedia) && chainId === "0x1" ? _controllerutils.safelyExecute.call(void 0, -+ () => _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNftInformationFromApi, getNftInformationFromApi_fn).call(this, contractAddress, tokenId, networkClientId) + () => _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getNftInformationFromApi, getNftInformationFromApi_fn).call(this, contractAddress, tokenId) ) : void 0 ]); + if (blockchainMetadata?.error && nftApiMetadata?.error) { @@ -338,17 +199,7 @@ index 5a6e21d..121d2db 100644 return { ...nftApiMetadata, name: blockchainMetadata?.name ?? nftApiMetadata?.name ?? null, -@@ -1105,7 +1158,8 @@ addIndividualNft_fn = async function(tokenAddress, tokenId, nftMetadata, nftCont - nftMetadata, - existingEntry - ); -- if (!differentMetadata && existingEntry.isCurrentlyOwned) { -+ const hasNewFields = _chunkNEXY7SE2js.hasNewCollectionFields(nftMetadata, existingEntry); -+ if (!differentMetadata && existingEntry.isCurrentlyOwned && !hasNewFields) { - return; - } - const indexToUpdate = nfts.findIndex( -@@ -1137,7 +1191,8 @@ addIndividualNft_fn = async function(tokenAddress, tokenId, nftMetadata, nftCont +@@ -1161,7 +1188,8 @@ addIndividualNft_fn = async function(tokenAddress, tokenId, nftMetadata, nftCont symbol: nftContract.symbol, tokenId: tokenId.toString(), standard: nftMetadata.standard, @@ -359,7 +210,7 @@ index 5a6e21d..121d2db 100644 } } finally { diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-NHFZIY2K.js b/node_modules/@metamask/assets-controllers/dist/chunk-NHFZIY2K.js -index 995ec6b..84408ac 100644 +index 995ec6b..7222a8a 100644 --- a/node_modules/@metamask/assets-controllers/dist/chunk-NHFZIY2K.js +++ b/node_modules/@metamask/assets-controllers/dist/chunk-NHFZIY2K.js @@ -19,7 +19,7 @@ function getDefaultTokenBalancesState() { @@ -383,10 +234,11 @@ index 995ec6b..84408ac 100644 this.messagingSystem.subscribe( "TokensController:stateChange", ({ tokens: newTokens, detectedTokens }) => { -@@ -67,6 +69,15 @@ var TokenBalancesController = class extends _basecontroller.BaseController { +@@ -67,6 +69,17 @@ var TokenBalancesController = class extends _basecontroller.BaseController { _chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _getERC20BalanceOf, getERC20BalanceOf); this.poll(); } ++ + /** + * THIS FUNCTIONS IS CURRENTLY PATCHED AND STILL NEEDS TO BE IMPLEMENTED ON THE CORE REPO + * Resets to the default state @@ -396,10 +248,11 @@ index 995ec6b..84408ac 100644 + state.contractBalances = {}; + }); + } ++ /** * Allows controller to update tracked tokens contract balances. */ -@@ -107,20 +118,27 @@ var TokenBalancesController = class extends _basecontroller.BaseController { +@@ -107,20 +120,27 @@ var TokenBalancesController = class extends _basecontroller.BaseController { "AccountsController:getSelectedAccount" ); const newContractBalances = {}; @@ -437,7 +290,7 @@ index 995ec6b..84408ac 100644 } }; _handle = new WeakMap(); -@@ -128,6 +146,7 @@ _getERC20BalanceOf = new WeakMap(); +@@ -128,6 +148,7 @@ _getERC20BalanceOf = new WeakMap(); _interval = new WeakMap(); _tokens = new WeakMap(); _disabled = new WeakMap(); @@ -445,27 +298,6 @@ index 995ec6b..84408ac 100644 var TokenBalancesController_default = TokenBalancesController; -diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-RPQ737HL.js b/node_modules/@metamask/assets-controllers/dist/chunk-RPQ737HL.js -index b14af30..ee7141e 100644 ---- a/node_modules/@metamask/assets-controllers/dist/chunk-RPQ737HL.js -+++ b/node_modules/@metamask/assets-controllers/dist/chunk-RPQ737HL.js -@@ -173,6 +173,16 @@ var TokenRatesController = class extends _pollingcontroller.StaticIntervalPollin - _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _subscribeToNetworkStateChange, subscribeToNetworkStateChange_fn).call(this); - _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _subscribeToAccountChange, subscribeToAccountChange_fn).call(this); - } -+ -+ /** -+ * THIS FUNCTIONS IS CURRENTLY PATCHED AND STILL NEEDS TO BE IMPLEMENTED ON THE CORE REPO -+ * Resets to the default state -+ */ -+ reset() { -+ this.update((state) => { -+ state.marketData = {}; -+ }); -+ } - /** - * Allows controller to make active and passive polling requests - */ diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-T5ZX5BV7.js b/node_modules/@metamask/assets-controllers/dist/chunk-T5ZX5BV7.js index 9c89a65..2ac17ba 100644 --- a/node_modules/@metamask/assets-controllers/dist/chunk-T5ZX5BV7.js @@ -519,35 +351,44 @@ index 9c89a65..2ac17ba 100644 } finally { releaseLock(); } +diff --git a/node_modules/@metamask/assets-controllers/dist/chunk-TPUVGGNO.js b/node_modules/@metamask/assets-controllers/dist/chunk-TPUVGGNO.js +index baaf7d0..cfefb60 100644 +--- a/node_modules/@metamask/assets-controllers/dist/chunk-TPUVGGNO.js ++++ b/node_modules/@metamask/assets-controllers/dist/chunk-TPUVGGNO.js +@@ -189,6 +189,20 @@ var TokensController = class extends _basecontroller.BaseController { + } + ); + } ++ ++ /** ++ * THIS FUNCTIONS IS CURRENTLY PATCHED AND STILL NEEDS TO BE IMPLEMENTED ON THE CORE REPO ++ * Resets to the default state ++ */ ++ reset() { ++ this.update((state) => { ++ state.allTokens = {}; ++ state.allIgnoredTokens = {}; ++ state.ignoredTokens = []; ++ state.tokens = []; ++ }); ++ } ++ + /** + * Adds a token to the stored token list. + * diff --git a/node_modules/@metamask/assets-controllers/dist/types/NftController.d.ts b/node_modules/@metamask/assets-controllers/dist/types/NftController.d.ts -index b663e26..09f72c6 100644 +index a69c32d..077e2db 100644 --- a/node_modules/@metamask/assets-controllers/dist/types/NftController.d.ts +++ b/node_modules/@metamask/assets-controllers/dist/types/NftController.d.ts -@@ -7,7 +7,7 @@ import type { PreferencesControllerStateChangeEvent } from '@metamask/preference - import type { Hex } from '@metamask/utils'; - import type { AssetsContractController } from './AssetsContractController'; - import { Source } from './constants'; --import type { Collection, Attributes, LastSale } from './NftDetectionController'; -+import type { Collection, Attributes, LastSale, TopBid } from './NftDetectionController'; - type NFTStandardType = 'ERC721' | 'ERC1155'; - type SuggestedNftMeta = { - asset: { -@@ -108,11 +108,13 @@ export type NftMetadata = { +@@ -108,6 +108,7 @@ export type NftMetadata = { creator?: string; transactionId?: string; tokenURI?: string | null; + error?: string; collection?: Collection; address?: string; -- attributes?: Attributes; -+ attributes?: Attributes[]; - lastSale?: LastSale; - rarityRank?: string; -+ topBid?: TopBid; - }; - /** - * @type NftControllerState -@@ -419,6 +421,11 @@ export declare class NftController extends BaseController; @@ -560,61 +401,6 @@ index b663e26..09f72c6 100644 export default NftController; //# sourceMappingURL=NftController.d.ts.map \ No newline at end of file -diff --git a/node_modules/@metamask/assets-controllers/dist/types/NftDetectionController.d.ts b/node_modules/@metamask/assets-controllers/dist/types/NftDetectionController.d.ts -index c645b3a..0c2a87c 100644 ---- a/node_modules/@metamask/assets-controllers/dist/types/NftDetectionController.d.ts -+++ b/node_modules/@metamask/assets-controllers/dist/types/NftDetectionController.d.ts -@@ -227,7 +227,39 @@ export type Attributes = { - topBidValue?: number | null; - createdAt?: string; - }; --export type Collection = { -+export type GetCollectionsResponse = { -+ collections: CollectionResponse[]; -+ }; -+export type CollectionResponse = { -+ id?: string; -+ openseaVerificationStatus?: string; -+ contractDeployedAt?: string; -+ creator?: string; -+ ownerCount?: string; -+ topBid?: TopBid & { -+ sourceDomain?: string; -+ }; -+}; -+export type FloorAskCollection = { -+ id?: string; -+ price?: Price; -+ maker?: string; -+ kind?: string; -+ validFrom?: number; -+ validUntil?: number; -+ source?: SourceCollection; -+ rawData?: Metadata; -+ isNativeOffChainCancellable?: boolean; -+}; -+ -+export type SourceCollection = { -+ id: string; -+ domain: string; -+ name: string; -+ icon: string; -+ url: string; -+}; -+export type TokenCollection = { - id?: string; - name?: string; - slug?: string; -@@ -243,7 +275,9 @@ export type Collection = { - floorAskPrice?: Price; - royaltiesBps?: number; - royalties?: Royalties[]; -+ floorAsk?: FloorAskCollection; - }; -+export type Collection = TokenCollection & CollectionResponse; - export type Royalties = { - bps?: number; - recipient?: string; diff --git a/node_modules/@metamask/assets-controllers/dist/types/TokenBalancesController.d.ts b/node_modules/@metamask/assets-controllers/dist/types/TokenBalancesController.d.ts index 45d58f8..ce24723 100644 --- a/node_modules/@metamask/assets-controllers/dist/types/TokenBalancesController.d.ts diff --git a/yarn.lock b/yarn.lock index 532ddd37cd1..a4bdd2e6950 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4330,10 +4330,10 @@ "@metamask/utils" "^9.1.0" nanoid "^3.1.31" -"@metamask/assets-controllers@^35.0.0": - version "35.0.0" - resolved "https://registry.yarnpkg.com/@metamask/assets-controllers/-/assets-controllers-35.0.0.tgz#564b1b91f199863090221cad256af1c6061d4ea8" - integrity sha512-OAkh89NZKMPihBSCB4MsMXzavvQ01myWHvLsDtfhRMrV5cXqNL5NynCm5Q2hz2X4JjUyW/Kdqc69nBBjVj++oA== +"@metamask/assets-controllers@^36.0.0": + version "36.0.0" + resolved "https://registry.yarnpkg.com/@metamask/assets-controllers/-/assets-controllers-36.0.0.tgz#17f48d65b0b444aae742b8221fd16513da148458" + integrity sha512-leYjYcH6TIxDzrQebJjeBc02H2YMx9JfWsGQ9tZHydB0BF4st3pDUZYneVZRfR2XlIAyoVS7cSgvfdXZ+tmstQ== dependencies: "@ethereumjs/util" "^8.1.0" "@ethersproject/address" "^5.7.0" @@ -4342,18 +4342,18 @@ "@ethersproject/providers" "^5.7.0" "@metamask/abi-utils" "^2.0.2" "@metamask/accounts-controller" "^17.2.0" - "@metamask/approval-controller" "^7.0.0" - "@metamask/base-controller" "^6.0.0" + "@metamask/approval-controller" "^7.0.1" + "@metamask/base-controller" "^6.0.1" "@metamask/contract-metadata" "^2.4.0" - "@metamask/controller-utils" "^11.0.0" + "@metamask/controller-utils" "^11.0.1" "@metamask/eth-query" "^4.0.0" "@metamask/keyring-controller" "^17.1.0" "@metamask/metamask-eth-abis" "^3.1.1" "@metamask/network-controller" "^20.0.0" "@metamask/polling-controller" "^9.0.0" "@metamask/preferences-controller" "^13.0.0" - "@metamask/rpc-errors" "^6.2.1" - "@metamask/utils" "^8.3.0" + "@metamask/rpc-errors" "^6.3.1" + "@metamask/utils" "^9.0.0" "@types/bn.js" "^5.1.5" "@types/uuid" "^8.3.0" async-mutex "^0.5.0" @@ -4388,7 +4388,7 @@ "@metamask/utils" "^8.3.0" immer "^9.0.6" -"@metamask/base-controller@^6.0.0", "@metamask/base-controller@^6.0.2": +"@metamask/base-controller@^6.0.0", "@metamask/base-controller@^6.0.1", "@metamask/base-controller@^6.0.2": version "6.0.3" resolved "https://registry.yarnpkg.com/@metamask/base-controller/-/base-controller-6.0.3.tgz#9bb4e74234c1de5f99842c343ffa053c08055db1" integrity sha512-neUqsCXRT6QYcZO51y6Y5u9NPTHuxgNsW5Z4h///o1gDdV8lBeIG/b1ne+QPK422DZMAm4ChnkG1DDNf4PkErw== @@ -4438,7 +4438,7 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-2.2.0.tgz#277764d0d56e37180ae7644a9d11eb96295b36fc" integrity sha512-SM6A4C7vXNbVpgMTX67kfW8QWvu3eSXxMZlY5PqZBTkvri1s9zgQ0uwRkK5r2VXNEoVmXCDnnEX/tX5EzzgNUQ== -"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0": +"@metamask/controller-utils@^11.0.0", "@metamask/controller-utils@^11.0.1", "@metamask/controller-utils@^11.0.2", "@metamask/controller-utils@^11.3.0": version "11.3.0" resolved "https://registry.yarnpkg.com/@metamask/controller-utils/-/controller-utils-11.3.0.tgz#530fd22289f717b752b4a7b6e504e1f2911b30a4" integrity sha512-5b+Jg9sKKESzvQcuipHC1D7KSh98MVIi7hXQUk7iX+YVMl4KoKDv94Bl+li8g+jCBshMOV9bRMRh25/hdEvTZQ==