@t2000/sdk 0.17.16 → 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,20 +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) {
950
+ const assetSymbol = resolvePoolSymbol(pool);
960
951
  rewards.push({
961
952
  protocol: "navi",
962
- coinType,
963
- symbol: REWARD_SYMBOLS[coinType] ?? coinType.split("::").pop() ?? "UNKNOWN",
953
+ asset: assetSymbol,
954
+ coinType: rewardType,
955
+ symbol: REWARD_SYMBOLS[rewardType] ?? rewardType.split("::").pop() ?? "UNKNOWN",
964
956
  amount: 0,
965
- estimatedValueUsd: dailyUsd
957
+ estimatedValueUsd: 0
966
958
  });
967
959
  }
968
960
  return rewards;
@@ -1023,6 +1015,7 @@ async function addClaimRewardsToTx(tx, client, address) {
1023
1015
  tx.transferObjects([coin], address);
1024
1016
  claimed.push({
1025
1017
  protocol: "navi",
1018
+ asset: assets.join(", "),
1026
1019
  coinType: rewardType,
1027
1020
  symbol: REWARD_SYMBOLS[rewardType] ?? "UNKNOWN",
1028
1021
  amount: 0,
@@ -2022,45 +2015,24 @@ var SuilendAdapter = class {
2022
2015
  this.fetchObligation(caps[0].obligationId)
2023
2016
  ]);
2024
2017
  const rewards = [];
2025
- const rewardEstimates = /* @__PURE__ */ new Map();
2026
2018
  for (const dep of obligation.deposits) {
2027
2019
  const reserve = reserves[dep.reserveIdx];
2028
2020
  if (!reserve) continue;
2029
- const ratio = cTokenRatio(reserve);
2030
- const amount = dep.ctokenAmount * ratio / 10 ** reserve.mintDecimals;
2031
- const price = reserve.price;
2032
- const depositUsd = amount * price;
2033
2021
  for (const rw of reserve.depositPoolRewards) {
2034
2022
  if (!this.isClaimableReward(rw.coinType)) continue;
2035
- const rewardReserve = reserves.find((r) => {
2036
- try {
2037
- return normalizeStructTag(r.coinType) === normalizeStructTag(rw.coinType);
2038
- } catch {
2039
- return false;
2040
- }
2041
- });
2042
- const rewardPrice = rewardReserve?.price ?? 0;
2043
- const rewardDecimals = rewardReserve?.mintDecimals ?? 9;
2044
2023
  const durationMs = rw.endTimeMs - rw.startTimeMs;
2045
2024
  if (durationMs <= 0) continue;
2046
- const annualTokens = rw.totalRewards / 10 ** rewardDecimals * (MS_PER_YEAR / durationMs);
2047
- const totalDepositValue = reserve.depositTotalShares / 10 ** reserve.mintDecimals * price;
2048
- if (totalDepositValue <= 0) continue;
2049
- const userShare = depositUsd / totalDepositValue;
2050
- const dailyRewardUsd = annualTokens * rewardPrice / 365 * userShare;
2051
- 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
+ });
2052
2034
  }
2053
2035
  }
2054
- for (const [coinType, dailyUsd] of rewardEstimates) {
2055
- const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2056
- rewards.push({
2057
- protocol: "suilend",
2058
- coinType,
2059
- symbol,
2060
- amount: 0,
2061
- estimatedValueUsd: dailyUsd
2062
- });
2063
- }
2064
2036
  return rewards;
2065
2037
  }
2066
2038
  async addClaimRewardsToTx(tx, address) {
@@ -2103,6 +2075,7 @@ var SuilendAdapter = class {
2103
2075
  const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2104
2076
  claimed.push({
2105
2077
  protocol: "suilend",
2078
+ asset: "",
2106
2079
  coinType,
2107
2080
  symbol,
2108
2081
  amount: 0,