7
7
import Foundation
8
8
import BigInt
9
9
10
+ // FIXME: None of the follow methods are syncronious.
10
11
extension web3 . Eth {
11
-
12
12
/// Send an EthereumTransaction object to the network. Transaction is either signed locally if there is a KeystoreManager
13
13
/// object bound to the web3 instance, or sent unsigned to the node. For local signing the password is required.
14
14
///
@@ -34,10 +34,10 @@ extension web3.Eth {
34
34
/// This function is synchronous!
35
35
///
36
36
/// 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
+ // }
41
41
42
42
/// Send raw Ethereum transaction data to the network.
43
43
///
@@ -59,18 +59,18 @@ extension web3.Eth {
59
59
return result
60
60
}
61
61
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
+ // }
74
74
75
75
/// Returns a balance of particular Ethereum address in Wei units (1 ETH = 10^18 Wei).
76
76
///
@@ -80,7 +80,7 @@ extension web3.Eth {
80
80
/// This function is synchronous!
81
81
///
82
82
/// 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 {
84
84
let result = try await self . getBalance ( for: address, onBlock: onBlock)
85
85
return result
86
86
}
@@ -185,7 +185,7 @@ extension web3.Eth {
185
185
///
186
186
/// Returns the Result object that indicates either success of failure.
187
187
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)
189
189
return result
190
190
}
191
191
@@ -197,19 +197,7 @@ extension web3.Eth {
197
197
///
198
198
/// Returns the Result object that indicates either success of failure.
199
199
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)
213
201
return result
214
202
}
215
203
@@ -220,22 +208,11 @@ extension web3.Eth {
220
208
/// This function is synchronous!
221
209
///
222
210
/// 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)
225
213
return result
226
214
}
227
215
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
- }
239
216
240
217
/**
241
218
Convenience wrapper to send Ethereum to another address. Internally it creates a virtual contract and encodes all the options and data.
0 commit comments