diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-20 10:38:11 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-06 19:04:25 +0800 |
commit | f3c28afedd6864e35a17245eb7c187d1c129c35a (patch) | |
tree | 92f7625ed39feffa1d91f499720552b2795a180b /packages/pipeline/src/parsers | |
parent | 80ab797d3ab409e29bcd9b99ddb57c14a5849a19 (diff) | |
download | dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar.gz dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar.bz2 dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar.lz dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar.xz dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.tar.zst dexon-sol-tools-f3c28afedd6864e35a17245eb7c187d1c129c35a.zip |
Add script for pulling missing block data
Diffstat (limited to 'packages/pipeline/src/parsers')
-rw-r--r-- | packages/pipeline/src/parsers/web3/index.ts | 5 |
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; } |