aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-08-24 00:13:50 +0800
committerFabio Berger <me@fabioberger.com>2017-08-24 00:13:50 +0800
commitc12e48d28a811ace4bf7543a5c06471170ddf3f9 (patch)
tree4de06648464cb1196fce97e4aff1c07e450f6196 /src
parent2a7da4fc4f344c1359aac93f286bb878447e67c6 (diff)
downloaddexon-0x-contracts-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.gz
dexon-0x-contracts-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.zst
dexon-0x-contracts-c12e48d28a811ace4bf7543a5c06471170ddf3f9.zip
Add assertion to public method
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/token_registry_wrapper.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts
index c78b86a88..c106a4a40 100644
--- a/src/contract_wrappers/token_registry_wrapper.ts
+++ b/src/contract_wrappers/token_registry_wrapper.ts
@@ -1,5 +1,6 @@
import * as _ from 'lodash';
import {Web3Wrapper} from '../web3_wrapper';
+import {assert} from '../utils/assert';
import {Token, TokenRegistryContract, TokenMetadata} from '../types';
import {constants} from '../utils/constants';
import {ContractWrapper} from './contract_wrapper';
@@ -33,6 +34,8 @@ export class TokenRegistryWrapper extends ContractWrapper {
* @return An object that conforms to the Token interface or undefined if token not found.
*/
public async getTokenMetadataIfExistsAsync(address: string): Promise<Token|undefined> {
+ assert.isETHAddressHex('address', address);
+
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const metadata = await tokenRegistryContract.getTokenMetaData.call(address);
if (metadata[0] === constants.NULL_ADDRESS) {