Skip to content

Commit 13f61a0

Browse files
committed
refactor: minors
1 parent f436ca9 commit 13f61a0

File tree

1 file changed

+73
-73
lines changed
  • packages/sdk-ts/src/client/olp/grpc/transformers

1 file changed

+73
-73
lines changed

packages/sdk-ts/src/client/olp/grpc/transformers/index.ts

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,36 @@ export class DmmGrpcTransformer {
3333

3434
static grpcEpochToEpoch(epoch: GrpcEpochV2): EpochV2 {
3535
return {
36-
epochId: epoch.epochId,
3736
status: epoch.status,
38-
startHeight: epoch.startHeight?.toString(),
39-
endHeight: epoch.endHeight?.toString(),
40-
snapshotCount: epoch.snapshotCount,
37+
epochId: epoch.epochId,
4138
resultCount: epoch.resultCount,
39+
snapshotCount: epoch.snapshotCount,
40+
endHeight: epoch.endHeight?.toString(),
41+
startHeight: epoch.startHeight?.toString(),
4242
config: epoch.config
4343
? {
44+
number: epoch.config.number,
45+
rewardInj: epoch.config.rewardInj,
46+
isMiniEpoch: epoch.config.isMiniEpoch,
47+
uptimeExponent: epoch.config.uptimeExponent,
48+
volumeExponent: epoch.config.volumeExponent,
49+
liquidityScoreExponent: epoch.config.liquidityScoreExponent,
50+
permanenceVolumeThreshold: epoch.config.permanenceVolumeThreshold,
51+
qualifyingVolumeThreshold: epoch.config.qualifyingVolumeThreshold,
4452
startDate: epoch.config.startDate
4553
? new Date(epoch.config.startDate)
4654
: undefined,
4755
endDate: epoch.config.endDate
4856
? new Date(epoch.config.endDate)
4957
: undefined,
50-
rewardInj: epoch.config.rewardInj,
5158
markets: epoch.config.markets.map((market) => ({
52-
marketId: market.marketId,
5359
ticker: market.ticker,
60+
marketId: market.marketId,
5461
startDate: market.startDate
5562
? new Date(market.startDate)
5663
: undefined,
5764
preAllocatedReward: market.preAllocatedReward,
5865
})),
59-
liquidityScoreExponent: epoch.config.liquidityScoreExponent,
60-
uptimeExponent: epoch.config.uptimeExponent,
61-
volumeExponent: epoch.config.volumeExponent,
62-
permanenceVolumeThreshold: epoch.config.permanenceVolumeThreshold,
63-
qualifyingVolumeThreshold: epoch.config.qualifyingVolumeThreshold,
64-
number: epoch.config.number,
65-
isMiniEpoch: epoch.config.isMiniEpoch,
6666
}
6767
: undefined,
6868
createdAt: epoch.createdAt ? new Date(epoch.createdAt) : undefined,
@@ -82,26 +82,26 @@ export class DmmGrpcTransformer {
8282
marketReward: GrpcMarketReward,
8383
): MarketReward {
8484
return {
85+
reward: marketReward.reward,
8586
epochId: marketReward.epochId,
8687
marketId: marketReward.marketId,
88+
liquidity: marketReward.liquidity,
89+
totalScore: marketReward.totalScore,
8790
height: marketReward.height?.toString(),
88-
reward: marketReward.reward,
8991
rewardPercentage: marketReward.rewardPercentage,
90-
liquidity: marketReward.liquidity,
92+
miniEpochsReward: marketReward.miniEpochsReward,
9193
startDate: marketReward.startDate
9294
? new Date(marketReward.startDate)
9395
: undefined,
9496
endDate: marketReward.endDate
9597
? new Date(marketReward.endDate)
9698
: undefined,
97-
totalScore: marketReward.totalScore,
9899
createdAt: marketReward.createdAt
99100
? new Date(marketReward.createdAt)
100101
: undefined,
101102
updatedAt: marketReward.updatedAt
102103
? new Date(marketReward.updatedAt)
103104
: undefined,
104-
miniEpochsReward: marketReward.miniEpochsReward,
105105
}
106106
}
107107

@@ -122,10 +122,10 @@ export class DmmGrpcTransformer {
122122
eligibleAddress: GrpcEligibleAddress,
123123
): EligibleAddress {
124124
return {
125+
source: eligibleAddress.source,
125126
epochId: eligibleAddress.epochId,
126-
accountAddress: eligibleAddress.accountAddress,
127127
height: eligibleAddress.height?.toString(),
128-
source: eligibleAddress.source,
128+
accountAddress: eligibleAddress.accountAddress,
129129
createdAt: eligibleAddress.createdAt
130130
? new Date(eligibleAddress.createdAt)
131131
: undefined,
@@ -148,26 +148,26 @@ export class DmmGrpcTransformer {
148148

149149
static grpcEpochScoresToEpochScores(score: GrpcEpochScore): EpochScore {
150150
return {
151+
volume: score.volume,
152+
reward: score.reward,
151153
epochId: score.epochId,
152-
accountAddress: score.accountAddress,
153-
height: score.height?.toString(),
154-
blockTime: score.blockTime ? new Date(score.blockTime) : undefined,
155-
startHeight: score.startHeight?.toString(),
156-
liquidityScore: score.liquidityScore,
157-
liquidityScorePonderated: score.liquidityScorePonderated,
154+
qualifies: score.qualifies,
155+
totalScore: score.totalScore,
158156
uptimeScore: score.uptimeScore,
159-
uptimeScorePonderated: score.uptimeScorePonderated,
160-
uptimePercentage: score.uptimePercentage,
161157
volumeScore: score.volumeScore,
162-
volumeScorePonderated: score.volumeScorePonderated,
163-
totalScore: score.totalScore,
164-
volume: score.volume,
165158
makerVolume: score.makerVolume,
166159
takerVolume: score.takerVolume,
167-
reward: score.reward,
160+
height: score.height?.toString(),
161+
accountAddress: score.accountAddress,
162+
liquidityScore: score.liquidityScore,
163+
uptimePercentage: score.uptimePercentage,
168164
rewardPercentage: score.rewardPercentage,
169-
qualifies: score.qualifies,
170165
volumePercentage: score.volumePercentage,
166+
startHeight: score.startHeight?.toString(),
167+
uptimeScorePonderated: score.uptimeScorePonderated,
168+
volumeScorePonderated: score.volumeScorePonderated,
169+
liquidityScorePonderated: score.liquidityScorePonderated,
170+
blockTime: score.blockTime ? new Date(score.blockTime) : undefined,
171171
createdAt: score.createdAt ? new Date(score.createdAt) : undefined,
172172
updatedAt: score.updatedAt ? new Date(score.updatedAt) : undefined,
173173
}
@@ -197,35 +197,35 @@ export class DmmGrpcTransformer {
197197

198198
static grpcTotalScoresToTotalScores(score: GrpcTotalScore): TotalScore {
199199
return {
200-
epochId: score.epochId,
201-
marketId: score.marketId,
202-
accountAddress: score.accountAddress,
203-
height: score.height?.toString(),
204-
startHeight: score.startHeight?.toString(),
205-
blockTime: score.blockTime ? new Date(score.blockTime) : undefined,
206200
bid: score.bid,
207201
ask: score.ask,
208202
depth: score.depth,
209-
snapshotCount: score.snapshotCount,
210-
liquidityScore: score.liquidityScore,
211-
liquidityScorePonderated: score.liquidityScorePonderated,
203+
volume: score.volume,
204+
reward: score.reward,
205+
epochId: score.epochId,
206+
marketId: score.marketId,
207+
totalScore: score.totalScore,
212208
uptimeScore: score.uptimeScore,
213-
uptimeScorePonderated: score.uptimeScorePonderated,
214-
uptimePercentage: score.uptimePercentage,
215209
startVolume: score.startVolume,
216-
currentVolume: score.currentVolume,
217-
volume: score.volume,
218210
volumeScore: score.volumeScore,
219-
volumeScorePonderated: score.volumeScorePonderated,
220-
takerStartVolume: score.takerStartVolume,
221-
takerCurrentVolume: score.takerCurrentVolume,
222211
takerVolume: score.takerVolume,
223-
makerStartVolume: score.makerStartVolume,
224-
makerCurrentVolume: score.makerCurrentVolume,
225212
makerVolume: score.makerVolume,
226-
totalScore: score.totalScore,
227-
reward: score.reward,
213+
height: score.height?.toString(),
214+
snapshotCount: score.snapshotCount,
215+
currentVolume: score.currentVolume,
216+
accountAddress: score.accountAddress,
217+
liquidityScore: score.liquidityScore,
218+
uptimePercentage: score.uptimePercentage,
219+
takerStartVolume: score.takerStartVolume,
220+
makerStartVolume: score.makerStartVolume,
228221
rewardPercentage: score.rewardPercentage,
222+
startHeight: score.startHeight?.toString(),
223+
takerCurrentVolume: score.takerCurrentVolume,
224+
makerCurrentVolume: score.makerCurrentVolume,
225+
uptimeScorePonderated: score.uptimeScorePonderated,
226+
volumeScorePonderated: score.volumeScorePonderated,
227+
liquidityScorePonderated: score.liquidityScorePonderated,
228+
blockTime: score.blockTime ? new Date(score.blockTime) : undefined,
229229
createdAt: score.createdAt ? new Date(score.createdAt) : undefined,
230230
updatedAt: score.updatedAt ? new Date(score.updatedAt) : undefined,
231231
}
@@ -259,13 +259,13 @@ export class DmmGrpcTransformer {
259259
reward: GrpcRewardDistribution,
260260
): RewardDistribution {
261261
return {
262+
depth: reward.depth,
263+
reward: reward.reward,
262264
epochId: reward.epochId,
263-
accountAddress: reward.accountAddress,
264265
height: reward.height?.toString(),
266+
accountAddress: reward.accountAddress,
265267
startHeight: reward.startHeight?.toString(),
266268
blockTime: reward.blockTime ? new Date(reward.blockTime) : undefined,
267-
depth: reward.depth,
268-
reward: reward.reward,
269269
createdAt: reward.createdAt ? new Date(reward.createdAt) : undefined,
270270
updatedAt: reward.updatedAt ? new Date(reward.updatedAt) : undefined,
271271
}
@@ -283,29 +283,29 @@ export class DmmGrpcTransformer {
283283
reward: GrpcAccountVolume,
284284
): AccountVolume {
285285
return {
286-
epochId: reward.epochId,
287-
accountAddress: reward.accountAddress,
288-
height: reward.height?.toString(),
289-
blockTime: reward.blockTime ? new Date(reward.blockTime) : undefined,
290286
date: reward.date,
291-
dateTimestamp: reward.dateTimestamp
292-
? new Date(reward.dateTimestamp)
293-
: undefined,
294287
volume: reward.volume,
288+
epochId: reward.epochId,
295289
takerVolume: reward.takerVolume,
296290
makerVolume: reward.makerVolume,
297-
volumePercentage: reward.volumePercentage,
298-
makerVolumePercentage: reward.makerVolumePercentage,
299-
takerVolumePercentage: reward.takerVolumePercentage,
300291
dailyVolume: reward.dailyVolume,
292+
height: reward.height?.toString(),
293+
accountAddress: reward.accountAddress,
294+
dailyQualified: reward.dailyQualified,
295+
volumePercentage: reward.volumePercentage,
301296
dailyMakerVolume: reward.dailyMakerVolume,
302297
dailyTakerVolume: reward.dailyTakerVolume,
298+
makerVolumePercentage: reward.makerVolumePercentage,
299+
takerVolumePercentage: reward.takerVolumePercentage,
303300
dailyVolumePercentage: reward.dailyVolumePercentage,
304301
dailyMakerVolumePercentage: reward.dailyMakerVolumePercentage,
305302
dailyTakerVolumePercentage: reward.dailyTakerVolumePercentage,
306-
dailyQualified: reward.dailyQualified,
303+
blockTime: reward.blockTime ? new Date(reward.blockTime) : undefined,
307304
createdAt: reward.createdAt ? new Date(reward.createdAt) : undefined,
308305
updatedAt: reward.updatedAt ? new Date(reward.updatedAt) : undefined,
306+
dateTimestamp: reward.dateTimestamp
307+
? new Date(reward.dateTimestamp)
308+
: undefined,
309309
}
310310
}
311311

@@ -315,16 +315,16 @@ export class DmmGrpcTransformer {
315315
const volumes = response.volumes
316316

317317
return {
318-
volumes: volumes.map(
319-
DmmGrpcTransformer.grpcAccountVolumesToAccountVolumes,
320-
),
321-
currentMakerVolumePercentage: response.currentMakerVolumePercentage,
322-
averageDailyMakerVolumePercentage:
323-
response.averageDailyMakerVolumePercentage,
318+
estimatedReward: response.estimatedReward,
324319
eligibleForNextEpoch: response.eligibleForNextEpoch,
325320
eligibleForCurrentEpoch: response.eligibleForCurrentEpoch,
326-
estimatedReward: response.estimatedReward,
321+
currentMakerVolumePercentage: response.currentMakerVolumePercentage,
327322
updatedAt: response.updatedAt ? new Date(response.updatedAt) : undefined,
323+
averageDailyMakerVolumePercentage:
324+
response.averageDailyMakerVolumePercentage,
325+
volumes: volumes.map(
326+
DmmGrpcTransformer.grpcAccountVolumesToAccountVolumes,
327+
),
328328
}
329329
}
330330

0 commit comments

Comments
 (0)