|
|
@ -21,7 +21,7 @@ import BigInt |
|
|
|
public class OrdersRequest { |
|
|
|
public class OrdersRequest { |
|
|
|
|
|
|
|
|
|
|
|
public let baseURL = "https://482kdh4npg.execute-api.ap-southeast-1.amazonaws.com/dev/" |
|
|
|
public let baseURL = "https://482kdh4npg.execute-api.ap-southeast-1.amazonaws.com/dev/" |
|
|
|
public let contractAddress = "0xacDe9017473D7dC82ACFd0da601E4de291a7d6b0" |
|
|
|
public let contractAddress = "bC9a1026A4BC6F0BA8Bbe486d1D09dA5732B39e4".lowercased() |
|
|
|
|
|
|
|
|
|
|
|
public func getOrders(callback: @escaping (_ result : Any) -> Void) { |
|
|
|
public func getOrders(callback: @escaping (_ result : Any) -> Void) { |
|
|
|
Alamofire.request(baseURL + "contract/" + contractAddress, method: .get).responseJSON { |
|
|
|
Alamofire.request(baseURL + "contract/" + contractAddress, method: .get).responseJSON { |
|
|
@ -31,6 +31,11 @@ public class OrdersRequest { |
|
|
|
let parsedJSON = try! JSON(data: response.data!) |
|
|
|
let parsedJSON = try! JSON(data: response.data!) |
|
|
|
for i in 0...parsedJSON.count - 1 { |
|
|
|
for i in 0...parsedJSON.count - 1 { |
|
|
|
let orderObj: JSON = parsedJSON["orders"][i] |
|
|
|
let orderObj: JSON = parsedJSON["orders"][i] |
|
|
|
|
|
|
|
if(orderObj == nil) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
callback("no orders") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
orders.append(self.parseOrder(orderObj)) |
|
|
|
orders.append(self.parseOrder(orderObj)) |
|
|
|
} |
|
|
|
} |
|
|
|
callback(orders) |
|
|
|
callback(orders) |
|
|
|