aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/entities
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-14 07:33:43 +0800
committerFred Carlsen <fred@sjelfull.no>2018-12-06 19:04:25 +0800
commite394c4fe1dd3bcceb382bb56e9c63e0b320e193f (patch)
tree1af4fe8639441006826ab8132155f28251fb0119 /packages/pipeline/src/entities
parent5c655eeda75f8a859378a0511d9e19438c149a60 (diff)
downloaddexon-sol-tools-e394c4fe1dd3bcceb382bb56e9c63e0b320e193f.tar.gz
dexon-sol-tools-e394c4fe1dd3bcceb382bb56e9c63e0b320e193f.tar.zst
dexon-sol-tools-e394c4fe1dd3bcceb382bb56e9c63e0b320e193f.zip
Implement scraping sra orders from radar relay
Diffstat (limited to 'packages/pipeline/src/entities')
-rw-r--r--packages/pipeline/src/entities/index.ts1
-rw-r--r--packages/pipeline/src/entities/sra_order.ts4
-rw-r--r--packages/pipeline/src/entities/sra_order_observed_timestamp.ts30
3 files changed, 33 insertions, 2 deletions
diff --git a/packages/pipeline/src/entities/index.ts b/packages/pipeline/src/entities/index.ts
index 6e024f280..442eec9cd 100644
--- a/packages/pipeline/src/entities/index.ts
+++ b/packages/pipeline/src/entities/index.ts
@@ -6,3 +6,4 @@ export { Relayer } from './relayer';
export { SraOrder } from './sra_order';
export { Transaction } from './transaction';
export { TokenOnChainMetadata } from './token_on_chain_metadata';
+export { SraOrdersObservedTimeStamp, createObservedTimestampForOrder } from './sra_order_observed_timestamp';
diff --git a/packages/pipeline/src/entities/sra_order.ts b/packages/pipeline/src/entities/sra_order.ts
index 4b7f652d3..2bdb1ba2e 100644
--- a/packages/pipeline/src/entities/sra_order.ts
+++ b/packages/pipeline/src/entities/sra_order.ts
@@ -19,9 +19,9 @@ export class SraOrder {
public feeRecipientAddress!: string;
@Column({ name: 'sender_address' })
public senderAddress!: string;
- @Column({ name: 'maker_asset_amount' })
+ @Column({ name: 'maker_asset_filled_amount' })
public makerAssetAmount!: string;
- @Column({ name: 'taker_asset_amount' })
+ @Column({ name: 'taker_asset_filled_amount' })
public takerAssetAmount!: string;
@Column({ name: 'maker_fee' })
public makerFee!: string;
diff --git a/packages/pipeline/src/entities/sra_order_observed_timestamp.ts b/packages/pipeline/src/entities/sra_order_observed_timestamp.ts
new file mode 100644
index 000000000..bdb6cd36b
--- /dev/null
+++ b/packages/pipeline/src/entities/sra_order_observed_timestamp.ts
@@ -0,0 +1,30 @@
+import { Entity, PrimaryColumn } from 'typeorm';
+
+import { SraOrder } from './sra_order';
+
+@Entity({ name: 'sra_orders_observed_timestamps', schema: 'raw' })
+export class SraOrdersObservedTimeStamp {
+ @PrimaryColumn({ name: 'exchange_address' })
+ public exchangeAddress!: string;
+ @PrimaryColumn({ name: 'order_hash_hex' })
+ public orderHashHex!: string;
+ @PrimaryColumn({ name: 'source_url' })
+ public sourceUrl!: string;
+
+ @PrimaryColumn({ name: 'observed_timestamp' })
+ public observedTimestamp!: number;
+}
+
+/**
+ * Returns a new SraOrdersObservedTimeStamp for the given order based on the
+ * current time.
+ * @param order The order to generate a timestamp for.
+ */
+export function createObservedTimestampForOrder(order: SraOrder): SraOrdersObservedTimeStamp {
+ const observed = new SraOrdersObservedTimeStamp();
+ observed.exchangeAddress = order.exchangeAddress;
+ observed.orderHashHex = order.orderHashHex;
+ observed.sourceUrl = order.sourceUrl;
+ observed.observedTimestamp = Date.now();
+ return observed;
+}