diff options
author | fragosti <francesco.agosti93@gmail.com> | 2019-01-31 02:12:15 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2019-01-31 02:12:15 +0800 |
commit | c2ad95fd94611dba2030778553380cf07a85a4c3 (patch) | |
tree | 337be782f27f2bd3a2dc88da6a5f65b592a4c92c /packages | |
parent | 5ad2e9d6b6b1ff7c5327975501e8c042a5817ab9 (diff) | |
download | dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar.gz dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar.bz2 dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar.lz dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar.xz dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.tar.zst dexon-0x-contracts-c2ad95fd94611dba2030778553380cf07a85a4c3.zip |
update types to adhere to new dex trades and bloxy api format
Diffstat (limited to 'packages')
-rw-r--r-- | packages/pipeline/src/data_sources/bloxy/index.ts | 1 | ||||
-rw-r--r-- | packages/pipeline/src/entities/dex_trade.ts | 2 | ||||
-rw-r--r-- | packages/pipeline/src/parsers/bloxy/index.ts | 1 | ||||
-rw-r--r-- | packages/pipeline/test/entities/dex_trades_test.ts | 1 | ||||
-rw-r--r-- | packages/pipeline/test/parsers/bloxy/index_test.ts | 2 |
5 files changed, 7 insertions, 0 deletions
diff --git a/packages/pipeline/src/data_sources/bloxy/index.ts b/packages/pipeline/src/data_sources/bloxy/index.ts index 3d9147757..bba424f67 100644 --- a/packages/pipeline/src/data_sources/bloxy/index.ts +++ b/packages/pipeline/src/data_sources/bloxy/index.ts @@ -27,6 +27,7 @@ export interface BloxyTrade { tx_time: string; tx_date: string; tx_sender: string; + tradeIndex: string; smart_contract_id: number; smart_contract_address: string; contract_type: string; diff --git a/packages/pipeline/src/entities/dex_trade.ts b/packages/pipeline/src/entities/dex_trade.ts index 9d288cb51..93dcaf238 100644 --- a/packages/pipeline/src/entities/dex_trade.ts +++ b/packages/pipeline/src/entities/dex_trade.ts @@ -9,6 +9,8 @@ export class DexTrade { public sourceUrl!: string; @PrimaryColumn({ name: 'tx_hash' }) public txHash!: string; + @PrimaryColumn({ name: 'trade_index' }) + public tradeIndex!: string; @Column({ name: 'tx_timestamp', type: 'bigint', transformer: numberToBigIntTransformer }) public txTimestamp!: number; diff --git a/packages/pipeline/src/parsers/bloxy/index.ts b/packages/pipeline/src/parsers/bloxy/index.ts index caa55d289..3d797aff0 100644 --- a/packages/pipeline/src/parsers/bloxy/index.ts +++ b/packages/pipeline/src/parsers/bloxy/index.ts @@ -21,6 +21,7 @@ export function _parseBloxyTrade(rawTrade: BloxyTrade): DexTrade { const dexTrade = new DexTrade(); dexTrade.sourceUrl = BLOXY_DEX_TRADES_URL; dexTrade.txHash = rawTrade.tx_hash; + dexTrade.tradeIndex = rawTrade.tradeIndex; dexTrade.txTimestamp = new Date(rawTrade.tx_time).getTime(); dexTrade.txDate = rawTrade.tx_date; dexTrade.txSender = rawTrade.tx_sender; diff --git a/packages/pipeline/test/entities/dex_trades_test.ts b/packages/pipeline/test/entities/dex_trades_test.ts index 83aaeec8f..7c4829988 100644 --- a/packages/pipeline/test/entities/dex_trades_test.ts +++ b/packages/pipeline/test/entities/dex_trades_test.ts @@ -33,6 +33,7 @@ const baseTrade = { takerAnnotation: '', protocol: 'Kyber Network Proxy', sellAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100e', + tradeIndex: '3', }; const tradeWithNullAddresses: DexTrade = R.merge(baseTrade, { diff --git a/packages/pipeline/test/parsers/bloxy/index_test.ts b/packages/pipeline/test/parsers/bloxy/index_test.ts index 6aabb091d..d270bd2a7 100644 --- a/packages/pipeline/test/parsers/bloxy/index_test.ts +++ b/packages/pipeline/test/parsers/bloxy/index_test.ts @@ -17,6 +17,7 @@ const baseInput: BloxyTrade = { tx_time: '2018-11-21T09:06:28.000+00:00', tx_date: '2018-11-21', tx_sender: '0x00923b9a074762b93650716333b3e1473a15048e', + tradeIndex: '1', smart_contract_id: 7091917, smart_contract_address: '0x818e6fecd516ecc3849daf6845e3ec868087b755', contract_type: 'DEX/Kyber Network Proxy', @@ -40,6 +41,7 @@ const baseInput: BloxyTrade = { const baseExpected: DexTrade = { sourceUrl: BLOXY_DEX_TRADES_URL, txHash: '0xb93a7faf92efbbb5405c9a73cd4efd99702fe27c03ff22baee1f1b1e37b3a0bf', + tradeIndex: '1', txTimestamp: 1542791188000, txDate: '2018-11-21', txSender: '0x00923b9a074762b93650716333b3e1473a15048e', |