@t2000/sdk 0.21.0 → 0.21.2

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.js CHANGED
@@ -968,7 +968,7 @@ async function getPositions(client, address) {
968
968
  const amount = parseFloat(data.amount);
969
969
  const amountUsd = parseFloat(data.valueUSD);
970
970
  const pool = data.pool;
971
- const apy = isBorrow ? parseFloat(pool.borrowIncentiveApyInfo?.apy ?? "0") : parseFloat(pool.supplyIncentiveApyInfo?.apy ?? "0");
971
+ const apy = (isBorrow ? parseFloat(pool.borrowIncentiveApyInfo?.apy ?? "0") : parseFloat(pool.supplyIncentiveApyInfo?.apy ?? "0")) / 100;
972
972
  if (amountUsd > 0.01 || amount > 1e-10) {
973
973
  positions.push({
974
974
  protocol: "navi",
@@ -999,16 +999,16 @@ async function getRates(client) {
999
999
  return poolSuffix === targetSuffix;
1000
1000
  });
1001
1001
  if (!pool) continue;
1002
- const saveApy = parseFloat(pool.supplyIncentiveApyInfo?.apy ?? "0");
1003
- const borrowApy = parseFloat(pool.borrowIncentiveApyInfo?.apy ?? "0");
1004
- if (saveApy >= 0 && saveApy < 200) {
1005
- result[asset] = { saveApy, borrowApy: borrowApy >= 0 && borrowApy < 200 ? borrowApy : 0 };
1002
+ const saveApy = parseFloat(pool.supplyIncentiveApyInfo?.apy ?? "0") / 100;
1003
+ const borrowApy = parseFloat(pool.borrowIncentiveApyInfo?.apy ?? "0") / 100;
1004
+ if (saveApy >= 0 && saveApy < 2) {
1005
+ result[asset] = { saveApy, borrowApy: borrowApy >= 0 && borrowApy < 2 ? borrowApy : 0 };
1006
1006
  }
1007
1007
  }
1008
- if (!result.USDC) result.USDC = { saveApy: 4, borrowApy: 6 };
1008
+ if (!result.USDC) result.USDC = { saveApy: 0.04, borrowApy: 0.06 };
1009
1009
  return result;
1010
1010
  } catch {
1011
- return { USDC: { saveApy: 4, borrowApy: 6 } };
1011
+ return { USDC: { saveApy: 0.04, borrowApy: 0.06 } };
1012
1012
  }
1013
1013
  }
1014
1014
  async function getHealthFactor(client, address) {
@@ -1281,7 +1281,7 @@ async function getEarnings(client, address) {
1281
1281
  const hf = await getHealthFactor(client, address);
1282
1282
  const rates = await getRates(client);
1283
1283
  const supplied = hf.supplied;
1284
- const apy = rates.USDC.saveApy / 100;
1284
+ const apy = rates.USDC.saveApy;
1285
1285
  const dailyRate = apy / 365;
1286
1286
  const dailyEarning = supplied * dailyRate;
1287
1287
  const totalYieldEarned = dailyEarning * 30;