mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Merge remote-tracking branch 'origin/master' into Version-v10.31.0
This commit is contained in:
commit
301c2e1beb
20
CHANGELOG.md
20
CHANGELOG.md
@ -33,6 +33,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- [FLASK] Fix overflowing notification content ([#18881](https://github.com/MetaMask/metamask-extension/pull/18881))
|
||||
- [FLASK] Fix missing icon for webassembly endowment ([#18781](https://github.com/MetaMask/metamask-extension/pull/18781))
|
||||
- [FLASK] Fix text selection bug in snap ui ([#18719](https://github.com/MetaMask/metamask-extension/pull/18719))
|
||||
## [10.30.4]
|
||||
### Fixed
|
||||
- Fix error upon submitting multiple requests that require approval ([#19050](https://github.com/MetaMask/metamask-extension/pull/19050))
|
||||
- The affected requests were `eth_sendTransaction`, `wallet_watchAsset`, `eth_getEncryptionPublicKey`, and `eth_decrypt`
|
||||
|
||||
## [10.30.3]
|
||||
### Fixed
|
||||
- Restore support for chains that return hex or number responses to `net_version` ([#19156](https://github.com/MetaMask/metamask-extension/pull/19156))
|
||||
|
||||
## [10.30.2]
|
||||
### Changed
|
||||
- Improve `eth_signTypedData_v4` validation ([#19110](https://github.com/MetaMask/metamask-extension/pull/19110))
|
||||
|
||||
### Fixed
|
||||
- Fix crash when confirming an approval where the `maxPriorityFeePerGas` is zero ([#19102](https://github.com/MetaMask/metamask-extension/pull/19102))
|
||||
|
||||
## [10.30.1]
|
||||
### Fixed
|
||||
@ -3740,7 +3755,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added the ability to restore accounts from seed words.
|
||||
|
||||
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.31.0...HEAD
|
||||
[10.31.0]: https://github.com/MetaMask/metamask-extension/compare/v10.30.1...v10.31.0
|
||||
[10.31.0]: https://github.com/MetaMask/metamask-extension/compare/v10.30.4...v10.31.0
|
||||
[10.30.4]: https://github.com/MetaMask/metamask-extension/compare/v10.30.3...v10.30.4
|
||||
[10.30.3]: https://github.com/MetaMask/metamask-extension/compare/v10.30.2...v10.30.3
|
||||
[10.30.2]: https://github.com/MetaMask/metamask-extension/compare/v10.30.1...v10.30.2
|
||||
[10.30.1]: https://github.com/MetaMask/metamask-extension/compare/v10.30.0...v10.30.1
|
||||
[10.30.0]: https://github.com/MetaMask/metamask-extension/compare/v10.29.0...v10.30.0
|
||||
[10.29.0]: https://github.com/MetaMask/metamask-extension/compare/v10.28.3...v10.29.0
|
||||
|
@ -10,10 +10,11 @@ import {
|
||||
import EthQuery from 'eth-query';
|
||||
import { RestrictedControllerMessenger } from '@metamask/base-controller';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { Hex, isPlainObject } from '@metamask/utils';
|
||||
import { Hex, isPlainObject, isStrictHexString } from '@metamask/utils';
|
||||
import { errorCodes } from 'eth-rpc-errors';
|
||||
import { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
|
||||
import { PollingBlockTracker } from 'eth-block-tracker';
|
||||
import { hexToDecimal } from '../../../../shared/modules/conversion.utils';
|
||||
import {
|
||||
INFURA_PROVIDER_TYPES,
|
||||
INFURA_BLOCKED_KEY,
|
||||
@ -301,16 +302,22 @@ function isErrorWithCode(error: unknown): error is { code: string | number } {
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given value is a network ID, i.e., that it is a decimal
|
||||
* number represented as a string.
|
||||
* Convert the given value into a valid network ID. The ID is accepted
|
||||
* as either a number, a decimal string, or a 0x-prefixed hex string.
|
||||
*
|
||||
* @param value - The value to check.
|
||||
* @param value - The network ID to convert, in an unknown format.
|
||||
* @returns A valid network ID (as a decimal string)
|
||||
* @throws If the given value cannot be safely parsed.
|
||||
*/
|
||||
function assertNetworkId(value: any): asserts value is NetworkId {
|
||||
assert(
|
||||
/^\d+$/u.test(value) && !Number.isNaN(Number(value)),
|
||||
'value is not a number',
|
||||
);
|
||||
function convertNetworkId(value: unknown): NetworkId {
|
||||
if (typeof value === 'number' && !Number.isNaN(value)) {
|
||||
return `${value}`;
|
||||
} else if (isStrictHexString(value)) {
|
||||
return hexToDecimal(value) as NetworkId;
|
||||
} else if (typeof value === 'string' && /^\d+$/u.test(value)) {
|
||||
return value as NetworkId;
|
||||
}
|
||||
throw new Error(`Cannot parse as a valid network ID: '${value}'`);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -619,8 +626,7 @@ export class NetworkController extends EventEmitter {
|
||||
this.#determineEIP1559Compatibility(provider),
|
||||
]);
|
||||
const possibleNetworkId = results[0];
|
||||
assertNetworkId(possibleNetworkId);
|
||||
networkId = possibleNetworkId;
|
||||
networkId = convertNetworkId(possibleNetworkId);
|
||||
supportsEIP1559 = results[1];
|
||||
networkStatus = NetworkStatus.Available;
|
||||
} catch (error) {
|
||||
|
@ -63,6 +63,7 @@ import {
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
|
||||
import { SignatureController } from '@metamask/signature-controller';
|
||||
import { ApprovalType } from '@metamask/controller-utils';
|
||||
import {
|
||||
AssetType,
|
||||
TransactionStatus,
|
||||
@ -94,7 +95,6 @@ import { UI_NOTIFICATIONS } from '../../shared/notifications';
|
||||
import { MILLISECOND, SECOND } from '../../shared/constants/time';
|
||||
import {
|
||||
ORIGIN_METAMASK,
|
||||
MESSAGE_TYPE,
|
||||
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
||||
SNAP_DIALOG_TYPES,
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
@ -256,9 +256,13 @@ export default class MetamaskController extends EventEmitter {
|
||||
}),
|
||||
showApprovalRequest: opts.showUserConfirmation,
|
||||
typesExcludedFromRateLimiting: [
|
||||
MESSAGE_TYPE.ETH_SIGN,
|
||||
MESSAGE_TYPE.PERSONAL_SIGN,
|
||||
MESSAGE_TYPE.ETH_SIGN_TYPED_DATA,
|
||||
ApprovalType.EthSign,
|
||||
ApprovalType.PersonalSign,
|
||||
ApprovalType.EthSignTypedData,
|
||||
ApprovalType.Transaction,
|
||||
ApprovalType.WatchAsset,
|
||||
ApprovalType.EthGetEncryptionPublicKey,
|
||||
ApprovalType.EthDecrypt,
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -1653,13 +1653,25 @@
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager": true,
|
||||
"@metamask/signature-controller>@metamask/message-manager": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-rpc-errors": true,
|
||||
"ethereumjs-util": true
|
||||
}
|
||||
},
|
||||
"@metamask/signature-controller>@metamask/message-manager": {
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager>jsonschema": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-sig-util": true,
|
||||
"ethereumjs-util": true,
|
||||
"uuid": true
|
||||
}
|
||||
},
|
||||
"@metamask/smart-transactions-controller": {
|
||||
"globals": {
|
||||
"URLSearchParams": true,
|
||||
|
@ -1829,13 +1829,25 @@
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager": true,
|
||||
"@metamask/signature-controller>@metamask/message-manager": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-rpc-errors": true,
|
||||
"ethereumjs-util": true
|
||||
}
|
||||
},
|
||||
"@metamask/signature-controller>@metamask/message-manager": {
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager>jsonschema": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-sig-util": true,
|
||||
"ethereumjs-util": true,
|
||||
"uuid": true
|
||||
}
|
||||
},
|
||||
"@metamask/smart-transactions-controller": {
|
||||
"globals": {
|
||||
"URLSearchParams": true,
|
||||
|
@ -1829,13 +1829,25 @@
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager": true,
|
||||
"@metamask/signature-controller>@metamask/message-manager": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-rpc-errors": true,
|
||||
"ethereumjs-util": true
|
||||
}
|
||||
},
|
||||
"@metamask/signature-controller>@metamask/message-manager": {
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager>jsonschema": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-sig-util": true,
|
||||
"ethereumjs-util": true,
|
||||
"uuid": true
|
||||
}
|
||||
},
|
||||
"@metamask/smart-transactions-controller": {
|
||||
"globals": {
|
||||
"URLSearchParams": true,
|
||||
|
@ -1653,13 +1653,25 @@
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager": true,
|
||||
"@metamask/signature-controller>@metamask/message-manager": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-rpc-errors": true,
|
||||
"ethereumjs-util": true
|
||||
}
|
||||
},
|
||||
"@metamask/signature-controller>@metamask/message-manager": {
|
||||
"packages": {
|
||||
"@metamask/base-controller": true,
|
||||
"@metamask/controller-utils": true,
|
||||
"@metamask/message-manager>jsonschema": true,
|
||||
"browserify>buffer": true,
|
||||
"browserify>events": true,
|
||||
"eth-sig-util": true,
|
||||
"ethereumjs-util": true,
|
||||
"uuid": true
|
||||
}
|
||||
},
|
||||
"@metamask/smart-transactions-controller": {
|
||||
"globals": {
|
||||
"URLSearchParams": true,
|
||||
|
@ -248,7 +248,7 @@
|
||||
"@metamask/jazzicon": "^2.0.0",
|
||||
"@metamask/key-tree": "^7.0.0",
|
||||
"@metamask/logo": "^3.1.1",
|
||||
"@metamask/message-manager": "^4.0.0",
|
||||
"@metamask/message-manager": "^5.0.0",
|
||||
"@metamask/metamask-eth-abis": "^3.0.0",
|
||||
"@metamask/notification-controller": "^2.0.0",
|
||||
"@metamask/obs-store": "^8.1.0",
|
||||
|
@ -50,6 +50,16 @@ const GasDetailsItem = ({ userAcknowledgedGasMissing = false }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const maxPriorityFeePerGasToRender = (
|
||||
maxPriorityFeePerGas ??
|
||||
hexWEIToDecGWEI(transactionData.txParams?.maxPriorityFeePerGas ?? '0x0')
|
||||
).toString();
|
||||
|
||||
const maxFeePerGasToRender = (
|
||||
maxFeePerGas ??
|
||||
hexWEIToDecGWEI(transactionData.txParams?.maxFeePerGas ?? '0x0')
|
||||
).toString();
|
||||
|
||||
return (
|
||||
<TransactionDetailItem
|
||||
key="gas-details-item"
|
||||
@ -113,14 +123,8 @@ const GasDetailsItem = ({ userAcknowledgedGasMissing = false }) => {
|
||||
}
|
||||
subTitle={
|
||||
<GasTiming
|
||||
maxPriorityFeePerGas={(
|
||||
maxPriorityFeePerGas ||
|
||||
hexWEIToDecGWEI(transactionData.txParams.maxPriorityFeePerGas)
|
||||
).toString()}
|
||||
maxFeePerGas={(
|
||||
maxFeePerGas ||
|
||||
hexWEIToDecGWEI(transactionData.txParams.maxFeePerGas)
|
||||
).toString()}
|
||||
maxPriorityFeePerGas={maxPriorityFeePerGasToRender}
|
||||
maxFeePerGas={maxFeePerGasToRender}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
@ -110,4 +110,43 @@ describe('GasDetailsItem', () => {
|
||||
expect(screen.queryAllByText('ETH').length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should render gas fee details if maxPriorityFeePerGas is 0', async () => {
|
||||
render({
|
||||
contextProps: {
|
||||
transaction: {
|
||||
txParams: {
|
||||
gas: '0x5208',
|
||||
maxFeePerGas: '0x59682f10',
|
||||
maxPriorityFeePerGas: '0',
|
||||
},
|
||||
simulationFails: false,
|
||||
userFeeLevel: 'low',
|
||||
},
|
||||
},
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(screen.queryAllByTitle('0.0000315 ETH').length).toBeGreaterThan(0);
|
||||
expect(screen.queryAllByText('ETH').length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should render gas fee details if maxPriorityFeePerGas is undefined', async () => {
|
||||
render({
|
||||
contextProps: {
|
||||
transaction: {
|
||||
txParams: {
|
||||
gas: '0x5208',
|
||||
maxFeePerGas: '0x59682f10',
|
||||
},
|
||||
simulationFails: false,
|
||||
userFeeLevel: 'low',
|
||||
},
|
||||
},
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(screen.queryAllByTitle('0.0000315 ETH').length).toBeGreaterThan(0);
|
||||
expect(screen.queryAllByText('ETH').length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
17
yarn.lock
17
yarn.lock
@ -4060,6 +4060,21 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@metamask/message-manager@npm:^5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "@metamask/message-manager@npm:5.0.0"
|
||||
dependencies:
|
||||
"@metamask/base-controller": ^2.0.0
|
||||
"@metamask/controller-utils": ^3.4.0
|
||||
"@types/uuid": ^8.3.0
|
||||
eth-sig-util: ^3.0.0
|
||||
ethereumjs-util: ^7.0.10
|
||||
jsonschema: ^1.2.4
|
||||
uuid: ^8.3.2
|
||||
checksum: 078c7eeca03975c3a899dcaa7485ce7aaff6d97b53c2a8e8563ec4e17791b836914fbc0f57a64cbf263be231609e0ffc77eabbe9a98fdcc1240af09a733ba574
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@metamask/metamask-eth-abis@npm:3.0.0, @metamask/metamask-eth-abis@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "@metamask/metamask-eth-abis@npm:3.0.0"
|
||||
@ -24006,7 +24021,7 @@ __metadata:
|
||||
"@metamask/jazzicon": ^2.0.0
|
||||
"@metamask/key-tree": ^7.0.0
|
||||
"@metamask/logo": ^3.1.1
|
||||
"@metamask/message-manager": ^4.0.0
|
||||
"@metamask/message-manager": ^5.0.0
|
||||
"@metamask/metamask-eth-abis": ^3.0.0
|
||||
"@metamask/notification-controller": ^2.0.0
|
||||
"@metamask/obs-store": ^8.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user