Skip to content

Commit cde0ceb

Browse files
authored
Merge pull request #281 from matter-labs/master
Master
2 parents f2756ac + 84c9250 commit cde0ceb

File tree

10 files changed

+39
-50
lines changed

10 files changed

+39
-50
lines changed

Example/web3swiftBrowser/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 17 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let package = Package(
1010
.library(name: "web3swift", targets: ["web3swift"]),
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.0"),
13+
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.0.0"),
1414
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.8.4"),
1515
.package(url: "https://github.com/daltoniam/Starscream.git", from: "3.1.0"),
1616
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.0.0"),

Sources/web3swift/Browser/Bridge.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright © 2017 Samaritan. All rights reserved.
77
//
88

9-
import UIKit
109
import WebKit
1110

1211
/// Bridge for WKWebView and JavaScript
@@ -197,7 +196,7 @@ public extension WKWebView {
197196
}
198197

199198
/// Bridge for WKWebView and JavaScript. Initialize `lazy`
200-
public var bridge: Bridge {
199+
var bridge: Bridge {
201200
if let bridge = objc_getAssociatedObject(self, &STPrivateStatic.bridgeKey) as? Bridge {
202201
return bridge
203202
}
@@ -207,7 +206,7 @@ public extension WKWebView {
207206
}
208207

209208
/// Remove Bridge And Reset, All the handlers will be removed
210-
public func removeBridge() {
209+
func removeBridge() {
211210
if let bridge = objc_getAssociatedObject(self, &STPrivateStatic.bridgeKey) as? Bridge {
212211
let userContentController = bridge.configuration.userContentController
213212
userContentController.removeScriptMessageHandler(forName: Bridge.name)
@@ -218,7 +217,7 @@ public extension WKWebView {
218217

219218
fileprivate extension WKWebView {
220219

221-
fileprivate func st_dispatchBridgeEvent(_ eventName: String,
220+
func st_dispatchBridgeEvent(_ eventName: String,
222221
parameters: [String: Any],
223222
results: Bridge.Results,
224223
completionHandler: ((Any?, Error?) -> Void)? = nil) {

Sources/web3swift/Browser/BrowserViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright © 2020 Matter Labs. All rights reserved.
77
//
88

9-
import UIKit
109
import WebKit
1110

1211
open class BrowserViewController: UIViewController {

Sources/web3swift/SwiftRLP/RLP.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public struct RLP {
193193
return false
194194
case .data(_):
195195
return true
196-
case .list(_):
196+
case .list(_, _, _):
197197
return false
198198
}
199199
}
@@ -204,7 +204,7 @@ public struct RLP {
204204
return false
205205
case .data(_):
206206
return false
207-
case .list(_):
207+
case .list(_,_,_):
208208
return true
209209
}
210210
}

Sources/web3swift/Transaction/BloomFilter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extension EthereumBloomFilter {
3232
}
3333

3434
static func bloom9(_ data: Data) -> BigUInt {
35-
var b = data.sha3(.keccak256)
35+
let b = data.sha3(.keccak256)
3636
var r = BigUInt(0)
3737
let mask = BigUInt(2047)
3838
for i in stride(from: 0, to: 6, by: 2) {

Sources/web3swift/Transaction/EthereumTransaction.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public struct EthereumTransaction: CustomStringConvertible {
1717
// The destination address of the message, left undefined for a contract-creation transaction.
1818
public var to: EthereumAddress
1919
// (optional) The value transferred for the transaction in wei, also the endowment if it’s a contract-creation transaction.
20+
// TODO - split EthereumTransaction to two classes: with optional and required value property, depends on type of transaction
2021
public var value: BigUInt?
2122
public var data: Data
2223
public var v: BigUInt = BigUInt(1)
@@ -165,18 +166,18 @@ public struct EthereumTransaction: CustomStringConvertible {
165166
public func encode(forSignature:Bool = false, chainID: BigUInt? = nil) -> Data? {
166167
if (forSignature) {
167168
if chainID != nil {
168-
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value, self.data, chainID!, BigUInt(0), BigUInt(0)] as [AnyObject]
169+
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value!, self.data, chainID!, BigUInt(0), BigUInt(0)] as [AnyObject]
169170
return RLP.encode(fields)
170171
}
171172
else if self.chainID != nil {
172-
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value, self.data, self.chainID!, BigUInt(0), BigUInt(0)] as [AnyObject]
173+
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value!, self.data, self.chainID!, BigUInt(0), BigUInt(0)] as [AnyObject]
173174
return RLP.encode(fields)
174175
} else {
175-
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value, self.data] as [AnyObject]
176+
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value!, self.data] as [AnyObject]
176177
return RLP.encode(fields)
177178
}
178179
} else {
179-
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value, self.data, self.v, self.r, self.s] as [AnyObject]
180+
let fields = [self.nonce, self.gasPrice, self.gasLimit, self.to.addressData, self.value!, self.data, self.v, self.r, self.s] as [AnyObject]
180181
return RLP.encode(fields)
181182
}
182183
}

0 commit comments

Comments
 (0)