Skip to content

Commit

Permalink
Merge branch '1.x' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kigawas committed Oct 12, 2020
2 parents 93ce3cb + 4615f2d commit c8feb11
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,7 @@ Released with 1.0.0-beta.37 code base.
## [Unreleased]

## [1.3.1]

### Removed

- Removed post-install script in `packages/web3`. Added documentation to root README (#3717)
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ If you are using the types in a `commonjs` module, like in a Node app, you just
....
```
## Trouble shooting and known issues.
### Web3 and Angular
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`
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)
Another variation of this problem was an issue opned on angular-cli: https://github.com/angular/angular-cli/issues/1548
## Documentation
Documentation can be found at [ReadTheDocs][docs].
Expand Down
20 changes: 10 additions & 10 deletions packages/web3-core-requestmanager/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RequestManager.prototype.setProvider = function (provider, net) {


// reset the old one before changing, if still connected
if(this.provider && this.provider.connected)
if (this.provider && this.provider.connected)
this.clearSubscriptions();

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

// notify all subscriptions about bad close conditions
this.provider.on('close', function close(event) {
if (!_this._isCleanCloseEvent(event) || _this._isIpcCloseError(event)){
if (!_this._isCleanCloseEvent(event) || _this._isIpcCloseError(event)) {
_this.subscriptions.forEach(function (subscription) {
subscription.callback(errors.ConnectionCloseError(event));
_this.subscriptions.delete(subscription.subscription.id);
});

if(_this.provider && _this.provider.emit){
if (_this.provider && _this.provider.emit) {
_this.provider.emit('error', errors.ConnectionCloseError(event));
}
}
if(_this.provider && _this.provider.emit){
if (_this.provider && _this.provider.emit) {
_this.provider.emit('end', event);
}
});
Expand All @@ -151,7 +151,7 @@ RequestManager.prototype.setProvider = function (provider, net) {
* @param {Function} callback
*/
RequestManager.prototype.send = function (data, callback) {
callback = callback || function () {};
callback = callback || function () { };

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

if (this.provider.request) {
const callbackRequest = callbackify(this.provider.request)
const callbackRequest = callbackify(this.provider.request.bind(this.provider))
const requestArgs = { method, params }
callbackRequest(requestArgs, callback);
} else if (this.provider.sendAsync) {
Expand Down Expand Up @@ -220,7 +220,7 @@ RequestManager.prototype.addSubscription = function (subscription, callback) {
}
);
} else {
throw new Error('The provider doesn\'t support subscriptions: '+ this.provider.constructor.name);
throw new Error('The provider doesn\'t support subscriptions: ' + this.provider.constructor.name);
}
};

Expand Down Expand Up @@ -273,7 +273,7 @@ RequestManager.prototype.clearSubscriptions = function (keepIsSyncing) {
}

// reset notification callbacks etc.
if(this.provider.reset)
if (this.provider.reset)
this.provider.reset();

return true
Expand Down Expand Up @@ -320,8 +320,8 @@ RequestManager.prototype._isIpcCloseError = function (event) {
*
*/
RequestManager.prototype._jsonrpcResultCallback = function (callback, payload) {
return function(err, result) {
if(result && result.id && payload.id !== result.id) {
return function (err, result) {
if (result && result.id && payload.id !== result.id) {
return callback(new Error(`Wrong response id ${result.id} (expected: ${payload.id}) in ${JSON.stringify(payload)}`));
}

Expand Down
17 changes: 0 additions & 17 deletions packages/web3/angular-patch.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"types": "types/index.d.ts",
"scripts": {
"tsc": "tsc -b tsconfig.json",
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types",
"postinstall": "node angular-patch.js"
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types"
},
"authors": [
{
Expand Down

0 comments on commit c8feb11

Please sign in to comment.