Skip to content

Commit c563892

Browse files
committed
fix: update patch and fix actions
1 parent 17053e9 commit c563892

File tree

4 files changed

+80
-5
lines changed

4 files changed

+80
-5
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
"@metamask/address-book-controller": "^3.0.0",
249249
"@metamask/announcement-controller": "^5.0.1",
250250
"@metamask/approval-controller": "^5.1.2",
251-
"@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A24.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch",
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",
252252
"@metamask/base-controller": "^4.1.0",
253253
"@metamask/browser-passworder": "^4.3.0",
254254
"@metamask/contract-metadata": "^2.3.1",

ui/store/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,8 +2015,10 @@ export function updateNftMetadata(
20152015
try {
20162016
const networkClientId = getSelectedNetworkClientId(getState());
20172017
await submitRequestToBackground('updateNftMetadata', [
2018-
nfts,
2019-
networkClientId,
2018+
{
2019+
nfts,
2020+
networkClientId,
2021+
},
20202022
]);
20212023
} catch (error) {
20222024
logErrorWithMessage(error);

yarn.lock

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,7 +3942,7 @@ __metadata:
39423942
languageName: node
39433943
linkType: hard
39443944

3945-
"@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A24.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch":
3945+
"@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A24.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch::version=24.0.0&hash=f321cb":
39463946
version: 24.0.0
39473947
resolution: "@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A24.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch::version=24.0.0&hash=f321cb"
39483948
dependencies:
@@ -3978,6 +3978,42 @@ __metadata:
39783978
languageName: node
39793979
linkType: hard
39803980

3981+
"@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":
3982+
version: 24.0.0
3983+
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"
3984+
dependencies:
3985+
"@ethersproject/address": "npm:^5.7.0"
3986+
"@ethersproject/bignumber": "npm:^5.7.0"
3987+
"@ethersproject/contracts": "npm:^5.7.0"
3988+
"@ethersproject/providers": "npm:^5.7.0"
3989+
"@metamask/abi-utils": "npm:^2.0.2"
3990+
"@metamask/approval-controller": "npm:^5.1.1"
3991+
"@metamask/base-controller": "npm:^4.0.1"
3992+
"@metamask/contract-metadata": "npm:^2.4.0"
3993+
"@metamask/controller-utils": "npm:^8.0.1"
3994+
"@metamask/eth-query": "npm:^4.0.0"
3995+
"@metamask/metamask-eth-abis": "npm:3.0.0"
3996+
"@metamask/network-controller": "npm:^17.1.0"
3997+
"@metamask/polling-controller": "npm:^4.0.0"
3998+
"@metamask/preferences-controller": "npm:^6.0.0"
3999+
"@metamask/rpc-errors": "npm:^6.1.0"
4000+
"@metamask/utils": "npm:^8.2.0"
4001+
"@types/uuid": "npm:^8.3.0"
4002+
async-mutex: "npm:^0.2.6"
4003+
cockatiel: "npm:^3.1.2"
4004+
ethereumjs-util: "npm:^7.0.10"
4005+
lodash: "npm:^4.17.21"
4006+
multiformats: "npm:^9.5.2"
4007+
single-call-balance-checker-abi: "npm:^1.0.0"
4008+
uuid: "npm:^8.3.2"
4009+
peerDependencies:
4010+
"@metamask/approval-controller": ^5.1.1
4011+
"@metamask/network-controller": ^17.1.0
4012+
"@metamask/preferences-controller": ^6.0.0
4013+
checksum: b68114d44eb90e6c4799d75b1eda2f2b707010be9250205136c20d3ef9086801c9d1292589c4e82c7209262358d31707f4432ad8970161896011f62fd29c9e42
4014+
languageName: node
4015+
linkType: hard
4016+
39814017
"@metamask/auto-changelog@npm:^2.1.0":
39824018
version: 2.6.1
39834019
resolution: "@metamask/auto-changelog@npm:2.6.1"
@@ -24772,7 +24808,7 @@ __metadata:
2477224808
"@metamask/address-book-controller": "npm:^3.0.0"
2477324809
"@metamask/announcement-controller": "npm:^5.0.1"
2477424810
"@metamask/approval-controller": "npm:^5.1.2"
24775-
"@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A24.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-24.0.0-dfef136464.patch"
24811+
"@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"
2477624812
"@metamask/auto-changelog": "npm:^2.1.0"
2477724813
"@metamask/base-controller": "npm:^4.1.0"
2477824814
"@metamask/browser-passworder": "npm:^4.3.0"

0 commit comments

Comments
 (0)