@@ -42,47 +42,4 @@ public class WriteOperation: ReadOperation {
42
42
guard let transactionData = transaction. encode ( for: . transaction) else { throw Web3Error . dataError }
43
43
return try await web3. eth. send ( raw: transactionData)
44
44
}
45
-
46
- public func depploy( password: String , policies: Policies = . auto) async throws -> TransactionSendingResult {
47
- //TODO: optimize/cleanup
48
- // try await transaction.resolve(provider: web3.provider)
49
- try await policyResolver. resolveAll ( for: & transaction, with: policies)
50
-
51
- guard let attachedKeystoreManager = self . web3. provider. attachedKeystoreManager else {
52
- throw Web3Error . inputError ( desc: " Failed to locally sign a transaction " )
53
- }
54
-
55
- do {
56
- //TODO: optimize/cleanup
57
- // transaction.unsign()
58
- let account = transaction. from ?? transaction. sender ?? EthereumAddress . contractDeploymentAddress ( )
59
- var privateKey = try attachedKeystoreManager. UNSAFE_getPrivateKeyData ( password: password, account: account)
60
- defer { Data . zero ( & privateKey) }
61
- try transaction. sign ( privateKey: privateKey, useExtraEntropy: false )
62
- } catch {
63
- throw Web3Error . inputError ( desc: " Failed to locally sign a transaction " )
64
- }
65
-
66
- //TODO: optimize/cleanup
67
- guard let transactionData = transaction. encode ( for: . transaction) else { throw Web3Error . dataError }
68
- // let vectorHash = transaction.hash!.toHexString().addHexPrefix()
69
- // print(vectorHash)
70
-
71
- //TODO: optimize/cleanup
72
- return try await web3. eth. send ( raw: transactionData)
73
- }
74
-
75
- // FIXME: Rewrite this to CodableTransaction
76
- // func nonce(for policy: CodableTransaction.NoncePolicy, from: EthereumAddress) async throws -> BigUInt {
77
- // switch policy {
78
- // case .latest:
79
- // return try await self.web3.eth.getTransactionCount(for: from, onBlock: .latest)
80
- // case .pending:
81
- // return try await self.web3.eth.getTransactionCount(for: from, onBlock: .pending)
82
- // case .earliest:
83
- // return try await self.web3.eth.getTransactionCount(for: from, onBlock: .earliest)
84
- // case .exact(let nonce):
85
- // return nonce
86
- // }
87
- // }
88
45
}
0 commit comments