Skip to content

Commit e2b0f5d

Browse files
fix: changed type of web3.eth to IEth and removed it's dependency on web3
1 parent 29fff74 commit e2b0f5d

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Sources/web3swift/Web3/Web3+Instance.swift

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,26 @@ public class Web3 {
2020
/// Keystore manager can be bound to Web3 instance. If some manager is bound all further account related functions, such
2121
/// as account listing, transaction signing, etc. are done locally using private keys and accounts found in a manager.
2222
public func addKeystoreManager(_ manager: KeystoreManager?) {
23-
self.provider.attachedKeystoreManager = manager
23+
provider.attachedKeystoreManager = manager
2424
}
2525

26-
var ethInstance: Web3.Eth?
26+
var ethInstance: IEth?
2727

2828
/// Public web3.eth.* namespace.
29-
public var eth: Web3.Eth {
30-
if self.ethInstance != nil {
31-
return self.ethInstance!
29+
public var eth: IEth {
30+
if ethInstance != nil {
31+
return ethInstance!
3232
}
33-
self.ethInstance = Web3.Eth(provider: self.provider, web3: self)
34-
return self.ethInstance!
33+
ethInstance = Web3.Eth(provider: provider)
34+
return ethInstance!
3535
}
3636

3737
// FIXME: Rewrite this to CodableTransaction
3838
public class Eth: IEth {
3939
public var provider: Web3Provider
40-
// FIXME: web3 must be weak
41-
var web3: Web3
4240

43-
public init(provider prov: Web3Provider, web3 web3instance: Web3) {
41+
public init(provider prov: Web3Provider) {
4442
provider = prov
45-
web3 = web3instance
46-
}
47-
48-
public func callTransaction(_ transaction: CodableTransaction) async throws -> Data {
49-
let request = APIRequest.call(transaction, transaction.callOnBlock ?? .latest)
50-
return try await APIRequest.sendRequest(with: provider, for: request).result
5143
}
5244
}
5345

0 commit comments

Comments
 (0)