mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
81 lines
4.1 KiB
Swift
81 lines
4.1 KiB
Swift
//
|
|
// Market.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Market: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Amm reports whether an automated market maker is deployed on this chain, which is the registry's factory addresses being present and not the indexer having rows. The two disagree in exactly the interesting case: a chain with a factory and nothing traded yet is a live venue with no history, and a chain with neither has no venue at all. */
|
|
public var amm: Bool?
|
|
public var coin: String?
|
|
public var day: Day?
|
|
/** Factory is the AMM's factory contracts, by generation, omitted where none is deployed. Addresses come from the registry because that is what the indexer itself ingested from; anything else is a second copy free to drift. */
|
|
public var factory: [String: String]?
|
|
/** Figures is the chain's whole market maker, and Day its most recent active one. Both are absent unless Reach says Read, so a caller cannot mistake a zero this process never received for one the indexer computed. Day is also absent on a chain that has never traded — which reach reports as Read, so the two absences are told apart by the state beside them and never by the gap itself. */
|
|
public var figures: Figures?
|
|
/** Graph is where this chain's indexer answers, empty where it has none. */
|
|
public var graph: String?
|
|
/** ID is the EVM chain id, which is what a wallet must agree with. */
|
|
public var id: Int64?
|
|
public var name: String?
|
|
/** Reach is how far the read of this chain's FIGURES got — its own, so one indexer being down describes one row and leaves the others to answer. */
|
|
public var reach: Reach?
|
|
/** RPC is the chain's PUBLIC JSON-RPC, empty where the registry names only a route this process happens to have. The registry's own `rpc` field is the INDEXER's route to the node and is sometimes inside its cluster — plain HTTP on a `.svc.cluster.local` name — which is reachable from the indexer, from nothing else, and from no browser. Publishing that as the chain's endpoint hands every caller an address that cannot answer them. See [endpoint]. */
|
|
public var rpc: String?
|
|
/** Slug is the chain's word in every indexer path — `cchain`, `zoo`. It is the value a caller passes back as `chain`, and it is NOT the chain id: `96369`, `C` and `c-chain` all answer 404 in that position. */
|
|
public var slug: String?
|
|
|
|
public init(amm: Bool? = nil, coin: String? = nil, day: Day? = nil, factory: [String: String]? = nil, figures: Figures? = nil, graph: String? = nil, id: Int64? = nil, name: String? = nil, reach: Reach? = nil, rpc: String? = nil, slug: String? = nil) {
|
|
self.amm = amm
|
|
self.coin = coin
|
|
self.day = day
|
|
self.factory = factory
|
|
self.figures = figures
|
|
self.graph = graph
|
|
self.id = id
|
|
self.name = name
|
|
self.reach = reach
|
|
self.rpc = rpc
|
|
self.slug = slug
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case amm
|
|
case coin
|
|
case day
|
|
case factory
|
|
case figures
|
|
case graph
|
|
case id
|
|
case name
|
|
case reach
|
|
case rpc
|
|
case slug
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(amm, forKey: .amm)
|
|
try container.encodeIfPresent(coin, forKey: .coin)
|
|
try container.encodeIfPresent(day, forKey: .day)
|
|
try container.encodeIfPresent(factory, forKey: .factory)
|
|
try container.encodeIfPresent(figures, forKey: .figures)
|
|
try container.encodeIfPresent(graph, forKey: .graph)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(name, forKey: .name)
|
|
try container.encodeIfPresent(reach, forKey: .reach)
|
|
try container.encodeIfPresent(rpc, forKey: .rpc)
|
|
try container.encodeIfPresent(slug, forKey: .slug)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension Market: Identifiable {}
|