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: add methods to support ERC-4337 accounts #3602

Merged
merged 16 commits into from
Jan 22, 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
2 changes: 1 addition & 1 deletion jest.config.packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
coverageProvider: 'babel',

// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text', 'html', 'json-summary'],
coverageReporters: ['text', 'html', 'json-summary', 'lcov'],

// An object that configures minimum threshold enforcement for coverage results
// (Each package defines this separately)
Expand Down
4 changes: 2 additions & 2 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
},
"dependencies": {
"@metamask/base-controller": "^4.1.0",
"@metamask/eth-snap-keyring": "^2.0.0",
"@metamask/keyring-api": "^1.1.0",
"@metamask/eth-snap-keyring": "^2.1.1",
"@metamask/keyring-api": "^2.0.0",
"@metamask/snaps-sdk": "^1.3.1",
"@metamask/snaps-utils": "^5.1.1",
"@metamask/utils": "^8.3.0",
Expand Down
19 changes: 14 additions & 5 deletions packages/accounts-controller/src/AccountsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@ const mockGetKeyringForAccount = jest.fn();
const mockGetKeyringByType = jest.fn();
const mockGetAccounts = jest.fn();

const EOA_METHODS = [
EthMethod.PersonalSign,
EthMethod.Sign,
EthMethod.SignTransaction,
EthMethod.SignTypedDataV1,
EthMethod.SignTypedDataV3,
EthMethod.SignTypedDataV4,
] as const;

const mockAccount: InternalAccount = {
id: 'mock-id',
address: '0x123',
options: {},
methods: [...Object.values(EthMethod)],
methods: [...EOA_METHODS],
type: EthAccountType.Eoa,
metadata: {
name: 'Account 1',
Expand All @@ -45,7 +54,7 @@ const mockAccount2: InternalAccount = {
id: 'mock-id2',
address: '0x1234',
options: {},
methods: [...Object.values(EthMethod)],
methods: [...EOA_METHODS],
type: EthAccountType.Eoa,
metadata: {
name: 'Account 2',
Expand All @@ -58,7 +67,7 @@ const mockAccount3: InternalAccount = {
id: 'mock-id3',
address: '0x3333',
options: {},
methods: [...Object.values(EthMethod)],
methods: [...EOA_METHODS],
type: EthAccountType.Eoa,
metadata: {
name: '',
Expand All @@ -76,7 +85,7 @@ const mockAccount4: InternalAccount = {
id: 'mock-id4',
address: '0x4444',
options: {},
methods: [...Object.values(EthMethod)],
methods: [...EOA_METHODS],
type: EthAccountType.Eoa,
metadata: {
name: 'Custom Name',
Expand Down Expand Up @@ -121,7 +130,7 @@ function createExpectedInternalAccount({
id,
address,
options: {},
methods: [...Object.values(EthMethod)],
methods: [...EOA_METHODS],
type: EthAccountType.Eoa,
metadata: {
name,
Expand Down
12 changes: 10 additions & 2 deletions packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
"dependencies": {
"@keystonehq/metamask-airgapped-keyring": "^0.13.1",
"@metamask/base-controller": "^4.1.0",
"@metamask/eth-keyring-controller": "^15.1.0",
"@metamask/eth-keyring-controller": "^17.0.0",
"@metamask/keyring-api": "^2.0.0",
"@metamask/message-manager": "^7.3.7",
"@metamask/preferences-controller": "^6.0.0",
"@metamask/utils": "^8.3.0",
"async-mutex": "^0.2.6",
"ethereumjs-util": "^7.0.10",
Expand All @@ -45,9 +47,9 @@
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@keystonehq/bc-ur-registry-eth": "^0.9.0",
"@lavamoat/allow-scripts": "^2.3.1",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eth-sig-util": "^7.0.1",
"@metamask/preferences-controller": "^6.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @danroc, why was this moved from dev dependenices to dependencies? I'm asking because this conflicts with one of my PRs, where this is being removed as a dependency completely.

"@metamask/scure-bip39": "^2.1.1",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
Expand All @@ -69,5 +71,11 @@
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"lavamoat": {
"allowScripts": {
"ethereumjs-util>ethereum-cryptography>keccak": false,
"ethereumjs-util>ethereum-cryptography>secp256k1": false
}
}
}
Loading
Loading