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

web3-eth-accounts

Package Overview
Dependencies
Maintainers
1
Versions
479
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-eth-accounts - npm Package Compare versions

Comparing version 1.0.0-beta.11 to 1.0.0-beta.12

8

package.json
{
"name": "web3-eth-accounts",
"version": "1.0.0-beta.11",
"version": "1.0.0-beta.12",
"description": "Web3 module to generate Ethereum accounts and sign data and transactions.",

@@ -14,5 +14,7 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-accounts",

"uuid": "2.0.1",
"web3-core-helpers": "^1.0.0-beta.11",
"web3-utils": "^1.0.0-beta.11"
"web3-core": "^1.0.0-beta.12",
"web3-core-helpers": "^1.0.0-beta.12",
"web3-core-method": "^1.0.0-beta.12",
"web3-utils": "^1.0.0-beta.12"
}
}

@@ -32,8 +32,5 @@ # web3-eth-accounts

// in node.js
var Eth = require('web3-eth');
var Web3EthAccounts = require('web3-eth-accounts');
var eth = new Eth('ws://localhost:8546');
var account = new Web3EthAccounts(eth);
var account = new Web3EthAccounts('ws://localhost:8546');
account.create();

@@ -40,0 +37,0 @@ > {

@@ -26,2 +26,4 @@ /*

var _ = require("underscore");
var core = require('web3-core');
var Method = require('web3-core-method');
var Promise = require('bluebird');

@@ -41,7 +43,45 @@ var Account = require("eth-lib/src/account");

var Accounts = function Accounts(eth) {
var Accounts = function Accounts() {
var _this = this;
if (eth) {
this.eth = (eth.eth) ? eth.eth : eth;
}
// sets _requestmanager
core.packageInit(this, arguments);
// remove unecessary core functions
delete this.BatchRequest;
delete this.extend;
var _ethereumCall = [
new Method({
name: 'getId',
call: 'net_version',
params: 0,
outputFormatter: utils.hexToNumber
}),
new Method({
name: 'getGasPrice',
call: 'eth_gasPrice',
params: 0
}),
new Method({
name: 'getTransactionCount',
call: 'eth_getTransactionCount',
params: 2,
inputFormatter: [function (address) {
if (utils.isAddress(address)) {
return address;
} else {
throw new Error('Address '+ address +' is not a valid address to get the "transactionCount".');
}
}, function () { return 'latest'; }]
})
];
// attach methods to this._ethereumCall
this._ethereumCall = {};
_.each(_ethereumCall, function (method) {
method.attachToObject(_this._ethereumCall);
method.setRequestManager(_this._requestManager);
});
this.wallet = new Wallet(this);

@@ -119,11 +159,8 @@ };

if (!_this || !_this.eth || !_this.eth.net) {
return Promise.reject(new Error('The Eth package is set bound. Please set using "accounts.eth = eth", or provide "nonce", "chainId" and "gasPrice" in the transaction yourself.'));
}
// Otherwise, get the missing info from the Ethereum Node
return Promise.all([
isNot(tx.chainId) ? _this.eth.net.getId() : tx.chainId,
isNot(tx.gasPrice) ? _this.eth.getGasPrice() : tx.gasPrice,
isNot(tx.nonce) ? _this.eth.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce
isNot(tx.chainId) ? _this._ethereumCall.getId() : tx.chainId,
isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice,
isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce
]).then(function (args) {

@@ -130,0 +167,0 @@ if (isNot(args[0]) || isNot(args[1]) || isNot(args[2])) {

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