Skip to content

Conversation

@AntonioVentilii
Copy link
Collaborator

Motivation

Tokens EXT have zero fee, while the other standards the we support in ICP network have their imbedded fee. To centralize the logic, we create an util to extract the fee based on the standard.

Copilot AI review requested due to automatic review settings December 3, 2025 08:40
@AntonioVentilii AntonioVentilii requested a review from a team as a code owner December 3, 2025 08:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a utility function to centralize fee extraction logic for tokens in the ICP network, addressing the difference between EXT v2 tokens (which have zero fees) and other supported standards (ICP, ICRC, DIP20) that have embedded fees.

Key changes:

  • Created getTokenFee utility function that returns zero for EXT v2 tokens, extracts the fee for ICP/ICRC/DIP20 tokens, and returns undefined for non-ICP token standards
  • Refactored IcTokenFee and IcSendAmount components to use the new utility instead of direct type casting to OptionIcToken
  • Added comprehensive test coverage for the new utility function and updated component tests

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/frontend/src/icp/utils/token.utils.ts New utility function getTokenFee that centralizes fee extraction logic based on token standard
src/frontend/src/tests/icp/utils/token.utils.spec.ts Comprehensive test suite for the new utility function covering all token standards
src/frontend/src/icp/components/fee/IcTokenFee.svelte Refactored to use getTokenFee utility instead of type casting
src/frontend/src/icp/components/send/IcSendAmount.svelte Refactored to use getTokenFee utility instead of type casting
src/frontend/src/tests/icp/components/fee/IcTokenFee.spec.ts Added test case for EXT token fee rendering and improved test structure with beforeEach

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AntonioVentilii AntonioVentilii added this pull request to the merge queue Dec 3, 2025
Merged via the queue into main with commit 1b2d50c Dec 3, 2025
79 checks passed
@AntonioVentilii AntonioVentilii deleted the feat-frontend/Util-to-extract-the-fee-from-tokens-in-ICP-network branch December 3, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants