web3-core
Advanced tools
Comparing version 1.2.11 to 1.3.0-rc.0
{ | ||
"name": "web3-core", | ||
"version": "1.2.11", | ||
"version": "1.3.0-rc.0", | ||
"description": "Web3 core tools for sub-packages. This is an internal package.", | ||
@@ -12,5 +12,6 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-core", | ||
"scripts": { | ||
"tsc": "tsc -b tsconfig.json", | ||
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types" | ||
}, | ||
"main": "src/index.js", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
@@ -20,6 +21,6 @@ "@types/bn.js": "^4.11.5", | ||
"bignumber.js": "^9.0.0", | ||
"web3-core-helpers": "1.2.11", | ||
"web3-core-method": "1.2.11", | ||
"web3-core-requestmanager": "1.2.11", | ||
"web3-utils": "1.2.11" | ||
"web3-core-helpers": "1.3.0-rc.0", | ||
"web3-core-method": "1.3.0-rc.0", | ||
"web3-core-requestmanager": "1.3.0-rc.0", | ||
"web3-utils": "1.3.0-rc.0" | ||
}, | ||
@@ -30,3 +31,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "87e668275ac7d9b8af7c909137fc0626c3866929" | ||
"gitHead": "83c9f65c7cb3b4f4532f890ec5a3608fd1879e35" | ||
} |
105
src/index.js
@@ -23,65 +23,66 @@ /* | ||
"use strict"; | ||
const requestManager = require("web3-core-requestmanager"); | ||
const extend = require("./extend"); | ||
const packageInit = (pkg, args) => { | ||
args = Array.prototype.slice.call(args); | ||
var requestManager = require('web3-core-requestmanager'); | ||
var extend = require('./extend.js'); | ||
if (!pkg) { | ||
throw new Error('You need to instantiate using the "new" keyword.'); | ||
} | ||
module.exports = { | ||
packageInit: function (pkg, args) { | ||
args = Array.prototype.slice.call(args); | ||
// make property of pkg._provider, which can properly set providers | ||
Object.defineProperty(pkg, 'currentProvider', { | ||
get: () => { | ||
return pkg._provider; | ||
}, | ||
set: (value) => { | ||
return pkg.setProvider(value); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
if (!pkg) { | ||
throw new Error('You need to instantiate using the "new" keyword.'); | ||
} | ||
// inherit from parent package or create a new RequestManager | ||
if (args[0] && args[0]._requestManager) { | ||
pkg._requestManager = args[0]._requestManager; | ||
} else { | ||
pkg._requestManager = new requestManager.Manager(args[0], args[1]); | ||
} | ||
// make property of pkg._provider, which can properly set providers | ||
Object.defineProperty(pkg, 'currentProvider', { | ||
get: function () { | ||
return pkg._provider; | ||
}, | ||
set: function (value) { | ||
return pkg.setProvider(value); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
// add givenProvider | ||
pkg.givenProvider = requestManager.Manager.givenProvider; | ||
pkg.providers = requestManager.Manager.providers; | ||
// inherit from parent package or create a new RequestManager | ||
if (args[0] && args[0]._requestManager) { | ||
pkg._requestManager = args[0]._requestManager; | ||
} else { | ||
pkg._requestManager = new requestManager.Manager(args[0], args[1]); | ||
} | ||
pkg._provider = pkg._requestManager.provider; | ||
// add givenProvider | ||
pkg.givenProvider = requestManager.Manager.givenProvider; | ||
pkg.providers = requestManager.Manager.providers; | ||
// add SETPROVIDER function (don't overwrite if already existing) | ||
if (!pkg.setProvider) { | ||
pkg.setProvider = (provider, net) => { | ||
pkg._requestManager.setProvider(provider, net); | ||
pkg._provider = pkg._requestManager.provider; | ||
return true; | ||
}; | ||
} | ||
pkg._provider = pkg._requestManager.provider; | ||
pkg.setRequestManager = (manager) => { | ||
pkg._requestManager = manager; | ||
pkg._provider = manager.provider; | ||
}; | ||
// add SETPROVIDER function (don't overwrite if already existing) | ||
if (!pkg.setProvider) { | ||
pkg.setProvider = function (provider, net) { | ||
pkg._requestManager.setProvider(provider, net); | ||
pkg._provider = pkg._requestManager.provider; | ||
return true; | ||
}; | ||
} | ||
// attach batch request creation | ||
pkg.BatchRequest = requestManager.BatchManager.bind(null, pkg._requestManager); | ||
pkg.setRequestManager = function(manager) { | ||
pkg._requestManager = manager; | ||
pkg._provider = manager.provider; | ||
}; | ||
// attach extend function | ||
pkg.extend = extend(pkg); | ||
} | ||
// attach batch request creation | ||
pkg.BatchRequest = requestManager.BatchManager.bind(null, pkg._requestManager); | ||
const addProviders = (pkg) => { | ||
pkg.givenProvider = requestManager.Manager.givenProvider; | ||
pkg.providers = requestManager.Manager.providers; | ||
} | ||
// attach extend function | ||
pkg.extend = extend(pkg); | ||
}, | ||
addProviders: function (pkg) { | ||
pkg.givenProvider = requestManager.Manager.givenProvider; | ||
pkg.providers = requestManager.Manager.providers; | ||
} | ||
}; | ||
module.exports = { | ||
packageInit, | ||
addProviders | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
23725
11
646
2
1
29
243
+ Addedoboe@2.1.5(transitive)
+ Addedweb3-core-helpers@1.3.0-rc.0(transitive)
+ Addedweb3-core-method@1.3.0-rc.0(transitive)
+ Addedweb3-core-promievent@1.3.0-rc.0(transitive)
+ Addedweb3-core-requestmanager@1.3.0-rc.0(transitive)
+ Addedweb3-core-subscriptions@1.3.0-rc.0(transitive)
+ Addedweb3-eth-iban@1.3.0-rc.0(transitive)
+ Addedweb3-providers-http@1.3.0-rc.0(transitive)
+ Addedweb3-providers-ipc@1.3.0-rc.0(transitive)
+ Addedweb3-providers-ws@1.3.0-rc.0(transitive)
+ Addedweb3-utils@1.3.0-rc.0(transitive)
- Removedoboe@2.1.4(transitive)
- Removedweb3-core-helpers@1.2.11(transitive)
- Removedweb3-core-method@1.2.11(transitive)
- Removedweb3-core-promievent@1.2.11(transitive)
- Removedweb3-core-requestmanager@1.2.11(transitive)
- Removedweb3-core-subscriptions@1.2.11(transitive)
- Removedweb3-eth-iban@1.2.11(transitive)
- Removedweb3-providers-http@1.2.11(transitive)
- Removedweb3-providers-ipc@1.2.11(transitive)
- Removedweb3-providers-ws@1.2.11(transitive)
- Removedweb3-utils@1.2.11(transitive)
Updatedweb3-core-helpers@1.3.0-rc.0
Updatedweb3-core-method@1.3.0-rc.0
Updatedweb3-utils@1.3.0-rc.0