aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/parsers/web3
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-20 10:38:11 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commit9986717671fe8e14c2168f7479bdaffe406bedc0 (patch)
tree740250d59b8679756c7595ef49eba0d73cacbec5 /packages/pipeline/src/parsers/web3
parent5cad2ad1744ab1c1e24ed52fc0a26ec5acf5c898 (diff)
downloaddexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar.gz
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar.bz2
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar.lz
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar.xz
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.tar.zst
dexon-0x-contracts-9986717671fe8e14c2168f7479bdaffe406bedc0.zip
Add script for pulling missing block data
Diffstat (limited to 'packages/pipeline/src/parsers/web3')
-rw-r--r--packages/pipeline/src/parsers/web3/index.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/pipeline/src/parsers/web3/index.ts b/packages/pipeline/src/parsers/web3/index.ts
index 2ead4c0e4..9b5b3b55d 100644
--- a/packages/pipeline/src/parsers/web3/index.ts
+++ b/packages/pipeline/src/parsers/web3/index.ts
@@ -2,6 +2,8 @@ import { BlockWithoutTransactionData, Transaction as EthTransaction } from 'ethe
import { Block, Transaction } from '../../entities';
+const MILLISECONDS_PER_SECOND = 1000;
+
/**
* Parses a raw block and returns a Block entity.
* @param rawBlock a raw block (e.g. returned from web3-wrapper).
@@ -17,7 +19,8 @@ export function parseBlock(rawBlock: BlockWithoutTransactionData): Block {
const block = new Block();
block.hash = rawBlock.hash;
block.number = rawBlock.number;
- block.unixTimestampSeconds = rawBlock.timestamp;
+ // Block timestamps are in seconds, but we use milliseconds everywhere else.
+ block.timestamp = rawBlock.timestamp * MILLISECONDS_PER_SECOND;
return block;
}