@avalabs/core-coingecko-sdk 3.1.0-alpha.8 → 3.1.0-alpha.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +7 -6
- package/esm/http.d.ts +5 -5
- package/esm/http.js +1 -1
- package/esm/models.d.ts +2 -1
- package/package.json +14 -5
- package/dist/index.js +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@avalabs/core-utils-sdk");function t(e){return e?{x_cg_pro_api_key:e}:{}}var r=(e=>(e.AED="aed",e.ARS="ars",e.AUD="aud",e.BCH="bch",e.BDT="bdt",e.BHD="bhd",e.BMD="bmd",e.BNB="bnb",e.BRL="brl",e.BTC="btc",e.CAD="cad",e.CHF="chf",e.CLP="clp",e.CNY="cny",e.CZK="czk",e.DKK="dkk",e.DOT="dot",e.EOS="eos",e.ETH="eth",e.EUR="eur",e.GBP="gbp",e.HKD="hkd",e.HUF="huf",e.IDR="idr",e.ILS="ils",e.INR="inr",e.JPY="jpy",e.KRW="krw",e.KWD="kwd",e.LKR="lkr",e.LTC="ltc",e.MMK="mmk",e.MXN="mxn",e.MYR="myr",e.NGN="ngn",e.NOK="nok",e.NZD="nzd",e.PHP="php",e.PKR="pkr",e.PLN="pln",e.RUB="rub",e.SAR="sar",e.SEK="sek",e.SGD="sgd",e.THB="thb",e.TRY="try",e.TWD="twd",e.UAH="uah",e.USD="usd",e.VEF="vef",e.VND="vnd",e.XAG="xag",e.XAU="xau",e.XDR="xdr",e.XLM="xlm",e.XRP="xrp",e.YFI="yfi",e.ZAR="zar",e.BITS="bits",e.LINK="link",e.SATS="sats",e))(r||{});const n="https://api.coingecko.com/api/v3",o="https://pro-api.coingecko.com/api/v3",a="https://proxy-api-dev.avax.network",c="https://proxy-api.avax.network",s=`${c}/proxy/coingecko`,i=`${a}/proxy/coingecko`;function p(t=n,r={},o){return new e.HttpClient(t,r,o)}exports.COINGECKO_PROXY_URL=s,exports.COINGECKO_PRO_URL=o,exports.COINGECKO_URL=n,exports.DEV_COINGECKO_PROXY_URL=i,exports.DEV_PROXY_API_WORKER_URL=a,exports.PROXY_API_WORKER_URL=c,exports.VsCurrencyType=r,exports.coinsContractInfo=async function(e,{assetPlatformId:r,address:n,coinGeckoProApiKey:o}){const a=new URLSearchParams({...t(o)});return await e.get(`/coins/${r}/contract/${n}?${a.toString()}`)},exports.coinsContractMarketChart=async function(e,{assetPlatformId:n,address:o,currency:a=r.USD,days:c=7,coinGeckoProApiKey:s}){const i=new URLSearchParams({vs_currency:a,days:c.toString(),...t(s)}),p=await e.get(`/coins/${n}/contract/${o}/market_chart/?${i.toString()}`);return{prices:p.prices,marketCaps:p.market_caps,totalVolumes:p.total_volumes}},exports.coinsContractMarketChartRange=async function(e,{assetPlatformId:n,address:o,from:a,to:c,currency:s=r.USD,coinGeckoProApiKey:i}){const p=new URLSearchParams({vs_currency:s,from:a.toString(),to:c.toString(),...t(i)}),u=await e.get(`/coins/${n}/contract/${o}/market_chart/range?${p.toString()}`);return{prices:u.prices,marketCaps:u.market_caps,totalVolumes:u.total_volumes}},exports.coinsInfo=async function(e,{coinId:r,coinGeckoProApiKey:n}){const o=new URLSearchParams({...t(n)});return await e.get(`/coins/${r}?${o.toString()}`)},exports.coinsMarket=async function(e,{coinIds:n,currency:o=r.USD,sparkline:a=!1,page:c,perPage:s,order:i,priceChangePercentage:p,coinGeckoProApiKey:u}){const d=new URLSearchParams({vs_currency:o,...t(u)});return n&&d.append("ids",n.join(",")),i&&d.append("order",i),p&&d.append("price_change_percentage",p),a&&d.append("sparkline","true"),s&&d.append("per_page",s.toString()),c&&d.append("page",c.toString()),await e.get(`/coins/markets?${d.toString()}`)},exports.coinsMarketChart=async function(e,{coinId:n,currency:o=r.USD,days:a=7,coinGeckoProApiKey:c}){const s=new URLSearchParams({vs_currency:o,days:a.toString(),...t(c)}),i=await e.get(`/coins/${n}/market_chart/?${s.toString()}`);return{prices:i.prices,marketCaps:i.market_caps,totalVolumes:i.total_volumes}},exports.coinsMarketChartRange=async function(e,{coinId:n,from:o,to:a,currency:c=r.USD,coinGeckoProApiKey:s}){const i=new URLSearchParams({vs_currency:c,from:`${o}`,to:`${a}`,...t(s)}),p=await e.get(`/coins/${n}/market_chart/range?${i.toString()}`);return{prices:p.prices,marketCaps:p.market_caps,totalVolumes:p.total_volumes}},exports.coinsSearch=async function(e,{query:r,coinGeckoProApiKey:n}){const o=new URLSearchParams({query:r,...t(n)});return await e.get(`/search?${o.toString()}`)},exports.getBasicCoingeckoHttp=function(e={},t){return p(n,e,t)},exports.getCoinGeckoHttp=p,exports.getDevProxiedCoingeckoHttp=function(e={},t){return p(i,{...e,method:"POST"},t)},exports.getProCoingeckoHttp=function(e={},t){return p(o,e,t)},exports.getProxiedCoingeckoHttp=function(e={},t){return p(s,{...e,method:"POST"},t)},exports.simplePrice=async function(e,{coinIds:n=[],currencies:o=[r.USD],marketCap:a=!1,vol24:c=!1,change24:s=!1,lastUpdated:i=!1,coinGeckoProApiKey:p,shouldThrow:u=!1}){const d=Array.from({length:Math.ceil(n.length/40)},((e,t)=>n.slice(40*t,40*t+40))).map((e=>{const r=new URLSearchParams({ids:e.join(","),vs_currencies:o.join(","),...t(p)});return a&&r.append("include_market_cap",a.toString()),c&&r.append("include_24hr_vol",c.toString()),s&&r.append("include_24hr_change",s.toString()),i&&r.append("include_last_updated_at",i.toString()),`/simple/price?${r.toString()}`})),g=await Promise.allSettled(d.map((t=>e.get(t))));u&&g.forEach((e=>{if("rejected"===e.status&&e.reason?.toString().includes("429"))throw e.reason}));const _=g.reduce(((e,t)=>({...e,..."fulfilled"===t.status?t.value:{}})),{}),l={};return Object.keys(_).forEach((e=>{const t=_[e];l[e]={},o.forEach((r=>{l[e][r]={price:t[r],change24:t[`${r}_24h_change`],vol24:t[`${r}_24h_vol`],marketCap:t[`${r}_market_cap`]}}))})),l},exports.simpleTokenPrice=async function(e,{assetPlatformId:n,tokenAddresses:o,currencies:a=[r.USD],marketCap:c=!1,vol24:s=!1,change24:i=!1,lastUpdated:p=!1,coinGeckoProApiKey:u}){const d=new URLSearchParams({contract_addresses:o.join(","),vs_currencies:a.join(","),include_market_cap:c.toString(),include_24hr_vol:s.toString(),include_24hr_change:i.toString(),include_last_updated_at:p.toString(),...t(u)}),g=await e.get(`/simple/token_price/${n}?${d.toString()}`),_={};return Object.keys(g).forEach((e=>{const t=g[e];_[e]={},a.forEach((r=>{_[e][r]={price:t[r],change24:t[`${r}_24h_change`],vol24:t[`${r}_24h_vol`],marketCap:t[`${r}_market_cap`]}}))})),_};
|
package/dist/index.d.ts
CHANGED
|
@@ -406,11 +406,11 @@ declare const DEV_COINGECKO_PROXY_URL: "https://proxy-api-dev.avax.network/proxy
|
|
|
406
406
|
* otherwise requests will not work because the proxy worker only accepts `POST` requests.
|
|
407
407
|
* @returns
|
|
408
408
|
*/
|
|
409
|
-
declare function getCoinGeckoHttp(url?: typeof COINGECKO_URL | typeof COINGECKO_PRO_URL | typeof COINGECKO_PROXY_URL | typeof DEV_COINGECKO_PROXY_URL, options?: HttpOptions): HttpClient;
|
|
410
|
-
declare function getProxiedCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
411
|
-
declare function getDevProxiedCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
412
|
-
declare function getBasicCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
413
|
-
declare function getProCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
409
|
+
declare function getCoinGeckoHttp(url?: typeof COINGECKO_URL | typeof COINGECKO_PRO_URL | typeof COINGECKO_PROXY_URL | typeof DEV_COINGECKO_PROXY_URL, options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
410
|
+
declare function getProxiedCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
411
|
+
declare function getDevProxiedCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
412
|
+
declare function getBasicCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
413
|
+
declare function getProCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
416
|
* Get the current price of any cryptocurrencies in any other supported currencies that you need.
|
|
@@ -442,4 +442,5 @@ declare function simpleTokenPrice(http: HttpClient, { assetPlatformId, tokenAddr
|
|
|
442
442
|
*/
|
|
443
443
|
declare function simplePrice(http: HttpClient, { coinIds, currencies, marketCap, vol24, change24, lastUpdated, coinGeckoProApiKey, shouldThrow, }: SimplePriceParams): Promise<SimplePriceResponse>;
|
|
444
444
|
|
|
445
|
-
export { COINGECKO_PROXY_URL, COINGECKO_PRO_URL, COINGECKO_URL,
|
|
445
|
+
export { COINGECKO_PROXY_URL, COINGECKO_PRO_URL, COINGECKO_URL, DEV_COINGECKO_PROXY_URL, DEV_PROXY_API_WORKER_URL, PROXY_API_WORKER_URL, VsCurrencyType, coinsContractInfo, coinsContractMarketChart, coinsContractMarketChartRange, coinsInfo, coinsMarket, coinsMarketChart, coinsMarketChartRange, coinsSearch, getBasicCoingeckoHttp, getCoinGeckoHttp, getDevProxiedCoingeckoHttp, getProCoingeckoHttp, getProxiedCoingeckoHttp, simplePrice, simpleTokenPrice };
|
|
446
|
+
export type { CoinMarket, CoinMarketChartParams, CoinMarketChartRangeParams, CoinMarketChartRangeResponse, CoinMarketChartResponse, CoinsContractInfoParams, CoinsContractInfoResponse, CoinsInfoParams, CoinsInfoResponse, CoinsMarketParams, CoinsSearchParams, CoinsSearchResponse, ContractMarketChartParams, ContractMarketChartRangeParams, ContractMarketChartResponse, DaysValueType, MarketTuple, SimplePriceInCurrency, SimplePriceParams, SimplePriceResponse, SimpleTokenPriceParams, SimpleTokenPriceResponse };
|
package/esm/http.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ import { COINGECKO_URL, COINGECKO_PRO_URL, COINGECKO_PROXY_URL, DEV_COINGECKO_PR
|
|
|
9
9
|
* otherwise requests will not work because the proxy worker only accepts `POST` requests.
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
declare function getCoinGeckoHttp(url?: typeof COINGECKO_URL | typeof COINGECKO_PRO_URL | typeof COINGECKO_PROXY_URL | typeof DEV_COINGECKO_PROXY_URL, options?: HttpOptions): HttpClient;
|
|
13
|
-
declare function getProxiedCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
14
|
-
declare function getDevProxiedCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
15
|
-
declare function getBasicCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
16
|
-
declare function getProCoingeckoHttp(options?: HttpOptions): HttpClient;
|
|
12
|
+
declare function getCoinGeckoHttp(url?: typeof COINGECKO_URL | typeof COINGECKO_PRO_URL | typeof COINGECKO_PROXY_URL | typeof DEV_COINGECKO_PROXY_URL, options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
13
|
+
declare function getProxiedCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
14
|
+
declare function getDevProxiedCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
15
|
+
declare function getBasicCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
16
|
+
declare function getProCoingeckoHttp(options?: HttpOptions, fetchFn?: typeof fetch): HttpClient;
|
|
17
17
|
|
|
18
18
|
export { getBasicCoingeckoHttp, getCoinGeckoHttp, getDevProxiedCoingeckoHttp, getProCoingeckoHttp, getProxiedCoingeckoHttp };
|
package/esm/http.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HttpClient as n}from"@avalabs/core-utils-sdk";import{COINGECKO_URL as t,
|
|
1
|
+
import{HttpClient as n}from"@avalabs/core-utils-sdk";import{COINGECKO_URL as t,DEV_COINGECKO_PROXY_URL as r,COINGECKO_PRO_URL as o,COINGECKO_PROXY_URL as u}from"./constants.js";function e(r=t,o={},u){return new n(r,o,u)}function i(n={},t){return e(u,{...n,method:"POST"},t)}function c(n={},t){return e(r,{...n,method:"POST"},t)}function f(n={},r){return e(t,n,r)}function m(n={},t){return e(o,n,t)}export{f as getBasicCoingeckoHttp,e as getCoinGeckoHttp,c as getDevProxiedCoingeckoHttp,m as getProCoingeckoHttp,i as getProxiedCoingeckoHttp};
|
package/esm/models.d.ts
CHANGED
|
@@ -294,4 +294,5 @@ type CoinsMarketParams = {
|
|
|
294
294
|
};
|
|
295
295
|
type CoinsInfoResponse = Omit<CoinsContractInfoResponse, 'contract_address'>;
|
|
296
296
|
|
|
297
|
-
export {
|
|
297
|
+
export { VsCurrencyType };
|
|
298
|
+
export type { CoinMarket, CoinMarketChartParams, CoinMarketChartRangeParams, CoinMarketChartRangeResponse, CoinMarketChartResponse, CoinsContractInfoParams, CoinsContractInfoResponse, CoinsInfoParams, CoinsInfoResponse, CoinsMarketParams, CoinsSearchParams, CoinsSearchResponse, ContractMarketChartParams, ContractMarketChartRangeParams, ContractMarketChartResponse, DaysValueType, MarketTuple, SimplePriceInCurrency, SimplePriceParams, SimplePriceResponse, SimpleTokenPriceParams, SimpleTokenPriceResponse };
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/core-coingecko-sdk",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.80",
|
|
4
4
|
"license": "Limited Ecosystem License",
|
|
5
5
|
"private": false,
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
7
8
|
"module": "esm/index.js",
|
|
8
9
|
"typings": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./esm/index.d.ts",
|
|
13
|
+
"import": "./esm/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"default": "./esm/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
9
18
|
"files": [
|
|
10
19
|
"dist",
|
|
11
20
|
"esm"
|
|
@@ -14,10 +23,10 @@
|
|
|
14
23
|
"scripts": {
|
|
15
24
|
"start": "rollup -c --watch",
|
|
16
25
|
"build": "rollup -c",
|
|
17
|
-
"lint": "eslint --fix -c ./.eslintrc.
|
|
26
|
+
"lint": "eslint --fix -c ./.eslintrc.cjs \"src/**/*.ts*\""
|
|
18
27
|
},
|
|
19
28
|
"dependencies": {
|
|
20
|
-
"@avalabs/core-utils-sdk": "3.1.0-alpha.
|
|
29
|
+
"@avalabs/core-utils-sdk": "3.1.0-alpha.80"
|
|
21
30
|
},
|
|
22
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "fac1eece40ef40bb0c4d927f95152064afc0ace0"
|
|
23
32
|
}
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@avalabs/core-utils-sdk");function t(e){return e?{x_cg_pro_api_key:e}:{}}var r=(e=>(e.AED="aed",e.ARS="ars",e.AUD="aud",e.BCH="bch",e.BDT="bdt",e.BHD="bhd",e.BMD="bmd",e.BNB="bnb",e.BRL="brl",e.BTC="btc",e.CAD="cad",e.CHF="chf",e.CLP="clp",e.CNY="cny",e.CZK="czk",e.DKK="dkk",e.DOT="dot",e.EOS="eos",e.ETH="eth",e.EUR="eur",e.GBP="gbp",e.HKD="hkd",e.HUF="huf",e.IDR="idr",e.ILS="ils",e.INR="inr",e.JPY="jpy",e.KRW="krw",e.KWD="kwd",e.LKR="lkr",e.LTC="ltc",e.MMK="mmk",e.MXN="mxn",e.MYR="myr",e.NGN="ngn",e.NOK="nok",e.NZD="nzd",e.PHP="php",e.PKR="pkr",e.PLN="pln",e.RUB="rub",e.SAR="sar",e.SEK="sek",e.SGD="sgd",e.THB="thb",e.TRY="try",e.TWD="twd",e.UAH="uah",e.USD="usd",e.VEF="vef",e.VND="vnd",e.XAG="xag",e.XAU="xau",e.XDR="xdr",e.XLM="xlm",e.XRP="xrp",e.YFI="yfi",e.ZAR="zar",e.BITS="bits",e.LINK="link",e.SATS="sats",e))(r||{});const n="https://api.coingecko.com/api/v3",o="https://pro-api.coingecko.com/api/v3",a="https://proxy-api-dev.avax.network",c="https://proxy-api.avax.network",s=`${c}/proxy/coingecko`,i=`${a}/proxy/coingecko`;function p(t=n,r={}){return new e.HttpClient(t,r)}exports.COINGECKO_PROXY_URL=s,exports.COINGECKO_PRO_URL=o,exports.COINGECKO_URL=n,exports.DEV_COINGECKO_PROXY_URL=i,exports.DEV_PROXY_API_WORKER_URL=a,exports.PROXY_API_WORKER_URL=c,exports.VsCurrencyType=r,exports.coinsContractInfo=async function(e,{assetPlatformId:r,address:n,coinGeckoProApiKey:o}){const a=new URLSearchParams({...t(o)});return await e.get(`/coins/${r}/contract/${n}?${a.toString()}`)},exports.coinsContractMarketChart=async function(e,{assetPlatformId:n,address:o,currency:a=r.USD,days:c=7,coinGeckoProApiKey:s}){const i=new URLSearchParams({vs_currency:a,days:c.toString(),...t(s)}),p=await e.get(`/coins/${n}/contract/${o}/market_chart/?${i.toString()}`);return{prices:p.prices,marketCaps:p.market_caps,totalVolumes:p.total_volumes}},exports.coinsContractMarketChartRange=async function(e,{assetPlatformId:n,address:o,from:a,to:c,currency:s=r.USD,coinGeckoProApiKey:i}){const p=new URLSearchParams({vs_currency:s,from:a.toString(),to:c.toString(),...t(i)}),u=await e.get(`/coins/${n}/contract/${o}/market_chart/range?${p.toString()}`);return{prices:u.prices,marketCaps:u.market_caps,totalVolumes:u.total_volumes}},exports.coinsInfo=async function(e,{coinId:r,coinGeckoProApiKey:n}){const o=new URLSearchParams({...t(n)});return await e.get(`/coins/${r}?${o.toString()}`)},exports.coinsMarket=async function(e,{coinIds:n,currency:o=r.USD,sparkline:a=!1,page:c,perPage:s,order:i,priceChangePercentage:p,coinGeckoProApiKey:u}){const d=new URLSearchParams({vs_currency:o,...t(u)});return n&&d.append("ids",n.join(",")),i&&d.append("order",i),p&&d.append("price_change_percentage",p),a&&d.append("sparkline","true"),s&&d.append("per_page",s.toString()),c&&d.append("page",c.toString()),await e.get(`/coins/markets?${d.toString()}`)},exports.coinsMarketChart=async function(e,{coinId:n,currency:o=r.USD,days:a=7,coinGeckoProApiKey:c}){const s=new URLSearchParams({vs_currency:o,days:a.toString(),...t(c)}),i=await e.get(`/coins/${n}/market_chart/?${s.toString()}`);return{prices:i.prices,marketCaps:i.market_caps,totalVolumes:i.total_volumes}},exports.coinsMarketChartRange=async function(e,{coinId:n,from:o,to:a,currency:c=r.USD,coinGeckoProApiKey:s}){const i=new URLSearchParams({vs_currency:c,from:`${o}`,to:`${a}`,...t(s)}),p=await e.get(`/coins/${n}/market_chart/range?${i.toString()}`);return{prices:p.prices,marketCaps:p.market_caps,totalVolumes:p.total_volumes}},exports.coinsSearch=async function(e,{query:r,coinGeckoProApiKey:n}){const o=new URLSearchParams({query:r,...t(n)});return await e.get(`/search?${o.toString()}`)},exports.getBasicCoingeckoHttp=function(e={}){return p(n,e)},exports.getCoinGeckoHttp=p,exports.getDevProxiedCoingeckoHttp=function(e={}){return p(i,{...e,method:"POST"})},exports.getProCoingeckoHttp=function(e={}){return p(o,e)},exports.getProxiedCoingeckoHttp=function(e={}){return p(s,{...e,method:"POST"})},exports.simplePrice=async function(e,{coinIds:n=[],currencies:o=[r.USD],marketCap:a=!1,vol24:c=!1,change24:s=!1,lastUpdated:i=!1,coinGeckoProApiKey:p,shouldThrow:u=!1}){const d=Array.from({length:Math.ceil(n.length/40)},((e,t)=>n.slice(40*t,40*t+40))).map((e=>{const r=new URLSearchParams({ids:e.join(","),vs_currencies:o.join(","),...t(p)});return a&&r.append("include_market_cap",a.toString()),c&&r.append("include_24hr_vol",c.toString()),s&&r.append("include_24hr_change",s.toString()),i&&r.append("include_last_updated_at",i.toString()),`/simple/price?${r.toString()}`})),g=await Promise.allSettled(d.map((t=>e.get(t))));u&&g.forEach((e=>{if("rejected"===e.status&&e.reason?.toString().includes("429"))throw e.reason}));const _=g.reduce(((e,t)=>({...e,..."fulfilled"===t.status?t.value:{}})),{}),l={};return Object.keys(_).forEach((e=>{const t=_[e];l[e]={},o.forEach((r=>{l[e][r]={price:t[r],change24:t[`${r}_24h_change`],vol24:t[`${r}_24h_vol`],marketCap:t[`${r}_market_cap`]}}))})),l},exports.simpleTokenPrice=async function(e,{assetPlatformId:n,tokenAddresses:o,currencies:a=[r.USD],marketCap:c=!1,vol24:s=!1,change24:i=!1,lastUpdated:p=!1,coinGeckoProApiKey:u}){const d=new URLSearchParams({contract_addresses:o.join(","),vs_currencies:a.join(","),include_market_cap:c.toString(),include_24hr_vol:s.toString(),include_24hr_change:i.toString(),include_last_updated_at:p.toString(),...t(u)}),g=await e.get(`/simple/token_price/${n}?${d.toString()}`),_={};return Object.keys(g).forEach((e=>{const t=g[e];_[e]={},a.forEach((r=>{_[e][r]={price:t[r],change24:t[`${r}_24h_change`],vol24:t[`${r}_24h_vol`],marketCap:t[`${r}_market_cap`]}}))})),_};
|