Skip to content

Commit

Permalink
IOS-8096 Add all evm chain id to wc chain ids for ethereum, add to un…
Browse files Browse the repository at this point in the history
…supported chains only chains from required namespace
  • Loading branch information
Vyachesl0ve committed Oct 22, 2024
1 parent 4723c0a commit fae59ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ extension BlockchainSdk.Blockchain {
var wcChainID: [String]? {
switch self {
case .ethereum:
return isTestnet ? ["5"] : ["1"]
let chainIds: [String] = SupportedBlockchains.all.compactMap {
guard let chainId = $0.chainId else { return nil }
return String(chainId)
}

return chainIds
case .solana:
let mainnetIds = ["5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"]
let testnetIds = ["4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ struct WalletConnectV2Utils {

let accounts: [[Account]] = chains.compactMap { wcBlockchain in
guard let blockchain = createBlockchain(for: wcBlockchain) else {
unsupportedEVMBlockchains.append(wcBlockchain.reference)
if proposal.namespaceRequiredChains.contains(wcBlockchain) {
unsupportedEVMBlockchains.append(wcBlockchain.reference)
}
return nil
}

Expand Down Expand Up @@ -217,6 +219,10 @@ extension WalletConnectV2Utils {
// MARK: - Session proposal helper properties for AutoNamespacesBuilder

private extension Session.Proposal {
var namespaceRequiredChains: Set<WalletConnectUtils.Blockchain> {
Set(requiredNamespaces.values.compactMap(\.chains).flatMap { $0 })
}

var namespaceChains: [WalletConnectUtils.Blockchain] {
let requiredChains = requiredNamespaces.values.compactMap(\.chains).flatMap { $0.asArray }
let optionalChains = optionalNamespaces?.values.compactMap(\.chains).flatMap { $0.asArray } ?? []
Expand Down
2 changes: 1 addition & 1 deletion tangem-app-config

0 comments on commit fae59ab

Please sign in to comment.