Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
912 changes: 912 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/subscriptions/eth.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Eth {
this._pollTimerId = null;
this._pollBlockNumber = this._pollBlockNumber.bind(this);

this._api.transport.on('close', () => {
this._api.provider.on('close', () => {
if (this.isStarted) {
this.start();
}
Expand Down Expand Up @@ -70,7 +70,7 @@ class Eth {
}
};

if (!this._api.transport.isConnected) {
if (!this._api.provider.isConnected) {
nextTimeout(500, true);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/subscriptions/eth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function stubApi (blockNumber) {

return {
_calls,
transport: {
provider: {
isConnected: true,
on: () => {}
},
Expand Down
2 changes: 1 addition & 1 deletion src/subscriptions/manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function newStub () {
const start = () => manager._updateSubscriptions(manager.__test, null, 'test');

const manager = new Manager({
transport: {
provider: {
isConnected: true,
on: sinon.stub()
}
Expand Down
4 changes: 2 additions & 2 deletions src/subscriptions/personal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Personal {
this._defaultAccount = this._defaultAccount.bind(this);
this._listAccounts = this._listAccounts.bind(this);

this._api.transport.on('close', () => {
this._api.provider.on('close', () => {
if (this.isStarted) {
this.start();
}
Expand Down Expand Up @@ -85,7 +85,7 @@ class Personal {
}
};

if (!this._api.transport.isConnected) {
if (!this._api.isConnected) {
nextTimeout(500);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/subscriptions/personal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ function stubApi (accounts, info) {

return {
_calls,
transport: {
isConnected: true,
provider: {
isConnected: true,
on: sinon.stub()
},
Expand Down
4 changes: 2 additions & 2 deletions src/subscriptions/signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Signer {

this._listRequests = this._listRequests.bind(this);

this._api.transport.on('close', () => {
this._api.provider.on('close', () => {
if (this.isStarted) {
this.start();
}
Expand Down Expand Up @@ -74,7 +74,7 @@ class Signer {
}
};

if (!this._api.transport.isConnected) {
if (!this._api.isConnected) {
nextTimeout(500, true);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/wei.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function _getUnitMultiplier (unit) {
throw new Error(`Unknown unit ${unit} passed to wei formatter`);
}

return 10 ** (position * 3);
return Math.pow(10, position * 3);
}

function fromWei (value, unit = 'ether') {
Expand Down
6 changes: 3 additions & 3 deletions src/util/wei.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const { _getUnitMultiplier, fromWei, toWei } = require('./wei');
describe('util/wei', () => {
describe('_getUnitMultiplier', () => {
it('returns 10^0 for wei', () => {
expect(_getUnitMultiplier('wei')).to.equal(10 ** 0);
expect(_getUnitMultiplier('wei')).to.equal(Math.pow(10, 0));
});

it('returns 10^15 for finney', () => {
expect(_getUnitMultiplier('finney')).to.equal(10 ** 15);
expect(_getUnitMultiplier('finney')).to.equal(Math.pow(10, 15));
});

it('returns 10^18 for ether', () => {
expect(_getUnitMultiplier('ether')).to.equal(10 ** 18);
expect(_getUnitMultiplier('ether')).to.equal(Math.pow(10, 18));
});

it('throws an error on invalid units', () => {
Expand Down