diff --git a/.eslintignore b/.eslintignore
index ef24bbc4ac4..cb12fd758ac 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -9,3 +9,4 @@ jest.config.js
jest.preprocessor.js
W3cWebsocket.js
packages/**/rollup.config.js
+angular-patch.js
diff --git a/docs/web3-eth-ens.rst b/docs/web3-eth-ens.rst
index 20e602087f0..10572f0046e 100644
--- a/docs/web3-eth-ens.rst
+++ b/docs/web3-eth-ens.rst
@@ -12,7 +12,7 @@ The ``web3.eth.ens`` functions let you interacting with Ens.
import Web3 from 'web3';
import {Ens} from 'web3-eth-ens';
- import {Accounts} from 'web3-eth-accounts;
+ import {Accounts} from 'web3-eth-accounts';
// "Web3.givenProvider" will be set if in an Ethereum supported browser.
const eth = new Ens(
@@ -388,7 +388,7 @@ Example
.. code-block:: javascript
- web3.eth.ens.getText('ethereum.eth', 'key).then((result) => {
+ web3.eth.ens.getText('ethereum.eth', 'key').then((result) => {
console.log(result);
});
> "0000000000000000000000000000000000000000000000000000000000000000"
diff --git a/docs/web3-eth-personal.rst b/docs/web3-eth-personal.rst
index ad03ac2154f..cd272a57789 100644
--- a/docs/web3-eth-personal.rst
+++ b/docs/web3-eth-personal.rst
@@ -84,7 +84,9 @@ sign
web3.eth.personal.sign(dataToSign, address, password [, callback])
-Signs data using a specific account.
+Signs data using a specific account. This data is before UTF-8 HEX decoded and enveloped as follows: ``"\x19Ethereum Signed Message:\n" + message.length + message``.
+
+
.. note:: Sending your account password over an unsecured HTTP RPC connection is highly unsecure.
diff --git a/docs/web3-shh.rst b/docs/web3-shh.rst
index e80176167fd..5e7b72b08b2 100644
--- a/docs/web3-shh.rst
+++ b/docs/web3-shh.rst
@@ -761,8 +761,7 @@ Example
.. code-block:: javascript
- const identities = [],
- subscription = null;
+ const identities = [];
Promise.all([
web3.shh.newSymKey().then((id) => {identities.push(id);}),
@@ -771,7 +770,7 @@ Example
]).then(() => {
// will receive also its own message send, below
- subscription = shh.subscribe("messages", {
+ const subscription = shh.subscribe("messages", {
symKeyID: identities[0],
topics: ['0xffaadd11']
}).on('data', console.log);
@@ -785,7 +784,7 @@ Example
payload: '0xffffffdddddd1122',
powTime: 3,
powTarget: 0.5
- }).then(hash => console.log(`Message with hash ${h} was successfuly sent`))
+ }).then(hash => console.log(`Message with hash ${hash} was successfuly sent`))
.catch(err => console.log("Error: ", err));
});
@@ -1023,5 +1022,3 @@ Example
"topic": "0x01020304",
"ttl": 50
},{...}]
-
-
diff --git a/packages/web3-bzz/types/index.d.ts b/packages/web3-bzz/types/index.d.ts
index 9d9ebb731eb..5d3d8844e10 100644
--- a/packages/web3-bzz/types/index.d.ts
+++ b/packages/web3-bzz/types/index.d.ts
@@ -17,6 +17,8 @@
* @date 2018
*/
+import {Buffer} from 'buffer';
+
export class Bzz {
constructor(provider: string | {});
diff --git a/packages/web3-core-method/src/methods/CallMethod.js b/packages/web3-core-method/src/methods/CallMethod.js
index e5e85f26d4b..65283ea88da 100644
--- a/packages/web3-core-method/src/methods/CallMethod.js
+++ b/packages/web3-core-method/src/methods/CallMethod.js
@@ -20,6 +20,7 @@
* @date 2018
*/
+import isFunction from 'lodash/isFunction';
import AbstractCallMethod from '../../lib/methods/AbstractCallMethod';
export default class CallMethod extends AbstractCallMethod {
@@ -42,6 +43,13 @@ export default class CallMethod extends AbstractCallMethod {
*/
beforeExecution(moduleInstance) {
this.parameters[0] = this.formatters.inputCallFormatter(this.parameters[0], moduleInstance);
+
+ // Optional second parameter 'defaultBlock' could also be the callback
+ if (isFunction(this.parameters[1])) {
+ this.callback = this.parameters[1];
+ this.parameters[1] = moduleInstance.defaultBlock;
+ }
+
this.parameters[1] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[1], moduleInstance);
}
}
diff --git a/packages/web3-core-method/src/methods/personal/NewAccountMethod.js b/packages/web3-core-method/src/methods/personal/NewAccountMethod.js
index 4d589512bc1..801ed78612d 100644
--- a/packages/web3-core-method/src/methods/personal/NewAccountMethod.js
+++ b/packages/web3-core-method/src/methods/personal/NewAccountMethod.js
@@ -30,7 +30,7 @@ export default class NewAccountMethod extends AbstractCallMethod {
* @constructor
*/
constructor(utils, formatters) {
- super('personal_newAccount', 0, utils, formatters);
+ super('personal_newAccount', 1, utils, formatters);
}
/**
diff --git a/packages/web3-core-method/tests/src/methods/CallMethodTest.js b/packages/web3-core-method/tests/src/methods/CallMethodTest.js
index 1367beb8a9c..129e7fa1ed9 100644
--- a/packages/web3-core-method/tests/src/methods/CallMethodTest.js
+++ b/packages/web3-core-method/tests/src/methods/CallMethodTest.js
@@ -44,4 +44,25 @@ describe('CallMethodTest', () => {
expect(formatters.inputCallFormatter).toHaveBeenCalledWith({}, {});
});
+
+ it('calls beforeExecution with a callback instead of the optional paramter and it calls the inputCallFormatter and inputDefaultBlockNumberFormatter', () => {
+ const callback = jest.fn();
+ method.parameters = [{}, callback];
+
+ formatters.inputCallFormatter.mockReturnValueOnce({empty: true});
+
+ formatters.inputDefaultBlockNumberFormatter.mockReturnValueOnce('0x0');
+
+ method.beforeExecution({defaultBlock: 'latest'});
+
+ expect(method.callback).toEqual(callback);
+
+ expect(method.parameters[0]).toEqual({empty: true});
+
+ expect(method.parameters[1]).toEqual('0x0');
+
+ expect(formatters.inputCallFormatter).toHaveBeenCalledWith({}, {defaultBlock: 'latest'});
+
+ expect(formatters.inputDefaultBlockNumberFormatter).toHaveBeenCalledWith('latest', {defaultBlock: 'latest'});
+ });
});
diff --git a/packages/web3-core-method/tests/src/methods/personal/NewAccountMethodTest.js b/packages/web3-core-method/tests/src/methods/personal/NewAccountMethodTest.js
index bb22737eb18..7ef1827c15b 100644
--- a/packages/web3-core-method/tests/src/methods/personal/NewAccountMethodTest.js
+++ b/packages/web3-core-method/tests/src/methods/personal/NewAccountMethodTest.js
@@ -20,7 +20,7 @@ describe('NewAccountMethodTest', () => {
expect(method.rpcMethod).toEqual('personal_newAccount');
- expect(method.parametersAmount).toEqual(0);
+ expect(method.parametersAmount).toEqual(1);
expect(method.utils).toEqual(Utils);
diff --git a/packages/web3-core/types/index.d.ts b/packages/web3-core/types/index.d.ts
index 85a298e2e3e..433d1794e52 100644
--- a/packages/web3-core/types/index.d.ts
+++ b/packages/web3-core/types/index.d.ts
@@ -17,6 +17,7 @@
* @date 2018
*/
+///
import * as net from 'net';
import {
BatchRequest,
@@ -123,6 +124,7 @@ export interface RLPEncodedTransaction {
}
export interface TransactionReceipt {
+ status: boolean;
transactionHash: string;
transactionIndex: number;
blockHash: string;
diff --git a/packages/web3-eth-accounts/src/Accounts.js b/packages/web3-eth-accounts/src/Accounts.js
index 3529567da1e..dc8dd904f2a 100644
--- a/packages/web3-eth-accounts/src/Accounts.js
+++ b/packages/web3-eth-accounts/src/Accounts.js
@@ -89,7 +89,7 @@ export default class Accounts extends AbstractWeb3Module {
_addAccountFunctions(account) {
// add sign functions
account.signTransaction = (tx, callback) => {
- return this.signTransaction(tx, account.privateKey, callback);
+ return this.signTransaction(tx, account.privateKey, callback).bind(this);
};
account.sign = (data) => {
diff --git a/packages/web3-eth-contract/src/models/AbiItemModel.js b/packages/web3-eth-contract/src/models/AbiItemModel.js
index a735518f3d6..303e5c9f549 100644
--- a/packages/web3-eth-contract/src/models/AbiItemModel.js
+++ b/packages/web3-eth-contract/src/models/AbiItemModel.js
@@ -32,6 +32,7 @@ export default class AbiItemModel {
this.abiItem = abiItem;
this.signature = this.abiItem.signature;
this.name = this.abiItem.name;
+ this.payable = this.abiItem.payable;
this.anonymous = this.abiItem.anonymous;
this.contractMethodParameters = [];
}
diff --git a/packages/web3-eth-contract/tests/src/models/AbiItemModelTest.js b/packages/web3-eth-contract/tests/src/models/AbiItemModelTest.js
index 572a1bea24f..df1b4757ee5 100644
--- a/packages/web3-eth-contract/tests/src/models/AbiItemModelTest.js
+++ b/packages/web3-eth-contract/tests/src/models/AbiItemModelTest.js
@@ -11,6 +11,7 @@ describe('AbiItemModelTest', () => {
signature: 'signature',
name: 'name',
anonymous: false,
+ payable: true,
type: 'function',
constant: true
};
diff --git a/packages/web3-eth-personal/types/index.d.ts b/packages/web3-eth-personal/types/index.d.ts
index ca600b125d0..c8d7faea7db 100644
--- a/packages/web3-eth-personal/types/index.d.ts
+++ b/packages/web3-eth-personal/types/index.d.ts
@@ -13,28 +13,55 @@
*/
/**
* @file index.d.ts
- * @author Huan Zhang
+ * @author Huan Zhang ,
+ * @author Josh Stevens
* @date 2018
*/
-import {Accounts} from 'web3-eth-accounts'
+import {Accounts} from 'web3-eth-accounts';
import {provider} from 'web3-providers';
import {AbstractWeb3Module, Providers, RLPEncodedTransaction, Transaction, Web3ModuleOptions} from 'web3-core';
export class Personal extends AbstractWeb3Module {
- constructor(
- provider: provider,
- accounts: Accounts,
- options?: Web3ModuleOptions
- );
+ constructor(provider: provider, accounts: Accounts, options?: Web3ModuleOptions);
newAccount(password: string, callback?: (error: Error, address: string) => void): Promise;
- sign(dataToSign: string, address: string, password: string, callback?: (error: Error, signature: string) => void): Promise;
+ sign(
+ dataToSign: string,
+ address: string,
+ password: string,
+ callback?: (error: Error, signature: string) => void
+ ): Promise;
- ecRecover(dataThatWasSigned: string, signature: string, callback?: (error: Error, address: string) => void): Promise;
+ ecRecover(
+ dataThatWasSigned: string,
+ signature: string,
+ callback?: (error: Error, address: string) => void
+ ): Promise;
- signTransaction(transation: Transaction, password: string, callback?: (error: Error, RLPEncodedTransaction: RLPEncodedTransaction) => void): Promise;
+ signTransaction(
+ transation: Transaction,
+ password: string,
+ callback?: (error: Error, RLPEncodedTransaction: RLPEncodedTransaction) => void
+ ): Promise;
- unlockAccount(address: string, password: string, unlockDuration: number, callback?: (error: Error) => void): Promise;
+ sendTransaction(
+ transation: Transaction,
+ password: string,
+ callback?: (error: Error, transactionHash: string) => void
+ ): Promise;
+
+ unlockAccount(
+ address: string,
+ password: string,
+ unlockDuration: number,
+ callback?: (error: Error) => void
+ ): Promise;
+
+ lockAccount(address: string, callback?: (error: Error, success: boolean) => void): Promise;
+
+ getAccounts(callback?: (error: Error, accounts: string[]) => void): Promise;
+
+ importRawKey(privateKey: string, password: string): Promise;
}
diff --git a/packages/web3-eth-personal/types/tests/personal-tests.ts b/packages/web3-eth-personal/types/tests/personal-tests.ts
index a582c73db42..7c9b5c4ac6c 100644
--- a/packages/web3-eth-personal/types/tests/personal-tests.ts
+++ b/packages/web3-eth-personal/types/tests/personal-tests.ts
@@ -13,20 +13,17 @@
*/
/**
* @file personal-tests.ts
- * @author Huan Zhang , Samuel Furter
+ * @author Huan Zhang
+ * @author Samuel Furter
+ * @author Josh Stevens
* @date 2018
*/
import {RLPEncodedTransaction} from 'web3-core';
import {Personal} from 'web3-eth-personal';
-import {HttpProvider} from 'web3-providers';
import {Accounts} from 'web3-eth-accounts';
-const personal = new Personal(
- 'http://localhost:7545',
- new Accounts('http://localhost:7545', {}),
- {}
-);
+const personal = new Personal('http://localhost:7545', new Accounts('http://localhost:7545'));
// $ExpectType Promise
personal.newAccount('test password');
@@ -36,7 +33,12 @@ personal.newAccount('test password', (error: Error, address: string) => {});
// $ExpectType Promise
personal.sign('Hello world', '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', 'test password!');
// $ExpectType Promise
-personal.sign('Hello world', '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', 'test password!', (error: Error, signature: string) => {});
+personal.sign(
+ 'Hello world',
+ '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
+ 'test password!',
+ (error: Error, signature: string) => {}
+);
// $ExpectType Promise
personal.ecRecover('Hello world', '0x30755ed65396facf86c53e6217c52b4daebe72aa');
@@ -67,9 +69,49 @@ personal.signTransaction(
},
'test password',
(error: Error, RLPEncodedTransaction: RLPEncodedTransaction) => {}
-)
+);
+
+// $ExpectType Promise
+personal.sendTransaction(
+ {
+ from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
+ gasPrice: '20000000000',
+ gas: '21000',
+ to: '0x3535353535353535353535353535353535353535',
+ value: '1000000000000000000',
+ data: ''
+ },
+ 'test password'
+);
+
+// $ExpectType Promise
+personal.sendTransaction(
+ {
+ from: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
+ gasPrice: '20000000000',
+ gas: '21000',
+ to: '0x3535353535353535353535353535353535353535',
+ value: '1000000000000000000',
+ data: ''
+ },
+ 'test password',
+ (error: Error, transactionHash: string) => {}
+);
// $ExpectType Promise
personal.unlockAccount('0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', 'test password!', 600);
// $ExpectType Promise
personal.unlockAccount('0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', 'test password!', 600, (error: Error) => {});
+
+// $ExpectType Promise
+personal.lockAccount('0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe');
+// $ExpectType Promise
+personal.lockAccount('0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', (error: Error, sucess: boolean) => {});
+
+// $ExpectType Promise
+personal.getAccounts();
+// $ExpectType Promise
+personal.getAccounts((error: Error, accounts: string[]) => {});
+
+// $ExpectType Promise
+personal.importRawKey('privateKey', 'blah2');
diff --git a/packages/web3-utils/package-lock.json b/packages/web3-utils/package-lock.json
index db04929b597..31e21a0ec7c 100644
--- a/packages/web3-utils/package-lock.json
+++ b/packages/web3-utils/package-lock.json
@@ -1,6 +1,8 @@
{
- "requires": true,
+ "name": "web3-utils",
+ "version": "1.0.0-beta.41",
"lockfileVersion": 1,
+ "requires": true,
"dependencies": {
"@babel/runtime": {
"version": "7.3.1",
@@ -10,25 +12,42 @@
"regenerator-runtime": "^0.12.0"
}
},
+ "@types/bn.js": {
+ "version": "4.11.4",
+ "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.4.tgz",
+ "integrity": "sha512-AO8WW+aRcKWKQAYTfKLzwnpL6U+TfPqS+haRrhCy5ff04Da8WZud3ZgVjspQXaEXJDcTlsjUEVvL39wegDek5w==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/node": {
"version": "10.12.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz",
"integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ=="
},
+ "@types/parsimmon": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.0.tgz",
+ "integrity": "sha512-bsTIJFVQv7jnvNiC42ld2pQW2KRI+pAG243L+iATvqzy3X6+NH1obz2itRKDZZ8VVhN3wjwYax/VBGCcXzgTqQ==",
+ "dev": true
+ },
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
- "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
@@ -37,6 +56,7 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
+ "dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
@@ -47,6 +67,7 @@
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
@@ -60,7 +81,8 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
},
"bn.js": {
"version": "4.11.8",
@@ -71,6 +93,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -89,12 +112,14 @@
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
- "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8="
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
@@ -105,6 +130,7 @@
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
"requires": {
"color-convert": "^1.9.0"
}
@@ -113,6 +139,7 @@
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
"requires": {
"has-flag": "^3.0.0"
}
@@ -123,6 +150,7 @@
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
"requires": {
"color-name": "1.1.3"
}
@@ -130,22 +158,26 @@
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
},
"commander": {
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
- "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg=="
+ "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
- "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
},
"crypto-js": {
"version": "3.1.9-1",
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz",
- "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg="
+ "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=",
+ "dev": true
},
"decode-uri-component": {
"version": "0.2.0",
@@ -160,10 +192,20 @@
"mimic-response": "^1.0.0"
}
},
+ "definitelytyped-header-parser": {
+ "version": "github:Microsoft/definitelytyped-header-parser#e0561530379dfa01324a89936b75d90b20df9bd2",
+ "from": "github:Microsoft/definitelytyped-header-parser#production",
+ "dev": true,
+ "requires": {
+ "@types/parsimmon": "^1.3.0",
+ "parsimmon": "^1.2.0"
+ }
+ },
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
- "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA=="
+ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
+ "dev": true
},
"dom-walk": {
"version": "0.1.1",
@@ -174,17 +216,13 @@
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/dtslint/-/dtslint-0.4.2.tgz",
"integrity": "sha512-ph4GXLw3HYzlQMJOFcpCqWHuL3MxJ/344OR7wn0wlQGchQGTIVNsSUl8iKEMatpy2geNMysgA9fQa6xVhHOkTQ==",
+ "dev": true,
"requires": {
+ "definitelytyped-header-parser": "github:Microsoft/definitelytyped-header-parser#e0561530379dfa01324a89936b75d90b20df9bd2",
"fs-extra": "^6.0.1",
"strip-json-comments": "^2.0.1",
"tslint": "^5.12.0",
"typescript": "^3.3.0-dev.20190126"
- },
- "dependencies": {
- "definitelytyped-header-parser": {
- "version": "github:Microsoft/definitelytyped-header-parser#e0561530379dfa01324a89936b75d90b20df9bd2",
- "from": "github:Microsoft/definitelytyped-header-parser#e0561530379dfa01324a89936b75d90b20df9bd2"
- }
}
},
"elliptic": {
@@ -204,17 +242,20 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
- "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
- "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
+ "dev": true
},
"eth-lib": {
"version": "0.2.8",
@@ -254,6 +295,7 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
"integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
+ "dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
@@ -263,12 +305,14 @@
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
- "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@@ -290,12 +334,14 @@
"graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
- "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -303,7 +349,8 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
},
"hash.js": {
"version": "1.1.7",
@@ -328,6 +375,7 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
@@ -356,12 +404,14 @@
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
- "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
+ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
+ "dev": true
},
"js-yaml": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz",
"integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==",
+ "dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
@@ -371,6 +421,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
@@ -407,6 +458,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -449,15 +501,23 @@
"trim": "0.0.1"
}
},
+ "parsimmon": {
+ "version": "1.12.0",
+ "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.12.0.tgz",
+ "integrity": "sha512-uC/BjuSfb4jfaWajKCp1mVncXXq+V1twbcYChbTxN3GM7fn+8XoHwUdvUz+PTaFtDSCRQxU8+Rnh+iMhAkVwdw==",
+ "dev": true
+ },
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
- "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
- "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "dev": true
},
"process": {
"version": "0.5.2",
@@ -488,6 +548,7 @@
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
+ "dev": true,
"requires": {
"path-parse": "^1.0.6"
}
@@ -495,7 +556,8 @@
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
- "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg=="
+ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
+ "dev": true
},
"simple-concat": {
"version": "1.0.0",
@@ -515,7 +577,8 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
- "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
},
"strict-uri-encode": {
"version": "1.1.0",
@@ -526,6 +589,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -541,12 +605,14 @@
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
- "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "dev": true
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
- "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true
},
"timed-out": {
"version": "4.0.1",
@@ -561,12 +627,14 @@
"tslib": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
- "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",
+ "dev": true
},
"tslint": {
"version": "5.12.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.1.tgz",
"integrity": "sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw==",
+ "dev": true,
"requires": {
"babel-code-frame": "^6.22.0",
"builtin-modules": "^1.1.1",
@@ -586,6 +654,7 @@
"version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
+ "dev": true,
"requires": {
"tslib": "^1.8.1"
}
@@ -593,12 +662,14 @@
"typescript": {
"version": "3.3.0-dev.20190126",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.0-dev.20190126.tgz",
- "integrity": "sha512-wx5ZIi0Dn61N/H+TDLQIyG+DPvtk46t/lHeKmu2jwk5sW7GIPjVRPUJ5AR9ohdSkV0pEUshZolWSABz5f1pTAA=="
+ "integrity": "sha512-wx5ZIi0Dn61N/H+TDLQIyG+DPvtk46t/lHeKmu2jwk5sW7GIPjVRPUJ5AR9ohdSkV0pEUshZolWSABz5f1pTAA==",
+ "dev": true
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
- "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true
},
"url-set-query": {
"version": "1.0.0",
diff --git a/packages/web3-utils/package.json b/packages/web3-utils/package.json
index 3b029d14eaa..615cbe4c5d6 100644
--- a/packages/web3-utils/package.json
+++ b/packages/web3-utils/package.json
@@ -17,6 +17,7 @@
"types": "types",
"dependencies": {
"@babel/runtime": "^7.3.1",
+ "@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
diff --git a/packages/web3-utils/src/index.js b/packages/web3-utils/src/index.js
index c825c5913ea..7865e1f80c3 100644
--- a/packages/web3-utils/src/index.js
+++ b/packages/web3-utils/src/index.js
@@ -28,7 +28,7 @@ import * as utils from './Utils';
import * as ethjsUnit from 'ethjs-unit';
export {soliditySha3} from './SoliditySha3';
-export {randomHex} from 'randomhex';
+export randomHex from 'randomhex';
/**
* Should be used to create full function/event name from json abi
diff --git a/packages/web3-utils/types/index.d.ts b/packages/web3-utils/types/index.d.ts
index aa8391bb3ad..d767a5a6603 100644
--- a/packages/web3-utils/types/index.d.ts
+++ b/packages/web3-utils/types/index.d.ts
@@ -20,7 +20,8 @@
* @date 2018
*/
-import BigNumber from 'bn.js';
+import BigNumber = require('bn.js');
+import {Buffer} from 'buffer';
export type Unit =
| 'noether'
diff --git a/packages/web3/angular-patch.js b/packages/web3/angular-patch.js
new file mode 100644
index 00000000000..3a76568e4cd
--- /dev/null
+++ b/packages/web3/angular-patch.js
@@ -0,0 +1,17 @@
+const fs = require('fs');
+const f = '../../node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js';
+
+// This is because we have to replace the `node:false` in the `/angular-cli-files/models/webpack-configs/browser.js`
+// with `node: {crypto: true, stream: true}` to allow web3 to work with angular (as they enforce node: false.)
+// as explained here - https://github.com/ethereum/web3.js/issues/2260#issuecomment-458519127
+if (fs.existsSync(f)) {
+ fs.readFile(f, 'utf8', function(err, data) {
+ if (err) {
+ return console.log(err);
+ }
+ var result = data.replace(/node: false/g, 'node: {crypto: true, stream: true}');
+ fs.writeFile(f, result, 'utf8', function(err) {
+ if (err) return console.log(err);
+ });
+ });
+}
diff --git a/packages/web3/package.json b/packages/web3/package.json
index ba2907609c7..7b9b8f944c8 100644
--- a/packages/web3/package.json
+++ b/packages/web3/package.json
@@ -17,8 +17,7 @@
"API"
],
"author": "ethereum.org",
- "authors": [
- {
+ "authors": [{
"name": "Samuel Furter",
"email": "samuel@ethereum.org",
"homepage": "https://github.com/nivida"
@@ -52,7 +51,8 @@
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "jest",
- "dtslint": "dtslint types --onlyTestTsNext"
+ "dtslint": "dtslint types --onlyTestTsNext",
+ "postinstall": "node angular-patch.js"
},
"types": "types",
"dependencies": {