Skip to content

Commit

Permalink
Show all RPC hosts for BSC
Browse files Browse the repository at this point in the history
  • Loading branch information
esen committed Dec 8, 2021
1 parent f6be010 commit 38eb999
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,13 @@ CHECKOUT OPTIONS:
:commit: 5ce8892ad352d5eb837742cb17a94fd2a561ef73
:git: https://github.com/horizontalsystems/bitcoin-kit-ios.git
Erc20Kit.swift:
:commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa
:commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205
:git: https://github.com/horizontalsystems/ethereum-kit-ios
EthereumABI:
:commit: f77b49868885e9f909bd7dcf4c50c42e84f43ef7
:git: https://github.com/horizontalsystems/EthereumABI
EthereumKit.swift:
:commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa
:commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205
:git: https://github.com/horizontalsystems/ethereum-kit-ios
FeeRateKit.swift:
:commit: 763394a92bdf091517376776bccecf9e7edbb49f
Expand Down Expand Up @@ -555,7 +555,7 @@ CHECKOUT OPTIONS:
:commit: 1ba3514ba9bbb649f02402d10570b0ef0de2407c
:git: https://github.com/horizontalsystems/component-kit-ios/
OneInchKit.swift:
:commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa
:commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205
:git: https://github.com/horizontalsystems/ethereum-kit-ios
PinKit.swift:
:commit: 44162b713df1858b02640b93e3b75bfbbaa4a3f2
Expand All @@ -576,7 +576,7 @@ CHECKOUT OPTIONS:
:commit: 3b1886c03600c421a0591cff3259013da606524e
:git: https://github.com/horizontalsystems/gui-kit/
UniswapKit.swift:
:commit: 28d74a16b9ed7780c7d49babb597ccac4e9c66fa
:commit: aa1dd69a938d0ec0d418a2b007316fa659f3b205
:git: https://github.com/horizontalsystems/ethereum-kit-ios
WalletConnect:
:commit: 1336f67877608e271107cd96bb852f76fd51eddf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class EvmNetwork {
}

var id: String {
"\(networkType.chainId)|\(syncSource.url.absoluteString)"
"\(networkType.chainId)|\(syncSource.urls.map({ $0.absoluteString }).joined(separator: ","))"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class EvmNetworkViewController: ThemeViewController {

tableView.registerCell(forClass: F4Cell.self)
tableView.registerHeaderFooter(forClass: SubtitleHeaderFooterView.self)
tableView.registerHeaderFooter(forClass: TopDescriptionHeaderFooterView.self)
tableView.sectionDataSource = self

subscribe(disposeBag, viewModel.sectionViewItemsDriver) { [weak self] sectionViewItems in
Expand Down Expand Up @@ -77,10 +78,20 @@ extension EvmNetworkViewController: SectionsDataSource {
}

private func section(sectionViewItem: EvmNetworkViewModel.SectionViewItem) -> SectionProtocol {
Section(
let containerWidth: CGFloat = tableView.bounds.width

let footerState: ViewState<TopDescriptionHeaderFooterView> = sectionViewItem.description.flatMap { descriptionText in
.cellType(hash: "bottom_description", binder: { view in
view.bind(text: descriptionText)
}, dynamicHeight: { [weak self] _ in
TopDescriptionHeaderFooterView.height(containerWidth: containerWidth, text: descriptionText)
})
} ?? .margin(height: .margin32)

return Section(
id: sectionViewItem.title,
headerState: header(text: sectionViewItem.title),
footerState: .margin(height: .margin32),
footerState: footerState,
rows: sectionViewItem.viewItems.enumerated().map { index, viewItem in
let isFirst = index == 0
let isLast = index == sectionViewItem.viewItems.count - 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,35 @@ class EvmNetworkViewModel {
let testNetItems = items.filter { !$0.mainNet }

let sectionViewItems: [SectionViewItem?] = [
sectionViewItem(title: "MainNet", viewItems: mainNetItems.map { viewItem(item: $0) }),
sectionViewItem(title: "TestNet", viewItems: testNetItems.map { viewItem(item: $0) })
sectionViewItem(title: "MainNet", items: mainNetItems),
sectionViewItem(title: "TestNet", items: testNetItems)
]

sectionViewItemsRelay.accept(sectionViewItems.compactMap { $0 })
}

private func sectionViewItem(title: String, viewItems: [ViewItem]) -> SectionViewItem? {
private func sectionViewItem(title: String, items: [EvmNetworkService.Item]) -> SectionViewItem? {
let viewItems = items.map { viewItem(item: $0) }
guard !viewItems.isEmpty else {
return nil
}

return SectionViewItem(title: title, viewItems: viewItems)
var description: String? = nil

if let selectedItem = items.first(where: { $0.selected }),
selectedItem.network.syncSource.urls.count > 1 {
let links = selectedItem.network.syncSource.urls.map({ "\($0.absoluteString)" }).joined(separator: "\n")
description = "\("evm_network.description".localized)\n\n\(links)"
}

return SectionViewItem(title: title, viewItems: viewItems, description: description)
}

private func viewItem(item: EvmNetworkService.Item) -> ViewItem {
ViewItem(
id: item.network.id,
name: item.network.name,
url: item.network.syncSource.url.absoluteString,
url: item.network.syncSource.urls.count == 1 ? item.network.syncSource.urls[0].absoluteString : "evm_network.switches_automatically".localized,
selected: item.selected
)
}
Expand Down Expand Up @@ -77,6 +86,7 @@ extension EvmNetworkViewModel {
struct SectionViewItem {
let title: String
let viewItems: [ViewItem]
let description: String?
}

struct ViewItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,3 +1039,8 @@ Wir haben Unstoppable für uns selbst entwickelt, da die verfügbaren Lösungen
// Network Settings

"network_settings.title" = "Netzwerkeinstellungen";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1042,3 +1042,8 @@ We built Unstoppable for ourselves as the other available solutions were not up
// Network Settings

"network_settings.title" = "Network Settings";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1040,3 +1040,8 @@ poner en peligro la seguridad de mis fondos.";
// Network Settings

"network_settings.title" = "Configuración de Red";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1039,3 +1039,8 @@ Nous avons construit Unstoppable à notre intention car les solutions disponible
// Network Settings

"network_settings.title" = "Paramètres réseau";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1039,3 +1039,8 @@ Unstoppable 지갑은 완전한 오픈소스여서 누구나 앱이 요구하는
// Network Settings

"network_settings.title" = "네트워크 설정";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1041,3 +1041,8 @@
// Network Settings

"network_settings.title" = "Настройки Сети";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1042,3 +1042,8 @@ Mevcut çözümler yeterli olmadığından kendimiz için Durdurulamaz'ı geliş
// Network Settings

"network_settings.title" = "Ağ Ayarları";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";
Original file line number Diff line number Diff line change
Expand Up @@ -1041,3 +1041,8 @@ Unstoppable钱包完全开源且任何人都可以确定应用按照其宣称的
// Network Settings

"network_settings.title" = "网络设置";

// EVM Network

"evm_network.switches_automatically" = "switches automatically";
"evm_network.description" = "MainNet HTTP uses the links listed below and switches automatically.";

0 comments on commit 38eb999

Please sign in to comment.