cURL
curl --request GET \ --url https://public-beam-backend-mainnet.codemelt.codes/api/algebra/pool/all/{networkName}
{ "message": "<string>", "data": "<unknown>", "status": "<unknown>" }
import api, { IConnection } from "codemelt-retro-api-sdk" const connection: IConnection = { host: '<enter you host url here>', headers: { 'x-api-key': '<enter your api key here>' } } const networkName = "Zeta Mainnet" const pools = await api.functional.api.algebra.pool.all.getAllPools( connection, networkName )
import api, { IConnection } from "codemelt-retro-api-sdk" import { AlgebraPoolDTO } from 'codemelt-retro-api-sdk/structures/AlgebraPoolDTO' class PoolDataManager { private connection: IConnection //always use the sdk types //if possible do not override them with custom types private poolData: Array<AlgebraPoolDTO> private abortController: AbortController | null = null constructor(apiKey: string, host: string) { this.connection = { host, headers: { 'x-api-key': apiKey } } } startPolling() { this.abortController = new AbortController() const poll = async () => { try { const networkName = "Zeta Mainnet" const response = await api.functional.api.liquidity.pools.getAll(this.connection, networkName) if(response.success && response.data.status){ this.poolData = response.data.data } if (!this.abortController?.signal.aborted) { setTimeout(poll, 5000) } } catch (err) { if (!this.abortController?.signal.aborted) { setTimeout(poll, 5000) } } } poll() } stopPolling() { this.abortController?.abort() this.abortController = null } getPoolData(poolId: string): PoolData | undefined { return this.poolData.get(poolId) } }