Skip to content

Commit dd93a0c

Browse files
committed
Update WriteOperation.swift
1 parent 0847410 commit dd93a0c

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

Sources/web3swift/Operations/WriteOperation.swift

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -42,47 +42,4 @@ public class WriteOperation: ReadOperation {
4242
guard let transactionData = transaction.encode(for: .transaction) else { throw Web3Error.dataError }
4343
return try await web3.eth.send(raw: transactionData)
4444
}
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-
// }
8845
}

0 commit comments

Comments
 (0)