Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit c8feb11

Browse files
authored
Merge branch '1.x' into patch-1
2 parents 93ce3cb + 4615f2d commit c8feb11

File tree

5 files changed

+24
-29
lines changed

5 files changed

+24
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,7 @@ Released with 1.0.0-beta.37 code base.
289289
## [Unreleased]
290290

291291
## [1.3.1]
292+
293+
### Removed
294+
295+
- Removed post-install script in `packages/web3`. Added documentation to root README (#3717)

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ If you are using the types in a `commonjs` module, like in a Node app, you just
101101
....
102102
```
103103
104+
## Trouble shooting and known issues.
105+
106+
### Web3 and Angular
107+
If you are using Ionic/Angular at a version >5 you may run into a build error in which modules `crypto` and `stream` are `undefined`
108+
109+
a work around for this is to go into your node-modules and at `/angular-cli-files/models/webpack-configs/browser.js` change the `node: false` to `node: {crypto: true, stream: true}` as mentioned [here](https://github.com/ethereum/web3.js/issues/2260#issuecomment-458519127)
110+
111+
Another variation of this problem was an issue opned on angular-cli: https://github.com/angular/angular-cli/issues/1548
112+
104113
## Documentation
105114
106115
Documentation can be found at [ReadTheDocs][docs].

packages/web3-core-requestmanager/src/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ RequestManager.prototype.setProvider = function (provider, net) {
9191

9292

9393
// reset the old one before changing, if still connected
94-
if(this.provider && this.provider.connected)
94+
if (this.provider && this.provider.connected)
9595
this.clearSubscriptions();
9696

9797
this.provider = provider || null;
@@ -123,17 +123,17 @@ RequestManager.prototype.setProvider = function (provider, net) {
123123

124124
// notify all subscriptions about bad close conditions
125125
this.provider.on('close', function close(event) {
126-
if (!_this._isCleanCloseEvent(event) || _this._isIpcCloseError(event)){
126+
if (!_this._isCleanCloseEvent(event) || _this._isIpcCloseError(event)) {
127127
_this.subscriptions.forEach(function (subscription) {
128128
subscription.callback(errors.ConnectionCloseError(event));
129129
_this.subscriptions.delete(subscription.subscription.id);
130130
});
131131

132-
if(_this.provider && _this.provider.emit){
132+
if (_this.provider && _this.provider.emit) {
133133
_this.provider.emit('error', errors.ConnectionCloseError(event));
134134
}
135135
}
136-
if(_this.provider && _this.provider.emit){
136+
if (_this.provider && _this.provider.emit) {
137137
_this.provider.emit('end', event);
138138
}
139139
});
@@ -151,7 +151,7 @@ RequestManager.prototype.setProvider = function (provider, net) {
151151
* @param {Function} callback
152152
*/
153153
RequestManager.prototype.send = function (data, callback) {
154-
callback = callback || function () {};
154+
callback = callback || function () { };
155155

156156
if (!this.provider) {
157157
return callback(errors.InvalidProvider());
@@ -163,7 +163,7 @@ RequestManager.prototype.send = function (data, callback) {
163163
const jsonrpcResultCallback = this._jsonrpcResultCallback(callback, jsonrpcPayload)
164164

165165
if (this.provider.request) {
166-
const callbackRequest = callbackify(this.provider.request)
166+
const callbackRequest = callbackify(this.provider.request.bind(this.provider))
167167
const requestArgs = { method, params }
168168
callbackRequest(requestArgs, callback);
169169
} else if (this.provider.sendAsync) {
@@ -220,7 +220,7 @@ RequestManager.prototype.addSubscription = function (subscription, callback) {
220220
}
221221
);
222222
} else {
223-
throw new Error('The provider doesn\'t support subscriptions: '+ this.provider.constructor.name);
223+
throw new Error('The provider doesn\'t support subscriptions: ' + this.provider.constructor.name);
224224
}
225225
};
226226

@@ -273,7 +273,7 @@ RequestManager.prototype.clearSubscriptions = function (keepIsSyncing) {
273273
}
274274

275275
// reset notification callbacks etc.
276-
if(this.provider.reset)
276+
if (this.provider.reset)
277277
this.provider.reset();
278278

279279
return true
@@ -320,8 +320,8 @@ RequestManager.prototype._isIpcCloseError = function (event) {
320320
*
321321
*/
322322
RequestManager.prototype._jsonrpcResultCallback = function (callback, payload) {
323-
return function(err, result) {
324-
if(result && result.id && payload.id !== result.id) {
323+
return function (err, result) {
324+
if (result && result.id && payload.id !== result.id) {
325325
return callback(new Error(`Wrong response id ${result.id} (expected: ${payload.id}) in ${JSON.stringify(payload)}`));
326326
}
327327

packages/web3/angular-patch.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/web3/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"types": "types/index.d.ts",
2121
"scripts": {
2222
"tsc": "tsc -b tsconfig.json",
23-
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types",
24-
"postinstall": "node angular-patch.js"
23+
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types"
2524
},
2625
"authors": [
2726
{

0 commit comments

Comments
 (0)