(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l["gecko-sdk"]={}))})(this,function(l){"use strict";class i{constructor(t){this.status=t.status.toString(),this.title=t.statusText.toString()}}class a{constructor(){this.baseUrl="https://api.geckoterminal.com/api/v2"}async getSimple(t,e){return this.get(`/simple/networks/${t}/token_price/${e}`)}getNetworks(t=1){return this.get("/networks")}getDexes(t,e=1){return this.get(`/networks/${t}/dexes?page=${e}`)}getTrendingPools(t=null,e=1){const r=`/networks/trending_pools${this.getQueryString(t)}`;return this.get(r)}getTrendingPoolsOnNetwork(t,e=1,r=null){const n=`/networks/${t}/trending_pools${this.getQueryString(r)}`;return this.get(n)}getSpecificPool(t,e,r=null){const n=`/networks/${t}/pools/${e}${this.getQueryString(r)}`;return this.get(n)}getMultiplePoolsOnNetwork(t,e,r=null){const n=`/networks/${t}/pools/multi/${e}${this.getQueryString(r)}`;return this.get(n)}getTopPools(t,e=1,r=null,n="h24_tx_count_desc"){const s=`/networks/${t}/pools${this.getQueryStringWithPageAndPoolSort(e,n,r)}`;return this.get(s)}getTopPoolsOnNetworkDex(t,e,r=1,n=null,s="h24_tx_count_desc"){const u=`/networks/${t}/dexes/${e}/pools${this.getQueryStringWithPageAndPoolSort(r,s,n)}`;return this.get(u)}getNewPoolsOnNetwork(t,e=1,r=null){const n=`/networks/${t}/new_pools${this.getQueryStingWithPage(e,r)}`;return this.get(n)}getNewPools(t=1,e=null){const r=`/networks/new_pools${this.getQueryStingWithPage(t,e)}`;return this.get(r)}searchForPoolsOnNetwork(t,e=null,r=1,n=null){const s=`/search/pools${this.getQuerySearch(t,r,e,n)}`;return this.get(s)}getTopPoolsForToken(t,e,r=1,n=null,s="h24_tx_count_desc"){const u=`/networks/${t}/tokens/${e}/pools${this.getQueryStringWithPageAndTokenSort(r,s,n)}`;return this.get(u)}getSpecificTokenOnNetwork(t,e,r=null){const n=`/networks/${t}/tokens/${e}${this.getQueryString(r)}`;return this.get(n)}getMultipleTokensOnNetwork(t,e,r=null){const n=`/networks/${t}/tokens/multi/${e}${this.getQueryString(r)}`;return this.get(n)}getSpecificTokenInfo(t,e){const r=`/networks/${t}/tokens/${e}/info`;return this.get(r)}getPoolTokenInfo(t,e){const r=`/networks/${t}/pools/${e}/info`;return this.get(r)}getRecentlyUpdatedTokens(t=null){const e=`/tokens/info_recently_updated${this.getQueryString(t)}`;return this.get(e)}getOhlcvs(t,e,r="hour",n="1",s=null,u="100",g="token",k=""){const d=`/networks/${t}/pools/${e}/ohlcv/${r}?${this.getQueryStringOHLCVS(n,s,u,g,k)}`;return this.get(d)}getQuerySearch(t,e=1,r=null,n=null){return r=r?`&network=${r}`:"",n=n?`&include=${n}`:"",`?query=${t}${r}${n}&page=${e}`}getQueryStringOHLCVS(t="0",e=null,r="100",n="token",s=""){let u=e?`&before_timestamp=${e}`:"",g=s?`&token=${s}`:"";return`aggregate=${t}${u}&limit=${r}¤cy=${n}${g}`}getQueryStingWithPage(t=1,e=null){return e?this.getQueryString(e)+`&page=${t}`:`?page=${t}`}getQueryStringWithPageAndPoolSort(t=1,e="h24_tx_count_desc",r=null){return r?this.getQueryString(r)+`&page=${t}&sort=${e}`:`?page=${t}&sort=${e.toString()}`}getQueryStringWithPageAndTokenSort(t=1,e="h24_tx_count_desc",r=null){return r?this.getQueryString(r)+`&page=${t}&sort=${e}`:`?page=${t}&sort=${e.toString()}`}getQueryString(t){if(!t)return"";const e={};typeof t=="string"?e.include=t:Array.isArray(t)?e.include=t.join(","):e.include="";const r=new URLSearchParams(e).toString();return r?`?${r}`:""}async get(t,e){console.log(this.baseUrl+t);const r=await fetch(this.baseUrl+t,e);if(!r.ok)throw new i(r);return r.json()}}var h=(o=>(o.h24_tx_count_desc="h24_tx_count_desc",o.h24_volume_usd_desc="h24_volume_usd_desc",o))(h||{}),c=(o=>(o.h24_volume_usd_liquidity_desc="h24_volume_usd_liquidity_desc",o.h24_tx_count_desc="h24_tx_count_desc",o.h24_volume_usd_desc="h24_volume_usd_desc",o))(c||{}),$=(o=>(o.day="day",o.hour="hour",o.minute="minute",o))($||{}),_=(o=>(o.token="token",o.usd="usd",o))(_||{});l.Currency=_,l.GeckoTerminalApi=a,l.GeckoTerminalError=i,l.PoolSortOptions=h,l.TimeFrame=$,l.TokenSortOptions=c,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=index.umd.cjs.map