ethers-providers
Advanced tools
Comparing version 2.1.8 to 2.1.9
@@ -17,14 +17,14 @@ 'use strict'; | ||
for (var i = 1; i < providers.length; i++) { | ||
if (providers[0].chainId !== providers[i].chainId) { | ||
throw new Error('incompatible providers - chainId mismatch'); | ||
var network = {}; | ||
['chainId', 'ensAddress', 'name', 'testnet'].forEach(function(key) { | ||
for (var i = 1; i < providers.length; i++) { | ||
if (providers[0][key] !== providers[i][key]) { | ||
throw new Error('incompatible providers - ' + key + ' mismatch'); | ||
} | ||
} | ||
network[key] = providers[0][key]; | ||
}); | ||
if (providers[0].testnet !== providers[i].testnet) { | ||
throw new Error('incompatible providers - testnet mismatch'); | ||
} | ||
} | ||
if (!(this instanceof FallbackProvider)) { throw new Error('missing new'); } | ||
Provider.call(this, providers[0].testnet, providers[0].chainId); | ||
Provider.call(this, network); | ||
@@ -31,0 +31,0 @@ providers = providers.slice(0); |
@@ -15,11 +15,5 @@ 'use strict'; | ||
// Legacy constructor (testnet, chainId, apiAccessToken) | ||
// Legacy constructor (testnet, apiAccessToken) | ||
// @TODO: Remove this in the next major release | ||
if (arguments.length === 3) { | ||
apiAccessToken = arguments[2]; | ||
network = Provider._legacyConstructor(network, 2, arguments[0], arguments[1]); | ||
} else { | ||
apiAccessToken = null; | ||
network = Provider._legacyConstructor(network, arguments.length, arguments[0], arguments[1]); | ||
} | ||
network = Provider._legacyConstructor(network, 1, arguments[0]); | ||
@@ -26,0 +20,0 @@ var host = null; |
@@ -54,6 +54,27 @@ 'use strict'; | ||
network = Provider._legacyConstructor(network, arguments.length - 1, arguments[1], arguments[2]); | ||
// Legacy Contructor (url, [ testnet, [ chainId ] ]) | ||
// @TODO: Remove this in the next major version | ||
Provider.call(this, network); | ||
var args = []; | ||
// Legacy without a url | ||
if (typeof(url) !== 'string' || Provider.networks[url] != null) { | ||
// url => network | ||
args.push(url); | ||
// network => chainId | ||
if (network != null) { args.push(network); } | ||
url = null; | ||
} else if (arguments.length === 2) { | ||
args.push(arguments[1]); | ||
} else if (arguments.length === 3) { | ||
args.push(arguments[1]); | ||
args.push(arguments[2]); | ||
} | ||
Provider.apply(this, args); | ||
if (!url) { url = 'http://localhost:8545'; } | ||
@@ -60,0 +81,0 @@ |
{ | ||
"name": "ethers-providers", | ||
"version": "2.1.8", | ||
"version": "2.1.9", | ||
"description": "Service provider for Ethereum wallet library.", | ||
@@ -5,0 +5,0 @@ "bugs": { |
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
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
50104
1300