Skip to content

Commit bdc52be

Browse files
Drop duplicated keystore manager code from send method.
1 parent df80fb7 commit bdc52be

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

Sources/web3swift/EthereumAPICalls/Ethereum/Eth+SendTransaction.swift

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,7 @@ import Core
1111

1212
extension web3.Eth {
1313

14-
public func send(_ transaction: CodableTransaction, password: String) async throws -> TransactionSendingResult {
15-
if let attachedKeystoreManager = self.web3.provider.attachedKeystoreManager {
16-
var tmpTransaction = transaction
17-
do {
18-
try Web3Signer.signTX(transaction: &tmpTransaction,
19-
keystore: attachedKeystoreManager,
20-
account: tmpTransaction.from ?? tmpTransaction.sender ?? EthereumAddress.contractDeploymentAddress(),
21-
password: password)
22-
} catch {
23-
throw Web3Error.inputError(desc: "Failed to locally sign a transaction")
24-
}
25-
return try await self.web3.eth.send(raw: tmpTransaction.encode(for: .transaction)!)
26-
}
27-
14+
public func send(_ transaction: CodableTransaction) async throws -> TransactionSendingResult {
2815
// MARK: Sending Data flow
2916
let request: APIRequest = .sendTransaction(transaction)
3017
let response: APIResponse<Hash> = try await APIRequest.sendRequest(with: self.provider, for: request)

Sources/web3swift/Operations/WriteOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class WriteOperation: ReadOperation {
2626
return try await web3.eth.send(raw: transactionData)
2727
}
2828
// MARK: Sending Data flow
29-
return try await web3.eth.send(transaction, password: password)
29+
return try await web3.eth.send(transaction)
3030
}
3131

3232
// FIXME: Rewrite this to CodableTransaction

0 commit comments

Comments
 (0)