mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-03 06:25:10 +03:00
Specify coin for account selection when possible
This commit is contained in:
parent
a376e412b0
commit
5a16d3aeda
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import WalletCore
|
||||
|
||||
struct AccountSelectionConfiguration {
|
||||
let peer: PeerMeta?
|
||||
let coinType: CoinType?
|
||||
var selectedAccounts: Set<SpecificWalletAccount>
|
||||
let completion: ((EthereumChain?, SpecificWalletAccount?) -> Void)
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user