aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/parsers
diff options
context:
space:
mode:
authorJake Ellowitz <jake.ellowitz@gmail.com>2018-11-20 11:11:51 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commitdea89c4e221d5b22de97b27573719cd27ce250c7 (patch)
tree8bb98513d90e6759d57f20d2d458625d4b68dc80 /packages/pipeline/src/parsers
parentc6af5131b0b06433d6294260274e187ad61f4ef7 (diff)
downloaddexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar.gz
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar.bz2
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar.lz
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar.xz
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.tar.zst
dexon-sol-tools-dea89c4e221d5b22de97b27573719cd27ce250c7.zip
metadata and trusted sources in same raw table
Diffstat (limited to 'packages/pipeline/src/parsers')
-rw-r--r--packages/pipeline/src/parsers/token_metadata/index.ts (renamed from packages/pipeline/src/parsers/trusted_tokens/index.ts)24
1 files changed, 17 insertions, 7 deletions
diff --git a/packages/pipeline/src/parsers/trusted_tokens/index.ts b/packages/pipeline/src/parsers/token_metadata/index.ts
index a6d32de35..d09def0db 100644
--- a/packages/pipeline/src/parsers/trusted_tokens/index.ts
+++ b/packages/pipeline/src/parsers/token_metadata/index.ts
@@ -1,36 +1,46 @@
import * as R from 'ramda';
import { MetamaskTrustedTokenMeta, ZeroExTrustedTokenMeta } from '../../data_sources/trusted_tokens';
-import { TrustedToken } from '../../entities';
+import { TokenMetadata } from '../../entities';
/**
* Parses Metamask's trusted tokens list.
* @param rawResp raw response from the metamask json file.
*/
-export function parseMetamaskTrustedTokens(rawResp: Map<string, MetamaskTrustedTokenMeta>): TrustedToken[] {
+export function parseMetamaskTrustedTokens(rawResp: Map<string, MetamaskTrustedTokenMeta>): TokenMetadata[] {
const parsedAsObject = R.mapObjIndexed(parseMetamaskTrustedToken, rawResp);
return R.values(parsedAsObject);
}
-export function parseZeroExTrustedTokens(rawResp: ZeroExTrustedTokenMeta[]): TrustedToken[] {
+/**
+ * Parses 0x's trusted tokens list.
+ * @param rawResp raw response from the 0x json file.
+ */
+export function parseZeroExTrustedTokens(rawResp: ZeroExTrustedTokenMeta[]): TokenMetadata[] {
return R.map(parseZeroExTrustedToken, rawResp);
}
-function parseMetamaskTrustedToken(resp: MetamaskTrustedTokenMeta, address: string): TrustedToken {
+function parseMetamaskTrustedToken(resp: MetamaskTrustedTokenMeta, address: string): TokenMetadata {
- const trustedToken = new TrustedToken();
+ const trustedToken = new TokenMetadata();
trustedToken.address = address;
+ trustedToken.decimals = resp.decimals;
+ trustedToken.symbol = resp.symbol;
+ trustedToken.name = resp.name;
trustedToken.authority = 'metamask';
return trustedToken;
}
-function parseZeroExTrustedToken(resp: ZeroExTrustedTokenMeta): TrustedToken {
+function parseZeroExTrustedToken(resp: ZeroExTrustedTokenMeta): TokenMetadata {
- const trustedToken = new TrustedToken();
+ const trustedToken = new TokenMetadata();
trustedToken.address = resp.address;
+ trustedToken.decimals = resp.decimals;
+ trustedToken.symbol = resp.symbol;
+ trustedToken.name = resp.name;
trustedToken.authority = '0x';
return trustedToken;