@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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InvestmentTrade, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, b as SendResult, B as BalanceResponse, c as TransactionRecord, D as DepositInfo, L as LendingAdapter, d as SwapAdapter, e as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, f as BorrowResult, R as RepayResult, g as MaxBorrowResult, H as HealthFactorResult, h as SwapResult, i as InvestResult, j as InvestEarnResult, P as PendingReward, C as ClaimRewardsResult, k as StrategyBuyResult, l as StrategySellResult, m as StrategyRebalanceResult, n as StrategyStatusResult, o as AutoInvestRunResult, p as PortfolioResult, q as InvestmentPosition, r as PositionsResult, s as RatesResult, t as LendingRates, u as RebalanceResult, E as EarningsResult, F as FundStatusResult, v as SentinelAgent, w as SentinelAttackResult, G as GasMethod } from './index-xQEri-Eu.cjs';
2
- export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, J as AssetRates, K as CetusAdapter, N as GasReserve, O as HealthInfo, Q as NaviAdapter, U as PerpsAdapter, V as PerpsPosition, X as PositionEntry, Y as PositionSide, Z as ProtocolDescriptor, _ as ProtocolRegistry, $ as RebalanceStep, a0 as SentinelVerdict, a1 as SuilendAdapter, a2 as SwapQuote, a3 as TradePositionsResult, a4 as TradeResult, a5 as allDescriptors, a6 as cetusDescriptor, a7 as getSentinelInfo, a8 as listSentinels, a9 as naviDescriptor, aa as requestAttack, ab as sentinelAttack, ac as sentinelDescriptor, ad as settleAttack, ae as submitPrompt, af as suilendDescriptor } from './index-xQEri-Eu.cjs';
1
+ import { I as InvestmentTrade, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, b as SendResult, B as BalanceResponse, c as TransactionRecord, D as DepositInfo, L as LendingAdapter, d as SwapAdapter, e as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, f as BorrowResult, R as RepayResult, g as MaxBorrowResult, H as HealthFactorResult, h as SwapResult, i as InvestResult, j as InvestEarnResult, P as PendingReward, C as ClaimRewardsResult, k as StrategyBuyResult, l as StrategySellResult, m as StrategyRebalanceResult, n as StrategyStatusResult, o as AutoInvestRunResult, p as PortfolioResult, q as InvestmentPosition, r as PositionsResult, s as RatesResult, t as LendingRates, u as RebalanceResult, E as EarningsResult, F as FundStatusResult, v as SentinelAgent, w as SentinelAttackResult, G as GasMethod } from './index-Dl9CthNB.cjs';
2
+ export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, J as AssetRates, K as CetusAdapter, N as GasReserve, O as HealthInfo, Q as NaviAdapter, U as PerpsAdapter, V as PerpsPosition, X as PositionEntry, Y as PositionSide, Z as ProtocolDescriptor, _ as ProtocolRegistry, $ as RebalanceStep, a0 as SentinelVerdict, a1 as SuilendAdapter, a2 as SwapQuote, a3 as TradePositionsResult, a4 as TradeResult, a5 as allDescriptors, a6 as cetusDescriptor, a7 as getSentinelInfo, a8 as listSentinels, a9 as naviDescriptor, aa as requestAttack, ab as sentinelAttack, ac as sentinelDescriptor, ad as settleAttack, ae as submitPrompt, af as suilendDescriptor } from './index-Dl9CthNB.cjs';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InvestmentTrade, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, b as SendResult, B as BalanceResponse, c as TransactionRecord, D as DepositInfo, L as LendingAdapter, d as SwapAdapter, e as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, f as BorrowResult, R as RepayResult, g as MaxBorrowResult, H as HealthFactorResult, h as SwapResult, i as InvestResult, j as InvestEarnResult, P as PendingReward, C as ClaimRewardsResult, k as StrategyBuyResult, l as StrategySellResult, m as StrategyRebalanceResult, n as StrategyStatusResult, o as AutoInvestRunResult, p as PortfolioResult, q as InvestmentPosition, r as PositionsResult, s as RatesResult, t as LendingRates, u as RebalanceResult, E as EarningsResult, F as FundStatusResult, v as SentinelAgent, w as SentinelAttackResult, G as GasMethod } from './index-xQEri-Eu.js';
2
- export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, J as AssetRates, K as CetusAdapter, N as GasReserve, O as HealthInfo, Q as NaviAdapter, U as PerpsAdapter, V as PerpsPosition, X as PositionEntry, Y as PositionSide, Z as ProtocolDescriptor, _ as ProtocolRegistry, $ as RebalanceStep, a0 as SentinelVerdict, a1 as SuilendAdapter, a2 as SwapQuote, a3 as TradePositionsResult, a4 as TradeResult, a5 as allDescriptors, a6 as cetusDescriptor, a7 as getSentinelInfo, a8 as listSentinels, a9 as naviDescriptor, aa as requestAttack, ab as sentinelAttack, ac as sentinelDescriptor, ad as settleAttack, ae as submitPrompt, af as suilendDescriptor } from './index-xQEri-Eu.js';
1
+ import { I as InvestmentTrade, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, b as SendResult, B as BalanceResponse, c as TransactionRecord, D as DepositInfo, L as LendingAdapter, d as SwapAdapter, e as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, f as BorrowResult, R as RepayResult, g as MaxBorrowResult, H as HealthFactorResult, h as SwapResult, i as InvestResult, j as InvestEarnResult, P as PendingReward, C as ClaimRewardsResult, k as StrategyBuyResult, l as StrategySellResult, m as StrategyRebalanceResult, n as StrategyStatusResult, o as AutoInvestRunResult, p as PortfolioResult, q as InvestmentPosition, r as PositionsResult, s as RatesResult, t as LendingRates, u as RebalanceResult, E as EarningsResult, F as FundStatusResult, v as SentinelAgent, w as SentinelAttackResult, G as GasMethod } from './index-Dl9CthNB.js';
2
+ export { x as AdapterCapability, y as AdapterPositions, z as AdapterTxResult, J as AssetRates, K as CetusAdapter, N as GasReserve, O as HealthInfo, Q as NaviAdapter, U as PerpsAdapter, V as PerpsPosition, X as PositionEntry, Y as PositionSide, Z as ProtocolDescriptor, _ as ProtocolRegistry, $ as RebalanceStep, a0 as SentinelVerdict, a1 as SuilendAdapter, a2 as SwapQuote, a3 as TradePositionsResult, a4 as TradeResult, a5 as allDescriptors, a6 as cetusDescriptor, a7 as getSentinelInfo, a8 as listSentinels, a9 as naviDescriptor, aa as requestAttack, ab as sentinelAttack, ac as sentinelDescriptor, ad as settleAttack, ae as submitPrompt, af as suilendDescriptor } from './index-Dl9CthNB.js';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
package/dist/index.js CHANGED
@@ -1244,15 +1244,13 @@ function stripPrefix(coinType) {
1244
1244
  return coinType.replace(/^0x0*/, "");
1245
1245
  }
1246
1246
  async function getPendingRewards(client, address) {
1247
- const [pools, states, rules] = await Promise.all([
1247
+ const [pools, states] = await Promise.all([
1248
1248
  getPools(),
1249
- getUserState(client, address),
1250
- getIncentiveRules(client)
1249
+ getUserState(client, address)
1251
1250
  ]);
1252
1251
  const rewards = [];
1253
1252
  const deposited = states.filter((s) => s.supplyBalance > 0n);
1254
1253
  if (deposited.length === 0) return rewards;
1255
- const rewardTotals = /* @__PURE__ */ new Map();
1256
1254
  for (const state of deposited) {
1257
1255
  const pool = pools.find((p) => p.id === state.assetId);
1258
1256
  if (!pool) continue;
@@ -1261,21 +1259,14 @@ async function getPendingRewards(client, address) {
1261
1259
  const rewardCoins = pool.supplyIncentiveApyInfo?.rewardCoin;
1262
1260
  if (!Array.isArray(rewardCoins) || rewardCoins.length === 0) continue;
1263
1261
  const rewardType = rewardCoins[0];
1264
- const supplyBal = compoundBalance(state.supplyBalance, pool.currentSupplyIndex, pool);
1265
- const price = pool.token?.price ?? 0;
1266
- const depositUsd = supplyBal * price;
1267
- const annualRewardUsd = depositUsd * (boostedApr / 100);
1268
- const estimatedUsd = annualRewardUsd / 365;
1269
- rewardTotals.set(rewardType, (rewardTotals.get(rewardType) ?? 0) + estimatedUsd);
1270
- }
1271
- for (const [coinType, dailyUsd] of rewardTotals) {
1272
- if (dailyUsd < 1e-3) continue;
1262
+ const assetSymbol = resolvePoolSymbol(pool);
1273
1263
  rewards.push({
1274
1264
  protocol: "navi",
1275
- coinType,
1276
- symbol: REWARD_SYMBOLS[coinType] ?? coinType.split("::").pop() ?? "UNKNOWN",
1265
+ asset: assetSymbol,
1266
+ coinType: rewardType,
1267
+ symbol: REWARD_SYMBOLS[rewardType] ?? rewardType.split("::").pop() ?? "UNKNOWN",
1277
1268
  amount: 0,
1278
- estimatedValueUsd: dailyUsd
1269
+ estimatedValueUsd: 0
1279
1270
  });
1280
1271
  }
1281
1272
  return rewards;
@@ -1336,6 +1327,7 @@ async function addClaimRewardsToTx(tx, client, address) {
1336
1327
  tx.transferObjects([coin], address);
1337
1328
  claimed.push({
1338
1329
  protocol: "navi",
1330
+ asset: assets.join(", "),
1339
1331
  coinType: rewardType,
1340
1332
  symbol: REWARD_SYMBOLS[rewardType] ?? "UNKNOWN",
1341
1333
  amount: 0,
@@ -2696,46 +2688,24 @@ var SuilendAdapter = class {
2696
2688
  this.fetchObligation(caps[0].obligationId)
2697
2689
  ]);
2698
2690
  const rewards = [];
2699
- const rewardEstimates = /* @__PURE__ */ new Map();
2700
2691
  for (const dep of obligation.deposits) {
2701
2692
  const reserve = reserves[dep.reserveIdx];
2702
2693
  if (!reserve) continue;
2703
- const ratio = cTokenRatio(reserve);
2704
- const amount = dep.ctokenAmount * ratio / 10 ** reserve.mintDecimals;
2705
- const price = reserve.price;
2706
- const depositUsd = amount * price;
2707
2694
  for (const rw of reserve.depositPoolRewards) {
2708
2695
  if (!this.isClaimableReward(rw.coinType)) continue;
2709
- const rewardReserve = reserves.find((r) => {
2710
- try {
2711
- return normalizeStructTag(r.coinType) === normalizeStructTag(rw.coinType);
2712
- } catch {
2713
- return false;
2714
- }
2715
- });
2716
- const rewardPrice = rewardReserve?.price ?? 0;
2717
- const rewardDecimals = rewardReserve?.mintDecimals ?? 9;
2718
2696
  const durationMs = rw.endTimeMs - rw.startTimeMs;
2719
2697
  if (durationMs <= 0) continue;
2720
- const annualTokens = rw.totalRewards / 10 ** rewardDecimals * (MS_PER_YEAR / durationMs);
2721
- const totalDepositValue = reserve.depositTotalShares / 10 ** reserve.mintDecimals * price;
2722
- if (totalDepositValue <= 0) continue;
2723
- const userShare = depositUsd / totalDepositValue;
2724
- const dailyRewardUsd = annualTokens * rewardPrice / 365 * userShare;
2725
- rewardEstimates.set(rw.coinType, (rewardEstimates.get(rw.coinType) ?? 0) + dailyRewardUsd);
2698
+ const assetSymbol = this.resolveSymbol(reserve.coinType);
2699
+ rewards.push({
2700
+ protocol: "suilend",
2701
+ asset: assetSymbol,
2702
+ coinType: rw.coinType,
2703
+ symbol: rw.coinType.includes("spring_sui") ? "sSUI" : rw.coinType.includes("deep::") ? "DEEP" : rw.coinType.split("::").pop() ?? "UNKNOWN",
2704
+ amount: 0,
2705
+ estimatedValueUsd: 0
2706
+ });
2726
2707
  }
2727
2708
  }
2728
- for (const [coinType, dailyUsd] of rewardEstimates) {
2729
- if (dailyUsd < 1e-3) continue;
2730
- const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2731
- rewards.push({
2732
- protocol: "suilend",
2733
- coinType,
2734
- symbol,
2735
- amount: 0,
2736
- estimatedValueUsd: dailyUsd
2737
- });
2738
- }
2739
2709
  return rewards;
2740
2710
  }
2741
2711
  async addClaimRewardsToTx(tx, address) {
@@ -2778,6 +2748,7 @@ var SuilendAdapter = class {
2778
2748
  const symbol = coinType.includes("spring_sui") ? "SPRING_SUI" : coinType.includes("deep::") ? "DEEP" : coinType.split("::").pop() ?? "UNKNOWN";
2779
2749
  claimed.push({
2780
2750
  protocol: "suilend",
2751
+ asset: "",
2781
2752
  coinType,
2782
2753
  symbol,
2783
2754
  amount: 0,