@t2000/sdk 0.17.3 → 0.17.5

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
@@ -3366,6 +3366,10 @@ var AutoInvestManager = class {
3366
3366
  this.save();
3367
3367
  }
3368
3368
  };
3369
+ var LOW_LIQUIDITY_ASSETS = /* @__PURE__ */ new Set(["GOLD"]);
3370
+ function defaultSlippage(asset) {
3371
+ return LOW_LIQUIDITY_ASSETS.has(asset) ? 0.05 : 0.03;
3372
+ }
3369
3373
  var DEFAULT_CONFIG_DIR = path.join(os.homedir(), ".t2000");
3370
3374
  var T2000 = class _T2000 extends eventemitter3.EventEmitter {
3371
3375
  keypair;
@@ -4281,7 +4285,7 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
4281
4285
  from: "USDC",
4282
4286
  to: params.asset,
4283
4287
  amount: params.usdAmount,
4284
- maxSlippage: params.maxSlippage ?? 0.03,
4288
+ maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset),
4285
4289
  _bypassInvestmentGuard: true
4286
4290
  });
4287
4291
  if (swapResult.toAmount === 0) {
@@ -4382,7 +4386,7 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
4382
4386
  from: params.asset,
4383
4387
  to: "USDC",
4384
4388
  amount: sellAmountAsset,
4385
- maxSlippage: params.maxSlippage ?? 0.03,
4389
+ maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset),
4386
4390
  _bypassInvestmentGuard: true
4387
4391
  });
4388
4392
  const price = swapResult.toAmount / sellAmountAsset;
@@ -4445,7 +4449,16 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
4445
4449
  const gasReserve = params.asset === "SUI" ? GAS_RESERVE_MIN : 0;
4446
4450
  const depositAmount = Math.max(0, walletAmount - gasReserve);
4447
4451
  if (pos.earning && depositAmount <= 0) {
4448
- throw new T2000Error("INVEST_ALREADY_EARNING", `${params.asset} is already earning via ${pos.earningProtocol}`);
4452
+ return {
4453
+ success: true,
4454
+ tx: "",
4455
+ asset: params.asset,
4456
+ amount: 0,
4457
+ protocol: pos.earningProtocol ?? "unknown",
4458
+ apy: pos.earningApy ?? 0,
4459
+ gasCost: 0,
4460
+ gasMethod: "none"
4461
+ };
4449
4462
  }
4450
4463
  if (depositAmount <= 0) {
4451
4464
  throw new T2000Error("INSUFFICIENT_BALANCE", `No ${params.asset} available to deposit (wallet: ${walletAmount}, gas reserve: ${gasReserve})`);