Skip to content

Commit a09ed12

Browse files
committed
Promis renaming
1 parent 63dda60 commit a09ed12

22 files changed

+80
-84
lines changed

Sources/web3swift/Promises/Promise+Web3+Eth+GetAccounts.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 getAccountsPromise() async throws -> [EthereumAddress] {
12+
public func ownedAccounts() async throws -> [EthereumAddress] {
1313

1414
guard self.web3.provider.attachedKeystoreManager == nil else {
1515
return try self.web3.wallet.getAccounts()

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

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

1111
extension web3.Eth {
12-
public func getBalancePromise(address: EthereumAddress, onBlock: String = "latest") async throws -> BigUInt {
12+
public func getBalance(for address: EthereumAddress, onBlock: String = "latest") async throws -> BigUInt {
1313
let addr = address.address
14-
return try await getBalancePromise(address: addr, onBlock: onBlock)
14+
return try await getBalance(address: addr, onBlock: onBlock)
1515
}
16-
public func getBalancePromise(address: String, onBlock: String = "latest") async throws -> BigUInt {
16+
public func getBalance(address: String, onBlock: String = "latest") async throws -> BigUInt {
1717
let request = JSONRPCRequestFabric.prepareRequest(.getBalance, parameters: [address.lowercased(), onBlock])
1818
let response = try await web3.dispatch(request)
1919

Sources/web3swift/Promises/Promise+Web3+Eth+GetBlockByHash.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.Eth {
12-
public func getBlockByHashPromise(_ hash: Data, fullTransactions: Bool = false) async throws -> Block {
12+
public func block(for hash: Data, fullTransactions: Bool = false) async throws -> Block {
1313
let hashString = hash.toHexString().addHexPrefix()
14-
return try await getBlockByHashPromise(hashString, fullTransactions: fullTransactions)
14+
return try await block(for: hashString, fullTransactions: fullTransactions)
1515
}
1616

17-
public func getBlockByHashPromise(_ hash: String, fullTransactions: Bool = false) async throws -> Block {
17+
public func block(for hash: String, fullTransactions: Bool = false) async throws -> Block {
1818
let request = JSONRPCRequestFabric.prepareRequest(.getBlockByHash, parameters: [hash, fullTransactions])
1919
let response = try await web3.dispatch(request)
2020

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

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

1010

1111
extension web3.Eth {
12-
public func getBlockByNumberPromise(_ number: UInt64, fullTransactions: Bool = false) async throws -> Block {
12+
public func blockBy(number: UInt64, fullTransactions: Bool = false) async throws -> Block {
1313
let block = String(number, radix: 16).addHexPrefix()
14-
return try await getBlockByNumberPromise(block, fullTransactions: fullTransactions)
14+
return try await blockBy(number: block, fullTransactions: fullTransactions)
1515
}
1616

17-
public func getBlockByNumberPromise(_ number: BigUInt, fullTransactions: Bool = false) async throws -> Block {
17+
public func blockBy(number: BigUInt, fullTransactions: Bool = false) async throws -> Block {
1818
let block = String(number, radix: 16).addHexPrefix()
19-
return try await getBlockByNumberPromise(block, fullTransactions: fullTransactions)
19+
return try await blockBy(number: block, fullTransactions: fullTransactions)
2020
}
2121

22-
public func getBlockByNumberPromise(_ number: String, fullTransactions: Bool = false) async throws -> Block {
22+
public func blockBy(number: String, fullTransactions: Bool = false) async throws -> Block {
2323
let request = JSONRPCRequestFabric.prepareRequest(.getBlockByNumber, parameters: [number, fullTransactions])
2424
let response = try await web3.dispatch(request)
2525

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import Foundation
1010
import BigInt
1111

1212
extension web3.Eth {
13-
public func getCodePromise(address: EthereumAddress, onBlock: String = "latest") async throws -> String {
13+
public func code(for address: EthereumAddress, onBlock: String = "latest") async throws -> String {
1414
let addr = address.address
15-
return try await getCodePromise(address: addr, onBlock: onBlock)
15+
return try await code(for : addr, onBlock: onBlock)
1616
}
17-
public func getCodePromise(address: String, onBlock: String = "latest") async throws -> String {
17+
public func code(for address: String, onBlock: String = "latest") async throws -> String {
1818
let request = JSONRPCRequestFabric.prepareRequest(.getCode, parameters: [address.lowercased(), onBlock])
1919
let response = try await web3.dispatch(request)
2020

Sources/web3swift/Promises/Promise+Web3+Eth+GetTransactionDetails.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.Eth {
12-
public func getTransactionDetailsPromise(_ txhash: Data) async throws -> TransactionDetails {
12+
public func transactionDetails(_ txhash: Data) async throws -> TransactionDetails {
1313
let hashString = txhash.toHexString().addHexPrefix()
14-
return try await self.getTransactionDetailsPromise(hashString)
14+
return try await self.transactionDetails(hashString)
1515
}
1616

17-
public func getTransactionDetailsPromise(_ txhash: String) async throws -> TransactionDetails {
17+
public func transactionDetails(_ txhash: String) async throws -> TransactionDetails {
1818
let request = JSONRPCRequestFabric.prepareRequest(.getTransactionByHash, parameters: [txhash])
1919
let response = try await web3.dispatch(request)
2020

Sources/web3swift/Promises/Promise+Web3+Eth+GetTransactionReceipt.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.Eth {
12-
public func getTransactionReceiptPromise(_ txhash: Data) async throws -> TransactionReceipt {
12+
public func transactionReceipt(_ txhash: Data) async throws -> TransactionReceipt {
1313
let hashString = txhash.toHexString().addHexPrefix()
14-
return try await self.getTransactionReceiptPromise(hashString)
14+
return try await self.transactionReceipt(hashString)
1515
}
1616

17-
public func getTransactionReceiptPromise(_ txhash: String) async throws -> TransactionReceipt {
17+
public func transactionReceipt(_ txhash: String) async throws -> TransactionReceipt {
1818
let request = JSONRPCRequestFabric.prepareRequest(.getTransactionReceipt, parameters: [txhash])
1919
let response = try await web3.dispatch(request)
2020

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import Foundation
88

99

1010
extension web3.Eth {
11-
public func sendRawTransactionPromise(_ transaction: Data) async throws -> TransactionSendingResult {
11+
public func send(raw transaction: Data) async throws -> TransactionSendingResult {
1212
guard let deserializedTX = EthereumTransaction(rawValue: transaction) else {
1313
throw Web3Error.processingError(desc: "Serialized TX is invalid")
1414
}
15-
return try await sendRawTransactionPromise(deserializedTX)
15+
return try await send(raw: deserializedTX)
1616
}
1717

18-
public func sendRawTransactionPromise(_ transaction: EthereumTransaction) async throws -> TransactionSendingResult {
18+
public func send(raw transaction: EthereumTransaction) async throws -> TransactionSendingResult {
1919

2020
guard let request = EthereumTransaction.createRawTransaction(transaction: transaction) else {
2121
throw Web3Error.processingError(desc: "Transaction is invalid")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extension web3.Eth {
6363
} catch {
6464
throw Web3Error.inputError(desc: "Failed to locally sign a transaction")
6565
}
66-
return try await self.web3.eth.sendRawTransactionPromise(assembledTransaction)
66+
return try await self.web3.eth.send(raw: assembledTransaction)
6767

6868
}
6969
}

Sources/web3swift/Promises/Promise+Web3+TxPool.swift

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

1010

1111
extension web3.TxPool {
12-
public func getInspectPromise() async throws -> [String: [String: [String: String]]] {
12+
public func txPoolInspect() async throws -> [String: [String: [String: String]]] {
1313
let request = JSONRPCRequestFabric.prepareRequest(.getTxPoolInspect, parameters: [])
1414
let response = try await web3.dispatch(request)
1515

@@ -23,7 +23,7 @@ extension web3.TxPool {
2323

2424
}
2525

26-
public func getStatusPromise() async throws -> TxPoolStatus {
26+
public func txPoolStatus() async throws -> TxPoolStatus {
2727
let request = JSONRPCRequestFabric.prepareRequest(.getTxPoolStatus, parameters: [])
2828
let response = try await web3.dispatch(request)
2929

@@ -37,7 +37,7 @@ extension web3.TxPool {
3737

3838
}
3939

40-
public func getContentPromise() async throws -> TxPoolContent {
40+
public func txPoolContent() async throws -> TxPoolContent {
4141
let request = JSONRPCRequestFabric.prepareRequest(.getTxPoolContent, parameters: [])
4242
let response = try await web3.dispatch(request)
4343

0 commit comments

Comments
 (0)