diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-13 09:36:33 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:48 +0800 |
commit | 688d277b30b287f66f0dbd49f2a23cab8b256219 (patch) | |
tree | 97519ff71a2cd9e62c185f04556cd7b4cb6b62d8 /packages/pipeline/src/parsers/sra_orders/index.ts | |
parent | 329c68f610843ebded9ca31fc9cd6f3eed744a8e (diff) | |
download | dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.gz dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.bz2 dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.lz dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.xz dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.zst dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.zip |
Configure linter with --format stylish and fix linter errors
Diffstat (limited to 'packages/pipeline/src/parsers/sra_orders/index.ts')
-rw-r--r-- | packages/pipeline/src/parsers/sra_orders/index.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/pipeline/src/parsers/sra_orders/index.ts b/packages/pipeline/src/parsers/sra_orders/index.ts index 4e4bf12ff..3d7f73fca 100644 --- a/packages/pipeline/src/parsers/sra_orders/index.ts +++ b/packages/pipeline/src/parsers/sra_orders/index.ts @@ -6,10 +6,19 @@ import * as R from 'ramda'; import { SraOrder } from '../../entities'; import { bigNumbertoStringOrNull } from '../../utils'; +/** + * Parses a raw order response from an SRA endpoint and returns an array of + * SraOrder entities. + * @param rawOrdersResponse A raw order response from an SRA endpoint. + */ export function parseSraOrders(rawOrdersResponse: OrdersResponse): SraOrder[] { return R.map(_convertToEntity, rawOrdersResponse.records); } +/** + * Converts a single APIOrder into an SraOrder entity. + * @param apiOrder A single order from the response from an SRA endpoint. + */ export function _convertToEntity(apiOrder: APIOrder): SraOrder { // TODO(albrow): refactor out common asset data decoding code. const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(apiOrder.order.makerAssetData); @@ -41,11 +50,14 @@ export function _convertToEntity(apiOrder: APIOrder): SraOrder { sraOrder.makerAssetType = makerAssetType; sraOrder.makerAssetProxyId = makerAssetData.assetProxyId; sraOrder.makerTokenAddress = makerAssetData.tokenAddress; + // tslint has a false positive here. Type assertion is required. + // tslint:disable-next-line:no-unnecessary-type-assertion sraOrder.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId); sraOrder.rawTakerAssetData = apiOrder.order.takerAssetData; sraOrder.takerAssetType = takerAssetType; sraOrder.takerAssetProxyId = takerAssetData.assetProxyId; sraOrder.takerTokenAddress = takerAssetData.tokenAddress; + // tslint:disable-next-line:no-unnecessary-type-assertion sraOrder.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId); sraOrder.metadataJson = JSON.stringify(apiOrder.metaData); |