DipDupClient
public class DipDupClient
This client exposes functions to allow communication to the indexer platform DipDup ( https://dipdup.net/ ). DipDup is composed of many small, dedicated indexers, powered by GraphQL. This client tries to exposes userflow functions, allowing users to accomplish tasks without having to worry about the underlying complexities
-
Max enteries to return per request
Declaration
Swift
public static let dexMaxQuerySize: Int
-
Init a
DipDupClient
with aNetworkService
and aTezosNodeClientConfig
.Declaration
Swift
public init(networkService: NetworkService, config: TezosNodeClientConfig)
Parameters
networkService
NetworkService
used to manage network communication.config
TezosNodeClientConfig
used to apss in settings.
-
Get a list of all the tokens available and on what excahnges (including their prices and pool data)
Declaration
Swift
public func getExchangesAndTokens(limit: Int = DipDupClient.dexMaxQuerySize, offset: Int = 0, completion: @escaping ((Result<GraphQLResponse<DipDupExchangesAndTokensResponse>, KukaiError>) -> Void))
Parameters
limit
Int, How many results to reuturn 100 Max)
offset
Int, How many positions to move the cursor
completion
Block returning a GraphQL response or an KukaiError
-
Recurrsively call
getExchangesAndTokens(...)
until we have found all the tokensDeclaration
Swift
public func getAllExchangesAndTokens(completion: @escaping ((Result<[DipDupExchangesAndTokens], KukaiError>) -> Void))
Parameters
completion
Block returning a GraphQL response or an KukaiError
-
Query a given addresses liquidity token balances
Declaration
Swift
public func getLiquidityFor(address: String, completion: @escaping ((Result<GraphQLResponse<DipDupPosition>, KukaiError>) -> Void))
Parameters
address
The TZ address to query for
completion
Block returning a GraphQL response or an KukaiError
-
Query a given contract address for pricing data for the given token
Declaration
Swift
public func getChartDataFor(exchangeContract: String, nowDate: Date = Date(), completion: @escaping ((Result<GraphQLResponse<DipDupChartData>, KukaiError>) -> Void))
Parameters
exchangeContract
The KT address of the dex contract to query data for
completion
Block returning a GraphQL response or an KukaiError