@render-foundation/utils 0.0.18 → 0.0.19
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/lib/cjs/priceClient.js
CHANGED
|
@@ -8,13 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.coinGeckoClient = void 0;
|
|
16
13
|
const coingecko_api_v3_1 = require("coingecko-api-v3");
|
|
17
|
-
const dateformat_1 = __importDefault(require("dateformat"));
|
|
18
14
|
const coinGeckoClient = () => {
|
|
19
15
|
const client = new coingecko_api_v3_1.CoinGeckoClient({
|
|
20
16
|
timeout: 10000,
|
|
@@ -23,7 +19,7 @@ const coinGeckoClient = () => {
|
|
|
23
19
|
return {
|
|
24
20
|
getRenderPriceAtDate(d) {
|
|
25
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const res = yield client.coinIdHistory({ id: 'render-token', date: (
|
|
22
|
+
const res = yield client.coinIdHistory({ id: 'render-token', date: `${d.getDay()}-${d.getMonth() + 1}-${d.getFullYear()}` });
|
|
27
23
|
return res.market_data.current_price['usd'];
|
|
28
24
|
});
|
|
29
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceClient.js","sourceRoot":"","sources":["../../src/priceClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"priceClient.js","sourceRoot":"","sources":["../../src/priceClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAiD;AAM1C,MAAM,eAAe,GAAG,GAAgB,EAAE;IAE/C,MAAM,MAAM,GAAG,IAAI,kCAAe,CAAC;QACjC,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO;QACC,oBAAoB,CAAC,CAAO;;gBAChC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,EAAC,CAAC,CAAA;gBAC1H,OAAO,GAAG,CAAC,WAAW,CAAC,aAAc,CAAC,KAAK,CAAC,CAAA;YAC9C,CAAC;SAAA;KACF,CAAA;AAEH,CAAC,CAAA;AAdY,QAAA,eAAe,mBAc3B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CoinGeckoClient } from "coingecko-api-v3";
|
|
2
|
-
import dateFormat from "dateformat";
|
|
3
2
|
export const coinGeckoClient = () => {
|
|
4
3
|
const client = new CoinGeckoClient({
|
|
5
4
|
timeout: 10000,
|
|
@@ -7,7 +6,7 @@ export const coinGeckoClient = () => {
|
|
|
7
6
|
});
|
|
8
7
|
return {
|
|
9
8
|
async getRenderPriceAtDate(d) {
|
|
10
|
-
const res = await client.coinIdHistory({ id: 'render-token', date:
|
|
9
|
+
const res = await client.coinIdHistory({ id: 'render-token', date: `${d.getDay()}-${d.getMonth() + 1}-${d.getFullYear()}` });
|
|
11
10
|
return res.market_data.current_price['usd'];
|
|
12
11
|
}
|
|
13
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceClient.js","sourceRoot":"","sources":["../../../src/priceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"priceClient.js","sourceRoot":"","sources":["../../../src/priceClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAMjD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAgB,EAAE;IAE/C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,CAAO;YAChC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,EAAC,CAAC,CAAA;YAC1H,OAAO,GAAG,CAAC,WAAW,CAAC,aAAc,CAAC,KAAK,CAAC,CAAA;QAC9C,CAAC;KACF,CAAA;AAEH,CAAC,CAAA"}
|