Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Eth snap keyring #10829

Merged
merged 8 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ describe('SnapPermissions', () => {
const snapGetBip44EntropyTitle = (protocol: string) =>
`Control your ${protocol} accounts and assets`;
const snapGetEntropyTitle = 'Derive arbitrary keys unique to this snap';
const endowmentKeyringTitle = 'endowment:keyring';
const endowmentKeyringTitle =
'Allow requests for adding and controlling Ethereum accounts';
const endowmentWebassemblyTitle = 'Support for WebAssembly';
const endowmentEthereumProviderTitle = 'Access the Ethereum provider';
const endowmentUnknownTitle = 'Unknown permission';
Expand All @@ -42,6 +43,7 @@ describe('SnapPermissions', () => {
'See the origins of websites that suggest transactions';
const endowmentExtendRuntimeTitle = 'Extend runtime';
const snapDialogTitle = 'Display custom dialogs';
const snapManageAccountsTitle = 'Add and control Ethereum accounts';

const mockCoinTypes = [
{ coinType: 0 }, // Bitcoin
Expand Down Expand Up @@ -399,6 +401,13 @@ describe('SnapPermissions', () => {
caveats: null,
date: mockDate2,
},
snap_manageAccounts: {
caveats: null,
date: mockDate2,
id: '_jJdNdRnD5pXD728ngmHY',
invoker: 'npm:@metamask/snap-simple-keyring-snap',
parentCapability: 'snap_manageAccounts',
},
};

const { getAllByTestId } = render(
Expand All @@ -409,7 +418,7 @@ describe('SnapPermissions', () => {
const permissionCellTitles = getAllByTestId(SNAP_PERMISSIONS_TITLE);
const permissionCellDates = getAllByTestId(SNAP_PERMISSIONS_DATE);

expect(permissionCells.length).toBe(21);
expect(permissionCells.length).toBe(22);
expect(permissionCellTitles[0].props.children).toBe(longRunningTitle);
expect(permissionCellDates[0].props.children).toBe(
'Approved on May 24 at 5:35 pm',
Expand Down Expand Up @@ -510,6 +519,10 @@ describe('SnapPermissions', () => {
expect(permissionCellDates[20].props.children).toBe(
'Approved on Jun 6 at 4:02 pm',
);
expect(permissionCellTitles[21].props.children).toBe(snapManageAccountsTitle);
expect(permissionCellDates[21].props.children).toBe(
'Approved on Jun 6 at 4:02 pm',
);
});

it('renders correct installed date', () => {
Expand Down
2 changes: 1 addition & 1 deletion app/core/BackgroundBridge/BackgroundBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ export class BackgroundBridge extends EventEmitter {
snapMethodMiddlewareBuilder(
Engine.context,
Engine.controllerMessenger,
origin,
this.url,
owencraston marked this conversation as resolved.
Show resolved Hide resolved
// We assume that origins connecting through the BackgroundBridge are websites
SubjectType.Website,
),
Expand Down
Loading
Loading