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

GIX-1890: Add Transaction Fee confirm screen #3327

Closed
wants to merge 1 commit into from

Conversation

lmuntaner
Copy link
Contributor

@lmuntaner lmuntaner commented Sep 18, 2023

PENDING

Confirm: The fee is not subtracted from the maturity. Instead, it just used as an arbitrary minimum to mint the tokens.

Motivation

Add transaction fee in the confirmation screen when disbursing maturity.

Changes

  • Pass the IcrcTokenMetadata as prop instead of just the tokenSymbol in DisburseMaturityModal.
  • Add one more KeyValuePair in DisburseMaturityModal confirmation screen.

Tests

  • Fill the tokensStore in spec file for SnsDisburseMaturityModal.
  • Add expect in "should display summary information in the last step".

Todos

  • Add entry to changelog (if necessary).
    Not necessary. It's covered by the disburse maturity changelog entry.

@lmuntaner lmuntaner requested a review from dskloetd September 18, 2023 11:06
@lmuntaner
Copy link
Contributor Author

New UI:

Screenshot 2023-09-18 at 13 01 25

@lmuntaner
Copy link
Contributor Author

@dskloetd please review

Copy link
Contributor

Choose a reason for hiding this comment

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

In the screenshot, the transaction fee is larger than the entire amount disbursed.
How does this work? Where is the transaction fee subtracted from?
And should we prevent this or at least warn against it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have another branch that solves that.

@@ -26,8 +26,8 @@
$snsProjectMainAccountStore?.identifier ?? ""
);

let token: Token | undefined;
$: token = $tokensStore[$selectedUniverseIdStore.toText()]?.token;
let token: IcrcTokenMetadata | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

We are still getting token from the $tokensStore. How can it be that the type is different now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IcrcTokenMetadata extends Token

on:nnsDisburseMaturity={disburseMaturity}
on:nnsClose
/>
{#if nonNullish(token)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed now but not before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Beucase it was passing only the tokenSymbol and falling back to "".

@@ -77,8 +84,9 @@ describe("SnsDisburseMaturityModal", () => {
await po.clickNextButton();

expect(await po.getConfirmPercentage()).toBe("50%");
expect(await po.getConfirmTokens()).toBe("0.48-0.53 ICP");
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a bug? Are you fixing a bug at the same time in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not a bug, but the setup of the test was wrong.

When I set it for the transaction fee, this surfaced. I didn't fee it was big enough to deserve its own PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: #3328


async getTransactionFee(): Promise<string> {
return (
await this.getNeuronConfirmActionScreenPo().getText("token-value-label")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this relying on there being only 1 token amount in the modal?
Might be better to explicitly refer to the fee.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I also thought so, I didn't want to add anything else to this PR, but I'll add a testId prop to the AmountDisplay

@lmuntaner lmuntaner marked this pull request as draft September 18, 2023 13:44
@lmuntaner
Copy link
Contributor Author

The fee is not deducted, it's only used as a minimum. Therefore, there is no need to show it in the confirmation screen.

@lmuntaner lmuntaner closed this Sep 18, 2023
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