@t2000/sdk 0.17.15 → 0.17.17

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,4 +1,4 @@
1
- export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, K as CetusAdapter, O as HealthInfo, L as LendingAdapter, t as LendingRates, Q as NaviAdapter, U as PerpsAdapter, Z as ProtocolDescriptor, _ as ProtocolRegistry, a1 as SuilendAdapter, d as SwapAdapter, a2 as SwapQuote, a5 as allDescriptors, a6 as cetusDescriptor, a9 as naviDescriptor, ac as sentinelDescriptor, af as suilendDescriptor } from '../index-xQEri-Eu.cjs';
1
+ export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, K as CetusAdapter, O as HealthInfo, L as LendingAdapter, t as LendingRates, Q as NaviAdapter, U as PerpsAdapter, Z as ProtocolDescriptor, _ as ProtocolRegistry, a1 as SuilendAdapter, d as SwapAdapter, a2 as SwapQuote, a5 as allDescriptors, a6 as cetusDescriptor, a9 as naviDescriptor, ac as sentinelDescriptor, af as suilendDescriptor } from '../index-Dl9CthNB.cjs';
2
2
  import '@mysten/sui/transactions';
3
3
  import '@mysten/sui/jsonRpc';
4
4
  import '@mysten/sui/keypairs/ed25519';
@@ -1,4 +1,4 @@
1
- export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, K as CetusAdapter, O as HealthInfo, L as LendingAdapter, t as LendingRates, Q as NaviAdapter, U as PerpsAdapter, Z as ProtocolDescriptor, _ as ProtocolRegistry, a1 as SuilendAdapter, d as SwapAdapter, a2 as SwapQuote, a5 as allDescriptors, a6 as cetusDescriptor, a9 as naviDescriptor, ac as sentinelDescriptor, af as suilendDescriptor } from '../index-xQEri-Eu.js';
1
+ export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, K as CetusAdapter, O as HealthInfo, L as LendingAdapter, t as LendingRates, Q as NaviAdapter, U as PerpsAdapter, Z as ProtocolDescriptor, _ as ProtocolRegistry, a1 as SuilendAdapter, d as SwapAdapter, a2 as SwapQuote, a5 as allDescriptors, a6 as cetusDescriptor, a9 as naviDescriptor, ac as sentinelDescriptor, af as suilendDescriptor } from '../index-Dl9CthNB.js';
2
2
  import '@mysten/sui/transactions';
3
3
  import '@mysten/sui/jsonRpc';
4
4
  import '@mysten/sui/keypairs/ed25519';
@@ -932,15 +932,13 @@ function stripPrefix(coinType) {
932
932
  return coinType.replace(/^0x0*/, "");
933
933
  }
934
934
  async function getPendingRewards(client, address) {
935
- const [pools, states, rules] = await Promise.all([
935
+ const [pools, states] = await Promise.all([
936
936
  getPools(),
937
- getUserState(client, address),
938
- getIncentiveRules(client)
937
+ getUserState(client, address)
939
938
  ]);
940
939
  const rewards = [];
941
940
  const deposited = states.filter((s) => s.supplyBalance > 0n);
942
941
  if (deposited.length === 0) return rewards;
943
- const rewardTotals = /* @__PURE__ */ new Map();
944
942
  for (const state of deposited) {
945
943
  const pool = pools.find((p) => p.id === state.assetId);
946
944
  if (!pool) continue;
@@ -949,21 +947,14 @@ async function getPendingRewards(client, address) {
949
947
  const rewardCoins = pool.supplyIncentiveApyInfo?.rewardCoin;
950
948
  if (!Array.isArray(rewardCoins) || rewardCoins.length === 0) continue;
951
949
  const rewardType = rewardCoins[0];
952
- const supplyBal = compoundBalance(state.supplyBalance, pool.currentSupplyIndex, pool);
953
- const price = pool.token?.price ?? 0;
954
- const depositUsd = supplyBal * price;
955
- const annualRewardUsd = depositUsd * (boostedApr / 100);
956
- const estimatedUsd = annualRewardUsd / 365;
957
- rewardTotals.set(rewardType, (rewardTotals.get(rewardType) ?? 0) + estimatedUsd);
958
- }
959
- for (const [coinType, dailyUsd] of rewardTotals) {
960
- if (dailyUsd < 1e-3) continue;
950
+ const assetSymbol = resolvePoolSymbol(pool);
961
951
  rewards.push({
962
952
  protocol: "navi",
963
- coinType,
964
- symbol: REWARD_SYMBOLS[coinType] ?? coinType.split("::").pop() ?? "UNKNOWN",
953
+ asset: assetSymbol,
954
+ coinType: rewardType,
955
+ symbol: REWARD_SYMBOLS[rewardType] ?? rewardType.split("::").pop() ?? "UNKNOWN",
965
956
  amount: 0,
966
- estimatedValueUsd: dailyUsd
957
+ estimatedValueUsd: 0
967
958
  });
968
959
  }
969
960
  return rewards;
@@ -1024,6 +1015,7 @@ async function addClaimRewardsToTx(tx, client, address) {
1024
1015
  tx.transferObjects([coin], address);
1025
1016
  claimed.push({
1026
1017
  protocol: "navi",
1018
+ asset: assets.join(", "),
1027
1019
  coinType: rewardType,
1028
1020
  symbol: REWARD_SYMBOLS[rewardType] ?? "UNKNOWN",
1029
1021
  amount: 0,
@@ -2023,46 +2015,24 @@ var SuilendAdapter = class {
2023
2015
  this.fetchObligation(caps[0].obligationId)
2024
2016
  ]);
2025
2017
  const rewards = [];
2026
- const rewardEstimates = /* @__PURE__ */ new Map();
2027
2018
  for (const dep of obligation.deposits) {
2028
2019
  const reserve = reserves[dep.reserveIdx];
2029
2020
  if (!reserve) continue;
2030
- const ratio = cTokenRatio(reserve);
2031
- const amount = dep.ctokenAmount * ratio / 10 ** reserve.mintDecimals;
2032
- const price = reserve.price;
2033
- const depositUsd = amount * price;
2034
2021
  for (const rw of reserve.depositPoolRewards) {
2035
2022
  if (!this.isClaimableReward(rw.coinType)) continue;
2036
- const rewardReserve = reserves.find((r) => {
2037
- try {
2038
- return normalizeStructTag(r.coinType) === normalizeStructTag(rw.coinType);
2039
- } catch {
2040
- return false;
2041
- }
2042
- });
2043
- const rewardPrice = rewardReserve?.price ?? 0;
2044
- const rewardDecimals = rewardReserve?.mintDecimals ?? 9;
2045
2023
  const durationMs = rw.endTimeMs - rw.startTimeMs;
2046
2024
  if (durationMs <= 0) continue;
2047
- const annualTokens = rw.totalRewards / 10 ** rewardDecimals * (MS_PER_YEAR / durationMs);
2048
- const totalDepositValue = reserve.depositTotalShares / 10 ** reserve.mintDecimals * price;
2049
- if (totalDepositValue <= 0) continue;
2050
- const userShare = depositUsd / totalDepositValue;
2051
- const dailyRewardUsd = annualTokens * rewardPrice / 365 * userShare;
2052
- rewardEstimates.set(rw.coinType, (rewardEstimates.get(rw.coinType) ?? 0) + dailyRewardUsd);
2025
+ const assetSymbol = this.resolveSymbol(reserve.coinType);
2026
+ rewards.push({
2027
+ protocol: "suilend",
2028
+ asset: assetSymbol,
2029
+ coinType: rw.coinType,
2030
+ symbol: rw.coinType.includes("spring_sui") ? "sSUI" : rw.coinType.includes("deep::") ? "DEEP" : rw.coinType.split("::").pop() ?? "UNKNOWN",
2031
+ amount: 0,
2032
+ estimatedValueUsd: 0
2033
+ });
2053
2034
  }
2054
2035
  }
2055
- for (const [coinType, dailyUsd] of rewardEstimates) {
2056
- if (dailyUsd < 1e-3) continue;
2057
- const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2058
- rewards.push({
2059
- protocol: "suilend",
2060
- coinType,
2061
- symbol,
2062
- amount: 0,
2063
- estimatedValueUsd: dailyUsd
2064
- });
2065
- }
2066
2036
  return rewards;
2067
2037
  }
2068
2038
  async addClaimRewardsToTx(tx, address) {
@@ -2105,6 +2075,7 @@ var SuilendAdapter = class {
2105
2075
  const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2106
2076
  claimed.push({
2107
2077
  protocol: "suilend",
2078
+ asset: "",
2108
2079
  coinType,
2109
2080
  symbol,
2110
2081
  amount: 0,