diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 94bf575e610a..2993482ec504 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -2603,6 +2603,9 @@ } }, "@metamask/signature-controller": { + "globals": { + "fetch": true + }, "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 94bf575e610a..2993482ec504 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -2603,6 +2603,9 @@ } }, "@metamask/signature-controller": { + "globals": { + "fetch": true + }, "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 94bf575e610a..2993482ec504 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -2603,6 +2603,9 @@ } }, "@metamask/signature-controller": { + "globals": { + "fetch": true + }, "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 9acbc67302ab..02d73c44f420 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -2695,6 +2695,9 @@ } }, "@metamask/signature-controller": { + "globals": { + "fetch": true + }, "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 629492c40425..04be3b9f2867 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -116,22 +116,12 @@ "console.warn": true }, "packages": { - "@babel/core>@babel/generator>@babel/types": true, "@babel/core>@babel/generator>jsesc": true, + "@babel/core>@babel/types": true, "terser-webpack-plugin>@jridgewell/trace-mapping": true, "terser>@jridgewell/source-map>@jridgewell/gen-mapping": true } }, - "@babel/core>@babel/generator>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true - } - }, "@babel/core>@babel/generator>jsesc": { "globals": { "Buffer": true @@ -182,65 +172,25 @@ "assert": true }, "packages": { - "@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports>@babel/types": true - } - }, - "@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/core>@babel/helper-module-transforms>@babel/helper-simple-access": { "packages": { - "@babel/core>@babel/helper-module-transforms>@babel/helper-simple-access>@babel/types": true - } - }, - "@babel/core>@babel/helper-module-transforms>@babel/helper-simple-access>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/core>@babel/helpers": { "packages": { - "@babel/core>@babel/helpers>@babel/types": true, - "@babel/core>@babel/template": true - } - }, - "@babel/core>@babel/helpers>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/template": true, + "@babel/core>@babel/types": true } }, "@babel/core>@babel/template": { "packages": { "@babel/code-frame": true, "@babel/core>@babel/parser": true, - "@babel/core>@babel/template>@babel/types": true - } - }, - "@babel/core>@babel/template>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/core>@babel/types": { @@ -481,20 +431,10 @@ "@babel/preset-env>@babel/plugin-transform-async-to-generator>@babel/helper-remap-async-to-generator>@babel/helper-wrap-function": { "packages": { "@babel/core>@babel/template": true, - "@babel/preset-env>@babel/plugin-transform-async-to-generator>@babel/helper-remap-async-to-generator>@babel/helper-wrap-function>@babel/types": true, + "@babel/core>@babel/types": true, "depcheck>@babel/traverse": true } }, - "@babel/preset-env>@babel/plugin-transform-async-to-generator>@babel/helper-remap-async-to-generator>@babel/helper-wrap-function>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true - } - }, "@babel/preset-env>@babel/plugin-transform-block-scoped-functions": { "packages": { "@babel/core": true, @@ -532,17 +472,7 @@ }, "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-annotate-as-pure": { "packages": { - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-annotate-as-pure>@babel/types": true - } - }, - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-annotate-as-pure>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers": { @@ -555,32 +485,12 @@ }, "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-member-expression-to-functions": { "packages": { - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-member-expression-to-functions>@babel/types": true - } - }, - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-member-expression-to-functions>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-optimise-call-expression": { "packages": { - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-optimise-call-expression>@babel/types": true - } - }, - "@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers>@babel/helper-optimise-call-expression>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/preset-env>@babel/plugin-transform-computed-properties": { @@ -675,17 +585,7 @@ }, "@babel/preset-env>@babel/plugin-transform-exponentiation-operator>@babel/helper-builder-binary-assignment-operator-visitor": { "packages": { - "@babel/preset-env>@babel/plugin-transform-exponentiation-operator>@babel/helper-builder-binary-assignment-operator-visitor>@babel/types": true - } - }, - "@babel/preset-env>@babel/plugin-transform-exponentiation-operator>@babel/helper-builder-binary-assignment-operator-visitor>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/preset-env>@babel/plugin-transform-export-namespace-from": { @@ -703,17 +603,7 @@ }, "@babel/preset-env>@babel/plugin-transform-for-of>@babel/helper-skip-transparent-expression-wrappers": { "packages": { - "@babel/preset-env>@babel/plugin-transform-for-of>@babel/helper-skip-transparent-expression-wrappers>@babel/types": true - } - }, - "@babel/preset-env>@babel/plugin-transform-for-of>@babel/helper-skip-transparent-expression-wrappers>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true + "@babel/core>@babel/types": true } }, "@babel/preset-env>@babel/plugin-transform-function-name": { @@ -1261,17 +1151,6 @@ "@metamask/object-multiplex>once>wrappy": true } }, - "@metamask/snaps-utils>@babel/types": { - "globals": { - "console.warn": true, - "process.env.BABEL_TYPES_8_BREAKING": true - }, - "packages": { - "@metamask/snaps-utils>@babel/types>@babel/helper-string-parser": true, - "@metamask/snaps-utils>@babel/types>@babel/helper-validator-identifier": true, - "@metamask/snaps-utils>@babel/types>to-fast-properties": true - } - }, "@metamask/utils>@scure/base": { "globals": { "TextDecoder": true, @@ -2392,22 +2271,12 @@ "@babel/core>@babel/generator": true, "@babel/core>@babel/parser": true, "@babel/core>@babel/template": true, + "@babel/core>@babel/types": true, "babel/preset-env>b@babel/types": true, - "depcheck>@babel/traverse>@babel/types": true, "depcheck>@babel/traverse>globals": true, "nock>debug": true } }, - "depcheck>@babel/traverse>@babel/types": { - "globals": { - "console.warn": true, - "process.env": true - }, - "packages": { - "@babel/core>@babel/types>@babel/helper-string-parser": true, - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true - } - }, "depcheck>cosmiconfig>parse-json": { "packages": { "@babel/code-frame": true, @@ -6371,12 +6240,11 @@ "lavamoat-viz>lavamoat-core>lavamoat-tofu>@babel/traverse>@babel/types": { "globals": { "console.warn": true, - "process.env.BABEL_TYPES_8_BREAKING": true + "process.env": true }, "packages": { - "@metamask/snaps-utils>@babel/types>to-fast-properties": true, - "lavamoat-viz>lavamoat-core>lavamoat-tofu>@babel/traverse>@babel/types>@babel/helper-string-parser": true, - "lavamoat-viz>lavamoat-core>lavamoat-tofu>@babel/traverse>@babel/types>@babel/helper-validator-identifier": true + "@babel/core>@babel/types>@babel/helper-string-parser": true, + "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true } }, "lavamoat>@lavamoat/aa": { @@ -6454,17 +6322,17 @@ "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name": { "packages": { "@babel/core>@babel/template": true, - "@metamask/snaps-utils>@babel/types": true + "@babel/core>@babel/types": true } }, "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-hoist-variables": { "packages": { - "@metamask/snaps-utils>@babel/types": true + "@babel/core>@babel/types": true } }, "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-split-export-declaration": { "packages": { - "@metamask/snaps-utils>@babel/types": true + "@babel/core>@babel/types": true } }, "lodash": { diff --git a/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx b/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx index 128cd8b86beb..9a1ac0163ea7 100644 --- a/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx +++ b/ui/components/app/assets/asset-list/asset-list-control-bar/asset-list-control-bar.tsx @@ -50,18 +50,19 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => { useState(false); const allOpts: Record = {}; - Object.keys(allNetworks).forEach((chainId) => { + Object.keys(allNetworks || {}).forEach((chainId) => { allOpts[chainId] = true; }); const allNetworksFilterShown = - Object.keys(tokenNetworkFilter).length !== Object.keys(allOpts).length; + Object.keys(tokenNetworkFilter || {}).length !== + Object.keys(allOpts || {}).length; // TODO: This useEffect should be a migration // We need to set the default filter for all users to be all included networks, rather than defaulting to empty object // This effect is to unblock and derisk in the short-term useEffect(() => { - if (Object.keys(tokenNetworkFilter).length === 0) { + if (Object.keys(tokenNetworkFilter || {}).length === 0) { dispatch(setTokenNetworkFilter(allOpts)); } }, []); diff --git a/ui/components/app/assets/asset-list/network-filter/network-filter.tsx b/ui/components/app/assets/asset-list/network-filter/network-filter.tsx index b90d3cd13235..489d69f11d52 100644 --- a/ui/components/app/assets/asset-list/network-filter/network-filter.tsx +++ b/ui/components/app/assets/asset-list/network-filter/network-filter.tsx @@ -56,14 +56,14 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => { useEffect(() => { const testnetChains: string[] = TEST_CHAINS; - const mainnetChainIds = Object.keys(allNetworks).filter( + const mainnetChainIds = Object.keys(allNetworks || {}).filter( (chain) => !testnetChains.includes(chain), ); setChainsToShow(mainnetChainIds); }, []); const allOpts: Record = {}; - Object.keys(allNetworks).forEach((chain) => { + Object.keys(allNetworks || {}).forEach((chain) => { allOpts[chain] = true; }); @@ -71,8 +71,8 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => { <> handleFilter(allOpts)} > @@ -123,7 +123,7 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => { handleFilter({ [chainId]: true })} >