Skip to content

Commit 7f5d156

Browse files
Merge pull request #508 from mloit/feature/late-lint-fixups
2 parents b267da1 + 24d43ac commit 7f5d156

File tree

8 files changed

+81
-81
lines changed

8 files changed

+81
-81
lines changed

Sources/web3swift/Contract/EthereumContract.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct EthereumContract: ContractProtocol {
3333
var toReturn = [String: ABI.Element]()
3434
for m in self._abi {
3535
switch m {
36-
case .function(let function):
36+
case .function(let function):
3737
guard let name = function.name else {continue}
3838
toReturn[name] = m
3939
default:
@@ -50,7 +50,7 @@ public struct EthereumContract: ContractProtocol {
5050
break
5151
}
5252
switch m {
53-
case .constructor(_):
53+
case .constructor(_):
5454
toReturn = m
5555
break
5656
default:
@@ -68,10 +68,10 @@ public struct EthereumContract: ContractProtocol {
6868
var toReturn = [String: ABI.Element.Event]()
6969
for m in self._abi {
7070
switch m {
71-
case .event(let event):
71+
case .event(let event):
7272
let name = event.name
7373
toReturn[name] = event
74-
default:
74+
default:
7575
continue
7676
}
7777
}

Sources/web3swift/EthereumABI/ABIElements.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//
1+
//
22
// Created by Alex Vlasov on 25/10/2018.
33
// Copyright © 2018 Alex Vlasov. All rights reserved.
4-
//
4+
//
55

66
import Foundation
77
import BigInt

Sources/web3swift/EthereumABI/ABIEncoding.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//
1+
//
22
// Created by Alex Vlasov on 25/10/2018.
33
// Copyright © 2018 Alex Vlasov. All rights reserved.
4-
//
4+
//
55

66
import Foundation
77
import BigInt

Sources/web3swift/Web3/Web3+Contract.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension web3 {
1717
/// Web3 instance bound contract instance.
1818
public class web3contract {
1919
var contract: EthereumContract
20-
var web3 : web3
20+
var web3: web3
2121
public var transactionOptions: TransactionOptions? = nil
2222

2323
/// Initialize the bound contract instance by supplying the Web3 provider bound object, ABI, Ethereum address and some default

Sources/web3swift/Web3/Web3+Eth.swift

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// web3swift
2-
//
2+
//
33
// Created by Alex Vlasov.
44
// Copyright © 2018 Alex Vlasov. All rights reserved.
5-
//
5+
//
66

77
import Foundation
88
import BigInt
@@ -11,12 +11,12 @@ extension web3.Eth {
1111

1212
/// Send an EthereumTransaction object to the network. Transaction is either signed locally if there is a KeystoreManager
1313
/// object bound to the web3 instance, or sent unsigned to the node. For local signing the password is required.
14-
///
14+
///
1515
/// "options" object can override the "to", "gasPrice", "gasLimit" and "value" parameters is pre-formed transaction.
1616
/// "from" field in "options" is mandatory for both local and remote signing.
17-
///
17+
///
1818
/// This function is synchronous!
19-
///
19+
///
2020
/// Returns the Result object that indicates either success of failure.
2121
public func sendTransaction(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions, password: String = "web3swift") throws -> TransactionSendingResult {
2222
let result = try self.sendTransactionPromise(transaction, transactionOptions: transactionOptions, password: password).wait()
@@ -27,78 +27,78 @@ extension web3.Eth {
2727
/// Does NOT decode the data returned from the smart-contract.
2828
/// "options" object can override the "to", "gasPrice", "gasLimit" and "value" parameters is pre-formed transaction.
2929
/// "from" field in "options" is mandatory for both local and remote signing.
30-
///
30+
///
3131
/// "onString" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
3232
/// or the expected state after all the transactions in memory pool are applied ("pending").
33-
///
33+
///
3434
/// This function is synchronous!
35-
///
35+
///
3636
/// Returns the Result object that indicates either success of failure.
3737
func call(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions) throws -> Data {
3838
let result = try self.callPromise(transaction, transactionOptions: transactionOptions).wait()
3939
return result
4040
}
4141

4242
/// Send raw Ethereum transaction data to the network.
43-
///
43+
///
4444
/// This function is synchronous!
45-
///
45+
///
4646
/// Returns the Result object that indicates either success of failure.
4747
public func sendRawTransaction(_ transaction: Data) throws -> TransactionSendingResult {
4848
let result = try self.sendRawTransactionPromise(transaction).wait()
4949
return result
5050
}
5151

5252
/// Send raw Ethereum transaction data to the network by first serializing the EthereumTransaction object.
53-
///
53+
///
5454
/// This function is synchronous!
55-
///
55+
///
5656
/// Returns the Result object that indicates either success of failure.
5757
public func sendRawTransaction(_ transaction: EthereumTransaction) throws -> TransactionSendingResult {
5858
let result = try self.sendRawTransactionPromise(transaction).wait()
5959
return result
6060
}
6161

6262
/// Returns a total number of transactions sent by the particular Ethereum address.
63-
///
63+
///
6464
/// "onBlock" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
6565
/// or the expected state after all the transactions in memory pool are applied ("pending").
66-
///
66+
///
6767
/// This function is synchronous!
68-
///
68+
///
6969
/// Returns the Result object that indicates either success of failure.
7070
public func getTransactionCount(address: EthereumAddress, onBlock: String = "latest") throws -> BigUInt {
7171
let result = try self.getTransactionCountPromise(address: address, onBlock: onBlock).wait()
7272
return result
7373
}
7474

7575
/// Returns a balance of particular Ethereum address in Wei units (1 ETH = 10^18 Wei).
76-
///
76+
///
7777
/// "onString" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
7878
/// or the expected state after all the transactions in memory pool are applied ("pending").
79-
///
79+
///
8080
/// This function is synchronous!
81-
///
81+
///
8282
/// Returns the Result object that indicates either success of failure.
8383
public func getBalance(address: EthereumAddress, onBlock: String = "latest") throws -> BigUInt {
8484
let result = try self.getBalancePromise(address: address, onBlock: onBlock).wait()
8585
return result
8686
}
8787

8888
/// Returns a block number of the last mined block that Ethereum node knows about.
89-
///
89+
///
9090
/// This function is synchronous!
91-
///
91+
///
9292
/// Returns the Result object that indicates either success of failure.
9393
public func getBlockNumber() throws -> BigUInt {
9494
let result = try self.getBlockNumberPromise().wait()
9595
return result
9696
}
9797

9898
/// Returns a current gas price in the units of Wei. The node has internal algorithms for averaging over the last few blocks.
99-
///
99+
///
100100
/// This function is synchronous!
101-
///
101+
///
102102
/// Returns the Result object that indicates either success of failure.
103103
public func getGasPrice() throws -> BigUInt {
104104
let result = try self.getGasPricePromise().wait()
@@ -107,9 +107,9 @@ extension web3.Eth {
107107

108108
/// Returns transaction details for particular transaction hash. Details indicate position of the transaction in a particular block,
109109
/// as well as original transaction details such as value, gas limit, gas price, etc.
110-
///
110+
///
111111
/// This function is synchronous!
112-
///
112+
///
113113
/// Returns the Result object that indicates either success of failure.
114114
public func getTransactionDetails(_ txhash: Data) throws -> TransactionDetails {
115115
let result = try self.getTransactionDetailsPromise(txhash).wait()
@@ -118,9 +118,9 @@ extension web3.Eth {
118118

119119
/// Returns transaction details for particular transaction hash. Details indicate position of the transaction in a particular block,
120120
/// as well as original transaction details such as value, gas limit, gas price, etc.
121-
///
121+
///
122122
/// This function is synchronous!
123-
///
123+
///
124124
/// Returns the Result object that indicates either success of failure.
125125
public func getTransactionDetails(_ txhash: String) throws -> TransactionDetails {
126126
let result = try self.getTransactionDetailsPromise(txhash).wait()
@@ -129,9 +129,9 @@ extension web3.Eth {
129129

130130
/// Returns transaction receipt for particular transaction hash. Receipt indicate what has happened when the transaction
131131
/// was included in block, so it contains logs and status, such as succesful or failed transaction.
132-
///
132+
///
133133
/// This function is synchronous!
134-
///
134+
///
135135
/// Returns the Result object that indicates either success of failure.
136136
public func getTransactionReceipt(_ txhash: Data) throws -> TransactionReceipt {
137137
let result = try self.getTransactionReceiptPromise(txhash).wait()
@@ -140,9 +140,9 @@ extension web3.Eth {
140140

141141
/// Returns transaction receipt for particular transaction hash. Receipt indicate what has happened when the transaction
142142
/// was included in block, so it contains logs and status, such as succesful or failed transaction.
143-
///
143+
///
144144
/// This function is synchronous!
145-
///
145+
///
146146
/// Returns the Result object that indicates either success of failure.
147147
public func getTransactionReceipt(_ txhash: String) throws -> TransactionReceipt {
148148
let result = try self.getTransactionReceiptPromise(txhash).wait()
@@ -152,12 +152,12 @@ extension web3.Eth {
152152
/// Estimates a minimal amount of gas required to run a transaction. To do it the Ethereum node tries to run it and counts
153153
/// how much gas it consumes for computations. Setting the transaction gas limit lower than the estimate will most likely
154154
/// result in a failing transaction.
155-
///
155+
///
156156
/// "onString" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
157157
/// or the expected state after all the transactions in memory pool are applied ("pending").
158-
///
158+
///
159159
/// This function is synchronous!
160-
///
160+
///
161161
/// Returns the Result object that indicates either success of failure.
162162
/// Error can also indicate that transaction is invalid in the current state, so formally it's gas limit is infinite.
163163
/// An example of such transaction can be sending an amount of ETH that is larger than the current account balance.
@@ -168,9 +168,9 @@ extension web3.Eth {
168168

169169
/// Get a list of Ethereum accounts that a node knows about.
170170
/// If one has attached a Keystore Manager to the web3 object it returns accounts known to the keystore.
171-
///
171+
///
172172
/// This function is synchronous!
173-
///
173+
///
174174
/// Returns the Result object that indicates either success of failure.
175175
public func getAccounts() throws -> [EthereumAddress] {
176176
let result = try self.getAccountsPromise().wait()
@@ -180,9 +180,9 @@ extension web3.Eth {
180180
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
181181
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
182182
/// but full decoded EthereumTransaction objects.
183-
///
183+
///
184184
/// This function is synchronous!
185-
///
185+
///
186186
/// Returns the Result object that indicates either success of failure.
187187
public func getBlockByHash(_ hash: String, fullTransactions: Bool = false) throws -> Block {
188188
let result = try self.getBlockByHashPromise(hash, fullTransactions: fullTransactions).wait()
@@ -192,9 +192,9 @@ extension web3.Eth {
192192
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
193193
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
194194
/// but full decoded EthereumTransaction objects.
195-
///
195+
///
196196
/// This function is synchronous!
197-
///
197+
///
198198
/// Returns the Result object that indicates either success of failure.
199199
public func getBlockByHash(_ hash: Data, fullTransactions: Bool = false) throws -> Block {
200200
let result = try self.getBlockByHashPromise(hash, fullTransactions: fullTransactions).wait()
@@ -204,9 +204,9 @@ extension web3.Eth {
204204
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
205205
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
206206
/// but full decoded EthereumTransaction objects.
207-
///
207+
///
208208
/// This function is synchronous!
209-
///
209+
///
210210
/// Returns the Result object that indicates either success of failure.
211211
public func getBlockByNumber(_ number: UInt64, fullTransactions: Bool = false) throws -> Block {
212212
let result = try self.getBlockByNumberPromise(number, fullTransactions: fullTransactions).wait()
@@ -216,9 +216,9 @@ extension web3.Eth {
216216
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
217217
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
218218
/// but full decoded EthereumTransaction objects.
219-
///
219+
///
220220
/// This function is synchronous!
221-
///
221+
///
222222
/// Returns the Result object that indicates either success of failure.
223223
public func getBlockByNumber(_ number: BigUInt, fullTransactions: Bool = false) throws -> Block {
224224
let result = try self.getBlockByNumberPromise(number, fullTransactions: fullTransactions).wait()
@@ -228,10 +228,10 @@ extension web3.Eth {
228228
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
229229
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
230230
/// but full decoded EthereumTransaction objects.
231-
///
231+
///
232232
/// This function is synchronous!
233-
///
234-
///
233+
///
234+
///
235235
public func getBlockByNumber(_ block: String, fullTransactions: Bool = false) throws -> Block {
236236
let result = try self.getBlockByNumberPromise(block, fullTransactions: fullTransactions).wait()
237237
return result

Sources/web3swift/Web3/Web3+Options.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ public struct TransactionOptions {
158158
return newOptions
159159
}
160160
//
161-
// // merges two sets of options along with a gas estimate to try to guess the final gas limit value required by user.
162-
// //
163-
// // Please refer to the source code for a logic.
161+
// /// merges two sets of options along with a gas estimate to try to guess the final gas limit value required by user.
162+
// ///
163+
// /// Please refer to the source code for a logic.
164164
// public static func smartMergeGasLimit(originalOptions: Web3Options?, extraOptions: Web3Options?, gasEstimate: BigUInt) -> BigUInt? {
165165
// guard let mergedOptions = Web3Options.merge(originalOptions, with: extraOptions) else {return nil} // just require any non-nils
166166
// if mergedOptions.gasLimit == nil {

Sources/web3swift/Web3/Web3+Structures.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ extension EthereumTransaction: Decodable {
114114
public init(from decoder: Decoder) throws {
115115
let options = try TransactionOptions(from: decoder)
116116
let container = try decoder.container(keyedBy: CodingKeys.self)
117-
117+
118118
// test to see if it is a EIP-1559 wrapper
119119
if let envelope = try decodeHexToBigUInt(container, key: .type, allowOptional: true) {
120120
// if present and non-sero we are a new wrapper we can't decode
121121
if envelope != BigInt(0) { throw Web3Error.dataError }
122122
}
123-
123+
124124
var data = try decodeHexToData(container, key: .data, allowOptional: true)
125125
if data != nil {
126126
self.data = data!

0 commit comments

Comments
 (0)