Skip to content

Commit 4c57752

Browse files
Merge pull request #632 from JeneaVranceanu/hot-fix/data-to-hex-string
2 parents 53a216e + b2298b3 commit 4c57752

25 files changed

+89
-92
lines changed

Sources/Core/Contract/ContractProtocol.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ extension DefaultContractProtocol {
225225
let parameters = parameters,
226226
!parameters.isEmpty {
227227
guard constructor.inputs.count == parameters.count,
228-
// FIXME: This should be zipped, because Arrays don't guarantee it's elements order
229228
let encodedData = constructor.encodeParameters(parameters) else {
230229
NSLog("Constructor encoding will fail as the number of input arguments doesn't match the number of given arguments.")
231230
return nil

Sources/Core/EthereumABI/ABIEncoding.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ extension ABIEncoder {
137137
/// - values: Contract values of a given element to encode
138138
/// - Returns: Encoded data
139139
public static func encode(types: [ABI.Element.InOut], values: [AnyObject]) -> Data? {
140-
// FIXME: This should be zipped, because Arrays don't guarantee it's elements order
141140
guard types.count == values.count else {return nil}
142141
let params = types.compactMap { (el) -> ABI.Element.ParameterType in
143142
return el.type
@@ -152,7 +151,6 @@ extension ABIEncoder {
152151
/// - values: Contract values of a given element to encode
153152
/// - Returns: Encoded data
154153
public static func encode(types: [ABI.Element.ParameterType], values: [AnyObject]) -> Data? {
155-
// FIXME: This should be zipped, because Arrays don't guarantee it's elements order
156154
guard types.count == values.count else {return nil}
157155
var tails = [Data]()
158156
var heads = [Data]()

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

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

1010
extension Web3.Eth {
1111
public func callTransaction(_ transaction: CodableTransaction) async throws -> Data {
12-
let request: APIRequest = .call(transaction, transaction.callOnBlock ?? .latest)
13-
return try await APIRequest.sendRequest(with: self.provider, for: request).result
12+
let request = APIRequest.call(transaction, transaction.callOnBlock ?? .latest)
13+
return try await APIRequest.sendRequest(with: provider, for: request).result
1414
}
1515
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Core
1010

1111
extension Web3.Eth {
1212
public func estimateGas(for transaction: CodableTransaction, onBlock: BlockNumber = .latest) async throws -> BigUInt {
13-
try await APIRequest.sendRequest(with: provider, for: .estimateGas(transaction, onBlock)).result
13+
let request = APIRequest.estimateGas(transaction, onBlock)
14+
return try await APIRequest.sendRequest(with: provider, for: request).result
1415
}
1516
}

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

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

1010
extension Web3.Eth {
1111
func feeHistory(blockCount: BigUInt, block: BlockNumber, percentiles:[Double]) async throws -> Oracle.FeeHistory {
12-
let requestCall: APIRequest = .feeHistory(blockCount, block, percentiles)
13-
return try await APIRequest.sendRequest(with: web3.provider, for: requestCall).result
12+
let request = APIRequest.feeHistory(blockCount, block, percentiles)
13+
return try await APIRequest.sendRequest(with: web3.provider, for: request).result
1414
}
1515
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import Core
99

1010
extension Web3.Eth {
1111
public func ownedAccounts() async throws -> [EthereumAddress] {
12-
guard self.web3.provider.attachedKeystoreManager == nil else {
13-
return try self.web3.wallet.getAccounts()
12+
guard web3.provider.attachedKeystoreManager == nil else {
13+
return try web3.wallet.getAccounts()
1414
}
1515
return try await APIRequest.sendRequest(with: web3.provider, for: .getAccounts).result
1616
}

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

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

1010
extension Web3.Eth {
1111
public func getBalance(for address: EthereumAddress, onBlock: BlockNumber = .latest) async throws -> BigUInt {
12-
let requestCall: APIRequest = .getBalance(address.address, onBlock)
13-
return try await APIRequest.sendRequest(with: web3.provider, for: requestCall).result
12+
let request = APIRequest.getBalance(address.address, onBlock)
13+
return try await APIRequest.sendRequest(with: web3.provider, for: request).result
1414
}
1515
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import Core
1010

1111
extension Web3.Eth {
1212
public func block(by hash: Data, fullTransactions: Bool = false) async throws -> Block {
13-
guard let hexString = String(data: hash, encoding: .utf8)?.addHexPrefix() else { throw Web3Error.dataError }
14-
let requestCall: APIRequest = .getBlockByHash(hash.toHexString().addHexPrefix(), fullTransactions)
15-
return try await APIRequest.sendRequest(with: self.provider, for: requestCall).result
13+
let request = APIRequest.getBlockByHash(hash.toHexString().addHexPrefix(), fullTransactions)
14+
return try await APIRequest.sendRequest(with: provider, for: request).result
1615
}
1716
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import Core
1010

1111
extension Web3.Eth {
1212
public func block(by hash: Hash, fullTransactions: Bool = false) async throws -> Block {
13-
let requestCall: APIRequest = .getBlockByHash(hash, fullTransactions)
14-
return try await APIRequest.sendRequest(with: self.provider, for: requestCall).result
13+
let request = APIRequest.getBlockByHash(hash, fullTransactions)
14+
return try await APIRequest.sendRequest(with: provider, for: request).result
1515
}
1616

1717
public func block(by number: BlockNumber, fullTransactions: Bool = false) async throws -> Block {
18-
let requestCall: APIRequest = .getBlockByNumber(number, fullTransactions)
19-
return try await APIRequest.sendRequest(with: self.provider, for: requestCall).result
18+
let request = APIRequest.getBlockByNumber(number, fullTransactions)
19+
return try await APIRequest.sendRequest(with: provider, for: request).result
2020
}
2121
}

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

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

1010
extension Web3.Eth {
1111
public func code(for address: EthereumAddress, onBlock: BlockNumber = .latest) async throws -> Hash {
12-
try await APIRequest.sendRequest(with: self.provider, for: .getCode(address.address, onBlock)).result
12+
let request = APIRequest.getCode(address.address, onBlock)
13+
return try await APIRequest.sendRequest(with: provider, for: request).result
1314
}
1415
}

0 commit comments

Comments
 (0)