@metamask/eth-json-rpc-provider
Advanced tools
Comparing version 2.3.2 to 3.0.0
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
@@ -9,4 +10,17 @@ | ||
## [3.0.0] | ||
### Added | ||
- **BREAKING**: Add ESM build ([#3998](https://github.com/MetaMask/core/pull/3998)) | ||
- It's no longer possible to import files from `./dist` directly. | ||
### Changed | ||
- Bump `@metamask/json-rpc-engine` to `^8.0.0` ([#4039](https://github.com/MetaMask/core/pull/4039)) | ||
## [2.3.2] | ||
### Changed | ||
- Bump `@metamask/utils` to `^8.3.0` ([#3769](https://github.com/MetaMask/core/pull/3769)) | ||
@@ -16,10 +30,15 @@ - Bump `@metamask/json-rpc-engine` to `^7.3.2` ([#3821](https://github.com/MetaMask/core/pull/3821)) | ||
## [2.3.1] | ||
### Changed | ||
- Bump `@metamask/json-rpc-engine` to `^7.3.1` ([#3695](https://github.com/MetaMask/core/pull/3695)) | ||
## [2.3.0] | ||
### Added | ||
- Migrate `@metamask/eth-json-rpc-provider` into the core monorepo ([#1738](https://github.com/MetaMask/core/pull/1738)) | ||
### Changed | ||
- Export `SafeEventEmitterProvider` as class instead of type ([#1738](https://github.com/MetaMask/core/pull/1738)) | ||
@@ -31,7 +50,11 @@ - Bump `@metamask/json-rpc-engine` from `^7.1.0` to `^7.2.0` ([#1895](https://github.com/MetaMask/core/pull/1895)) | ||
## [2.2.0] | ||
### Changed | ||
- Add missing ISC license information ([#24](https://github.com/MetaMask/eth-json-rpc-provider/pull/24)) | ||
## [2.1.0] | ||
### Changed | ||
- Bump `@metamask/json-rpc-engine` from `^7.0.0` to `^7.1.0` ([#25](https://github.com/MetaMask/eth-json-rpc-provider/pull/25)) | ||
@@ -41,3 +64,5 @@ - Bump `@metamask/utils` from `^5.0.1` to `^8.1.0` ([#25](https://github.com/MetaMask/eth-json-rpc-provider/pull/25)) | ||
## [2.0.0] | ||
### Fixed | ||
- **BREAKING:** Update minimum Node.js version to 16 ([#20](https://github.com/MetaMask/eth-json-rpc-provider/pull/20)) | ||
@@ -53,3 +78,5 @@ - Switched json-rpc-engine@^6.1.0 -> @metamask/json-rpc-engine@^7.0.0 ([#16](https://github.com/MetaMask/eth-json-rpc-provider/pull/16)) | ||
## [1.0.1] [RETRACTED] | ||
### Changed | ||
- **BREAKING:** Update minimum Node.js version to 16 ([#20](https://github.com/MetaMask/eth-json-rpc-provider/pull/20)) | ||
@@ -63,6 +90,9 @@ - Switched json-rpc-engine@^6.1.0 -> @metamask/json-rpc-engine@^7.0.0 ([#16](https://github.com/MetaMask/eth-json-rpc-provider/pull/16)) | ||
## [1.0.0] | ||
### Added | ||
- Initial release, including `providerFromEngine` and `providerFromMiddleware`. | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.2...HEAD | ||
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@3.0.0...HEAD | ||
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.2...@metamask/eth-json-rpc-provider@3.0.0 | ||
[2.3.2]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.1...@metamask/eth-json-rpc-provider@2.3.2 | ||
@@ -69,0 +99,0 @@ [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 |
@@ -1,22 +0,15 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SafeEventEmitterProvider = void 0; | ||
__exportStar(require("./provider-from-engine"), exports); | ||
__exportStar(require("./provider-from-middleware"), exports); | ||
var safe_event_emitter_provider_1 = require("./safe-event-emitter-provider"); | ||
Object.defineProperty(exports, "SafeEventEmitterProvider", { enumerable: true, get: function () { return safe_event_emitter_provider_1.SafeEventEmitterProvider; } }); | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk5M2DPAVJjs = require('./chunk-5M2DPAVJ.js'); | ||
var _chunkYCKILYCRjs = require('./chunk-YCKILYCR.js'); | ||
var _chunkS7F3T5RGjs = require('./chunk-S7F3T5RG.js'); | ||
exports.SafeEventEmitterProvider = _chunkS7F3T5RGjs.SafeEventEmitterProvider; exports.providerFromEngine = _chunkYCKILYCRjs.providerFromEngine; exports.providerFromMiddleware = _chunk5M2DPAVJjs.providerFromMiddleware; | ||
//# sourceMappingURL=index.js.map |
@@ -1,15 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.providerFromEngine = void 0; | ||
const safe_event_emitter_provider_1 = require("./safe-event-emitter-provider"); | ||
/** | ||
* Construct an Ethereum provider from the given JSON-RPC engine. | ||
* | ||
* @param engine - The JSON-RPC engine to construct a provider from. | ||
* @returns An Ethereum provider. | ||
*/ | ||
function providerFromEngine(engine) { | ||
return new safe_event_emitter_provider_1.SafeEventEmitterProvider({ engine }); | ||
} | ||
exports.providerFromEngine = providerFromEngine; | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkYCKILYCRjs = require('./chunk-YCKILYCR.js'); | ||
require('./chunk-S7F3T5RG.js'); | ||
exports.providerFromEngine = _chunkYCKILYCRjs.providerFromEngine; | ||
//# sourceMappingURL=provider-from-engine.js.map |
@@ -1,19 +0,9 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.providerFromMiddleware = void 0; | ||
const json_rpc_engine_1 = require("@metamask/json-rpc-engine"); | ||
const provider_from_engine_1 = require("./provider-from-engine"); | ||
/** | ||
* Construct an Ethereum provider from the given middleware. | ||
* | ||
* @param middleware - The middleware to construct a provider from. | ||
* @returns An Ethereum provider. | ||
*/ | ||
function providerFromMiddleware(middleware) { | ||
const engine = new json_rpc_engine_1.JsonRpcEngine(); | ||
engine.push(middleware); | ||
const provider = (0, provider_from_engine_1.providerFromEngine)(engine); | ||
return provider; | ||
} | ||
exports.providerFromMiddleware = providerFromMiddleware; | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk5M2DPAVJjs = require('./chunk-5M2DPAVJ.js'); | ||
require('./chunk-YCKILYCR.js'); | ||
require('./chunk-S7F3T5RG.js'); | ||
exports.providerFromMiddleware = _chunk5M2DPAVJjs.providerFromMiddleware; | ||
//# sourceMappingURL=provider-from-middleware.js.map |
@@ -1,77 +0,7 @@ | ||
"use strict"; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var _SafeEventEmitterProvider_engine; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SafeEventEmitterProvider = void 0; | ||
const safe_event_emitter_1 = __importDefault(require("@metamask/safe-event-emitter")); | ||
/** | ||
* An Ethereum provider. | ||
* | ||
* This provider loosely follows conventions that pre-date EIP-1193. | ||
* It is not compliant with any Ethereum provider standard. | ||
*/ | ||
class SafeEventEmitterProvider extends safe_event_emitter_1.default { | ||
/** | ||
* Construct a SafeEventEmitterProvider from a JSON-RPC engine. | ||
* | ||
* @param options - Options. | ||
* @param options.engine - The JSON-RPC engine used to process requests. | ||
*/ | ||
constructor({ engine }) { | ||
super(); | ||
_SafeEventEmitterProvider_engine.set(this, void 0); | ||
/** | ||
* Send a provider request asynchronously. | ||
* | ||
* @param req - The request to send. | ||
* @param callback - A function that is called upon the success or failure of the request. | ||
*/ | ||
this.sendAsync = (req, | ||
// TODO: Replace `any` with type | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
callback) => { | ||
__classPrivateFieldGet(this, _SafeEventEmitterProvider_engine, "f").handle(req, callback); | ||
}; | ||
/** | ||
* Send a provider request asynchronously. | ||
* | ||
* This method serves the same purpose as `sendAsync`. It only exists for | ||
* legacy reasons. | ||
* | ||
* @deprecated Use `sendAsync` instead. | ||
* @param req - The request to send. | ||
* @param callback - A function that is called upon the success or failure of the request. | ||
*/ | ||
this.send = (req, | ||
// TODO: Replace `any` with type | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
callback) => { | ||
if (typeof callback !== 'function') { | ||
throw new Error('Must provide callback to "send" method.'); | ||
} | ||
__classPrivateFieldGet(this, _SafeEventEmitterProvider_engine, "f").handle(req, callback); | ||
}; | ||
__classPrivateFieldSet(this, _SafeEventEmitterProvider_engine, engine, "f"); | ||
if (engine.on) { | ||
engine.on('notification', (message) => { | ||
this.emit('data', null, message); | ||
}); | ||
} | ||
} | ||
} | ||
exports.SafeEventEmitterProvider = SafeEventEmitterProvider; | ||
_SafeEventEmitterProvider_engine = new WeakMap(); | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkS7F3T5RGjs = require('./chunk-S7F3T5RG.js'); | ||
exports.SafeEventEmitterProvider = _chunkS7F3T5RGjs.SafeEventEmitterProvider; | ||
//# sourceMappingURL=safe-event-emitter-provider.js.map |
{ | ||
"name": "@metamask/eth-json-rpc-provider", | ||
"version": "2.3.2", | ||
"version": "3.0.0", | ||
"description": "Create an Ethereum provider using a JSON-RPC engine or middleware", | ||
@@ -18,2 +18,11 @@ "keywords": [ | ||
"license": "ISC", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/types/index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "./dist/index.js", | ||
@@ -25,4 +34,3 @@ "types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc --project tsconfig.build.json", | ||
"build:clean": "rimraf dist && yarn build", | ||
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean", | ||
"build:docs": "typedoc", | ||
@@ -43,3 +51,3 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/eth-json-rpc-provider", | ||
"dependencies": { | ||
"@metamask/json-rpc-engine": "^7.3.2", | ||
"@metamask/json-rpc-engine": "^8.0.0", | ||
"@metamask/safe-event-emitter": "^3.0.0", | ||
@@ -46,0 +54,0 @@ "@metamask/utils": "^8.3.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75367
41
289
1
+ Added@metamask/json-rpc-engine@8.0.2(transitive)
- Removed@metamask/json-rpc-engine@7.3.3(transitive)