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

feat: Implement unstaking confirmation #13921

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

Conversation

pedronfigueiredo
Copy link
Contributor

Description

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/4379

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Screenshot 2025-03-06 at 17 36 48

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Mar 7, 2025
@pedronfigueiredo pedronfigueiredo self-assigned this Mar 7, 2025
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner March 7, 2025 15:07
@pedronfigueiredo pedronfigueiredo added the Run Smoke E2E Triggers smoke e2e on Bitrise label Mar 7, 2025
Copy link
Contributor

github-actions bot commented Mar 7, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Contributor

github-actions bot commented Mar 7, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 23f65b0
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b42e7939-a23a-4794-a8ef-51aa286ed641

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/unstaking-confirmation branch 2 times, most recently from b9938cc to 657a0c7 Compare March 7, 2025 16:52
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner March 7, 2025 16:52
@pedronfigueiredo pedronfigueiredo force-pushed the pnf/unstaking-confirmation branch from 657a0c7 to bc92294 Compare March 7, 2025 17:07
Comment on lines 21 to 22


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

digiwand
digiwand previously approved these changes Mar 8, 2025
}
}),
});
expect(getByText('Withdrawal time')).toBeDefined();
Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm, is this is the confirmed copy? Figma is using "Unstaking time"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I confirmed with Saya that we want to keep withdrawal time, the designs will be updated

Comment on lines 121 to 130
AccountsController: {
internalAccounts: {
accounts: {
'0x0000000000000000000000000000000000000000': {
address: '0x0000000000000000000000000000000000000000',
},
},
selectedAccount: '0x0000000000000000000000000000000000000000',
},
},
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to put this AccountsController state into stakingWithdrawalConfirmationState? It looks a needed state almost all tests.

// eslint-disable-next-line import/no-namespace
import * as ConfirmationRedesignEnabled from '../hooks/useConfirmationRedesignEnabled';

import { merge } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

Minor, can we make package imports on top of file

// eslint-disable-next-line import/no-namespace
import * as ConfirmationRedesignEnabled from '../hooks/useConfirmationRedesignEnabled';

import { merge } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

Minor, can we make package imports on top of file

import styleSheet from './AdvancedDetails.styles';

const AdvancedDetails = () => {
const { styles } = useStyles(styleSheet, {});
const transactionMeta = useTransactionMetadataRequest();

return (
<View style={styles.container}>
<InfoSectionAccordion header={strings('stake.advanced_details')}>
Copy link
Member

Choose a reason for hiding this comment

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

If we think of this component as a generic one - does it make sense to change stake.advanced_details to confirmations.advanced_details or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if we will use this component as generic to more confirmation types. InfoSectionAccordion can be leveraged for other advanced details, but the internals will need to be changed significantly if we wanted to reuse this specific component.

Copy link
Member

@OGPoyraz OGPoyraz Mar 11, 2025

Choose a reason for hiding this comment

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

If we don't think this as generic component then this is just an extra file hop in the StakingDeposit file. If nothing on this component will be re-used - then would it make sense do

<InfoSectionAccordion header={strings('stake.advanced_details')}>
        <ContractInteractionDetails variant={ContractInteractionDetailsVariant.StakingDeposit} />
</InfoSectionAccordion>

instead of

<AdvancedDetails />

in StakingDeposit?

Because similar thing has done in StakingWithdrawal already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair enough, I'll remove the advanced details file 👍

<Text>{strings('stake.ethereum_mainnet')}</Text>
</View>
</InfoRow>
<ContractInteractionDetails variant={ContractInteractionDetailsVariant.StakingDeposit} />
Copy link
Member

Choose a reason for hiding this comment

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

As similar note above, what do we think of deriving variant in ContractInteractionDetails? Because if this is a generic AdvancedDetails component then it shouldn't rely on any variant passed by this component.

We could also fix these similar queries by introducing ConfirmationContext as we do in extension. I will probably introduce ConfirmationContext in #13919

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's a good thought, I will change to using the transaction type internally in the contract interaction details instead of the variant.

Copy link
Member

@OGPoyraz OGPoyraz Mar 11, 2025

Choose a reason for hiding this comment

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

Minor, on related note if ContractInteractionDetails is just purpose of serving those details only for staking operations - maybe we could rename this into StakingContractInteractionDetails. Since we are planning to give code ownership to them it would be more clear if we rename like that. We could do this change later - it's not urgent, just flagging here.

@pedronfigueiredo pedronfigueiredo added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Mar 11, 2025
Copy link
Contributor

github-actions bot commented Mar 11, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: da36f6c
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/e3bff41f-ca15-4e42-9f38-6cbde8bd9fdb

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/unstaking-confirmation branch from 9482b67 to 16d6d56 Compare March 12, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants