@metamask-previews/eth-json-rpc-provider 2.3.0-preview.eb58a59 → 2.3.1-preview.353ee83b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.3.1]
10
+ ### Changed
11
+ - Bump `@metamask/json-rpc-engine` to `^7.3.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
12
+
9
13
  ## [2.3.0]
10
14
  ### Added
11
15
  - Migrate `@metamask/eth-json-rpc-provider` into the core monorepo ([#1738](https://github.com/MetaMask/core/pull/1738))
@@ -49,7 +53,8 @@ Release `v2.0.0` is identical to `v1.0.1` aside from Node.js version requirement
49
53
  ### Added
50
54
  - Initial release, including `providerFromEngine` and `providerFromMiddleware`.
51
55
 
52
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.0...HEAD
56
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.1...HEAD
57
+ [2.3.1]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.0...@metamask/eth-json-rpc-provider@2.3.1
53
58
  [2.3.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.2.0...@metamask/eth-json-rpc-provider@2.3.0
54
59
  [2.2.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.1.0...@metamask/eth-json-rpc-provider@2.2.0
55
60
  [2.1.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.0.0...@metamask/eth-json-rpc-provider@2.1.0
@@ -1 +1 @@
1
- {"version":3,"file":"safe-event-emitter-provider.d.ts","sourceRoot":"","sources":["../src/safe-event-emitter-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,gBAAgB;;IAG5D;;;;;OAKG;gBACS,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE;IAWjD;;;;;OAKG;IACH,SAAS,QACF,cAAc,oBACD,OAAO,gBAAgB,GAAG,KAAK,IAAI,UAGrD;IAEF;;;;;;;;;OASG;IACH,IAAI,QACG,cAAc,oBACD,OAAO,gBAAgB,GAAG,KAAK,IAAI,UAMrD;CACH"}
1
+ {"version":3,"file":"safe-event-emitter-provider.d.ts","sourceRoot":"","sources":["../src/safe-event-emitter-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,gBAAgB;;IAG5D;;;;;OAKG;gBACS,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE;IAWjD;;;;;OAKG;IACH,SAAS,QACF,cAAc,oBAGD,OAAO,gBAAgB,GAAG,KAAK,IAAI,UAGrD;IAEF;;;;;;;;;OASG;IACH,IAAI,QACG,cAAc,oBAGD,OAAO,gBAAgB,GAAG,KAAK,IAAI,UAMrD;CACH"}
@@ -39,7 +39,10 @@ class SafeEventEmitterProvider extends safe_event_emitter_1.default {
39
39
  * @param req - The request to send.
40
40
  * @param callback - A function that is called upon the success or failure of the request.
41
41
  */
42
- this.sendAsync = (req, callback) => {
42
+ this.sendAsync = (req,
43
+ // TODO: Replace `any` with type
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ callback) => {
43
46
  __classPrivateFieldGet(this, _SafeEventEmitterProvider_engine, "f").handle(req, callback);
44
47
  };
45
48
  /**
@@ -52,7 +55,10 @@ class SafeEventEmitterProvider extends safe_event_emitter_1.default {
52
55
  * @param req - The request to send.
53
56
  * @param callback - A function that is called upon the success or failure of the request.
54
57
  */
55
- this.send = (req, callback) => {
58
+ this.send = (req,
59
+ // TODO: Replace `any` with type
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ callback) => {
56
62
  if (typeof callback !== 'function') {
57
63
  throw new Error('Must provide callback to "send" method.');
58
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"safe-event-emitter-provider.js","sourceRoot":"","sources":["../src/safe-event-emitter-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,sFAA4D;AAG5D;;;;;GAKG;AACH,MAAa,wBAAyB,SAAQ,4BAAgB;IAG5D;;;;;OAKG;IACH,YAAY,EAAE,MAAM,EAA6B;QAC/C,KAAK,EAAE,CAAC;QATV,mDAAuB;QAmBvB;;;;;WAKG;QACH,cAAS,GAAG,CACV,GAAmB,EACnB,QAAqD,EACrD,EAAE;YACF,uBAAA,IAAI,wCAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF;;;;;;;;;WASG;QACH,SAAI,GAAG,CACL,GAAmB,EACnB,QAAqD,EACrD,EAAE;YACF,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;aAC5D;YACD,uBAAA,IAAI,wCAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC;QAxCA,uBAAA,IAAI,oCAAW,MAAM,MAAA,CAAC;QAEtB,IAAI,MAAM,CAAC,EAAE,EAAE;YACb,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;gBAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CAkCF;AApDD,4DAoDC","sourcesContent":["import type { JsonRpcEngine } from '@metamask/json-rpc-engine';\nimport SafeEventEmitter from '@metamask/safe-event-emitter';\nimport type { JsonRpcRequest } from '@metamask/utils';\n\n/**\n * An Ethereum provider.\n *\n * This provider loosely follows conventions that pre-date EIP-1193.\n * It is not compliant with any Ethereum provider standard.\n */\nexport class SafeEventEmitterProvider extends SafeEventEmitter {\n #engine: JsonRpcEngine;\n\n /**\n * Construct a SafeEventEmitterProvider from a JSON-RPC engine.\n *\n * @param options - Options.\n * @param options.engine - The JSON-RPC engine used to process requests.\n */\n constructor({ engine }: { engine: JsonRpcEngine }) {\n super();\n this.#engine = engine;\n\n if (engine.on) {\n engine.on('notification', (message: string) => {\n this.emit('data', null, message);\n });\n }\n }\n\n /**\n * Send a provider request asynchronously.\n *\n * @param req - The request to send.\n * @param callback - A function that is called upon the success or failure of the request.\n */\n sendAsync = (\n req: JsonRpcRequest,\n callback: (error: unknown, providerRes?: any) => void,\n ) => {\n this.#engine.handle(req, callback);\n };\n\n /**\n * Send a provider request asynchronously.\n *\n * This method serves the same purpose as `sendAsync`. It only exists for\n * legacy reasons.\n *\n * @deprecated Use `sendAsync` instead.\n * @param req - The request to send.\n * @param callback - A function that is called upon the success or failure of the request.\n */\n send = (\n req: JsonRpcRequest,\n callback: (error: unknown, providerRes?: any) => void,\n ) => {\n if (typeof callback !== 'function') {\n throw new Error('Must provide callback to \"send\" method.');\n }\n this.#engine.handle(req, callback);\n };\n}\n"]}
1
+ {"version":3,"file":"safe-event-emitter-provider.js","sourceRoot":"","sources":["../src/safe-event-emitter-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,sFAA4D;AAG5D;;;;;GAKG;AACH,MAAa,wBAAyB,SAAQ,4BAAgB;IAG5D;;;;;OAKG;IACH,YAAY,EAAE,MAAM,EAA6B;QAC/C,KAAK,EAAE,CAAC;QATV,mDAAuB;QAmBvB;;;;;WAKG;QACH,cAAS,GAAG,CACV,GAAmB;QACnB,gCAAgC;QAChC,8DAA8D;QAC9D,QAAqD,EACrD,EAAE;YACF,uBAAA,IAAI,wCAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF;;;;;;;;;WASG;QACH,SAAI,GAAG,CACL,GAAmB;QACnB,gCAAgC;QAChC,8DAA8D;QAC9D,QAAqD,EACrD,EAAE;YACF,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;aAC5D;YACD,uBAAA,IAAI,wCAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC;QA5CA,uBAAA,IAAI,oCAAW,MAAM,MAAA,CAAC;QAEtB,IAAI,MAAM,CAAC,EAAE,EAAE;YACb,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;gBAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CAsCF;AAxDD,4DAwDC","sourcesContent":["import type { JsonRpcEngine } from '@metamask/json-rpc-engine';\nimport SafeEventEmitter from '@metamask/safe-event-emitter';\nimport type { JsonRpcRequest } from '@metamask/utils';\n\n/**\n * An Ethereum provider.\n *\n * This provider loosely follows conventions that pre-date EIP-1193.\n * It is not compliant with any Ethereum provider standard.\n */\nexport class SafeEventEmitterProvider extends SafeEventEmitter {\n #engine: JsonRpcEngine;\n\n /**\n * Construct a SafeEventEmitterProvider from a JSON-RPC engine.\n *\n * @param options - Options.\n * @param options.engine - The JSON-RPC engine used to process requests.\n */\n constructor({ engine }: { engine: JsonRpcEngine }) {\n super();\n this.#engine = engine;\n\n if (engine.on) {\n engine.on('notification', (message: string) => {\n this.emit('data', null, message);\n });\n }\n }\n\n /**\n * Send a provider request asynchronously.\n *\n * @param req - The request to send.\n * @param callback - A function that is called upon the success or failure of the request.\n */\n sendAsync = (\n req: JsonRpcRequest,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (error: unknown, providerRes?: any) => void,\n ) => {\n this.#engine.handle(req, callback);\n };\n\n /**\n * Send a provider request asynchronously.\n *\n * This method serves the same purpose as `sendAsync`. It only exists for\n * legacy reasons.\n *\n * @deprecated Use `sendAsync` instead.\n * @param req - The request to send.\n * @param callback - A function that is called upon the success or failure of the request.\n */\n send = (\n req: JsonRpcRequest,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callback: (error: unknown, providerRes?: any) => void,\n ) => {\n if (typeof callback !== 'function') {\n throw new Error('Must provide callback to \"send\" method.');\n }\n this.#engine.handle(req, callback);\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/eth-json-rpc-provider",
3
- "version": "2.3.0-preview.eb58a59",
3
+ "version": "2.3.1-preview.353ee83b",
4
4
  "description": "Create an Ethereum provider using a JSON-RPC engine or middleware",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -24,6 +24,7 @@
24
24
  "build": "tsc --project tsconfig.build.json",
25
25
  "build:clean": "rimraf dist && yarn build",
26
26
  "build:docs": "typedoc",
27
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/eth-json-rpc-provider",
27
28
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-json-rpc-provider",
28
29
  "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:dependencies",
29
30
  "lint:dependencies": "depcheck",
@@ -37,15 +38,14 @@
37
38
  "test:watch": "jest --watch"
38
39
  },
39
40
  "dependencies": {
40
- "@metamask/json-rpc-engine": "^7.3.0",
41
+ "@metamask/json-rpc-engine": "^7.3.1",
41
42
  "@metamask/safe-event-emitter": "^3.0.0",
42
43
  "@metamask/utils": "^8.2.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@metamask/auto-changelog": "^3.4.3",
46
+ "@metamask/auto-changelog": "^3.4.4",
46
47
  "@types/jest": "^27.4.1",
47
48
  "deepmerge": "^4.2.2",
48
- "depcheck": "^1.4.3",
49
49
  "jest": "^27.5.1",
50
50
  "jest-it-up": "^2.0.2",
51
51
  "ts-jest": "^27.1.4",