From ccad046eb649a60fdf7319a075fa41490d593ae8 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 8 Nov 2018 10:15:09 -0800 Subject: Reorganize entities. Make scripts work from any directory. --- .../pipeline/src/entities/exchange_cancel_event.ts | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 packages/pipeline/src/entities/exchange_cancel_event.ts (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts new file mode 100644 index 000000000..698b9e2ec --- /dev/null +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -0,0 +1,35 @@ +import { Column, Entity, PrimaryColumn } from 'typeorm'; + +import { AssetType } from '../types'; + +@Entity() +export class ExchangeCancelEvent { + @PrimaryColumn() public contractAddress!: string; + @PrimaryColumn() public logIndex!: number; + @PrimaryColumn() public blockNumber!: number; + + @Column() public rawData!: string; + + // TODO(albrow): Include transaction hash + @Column() public makerAddress!: string; + @Column({ nullable: true, type: String }) + public takerAddress!: string; + @Column() public feeRecepientAddress!: string; + @Column() public senderAddress!: string; + @Column() public orderHash!: string; + + @Column() public rawMakerAssetData!: string; + @Column() public makerAssetType!: AssetType; + @Column() public makerAssetProxyId!: string; + @Column() public makerTokenAddress!: string; + @Column({ nullable: true, type: String }) + public makerTokenId!: string | null; + @Column() public rawTakerAssetData!: string; + @Column() public takerAssetType!: AssetType; + @Column() public takerAssetProxyId!: string; + @Column() public takerTokenAddress!: string; + @Column({ nullable: true, type: String }) + public takerTokenId!: string | null; + + // TODO(albrow): Include topics? +} -- cgit v1.2.3 From 53cc9e9bedc6adf2247a190dbb758c9411033cab Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 8 Nov 2018 10:53:18 -0800 Subject: Rename table and column names --- .../pipeline/src/entities/exchange_cancel_event.ts | 56 ++++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 698b9e2ec..6d0c3bc32 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -2,33 +2,49 @@ import { Column, Entity, PrimaryColumn } from 'typeorm'; import { AssetType } from '../types'; -@Entity() +@Entity({ name: 'exchange_cancel_events' }) export class ExchangeCancelEvent { - @PrimaryColumn() public contractAddress!: string; - @PrimaryColumn() public logIndex!: number; - @PrimaryColumn() public blockNumber!: number; + @PrimaryColumn({ name: 'contract_address' }) + public contractAddress!: string; + @PrimaryColumn({ name: 'log_index' }) + public logIndex!: number; + @PrimaryColumn({ name: 'block_number' }) + public blockNumber!: number; - @Column() public rawData!: string; + @Column({ name: 'raw_data' }) + public rawData!: string; // TODO(albrow): Include transaction hash - @Column() public makerAddress!: string; - @Column({ nullable: true, type: String }) + @Column({ name: 'maker_address' }) + public makerAddress!: string; + @Column({ nullable: true, type: String, name: 'taker_address' }) public takerAddress!: string; - @Column() public feeRecepientAddress!: string; - @Column() public senderAddress!: string; - @Column() public orderHash!: string; + @Column({ name: 'fee_recipient_address' }) + public feeRecipientAddress!: string; + @Column({ name: 'sender_address' }) + public senderAddress!: string; + @Column({ name: 'order_hash' }) + public orderHash!: string; - @Column() public rawMakerAssetData!: string; - @Column() public makerAssetType!: AssetType; - @Column() public makerAssetProxyId!: string; - @Column() public makerTokenAddress!: string; - @Column({ nullable: true, type: String }) + @Column({ name: 'raw_maker_asset_data' }) + public rawMakerAssetData!: string; + @Column({ name: 'maker_asset_type' }) + public makerAssetType!: AssetType; + @Column({ name: 'maker_asset_proxy_id' }) + public makerAssetProxyId!: string; + @Column({ name: 'maker_token_address' }) + public makerTokenAddress!: string; + @Column({ nullable: true, type: String, name: 'maker_token_id' }) public makerTokenId!: string | null; - @Column() public rawTakerAssetData!: string; - @Column() public takerAssetType!: AssetType; - @Column() public takerAssetProxyId!: string; - @Column() public takerTokenAddress!: string; - @Column({ nullable: true, type: String }) + @Column({ name: 'raw_taker_asset_data' }) + public rawTakerAssetData!: string; + @Column({ name: 'taker_asset_type' }) + public takerAssetType!: AssetType; + @Column({ name: 'taker_asset_proxy_id' }) + public takerAssetProxyId!: string; + @Column({ name: 'taker_token_address' }) + public takerTokenAddress!: string; + @Column({ nullable: true, type: String, name: 'taker_token_id' }) public takerTokenId!: string | null; // TODO(albrow): Include topics? -- cgit v1.2.3 From 96134003e1aa1903bdf051e39e7e244cc8684043 Mon Sep 17 00:00:00 2001 From: Jake Ellowitz Date: Tue, 13 Nov 2018 09:57:02 -0800 Subject: Pointing entities to raw schema Fix linter issues --- packages/pipeline/src/entities/exchange_cancel_event.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 6d0c3bc32..781e1c4bb 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -2,7 +2,7 @@ import { Column, Entity, PrimaryColumn } from 'typeorm'; import { AssetType } from '../types'; -@Entity({ name: 'exchange_cancel_events' }) +@Entity({ name: 'exchange_cancel_events', schema: 'raw' }) export class ExchangeCancelEvent { @PrimaryColumn({ name: 'contract_address' }) public contractAddress!: string; -- cgit v1.2.3 From 0397ff8b2206ab4e9308a524d635ec37ec9dda99 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 15 Nov 2018 13:09:44 -0800 Subject: Add transactionHash to CancelUpToEvent and CancelEvent entities --- packages/pipeline/src/entities/exchange_cancel_event.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 781e1c4bb..5a40ba799 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -14,7 +14,8 @@ export class ExchangeCancelEvent { @Column({ name: 'raw_data' }) public rawData!: string; - // TODO(albrow): Include transaction hash + @Column({ name: 'transaction_hash' }) + public transactionHash!: string; @Column({ name: 'maker_address' }) public makerAddress!: string; @Column({ nullable: true, type: String, name: 'taker_address' }) -- cgit v1.2.3 From 3d211c415b58a67f84332ff512bf9372cac5a3ac Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 28 Nov 2018 13:21:04 -0800 Subject: Introduce framework for running basic tests for entities (#1344) * Introduce framework for running basic tests for entities * Add pipeline tests to CircleCI config * Make pipeline tests more configurable and fix CircleCI config * Add coverage dir to pipeline package * Add basic tests for all exchange event entities * Add tests for remaining entities * Create separate test scripts in package.json and add new info to README * Update db_setup.ts to revert migrations even if you are using docker * Automatically pull the postgres image if needed * Add comment about why NumberToBigIntTransformer is needed --- packages/pipeline/src/entities/exchange_cancel_event.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 5a40ba799..2fcc17df6 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -1,6 +1,7 @@ import { Column, Entity, PrimaryColumn } from 'typeorm'; import { AssetType } from '../types'; +import { numberToBigIntTransformer } from '../utils'; @Entity({ name: 'exchange_cancel_events', schema: 'raw' }) export class ExchangeCancelEvent { @@ -8,7 +9,7 @@ export class ExchangeCancelEvent { public contractAddress!: string; @PrimaryColumn({ name: 'log_index' }) public logIndex!: number; - @PrimaryColumn({ name: 'block_number' }) + @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer }) public blockNumber!: number; @Column({ name: 'raw_data' }) -- cgit v1.2.3 From 00f86ca0f7871639d2b0be496f6f8c5e0d8d7ffe Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 4 Dec 2018 20:04:08 -0800 Subject: Address PR feedback --- packages/pipeline/src/entities/exchange_cancel_event.ts | 2 -- 1 file changed, 2 deletions(-) (limited to 'packages/pipeline/src/entities/exchange_cancel_event.ts') diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 2fcc17df6..38f99c903 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -48,6 +48,4 @@ export class ExchangeCancelEvent { public takerTokenAddress!: string; @Column({ nullable: true, type: String, name: 'taker_token_id' }) public takerTokenId!: string | null; - - // TODO(albrow): Include topics? } -- cgit v1.2.3