@defisaver/positions-sdk 2.1.0 → 2.1.1

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.
@@ -138,8 +138,9 @@ const calculateInterestEarned = (principal, interest, type, apy = false) => {
138
138
  exports.calculateInterestEarned = calculateInterestEarned;
139
139
  const calculateNetApy = ({ usedAssets, assetsData, }) => {
140
140
  const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
141
+ var _a;
141
142
  const acc = Object.assign({}, _acc);
142
- const assetData = assetsData[usedAsset.symbol];
143
+ const assetData = assetsData[usedAsset.symbol] || assetsData[((_a = usedAsset.vaultAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ''];
143
144
  if (usedAsset.isSupplied) {
144
145
  const amount = usedAsset.suppliedUsd;
145
146
  acc.suppliedUsd = new decimal_js_1.default(acc.suppliedUsd).add(amount).toString();
@@ -131,8 +131,9 @@ export const calculateInterestEarned = (principal, interest, type, apy = false)
131
131
  };
132
132
  export const calculateNetApy = ({ usedAssets, assetsData, }) => {
133
133
  const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
134
+ var _a;
134
135
  const acc = Object.assign({}, _acc);
135
- const assetData = assetsData[usedAsset.symbol];
136
+ const assetData = assetsData[usedAsset.symbol] || assetsData[((_a = usedAsset.vaultAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ''];
136
137
  if (usedAsset.isSupplied) {
137
138
  const amount = usedAsset.suppliedUsd;
138
139
  acc.suppliedUsd = new Dec(acc.suppliedUsd).add(amount).toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -4,6 +4,7 @@ import { IncentiveEligibilityId, MMAssetsData, MMUsedAssets } from '../types/com
4
4
  import { BLOCKS_IN_A_YEAR } from '../constants';
5
5
  import { DEFAULT_TIMEOUT } from '../services/utils';
6
6
  import { EligibilityMapping } from './eligibility';
7
+ import { EulerV2UsedAsset } from '../types';
7
8
 
8
9
  const getSsrApy = async () => {
9
10
  try {
@@ -109,7 +110,7 @@ export const calculateNetApy = ({
109
110
  }: { usedAssets: MMUsedAssets, assetsData: MMAssetsData }) => {
110
111
  const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
111
112
  const acc = { ..._acc };
112
- const assetData = assetsData[usedAsset.symbol];
113
+ const assetData = assetsData[usedAsset.symbol] || assetsData[(usedAsset as EulerV2UsedAsset).vaultAddress?.toLowerCase() || ''];
113
114
 
114
115
  if (usedAsset.isSupplied) {
115
116
  const amount = usedAsset.suppliedUsd;