All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Export
assertExpectedHooksutility (#8747)
- Add legacy
createOriginMiddlewareutility (#8734)
- Add
createOriginMiddlewareutility tov2(#8522) - Add
createMethodMiddlewareutility tov2(#8506, #8583)- This utility allows JSON-RPC method implementations to use both the hooks pattern and the messenger.
- Add legacy
createMethodMiddleware(#8583)- Consolidates bespoke
makeMethodMiddlewareMakerimplementations from the MetaMask extension and mobile clients. - Handlers may now declare
actionNamesand receive a delegated messenger as the sixth argument toimplementation, mirroring the v2createMethodMiddleware. - Deprecated in favor of the v2
createMethodMiddleware.
- Consolidates bespoke
- Bump
@metamask/messengerfrom^1.1.1to^1.2.0(#8632)
JsonRpcServer.handle()no longer throws or produces unhandled promise rejections when theonErrorcallback throws or rejects (#8071)
- Clone
JsonRpcEngineV2return values to prevent returning frozen objects (#8077)
- Preserve
data.causein RPC errors when using JsonRpcEngine compatibility tools (#7838)
- Upgrade
@metamask/utilsfrom^11.8.1to^11.9.0(#7511)
- Ensure non-object data in RPC errors is deserialized correctly when using JsonRpcEngine compatibility tools (#7638)
- Add
JsonRpcEngineV2(#6176, #6971, #6975, #6990, #6991, #7032, #7001, #7061, #7065)- This is a complete rewrite of
JsonRpcEngine, intended to replace the original implementation. See the readme for details.
- This is a complete rewrite of
- Bump
@metamask/utilsfrom^11.8.0to^11.8.1(#6708)
- Bump
@metamask/utilsfrom^11.2.0to^11.4.2(#6054) - Bump
@metamask/utilsfrom^11.4.2to^11.8.0(#6588)
JsonRpcEngineand related types (#6176)- To be replaced by
JsonRpcEngineV2.
- To be replaced by
- Bump
@metamask/utilsfrom^11.0.1to^11.1.0(#5223)
- Bump
@metamask/utilsfrom^10.0.0to^11.0.1(#5080) - Bump
@metamask/rpc-errorsfrom^7.0.0to^7.0.2(#5080)
- Bump
@metamask/utilsfrom^9.1.0to^10.0.0(#4831)
- BREAKING: Bump
@metamask/rpc-errorsfrom^6.3.1to^7.0.0(#4773)- This modifies the top-level error message for serialized internal JSON-RPC errors to include the actual error message, instead of the generic
Internal JSON-RPC Error.string.
- This modifies the top-level error message for serialized internal JSON-RPC errors to include the actual error message, instead of the generic
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files (#4648)
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
exportsfield inpackage.jsonlinked to these files. This is an anti-pattern and was rightfully flagged by the "Are the Types Wrong?" tool as "masquerading as CJS". All of the ATTW checks now pass.
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
- Remove chunk files. (#4648)
- Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.
- Bump TypeScript version to
~5.0.4and setmoduleResolutionoption toNode16(#3645) - Bump
@metamask/utilsfrom^9.0.0to^9.1.0(#4529)
- Bump
@metamask/rpc-errorsfrom6.2.1to^6.3.1(#4516) - Bump
@metamask/utilsfrom^8.3.0to^9.0.0(#4516)
- BREAKING: Bump minimum Node version to 18.18 (#3611)
- Widen the
errorparameter ofJsonRpcEngineReturnHandler,JsonRpcEngineEndCallbackfunction types fromJsonRpcEngineCallbackErrortounknown(#3906) - Narrow the function parameters
req,callbackof the last overload of thehandlemethod of theJsonRpcEngineclass (#3906)- This applies to the overload with two function parameters, one required and one optional, and no generic parameters.
reqis narrowed fromunknownto(JsonRpcRequest | JsonRpcNotification)[] | JsonRpcRequest | JsonRpcNotification.callbackis narrowed fromanyto(error: unknown, response: never) => void.
- Bump TypeScript version to
~4.9.5(#4084)
- Fix
typesfield inpackage.json(#4047)
- BREAKING: Add ESM build (#3998)
- It's no longer possible to import files from
./distdirectly.
- It's no longer possible to import files from
- Bump
@metamask/rpc-errorsto^6.2.1(#3954)
- Bump
@metamask/utilsto^8.3.0(#3769)
- There are no consumer-facing changes to this package. This version is a part of a synchronized release across all packages in our monorepo.
- Migrate
@metamask/json-rpc-engineinto the core monorepo (#1895)
- Bump
@metamask/utilsfrom^8.1.0to^8.2.0(#1895) - Bump
@metamask/rpc-errorsfrom^6.0.0to^6.1.0(#1882) - Bump
@metamask/auto-changelogfrom3.4.2to3.4.3(#1997)
- Applied eslint rules from core monorepo (#172)
- Bumped
@metamask/utilsfrom^5.0.2to^8.1.0#158 (#162) - Bumped
@metamask/rpc-errorsfrom^5.0.0to^6.0.0(#162)
- Bumped
@metamask/safe-event-emitterfrom^2.0.0to^3.0.0(#148) - Bumped
@metamask/utilsfrom^5.0.1to^5.0.2(#151)
- Fixed handling of empty batch array in requests (#153)
- BREAKING: Require a minimum Node version of 16 (#139)
- BREAKING: Use
@metamask/utilstypes (#105)- The JSON-RPC engine and all middleware now use
@metamask/utilsJSON-RPC types
- The JSON-RPC engine and all middleware now use
- (BREAKING) Return a
nullinstead ofundefinedresponseidfor malformed request objects (#91)- This is very unlikely to be breaking in practice, but the behavior could have been relied on.
- Change package name to
@metamask/json-rpc-engine(#139) - Use
@metamask/rpc-errors(#138)
6.1.0 - 2020-11-20
- Add
PendingJsonRpcResponseinterface for use in middleware (#75)
- Use
async/awaitandtry/catchinstead of Promise methods everywhere (#74)- Consumers may notice improved stack traces on certain platforms.
6.0.0 - 2020-11-19
- Add docstrings for public
JsonRpcEnginemethods (#70)
- (BREAKING) Refactor exports (#69)
- All exports are now named, and available via the package entry point.
- All default exports have been removed.
- (BREAKING) Convert
asMiddlewareto instance method (#69)- The
asMiddlewareexport has been removed.
- The
- (BREAKING) Add runtime typechecks to
JsonRpcEngine.handle(), and error responses if they fail (#70)- Requests will now error if:
- The request is not a plain object, or if the
methodproperty is not astring. Empty strings are allowed. - A
nextmiddleware callback is called with a truthy, non-function parameter.
- The request is not a plain object, or if the
- Requests will now error if:
- Migrate to TypeScript (#69)
- Hopefully improve stack traces by removing uses of
Promise.thenand.catchinternally (#70) - Make some internal
JsonRpcEnginemethodsstatic(#71)
5.4.0 - 2020-11-07
5.3.0 - 2020-07-30
- Response object errors no longer include a
stackproperty
5.2.0 - 2020-07-24
- Promise signatures for
engine.handle(#55)- So, in addition to
engine.handle(request, callback), you can do e.g.await engine.handle(request).
- So, in addition to
- Remove
asyncandpromise-to-callbackdependencies- These dependencies were used internally for middleware flow control.
They have been replaced with Promises and native
async/await, which means that some operations are no longer eagerly executed. This change may affect consumers that depend on the eager execution of middleware during request processing, outside of middleware functions and request handlers.- In general, it is a bad practice to work with state that depends on middleware execution, while the middleware are executing.
- These dependencies were used internally for middleware flow control.
They have been replaced with Promises and native