@defisaver/positions-sdk 2.1.3 → 2.1.4

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.
@@ -54,12 +54,13 @@ const getSuperOETHApy = () => __awaiter(void 0, void 0, void 0, function* () {
54
54
  }
55
55
  });
56
56
  const getApyFromDfsApi = (asset) => __awaiter(void 0, void 0, void 0, function* () {
57
+ var _a;
57
58
  try {
58
59
  const res = yield fetch(`https://fe.defisaver.com/api/staking/apy?asset=${asset}`, { signal: AbortSignal.timeout(utils_1.DEFAULT_TIMEOUT) });
59
60
  if (!res.ok)
60
61
  throw new Error(`Failed to fetch APY for ${asset}`);
61
62
  const data = yield res.json();
62
- return String(data.apy);
63
+ return String((_a = data.apy) !== null && _a !== void 0 ? _a : '0');
63
64
  }
64
65
  catch (e) {
65
66
  console.error(`External API Failure: Failed to fetch APY for ${asset} from DFS API`, e);
@@ -48,12 +48,13 @@ const getSuperOETHApy = () => __awaiter(void 0, void 0, void 0, function* () {
48
48
  }
49
49
  });
50
50
  const getApyFromDfsApi = (asset) => __awaiter(void 0, void 0, void 0, function* () {
51
+ var _a;
51
52
  try {
52
53
  const res = yield fetch(`https://fe.defisaver.com/api/staking/apy?asset=${asset}`, { signal: AbortSignal.timeout(DEFAULT_TIMEOUT) });
53
54
  if (!res.ok)
54
55
  throw new Error(`Failed to fetch APY for ${asset}`);
55
56
  const data = yield res.json();
56
- return String(data.apy);
57
+ return String((_a = data.apy) !== null && _a !== void 0 ? _a : '0');
57
58
  }
58
59
  catch (e) {
59
60
  console.error(`External API Failure: Failed to fetch APY for ${asset} from DFS API`, e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -49,7 +49,7 @@ const getApyFromDfsApi = async (asset: string) => {
49
49
  { signal: AbortSignal.timeout(DEFAULT_TIMEOUT) });
50
50
  if (!res.ok) throw new Error(`Failed to fetch APY for ${asset}`);
51
51
  const data = await res.json();
52
- return String(data.apy);
52
+ return String(data.apy ?? '0');
53
53
  } catch (e) {
54
54
  console.error(`External API Failure: Failed to fetch APY for ${asset} from DFS API`, e);
55
55
  return '0';