Skip to content

Commit 63dda60

Browse files
committed
more promise renaming
1 parent b0b0179 commit 63dda60

12 files changed

+22
-22
lines changed

Sources/web3swift/Promises/Promise+Web3+Eth+Call.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99

1010
extension web3.Eth {
1111

12-
public func callPromise(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions?) async throws -> Data {
12+
public func callTransaction(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions?) async throws -> Data {
1313
guard let request = EthereumTransaction.createRequest(method: .call, transaction: transaction, transactionOptions: transactionOptions) else {
1414
throw Web3Error.processingError(desc: "Transaction is invalid")
1515
}

Sources/web3swift/Promises/Promise+Web3+Eth+EstimateGas.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import BigInt
1010

1111
extension web3.Eth {
1212

13-
public func estimateGasPromise(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions?) async throws -> BigUInt {
13+
public func estimateGas(for transaction: EthereumTransaction, transactionOptions: TransactionOptions?) async throws -> BigUInt {
1414

1515
guard let request = EthereumTransaction.createRequest(method: .estimateGas, transaction: transaction, transactionOptions: transactionOptions) else {
1616
throw Web3Error.processingError(desc: "Transaction is invalid")

Sources/web3swift/Promises/Promise+Web3+Eth+GetBlockNumber.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import BigInt
99

1010

1111
extension web3.Eth {
12-
public func getBlockNumberPromise() async throws -> BigUInt {
12+
public func blockNumber() async throws -> BigUInt {
1313
let request = JSONRPCRequestFabric.prepareRequest(.blockNumber, parameters: [])
1414
let response = try await web3.dispatch(request)
1515

Sources/web3swift/Promises/Promise+Web3+Eth+GetGasPrice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import BigInt
99

1010

1111
extension web3.Eth {
12-
public func getGasPricePromise() async throws -> BigUInt {
12+
public func gasPrice() async throws -> BigUInt {
1313
let request = JSONRPCRequestFabric.prepareRequest(.gasPrice, parameters: [])
1414
let response = try await web3.dispatch(request)
1515

Sources/web3swift/Promises/Promise+Web3+Eth+SendTransaction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import BigInt
1010

1111
extension web3.Eth {
1212

13-
public func sendTransactionPromise(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions? = nil, password: String = "web3swift") async throws -> TransactionSendingResult {
13+
public func send(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions? = nil, password: String = "web3swift") async throws -> TransactionSendingResult {
1414
// print(transaction)
1515
var assembledTransaction: EthereumTransaction = transaction
1616

Sources/web3swift/Promises/Promise+Web3+Personal+CreateAccount.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import BigInt
99

1010

1111
extension web3.Personal {
12-
public func createAccountPromise(password: String = "web3swift") async throws -> EthereumAddress {
12+
public func createAccount(password: String = "web3swift") async throws -> EthereumAddress {
1313

1414
guard self.web3.provider.attachedKeystoreManager == nil else {
1515
throw Web3Error.inputError(desc: "Creating account in a local keystore with this method is not supported")

Sources/web3swift/Promises/Promise+Web3+Personal+Sign.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import BigInt
1010

1111
extension web3.Personal {
1212

13-
public func signPersonalMessagePromise(message: Data, from: EthereumAddress, password: String = "web3swift") async throws -> Data {
13+
public func signPersonal(message: Data, from: EthereumAddress, password: String = "web3swift") async throws -> Data {
1414

1515
guard let attachedKeystoreManager = self.web3.provider.attachedKeystoreManager else {
1616
let hexData = message.toHexString().addHexPrefix()

Sources/web3swift/Promises/Promise+Web3+Personal+UnlockAccount.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import BigInt
99

1010

1111
extension web3.Personal {
12-
public func unlockAccountPromise(account: EthereumAddress, password: String = "web3swift", seconds: UInt64 = 300) async throws -> Bool {
12+
public func unlock(account: EthereumAddress, password: String = "web3swift", seconds: UInt64 = 300) async throws -> Bool {
1313
let addr = account.address
14-
return try await unlockAccountPromise(account: addr, password: password, seconds: seconds)
14+
return try await unlock(account: addr, password: password, seconds: seconds)
1515
}
1616

17-
public func unlockAccountPromise(account: String, password: String = "web3swift", seconds: UInt64 = 300) async throws -> Bool {
17+
public func unlock(account: String, password: String = "web3swift", seconds: UInt64 = 300) async throws -> Bool {
1818

1919
guard self.web3.provider.attachedKeystoreManager == nil else {
2020
throw Web3Error.inputError(desc: "Can not unlock a local keystore")

Sources/web3swift/Web3/Web3+Eth.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension web3.Eth {
1919
///
2020
/// Returns the Result object that indicates either success of failure.
2121
public func sendTransaction(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions, password: String = "web3swift") async throws -> TransactionSendingResult {
22-
let result = try await self.sendTransactionPromise(transaction, transactionOptions: transactionOptions, password: password)
22+
let result = try await self.send(transaction, transactionOptions: transactionOptions, password: password)
2323
return result
2424
}
2525

@@ -35,7 +35,7 @@ extension web3.Eth {
3535
///
3636
/// Returns the Result object that indicates either success of failure.
3737
func call(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions) async throws -> Data {
38-
let result = try await self.callPromise(transaction, transactionOptions: transactionOptions)
38+
let result = try await self.callTransaction(transaction, transactionOptions: transactionOptions)
3939
return result
4040
}
4141

@@ -91,7 +91,7 @@ extension web3.Eth {
9191
///
9292
/// Returns the Result object that indicates either success of failure.
9393
public func getBlockNumber() async throws -> BigUInt {
94-
let result = try await self.getBlockNumberPromise()
94+
let result = try await self.blockNumber()
9595
return result
9696
}
9797

@@ -101,7 +101,7 @@ extension web3.Eth {
101101
///
102102
/// Returns the Result object that indicates either success of failure.
103103
public func getGasPrice() async throws -> BigUInt {
104-
let result = try await self.getGasPricePromise()
104+
let result = try await self.gasPrice()
105105
return result
106106
}
107107

@@ -162,7 +162,7 @@ extension web3.Eth {
162162
/// Error can also indicate that transaction is invalid in the current state, so formally it's gas limit is infinite.
163163
/// An example of such transaction can be sending an amount of ETH that is larger than the current account balance.
164164
public func estimateGas(_ transaction: EthereumTransaction, transactionOptions: TransactionOptions?) async throws -> BigUInt {
165-
let result = try await self.estimateGasPromise(transaction, transactionOptions: transactionOptions)
165+
let result = try await self.estimateGas(for: transaction, transactionOptions: transactionOptions)
166166
return result
167167
}
168168

Sources/web3swift/Web3/Web3+MutatingTransaction.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public class WriteTransaction: ReadTransaction {
131131
var cleanedOptions = TransactionOptions()
132132
cleanedOptions.from = mergedOptions.from
133133
cleanedOptions.to = mergedOptions.to
134-
return try await self.web3.eth.sendTransactionPromise(transaction, transactionOptions: cleanedOptions, password: password)
134+
return try await self.web3.eth.send(transaction, transactionOptions: cleanedOptions, password: password)
135135
}
136136

137137
public func send(password: String = "web3swift", transactionOptions: TransactionOptions? = nil) async throws -> TransactionSendingResult {
@@ -146,7 +146,7 @@ public class WriteTransaction: ReadTransaction {
146146
, assembledTransaction: EthereumTransaction, optionsForGasEstimation: TransactionOptions) async throws -> BigUInt {
147147
switch policy {
148148
case .automatic, .withMargin, .limited:
149-
return try await self.web3.eth.estimateGasPromise(assembledTransaction, transactionOptions: optionsForGasEstimation)
149+
return try await self.web3.eth.estimateGas(for: assembledTransaction, transactionOptions: optionsForGasEstimation)
150150
case .manual(let gasLimit):
151151
return gasLimit
152152
}
@@ -166,7 +166,7 @@ public class WriteTransaction: ReadTransaction {
166166
func gasPrice(for policy: TransactionOptions.GasPricePolicy) async throws -> BigUInt {
167167
switch policy {
168168
case .automatic, .withMargin:
169-
return try await self.web3.eth.getGasPricePromise()
169+
return try await self.web3.eth.gasPrice()
170170
case .manual(let gasPrice):
171171
return gasPrice
172172
}

0 commit comments

Comments
 (0)