diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e07a61d1507..3042b992e912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - fix(swaps): set default slippage when source or destination token is not stablecoin ([#14730](https://github.com/MetaMask/metamask-mobile/pull/14730)) - fix(bridge): fix transaction history for EVM and Solana bridge transactions ([#14759](https://github.com/MetaMask/metamask-mobile/pull/14759)) - fix(bridge): change networks properly when user switches between source and destination tokens ([#14812](https://github.com/MetaMask/metamask-mobile/pull/14812)) +- fix(bridge): fix(bridge): update quote details card toggle to handle same chain swaps and improve slippage button layout ([#15153](https://github.com/MetaMask/metamask-mobile/pull/15153)) +- fix(confirmations): fix the send crash when user puts unexpected address into recipient input([#15308](https://github.com/MetaMask/metamask-mobile/pull/15308)) + +## [7.45.2] + +### Fixed + +- fix: 15108 create a wrapper for toChecksumAddress to prevent app crash ([#15202](https://github.com/MetaMask/metamask-mobile/pull/15202)) +- chore(runway): cherry-pick fix: base-x audit issue ([#15216](https://github.com/MetaMask/metamask-mobile/pull/15216)) ## [7.45.1] diff --git a/app/components/Views/confirmations/legacy/SendFlow/SendTo/__snapshots__/index.test.tsx.snap b/app/components/Views/confirmations/legacy/SendFlow/SendTo/__snapshots__/index.test.tsx.snap index 32429ab9a5f0..aea80aaf6bbb 100644 --- a/app/components/Views/confirmations/legacy/SendFlow/SendTo/__snapshots__/index.test.tsx.snap +++ b/app/components/Views/confirmations/legacy/SendFlow/SendTo/__snapshots__/index.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`SendTo Component should render 1`] = ` +exports[`SendTo Component render matches snapshot 1`] = ` @@ -381,7 +381,7 @@ class SendFlow extends PureComponent { const networkAddressBook = addressBook[globalChainId] || {}; - const checksummedAddress = safeToChecksumAddress(toAccount); + const checksummedAddress = this.safeChecksumAddress(toAccount); const matchingAccount = internalAccounts.find((account) => toLowerCaseEquals(account.address, checksummedAddress), ); @@ -481,6 +481,14 @@ class SendFlow extends PureComponent { this.setState({ showAmbiguousAcountWarning: false }); }; + safeChecksumAddress = (address) => { + try { + return toChecksumAddress(address); + } catch (error) { + return address; + } + }; + render = () => { const { ticker, addressBook, globalChainId } = this.props; const { @@ -499,7 +507,7 @@ class SendFlow extends PureComponent { const colors = this.context.colors || mockTheme.colors; const styles = createStyles(colors); - const checksummedAddress = toAccount && safeToChecksumAddress(toAccount); + const checksummedAddress = this.safeChecksumAddress(toAccount); const existingAddressName = this.getAddressNameFromBookOrInternalAccounts( toEnsAddressResolved || toAccount, ); diff --git a/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.test.tsx b/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.test.tsx index 692181f28e1c..88c7c39b6985 100644 --- a/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.test.tsx +++ b/app/components/Views/confirmations/legacy/SendFlow/SendTo/index.test.tsx @@ -8,6 +8,7 @@ import SendTo from './index'; import { ThemeContext, mockTheme } from '../../../../../../util/theme'; import initialRootState from '../../../../../../util/test/initial-root-state'; import { validateAddressOrENS } from '../../../../../../util/address'; +import { SendViewSelectorsIDs } from '../../../../../../../e2e/selectors/SendFlow/SendView.selectors'; jest.mock('@react-navigation/native', () => { const actualNav = jest.requireActual('@react-navigation/native'); @@ -54,7 +55,7 @@ describe('SendTo Component', () => { ); }); - it('should render', () => { + it('render matches snapshot', () => { const wrapper = render( @@ -65,7 +66,7 @@ describe('SendTo Component', () => { expect(wrapper).toMatchSnapshot(); }); - it('should navigate to Amount screen', () => { + it('navigates to Amount screen', () => { const MOCK_TARGET_ADDRESS = '0x0000000000000000000000000000000000000000'; const { navigate } = navigationPropMock; const routeProps = { @@ -86,4 +87,23 @@ describe('SendTo Component', () => { fireEvent.press(screen.getByText('Next')); expect(navigate).toHaveBeenCalledWith('Amount'); }); + + it('shows the warning message when the target address is invalid', () => { + const { getByText, getByTestId } = render( + + + + + , + ); + + const toInput = getByTestId(SendViewSelectorsIDs.ADDRESS_INPUT); + fireEvent.changeText(toInput, 'invalid address'); + + const expectedWarningMessage = getByText( + 'No address has been set for this name.', + ); + + expect(expectedWarningMessage).toBeOnTheScreen(); + }); });