Skip to content

Commit fa2dfef

Browse files
feat(json-rpc-engine): Export assertExpectedHooks (MetaMask#8747)
## Explanation Exports the `assertExpectedHooks` utility which is helpful when creating middlewares using `selectHooks`. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this is a surface-area change that only adds a new named export and updates tests/changelog, with no behavioral changes to request handling. > > **Overview** > Exposes the `assertExpectedHooks` helper as a public export from `@metamask/json-rpc-engine/v2` (re-exported from `utils`). > > Updates the v2 export snapshot test to include the new symbol and notes the addition in the package changelog. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d0b1873. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 4acab9d commit fa2dfef

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/json-rpc-engine/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Export `assertExpectedHooks` utility ([#8747](https://github.com/MetaMask/core/pull/8747))
13+
1014
## [10.4.0]
1115

1216
### Added

packages/json-rpc-engine/src/v2/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('@metamask/json-rpc-engine/v2', () => {
99
"JsonRpcServer",
1010
"MiddlewareContext",
1111
"asLegacyMiddleware",
12+
"assertExpectedHooks",
1213
"createMethodMiddleware",
1314
"createOriginMiddleware",
1415
"createScaffoldMiddleware",

packages/json-rpc-engine/src/v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export {
2323
isRequest,
2424
JsonRpcEngineError,
2525
selectHooks,
26+
assertExpectedHooks,
2627
} from './utils';
2728
export type {
2829
Json,

0 commit comments

Comments
 (0)