Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web3-core

Package Overview
Dependencies
Maintainers
2
Versions
489
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-core - npm Package Compare versions

Comparing version 1.2.11 to 1.3.0-rc.0

lib/extend.js

15

package.json
{
"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"
}

@@ -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
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc