Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map TransactionInfo according to Transfer['type'] #1477

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

iamacook
Copy link
Member

Summary

We were mapping the types of Transfers based on properties in the entity. However, a type decriminator exists. Migrating to this was marked as a TODO and this adjusts the code to instead use that.

Changes

  • Remove and migrate from using isERC20Transfer to instead check for type === ERC20_TRANSFER
  • Remove and migrate from using isERC721Transfer to instead check for type === ERC721_TRANSFER
  • Remove and migrate from using isNativeTokenTransfer to instead check for type === ETHER_TRANSFER

@iamacook iamacook self-assigned this Apr 29, 2024
@iamacook iamacook requested a review from a team as a code owner April 29, 2024 09:44
@@ -84,7 +79,7 @@ export class TransferInfoMapper {
token?.logoUri,
token?.trusted,
);
} else if (isNativeTokenTransfer(domainTransfer)) {
} else if (domainTransfer.type === 'ETHER_TRANSFER') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes passe our tests and I also tested them against live data.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8876525833

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 91.862%

Totals Coverage Status
Change from base Build 8876334021: -0.03%
Covered Lines: 6884
Relevant Lines: 7228

💛 - Coveralls

Comment on lines -44 to -46
export function isERC20Transfer(transfer: Transfer): transfer is ERC20Transfer {
return hasTokenAddress(transfer) && hasValue(transfer);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the helpers as they are only used in one file.

@iamacook iamacook enabled auto-merge (squash) April 29, 2024 09:54
@fmrsabino fmrsabino added the in review Someone is reviewing this Pull Request label Apr 29, 2024
@iamacook iamacook merged commit fe4089a into main Apr 29, 2024
16 checks passed
@iamacook iamacook deleted the transaction-info-type-mapping branch April 29, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Someone is reviewing this Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants