aboutsummaryrefslogtreecommitdiffstats
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
parent2a7da4fc4f344c1359aac93f286bb878447e67c6 (diff)
downloaddexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.gz
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.bz2
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.lz
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.xz
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.tar.zst
dexon-sol-tools-c12e48d28a811ace4bf7543a5c06471170ddf3f9.zip
Add assertion to public method
-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) {