diff --git a/Shared/Extension/CoinType.swift b/Shared/Extension/CoinType.swift index 15fab117..9403ae9d 100644 --- a/Shared/Extension/CoinType.swift +++ b/Shared/Extension/CoinType.swift @@ -43,4 +43,19 @@ extension CoinType { } } + static func correspondingToWeb3Provider(_ web3Provider: Web3Provider) -> CoinType? { + switch web3Provider { + case .ethereum: + return .ethereum + case .solana: + return .solana + case .tezos: + return .tezos + case .near: + return .near + case .unknown: + return nil + } + } + } diff --git a/Shared/Models/AccountSelectionConfiguration.swift b/Shared/Models/AccountSelectionConfiguration.swift index a334f4df..b49e131a 100644 --- a/Shared/Models/AccountSelectionConfiguration.swift +++ b/Shared/Models/AccountSelectionConfiguration.swift @@ -5,6 +5,7 @@ import WalletCore struct AccountSelectionConfiguration { let peer: PeerMeta? + let coinType: CoinType? var selectedAccounts: Set let completion: ((EthereumChain?, SpecificWalletAccount?) -> Void) } diff --git a/Tokenary macOS/Agent.swift b/Tokenary macOS/Agent.swift index c144a1d8..6d491084 100644 --- a/Tokenary macOS/Agent.swift +++ b/Tokenary macOS/Agent.swift @@ -79,7 +79,7 @@ class Agent: NSObject { let accountsList = instantiate(AccountsListViewController.self) if case let .wcSession(session) = request, let completion = onSelectedWallet(session: session) { - accountsList.accountSelectionConfiguration = AccountSelectionConfiguration(peer: nil, selectedAccounts: Set(), completion: completion) + accountsList.accountSelectionConfiguration = AccountSelectionConfiguration(peer: nil, coinType: .ethereum, selectedAccounts: Set(), completion: completion) } let windowController = Window.showNew(closeOthers: accountsList.accountSelectionConfiguration == nil) @@ -319,7 +319,10 @@ class Agent: NSObject { windowNumber = windowController.window?.windowNumber let accountsList = instantiate(AccountsListViewController.self) // TODO: pass selected accounts when there are some - accountsList.accountSelectionConfiguration = AccountSelectionConfiguration(peer: safariRequest.peerMeta, selectedAccounts: Set(), completion: accountAction.completion) + accountsList.accountSelectionConfiguration = AccountSelectionConfiguration(peer: safariRequest.peerMeta, + coinType: CoinType.correspondingToWeb3Provider(accountAction.provider), + selectedAccounts: Set(), + completion: accountAction.completion) windowController.contentViewController = accountsList case .approveMessage(let action): let windowController = Window.showNew(closeOthers: false)