@7kprotocol/sdk-ts 1.3.2 → 1.3.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/utils/price.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/utils/price.ts"],"names":[],"mappings":"AASA,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,SAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
package/lib/cjs/utils/price.js
CHANGED
|
@@ -14,10 +14,11 @@ const tokens_1 = require("../constants/tokens");
|
|
|
14
14
|
const PRICES_API = "https://prices.7k.ag";
|
|
15
15
|
function getTokenPrice(id_1) {
|
|
16
16
|
return __awaiter(this, arguments, void 0, function* (id, vsCoin = tokens_1.USDC_TOKEN_TYPE) {
|
|
17
|
+
var _a;
|
|
17
18
|
try {
|
|
18
19
|
const response = yield fetch(`${PRICES_API}/price?ids=${id}&vsCoin=${vsCoin}`);
|
|
19
20
|
const prices = (yield response.json());
|
|
20
|
-
return (prices === null || prices === void 0 ? void 0 : prices[id]) || 0;
|
|
21
|
+
return ((_a = prices === null || prices === void 0 ? void 0 : prices[id]) === null || _a === void 0 ? void 0 : _a.price) || 0;
|
|
21
22
|
}
|
|
22
23
|
catch (error) {
|
|
23
24
|
return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/utils/price.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/utils/price.ts"],"names":[],"mappings":"AASA,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,SAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
package/lib/esm/utils/price.js
CHANGED
|
@@ -4,7 +4,7 @@ export async function getTokenPrice(id, vsCoin = USDC_TOKEN_TYPE) {
|
|
|
4
4
|
try {
|
|
5
5
|
const response = await fetch(`${PRICES_API}/price?ids=${id}&vsCoin=${vsCoin}`);
|
|
6
6
|
const prices = (await response.json());
|
|
7
|
-
return prices?.[id] || 0;
|
|
7
|
+
return prices?.[id]?.price || 0;
|
|
8
8
|
}
|
|
9
9
|
catch (error) {
|
|
10
10
|
return 0;
|