1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge branch 'master' into Version-v10.24.0

This commit is contained in:
seaona 2022-12-19 11:06:54 +01:00
commit 8c0678eb99
6 changed files with 21 additions and 9 deletions

View File

@ -65,6 +65,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [FLASK] Clear notification state on restore ([#16503](https://github.com/MetaMask/metamask-extension/pull/16503))
- [FLASK] Fix a crash that happens after snap install ([#16526](https://github.com/MetaMask/metamask-extension/pull/16526))
- [FLASK] Fix usage of wrong `ethereum` global for `ethereum` endowment ([#16932](https://github.com/MetaMask/metamask-extension/pull/16932))
## [10.23.1]
### Fixed
- Fix incorrectly displaying "New Contract" instead of the recipient address, on the header from the Confirmation page ([#16961](https://github.com/MetaMask/metamask-extension/pull/16961))
## [10.23.0]
### Added
@ -3398,6 +3401,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.24.0...HEAD
[10.24.0]: https://github.com/MetaMask/metamask-extension/compare/v10.23.0...v10.24.0
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.23.1...HEAD
[10.23.1]: https://github.com/MetaMask/metamask-extension/compare/v10.23.0...v10.23.1
[10.23.0]: https://github.com/MetaMask/metamask-extension/compare/v10.22.3...v10.23.0
[10.22.3]: https://github.com/MetaMask/metamask-extension/compare/v10.22.2...v10.22.3
[10.22.2]: https://github.com/MetaMask/metamask-extension/compare/v10.22.1...v10.22.2

View File

@ -135,7 +135,7 @@ describe('Send ETH non-contract address with data that matches ERC20 transfer da
await driver.clickElement({ text: 'Next', tag: 'button' });
await driver.clickElement({ text: 'New contract' });
await driver.clickElement({ text: '0xc42...cd28' });
const recipientAddress = await driver.findElements({
text: '0xc427D562164062a23a5cFf596A4a3208e72Acd28',

View File

@ -100,7 +100,7 @@ describe('Confirm Page Container Container Test', () => {
expect(senderRecipient).toBeInTheDocument();
});
it('should render recipient as address', () => {
const recipientName = screen.queryByText('New contract');
const recipientName = screen.queryByText(shortenAddress(props.toAddress));
expect(recipientName).toBeInTheDocument();
});
@ -126,7 +126,7 @@ describe('Confirm Page Container Container Test', () => {
describe('Contact/AddressBook name should appear in recipient header', () => {
it('should not show add to address dialog if recipient is in contact list and should display contact name', () => {
const addressBookName = 'New contract';
const addressBookName = 'test save name';
const addressBook = {
'0x5': {

View File

@ -71,6 +71,7 @@ export default class ConfirmPageContainer extends Component {
toMetadataName: PropTypes.string,
toEns: PropTypes.string,
toNickname: PropTypes.string,
recipientIsOwnedAccount: PropTypes.bool,
// Content
contentComponent: PropTypes.node,
errorKey: PropTypes.string,
@ -143,6 +144,7 @@ export default class ConfirmPageContainer extends Component {
toMetadataName,
toEns,
toNickname,
recipientIsOwnedAccount,
toAddress,
disabled,
errorKey,
@ -261,6 +263,7 @@ export default class ConfirmPageContainer extends Component {
recipientAddress={toAddress}
recipientEns={toEns}
recipientNickname={toNickname}
recipientIsOwnedAccount={recipientIsOwnedAccount}
/>
)}
</ConfirmPageContainerHeader>

View File

@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import {
getAccountsWithLabels,
getAddressBookEntry,
getIsBuyableChain,
getNetworkIdentifier,
@ -19,7 +18,8 @@ function mapStateToProps(state, ownProps) {
const defaultToken = getSwapsDefaultToken(state);
const accountBalance = defaultToken.string;
const identities = getMetaMaskIdentities(state);
const toName = getAccountName(identities, to);
const ownedAccountName = getAccountName(identities, to);
const toName = ownedAccountName || contact?.name;
const toMetadataName = getMetadataContractName(state, to);
return {
@ -27,9 +27,7 @@ function mapStateToProps(state, ownProps) {
contact,
toName,
toMetadataName,
isOwnedAccount: getAccountsWithLabels(state)
.map((accountWithLabel) => accountWithLabel.address)
.includes(to),
recipientIsOwnedAccount: Boolean(ownedAccountName),
to,
networkIdentifier,
accountBalance,

View File

@ -104,6 +104,7 @@ export function RecipientWithAddress({
recipientEns,
recipientName,
recipientMetadataName,
recipientIsOwnedAccount,
}) {
const t = useI18nContext();
const [showNicknamePopovers, setShowNicknamePopovers] = useState(false);
@ -127,7 +128,7 @@ export function RecipientWithAddress({
<div
className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address"
onClick={() => {
if (recipientName) {
if (recipientIsOwnedAccount) {
setAddressCopied(true);
copyToClipboard(checksummedRecipientAddress);
} else {
@ -163,6 +164,7 @@ export function RecipientWithAddress({
recipientNickname ||
recipientMetadataName ||
recipientEns ||
shortenAddress(checksummedRecipientAddress) ||
t('newContract')}
</div>
</Tooltip>
@ -185,6 +187,7 @@ RecipientWithAddress.propTypes = {
recipientNickname: PropTypes.string,
addressOnly: PropTypes.bool,
onRecipientClick: PropTypes.func,
recipientIsOwnedAccount: PropTypes.bool,
};
function Arrow({ variant }) {
@ -218,6 +221,7 @@ export default function SenderToRecipient({
recipientAddress,
variant,
warnUserOnAccountMismatch,
recipientIsOwnedAccount,
}) {
const t = useI18nContext();
const checksummedSenderAddress = toChecksumHexAddress(senderAddress);
@ -246,6 +250,7 @@ export default function SenderToRecipient({
recipientEns={recipientEns}
recipientName={recipientName}
recipientMetadataName={recipientMetadataName}
recipientIsOwnedAccount={recipientIsOwnedAccount}
/>
) : (
<div className="sender-to-recipient__party sender-to-recipient__party--recipient">
@ -275,4 +280,5 @@ SenderToRecipient.propTypes = {
onRecipientClick: PropTypes.func,
onSenderClick: PropTypes.func,
warnUserOnAccountMismatch: PropTypes.bool,
recipientIsOwnedAccount: PropTypes.bool,
};