mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The lock sat at 574d1f1d while the product moved on. The team surface stopped at rooms — no messages path, no way to open one — so anything built on this client had to reach past it with its own HTTP calls, which is the duplication a generated client exists to prevent.
215 lines
15 KiB
Swift
215 lines
15 KiB
Swift
//
|
|
// MarketAPI.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
open class MarketAPI {
|
|
|
|
/**
|
|
Answers every chain this deployment can read, what is deployed on each, and what its automated market maker amounts to.
|
|
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Roster
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getMarketChains(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Roster {
|
|
return try await getMarketChainsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Answers every chain this deployment can read, what is deployed on each, and what its automated market maker amounts to.
|
|
- GET /v1/market/chains
|
|
- Answers every chain this deployment can read, what is deployed on each, and what its automated market maker amounts to. One call. It reads the chain registry, then every chain's indexer for its figures and its most recent active day, all at once — where a client doing it itself makes one registry request and two more per chain. THE ROW IS THE UNIT OF TRUTH. Each carries its own reach, so one indexer being unreachable costs one row its figures and leaves the rest answered. A chain with no market maker deployed — the registry names no factory for it — answers `read` with totals of nothing, which is a fact about that chain and is not the same as a chain nobody could ask.
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Roster>
|
|
*/
|
|
open class func getMarketChainsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Roster> {
|
|
let localVariablePath = "/v1/market/chains"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<Roster>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Answers the automated market makers on one chain: their two tokens, their fee tier, and what has moved through each.
|
|
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Pools
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getMarketPools(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Pools {
|
|
return try await getMarketPoolsWithRequestBuilder(chain: chain, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Answers the automated market makers on one chain: their two tokens, their fee tier, and what has moved through each.
|
|
- GET /v1/market/pools
|
|
- Answers the automated market makers on one chain: their two tokens, their fee tier, and what has moved through each. The two price fields on a pool are the ratio its own reserves stand at, as the indexer computed them. They are not a price ON either token and not a mark: nothing here derives one, ranks the pools, or names a route through them. A chain with no market maker deployed answers `read` with no pools. That is the chain's real condition, and it is deliberately not the same answer as an indexer that could not be asked.
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Pools>
|
|
*/
|
|
open class func getMarketPoolsWithRequestBuilder(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Pools> {
|
|
let localVariablePath = "/v1/market/pools"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"chain": (wrappedValue: chain?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<Pools>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Answers which of the four settlement precompiles carry code on one chain.
|
|
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Survey
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getMarketSurvey(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Survey {
|
|
return try await getMarketSurveyWithRequestBuilder(chain: chain, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Answers which of the four settlement precompiles carry code on one chain.
|
|
- GET /v1/market/survey
|
|
- Answers which of the four settlement precompiles carry code on one chain. An address with no code answers a call with empty data rather than an error, so \"this chain has no view precompile\" and \"this market was never opened\" reach a caller as the same silence — and only the second is a fact about a market. This says which it is, by asking the node for the code at each address. It reads presence and nothing else. No market, no quote, no depth and no order is requested here, and `eth_getCode` is the only method this operation ever sends.
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Survey>
|
|
*/
|
|
open class func getMarketSurveyWithRequestBuilder(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Survey> {
|
|
let localVariablePath = "/v1/market/survey"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"chain": (wrappedValue: chain?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<Survey>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Answers one token's daily history — open, high, low, close, price and volume per UTC day, oldest first.
|
|
|
|
- parameter chain: (query) (optional)
|
|
- parameter at: (query) At is the token's contract address. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: History
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getMarketToken(chain: String? = nil, at: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> History {
|
|
return try await getMarketTokenWithRequestBuilder(chain: chain, at: at, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Answers one token's daily history — open, high, low, close, price and volume per UTC day, oldest first.
|
|
- GET /v1/market/token
|
|
- Answers one token's daily history — open, high, low, close, price and volume per UTC day, oldest first. Every figure is the indexer's own arithmetic, passed through as the decimal string it computed. Nothing here rounds one, converts one, or fills a gap: a day the indexer holds no figure for arrives with that field absent, which says \"not indexed\" where a zero would say \"worth nothing\".
|
|
- parameter chain: (query) (optional)
|
|
- parameter at: (query) At is the token's contract address. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<History>
|
|
*/
|
|
open class func getMarketTokenWithRequestBuilder(chain: String? = nil, at: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<History> {
|
|
let localVariablePath = "/v1/market/token"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"chain": (wrappedValue: chain?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
"at": (wrappedValue: at?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<History>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration)
|
|
}
|
|
|
|
/**
|
|
Answers the tokens one chain's indexer has seen, with the decimals a caller needs to read any amount of one correctly.
|
|
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: Tokens
|
|
*/
|
|
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
open class func getMarketTokens(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Tokens {
|
|
return try await getMarketTokensWithRequestBuilder(chain: chain, apiConfiguration: apiConfiguration).execute().body
|
|
}
|
|
|
|
/**
|
|
Answers the tokens one chain's indexer has seen, with the decimals a caller needs to read any amount of one correctly.
|
|
- GET /v1/market/tokens
|
|
- Answers the tokens one chain's indexer has seen, with the decimals a caller needs to read any amount of one correctly. This is what the indexer INGESTED, which is not the same as what exists on the chain: a token nothing has traded has no row here, and this is not a registry of what is permitted or listed.
|
|
- parameter chain: (query) Chain is the chain's slug — `cchain`, `zoo` — as `chains` reports it. It is the indexer's word for the chain and NOT the chain id: `96369`, `C` and `c-chain` all name nothing. (optional)
|
|
- parameter apiConfiguration: The configuration for the http request.
|
|
- returns: RequestBuilder<Tokens>
|
|
*/
|
|
open class func getMarketTokensWithRequestBuilder(chain: String? = nil, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Tokens> {
|
|
let localVariablePath = "/v1/market/tokens"
|
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
|
let localVariableParameters: [String: any Sendable]? = nil
|
|
|
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
|
"chain": (wrappedValue: chain?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
|
|
])
|
|
|
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
|
:
|
|
]
|
|
|
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
|
|
|
let localVariableRequestBuilder: RequestBuilder<Tokens>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
|
|
|
|
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: false, apiConfiguration: apiConfiguration)
|
|
}
|
|
}
|