Skip to content

Commit

Permalink
fix: add missing fields to dtos (#75)
Browse files Browse the repository at this point in the history
# What ❔

Add missing fields to dtos so they are displayed in docs.

## Why ❔

A couple of fields were missing and are not displayed in docs. This PR
is supposed to fix it.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [X] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [X] Documentation comments have been added / updated.

---------

Co-authored-by: Roman Petriv <[email protected]>
  • Loading branch information
vasyl-ivanchuk and Romsters authored Nov 2, 2023
1 parent a3a9cf6 commit daea529
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/api/account/account.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ describe("AccountController", () => {
tokenSymbol: "TKN",
transactionIndex: "10",
value: "1000000",
type: "255",
transactionType: "255",
},
],
});
Expand Down Expand Up @@ -547,7 +547,7 @@ describe("AccountController", () => {
tokenSymbol: "TKN",
transactionIndex: "10",
value: "1000000",
type: "255",
transactionType: "255",
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,11 @@ export class AccountInternalTransactionDto {
example: "",
})
public readonly errCode: string;

@ApiProperty({
type: String,
description: "The type of the parent transaction",
example: "255",
})
public readonly transactionType: string;
}
7 changes: 7 additions & 0 deletions packages/api/src/api/dtos/account/accountTokenTransfer.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ export class AccountTokenTransferDto {
example: "18",
})
public readonly tokenDecimal: string;

@ApiProperty({
type: String,
description: "The type of the parent transaction",
example: "255",
})
public readonly transactionType: string;
}

export class AccountNFTTransferDto extends AccountTokenTransferDto {
Expand Down
7 changes: 7 additions & 0 deletions packages/api/src/api/dtos/account/accountTransaction.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,11 @@ export class AccountTransactionDto {
example: "transfer(address to, uint256 tokens)",
})
public readonly functionName: string;

@ApiProperty({
type: String,
description: "The type of the transaction",
example: "255",
})
public readonly type: string;
}
4 changes: 2 additions & 2 deletions packages/api/src/api/mappers/transferMapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("transferMapper", () => {
tokenSymbol: "TKN",
transactionIndex: "10",
value: "1000000",
type: "255",
transactionType: "255",
});
});

Expand Down Expand Up @@ -159,7 +159,7 @@ describe("transferMapper", () => {
tokenSymbol: "TKN",
transactionIndex: "10",
value: "1000000",
type: "255",
transactionType: "255",
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/api/mappers/transferMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export const mapTransferListItem = (transfer: Transfer, lastBlockNumber: number)
confirmations: (lastBlockNumber - transfer.blockNumber).toString(),
fee: transfer.transaction?.fee ? BigNumber.from(transfer.transaction.fee).toString() : undefined,
l1BatchNumber: transfer.transaction?.l1BatchNumber.toString(),
type: transfer.transaction?.type.toString(),
transactionType: transfer.transaction?.type.toString(),
});
18 changes: 9 additions & 9 deletions packages/api/test/account-api.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "105",
type: "255",
transactionType: "255",
},
{
blockHash: "0x4f86d6647711915ac90e5ef69c29845946f0a55b3feaa0488aece4a359f79cb1",
Expand All @@ -330,7 +330,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "103",
type: "255",
transactionType: "255",
},
{
blockHash: "0x4f86d6647711915ac90e5ef69c29845946f0a55b3feaa0488aece4a359f79cb1",
Expand All @@ -354,7 +354,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "101",
type: "255",
transactionType: "255",
},
],
status: "1",
Expand Down Expand Up @@ -394,7 +394,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "ETH",
transactionIndex: "1",
value: "104",
type: "255",
transactionType: "255",
},
{
blockHash: "0x4f86d6647711915ac90e5ef69c29845946f0a55b3feaa0488aece4a359f79cb1",
Expand All @@ -418,7 +418,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "ETH",
transactionIndex: "1",
value: "102",
type: "255",
transactionType: "255",
},
{
blockHash: "0x4f86d6647711915ac90e5ef69c29845946f0a55b3feaa0488aece4a359f79cb1",
Expand All @@ -442,7 +442,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "ETH",
transactionIndex: "1",
value: "100",
type: "255",
transactionType: "255",
},
],
status: "1",
Expand Down Expand Up @@ -480,7 +480,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "105",
type: "255",
transactionType: "255",
},
{
blockHash: "0x4f86d6647711915ac90e5ef69c29845946f0a55b3feaa0488aece4a359f79cb1",
Expand All @@ -504,7 +504,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "103",
type: "255",
transactionType: "255",
},
],
status: "1",
Expand Down Expand Up @@ -542,7 +542,7 @@ describe("Account API (e2e)", () => {
tokenSymbol: "TKN",
transactionIndex: "1",
value: "101",
type: "255",
transactionType: "255",
},
],
status: "1",
Expand Down

0 comments on commit daea529

Please sign in to comment.