Skip to content

Commit 496a9fd

Browse files
Merge pull request #683 from albertopeam/feature/remove-warnings
Removed project warnings
2 parents deb58f1 + efd6672 commit 496a9fd

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Sources/Web3Core/RLP/RLP.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ public struct RLP {
113113
}
114114

115115
// FIXME: Make encode generic to avoid casting it's argument to [AnyObject]
116-
internal static func encode(_ elements: [AnyObject]) -> Data? {
116+
internal static func encode(_ elements: [Any?]) -> Data? {
117117
var encodedData = Data()
118118
for e in elements {
119-
if let encoded = encode(e) {
119+
if let encoded = encode(e as AnyObject) {
120120
encodedData.append(encoded)
121121
} else {
122122
guard let asArray = e as? [AnyObject] else {return nil}

Sources/Web3Core/Transaction/Envelope/EIP1559Envelope.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,14 @@ extension EIP1559Envelope {
245245
// }
246246

247247
public func encode(for type: EncodeType = .transaction) -> Data? {
248-
let fields: [AnyObject]
248+
let fields: [Any?]
249249
let list = accessList.map { $0.encodeAsList() as AnyObject }
250250

251251
switch type {
252252
case .transaction:
253-
fields = [chainID, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to.addressData, value, data, list, v, r, s] as [AnyObject]
253+
fields = [chainID, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to.addressData, value, data, list, v, r, s]
254254
case .signature:
255-
fields = [chainID, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to.addressData, value, data, list] as [AnyObject]
255+
fields = [chainID, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to.addressData, value, data, list]
256256
}
257257
guard var result = RLP.encode(fields) else { return nil }
258258
result.insert(UInt8(self.type.rawValue), at: 0)

Sources/Web3Core/Transaction/Envelope/EIP2930Envelope.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ extension EIP2930Envelope {
206206
}
207207

208208
public func encode(for type: EncodeType = .transaction) -> Data? {
209-
let fields: [AnyObject]
209+
let fields: [Any?]
210210
let list = accessList.map { $0.encodeAsList() as AnyObject }
211211

212212
switch type {
213213
case .transaction:
214-
fields = [chainID, nonce, gasPrice, gasLimit, to.addressData, value, data, list, v, r, s] as [AnyObject]
214+
fields = [chainID, nonce, gasPrice, gasLimit, to.addressData, value, data, list, v, r, s]
215215
case .signature:
216-
fields = [chainID, nonce, gasPrice, gasLimit, to.addressData, value, data, list] as [AnyObject]
216+
fields = [chainID, nonce, gasPrice, gasLimit, to.addressData, value, data, list]
217217
}
218218
guard var result = RLP.encode(fields) else { return nil }
219219
result.insert(UInt8(self.type.rawValue), at: 0)

Sources/Web3Core/Transaction/Envelope/LegacyEnvelope.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ extension LegacyEnvelope {
192192
// }
193193

194194
public func encode(for type: EncodeType = .transaction) -> Data? {
195-
let fields: [AnyObject]
195+
let fields: [Any?]
196196
switch type {
197197
case .transaction:
198-
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data, v, r, s] as [AnyObject]
198+
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data, v, r, s]
199199
case .signature:
200200
if let chainID = chainID, chainID != 0 {
201-
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data, chainID, BigUInt(0), BigUInt(0)] as [AnyObject]
201+
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data, chainID, BigUInt(0), BigUInt(0)]
202202
} else {
203-
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data] as [AnyObject]
203+
fields = [nonce, gasPrice, gasLimit, to.addressData, value, data]
204204
}
205205
}
206206
return RLP.encode(fields)

0 commit comments

Comments
 (0)