Skip to content

Commit 7e6b5d7

Browse files
Merge branch 'develop' into fix/use-counter-pending-transactions
2 parents 634bec5 + ed28508 commit 7e6b5d7

File tree

10 files changed

+10
-235
lines changed

10 files changed

+10
-235
lines changed

app/scripts/lib/snap-keyring/snap-keyring.test.ts

-7
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ describe('Snap Keyring Methods', () => {
171171

172172
await showAccountNameSuggestionDialog(
173173
mockSnapId,
174-
mockAccount.address,
175174
controllerMessenger,
176175
accountNameSuggestion,
177176
);
@@ -182,7 +181,6 @@ describe('Snap Keyring Methods', () => {
182181
origin: mockSnapId,
183182
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
184183
requestData: {
185-
address: mockAccount.address,
186184
snapSuggestedAccountName: accountNameSuggestion,
187185
},
188186
},
@@ -229,7 +227,6 @@ describe('Snap Keyring Methods', () => {
229227
origin: mockSnapId,
230228
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
231229
requestData: {
232-
address: mockInternalAccount.address.toLowerCase(),
233230
snapSuggestedAccountName: '',
234231
},
235232
},
@@ -294,7 +291,6 @@ describe('Snap Keyring Methods', () => {
294291
origin: mockSnapId,
295292
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
296293
requestData: {
297-
address: mockInternalAccount.address.toLowerCase(),
298294
// No user defined name
299295
snapSuggestedAccountName: '',
300296
},
@@ -355,7 +351,6 @@ describe('Snap Keyring Methods', () => {
355351
origin: mockSnapId,
356352
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
357353
requestData: {
358-
address: mockInternalAccount.address.toLowerCase(),
359354
snapSuggestedAccountName: mockNameSuggestion,
360355
},
361356
},
@@ -428,7 +423,6 @@ describe('Snap Keyring Methods', () => {
428423
origin: mockSnapId,
429424
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
430425
requestData: {
431-
address: mockInternalAccount.address.toLowerCase(),
432426
snapSuggestedAccountName: mockNameSuggestion,
433427
},
434428
},
@@ -492,7 +486,6 @@ describe('Snap Keyring Methods', () => {
492486
origin: mockSnapId,
493487
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
494488
requestData: {
495-
address: mockInternalAccount.address.toLowerCase(),
496489
snapSuggestedAccountName: mockNameSuggestion,
497490
},
498491
},

app/scripts/lib/snap-keyring/snap-keyring.ts

-4
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ export async function showAccountCreationDialog(
6565
* Show the account name suggestion confirmation dialog for a given Snap.
6666
*
6767
* @param snapId - Snap ID to show the account name suggestion dialog for.
68-
* @param address - The address of the new account.
6968
* @param controllerMessenger - The controller messenger instance.
7069
* @param accountNameSuggestion - Suggested name for the new account.
7170
* @returns The user's confirmation result.
7271
*/
7372
export async function showAccountNameSuggestionDialog(
7473
snapId: string,
75-
address: string,
7674
controllerMessenger: SnapKeyringBuilderMessenger,
7775
accountNameSuggestion: string,
7876
): Promise<{ success: boolean; name?: string }> {
@@ -83,7 +81,6 @@ export async function showAccountNameSuggestionDialog(
8381
origin: snapId,
8482
type: SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,
8583
requestData: {
86-
address,
8784
snapSuggestedAccountName: accountNameSuggestion,
8885
},
8986
},
@@ -227,7 +224,6 @@ export const snapKeyringBuilder = (
227224
const accountNameConfirmationResult =
228225
await showAccountNameSuggestionDialog(
229226
snapId,
230-
address,
231227
controllerMessenger,
232228
accountNameSuggestion,
233229
);

ui/components/multichain/create-btc-account/create-btc-account.stories.js

-15
This file was deleted.

ui/components/multichain/create-btc-account/create-btc-account.test.tsx

-120
This file was deleted.

ui/components/multichain/create-btc-account/create-btc-account.tsx

-42
This file was deleted.

ui/components/multichain/create-btc-account/index.ts

-1
This file was deleted.

ui/components/multichain/create-named-snap-account/create-named-snap-account.test.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@ import { fireEvent, renderWithProvider, waitFor } from '../../../../test/jest';
44
import configureStore from '../../../store/store';
55
import mockState from '../../../../test/data/mock-state.json';
66
import messages from '../../../../app/_locales/en/messages.json';
7-
import { createMockInternalAccount } from '../../../../test/jest/mocks';
87
import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods';
98
import {
109
CreateNamedSnapAccount,
1110
CreateNamedSnapAccountProps,
1211
} from './create-named-snap-account';
1312

14-
const mockAddress = '0x3f9658179a5c053bb2faaf7badbb95f6c9be0fa7';
15-
const mockAccount = createMockInternalAccount({
16-
address: mockAddress,
17-
name: 'New account',
18-
});
1913
const mockSnapSuggestedAccountName = 'Suggested Account Name';
2014

2115
jest.mock('../../../store/actions', () => ({
@@ -61,7 +55,6 @@ const mockSnapAccount2 = {
6155
const render = (
6256
props: CreateNamedSnapAccountProps = {
6357
onActionComplete: jest.fn().mockResolvedValue({ success: true }),
64-
address: mockAccount.address,
6558
snapSuggestedAccountName: mockSnapSuggestedAccountName,
6659
},
6760
) => {
@@ -105,7 +98,6 @@ describe('CreateNamedSnapAccount', () => {
10598
const onActionComplete = jest.fn();
10699
const { getByText, getByPlaceholderText } = render({
107100
onActionComplete,
108-
address: mockAccount.address,
109101
snapSuggestedAccountName: mockSnapSuggestedAccountName,
110102
});
111103

@@ -150,7 +142,6 @@ describe('CreateNamedSnapAccount', () => {
150142
const onActionComplete = jest.fn();
151143
const { getByText, getByPlaceholderText } = render({
152144
onActionComplete,
153-
address: mockAccount.address,
154145
});
155146

156147
fireEvent.click(getByText(messages.addAccount.message));
@@ -170,7 +161,6 @@ describe('CreateNamedSnapAccount', () => {
170161
const onActionComplete = jest.fn();
171162
const { getByText } = render({
172163
onActionComplete,
173-
address: mockAccount.address,
174164
snapSuggestedAccountName: mockSnapSuggestedAccountName,
175165
});
176166

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import React, { useCallback, useMemo } from 'react';
1+
import React, { useCallback } from 'react';
22
import { useSelector } from 'react-redux';
33
import { useHistory } from 'react-router-dom';
44
import { InternalAccount } from '@metamask/keyring-api';
55
import { KeyringTypes } from '@metamask/keyring-controller';
6-
import { CreateAccount, CreateBtcAccount } from '..';
6+
import { CreateAccount } from '..';
77
import { Box, ModalHeader } from '../../component-library';
88
import { useI18nContext } from '../../../hooks/useI18nContext';
99
import { getMostRecentOverviewPage } from '../../../ducks/history/history';
10-
import {
11-
isBtcMainnetAddress,
12-
isBtcTestnetAddress,
13-
} from '../../../../shared/lib/multichain';
1410
import { getNextAvailableAccountName } from '../../../store/actions';
1511

1612
export type CreateNamedSnapAccountProps = {
@@ -22,11 +18,6 @@ export type CreateNamedSnapAccountProps = {
2218
reject?: boolean,
2319
) => Promise<void>;
2420

25-
/**
26-
* Address of the account to create
27-
*/
28-
address: string;
29-
3021
/**
3122
* Suggested account name from the snap
3223
*/
@@ -35,17 +26,12 @@ export type CreateNamedSnapAccountProps = {
3526

3627
export const CreateNamedSnapAccount: React.FC<CreateNamedSnapAccountProps> = ({
3728
onActionComplete,
38-
address,
3929
snapSuggestedAccountName,
4030
}) => {
4131
const t = useI18nContext();
4232
const history = useHistory();
4333

4434
const mostRecentOverviewPage = useSelector(getMostRecentOverviewPage);
45-
const isBtcAccount = useMemo(
46-
() => isBtcMainnetAddress(address) || isBtcTestnetAddress(address),
47-
[address],
48-
);
4935

5036
const rejectAction = useCallback(async (completed: boolean) => {
5137
await onActionComplete({ success: completed });
@@ -81,23 +67,13 @@ export const CreateNamedSnapAccount: React.FC<CreateNamedSnapAccountProps> = ({
8167
<ModalHeader padding={4} onClose={onClose}>
8268
{t('addAccountToMetaMask')}
8369
</ModalHeader>
84-
{isBtcAccount ? (
85-
<CreateBtcAccount
86-
// onActionComplete is called when a user rejects the action
87-
// onCreateAccount will call onActionComplete if a user confirms the action
88-
onActionComplete={rejectAction}
89-
onCreateAccount={onCreateAccount}
90-
address={address}
91-
/>
92-
) : (
93-
<CreateAccount
94-
// onActionComplete is called when a user rejects the action
95-
// onCreateAccount will call onActionComplete if a user confirms the action
96-
onActionComplete={rejectAction}
97-
onCreateAccount={onCreateAccount}
98-
getNextAvailableAccountName={getNextAccountName}
99-
/>
100-
)}
70+
<CreateAccount
71+
// onActionComplete is called when a user rejects the action
72+
// onCreateAccount will call onActionComplete if a user confirms the action
73+
onActionComplete={rejectAction}
74+
onCreateAccount={onCreateAccount}
75+
getNextAvailableAccountName={getNextAccountName}
76+
/>
10177
</Box>
10278
);
10379
};

0 commit comments

Comments
 (0)