Prices (#15)
* add conveyor price info * remove comment * correct getPrices response type and add test stub * run swift format * fixup integration test for getPrices endpoint * CI kick
This commit is contained in:
parent
2819c3c9df
commit
8619f66130
|
@ -61,6 +61,18 @@ public struct API {
|
|||
public init() {}
|
||||
}
|
||||
|
||||
public struct SteemPrices: Decodable {
|
||||
public let steemSbd: Float32
|
||||
public let steemUsd: Float32
|
||||
public let steemVest: Float32
|
||||
}
|
||||
|
||||
public struct GetPrices: Request {
|
||||
public typealias Response = SteemPrices
|
||||
public let method = "conveyor.get_prices"
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct FeedHistory: Decodable {
|
||||
public let currentMedianHistory: Price
|
||||
public let priceHistory: [Price]
|
||||
|
|
|
@ -105,6 +105,7 @@ public struct Price: Equatable, SteemEncodable, Decodable {
|
|||
throw PriceError.cannotConvert(asset: asset, usingPrice: self)
|
||||
}
|
||||
}
|
||||
|
||||
public init(base: Asset, quote: Asset) {
|
||||
self.base = base
|
||||
self.quote = quote
|
||||
|
|
|
@ -81,6 +81,22 @@ class ClientTest: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
func testGetPrices() {
|
||||
let test = expectation(description: "Response")
|
||||
let req = API.GetPrices()
|
||||
client.send(req) { res, error in
|
||||
XCTAssertNil(error)
|
||||
XCTAssertNotNil(res)
|
||||
test.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if let error = error {
|
||||
print("Error: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testGetBlock() {
|
||||
let test = expectation(description: "Response")
|
||||
let req = API.GetBlock(blockNum: 12_345_678)
|
||||
|
|
Loading…
Reference in New Issue