aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-28 02:25:52 +0800
committerGitHub <noreply@github.com>2018-02-28 02:25:52 +0800
commit2da7f82171be76b36bac0500fb6dd78ba1669603 (patch)
tree41c931b6c07ea28222a98e9e7f051159542ce027
parentfce10548d2d992317e36af48638a5ee799e94e7c (diff)
parent593474031d7faf4242c76aa22defea8ea76e9e90 (diff)
downloaddexon-0x-contracts-2da7f82171be76b36bac0500fb6dd78ba1669603.tar.gz
dexon-0x-contracts-2da7f82171be76b36bac0500fb6dd78ba1669603.tar.zst
dexon-0x-contracts-2da7f82171be76b36bac0500fb6dd78ba1669603.zip
Merge pull request #415 from 0xProject/fix/unsubscribeAll
Rename _unsubscribeAll to unsubscribeAll
-rw-r--r--packages/0x.js/CHANGELOG.md1
-rw-r--r--packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts4
-rw-r--r--packages/0x.js/src/contract_wrappers/exchange_wrapper.ts4
-rw-r--r--packages/0x.js/src/contract_wrappers/token_wrapper.ts4
-rw-r--r--packages/0x.js/test/ether_token_wrapper_test.ts2
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts2
-rw-r--r--packages/0x.js/test/subscription_test.ts4
-rw-r--r--packages/0x.js/test/token_wrapper_test.ts2
-rw-r--r--packages/website/ts/blockchain.ts2
9 files changed, 13 insertions, 12 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index ae71beebc..2710788e0 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -4,6 +4,7 @@
* Validate and lowercase all addresses in public methods (#373)
* Improve validation to force passing contract addresses on private networks (#385)
+ * Rename all public `_unsubscribeAll` methods to `unsubscribeAll` (#415)
## v0.32.2 - _February 9, 2018_
diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
index c3ff60a10..4807eff33 100644
--- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts
@@ -162,7 +162,7 @@ export class EtherTokenWrapper extends ContractWrapper {
/**
* Cancels all existing subscriptions
*/
- public _unsubscribeAll(): void {
+ public unsubscribeAll(): void {
super._unsubscribeAll();
}
/**
@@ -179,7 +179,7 @@ export class EtherTokenWrapper extends ContractWrapper {
return contractAddressIfExists;
}
private _invalidateContractInstance(): void {
- this._unsubscribeAll();
+ this.unsubscribeAll();
this._etherTokenContractsByAddress = {};
}
private async _getEtherTokenContractAsync(etherTokenAddress: string): Promise<EtherTokenContract> {
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
index e366c46cd..6bafc84c1 100644
--- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
@@ -687,7 +687,7 @@ export class ExchangeWrapper extends ContractWrapper {
/**
* Cancels all existing subscriptions
*/
- public _unsubscribeAll(): void {
+ public unsubscribeAll(): void {
super._unsubscribeAll();
}
/**
@@ -872,7 +872,7 @@ export class ExchangeWrapper extends ContractWrapper {
return contractAddress;
}
private _invalidateContractInstances(): void {
- this._unsubscribeAll();
+ this.unsubscribeAll();
delete this._exchangeContractIfExists;
}
private async _isValidSignatureUsingContractCallAsync(
diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts
index 154d3fae6..11a7670c0 100644
--- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts
@@ -377,7 +377,7 @@ export class TokenWrapper extends ContractWrapper {
/**
* Cancels all existing subscriptions
*/
- public _unsubscribeAll(): void {
+ public unsubscribeAll(): void {
super._unsubscribeAll();
}
/**
@@ -410,7 +410,7 @@ export class TokenWrapper extends ContractWrapper {
return logs;
}
private _invalidateContractInstances(): void {
- this._unsubscribeAll();
+ this.unsubscribeAll();
this._tokenContractsByAddress = {};
}
private async _getTokenContractAsync(tokenAddress: string): Promise<TokenContract> {
diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts
index 72086dff0..68f2c6f66 100644
--- a/packages/0x.js/test/ether_token_wrapper_test.ts
+++ b/packages/0x.js/test/ether_token_wrapper_test.ts
@@ -158,7 +158,7 @@ describe('EtherTokenWrapper', () => {
etherTokenAddress = etherToken.address;
});
afterEach(() => {
- zeroEx.etherToken._unsubscribeAll();
+ zeroEx.etherToken.unsubscribeAll();
});
// Hack: Mocha does not allow a test to be both async and have a `done` callback
// Since we need to await the receipt of the event in the `subscribe` callback,
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index 325426438..688be628f 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -922,7 +922,7 @@ describe('ExchangeWrapper', () => {
);
});
afterEach(async () => {
- zeroEx.exchange._unsubscribeAll();
+ zeroEx.exchange.unsubscribeAll();
});
// Hack: Mocha does not allow a test to be both async and have a `done` callback
// Since we need to await the receipt of the event in the `subscribe` callback,
diff --git a/packages/0x.js/test/subscription_test.ts b/packages/0x.js/test/subscription_test.ts
index 337e2effa..f485bf84b 100644
--- a/packages/0x.js/test/subscription_test.ts
+++ b/packages/0x.js/test/subscription_test.ts
@@ -49,7 +49,7 @@ describe('SubscriptionTest', () => {
tokenAddress = token.address;
});
afterEach(() => {
- zeroEx.token._unsubscribeAll();
+ zeroEx.token.unsubscribeAll();
_.each(stubs, s => s.restore());
stubs = [];
});
@@ -76,7 +76,7 @@ describe('SubscriptionTest', () => {
const callback = (err: Error | null, logEvent?: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop;
zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync').throws(new Error('JSON RPC error'))];
- zeroEx.token._unsubscribeAll();
+ zeroEx.token.unsubscribeAll();
done();
})().catch(done);
});
diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts
index 34ebe30c2..070d6ec47 100644
--- a/packages/0x.js/test/token_wrapper_test.ts
+++ b/packages/0x.js/test/token_wrapper_test.ts
@@ -377,7 +377,7 @@ describe('TokenWrapper', () => {
tokenAddress = token.address;
});
afterEach(() => {
- zeroEx.token._unsubscribeAll();
+ zeroEx.token.unsubscribeAll();
});
// Hack: Mocha does not allow a test to be both async and have a `done` callback
// Since we need to await the receipt of the event in the `subscribe` callback,
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index db3872a32..85b4e892f 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -672,7 +672,7 @@ export class Blockchain {
}
}
private _stopWatchingExchangeLogFillEvents(): void {
- this._zeroEx.exchange._unsubscribeAll();
+ this._zeroEx.exchange.unsubscribeAll();
}
private async _getTokenRegistryTokensByAddressAsync(): Promise<TokenByAddress> {
utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.');