Skip to content

Commit ed43d2d

Browse files
fix: RLP func encode for single value has named parameter
It fixes the issue when trying to call func element() with [Any].
1 parent 2bd3303 commit ed43d2d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Sources/Web3Core/RLP/RLP.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ public struct RLP {
1818
static var length56 = BigUInt(UInt(56))
1919
static var lengthMax = (BigUInt(UInt(1)) << 256)
2020

21-
internal static func encode(_ element: Any?) -> Data? {
21+
internal static func encode(element: Any?) -> Data? {
2222
if let string = element as? String {
2323
return encode(string)
24-
2524
} else if let data = element as? Data {
2625
return encode(data)
2726
} else if let biguint = element as? BigUInt {
@@ -115,7 +114,7 @@ public struct RLP {
115114
internal static func encode(_ elements: [Any?]) -> Data? {
116115
var encodedData = Data()
117116
for e in elements {
118-
if let encoded = encode(e) {
117+
if let encoded = encode(element: e) {
119118
encodedData.append(encoded)
120119
} else {
121120
guard let asArray = e as? [Any] else {return nil}

Tests/web3swiftTests/localTests/TransactionsTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ class TransactionsTests: XCTestCase {
471471
// check that we recovered the address correctly
472472
XCTAssertEqual(jsonTxn.sender!.address, expectedAddress.address, "Recovered Address Mismatch")
473473
} catch {
474-
475474
return XCTFail(String(describing: error))
476475
}
477476
}

0 commit comments

Comments
 (0)