Skip to content

Conversation

@przemyslaw-wlodek
Copy link
Contributor

@przemyslaw-wlodek przemyslaw-wlodek commented Dec 8, 2025

Checklist

  • JIRA
  • Proper tests implemented
  • Screenshots added.

Please see the commits.

@lace-bot
Copy link
Collaborator

lace-bot commented Dec 8, 2025

Allure Report

allure-report-publisher generated test report!

processReports: ❌ test report for 3f179f81

passed failed skipped flaky total result
Total 33 2 5 0 40

@przemyslaw-wlodek przemyslaw-wlodek force-pushed the feat/LW-13693-midnight-onboarding-v1 branch 4 times, most recently from abecbef to 9ca9d2d Compare December 9, 2025 16:52
@przemyslaw-wlodek przemyslaw-wlodek marked this pull request as ready for review December 9, 2025 16:53
@przemyslaw-wlodek przemyslaw-wlodek requested a review from a team as a code owner December 9, 2025 16:53
@przemyslaw-wlodek przemyslaw-wlodek force-pushed the feat/LW-13693-midnight-onboarding-v1 branch 2 times, most recently from abfa24b to 57cf49a Compare December 9, 2025 18:57
@DominikGuzei DominikGuzei self-requested a review December 10, 2025 12:53
Copy link
Member

@DominikGuzei DominikGuzei left a comment

Choose a reason for hiding this comment

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

Great work 👏

@przemyslaw-wlodek przemyslaw-wlodek force-pushed the feat/LW-13693-midnight-onboarding-v1 branch from 57cf49a to a96354e Compare December 10, 2025 15:19
Comment on lines 32 to 36
const keyMaterialBytes = await Wallet.KeyManagement.emip3decrypt(
new Uint8Array(Buffer.from(walletToReuse.encryptedRecoveryPhrase, 'hex')),
new Uint8Array(Buffer.from(password))
);
mnemonic = Buffer.from(keyMaterialBytes).toString('utf8').split(' ');
Copy link
Contributor

Choose a reason for hiding this comment

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

could have created some getMnemonicForWallet somewhere in the lmp utils? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! Thanks. I am currently applying some of the improvements, like this one. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, this is the same as what is happening here. Maybe you can reuse

import { Portal } from '@views/browser/features/wallet-setup/components/Portal';
import { APP_MODE, lmpModeStorage } from '@src/utils/lmp';

const CAME_FROM_LMP_KEY = 'lace-came-from-lmp';
Copy link
Contributor

Choose a reason for hiding this comment

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

We should centralize this key and not repeat it

wallet !== null && typeof wallet === 'object' && 'walletName' in wallet;

const getWalletDisplayName = (wallet: unknown): string | undefined =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a more exact type

Suggested change
// eslint-disable-next-line @typescript-eslint/no-explicit-any

Comment on lines 11 to 15
type MidnightWallet = { walletId: string; walletName: string; encryptedRecoveryPhrase?: string };

const isMidnightWallet = (wallet: unknown): wallet is MidnightWallet =>
wallet !== null && typeof wallet === 'object' && 'walletName' in wallet;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like this? We don't need to create this MidnightWallet type and LmpBundleWallet has a blockchain property which is a more deterministic way to check this

Suggested change
type MidnightWallet = { walletId: string; walletName: string; encryptedRecoveryPhrase?: string };
const isMidnightWallet = (wallet: unknown): wallet is MidnightWallet =>
wallet !== null && typeof wallet === 'object' && 'walletName' in wallet;
const isMidnightWallet = (wallet: unknown): wallet is LmpBundleWallet =>
wallet !== null && typeof wallet === 'object' && (wallet as LmpBundleWallet).blockchain === 'Midnight';

Comment on lines 32 to 36
const keyMaterialBytes = await Wallet.KeyManagement.emip3decrypt(
new Uint8Array(Buffer.from(walletToReuse.encryptedRecoveryPhrase, 'hex')),
new Uint8Array(Buffer.from(password))
);
mnemonic = Buffer.from(keyMaterialBytes).toString('utf8').split(' ');
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, this is the same as what is happening here. Maybe you can reuse


export type ReusableWallet =
| AnyWallet<Wallet.WalletMetadata, Wallet.AccountMetadata>
| { walletId: string; walletName: string; encryptedRecoveryPhrase?: string };
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
| { walletId: string; walletName: string; encryptedRecoveryPhrase?: string };
| LmpBundleWallet;

@przemyslaw-wlodek przemyslaw-wlodek force-pushed the feat/LW-13693-midnight-onboarding-v1 branch 4 times, most recently from f328133 to b3a2493 Compare December 12, 2025 18:10
- Add Midnight to "Select Blockchain" screen (create/restore wallet)
- Remove separate AddNewMidnightWalletLink from dropdown menu
- Add useLMP hook with startMidnightCreate/Restore methods
@przemyslaw-wlodek przemyslaw-wlodek force-pushed the feat/LW-13693-midnight-onboarding-v1 branch from b3a2493 to 4bd853f Compare December 12, 2025 19:01
@pczeglik-iohk pczeglik-iohk requested a review from a team as a code owner December 12, 2025 21:42
@sonarqubecloud
Copy link

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.

7 participants