Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Commit

Permalink
Add extra fields to fills endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cbovis committed Sep 16, 2020
1 parent 19e4b40 commit f6e72f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/routes/v1/util/transform-fills.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const _ = require('lodash');

const { ETH_TOKEN_DECIMALS } = require('../../../../constants');
const formatFillStatus = require('../../../../fills/format-fill-status');
const formatTokenAmount = require('../../../../tokens/format-token-amount');
const getAssetsForFill = require('../../../../fills/get-assets-for-fill');

const transformRelayer = relayer =>
Expand All @@ -10,12 +12,22 @@ const transformFill = fill => {
const assets = getAssetsForFill(fill);
const conversions = _.get(fill, `conversions.USD`);

const protocolFee =
fill.protocolFee !== undefined
? {
ETH: formatTokenAmount(fill.protocolFee, ETH_TOKEN_DECIMALS),
USD: _.get(conversions, 'protocolFee'),
}
: undefined;

return {
assets,
date: fill.date,
feeRecipient: fill.feeRecipient,
id: fill.id,
makerAddress: fill.maker,
protocolFee,
protocolVersion: fill.protocolVersion,
relayer: transformRelayer(fill.relayer),
status: formatFillStatus(fill.status),
takerAddress: fill.taker,
Expand Down

0 comments on commit f6e72f5

Please sign in to comment.