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

Commit f6e72f5

Browse files
committed
Add extra fields to fills endpoint
1 parent 19e4b40 commit f6e72f5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/app/routes/v1/util/transform-fills.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const _ = require('lodash');
22

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

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

15+
const protocolFee =
16+
fill.protocolFee !== undefined
17+
? {
18+
ETH: formatTokenAmount(fill.protocolFee, ETH_TOKEN_DECIMALS),
19+
USD: _.get(conversions, 'protocolFee'),
20+
}
21+
: undefined;
22+
1323
return {
1424
assets,
1525
date: fill.date,
1626
feeRecipient: fill.feeRecipient,
1727
id: fill.id,
1828
makerAddress: fill.maker,
29+
protocolFee,
30+
protocolVersion: fill.protocolVersion,
1931
relayer: transformRelayer(fill.relayer),
2032
status: formatFillStatus(fill.status),
2133
takerAddress: fill.taker,

0 commit comments

Comments
 (0)