From a89aae905cca5ca76d7f415a0ee440030538c678 Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Mon, 7 Dec 2020 16:12:27 -0800 Subject: [PATCH] @metamask/safe-event-emitter (#125) Co-authored-by: Dan Finlay <542863+danfinlay@users.noreply.github.com> --- package.json | 4 ++-- src/MetaMaskInpageProvider.js | 2 +- src/utils.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a08a7a5e..ba912b4f 100644 --- a/package.json +++ b/package.json @@ -32,14 +32,14 @@ "index.d.ts" ], "dependencies": { + "@metamask/safe-event-emitter": "^2.0.0", "eth-rpc-errors": "^4.0.2", "fast-deep-equal": "^2.0.1", "is-stream": "^2.0.0", "json-rpc-engine": "^6.1.0", "json-rpc-middleware-stream": "^2.1.1", "obj-multiplex": "^1.0.0", - "pump": "^3.0.0", - "safe-event-emitter": "^1.0.1" + "pump": "^3.0.0" }, "devDependencies": { "@metamask/eslint-config": "^4.1.0", diff --git a/src/MetaMaskInpageProvider.js b/src/MetaMaskInpageProvider.js index 98695e25..f060c186 100644 --- a/src/MetaMaskInpageProvider.js +++ b/src/MetaMaskInpageProvider.js @@ -2,7 +2,7 @@ const pump = require('pump') const { JsonRpcEngine, createIdRemapMiddleware } = require('json-rpc-engine') const createJsonRpcStream = require('json-rpc-middleware-stream') const ObjectMultiplex = require('obj-multiplex') -const SafeEventEmitter = require('safe-event-emitter') +const { default: SafeEventEmitter } = require('@metamask/safe-event-emitter') const dequal = require('fast-deep-equal') const { ethErrors, EthereumRpcError } = require('eth-rpc-errors') const { duplex: isDuplex } = require('is-stream') diff --git a/src/utils.js b/src/utils.js index d22848b6..40db5a6f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -48,7 +48,7 @@ const getRpcPromiseCallback = (resolve, reject, unwrapResult = true) => (error, * @param {typeof console} log - The logging API to use. * @param {string} remoteLabel - The label of the disconnected stream. * @param {Error} [err] - The associated error to log. - * @param {import('safe-event-emitter')} [emitter] - The logging API to use. + * @param {import('@metamask/safe-event-emitter').default} [emitter] - The logging API to use. */ function logStreamDisconnectWarning (log, remoteLabel, err, emitter) { let warningMsg = `MetaMask: Lost connection to "${remoteLabel}".`