Skip to content

Default fee #438

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Default fee #438

wants to merge 9 commits into from

Conversation

dkackman
Copy link
Collaborator

@dkackman dkackman commented May 18, 2025

This PR adds a default fee that will be used anywhere the UI asks for a fee.

The implementation consists of:

  • a useDefaultFee hook that stores the default in local storage
  • a default fee setting under General Preferences (the default default is 0.0)
  • A FeeAmountInput component that handles populating the default when mounted. It also makes fee input consistent, ensuring the fee is >=0 and displays the fee token
  • Anywhere a fee is requested form the user has had the input controls replaced with FeeAmountInput

image

@dkackman dkackman requested a review from Copilot May 18, 2025 16:13
Copy link

@Copilot 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 PR introduces a default fee mechanism to be used throughout the UI by implementing a new useDefaultFee hook and replacing instances of the TokenAmountInput with a new FeeAmountInput component to ensure fee consistency. Key changes include:

  • Creation of the useDefaultFee hook to manage fee values in local storage.
  • Replacement of traditional fee inputs with FeeAmountInput across multiple pages and dialogs.
  • Adjustments in the settings page for managing the default fee.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pages/ViewOffer.tsx Replaced Input with FeeAmountInput for network fee input.
src/pages/Settings.tsx Added default fee setting via useDefaultFee and TokenAmountInput.
src/pages/Send.tsx Integrated useDefaultFee and updated fee input to FeeAmountInput.
src/pages/Offers.tsx Updated fee input and removed default fee in cancel form.
src/pages/MintNft.tsx Updated fee input to FeeAmountInput.
src/pages/MakeOffer.tsx Replaced fee input with FeeAmountInput and added temporary debug logs.
src/pages/IssueToken.tsx Replaced fee input with FeeAmountInput.
src/pages/CreateProfile.tsx Replaced fee input with FeeAmountInput.
src/hooks/useDefaultFee.ts Introduced the useDefaultFee hook with local storage support.
src/components/ui/masked-input.tsx Added FeeAmountInput component wrapping TokenAmountInput.
src/components/TransferDialog.tsx Replaced fee input with FeeAmountInput.
src/components/NftCard.tsx Updated fee input to FeeAmountInput and removed default fee.
src/components/FeeOnlyDialog.tsx Replaced fee input with FeeAmountInput.
src/components/CoinsCard.tsx Updated fee inputs in multiple forms to use FeeAmountInput while removing several default values.
src/components/AssignNftDialog.tsx Replaced fee input with FeeAmountInput and removed default fee.
Comments suppressed due to low confidence (3)

src/components/CoinsCard.tsx:255

  • [nitpick] The default fee value for the combineFee field was removed. Please verify that the FeeAmountInput component correctly provides a fallback value or consider initializing this field explicitly.
defaultValues: { combineFee: '0', },

src/components/CoinsCard.tsx:307

  • [nitpick] The default fee value for the autoCombineFee field has been removed. Verify that FeeAmountInput handles the initial fee appropriately or initialize the field explicitly as needed.
defaultValues: { autoCombineFee: '0',

src/components/ui/masked-input.tsx:152

  • The translation function 't' is used without an explicit import; please import it from the appropriate module (e.g., '@lingui/core/macro') to ensure proper usage.
placeholder={t`Enter network fee`}

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.

1 participant