diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 28c2fc85c8a6..86597b9a15fa 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -370,9 +370,9 @@ "@ethereumjs/tx": true, "@keystonehq/bc-ur-registry-eth": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": true, + "@keystonehq/metamask-airgapped-keyring>rlp": true, + "@metamask/obs-store": true, "browserify>buffer": true, - "ethereumjs-util>rlp": true, "uuid": true, "webpack>events": true } @@ -382,65 +382,18 @@ "@ethereumjs/tx": true, "@ethereumjs/tx>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": true, "@metamask/eth-trezor-keyring>hdkey": true, "browserify>buffer": true, + "eth-lattice-keyring>rlp": true, "uuid": true } }, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": { - "globals": { - "TextEncoder": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": true, - "stream-browserify": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": true, - "browserify>util": true, - "process": true, - "watchify>xtend": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>isarray": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": true, - "browserify>browser-resolve": true, - "browserify>timers-browserify": true, - "process": true, - "pumpify>inherits": true, - "readable-stream-2>core-util-is": true, - "readable-stream-2>process-nextick-args": true, - "readable-stream>util-deprecate": true, - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": { + "@keystonehq/metamask-airgapped-keyring>rlp": { "packages": { + "bn.js": true, "browserify>buffer": true } }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true - } - }, "@lavamoat/lavadome-react": { "globals": { "Document.prototype": true, @@ -1409,12 +1362,18 @@ "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": true, "bn.js": true, "browserify>assert": true, "browserify>buffer": true, "browserify>insert-module-globals>is-buffer": true, - "ethereumjs-util>create-hash": true, - "ethereumjs-util>rlp": true + "ethereumjs-util>create-hash": true + } + }, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": { + "packages": { + "bn.js": true, + "browserify>buffer": true } }, "@metamask/logging-controller": { @@ -4087,9 +4046,9 @@ "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, - "eth-lattice-keyring>gridplus-sdk>rlp": true, "eth-lattice-keyring>gridplus-sdk>secp256k1": true, "eth-lattice-keyring>gridplus-sdk>uuid": true, + "eth-lattice-keyring>rlp": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "ethers>@ethersproject/sha2>hash.js": true, "lodash": true @@ -4143,11 +4102,6 @@ "location": true } }, - "eth-lattice-keyring>gridplus-sdk>rlp": { - "globals": { - "TextEncoder": true - } - }, "eth-lattice-keyring>gridplus-sdk>secp256k1": { "packages": { "@metamask/ppom-validator>elliptic": true @@ -5362,16 +5316,6 @@ "webpack>events": true } }, - "readable-stream-2>core-util-is": { - "packages": { - "browserify>insert-module-globals>is-buffer": true - } - }, - "readable-stream-2>process-nextick-args": { - "packages": { - "process": true - } - }, "readable-stream>util-deprecate": { "globals": { "console.trace": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 28c2fc85c8a6..86597b9a15fa 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -370,9 +370,9 @@ "@ethereumjs/tx": true, "@keystonehq/bc-ur-registry-eth": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": true, + "@keystonehq/metamask-airgapped-keyring>rlp": true, + "@metamask/obs-store": true, "browserify>buffer": true, - "ethereumjs-util>rlp": true, "uuid": true, "webpack>events": true } @@ -382,65 +382,18 @@ "@ethereumjs/tx": true, "@ethereumjs/tx>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": true, "@metamask/eth-trezor-keyring>hdkey": true, "browserify>buffer": true, + "eth-lattice-keyring>rlp": true, "uuid": true } }, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": { - "globals": { - "TextEncoder": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": true, - "stream-browserify": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": true, - "browserify>util": true, - "process": true, - "watchify>xtend": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>isarray": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": true, - "browserify>browser-resolve": true, - "browserify>timers-browserify": true, - "process": true, - "pumpify>inherits": true, - "readable-stream-2>core-util-is": true, - "readable-stream-2>process-nextick-args": true, - "readable-stream>util-deprecate": true, - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": { + "@keystonehq/metamask-airgapped-keyring>rlp": { "packages": { + "bn.js": true, "browserify>buffer": true } }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true - } - }, "@lavamoat/lavadome-react": { "globals": { "Document.prototype": true, @@ -1409,12 +1362,18 @@ "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": true, "bn.js": true, "browserify>assert": true, "browserify>buffer": true, "browserify>insert-module-globals>is-buffer": true, - "ethereumjs-util>create-hash": true, - "ethereumjs-util>rlp": true + "ethereumjs-util>create-hash": true + } + }, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": { + "packages": { + "bn.js": true, + "browserify>buffer": true } }, "@metamask/logging-controller": { @@ -4087,9 +4046,9 @@ "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, - "eth-lattice-keyring>gridplus-sdk>rlp": true, "eth-lattice-keyring>gridplus-sdk>secp256k1": true, "eth-lattice-keyring>gridplus-sdk>uuid": true, + "eth-lattice-keyring>rlp": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "ethers>@ethersproject/sha2>hash.js": true, "lodash": true @@ -4143,11 +4102,6 @@ "location": true } }, - "eth-lattice-keyring>gridplus-sdk>rlp": { - "globals": { - "TextEncoder": true - } - }, "eth-lattice-keyring>gridplus-sdk>secp256k1": { "packages": { "@metamask/ppom-validator>elliptic": true @@ -5362,16 +5316,6 @@ "webpack>events": true } }, - "readable-stream-2>core-util-is": { - "packages": { - "browserify>insert-module-globals>is-buffer": true - } - }, - "readable-stream-2>process-nextick-args": { - "packages": { - "process": true - } - }, "readable-stream>util-deprecate": { "globals": { "console.trace": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 28c2fc85c8a6..86597b9a15fa 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -370,9 +370,9 @@ "@ethereumjs/tx": true, "@keystonehq/bc-ur-registry-eth": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": true, + "@keystonehq/metamask-airgapped-keyring>rlp": true, + "@metamask/obs-store": true, "browserify>buffer": true, - "ethereumjs-util>rlp": true, "uuid": true, "webpack>events": true } @@ -382,65 +382,18 @@ "@ethereumjs/tx": true, "@ethereumjs/tx>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": true, "@metamask/eth-trezor-keyring>hdkey": true, "browserify>buffer": true, + "eth-lattice-keyring>rlp": true, "uuid": true } }, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": { - "globals": { - "TextEncoder": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": true, - "stream-browserify": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": true, - "browserify>util": true, - "process": true, - "watchify>xtend": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>isarray": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": true, - "browserify>browser-resolve": true, - "browserify>timers-browserify": true, - "process": true, - "pumpify>inherits": true, - "readable-stream-2>core-util-is": true, - "readable-stream-2>process-nextick-args": true, - "readable-stream>util-deprecate": true, - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": { + "@keystonehq/metamask-airgapped-keyring>rlp": { "packages": { + "bn.js": true, "browserify>buffer": true } }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true - } - }, "@lavamoat/lavadome-react": { "globals": { "Document.prototype": true, @@ -1409,12 +1362,18 @@ "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": true, "bn.js": true, "browserify>assert": true, "browserify>buffer": true, "browserify>insert-module-globals>is-buffer": true, - "ethereumjs-util>create-hash": true, - "ethereumjs-util>rlp": true + "ethereumjs-util>create-hash": true + } + }, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": { + "packages": { + "bn.js": true, + "browserify>buffer": true } }, "@metamask/logging-controller": { @@ -4087,9 +4046,9 @@ "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, - "eth-lattice-keyring>gridplus-sdk>rlp": true, "eth-lattice-keyring>gridplus-sdk>secp256k1": true, "eth-lattice-keyring>gridplus-sdk>uuid": true, + "eth-lattice-keyring>rlp": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "ethers>@ethersproject/sha2>hash.js": true, "lodash": true @@ -4143,11 +4102,6 @@ "location": true } }, - "eth-lattice-keyring>gridplus-sdk>rlp": { - "globals": { - "TextEncoder": true - } - }, "eth-lattice-keyring>gridplus-sdk>secp256k1": { "packages": { "@metamask/ppom-validator>elliptic": true @@ -5362,16 +5316,6 @@ "webpack>events": true } }, - "readable-stream-2>core-util-is": { - "packages": { - "browserify>insert-module-globals>is-buffer": true - } - }, - "readable-stream-2>process-nextick-args": { - "packages": { - "process": true - } - }, "readable-stream>util-deprecate": { "globals": { "console.trace": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 923c51a9c32b..db949049605f 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -370,9 +370,9 @@ "@ethereumjs/tx": true, "@keystonehq/bc-ur-registry-eth": true, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": true, + "@keystonehq/metamask-airgapped-keyring>rlp": true, + "@metamask/obs-store": true, "browserify>buffer": true, - "ethereumjs-util>rlp": true, "uuid": true, "webpack>events": true } @@ -382,65 +382,18 @@ "@ethereumjs/tx": true, "@ethereumjs/tx>@ethereumjs/util": true, "@keystonehq/bc-ur-registry-eth": true, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": true, "@metamask/eth-trezor-keyring>hdkey": true, "browserify>buffer": true, + "eth-lattice-keyring>rlp": true, "uuid": true } }, - "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>rlp": { - "globals": { - "TextEncoder": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": true, - "stream-browserify": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>@metamask/safe-event-emitter": { - "globals": { - "setTimeout": true - }, - "packages": { - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": true, - "browserify>util": true, - "process": true, - "watchify>xtend": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>isarray": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": true, - "browserify>browser-resolve": true, - "browserify>timers-browserify": true, - "process": true, - "pumpify>inherits": true, - "readable-stream-2>core-util-is": true, - "readable-stream-2>process-nextick-args": true, - "readable-stream>util-deprecate": true, - "webpack>events": true - } - }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": { + "@keystonehq/metamask-airgapped-keyring>rlp": { "packages": { + "bn.js": true, "browserify>buffer": true } }, - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>string_decoder": { - "packages": { - "@keystonehq/metamask-airgapped-keyring>@metamask/obs-store>through2>readable-stream>safe-buffer": true - } - }, "@lavamoat/lavadome-react": { "globals": { "Document.prototype": true, @@ -1501,12 +1454,18 @@ "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": true, "bn.js": true, "browserify>assert": true, "browserify>buffer": true, "browserify>insert-module-globals>is-buffer": true, - "ethereumjs-util>create-hash": true, - "ethereumjs-util>rlp": true + "ethereumjs-util>create-hash": true + } + }, + "@metamask/keyring-controller>ethereumjs-wallet>ethereumjs-util>rlp": { + "packages": { + "bn.js": true, + "browserify>buffer": true } }, "@metamask/logging-controller": { @@ -4179,9 +4138,9 @@ "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, - "eth-lattice-keyring>gridplus-sdk>rlp": true, "eth-lattice-keyring>gridplus-sdk>secp256k1": true, "eth-lattice-keyring>gridplus-sdk>uuid": true, + "eth-lattice-keyring>rlp": true, "ethereumjs-util>ethereum-cryptography>bs58check": true, "ethers>@ethersproject/sha2>hash.js": true, "lodash": true @@ -4235,11 +4194,6 @@ "location": true } }, - "eth-lattice-keyring>gridplus-sdk>rlp": { - "globals": { - "TextEncoder": true - } - }, "eth-lattice-keyring>gridplus-sdk>secp256k1": { "packages": { "@metamask/ppom-validator>elliptic": true @@ -5430,16 +5384,6 @@ "webpack>events": true } }, - "readable-stream-2>core-util-is": { - "packages": { - "browserify>insert-module-globals>is-buffer": true - } - }, - "readable-stream-2>process-nextick-args": { - "packages": { - "process": true - } - }, "readable-stream>util-deprecate": { "globals": { "console.trace": true, diff --git a/package.json b/package.json index 007077424491..4825184fddc4 100644 --- a/package.json +++ b/package.json @@ -288,7 +288,7 @@ "@ethersproject/wallet": "^5.7.0", "@fortawesome/fontawesome-free": "^5.13.0", "@keystonehq/bc-ur-registry-eth": "^0.19.1", - "@keystonehq/metamask-airgapped-keyring": "^0.13.1", + "@keystonehq/metamask-airgapped-keyring": "^0.14.1", "@lavamoat/lavadome-react": "0.0.17", "@lavamoat/snow": "^2.0.2", "@material-ui/core": "^4.11.0", diff --git a/ui/hooks/metamask-notifications/useNotifications.ts b/ui/hooks/metamask-notifications/useNotifications.ts index 62367cdbe310..9724253a8671 100644 --- a/ui/hooks/metamask-notifications/useNotifications.ts +++ b/ui/hooks/metamask-notifications/useNotifications.ts @@ -54,8 +54,13 @@ export function useListNotifications(): { setLoading(true); setError(null); + const urlParams = new URLSearchParams(window.location.search); + const previewToken = urlParams.get('previewToken'); + try { - const data = await dispatch(fetchAndUpdateMetamaskNotifications()); + const data = await dispatch( + fetchAndUpdateMetamaskNotifications(previewToken ?? undefined), + ); setNotificationsData(data as unknown as Notification[]); return data as unknown as Notification[]; } catch (e) { diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useEIP1559TxFees.ts b/ui/pages/confirmations/components/confirm/info/hooks/useEIP1559TxFees.ts index 40aca7cf2d31..e4bfaad8d779 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useEIP1559TxFees.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useEIP1559TxFees.ts @@ -8,8 +8,11 @@ export const useEIP1559TxFees = ( maxFeePerGas: string; maxPriorityFeePerGas: string; } => { - const hexMaxFeePerGas = transactionMeta?.txParams?.maxFeePerGas; + const hexMaxFeePerGas = + transactionMeta.dappSuggestedGasFees?.maxFeePerGas || + transactionMeta?.txParams?.maxFeePerGas; const hexMaxPriorityFeePerGas = + transactionMeta.dappSuggestedGasFees?.maxPriorityFeePerGas || transactionMeta?.txParams?.maxPriorityFeePerGas; return useMemo(() => { diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useFeeCalculations.ts b/ui/pages/confirmations/components/confirm/info/hooks/useFeeCalculations.ts index ceb8a4b2d248..587d70c9c9ef 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useFeeCalculations.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useFeeCalculations.ts @@ -12,6 +12,7 @@ import { getValueFromWeiHex, multiplyHexes, } from '../../../../../../../shared/modules/conversion.utils'; +import { Numeric } from '../../../../../../../shared/modules/Numeric'; import { getConversionRate } from '../../../../../../ducks/metamask/metamask'; import { useFiatFormatter } from '../../../../../../hooks/useFiatFormatter'; import { useGasFeeEstimates } from '../../../../../../hooks/useGasFeeEstimates'; @@ -114,11 +115,21 @@ export function useFeeCalculations(transactionMeta: TransactionMeta) { } // Logic for any network without L1 and L2 fee components - const minimumFeePerGas = addHexes( + let minimumFeePerGas = addHexes( decGWEIToHexWEI(estimatedBaseFee) || HEX_ZERO, decimalToHex(maxPriorityFeePerGas), ); + // `minimumFeePerGas` should never be higher than the `maxFeePerGas` + if ( + new Numeric(minimumFeePerGas, 16).greaterThan( + decimalToHex(maxFeePerGas), + 16, + ) + ) { + minimumFeePerGas = decimalToHex(maxFeePerGas); + } + const estimatedFee = multiplyHexes( supportsEIP1559 ? (minimumFeePerGas as Hex) : (gasPrice as Hex), gasLimit as Hex, diff --git a/ui/pages/confirmations/components/confirm/info/hooks/useTransactionGasFeeEstimate.ts b/ui/pages/confirmations/components/confirm/info/hooks/useTransactionGasFeeEstimate.ts index 31802eb22feb..f5866a283935 100644 --- a/ui/pages/confirmations/components/confirm/info/hooks/useTransactionGasFeeEstimate.ts +++ b/ui/pages/confirmations/components/confirm/info/hooks/useTransactionGasFeeEstimate.ts @@ -5,6 +5,7 @@ import { addHexes, multiplyHexes, } from '../../../../../../../shared/modules/conversion.utils'; +import { Numeric } from '../../../../../../../shared/modules/Numeric'; import { useGasFeeEstimates } from '../../../../../../hooks/useGasFeeEstimates'; import { HEX_ZERO } from '../shared/constants'; @@ -28,15 +29,24 @@ export function useTransactionGasFeeEstimate( transactionMeta.dappSuggestedGasFees?.maxPriorityFeePerGas || transactionMeta.txParams?.maxPriorityFeePerGas || HEX_ZERO; + const maxFeePerGas = + transactionMeta.dappSuggestedGasFees?.maxFeePerGas || + transactionMeta.txParams?.maxFeePerGas || + HEX_ZERO; let gasEstimate: Hex; if (supportsEIP1559) { // Minimum Total Fee = (estimatedBaseFee + maxPriorityFeePerGas) * gasLimit - const minimumFeePerGas = addHexes( + let minimumFeePerGas = addHexes( estimatedBaseFee || HEX_ZERO, maxPriorityFeePerGas, ); + // `minimumFeePerGas` should never be higher than the `maxFeePerGas` + if (new Numeric(minimumFeePerGas, 16).greaterThan(maxFeePerGas, 16)) { + minimumFeePerGas = maxFeePerGas; + } + gasEstimate = multiplyHexes(minimumFeePerGas as Hex, gasLimit as Hex); } else { gasEstimate = multiplyHexes(gasPrice as Hex, gasLimit as Hex); diff --git a/ui/pages/swaps/prepare-swap-page/index.scss b/ui/pages/swaps/prepare-swap-page/index.scss index 60e24c6cdbce..b443006330d3 100644 --- a/ui/pages/swaps/prepare-swap-page/index.scss +++ b/ui/pages/swaps/prepare-swap-page/index.scss @@ -263,7 +263,7 @@ } &__exchange-rate-display { - color: var(--color-text-alternative); + width: auto !important; } } diff --git a/ui/store/actions.test.js b/ui/store/actions.test.js index d86ea20f845c..22e8db2fa281 100644 --- a/ui/store/actions.test.js +++ b/ui/store/actions.test.js @@ -2258,7 +2258,7 @@ describe('Actions', () => { const fetchAndUpdateMetamaskNotificationsStub = sinon .stub() - .callsFake((cb) => cb()); + .callsFake((_, cb) => cb()); const forceUpdateMetamaskStateStub = sinon.stub().callsFake((cb) => cb()); background.getApi.returns({ @@ -2280,7 +2280,7 @@ describe('Actions', () => { const fetchAndUpdateMetamaskNotificationsStub = sinon .stub() - .callsFake((cb) => cb(error)); + .callsFake((_, cb) => cb(error)); const forceUpdateMetamaskStateStub = sinon .stub() .callsFake((cb) => cb(error)); diff --git a/ui/store/actions.ts b/ui/store/actions.ts index 91e4530035b5..09f819711fcd 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -5423,22 +5423,20 @@ export function updateOnChainTriggersByAccount( /** * Fetches and updates MetaMask notifications. * - * This function sends a request to the background script to fetch the latest notifications and update the state accordingly. - * Upon success, it dispatches an action with type `FETCH_AND_UPDATE_METAMASK_NOTIFICATIONS` to update the Redux state. + * This function sends a request to the background script to fetch the latest notifications. * If the operation encounters an error, it logs the error message and rethrows the error to ensure it is handled appropriately. * + * @param previewToken - Optional preview token for fetching draft feature announcements. * @returns A thunk action that, when dispatched, attempts to fetch and update MetaMask notifications. */ -export function fetchAndUpdateMetamaskNotifications(): ThunkAction< - void, - MetaMaskReduxState, - unknown, - AnyAction -> { +export function fetchAndUpdateMetamaskNotifications( + previewToken?: string, +): ThunkAction { return async () => { try { const response = await submitRequestToBackground( 'fetchAndUpdateMetamaskNotifications', + [previewToken], ); return response; } catch (error) { diff --git a/yarn.lock b/yarn.lock index 01eea754a391..0674403766f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4172,20 +4172,6 @@ __metadata: languageName: node linkType: hard -"@keystonehq/metamask-airgapped-keyring@npm:^0.13.1": - version: 0.13.1 - resolution: "@keystonehq/metamask-airgapped-keyring@npm:0.13.1" - dependencies: - "@ethereumjs/tx": "npm:^4.0.2" - "@keystonehq/base-eth-keyring": "npm:^0.14.1" - "@keystonehq/bc-ur-registry-eth": "npm:^0.19.1" - "@metamask/obs-store": "npm:^7.0.0" - rlp: "npm:^2.2.6" - uuid: "npm:^8.3.2" - checksum: 10/a12870b4527ae91cbad1995700f0710188c6fd9d2c6c2d9b398c25d96c4267fa4812e075a117c05c5edd9f6ada2c525562b5a6df3a0881c938900ff0c88791ee - languageName: node - linkType: hard - "@keystonehq/metamask-airgapped-keyring@npm:^0.14.1": version: 0.14.1 resolution: "@keystonehq/metamask-airgapped-keyring@npm:0.14.1" @@ -5838,16 +5824,6 @@ __metadata: languageName: node linkType: hard -"@metamask/obs-store@npm:^7.0.0": - version: 7.0.0 - resolution: "@metamask/obs-store@npm:7.0.0" - dependencies: - "@metamask/safe-event-emitter": "npm:^2.0.0" - through2: "npm:^2.0.3" - checksum: 10/e1497140384de0ac689adbe7286df43e843c5d73fd8ba7080af2faab3de73e823b46b8214be1c839d9e9e5f86fb40df50a26e93bae936329daeaedae5e523323 - languageName: node - linkType: hard - "@metamask/obs-store@npm:^9.0.0": version: 9.0.0 resolution: "@metamask/obs-store@npm:9.0.0" @@ -6131,13 +6107,6 @@ __metadata: languageName: node linkType: hard -"@metamask/safe-event-emitter@npm:^2.0.0": - version: 2.0.0 - resolution: "@metamask/safe-event-emitter@npm:2.0.0" - checksum: 10/3e4f00c64aa1ddf9b9ae5c2337fb8cee359b6c481ded0ec21ef70610960c51cdcc4a9b569de334dcd7cb1fe445cafd298360907c1e211e244c5990b55246f350 - languageName: node - linkType: hard - "@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" @@ -25916,7 +25885,7 @@ __metadata: "@fortawesome/fontawesome-free": "npm:^5.13.0" "@jest/globals": "npm:^29.7.0" "@keystonehq/bc-ur-registry-eth": "npm:^0.19.1" - "@keystonehq/metamask-airgapped-keyring": "npm:^0.13.1" + "@keystonehq/metamask-airgapped-keyring": "npm:^0.14.1" "@lavamoat/allow-scripts": "npm:^3.0.4" "@lavamoat/lavadome-core": "npm:0.0.10" "@lavamoat/lavadome-react": "npm:0.0.17"