Skip to content
Closed
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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/core-monorepo",
"version": "77.0.0",
"version": "78.0.0",
"private": true,
"description": "Monorepo for packages shared between MetaMask clients",
"repository": {
Expand Down
7 changes: 6 additions & 1 deletion packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0]
### Changed
- **BREAKING:** Bump peer dependency on `@metamask/keyring-controller` to ^8.0.0

## [1.0.0]
### Added
- Initial release ([#1637](https://github.com/MetaMask/core/pull/1637))

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/[email protected]
10 changes: 5 additions & 5 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/accounts-controller",
"version": "1.0.0",
"version": "2.0.0",
"description": "Manages internal accounts",
"keywords": [
"MetaMask",
Expand Down Expand Up @@ -42,18 +42,18 @@
},
"devDependencies": {
"@metamask/auto-changelog": "^3.1.0",
"@metamask/keyring-controller": "^7.5.0",
"@metamask/keyring-controller": "^8.0.0",
"@metamask/snaps-controllers": "^1.0.1",
"@types/jest": "^27.4.1",
"@types/readable-stream": "^2.3.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc": "^0.23.15",
"typedoc-plugin-missing-exports": "^0.23.0",
"typescript": "~4.6.3"
},
"peerDependencies": {
"@metamask/keyring-controller": "^7.5.0"
"@metamask/keyring-controller": "^8.0.0"
},
"engines": {
"node": ">=16.0.0"
Expand Down
9 changes: 7 additions & 2 deletions packages/address-book-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.2]
### Changed
- Bump dependency on `@metamask/controller-utils` to ^5.0.0

## [3.1.1]
### Changed
- Bump dependency on `@metamask/base-controller` to ^3.2.1
Expand All @@ -32,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Add optional `addressType` property to address book entries ([#828](https://github.com/MetaMask/controllers/pull/828), [#1068](https://github.com/MetaMask/core/pull/1068))
- Rename this repository to `core` ([#1031](https://github.com/MetaMask/controllers/pull/1031))
- Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041))
- Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041))

## [1.0.1]
### Changed
Expand All @@ -47,7 +51,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

All changes listed after this point were applied to this package following the monorepo conversion.

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[3.1.2]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[3.1.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[3.1.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
8 changes: 4 additions & 4 deletions packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/address-book-controller",
"version": "3.1.1",
"version": "3.1.2",
"description": "Manages a list of recipient addresses associated with nicknames",
"keywords": [
"MetaMask",
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@metamask/base-controller": "^3.2.1",
"@metamask/controller-utils": "^4.3.2",
"@metamask/controller-utils": "^5.0.0",
"@metamask/utils": "^8.1.0"
},
"devDependencies": {
Expand All @@ -38,8 +38,8 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc": "^0.23.15",
"typedoc-plugin-missing-exports": "^0.23.0",
"typescript": "~4.6.3"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/announcement-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"immer": "^9.0.6",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc": "^0.23.15",
"typedoc-plugin-missing-exports": "^0.23.0",
"typescript": "~4.6.3"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/approval-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"dependencies": {
"@metamask/base-controller": "^3.2.1",
"@metamask/rpc-errors": "^6.0.0",
"@metamask/utils": "^8.1.0",
"eth-rpc-errors": "^4.0.2",
"immer": "^9.0.6",
"nanoid": "^3.1.31"
},
Expand All @@ -41,8 +41,8 @@
"jest": "^27.5.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc": "^0.23.15",
"typedoc-plugin-missing-exports": "^0.23.0",
"typescript": "~4.6.3"
},
"engines": {
Expand Down
16 changes: 8 additions & 8 deletions packages/approval-controller/src/ApprovalController.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable jest/expect-expect */

import { ControllerMessenger } from '@metamask/base-controller';
import { errorCodes, EthereumRpcError } from 'eth-rpc-errors';
import { errorCodes, JsonRpcError } from '@metamask/rpc-errors';

import type {
ApprovalControllerActions,
Expand Down Expand Up @@ -642,7 +642,7 @@ describe('approval controller', () => {
approvalController.reject('2', new Error('foo'));
expect(approvalController.getTotalApprovalCount()).toBe(2);

approvalController.clear(new EthereumRpcError(1, 'clear'));
approvalController.clear(new JsonRpcError(1, 'clear'));
expect(approvalController.getTotalApprovalCount()).toBe(0);
});

Expand All @@ -666,7 +666,7 @@ describe('approval controller', () => {
approvalController.reject('2', new Error('foo'));
expect(approvalController.getTotalApprovalCount()).toBe(1);

approvalController.clear(new EthereumRpcError(1, 'clear'));
approvalController.clear(new JsonRpcError(1, 'clear'));
expect(approvalController.getTotalApprovalCount()).toBe(0);
});
});
Expand Down Expand Up @@ -1025,7 +1025,7 @@ describe('approval controller', () => {
describe('clear', () => {
it('does nothing if state is already empty', () => {
expect(() =>
approvalController.clear(new EthereumRpcError(1, 'clear')),
approvalController.clear(new JsonRpcError(1, 'clear')),
).not.toThrow();
});

Expand All @@ -1040,7 +1040,7 @@ describe('approval controller', () => {
.add({ id: 'foo3', origin: 'fizz.buzz', type: 'myType' })
.catch((_error) => undefined);

approvalController.clear(new EthereumRpcError(1, 'clear'));
approvalController.clear(new JsonRpcError(1, 'clear'));

expect(
approvalController.state[PENDING_APPROVALS_STORE_KEY],
Expand All @@ -1055,16 +1055,16 @@ describe('approval controller', () => {
type: 'myType',
});

approvalController.clear(new EthereumRpcError(1000, 'foo'));
approvalController.clear(new JsonRpcError(1000, 'foo'));
await expect(rejectPromise).rejects.toThrow(
new EthereumRpcError(1000, 'foo'),
new JsonRpcError(1000, 'foo'),
);
});

it('does not clear approval flows', async () => {
approvalController.startFlow();

approvalController.clear(new EthereumRpcError(1, 'clear'));
approvalController.clear(new JsonRpcError(1, 'clear'));

expect(approvalController.state[APPROVAL_FLOWS_STORE_KEY]).toHaveLength(
1,
Expand Down
14 changes: 7 additions & 7 deletions packages/approval-controller/src/ApprovalController.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { RestrictedControllerMessenger } from '@metamask/base-controller';
import { BaseControllerV2 } from '@metamask/base-controller';
import type { JsonRpcError, DataWithOptionalCause } from '@metamask/rpc-errors';
import { rpcErrors } from '@metamask/rpc-errors';
import type { Json, OptionalField } from '@metamask/utils';
import type { EthereumRpcError } from 'eth-rpc-errors';
import { ethErrors } from 'eth-rpc-errors';
import type { Patch } from 'immer';
import { nanoid } from 'nanoid';

Expand Down Expand Up @@ -256,7 +256,7 @@ export type GetApprovalsState = {

export type ClearApprovalRequests = {
type: `${typeof controllerName}:clearRequests`;
handler: (error: EthereumRpcError<unknown>) => void;
handler: (error: JsonRpcError<DataWithOptionalCause>) => void;
};

export type AddApprovalRequest = {
Expand Down Expand Up @@ -719,10 +719,10 @@ export class ApprovalController extends BaseControllerV2<
/**
* Rejects and deletes all approval requests.
*
* @param rejectionError - The EthereumRpcError to reject the approval
* @param rejectionError - The JsonRpcError to reject the approval
* requests with.
*/
clear(rejectionError: EthereumRpcError<unknown>): void {
clear(rejectionError: JsonRpcError<DataWithOptionalCause>): void {
for (const id of this.#approvals.keys()) {
this.reject(id, rejectionError);
}
Expand Down Expand Up @@ -878,7 +878,7 @@ export class ApprovalController extends BaseControllerV2<
!this.#typesExcludedFromRateLimiting.includes(type) &&
this.has({ origin, type })
) {
throw ethErrors.rpc.resourceUnavailable(
throw rpcErrors.resourceUnavailable(
getAlreadyPendingMessage(origin, type),
);
}
Expand Down Expand Up @@ -937,7 +937,7 @@ export class ApprovalController extends BaseControllerV2<
}

if (errorMessage) {
throw ethErrors.rpc.internal(errorMessage);
throw rpcErrors.internal(errorMessage);
}
}

Expand Down
30 changes: 27 additions & 3 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [13.0.0]
### Changed
- **BREAKING**: `TokensController` now expects `getNetworkClientById` in constructor options ([#1676](https://github.com/MetaMask/core/pull/1676))
- **BREAKING**: `TokensController.addToken` now accepts a single options object ([#1676](https://github.com/MetaMask/core/pull/1676))
```
{
address: string;
symbol: string;
decimals: number;
name?: string;
image?: string;
interactingAddress?: string;
networkClientId?: NetworkClientId;
}
```
- **BREAKING**: Bump peer dependency on `@metamask/network-controller` to ^13.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
- **CHANGED**: `TokensController.addToken` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
- **CHANGED**: `TokensController.addTokens` now accepts an optional `networkClientId` as the last parameter ([#1676](https://github.com/MetaMask/core/pull/1676))
- **CHANGED**: `TokensController.addTokens` will use the chain ID value derived from state for `networkClientId` if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
- **CHANGED**: `TokensController.watchAsset` options now accepts optional `networkClientId` which is used to get the ERC-20 token name if provided ([#1676](https://github.com/MetaMask/core/pull/1676))
- Bump dependency on `@metamask/controller-utils` to ^5.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
- Bump dependency on `@metamask/preferences-controller` to ^4.4.1 ([#1676](https://github.com/MetaMask/core/pull/1676))

## [12.0.0]
### Added
- Add `AssetsContractController` methods `getProvider`, `getChainId`, `getERC721Standard`, and `getERC1155Standard` ([#1638](https://github.com/MetaMask/core/pull/1638))
Expand Down Expand Up @@ -78,7 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The `getERC20TokenName` method is used to get the token name for tokens added via `wallet_watchAsset`
- The `onTokenListStateChange` method is used to trigger a name update when the token list changes. On each change, token names are copied from the token list if they're missing from token controller state.
- **BREAKING:** The signature of the tokens controller method `addToken` has changed
- The fourth and fifth positional parameters (`image` and `interactingAddress`) have been replaced by an `options` object
- The fourth and fifth positional parameters (`image` and `interactingAddress`) have been replaced by an `options` object
- The new options parameter includes the `image` and `interactingAddress` properties, and a new `name` property
- The token detection controller now sets the token name when new tokens are detected ([#1127](https://github.com/MetaMask/core/pull/1127))
- The `Token` type now includes an optional `name` field ([#1127](https://github.com/MetaMask/core/pull/1127))
Expand Down Expand Up @@ -157,7 +180,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **BREAKING:** Remove the `networkType` configuration option from the NFT detection controller, NFT controller, and tokens controller ([#1360](https://github.com/MetaMask/core/pull/1360), [#1359](https://github.com/MetaMask/core/pull/1359))
- **BREAKING:** Remove the `SuggestedAssetMeta` and `SuggestedAssetMetaBase` types from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
- **BREAKING:** Remove the `acceptWatchAsset` and `rejectWatchAsset` methods from the token controller ([#1268](https://github.com/MetaMask/core/pull/1268))
- Suggested assets can be accepted or rejected using the approval controller instead
- Suggested assets can be accepted or rejected using the approval controller instead

## [7.0.0]
### Changed
Expand Down Expand Up @@ -248,7 +271,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[13.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[12.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[11.1.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[11.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
19 changes: 9 additions & 10 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/assets-controllers",
"version": "12.0.0",
"version": "13.0.0",
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
"keywords": [
"MetaMask",
Expand Down Expand Up @@ -36,15 +36,14 @@
"@metamask/approval-controller": "^3.5.1",
"@metamask/base-controller": "^3.2.1",
"@metamask/contract-metadata": "^2.3.1",
"@metamask/controller-utils": "^4.3.2",
"@metamask/controller-utils": "^5.0.0",
"@metamask/eth-query": "^3.0.1",
"@metamask/metamask-eth-abis": "3.0.0",
"@metamask/network-controller": "^12.2.0",
"@metamask/preferences-controller": "^4.4.0",
"@metamask/rpc-errors": "^5.1.1",
"@metamask/network-controller": "^13.0.0",
"@metamask/preferences-controller": "^4.4.1",
"@metamask/rpc-errors": "^6.0.0",
"@metamask/utils": "^8.1.0",
"@types/uuid": "^8.3.0",
"abort-controller": "^3.0.0",
"async-mutex": "^0.2.6",
"ethereumjs-util": "^7.0.10",
"immer": "^9.0.6",
Expand All @@ -63,14 +62,14 @@
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc": "^0.23.15",
"typedoc-plugin-missing-exports": "^0.23.0",
"typescript": "~4.6.3"
},
"peerDependencies": {
"@metamask/approval-controller": "^3.5.1",
"@metamask/network-controller": "^12.2.0",
"@metamask/preferences-controller": "^4.4.0"
"@metamask/network-controller": "^13.0.0",
"@metamask/preferences-controller": "^4.4.1"
},
"engines": {
"node": ">=16.0.0"
Expand Down
Loading