Skip to content

Commit bbe64ef

Browse files
Comment out some duplicating code.
1 parent 983d084 commit bbe64ef

File tree

2 files changed

+26
-49
lines changed

2 files changed

+26
-49
lines changed

Sources/web3swift/Web3/Web3+Eth.swift

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import Foundation
88
import BigInt
99

10+
// FIXME: None of the follow methods are syncronious.
1011
extension web3.Eth {
11-
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.
1414
///
@@ -34,10 +34,10 @@ extension web3.Eth {
3434
/// This function is synchronous!
3535
///
3636
/// Returns the Result object that indicates either success of failure.
37-
func call(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions) async throws -> Data {
38-
let result = try await self.callTransaction(transaction, transactionOptions: transactionOptions)
39-
return result
40-
}
37+
// func call(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions) async throws -> Data {
38+
// let result = try await self.callTransaction(transaction, transactionOptions: transactionOptions)
39+
// return result
40+
// }
4141

4242
/// Send raw Ethereum transaction data to the network.
4343
///
@@ -59,18 +59,18 @@ extension web3.Eth {
5959
return result
6060
}
6161

62-
/// Returns a total number of transactions sent by the particular Ethereum address.
63-
///
64-
/// "onBlock" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
65-
/// or the expected state after all the transactions in memory pool are applied ("pending").
66-
///
67-
/// This function is synchronous!
68-
///
69-
/// Returns the Result object that indicates either success of failure.
70-
public func getTransactionCount(address: EthereumAddress, onBlock: String = "latest") async throws -> BigUInt {
71-
let result = try await self.getTransactionCount(for: address, onBlock: onBlock)
72-
return result
73-
}
62+
// /// Returns a total number of transactions sent by the particular Ethereum address.
63+
// ///
64+
// /// "onBlock" field determines if value is returned based on the state of a blockchain on the latest mined block ("latest")
65+
// /// or the expected state after all the transactions in memory pool are applied ("pending").
66+
// ///
67+
// /// This function is synchronous!
68+
// ///
69+
// /// Returns the Result object that indicates either success of failure.
70+
// public func getTransactionCount(address: EthereumAddress, onBlock: String = "latest") async throws -> BigUInt {
71+
// let result = try await self.getTransactionCount(for: address, onBlock: onBlock)
72+
// return result
73+
// }
7474

7575
/// Returns a balance of particular Ethereum address in Wei units (1 ETH = 10^18 Wei).
7676
///
@@ -80,7 +80,7 @@ extension web3.Eth {
8080
/// This function is synchronous!
8181
///
8282
/// Returns the Result object that indicates either success of failure.
83-
public func getBalance(address: EthereumAddress, onBlock: String = "latest") async throws -> BigUInt {
83+
public func getBalance(address: EthereumAddress, onBlock: BlockNumber) async throws -> BigUInt {
8484
let result = try await self.getBalance(for: address, onBlock: onBlock)
8585
return result
8686
}
@@ -185,7 +185,7 @@ extension web3.Eth {
185185
///
186186
/// Returns the Result object that indicates either success of failure.
187187
public func getBlockByHash(_ hash: String, fullTransactions: Bool = false) async throws -> Block {
188-
let result = try await self.block(for: hash, fullTransactions: fullTransactions)
188+
let result = try await self.block(by: hash, fullTransactions: fullTransactions)
189189
return result
190190
}
191191

@@ -197,19 +197,7 @@ extension web3.Eth {
197197
///
198198
/// Returns the Result object that indicates either success of failure.
199199
public func getBlockByHash(_ hash: Data, fullTransactions: Bool = false) async throws -> Block {
200-
let result = try await self.block(for: hash, fullTransactions: fullTransactions)
201-
return result
202-
}
203-
204-
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
205-
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
206-
/// but full decoded EthereumTransaction objects.
207-
///
208-
/// This function is synchronous!
209-
///
210-
/// Returns the Result object that indicates either success of failure.
211-
public func getBlockByNumber(_ number: UInt, fullTransactions: Bool = false) async throws -> Block {
212-
let result = try await self.blockBy(number: number, fullTransactions: fullTransactions)
200+
let result = try await self.block(by: hash, fullTransactions: fullTransactions)
213201
return result
214202
}
215203

@@ -220,22 +208,11 @@ extension web3.Eth {
220208
/// This function is synchronous!
221209
///
222210
/// Returns the Result object that indicates either success of failure.
223-
public func getBlockByNumber(_ number: BigUInt, fullTransactions: Bool = false) async throws -> Block {
224-
let result = try await self.blockBy(number: number, fullTransactions: fullTransactions)
211+
public func getBlockByNumber(_ number: BlockNumber, fullTransactions: Bool = false) async throws -> Block {
212+
let result = try await self.block(by: number, fullTransactions: fullTransactions)
225213
return result
226214
}
227215

228-
/// Get information about the particular block in Ethereum network. If "fullTransactions" parameter is set to "true"
229-
/// this call fill do a virtual join and fetch not just transaction hashes from this block,
230-
/// but full decoded EthereumTransaction objects.
231-
///
232-
/// This function is synchronous!
233-
///
234-
///
235-
public func getBlockByNumber(_ block: String, fullTransactions: Bool = false) async throws -> Block {
236-
let result = try await self.blockBy(number: block, fullTransactions: fullTransactions)
237-
return result
238-
}
239216

240217
/**
241218
Convenience wrapper to send Ethereum to another address. Internally it creates a virtual contract and encodes all the options and data.

Sources/web3swift/Web3/Web3+TxPool.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import Foundation
88
import BigInt
99

1010
extension web3.TxPool {
11-
public func getInspect() async throws -> [String: [String: [String: String]]] {
12-
let result = try await self.txPoolInspect()
13-
return result
14-
}
11+
// public func getInspect() async throws -> [String: [String: [String: String]]] {
12+
// let result = try await self.txPoolInspect()
13+
// return result
14+
// }
1515

1616
public func getStatus() async throws -> TxPoolStatus {
1717
let result = try await self.txPoolStatus()

0 commit comments

Comments
 (0)