aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/parsers
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-12-13 08:49:01 +0800
committerGitHub <noreply@github.com>2018-12-13 08:49:01 +0800
commit3a8f3e01b611f666afd8769b532f8576ca5b5e14 (patch)
treeca4e4998e6b32522f79502a3da18453e520291c2 /packages/pipeline/src/parsers
parentf9d436cd213a6d9800aa528c9bac5415230378f4 (diff)
downloaddexon-0x-contracts-3a8f3e01b611f666afd8769b532f8576ca5b5e14.tar.gz
dexon-0x-contracts-3a8f3e01b611f666afd8769b532f8576ca5b5e14.tar.zst
dexon-0x-contracts-3a8f3e01b611f666afd8769b532f8576ca5b5e14.zip
Fix bug that occurs when token metadata decimals is undefined. (#1426)
* Fix bug that occurs when token metadata decimals is undefined. * move toBigNumberOrNull to utils
Diffstat (limited to 'packages/pipeline/src/parsers')
-rw-r--r--packages/pipeline/src/parsers/token_metadata/index.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/packages/pipeline/src/parsers/token_metadata/index.ts b/packages/pipeline/src/parsers/token_metadata/index.ts
index f258af063..65e0aaa6e 100644
--- a/packages/pipeline/src/parsers/token_metadata/index.ts
+++ b/packages/pipeline/src/parsers/token_metadata/index.ts
@@ -1,9 +1,8 @@
-import { BigNumber } from '@0x/utils';
import * as R from 'ramda';
import { MetamaskTrustedTokenMeta, ZeroExTrustedTokenMeta } from '../../data_sources/trusted_tokens';
import { TokenMetadata } from '../../entities';
-import {} from '../../utils';
+import { toBigNumberOrNull } from '../../utils';
/**
* Parses Metamask's trusted tokens list.
@@ -26,7 +25,7 @@ function parseMetamaskTrustedToken(resp: MetamaskTrustedTokenMeta, address: stri
const trustedToken = new TokenMetadata();
trustedToken.address = address;
- trustedToken.decimals = new BigNumber(resp.decimals);
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
trustedToken.symbol = resp.symbol;
trustedToken.name = resp.name;
trustedToken.authority = 'metamask';
@@ -38,7 +37,7 @@ function parseZeroExTrustedToken(resp: ZeroExTrustedTokenMeta): TokenMetadata {
const trustedToken = new TokenMetadata();
trustedToken.address = resp.address;
- trustedToken.decimals = resp.decimals ? new BigNumber(resp.decimals) : null;
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
trustedToken.symbol = resp.symbol;
trustedToken.name = resp.name;
trustedToken.authority = '0x';