Files
zeekay 0c2f028a8c Generate the Swift client, which this copy did not carry
The forge tree held the package scaffolding and none of the generated sources —
2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply
absent, so anything depending on this copy had a package that compiled to
nothing usable.

Generated from the current API document rather than reconciled with the other
copy: a client is a function of the spec, so regenerating answers "which history
wins" without anyone having to choose. .spec-lock records which document, so the
next reader can tell.
2026-08-23 10:04:41 -07:00

190 lines
11 KiB
Swift

//
// Web3API.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class Web3API {
/**
Reports the chains this deployment can reach.
- parameter apiConfiguration: The configuration for the http request.
- returns: ChainList
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getWeb3Chains(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ChainList {
return try await getWeb3ChainsWithRequestBuilder(apiConfiguration: apiConfiguration).execute().body
}
/**
Reports the chains this deployment can reach.
- GET /v1/web3/chains
- Reports the chains this deployment can reach. The list is the declared registry, so it is exactly what /v1/web3/rpc will accept — a chain that appears here is one this deployment actually has an upstream for.
- Bearer Token:
- type: http
- name: bearer
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<ChainList>
*/
open class func getWeb3ChainsWithRequestBuilder(apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ChainList> {
let localVariablePath = "/v1/web3/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<ChainList>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Reports one chain and whether its upstream is answering.
- parameter chain: (path) Chain is the registry id, as in /v1/web3/chains/lux.
- parameter apiConfiguration: The configuration for the http request.
- returns: ChainStatus
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getWeb3ChainsByChain(chain: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> ChainStatus {
return try await getWeb3ChainsByChainWithRequestBuilder(chain: chain, apiConfiguration: apiConfiguration).execute().body
}
/**
Reports one chain and whether its upstream is answering.
- GET /v1/web3/chains/{chain}
- Reports one chain and whether its upstream is answering. An unreachable chain is still a 200 with live:false — the chain is configured, which is a different fact from the chain being up, and a 502 here would make a console page error rather than show the outage.
- Bearer Token:
- type: http
- name: bearer
- parameter chain: (path) Chain is the registry id, as in /v1/web3/chains/lux.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<ChainStatus>
*/
open class func getWeb3ChainsByChainWithRequestBuilder(chain: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<ChainStatus> {
var localVariablePath = "/v1/web3/chains/{chain}"
let chainPreEscape = "\(APIHelper.mapValueToPathItem(chain))"
let chainPostEscape = chainPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{chain}", with: chainPostEscape, options: .literal, range: nil)
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<ChainStatus>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Reads an address's native balance on a chain.
- parameter chain: (path) Chain is the registry id.
- parameter address: (path) Address is the account, 0x-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: Balances
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getWeb3TokensByChainByAddress(chain: String, address: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> Balances {
return try await getWeb3TokensByChainByAddressWithRequestBuilder(chain: chain, address: address, apiConfiguration: apiConfiguration).execute().body
}
/**
Reads an address's native balance on a chain.
- GET /v1/web3/tokens/{chain}/{address}
- Reads an address's native balance on a chain. ERC-20 positions are NOT enumerated here: eth_getBalance answers the native one, but \"every token this address holds\" is an indexer question — there is no RPC call that answers it, and walking a token list would return a number that silently omits whatever the list missed. explorer owns the indexer relationship; this returns the balance the chain itself can prove.
- Bearer Token:
- type: http
- name: bearer
- parameter chain: (path) Chain is the registry id.
- parameter address: (path) Address is the account, 0x-prefixed.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Balances>
*/
open class func getWeb3TokensByChainByAddressWithRequestBuilder(chain: String, address: String, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<Balances> {
var localVariablePath = "/v1/web3/tokens/{chain}/{address}"
let chainPreEscape = "\(APIHelper.mapValueToPathItem(chain))"
let chainPostEscape = chainPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{chain}", with: chainPostEscape, options: .literal, range: nil)
let addressPreEscape = "\(APIHelper.mapValueToPathItem(address))"
let addressPostEscape = addressPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{address}", with: addressPostEscape, options: .literal, range: nil)
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<Balances>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Forwards a JSON-RPC call to the named chain and returns its answer unchanged.
- parameter chain: (path) Chain is the registry id, from the URL.
- parameter rpcIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RpcOut
*/
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func postWeb3RpcByChain(chain: String, rpcIn: RpcIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) async throws(ErrorResponse) -> RpcOut {
return try await postWeb3RpcByChainWithRequestBuilder(chain: chain, rpcIn: rpcIn, apiConfiguration: apiConfiguration).execute().body
}
/**
Forwards a JSON-RPC call to the named chain and returns its answer unchanged.
- POST /v1/web3/rpc/{chain}
- Forwards a JSON-RPC call to the named chain and returns its answer unchanged. Only declared chains are reachable, and only to a caller with a validated principal — this is the deployment's upstream, not an open relay.
- Bearer Token:
- type: http
- name: bearer
- parameter chain: (path) Chain is the registry id, from the URL.
- parameter rpcIn: (body)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<RpcOut>
*/
open class func postWeb3RpcByChainWithRequestBuilder(chain: String, rpcIn: RpcIn, apiConfiguration: HanzoAPIConfiguration = HanzoAPIConfiguration.shared) -> RequestBuilder<RpcOut> {
var localVariablePath = "/v1/web3/rpc/{chain}"
let chainPreEscape = "\(APIHelper.mapValueToPathItem(chain))"
let chainPostEscape = chainPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{chain}", with: chainPostEscape, options: .literal, range: nil)
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: rpcIn, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<RpcOut>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}