From 38f879beb07da6007622f6525433d72002424ace Mon Sep 17 00:00:00 2001 From: Yathartha Goenka Date: Mon, 30 Jan 2023 20:08:37 +0530 Subject: [PATCH] Added check for options type while creating network --- lib/protocol/network.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/protocol/network.js b/lib/protocol/network.js index 62e8fdb8c..03f654974 100644 --- a/lib/protocol/network.js +++ b/lib/protocol/network.js @@ -131,9 +131,12 @@ class Network { static create(options) { if (typeof options === 'string') options = networks[options]; - + + if(options instanceof Object) + assert(!options.type, 'Unknown network.'); + assert(options, 'Unknown network.'); - + if (Network[options.type]) return Network[options.type];