let dynamicClient: DynamicClientlet ethereumWallet: EthereumWalletlet chainId = SupportedEthereumNetwork.sepoliaTestnet.chainConfig.chainIddo { let networkClient = try await ethereumWallet.getNetworkClient(for: chainId) print("Connected to Sepolia network: \(chainId)") // Get gas price for transactions let gasPrice = try await networkClient.eth_gasPriceBigInt() print("Current gas price: \(gasPrice) wei")} catch { print("Failed to get network client: \(error)")}
let dynamicClient: DynamicClientlet ethereumWallet: EthereumWalletlet chainId = SupportedEthereumNetwork.sepoliaTestnet.chainConfig.chainIddo { let networkClient = try await ethereumWallet.getNetworkClient(for: chainId) print("Connected to Sepolia network: \(chainId)") // Get gas price for transactions let gasPrice = try await networkClient.eth_gasPriceBigInt() print("Current gas price: \(gasPrice) wei")} catch { print("Failed to get network client: \(error)")}
do { let networkClient = try await ethereumWallet.getNetworkClient(for: chainId)} catch { if let nsError = error as NSError? { switch nsError.code { case 3001: print("Network not supported") case 3002: print("Network connection failed") case 3003: print("Invalid chain ID") default: print("Network error: \(error)") } }}