From 8a51b0594c2822d771008cd5f5c907710702d762 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Fri, 19 Jul 2024 16:53:34 +0200 Subject: [PATCH 1/4] Check if account is ledger HW account when we don't know --- .../AccountsClient+Interface.swift | 9 ++++++++ .../AddressView/AddressDetails+View.swift | 11 ---------- .../AddressView/AddressDetails.swift | 22 +++++++++++++++++++ .../AddressView/AddressView.swift | 2 +- .../SharedModels/LedgerIdentifiable.swift | 4 +++- .../ReceivingAccount+Reducer.swift | 4 ++-- .../NewAccountCompletion+View.swift | 5 +++-- .../DappDetails/DappDetails+View.swift | 2 +- .../PersonaDetails/PersonaDetails+View.swift | 2 +- ...MigrateOlympiaAccountsToBabylon+View.swift | 2 +- .../TransactionReviewAccount+View.swift | 2 +- 11 files changed, 44 insertions(+), 21 deletions(-) diff --git a/RadixWallet/Clients/AccountsClient/AccountsClient+Interface.swift b/RadixWallet/Clients/AccountsClient/AccountsClient+Interface.swift index 21bdcf8b1d..694e15084e 100644 --- a/RadixWallet/Clients/AccountsClient/AccountsClient+Interface.swift +++ b/RadixWallet/Clients/AccountsClient/AccountsClient+Interface.swift @@ -139,4 +139,13 @@ extension AccountsClient { public func saveVirtualAccount(_ account: Account) async throws { try await saveVirtualAccounts([account]) } + + public func isLedgerHWAccount(_ address: AccountAddress) async -> Bool { + do { + let account = try await getAccountByAddress(address) + return account.isLedgerControlled + } catch { + return false + } + } } diff --git a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails+View.swift b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails+View.swift index 8aabd419ae..58f46f4ffd 100644 --- a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails+View.swift +++ b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails+View.swift @@ -221,14 +221,3 @@ private extension AddressDetails.View { return .init(result) } } - -private extension AddressDetails.State { - var showVerifyOnLedger: Bool { - switch address { - case let .account(_, isLedgerHWAccount): - isLedgerHWAccount - default: - false - } - } -} diff --git a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift index 87a529351e..8c0c608f22 100644 --- a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift +++ b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift @@ -9,6 +9,7 @@ public struct AddressDetails: Sendable, FeatureReducer { var showEnlarged = false var showShare = false + var showVerifyOnLedger = false public init(address: LedgerIdentifiable.Address) { self.address = address @@ -31,6 +32,7 @@ public struct AddressDetails: Sendable, FeatureReducer { public enum InternalAction: Sendable, Equatable { case loadedTitle(TaskResult) case loadedQrImage(TaskResult) + case loadedShowVerifyOnLedger(Bool) } @Dependency(\.accountsClient) var accountsClient @@ -48,6 +50,7 @@ public struct AddressDetails: Sendable, FeatureReducer { case .task: return loadTitleEffect(state: &state) .merge(with: loadQrCodeEffect(state: &state)) + .merge(with: loadShowVerifyOnLedgerEffect(state: state)) case .copyButtonTapped: pasteboardClient.copyString(state.address.address) return .none @@ -97,6 +100,9 @@ public struct AddressDetails: Sendable, FeatureReducer { case let .loadedQrImage(.failure(error)): state.qrImage = .failure(error) return .none + case let .loadedShowVerifyOnLedger(value): + state.showVerifyOnLedger = value + return .none } } @@ -141,6 +147,22 @@ public struct AddressDetails: Sendable, FeatureReducer { await send(.internal(.loadedQrImage(result))) } } + + private func loadShowVerifyOnLedgerEffect(state: State) -> Effect { + switch state.address { + case let .account(address, isLedgerHWAccount): + if let isLedgerHWAccount { + .send(.internal(.loadedShowVerifyOnLedger(isLedgerHWAccount))) + } else { + .run { send in + let showVerifyOnLedger = await accountsClient.isLedgerHWAccount(address) + await send(.internal(.loadedShowVerifyOnLedger(showVerifyOnLedger))) + } + } + default: + .send(.internal(.loadedShowVerifyOnLedger(false))) + } + } } // MARK: - Helpers diff --git a/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift b/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift index b30c2b4e80..1e670ad907 100644 --- a/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift +++ b/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift @@ -141,7 +141,7 @@ private extension AddressView { #if DEBUG struct AddressView_Previews: PreviewProvider { static var previews: some View { - AddressView(.address(.account(try! .init(validatingAddress: "account_tdx_b_1p8ahenyznrqy2w0tyg00r82rwuxys6z8kmrhh37c7maqpydx7p")))) + AddressView(.address(.account(try! .init(validatingAddress: "account_tdx_b_1p8ahenyznrqy2w0tyg00r82rwuxys6z8kmrhh37c7maqpydx7p"), isLedgerHWAccount: false))) } } #endif diff --git a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift index dd7e48015c..e10c8cbd3a 100644 --- a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift +++ b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift @@ -33,7 +33,9 @@ public enum LedgerIdentifiable: Sendable { // MARK: LedgerIdentifiable.Address extension LedgerIdentifiable { public enum Address: Hashable, Sendable, Identifiable { - case account(AccountAddress, isLedgerHWAccount: Bool = false) + /// `isLedgerHWAccount` indicates if the account is controlled by a Ledger device. + /// if the value is nil, it means we don't know. + case account(AccountAddress, isLedgerHWAccount: Bool?) case package(PackageAddress) case resource(ResourceAddress) case resourcePool(PoolAddress) diff --git a/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift b/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift index ff65395c94..6738fe0215 100644 --- a/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift +++ b/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift @@ -86,9 +86,9 @@ extension AccountOrAddressOf { var identifer: LedgerIdentifiable { switch self { case let .profileAccount(value: account): - .address(.account(account.address)) + .address(.account(account.address, isLedgerHWAccount: account.isLedgerControlled)) case let .addressOfExternalAccount(address): - .address(.account(address)) + .address(.account(address, isLedgerHWAccount: false)) } } diff --git a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift index 23f441c48b..8db26acad0 100644 --- a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift +++ b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift @@ -16,6 +16,7 @@ extension NewAccountCompletion { let subtitle: String let accountAddress: AccountAddress + let isLedgerController: Bool let appearanceID: AppearanceID init(state: NewAccountCompletion.State) { @@ -31,8 +32,8 @@ extension NewAccountCompletion { } self.isFirstOnNetwork = state.isFirstOnNetwork - self.accountAddress = state.account.address + self.isLedgerController = state.account.isLedgerControlled self.appearanceID = state.account.appearanceID self.explanation = L10n.CreateAccount.Completion.explanation @@ -106,7 +107,7 @@ private extension NewAccountCompletion.View { .textStyle(.body1Header) .multilineTextAlignment(.center) - AddressView(.address(.account(viewStore.accountAddress)), isTappable: false) + AddressView(.address(.account(viewStore.accountAddress, isLedgerHWAccount: viewStore.isLedgerController)), isTappable: false) .foregroundColor(.app.whiteTransparent) .textStyle(.body2HighImportance) } diff --git a/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift b/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift index 3d297ac4d8..2036350992 100644 --- a/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift +++ b/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift @@ -174,7 +174,7 @@ extension DappDetails.View { Spacer(minLength: 0) AddressView( - .address(.account(viewStore.address)), + .address(.account(viewStore.address, isLedgerHWAccount: false)), imageColor: .app.gray2 ) .foregroundColor(.app.gray1) diff --git a/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift b/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift index c89eb98b43..f67ae0e9ce 100644 --- a/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift +++ b/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift @@ -199,7 +199,7 @@ extension PersonaDetails.View { ForEach(viewStore.sharingAccounts) { account in SmallAccountCard( account.label.rawValue, - identifiable: .address(.account(account.address)), + identifiable: .address(.account(account.address, isLedgerHWAccount: nil)), gradient: .init(account.appearanceId) ) .cornerRadius(.small1) diff --git a/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift b/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift index 5d604d2552..798b3c0900 100644 --- a/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift +++ b/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift @@ -123,7 +123,7 @@ extension CompletionMigrateOlympiaAccountsToBabylon { Text(name) .textStyle(.body1Header) } - AddressView(.address(.account(account.address))) + AddressView(.address(.account(account.address, isLedgerHWAccount: nil))) .opacity(0.8) } .foregroundColor(.app.white) diff --git a/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift b/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift index fb911682b9..238029b6cb 100644 --- a/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift +++ b/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift @@ -166,7 +166,7 @@ extension SmallAccountCard where Accessory == EmptyView { case let .external(accountAddress, _): self.init( L10n.TransactionReview.externalAccountName, - identifiable: .address(.account(accountAddress)), + identifiable: .address(.account(accountAddress, isLedgerHWAccount: false)), gradient: .init(colors: [.app.gray2]), verticalPadding: .small1 ) From c08eee22e934ffaad8fd9c657ca64e06b92ac14b Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Fri, 19 Jul 2024 16:56:43 +0200 Subject: [PATCH 2/4] Improve comment --- RadixWallet/Core/SharedModels/LedgerIdentifiable.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift index e10c8cbd3a..fde17a5f14 100644 --- a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift +++ b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift @@ -34,7 +34,9 @@ public enum LedgerIdentifiable: Sendable { extension LedgerIdentifiable { public enum Address: Hashable, Sendable, Identifiable { /// `isLedgerHWAccount` indicates if the account is controlled by a Ledger device. - /// if the value is nil, it means we don't know. + /// - `true`: we know the account is controlled by a Ledger device + /// - `false`: either the account isn't controller by a Ledger device or it is an external account and we don't care. + /// - `nil`: we don't know if the account is controller by a Ledger device, we should check if needed. case account(AccountAddress, isLedgerHWAccount: Bool?) case package(PackageAddress) case resource(ResourceAddress) From c9b8ece764db4d2478967e6da11cdc4e20ffdea5 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Fri, 19 Jul 2024 17:01:53 +0200 Subject: [PATCH 3/4] Fix typo --- .../NewAccountCompletion/NewAccountCompletion+View.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift index 8db26acad0..8c4fef532c 100644 --- a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift +++ b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift @@ -16,7 +16,7 @@ extension NewAccountCompletion { let subtitle: String let accountAddress: AccountAddress - let isLedgerController: Bool + let isLedgerControlled: Bool let appearanceID: AppearanceID init(state: NewAccountCompletion.State) { @@ -33,7 +33,7 @@ extension NewAccountCompletion { self.isFirstOnNetwork = state.isFirstOnNetwork self.accountAddress = state.account.address - self.isLedgerController = state.account.isLedgerControlled + self.isLedgerControlled = state.account.isLedgerControlled self.appearanceID = state.account.appearanceID self.explanation = L10n.CreateAccount.Completion.explanation @@ -107,7 +107,7 @@ private extension NewAccountCompletion.View { .textStyle(.body1Header) .multilineTextAlignment(.center) - AddressView(.address(.account(viewStore.accountAddress, isLedgerHWAccount: viewStore.isLedgerController)), isTappable: false) + AddressView(.address(.account(viewStore.accountAddress, isLedgerHWAccount: viewStore.isLedgerControlled)), isTappable: false) .foregroundColor(.app.whiteTransparent) .textStyle(.body2HighImportance) } From 2cb4067f5fe667ed996aa1d02482a6758e2929bd Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 22 Jul 2024 11:52:12 +0200 Subject: [PATCH 4/4] Remove isLedgerHWAccount and manually check --- .../AddressView/AddressDetails.swift | 16 ++++++---------- .../FeaturePrelude/AddressView/AddressView.swift | 2 +- .../Core/SharedModels/LedgerIdentifiable.swift | 14 +++++--------- .../Coordinator/AccountDetails+View.swift | 2 +- .../ReceivingAccount+Reducer.swift | 4 ++-- .../NewAccountCompletion+View.swift | 4 +--- .../DappDetails/DappDetails+View.swift | 2 +- .../PersonaDetails/PersonaDetails+View.swift | 2 +- .../AccountRow/Home+AccountRow+View.swift | 2 +- ...ionMigrateOlympiaAccountsToBabylon+View.swift | 2 +- .../TransactionReviewAccount+View.swift | 2 +- 11 files changed, 21 insertions(+), 31 deletions(-) diff --git a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift index 8c0c608f22..299480690d 100644 --- a/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift +++ b/RadixWallet/Core/FeaturePrelude/AddressView/AddressDetails.swift @@ -73,7 +73,7 @@ public struct AddressDetails: Sendable, FeatureReducer { await openURL(url) } case .verifyOnLedgerButtonTapped: - if case let .account(address, _) = state.address { + if case let .account(address) = state.address { ledgerHardwareWalletClient.verifyAddress(of: address) } return .none @@ -117,7 +117,7 @@ public struct AddressDetails: Sendable, FeatureReducer { private func loadTitle(address: LedgerIdentifiable.Address) async throws -> String? { switch address { - case let .account(address, _): + case let .account(address): try await accountsClient.getAccountByAddress(address).displayName.rawValue case let .resource(address): try await onLedgerEntitiesClient.getResource(address).resourceTitle @@ -150,14 +150,10 @@ public struct AddressDetails: Sendable, FeatureReducer { private func loadShowVerifyOnLedgerEffect(state: State) -> Effect { switch state.address { - case let .account(address, isLedgerHWAccount): - if let isLedgerHWAccount { - .send(.internal(.loadedShowVerifyOnLedger(isLedgerHWAccount))) - } else { - .run { send in - let showVerifyOnLedger = await accountsClient.isLedgerHWAccount(address) - await send(.internal(.loadedShowVerifyOnLedger(showVerifyOnLedger))) - } + case let .account(address): + .run { send in + let showVerifyOnLedger = await accountsClient.isLedgerHWAccount(address) + await send(.internal(.loadedShowVerifyOnLedger(showVerifyOnLedger))) } default: .send(.internal(.loadedShowVerifyOnLedger(false))) diff --git a/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift b/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift index 1e670ad907..b30c2b4e80 100644 --- a/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift +++ b/RadixWallet/Core/FeaturePrelude/AddressView/AddressView.swift @@ -141,7 +141,7 @@ private extension AddressView { #if DEBUG struct AddressView_Previews: PreviewProvider { static var previews: some View { - AddressView(.address(.account(try! .init(validatingAddress: "account_tdx_b_1p8ahenyznrqy2w0tyg00r82rwuxys6z8kmrhh37c7maqpydx7p"), isLedgerHWAccount: false))) + AddressView(.address(.account(try! .init(validatingAddress: "account_tdx_b_1p8ahenyznrqy2w0tyg00r82rwuxys6z8kmrhh37c7maqpydx7p")))) } } #endif diff --git a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift index fde17a5f14..24141c8def 100644 --- a/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift +++ b/RadixWallet/Core/SharedModels/LedgerIdentifiable.swift @@ -4,7 +4,7 @@ public enum LedgerIdentifiable: Sendable { case transaction(IntentHash) public static func address(of account: Account) -> Self { - .address(.account(account.address, isLedgerHWAccount: account.isLedgerControlled)) + .address(.account(account.address)) } public var address: String { @@ -33,11 +33,7 @@ public enum LedgerIdentifiable: Sendable { // MARK: LedgerIdentifiable.Address extension LedgerIdentifiable { public enum Address: Hashable, Sendable, Identifiable { - /// `isLedgerHWAccount` indicates if the account is controlled by a Ledger device. - /// - `true`: we know the account is controlled by a Ledger device - /// - `false`: either the account isn't controller by a Ledger device or it is an external account and we don't care. - /// - `nil`: we don't know if the account is controller by a Ledger device, we should check if needed. - case account(AccountAddress, isLedgerHWAccount: Bool?) + case account(AccountAddress) case package(PackageAddress) case resource(ResourceAddress) case resourcePool(PoolAddress) @@ -52,7 +48,7 @@ extension LedgerIdentifiable { public func formatted(_ format: AddressFormat) -> String { switch self { - case let .account(accountAddress, _): + case let .account(accountAddress): accountAddress.formatted(format) case let .package(packageAddress): packageAddress.formatted(format) @@ -90,7 +86,7 @@ extension LedgerIdentifiable { public var id: String { switch self { - case let .account(accountAddress, _): + case let .account(accountAddress): accountAddress.id case let .package(packageAddress): packageAddress.id @@ -113,7 +109,7 @@ extension LedgerIdentifiable.Address { public init?(address: Address) { switch address { case let .account(accountAddress): - self = .account(accountAddress, isLedgerHWAccount: false) + self = .account(accountAddress) case let .resource(resourceAddress): self = .resource(resourceAddress) case let .pool(poolAddress): diff --git a/RadixWallet/Features/AccountDetailsFeature/Coordinator/AccountDetails+View.swift b/RadixWallet/Features/AccountDetailsFeature/Coordinator/AccountDetails+View.swift index a91e772432..33c916d41c 100644 --- a/RadixWallet/Features/AccountDetailsFeature/Coordinator/AccountDetails+View.swift +++ b/RadixWallet/Features/AccountDetailsFeature/Coordinator/AccountDetails+View.swift @@ -78,7 +78,7 @@ extension AccountDetails { @ViewBuilder func header(with viewStore: ViewStore) -> some SwiftUI.View { - AddressView(.address(.account(viewStore.accountAddress, isLedgerHWAccount: viewStore.isLedgerAccount))) + AddressView(.address(.account(viewStore.accountAddress))) .foregroundColor(.app.whiteTransparent) .textStyle(.body2HighImportance) .padding(.bottom, .small1) diff --git a/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift b/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift index 6738fe0215..ff65395c94 100644 --- a/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift +++ b/RadixWallet/Features/AssetTransferFeature/Components/TransferAccountList/ReceivingAccount/ReceivingAccount+Reducer.swift @@ -86,9 +86,9 @@ extension AccountOrAddressOf { var identifer: LedgerIdentifiable { switch self { case let .profileAccount(value: account): - .address(.account(account.address, isLedgerHWAccount: account.isLedgerControlled)) + .address(.account(account.address)) case let .addressOfExternalAccount(address): - .address(.account(address, isLedgerHWAccount: false)) + .address(.account(address)) } } diff --git a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift index 8c4fef532c..94fd80a2d3 100644 --- a/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift +++ b/RadixWallet/Features/CreateAccount/Children/NewAccountCompletion/NewAccountCompletion+View.swift @@ -16,7 +16,6 @@ extension NewAccountCompletion { let subtitle: String let accountAddress: AccountAddress - let isLedgerControlled: Bool let appearanceID: AppearanceID init(state: NewAccountCompletion.State) { @@ -33,7 +32,6 @@ extension NewAccountCompletion { self.isFirstOnNetwork = state.isFirstOnNetwork self.accountAddress = state.account.address - self.isLedgerControlled = state.account.isLedgerControlled self.appearanceID = state.account.appearanceID self.explanation = L10n.CreateAccount.Completion.explanation @@ -107,7 +105,7 @@ private extension NewAccountCompletion.View { .textStyle(.body1Header) .multilineTextAlignment(.center) - AddressView(.address(.account(viewStore.accountAddress, isLedgerHWAccount: viewStore.isLedgerControlled)), isTappable: false) + AddressView(.address(.account(viewStore.accountAddress)), isTappable: false) .foregroundColor(.app.whiteTransparent) .textStyle(.body2HighImportance) } diff --git a/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift b/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift index 2036350992..3d297ac4d8 100644 --- a/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift +++ b/RadixWallet/Features/DappsAndPersonas/DappDetails/DappDetails+View.swift @@ -174,7 +174,7 @@ extension DappDetails.View { Spacer(minLength: 0) AddressView( - .address(.account(viewStore.address, isLedgerHWAccount: false)), + .address(.account(viewStore.address)), imageColor: .app.gray2 ) .foregroundColor(.app.gray1) diff --git a/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift b/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift index f67ae0e9ce..c89eb98b43 100644 --- a/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift +++ b/RadixWallet/Features/DappsAndPersonas/PersonaDetails/PersonaDetails+View.swift @@ -199,7 +199,7 @@ extension PersonaDetails.View { ForEach(viewStore.sharingAccounts) { account in SmallAccountCard( account.label.rawValue, - identifiable: .address(.account(account.address, isLedgerHWAccount: nil)), + identifiable: .address(.account(account.address)), gradient: .init(account.appearanceId) ) .cornerRadius(.small1) diff --git a/RadixWallet/Features/HomeFeature/Children/AccountRow/Home+AccountRow+View.swift b/RadixWallet/Features/HomeFeature/Children/AccountRow/Home+AccountRow+View.swift index 70b245eda9..059678d207 100644 --- a/RadixWallet/Features/HomeFeature/Children/AccountRow/Home+AccountRow+View.swift +++ b/RadixWallet/Features/HomeFeature/Children/AccountRow/Home+AccountRow+View.swift @@ -113,7 +113,7 @@ extension Home.AccountRow { } HStack { - AddressView(.address(.account(viewStore.address, isLedgerHWAccount: viewStore.isLedgerAccount))) + AddressView(.address(.account(viewStore.address))) .foregroundColor(.app.whiteTransparent) .textStyle(.body2HighImportance) diff --git a/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift b/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift index 798b3c0900..5d604d2552 100644 --- a/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift +++ b/RadixWallet/Features/SettingsFeature/Troubleshooting/ImportFromOlympiaLegacyWallet/Children/Completion/CompletionMigrateOlympiaAccountsToBabylon+View.swift @@ -123,7 +123,7 @@ extension CompletionMigrateOlympiaAccountsToBabylon { Text(name) .textStyle(.body1Header) } - AddressView(.address(.account(account.address, isLedgerHWAccount: nil))) + AddressView(.address(.account(account.address))) .opacity(0.8) } .foregroundColor(.app.white) diff --git a/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift b/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift index 238029b6cb..fb911682b9 100644 --- a/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift +++ b/RadixWallet/Features/TransactionReviewFeature/TransactionReviewAccount/TransactionReviewAccount+View.swift @@ -166,7 +166,7 @@ extension SmallAccountCard where Accessory == EmptyView { case let .external(accountAddress, _): self.init( L10n.TransactionReview.externalAccountName, - identifiable: .address(.account(accountAddress, isLedgerHWAccount: false)), + identifiable: .address(.account(accountAddress)), gradient: .init(colors: [.app.gray2]), verticalPadding: .small1 )