Skip to content

Commit 3d8ea35

Browse files
chore: improved trezor onboarding
1 parent 16a0650 commit 3d8ea35

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

apps/browser-extension-wallet/src/hooks/useWalletManager.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ const getHwExtendedAccountPublicKey = async (
109109
accountIndex
110110
});
111111
case WalletType.Trezor:
112-
await Wallet.Trezor.TrezorKeyAgent.initializeTrezorTransport({
113-
manifest: Wallet.manifest,
114-
communicationType: Wallet.KeyManagement.CommunicationType.Web
115-
});
116112
return Wallet.Trezor.TrezorKeyAgent.getXpub({
117113
communicationType: Wallet.KeyManagement.CommunicationType.Web,
118114
accountIndex

apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/components/HardwareWalletFlow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ export const HardwareWalletFlow = ({
203203
await analytics.sendAliasEvent();
204204
}
205205

206-
if (typeof deviceConnection === 'object') {
206+
// To be checked in LW-9970
207+
if (connectedDevice !== WalletType.Trezor && typeof deviceConnection === 'object') {
207208
deviceConnection.transport.close();
208209
}
209210
}

apps/browser-extension-wallet/src/views/browser-view/features/wallet-setup/helpers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ export const getHWPersonProperties = async (
3737
connectedDevice: Wallet.HardwareWallets,
3838
deviceConnection: Wallet.DeviceConnection
3939
): Promise<PostHogProperties> => {
40+
// TODO: Remove these hardcoded specs once we have a logic that will prevent additional interaction with 3rd party Trezor Connect popup
41+
const trezorSpecificationsHC: HardwareWalletPersonProperties = {
42+
// We are only accepting Model T for now
43+
model: `${WalletType.Trezor} model T`
44+
};
4045
const HWSpecifications =
4146
connectedDevice === WalletType.Trezor
42-
? await getTrezorSpecifications()
47+
? trezorSpecificationsHC
4348
: await getLedgerSpecifications(deviceConnection as HardwareLedger.LedgerKeyAgent['deviceConnection']);
4449
return {
4550
$set_once: {

packages/cardano/src/wallet/lib/hardware-wallet.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ const connectDevices: Record<HardwareWallets, () => Promise<DeviceConnection>> =
2424
[WalletType.Ledger]: async () =>
2525
await HardwareLedger.LedgerKeyAgent.checkDeviceConnection(DEFAULT_COMMUNICATION_TYPE),
2626
...(AVAILABLE_WALLETS.includes(WalletType.Trezor) && {
27-
[WalletType.Trezor]: async () => {
28-
const isTrezorInitialized = await HardwareTrezor.TrezorKeyAgent.initializeTrezorTransport({
27+
[WalletType.Trezor]: async () =>
28+
await HardwareTrezor.TrezorKeyAgent.initializeTrezorTransport({
2929
manifest,
3030
communicationType: DEFAULT_COMMUNICATION_TYPE
31-
});
32-
33-
// initializeTrezorTransport would still succeed even when device is not connected
34-
await HardwareTrezor.TrezorKeyAgent.checkDeviceConnection(DEFAULT_COMMUNICATION_TYPE);
35-
36-
return isTrezorInitialized;
37-
}
31+
})
3832
})
3933
};
4034

0 commit comments

Comments
 (0)