Skip to content

Commit a6565a3

Browse files
committed
fix: update patch and fix actions
1 parent 986a057 commit a6565a3

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
diff --git a/dist/NftController.js b/dist/NftController.js
2+
index ecbb338b3d52f0c9f40ccc81f5a50c8c41b542f0..7056db263301fcf0527606dfe6c2c1d3240edc8a 100644
3+
--- a/dist/NftController.js
4+
+++ b/dist/NftController.js
5+
@@ -778,6 +778,32 @@ class NftController extends base_controller_1.BaseControllerV1 {
6+
}
7+
});
8+
}
9+
+ /**
10+
+ * Refetches NFT metadata and updates the state
11+
+ *
12+
+ * @param options - Options for refetching NFT metadata
13+
+ * @param options.nfts - Array of nfts
14+
+ * @param options.networkClientId - The networkClientId that can be used to identify the network client to use for this request.
15+
+ * @param options.userAddress - The current user address
16+
+ */
17+
+ updateNftMetadata({ nfts, networkClientId, userAddress = this.config.selectedAddress, }) {
18+
+ return __awaiter(this, void 0, void 0, function* () {
19+
+ const chainId = this.getCorrectChainId({ networkClientId });
20+
+ const nftsWithChecksumAdr = nfts.map((nft) => {
21+
+ return Object.assign(Object.assign({}, nft), { address: (0, controller_utils_1.toChecksumHexAddress)(nft.address) });
22+
+ });
23+
+ const nftMetadataResults = yield Promise.allSettled(nftsWithChecksumAdr.map((nft) => __awaiter(this, void 0, void 0, function* () {
24+
+ const resMetadata = yield this.getNftInformation(nft.address, nft.tokenId, networkClientId);
25+
+ return {
26+
+ nft,
27+
+ newMetadata: resMetadata,
28+
+ };
29+
+ })));
30+
+ nftMetadataResults
31+
+ .filter((result) => result.status === 'fulfilled')
32+
+ .forEach((elm) => this.updateNft(elm.value.nft, elm.value.newMetadata, userAddress, chainId));
33+
+ });
34+
+ }
35+
/**
36+
* Removes an NFT from the stored token list.
37+
*

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@
245245
"@metamask/address-book-controller": "^3.0.0",
246246
"@metamask/announcement-controller": "^5.0.1",
247247
"@metamask/approval-controller": "^5.1.2",
248+
<<<<<<< HEAD
248249
"@metamask/assets-controllers": "^26.0.0",
250+
=======
251+
"@metamask/assets-controllers": "patch:@metamask/assets-controllers@patch%3A@metamask/assets-controllers@npm%253A24.0.0%23~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch%3A%3Aversion=24.0.0&hash=f321cb#~/.yarn/patches/@metamask-assets-controllers-patch-74191f09e4.patch",
252+
>>>>>>> c563892848 (fix: update patch and fix actions)
249253
"@metamask/base-controller": "^4.1.0",
250254
"@metamask/browser-passworder": "^4.3.0",
251255
"@metamask/contract-metadata": "^2.3.1",

ui/store/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,8 +2040,10 @@ export function updateNftMetadata(
20402040
try {
20412041
const networkClientId = getSelectedNetworkClientId(getState());
20422042
await submitRequestToBackground('updateNftMetadata', [
2043-
nfts,
2044-
networkClientId,
2043+
{
2044+
nfts,
2045+
networkClientId,
2046+
},
20452047
]);
20462048
} catch (error) {
20472049
logErrorWithMessage(error);

yarn.lock

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,6 +3942,42 @@ __metadata:
39423942
languageName: node
39433943
linkType: hard
39443944

3945+
"@metamask/assets-controllers@patch:@metamask/assets-controllers@patch%3A@metamask/assets-controllers@npm%253A24.0.0%23~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch%3A%3Aversion=24.0.0&hash=f321cb#~/.yarn/patches/@metamask-assets-controllers-patch-74191f09e4.patch":
3946+
version: 24.0.0
3947+
resolution: "@metamask/assets-controllers@patch:@metamask/assets-controllers@patch%3A@metamask/assets-controllers@npm%253A24.0.0%23~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch%3A%3Aversion=24.0.0&hash=f321cb#~/.yarn/patches/@metamask-assets-controllers-patch-74191f09e4.patch::version=24.0.0&hash=f31c74"
3948+
dependencies:
3949+
"@ethersproject/address": "npm:^5.7.0"
3950+
"@ethersproject/bignumber": "npm:^5.7.0"
3951+
"@ethersproject/contracts": "npm:^5.7.0"
3952+
"@ethersproject/providers": "npm:^5.7.0"
3953+
"@metamask/abi-utils": "npm:^2.0.2"
3954+
"@metamask/approval-controller": "npm:^5.1.1"
3955+
"@metamask/base-controller": "npm:^4.0.1"
3956+
"@metamask/contract-metadata": "npm:^2.4.0"
3957+
"@metamask/controller-utils": "npm:^8.0.1"
3958+
"@metamask/eth-query": "npm:^4.0.0"
3959+
"@metamask/metamask-eth-abis": "npm:3.0.0"
3960+
"@metamask/network-controller": "npm:^17.1.0"
3961+
"@metamask/polling-controller": "npm:^4.0.0"
3962+
"@metamask/preferences-controller": "npm:^6.0.0"
3963+
"@metamask/rpc-errors": "npm:^6.1.0"
3964+
"@metamask/utils": "npm:^8.2.0"
3965+
"@types/uuid": "npm:^8.3.0"
3966+
async-mutex: "npm:^0.2.6"
3967+
cockatiel: "npm:^3.1.2"
3968+
ethereumjs-util: "npm:^7.0.10"
3969+
lodash: "npm:^4.17.21"
3970+
multiformats: "npm:^9.5.2"
3971+
single-call-balance-checker-abi: "npm:^1.0.0"
3972+
uuid: "npm:^8.3.2"
3973+
peerDependencies:
3974+
"@metamask/approval-controller": ^5.1.1
3975+
"@metamask/network-controller": ^17.1.0
3976+
"@metamask/preferences-controller": ^6.0.0
3977+
checksum: b68114d44eb90e6c4799d75b1eda2f2b707010be9250205136c20d3ef9086801c9d1292589c4e82c7209262358d31707f4432ad8970161896011f62fd29c9e42
3978+
languageName: node
3979+
linkType: hard
3980+
39453981
"@metamask/auto-changelog@npm:^2.1.0":
39463982
version: 2.6.1
39473983
resolution: "@metamask/auto-changelog@npm:2.6.1"

0 commit comments

Comments
 (0)