Skip to content

Commit

Permalink
Merge pull request #109 from lidofinance/feature/si-835-implementatio…
Browse files Browse the repository at this point in the history
…n-buffer

feature: added request info to response
  • Loading branch information
DiRaiks authored Oct 16, 2023
2 parents ff2aff8 + db6a083 commit 5b1c89a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/http/request-time/dto/request-time-by-request-id.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { RequestDto } from './request.dto';

export class RequestTimeByRequestIdDto {
@ApiProperty({
Expand All @@ -7,12 +8,6 @@ export class RequestTimeByRequestIdDto {
})
ms: number;

@ApiProperty({
example: 5,
description: 'Request Id',
})
requestId: string;

@ApiProperty({
example: '2023-10-04T15:14:24.202Z',
description: 'Withdrawal At',
Expand All @@ -27,4 +22,21 @@ export class RequestTimeByRequestIdDto {
ms: number;
withdrawalAt: string;
};

@ApiProperty({
example: 5,
description: 'Request Id',
})
requestId: string;

@ApiProperty({
example: {
id: '1',
amountOfStETH: '2',
amountOfShares: '2',
timestamp: '2023-10-04T15:14:24.202Z',
},
description: 'Request',
})
request: RequestDto;
}
17 changes: 17 additions & 0 deletions src/http/request-time/dto/request.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { WithdrawalRequest } from '../../../storage/queue-info/queue-info.types';

export class RequestDto {
id: string;
amountOfStETH: string;
amountOfShares: string;
timestamp: string;
}

export const transformToRequestDto = (request: WithdrawalRequest): RequestDto => {
return {
id: request.id.toString(),
amountOfStETH: request.amountOfStETH.toString(),
amountOfShares: request.amountOfStETH.toString(),
timestamp: new Date(request.timestamp.toNumber() * 1000).toISOString(),
};
};
2 changes: 2 additions & 0 deletions src/http/request-time/request-time.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { RequestTimeV2Dto } from './dto/request-time-v2.dto';
import { LOGGER_PROVIDER } from '@lido-nestjs/logger';
import { RequestTimeByRequestIdDto } from './dto/request-time-by-request-id.dto';
import { WithdrawalRequest } from '../../storage/queue-info/queue-info.types';
import { transformToRequestDto } from './dto/request.dto';

@Injectable()
export class RequestTimeService {
Expand Down Expand Up @@ -130,6 +131,7 @@ export class RequestTimeService {

return {
requestId: request.id.toString(),
request: transformToRequestDto(request),
ms: toTimeWithdrawal,
withdrawalAt: new Date(requestTimestamp + toTimeWithdrawal).toISOString(),
withVEBO: {
Expand Down

0 comments on commit 5b1c89a

Please sign in to comment.