From 7715aff90b952d0c8aa7a3c37a0333d83471bca6 Mon Sep 17 00:00:00 2001 From: David Van Isacker Date: Sun, 25 Feb 2018 03:28:41 +0900 Subject: [PATCH] Update error message in SignerProvider constructor The error message refers to and checks the type of options.privateKey while it should be checking for options.signTransaction. --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index a27bd9a..9f18a87 100644 --- a/src/index.js +++ b/src/index.js @@ -13,8 +13,8 @@ module.exports = SignerProvider; */ function SignerProvider(path, options) { if (!(this instanceof SignerProvider)) { throw new Error('[ethjs-provider-signer] the SignerProvider instance requires the "new" flag in order to function normally (e.g. `const eth = new Eth(new SignerProvider(...));`).'); } - if (typeof options !== 'object') { throw new Error(`[ethjs-provider-signer] the SignerProvider requires an options object be provided with the 'privateKey' property specified, you provided type ${typeof options}.`); } - if (typeof options.signTransaction !== 'function') { throw new Error(`[ethjs-provider-signer] the SignerProvider requires an options object be provided with the 'signTransaction' property specified, you provided type ${typeof options.privateKey} (e.g. 'const eth = new Eth(new SignerProvider("http://ropsten.infura.io", { privateKey: (account, cb) => cb(null, 'some private key') }));').`); } + if (typeof options !== 'object') { throw new Error(`[ethjs-provider-signer] the SignerProvider requires an options object be provided with the 'signTransaction' property specified, you provided type ${typeof options}.`); } + if (typeof options.signTransaction !== 'function') { throw new Error(`[ethjs-provider-signer] the SignerProvider requires an options object be provided with the 'signTransaction' property specified, you provided type ${typeof options.signTransaction} (e.g. 'const eth = new Eth(new SignerProvider("http://ropsten.infura.io", { signTransaction: (account, cb) => cb(null, 'some private key') }));').`); } const self = this; self.options = Object.assign({