Skip to content

Commit 3081a92

Browse files
Merge pull request #761 from JeneaVranceanu/chore/swiftlint-auto-fixes
chore: swiftlint auto fixes
2 parents 27e9d65 + 8550dc7 commit 3081a92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+508
-557
lines changed

Example/myWeb3Wallet/myWeb3Wallet/Appdelegate/AppDelegate.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import UIKit
1010
@main
1111
class AppDelegate: UIResponder, UIApplicationDelegate {
1212

13-
14-
1513
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1614
// Override point for customization after application launch.
1715
return true
@@ -31,6 +29,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3129
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
3230
}
3331

34-
3532
}
36-

Example/myWeb3Wallet/myWeb3Wallet/Appdelegate/SceneDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
1111

1212
var window: UIWindow?
1313

14-
1514
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
1615
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
1716
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
@@ -47,6 +46,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
4746
// to restore the scene back to its current state.
4847
}
4948

50-
5149
}
52-

Example/myWeb3Wallet/myWeb3Wallet/ViewController.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ class ViewController: UIViewController {
1414
// Do any additional setup after loading the view.
1515
}
1616

17-
1817
}
19-

Example/myWeb3Wallet/myWeb3Wallet/ViewControllers/WalletController/DashboardViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class DashboardViewController: UIViewController {
1919

2020
}
2121
}
22-
2322

2423
/*
2524
// MARK: - Navigation

Example/myWeb3Wallet/myWeb3Wallet/ViewControllers/WalletController/SplashViewController.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ import UIKit
1010
class SplashViewController: UIViewController {
1111

1212
@IBOutlet weak var logoView: UIImageView!
13-
13+
1414
override func viewDidLoad() {
1515
super.viewDidLoad()
1616
UIView.animate(withDuration: 0.9) {
1717
self.logoView.center.y = self.view.center.y
1818
Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.moveToWalletView), userInfo: nil, repeats: false)
1919

2020
}
21-
2221

2322
// Do any additional setup after loading the view.
2423
}
25-
@objc func moveToWalletView(){
26-
24+
@objc func moveToWalletView() {
25+
2726
guard let walletScreen = self.storyboard?.instantiateViewController(withIdentifier: "WalletViewController") as? WalletViewController else {
2827
#if DEBUG
2928
printContent("Unable to get Wallet controller")

Example/myWeb3Wallet/myWeb3Wallet/ViewControllers/WalletController/WalletViewController.swift

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import UIKit
99
import web3swift
1010
class WalletViewController: UIViewController {
11-
11+
1212
@IBOutlet weak var continueButton: UIButton!
1313
@IBOutlet weak var walletAddressLabel: UILabel!
1414
@IBOutlet weak var importWalletButton: UIButton!
1515
@IBOutlet weak var createWalletButton: UIButton!
1616
var _walletAddress: String {
17-
set{
17+
set {
1818
self.continueButton.isHidden = false
1919
self.walletAddressLabel.text = newValue
2020
}
@@ -27,23 +27,22 @@ class WalletViewController: UIViewController {
2727
super.viewDidLoad()
2828
self.createWalletButton.layer.cornerRadius = 5.0
2929
self.importWalletButton.layer.cornerRadius = 5.0
30-
30+
3131
// Do any additional setup after loading the view.
3232
}
33-
34-
33+
3534
@IBAction func onClickCreateWallet(_ sender: UIButton) {
3635
#if DEBUG
3736
print("Clicked on Create Wallet Option")
3837
#endif
3938
self.createMnemonics()
40-
39+
4140
}
4241
@IBAction func onClickImportWalletButton(_ sender: UIButton) {
4342
print("Clicked on import Wallet Option")
4443
self.showImportALert()
4544
}
46-
45+
4746
@IBAction func onClickContinueButton(_ sender: UIButton) {
4847
print("Clicked on COntinue button")
4948
guard let dashboardScreen = self.storyboard?.instantiateViewController(withIdentifier: "DashboardViewController") as? DashboardViewController else {
@@ -54,7 +53,7 @@ class WalletViewController: UIViewController {
5453
}
5554
self.navigationController?.pushViewController(dashboardScreen, animated: true)
5655
}
57-
fileprivate func showImportALert(){
56+
fileprivate func showImportALert() {
5857
let alert = UIAlertController(title: "MyWeb3Wallet", message: "", preferredStyle: .alert)
5958
alert.addTextField { textfied in
6059
textfied.placeholder = "Enter mnemonics/private Key"
@@ -69,15 +68,15 @@ class WalletViewController: UIViewController {
6968
guard let privateKey = alert.textFields?[0].text else { return }
7069
print(privateKey)
7170
self.importWalletWith(privateKey: privateKey)
72-
71+
7372
}
7473
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
7574
alert.addAction(mnemonicsAction)
7675
alert.addAction(privateKeyAction)
7776
alert.addAction(cancelAction)
7877
self.present(alert, animated: true, completion: nil)
7978
}
80-
func importWalletWith(privateKey: String){
79+
func importWalletWith(privateKey: String) {
8180
let formattedKey = privateKey.trimmingCharacters(in: .whitespacesAndNewlines)
8281
guard let dataKey = Data.fromHex(formattedKey) else {
8382
self.showAlertMessage(title: "Error", message: "Please enter a valid Private key ", actionName: "Ok")
@@ -94,7 +93,7 @@ class WalletViewController: UIViewController {
9493
#endif
9594
let walletAddress = manager.addresses?.first?.address
9695
self.walletAddressLabel.text = walletAddress ?? "0x"
97-
96+
9897
print(walletAddress)
9998
} else {
10099
print("error")
@@ -109,34 +108,31 @@ class WalletViewController: UIViewController {
109108
alert.addAction(okAction)
110109
self.present(alert, animated: true)
111110
}
112-
113-
114-
111+
115112
}
116113
func importWalletWith(mnemonics: String) {
117-
let walletAddress = try? BIP32Keystore(mnemonics: mnemonics , prefixPath: "m/44'/77777'/0'/0")
114+
let walletAddress = try? BIP32Keystore(mnemonics: mnemonics, prefixPath: "m/44'/77777'/0'/0")
118115
print(walletAddress?.addresses)
119116
self.walletAddressLabel.text = "\(walletAddress?.addresses?.first?.address ?? "0x")"
120-
117+
121118
}
122-
123-
119+
124120
}
125121
extension WalletViewController {
126-
127-
fileprivate func createMnemonics(){
122+
123+
fileprivate func createMnemonics() {
128124
let userDir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
129125
let web3KeystoreManager = KeystoreManager.managerForPath(userDir + "/keystore")
130126
do {
131-
if (web3KeystoreManager?.addresses?.count ?? 0 >= 0) {
127+
if web3KeystoreManager?.addresses?.count ?? 0 >= 0 {
132128
let tempMnemonics = try? BIP39.generateMnemonics(bitsOfEntropy: 256, language: .english)
133129
guard let tMnemonics = tempMnemonics else {
134130
self.showAlertMessage(title: "", message: "We are unable to create wallet", actionName: "Ok")
135131
return
136132
}
137133
self._mnemonics = tMnemonics
138134
print(_mnemonics)
139-
let tempWalletAddress = try? BIP32Keystore(mnemonics: self._mnemonics , prefixPath: "m/44'/77777'/0'/0")
135+
let tempWalletAddress = try? BIP32Keystore(mnemonics: self._mnemonics, prefixPath: "m/44'/77777'/0'/0")
140136
print(tempWalletAddress?.addresses?.first?.address)
141137
guard let walletAddress = tempWalletAddress?.addresses?.first else {
142138
self.showAlertMessage(title: "", message: "We are unable to create wallet", actionName: "Ok")
@@ -151,9 +147,9 @@ extension WalletViewController {
151147
FileManager.default.createFile(atPath: userDir + "/keystore"+"/key.json", contents: keyData, attributes: nil)
152148
}
153149
} catch {
154-
150+
155151
}
156-
152+
157153
}
158154
}
159155
extension UIViewController {
@@ -163,5 +159,5 @@ extension UIViewController {
163159
alertController.addAction(action)
164160
self.present(alertController, animated: true)
165161
}
166-
162+
167163
}

Sources/Web3Core/EthereumABI/ABIElements.swift

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -274,35 +274,35 @@ extension ABI.Element.Function {
274274
///
275275
/// Return cases:
276276
/// - when no `outputs` declared and `data` is not an error response:
277-
///```swift
278-
///["_success": true]
279-
///```
277+
/// ```swift
278+
/// ["_success": true]
279+
/// ```
280280
/// - when `outputs` declared and decoding completed successfully:
281-
///```swift
282-
///["_success": true, "0": value_1, "1": value_2, ...]
283-
///```
284-
///Additionally this dictionary will have mappings to output names if these names are specified in the ABI;
281+
/// ```swift
282+
/// ["_success": true, "0": value_1, "1": value_2, ...]
283+
/// ```
284+
/// Additionally this dictionary will have mappings to output names if these names are specified in the ABI;
285285
/// - function call was aborted using `revert(message)` or `require(expression, message)`:
286-
///```swift
287-
///["_success": false, "_abortedByRevertOrRequire": true, "_errorMessage": message]`
288-
///```
286+
/// ```swift
287+
/// ["_success": false, "_abortedByRevertOrRequire": true, "_errorMessage": message]`
288+
/// ```
289289
/// - function call was aborted using `revert CustomMessage()` and `errors` argument contains the ABI of that custom error type:
290-
///```swift
291-
///["_success": false,
292-
///"_abortedByRevertOrRequire": true,
293-
///"_error": error_name_and_types, // e.g. `MyCustomError(uint256, address senderAddress)`
294-
///"0": error_arg1,
295-
///"1": error_arg2,
296-
///...,
297-
///"error_arg1_name": error_arg1, // Only named arguments will be mapped to their names, e.g. `"senderAddress": EthereumAddress`
298-
///"error_arg2_name": error_arg2, // Otherwise, you can query them by position index.
299-
///...]
300-
///```
301-
///- in case of any error:
302-
///```swift
303-
///["_success": false, "_failureReason": String]
304-
///```
305-
///Error reasons include:
290+
/// ```swift
291+
/// ["_success": false,
292+
/// "_abortedByRevertOrRequire": true,
293+
/// "_error": error_name_and_types, // e.g. `MyCustomError(uint256, address senderAddress)`
294+
/// "0": error_arg1,
295+
/// "1": error_arg2,
296+
/// ...,
297+
/// "error_arg1_name": error_arg1, // Only named arguments will be mapped to their names, e.g. `"senderAddress": EthereumAddress`
298+
/// "error_arg2_name": error_arg2, // Otherwise, you can query them by position index.
299+
/// ...]
300+
/// ```
301+
/// - in case of any error:
302+
/// ```swift
303+
/// ["_success": false, "_failureReason": String]
304+
/// ```
305+
/// Error reasons include:
306306
/// - `outputs` declared but at least one value failed to be decoded;
307307
/// - `data.count` is less than `outputs.count * 32`;
308308
/// - `outputs` defined and `data` is empty;
@@ -479,7 +479,7 @@ extension ABIDecoder {
479479
guard inputs.count * 32 <= data.count else { return nil }
480480

481481
var i = 0
482-
guard let values = ABIDecoder.decode(types: inputs, data: data) else {return nil}
482+
guard let values = ABIDecoder.decode(types: inputs, data: data) else { return nil }
483483
for input in inputs {
484484
let name = "\(i)"
485485
returnArray[name] = values[i]
@@ -491,4 +491,4 @@ extension ABIDecoder {
491491
}
492492
return returnArray
493493
}
494-
}
494+
}

Sources/Web3Core/Transaction/CodableTransaction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public struct CodableTransaction {
5454
set { envelope.value = newValue }
5555
}
5656

57-
public var data: Data {
57+
public var data: Data {
5858
get { return envelope.data }
5959
set { envelope.data = newValue }
6060
}

Sources/web3swift/EthereumAPICalls/Ethereum/IEth+Defaults.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public extension IEth {
1919
func estimateGas(for transaction: CodableTransaction) async throws -> BigUInt {
2020
try await estimateGas(for: transaction, onBlock: .latest)
2121
}
22-
22+
2323
func estimateGas(for transaction: CodableTransaction, onBlock: BlockNumber) async throws -> BigUInt {
2424
let request = APIRequest.estimateGas(transaction, onBlock)
2525
return try await APIRequest.sendRequest(with: provider, for: request).result

Sources/web3swift/Tokens/ERC1376/Web3+ERC1376.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,3 @@ extension ERC1376 {
365365
}
366366

367367
}
368-

0 commit comments

Comments
 (0)