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

refactor: use new @metamask/keyring-api layout (split packages) #28861

Merged
merged 24 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f6d5942
refactor: use new accounts packages
ccharly Sep 12, 2024
cbd9f36
chore: lavamoat:auto
ccharly Dec 3, 2024
bf4405f
chore: yarn dedupe
ccharly Dec 3, 2024
de54690
chore: update resolutions
ccharly Dec 5, 2024
356eab7
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 5, 2024
0584a61
chore: update resolutions
ccharly Dec 11, 2024
0fb1493
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 11, 2024
a2b7d0b
chore: dedupe + lavamoat:auto
ccharly Dec 11, 2024
a39c3df
chore: update deps
ccharly Dec 11, 2024
6dce397
chore: lint
ccharly Dec 11, 2024
238f522
chore: update deps
ccharly Dec 11, 2024
ab65f1f
chore: remove preview builds
ccharly Dec 11, 2024
7cf8701
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 12, 2024
dfa88e1
chore: dedupe
ccharly Dec 12, 2024
9584e9e
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 12, 2024
dc10d94
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 12, 2024
5ea8323
chore: lavamoat:auto
ccharly Dec 12, 2024
45784bb
chore: dedupe
ccharly Dec 12, 2024
50035f3
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 12, 2024
384c9e9
Merge branch 'main' into refactor/use-new-accounts-packages
HowardBraham Dec 12, 2024
5689530
Merge branch 'main' into refactor/use-new-accounts-packages
HowardBraham Dec 16, 2024
9def941
Update LavaMoat policies
metamaskbot Dec 16, 2024
90050b9
Merge branch 'main' into refactor/use-new-accounts-packages
ccharly Dec 17, 2024
79dad4d
Merge branch 'main' into refactor/use-new-accounts-packages
gantunesr Dec 17, 2024
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 app/scripts/controllers/account-tracker-controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import EventEmitter from 'events';
import { ControllerMessenger } from '@metamask/base-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { BlockTracker, Provider } from '@metamask/network-controller';

import { flushPromises } from '../../../test/lib/timer-helpers';
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/account-tracker-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
AccountsControllerSelectedEvmAccountChangeEvent,
} from '@metamask/accounts-controller';
import { KeyringControllerAccountRemovedEvent } from '@metamask/keyring-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

import { LOCALHOST_RPC_URL } from '../../../shared/constants/network';
import { SINGLE_CALL_BALANCES_ADDRESSES } from '../constants/contracts';
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/metametrics-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Token,
TokensControllerState,
} from '@metamask/assets-controllers';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { Browser } from 'webextension-polyfill';
import { ControllerMessenger } from '@metamask/base-controller';
import { merge } from 'lodash';
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/mmi-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
OriginalRequest,
SignatureController,
} from '@metamask/signature-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { toHex } from '@metamask/controller-utils';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils';
// TODO: Remove restricted import
// eslint-disable-next-line import/no-restricted-paths
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/controllers/permissions/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const CaveatFactories = Object.freeze({
* PermissionController.
*
* @param {{
* getInternalAccounts: () => Record<string, import('@metamask/keyring-api').InternalAccount>,
* getInternalAccounts: () => Record<string, import('@metamask/keyring-internal-api').InternalAccount>,
* }} options - Options bag.
*/
export const getCaveatSpecifications = ({
Expand Down Expand Up @@ -96,7 +96,7 @@ export const getCaveatSpecifications = ({
*
* @param {{
* getAllAccounts: () => Promise<string[]>,
* getInternalAccounts: () => Record<string, import('@metamask/keyring-api').InternalAccount>,
* getInternalAccounts: () => Record<string, import('@metamask/keyring-internal-api').InternalAccount>,
* }} options - Options bag.
* @param options.getAllAccounts - A function that returns all Ethereum accounts
* in the current MetaMask instance.
Expand Down Expand Up @@ -254,7 +254,7 @@ export const getPermissionSpecifications = ({
* corresponds to a PreferencesController identity.
*
* @param {string[]} accounts - The accounts associated with the caveat.
* @param {() => Record<string, import('@metamask/keyring-api').InternalAccount>} getInternalAccounts -
* @param {() => Record<string, import('@metamask/keyring-internal-api').InternalAccount>} getInternalAccounts -
* Gets all AccountsController InternalAccounts.
*/
function validateCaveatAccounts(accounts, getInternalAccounts) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/AccountIdentitiesPetnamesBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
NameType,
NameOrigin,
} from '@metamask/name-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import {
AccountsControllerChangeEvent,
AccountsControllerListAccountsAction,
Expand Down
8 changes: 2 additions & 6 deletions app/scripts/lib/accounts/BalancesController.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ControllerMessenger } from '@metamask/base-controller';
import {
Balance,
BtcAccountType,
CaipAssetType,
InternalAccount,
} from '@metamask/keyring-api';
import { Balance, BtcAccountType, CaipAssetType } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { createMockInternalAccount } from '../../../../test/jest/mocks';
import { MultichainNetworks } from '../../../../shared/constants/multichain/networks';
import {
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/lib/accounts/BalancesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
} from '@metamask/base-controller';
import {
BtcAccountType,
KeyringClient,
SolAccountType,
isEvmAccountType,
type Balance,
type CaipAssetType,
type InternalAccount,
isEvmAccountType,
SolAccountType,
} from '@metamask/keyring-api';
import { type InternalAccount } from '@metamask/keyring-internal-api';
import { KeyringClient } from '@metamask/keyring-snap-client';
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
import type { SnapId } from '@metamask/snaps-sdk';
import { HandlerType } from '@metamask/snaps-utils';
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/lib/snap-keyring/snap-keyring.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ControllerMessenger } from '@metamask/base-controller';
import { EthAccountType, InternalAccount } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app';
import {
MetaMetricsEventCategory,
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/transaction/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { TransactionParams } from '@metamask/eth-json-rpc-middleware';
import {
TransactionController,
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/lib/transaction/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EthAccountType, InternalAccount } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import {
TransactionController,
TransactionMeta,
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/migrations/105.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { v4 as uuid } from 'uuid';
import { sha256FromString } from 'ethereumjs-util';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods';
import { migrate } from './105';

Expand Down
3 changes: 2 additions & 1 deletion app/scripts/migrations/105.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EthAccountType, InternalAccount } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { sha256FromString } from 'ethereumjs-util';
import { v4 as uuid } from 'uuid';
import { cloneDeep } from 'lodash';
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/migrations/119.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cloneDeep, isObject } from 'lodash';
import { hasProperty } from '@metamask/utils';
import { AccountsControllerState } from '@metamask/accounts-controller';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

type VersionedData = {
meta: { version: number };
Expand Down
96 changes: 42 additions & 54 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@
"packages": {
"@ethereumjs/tx": true,
"@metamask/eth-snap-keyring>@metamask/eth-sig-util": true,
"@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true,
"@metamask/eth-snap-keyring>@metamask/utils": true,
"@metamask/eth-snap-keyring>uuid": true,
"@metamask/keyring-api": true,
Expand All @@ -1069,6 +1070,11 @@
"browserify>buffer": true
}
},
"@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": {
"packages": {
"@metamask/keyring-snap-client": true
}
},
"@metamask/eth-snap-keyring>@metamask/utils": {
"globals": {
"TextDecoder": true,
Expand Down Expand Up @@ -1434,17 +1440,23 @@
}
},
"@metamask/keyring-api": {
"packages": {
"@metamask/keyring-api>@metamask/keyring-utils": true,
"@metamask/keyring-api>@metamask/utils": true,
"@metamask/keyring-api>bech32": true,
"@metamask/utils>@metamask/superstruct": true
}
},
"@metamask/keyring-api>@metamask/keyring-utils": {
"globals": {
"URL": true
},
"packages": {
"@metamask/keyring-api>@metamask/utils": true,
"@metamask/keyring-api>bech32": true,
"@metamask/keyring-api>uuid": true,
"@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true,
"@metamask/utils>@metamask/superstruct": true
}
},
"@metamask/keyring-api>@metamask/utils": {
"@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
Expand All @@ -1459,9 +1471,19 @@
"semver": true
}
},
"@metamask/keyring-api>uuid": {
"@metamask/keyring-api>@metamask/utils": {
"globals": {
"crypto": true
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/keyring-controller": {
Expand Down Expand Up @@ -1556,30 +1578,6 @@
"semver": true
}
},
"@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": {
"globals": {
"URL": true
},
"packages": {
"@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true,
"@metamask/utils>@metamask/superstruct": true
}
},
"@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/keyring-controller>ethereumjs-wallet": {
"packages": {
"@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true,
Expand Down Expand Up @@ -1624,6 +1622,19 @@
"browserify>buffer": true
}
},
"@metamask/keyring-snap-client": {
"packages": {
"@metamask/keyring-api": true,
"@metamask/keyring-api>@metamask/keyring-utils": true,
"@metamask/keyring-snap-client>uuid": true,
"@metamask/utils>@metamask/superstruct": true
}
},
"@metamask/keyring-snap-client>uuid": {
"globals": {
"crypto": true
}
},
"@metamask/logging-controller": {
"packages": {
"@metamask/base-controller": true,
Expand Down Expand Up @@ -2127,39 +2138,16 @@
},
"packages": {
"@metamask/base-controller": true,
"@metamask/keyring-api": true,
"@metamask/keyring-controller": true,
"@metamask/network-controller": true,
"@metamask/profile-sync-controller>@metamask/keyring-api": true,
"@metamask/profile-sync-controller>@noble/ciphers": true,
"@metamask/profile-sync-controller>siwe": true,
"@noble/hashes": true,
"browserify>buffer": true,
"loglevel": true
}
},
"@metamask/profile-sync-controller>@metamask/keyring-api": {
"packages": {
"@metamask/keyring-api>bech32": true,
"@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": true,
"@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": true,
"@metamask/utils>@metamask/superstruct": true
}
},
"@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/profile-sync-controller>@noble/ciphers": {
"globals": {
"TextDecoder": true,
Expand Down
Loading
Loading