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 assets-controllers to v37 #26984

Merged
merged 36 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1b874ef
chore: bump assets-controllers to v37
sahar-fehri Sep 9, 2024
8605106
Update LavaMoat policies
metamaskbot Sep 9, 2024
e1b952e
fix: make async getAssetImageURL
sahar-fehri Sep 9, 2024
e6a2835
fix: unit test
sahar-fehri Sep 9, 2024
b04727b
fix: unit test
sahar-fehri Sep 9, 2024
30e7e36
fix: lint
sahar-fehri Sep 9, 2024
8aac12e
fix: rm log
sahar-fehri Sep 10, 2024
8d7d88e
fix: rename fct
sahar-fehri Sep 10, 2024
6ca9c85
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
legobeat Sep 10, 2024
5f9cfb1
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 10, 2024
420a435
fix: refactor
sahar-fehri Sep 10, 2024
c952085
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 10, 2024
e017395
fix: add unit test
sahar-fehri Sep 10, 2024
61b19ad
fix: fix test
sahar-fehri Sep 10, 2024
07e6316
fix: fix test
sahar-fehri Sep 10, 2024
72e42ac
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 10, 2024
18b4857
fix: fix
sahar-fehri Sep 10, 2024
24b0477
fix: fix
sahar-fehri Sep 11, 2024
753f884
fix: fix test
sahar-fehri Sep 11, 2024
3dfc697
fix: add test
sahar-fehri Sep 11, 2024
6e9ba75
fix: fix merge conflicts
sahar-fehri Sep 11, 2024
b8f814a
fix: fix lint
sahar-fehri Sep 11, 2024
800891c
Update LavaMoat policies
metamaskbot Sep 11, 2024
bc302c5
Empty
sahar-fehri Sep 11, 2024
b658d4f
fix: refactor
sahar-fehri Sep 11, 2024
1103eb4
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 11, 2024
3a30a15
fix: fix
sahar-fehri Sep 12, 2024
f809cb8
fix: fix
sahar-fehri Sep 12, 2024
a901ac3
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 12, 2024
6d0a2bf
fix: merge conflicts
sahar-fehri Sep 16, 2024
0df17e5
fix: merge conflicts
sahar-fehri Sep 16, 2024
a832454
Update LavaMoat policies
metamaskbot Sep 17, 2024
e92a159
fix: fix merge conflicts
sahar-fehri Sep 17, 2024
96b56f4
fix: rm not needed nftController callbacks
sahar-fehri Sep 17, 2024
4b7eeb6
fix: merge conflicts
sahar-fehri Sep 18, 2024
82b3271
Merge branch 'develop' into feat/upgrade-assets-controllers-to-v37
sahar-fehri Sep 18, 2024
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
66 changes: 24 additions & 42 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,28 +591,24 @@ export default class MetamaskController extends EventEmitter {
state: initState.TokenListController,
});

this.assetsContractController = new AssetsContractController(
{
chainId: getCurrentChainId({ metamask: this.networkController.state }),
onPreferencesStateChange: (listener) =>
this.preferencesController.store.subscribe(listener),
onNetworkDidChange: (cb) =>
networkControllerMessenger.subscribe(
'NetworkController:networkDidChange',
() => {
const networkState = this.networkController.state;
return cb(networkState);
},
),
getNetworkClientById: this.networkController.getNetworkClientById.bind(
this.networkController,
),
},
{
provider: this.provider,
},
initState.AssetsContractController,
);
const assetsContractControllerMessenger =
this.controllerMessenger.getRestricted({
name: 'AssetsContractController',
allowedActions: [
'NetworkController:getNetworkClientById',
'NetworkController:getNetworkConfigurationByNetworkClientId',
'NetworkController:getSelectedNetworkClient',
'NetworkController:getState',
],
allowedEvents: [
'PreferencesController:stateChange',
'NetworkController:networkDidChange',
],
});
this.assetsContractController = new AssetsContractController({
messenger: assetsContractControllerMessenger,
chainId: getCurrentChainId({ metamask: this.networkController.state }),
});

const tokensControllerMessenger = this.controllerMessenger.getRestricted({
name: 'TokensController',
Expand Down Expand Up @@ -648,32 +644,18 @@ export default class MetamaskController extends EventEmitter {
`${this.networkController.name}:getNetworkClientById`,
'AccountsController:getSelectedAccount',
'AccountsController:getAccount',
'AssetsContractController:getERC721AssetName',
'AssetsContractController:getERC721AssetSymbol',
'AssetsContractController:getERC721TokenURI',
'AssetsContractController:getERC721OwnerOf',
'AssetsContractController:getERC1155BalanceOf',
'AssetsContractController:getERC1155TokenURI',
],
});
this.nftController = new NftController({
state: initState.NftController,
messenger: nftControllerMessenger,
chainId: getCurrentChainId({ metamask: this.networkController.state }),
getERC721AssetName: this.assetsContractController.getERC721AssetName.bind(
this.assetsContractController,
),
getERC721AssetSymbol:
this.assetsContractController.getERC721AssetSymbol.bind(
this.assetsContractController,
),
getERC721TokenURI: this.assetsContractController.getERC721TokenURI.bind(
this.assetsContractController,
),
getERC721OwnerOf: this.assetsContractController.getERC721OwnerOf.bind(
this.assetsContractController,
),
getERC1155BalanceOf:
this.assetsContractController.getERC1155BalanceOf.bind(
this.assetsContractController,
),
getERC1155TokenURI: this.assetsContractController.getERC1155TokenURI.bind(
this.assetsContractController,
),
onNftAdded: ({ address, symbol, tokenId, standard, source }) =>
this.metaMetricsController.trackEvent({
event: MetaMetricsEventName.NftAdded,
Expand Down
20 changes: 10 additions & 10 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
"TextEncoder": true
},
"packages": {
"@metamask/assets-controllers>multiformats": true
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true
}
},
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@ensdomains/content-hash>multihashes": {
Expand Down Expand Up @@ -846,14 +854,14 @@
"setTimeout": true
},
"packages": {
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethersproject/abi>@ethersproject/address": true,
"@ethersproject/contracts": true,
"@ethersproject/providers": true,
"@metamask/abi-utils": true,
"@metamask/assets-controllers>@metamask/base-controller": true,
"@metamask/assets-controllers>@metamask/polling-controller": true,
"@metamask/assets-controllers>multiformats": true,
"@metamask/contract-metadata": true,
"@metamask/controller-utils": true,
"@metamask/eth-query": true,
Expand Down Expand Up @@ -888,14 +896,6 @@
"uuid": true
}
},
"@metamask/assets-controllers>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@metamask/base-controller": {
"globals": {
"setTimeout": true
Expand Down
20 changes: 10 additions & 10 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
"TextEncoder": true
},
"packages": {
"@metamask/assets-controllers>multiformats": true
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true
}
},
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@ensdomains/content-hash>multihashes": {
Expand Down Expand Up @@ -846,14 +854,14 @@
"setTimeout": true
},
"packages": {
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethersproject/abi>@ethersproject/address": true,
"@ethersproject/contracts": true,
"@ethersproject/providers": true,
"@metamask/abi-utils": true,
"@metamask/assets-controllers>@metamask/base-controller": true,
"@metamask/assets-controllers>@metamask/polling-controller": true,
"@metamask/assets-controllers>multiformats": true,
"@metamask/contract-metadata": true,
"@metamask/controller-utils": true,
"@metamask/eth-query": true,
Expand Down Expand Up @@ -888,14 +896,6 @@
"uuid": true
}
},
"@metamask/assets-controllers>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@metamask/base-controller": {
"globals": {
"setTimeout": true
Expand Down
20 changes: 10 additions & 10 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
"TextEncoder": true
},
"packages": {
"@metamask/assets-controllers>multiformats": true
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true
}
},
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@ensdomains/content-hash>multihashes": {
Expand Down Expand Up @@ -846,14 +854,14 @@
"setTimeout": true
},
"packages": {
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethersproject/abi>@ethersproject/address": true,
"@ethersproject/contracts": true,
"@ethersproject/providers": true,
"@metamask/abi-utils": true,
"@metamask/assets-controllers>@metamask/base-controller": true,
"@metamask/assets-controllers>@metamask/polling-controller": true,
"@metamask/assets-controllers>multiformats": true,
"@metamask/contract-metadata": true,
"@metamask/controller-utils": true,
"@metamask/eth-query": true,
Expand Down Expand Up @@ -888,14 +896,6 @@
"uuid": true
}
},
"@metamask/assets-controllers>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@metamask/base-controller": {
"globals": {
"setTimeout": true
Expand Down
20 changes: 10 additions & 10 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@
"TextEncoder": true
},
"packages": {
"@metamask/assets-controllers>multiformats": true
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true
}
},
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@ensdomains/content-hash>multihashes": {
Expand Down Expand Up @@ -938,14 +946,14 @@
"setTimeout": true
},
"packages": {
"@ensdomains/content-hash>multicodec>uint8arrays>multiformats": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@ethersproject/abi>@ethersproject/address": true,
"@ethersproject/contracts": true,
"@ethersproject/providers": true,
"@metamask/abi-utils": true,
"@metamask/assets-controllers>@metamask/base-controller": true,
"@metamask/assets-controllers>@metamask/polling-controller": true,
"@metamask/assets-controllers>multiformats": true,
"@metamask/contract-metadata": true,
"@metamask/controller-utils": true,
"@metamask/eth-query": true,
Expand Down Expand Up @@ -980,14 +988,6 @@
"uuid": true
}
},
"@metamask/assets-controllers>multiformats": {
"globals": {
"TextDecoder": true,
"TextEncoder": true,
"console.warn": true,
"crypto.subtle.digest": true
}
},
"@metamask/base-controller": {
"globals": {
"setTimeout": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
"@metamask/address-book-controller": "^5.0.0",
"@metamask/announcement-controller": "^7.0.0",
"@metamask/approval-controller": "^7.0.0",
"@metamask/assets-controllers": "^36.0.0",
"@metamask/assets-controllers": "^37.0.0",
"@metamask/base-controller": "^7.0.0",
"@metamask/bitcoin-wallet-snap": "^0.6.0",
"@metamask/browser-passworder": "^4.3.0",
Expand Down
Loading