diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-09-20 08:30:34 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:03 +0800 |
commit | 4e6919a6e58d76766098262664c78f92d888337d (patch) | |
tree | 649bc1c711a498c6718f36994283f65c3e56aba1 /packages/pipeline/src/data-sources | |
parent | d71fa6535987a0f13900f8e31dbb51772c12fc4f (diff) | |
download | dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar.gz dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar.bz2 dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar.lz dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar.xz dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.tar.zst dexon-sol-tools-4e6919a6e58d76766098262664c78f92d888337d.zip |
Add typeorm and begin inserting database records
Diffstat (limited to 'packages/pipeline/src/data-sources')
-rw-r--r-- | packages/pipeline/src/data-sources/etherscan/events.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/pipeline/src/data-sources/etherscan/events.ts b/packages/pipeline/src/data-sources/etherscan/events.ts index 89b3ffac1..edc8cde7b 100644 --- a/packages/pipeline/src/data-sources/etherscan/events.ts +++ b/packages/pipeline/src/data-sources/etherscan/events.ts @@ -1,5 +1,6 @@ +import { ExchangeEventArgs } from '@0xproject/contract-wrappers'; import { AbiDecoder } from '@0xproject/utils'; -import { AbiDefinition, DecodedLogArgs, LogEntry, LogWithDecodedArgs } from 'ethereum-types'; +import { AbiDefinition, LogEntry, LogWithDecodedArgs } from 'ethereum-types'; import * as R from 'ramda'; // Raw events response from etherescan.io @@ -47,12 +48,12 @@ export function _convertResponseToLogEntry(result: EventsResponseResult): LogEnt // Decodes a LogEntry into a LogWithDecodedArgs // tslint:disable-next-line:completed-docs export const _decodeLogEntry = R.curry((contractAbi: AbiDefinition[], log: LogEntry): LogWithDecodedArgs< - DecodedLogArgs + ExchangeEventArgs > => { const abiDecoder = new AbiDecoder([contractAbi]); const logWithDecodedArgs = abiDecoder.tryToDecodeLogOrNoop(log); // tslint:disable-next-line:no-unnecessary-type-assertion - return logWithDecodedArgs as LogWithDecodedArgs<DecodedLogArgs>; + return logWithDecodedArgs as LogWithDecodedArgs<ExchangeEventArgs>; }); /** @@ -64,7 +65,7 @@ export const _decodeLogEntry = R.curry((contractAbi: AbiDefinition[], log: LogEn export function parseRawEventsResponse( contractAbi: AbiDefinition[], rawEventsResponse: EventsResponse, -): Array<LogWithDecodedArgs<DecodedLogArgs>> { +): Array<LogWithDecodedArgs<ExchangeEventArgs>> { return R.pipe(R.map(_convertResponseToLogEntry), R.map(_decodeLogEntry(contractAbi)))(rawEventsResponse.result); } |