Skip to content

Commit 93f66ca

Browse files
Code cleaning & unnecessary changes revert.
1 parent b338ac9 commit 93f66ca

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

Sources/web3swift/Promises/Promise+Web3+Eth+FeeHistory.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import PromiseKit
1111
import BigInt
1212

1313
extension web3.Eth {
14-
// public func feeHistory(blockCount: Int = 10, onBlock: String = "latest", percentiles:[Double] = [25, 50, 75]) -> Promise<FeeHistory> {
15-
// return feeHistory(address: addr, onBlock: onBlock)
16-
// }
17-
1814
func feeHistory(blockCount: BigUInt, block: String, percentiles:[Double]) throws -> Web3.Oracle.FeeHistory {
1915
let request = JSONRPCRequestFabric.prepareRequest(.feeHistory, parameters: [blockCount.description.addHexPrefix(), block, percentiles])
2016
let rp = web3.dispatch(request)

Sources/web3swift/Web3/Web3+Eth.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,5 @@ extension web3.Eth {
351351
guard let value = Web3.Utils.parseToBigUInt(amount, decimals: intDecimals) else {return nil}
352352
return sendERC20tokensWithKnownDecimals(tokenAddress: tokenAddress, from: from, to: to, amount: value, transactionOptions: mergedOptions)
353353
}
354+
354355
}

Sources/web3swift/Web3/Web3+ReadingTransaction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public class ReadTransaction {
9090
let promise = self.web3.eth.estimateGasPromise(assembledTransaction, transactionOptions: optionsForGasEstimation)
9191
promise.done(on: queue) {(estimate: BigUInt) in
9292
seal.fulfill(estimate)
93-
}.catch(on: queue) {err in
94-
seal.reject(err)
93+
}.catch(on: queue) {err in
94+
seal.reject(err)
9595
}
9696
}
9797
return returnPromise

Sources/web3swift/Web3/Web3+WebsocketProvider.swift

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,25 @@ public enum InfuraWebsocketMethod: String, Encodable {
3030
case unsubscribe = "eth_unsubscribe"
3131

3232
public var requiredNumOfParameters: Int? {
33-
switch self {
34-
case .newPendingTransactionFilter:
35-
return 0
36-
case .getFilterChanges:
37-
return 1
38-
case .newFilter:
39-
return nil
40-
case .newBlockFilter:
41-
return 0
42-
case .getFilterLogs:
43-
return nil
44-
case .uninstallFilter:
45-
return 1
46-
case .subscribe:
47-
return nil
48-
case .unsubscribe:
49-
return 1
33+
get {
34+
switch self {
35+
case .newPendingTransactionFilter:
36+
return 0
37+
case .getFilterChanges:
38+
return 1
39+
case .newFilter:
40+
return nil
41+
case .newBlockFilter:
42+
return 0
43+
case .getFilterLogs:
44+
return nil
45+
case .uninstallFilter:
46+
return 1
47+
case .subscribe:
48+
return nil
49+
case .unsubscribe:
50+
return 1
51+
}
5052
}
5153
}
5254
}
@@ -73,11 +75,13 @@ public struct InfuraWebsocketRequest: Encodable {
7375
}
7476

7577
public var isValid: Bool {
76-
if self.method == nil {
77-
return false
78+
get {
79+
if self.method == nil {
80+
return false
81+
}
82+
guard let method = self.method else {return false}
83+
return method.requiredNumOfParameters == self.params?.params.count
7884
}
79-
guard let method = self.method else {return false}
80-
return method.requiredNumOfParameters == self.params?.params.count
8185
}
8286
}
8387

Tests/web3swiftTests/localTests/web3swiftBasicLocalNodeTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class web3swiftBasicLocalNodeTests: XCTestCase {
6464
let balanceBeforeFrom = try web3.eth.getBalancePromise(address: allAddresses[0]).wait()
6565
print("Balance before to: " + balanceBeforeTo.description)
6666
print("Balance before from: " + balanceBeforeFrom.description)
67-
67+
6868
let result = try sendTx.sendPromise().wait()
6969
let txHash = result.hash
7070
print("Transaction with hash " + txHash)

Tests/web3swiftTests/localTests/web3swiftPromisesTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class web3swiftPromisesTests: XCTestCase {
9494
options.from = fromAddress
9595

9696
let amount1 = Web3.Utils.parseToBigUInt("0.000000000000000001", units: .eth) // 1 wei
97-
97+
9898
guard let tx1 = contract.write("test",
9999
parameters: [amount1] as [AnyObject],
100100
extraData: Data(),

0 commit comments

Comments
 (0)