@t2000/sdk 0.17.2 → 0.17.4

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 { w as AdapterCapability, x as AdapterPositions, y as AdapterTxResult, C as CetusAdapter, K as HealthInfo, L as LendingAdapter, s as LendingRates, N as NaviAdapter, O as PerpsAdapter, X as ProtocolDescriptor, Y as ProtocolRegistry, $ as SuilendAdapter, d as SwapAdapter, a0 as SwapQuote, a3 as allDescriptors, a4 as cetusDescriptor, a7 as naviDescriptor, aa as sentinelDescriptor, ad as suilendDescriptor } from '../index-BRjfwac2.cjs';
1
+ export { w as AdapterCapability, x as AdapterPositions, y as AdapterTxResult, C as CetusAdapter, K as HealthInfo, L as LendingAdapter, s as LendingRates, N as NaviAdapter, O as PerpsAdapter, X as ProtocolDescriptor, Y as ProtocolRegistry, $ as SuilendAdapter, d as SwapAdapter, a0 as SwapQuote, a3 as allDescriptors, a4 as cetusDescriptor, a7 as naviDescriptor, aa as sentinelDescriptor, ad as suilendDescriptor } from '../index-BzQsrfrc.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 { w as AdapterCapability, x as AdapterPositions, y as AdapterTxResult, C as CetusAdapter, K as HealthInfo, L as LendingAdapter, s as LendingRates, N as NaviAdapter, O as PerpsAdapter, X as ProtocolDescriptor, Y as ProtocolRegistry, $ as SuilendAdapter, d as SwapAdapter, a0 as SwapQuote, a3 as allDescriptors, a4 as cetusDescriptor, a7 as naviDescriptor, aa as sentinelDescriptor, ad as suilendDescriptor } from '../index-BRjfwac2.js';
1
+ export { w as AdapterCapability, x as AdapterPositions, y as AdapterTxResult, C as CetusAdapter, K as HealthInfo, L as LendingAdapter, s as LendingRates, N as NaviAdapter, O as PerpsAdapter, X as ProtocolDescriptor, Y as ProtocolRegistry, $ as SuilendAdapter, d as SwapAdapter, a0 as SwapQuote, a3 as allDescriptors, a4 as cetusDescriptor, a7 as naviDescriptor, aa as sentinelDescriptor, ad as suilendDescriptor } from '../index-BzQsrfrc.js';
2
2
  import '@mysten/sui/transactions';
3
3
  import '@mysten/sui/jsonRpc';
4
4
  import '@mysten/sui/keypairs/ed25519';
@@ -28,7 +28,7 @@ interface BalanceResponse {
28
28
  assets: Record<string, number>;
29
29
  stables: Record<string, number>;
30
30
  }
31
- type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
31
+ type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup' | 'none';
32
32
  interface SendResult {
33
33
  success: boolean;
34
34
  tx: string;
@@ -28,7 +28,7 @@ interface BalanceResponse {
28
28
  assets: Record<string, number>;
29
29
  stables: Record<string, number>;
30
30
  }
31
- type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
31
+ type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup' | 'none';
32
32
  interface SendResult {
33
33
  success: boolean;
34
34
  tx: string;
package/dist/index.cjs CHANGED
@@ -3027,9 +3027,6 @@ var PortfolioManager = class {
3027
3027
  if (!pos || pos.totalAmount <= 0) {
3028
3028
  throw new T2000Error("INSUFFICIENT_INVESTMENT", `No ${asset} position to earn on`);
3029
3029
  }
3030
- if (pos.earning) {
3031
- throw new T2000Error("INVEST_ALREADY_EARNING", `${asset} is already earning via ${pos.earningProtocol}`);
3032
- }
3033
3030
  pos.earning = true;
3034
3031
  pos.earningProtocol = protocol;
3035
3032
  pos.earningApy = apy;
@@ -4448,7 +4445,16 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
4448
4445
  const gasReserve = params.asset === "SUI" ? GAS_RESERVE_MIN : 0;
4449
4446
  const depositAmount = Math.max(0, walletAmount - gasReserve);
4450
4447
  if (pos.earning && depositAmount <= 0) {
4451
- throw new T2000Error("INVEST_ALREADY_EARNING", `${params.asset} is already earning via ${pos.earningProtocol}`);
4448
+ return {
4449
+ success: true,
4450
+ tx: "",
4451
+ asset: params.asset,
4452
+ amount: 0,
4453
+ protocol: pos.earningProtocol ?? "unknown",
4454
+ apy: pos.earningApy ?? 0,
4455
+ gasCost: 0,
4456
+ gasMethod: "none"
4457
+ };
4452
4458
  }
4453
4459
  if (depositAmount <= 0) {
4454
4460
  throw new T2000Error("INSUFFICIENT_BALANCE", `No ${params.asset} available to deposit (wallet: ${walletAmount}, gas reserve: ${gasReserve})`);