diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-10-05 19:49:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-05 19:49:04 +0800 |
commit | 46f4c56a3d4582434d5765774f4fc1de75147486 (patch) | |
tree | e2d2063bf0717368be4c8074e3887af606c978f6 | |
parent | acdc65c895bfaeaefc82b8a374f145c6c054e4a8 (diff) | |
parent | 49a50efa9ff5f12e194abba8d43a30b7776e3349 (diff) | |
download | dexon-0x-contracts-46f4c56a3d4582434d5765774f4fc1de75147486.tar.gz dexon-0x-contracts-46f4c56a3d4582434d5765774f4fc1de75147486.tar.zst dexon-0x-contracts-46f4c56a3d4582434d5765774f4fc1de75147486.zip |
Merge pull request #183 from 0xProject/fix/getLogs-assertions
Add assertions
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 3 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index b3a35d5bf..32eaa590c 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -668,6 +668,9 @@ export class ExchangeWrapper extends ContractWrapper { */ public async getLogsAsync(eventName: ExchangeEvents, subscriptionOpts: SubscriptionOpts, indexFilterValues: IndexedFilterValues): Promise<LogWithDecodedArgs[]> { + assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents); + assert.doesConformToSchema('subscriptionOpts', subscriptionOpts, schemas.subscriptionOptsSchema); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const exchangeContractAddress = await this.getContractAddressAsync(); const logs = await this._getLogsAsync( exchangeContractAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.ExchangeArtifact.abi, diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 91af223e4..f988e6ece 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -291,6 +291,10 @@ export class TokenWrapper extends ContractWrapper { */ public async getLogsAsync(tokenAddress: string, eventName: TokenEvents, subscriptionOpts: SubscriptionOpts, indexFilterValues: IndexedFilterValues): Promise<LogWithDecodedArgs[]> { + assert.isETHAddressHex('tokenAddress', tokenAddress); + assert.doesBelongToStringEnum('eventName', eventName, TokenEvents); + assert.doesConformToSchema('subscriptionOpts', subscriptionOpts, schemas.subscriptionOptsSchema); + assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); const logs = await this._getLogsAsync( tokenAddress, eventName, subscriptionOpts, indexFilterValues, artifacts.TokenArtifact.abi, ); |