@t2000/sdk 0.21.16 → 0.22.0

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,8 +1,8 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, af as SafeguardEnforcer, v as TransactionSigner, Z as ZkLoginProof, r as SupportedAsset } from './token-registry-DIl3H4Jh.cjs';
5
- export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, ag as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, K as KeypairSigner, M as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, i as SUI_DECIMALS, j as SUI_TYPE, k as SUPPORTED_ASSETS, l as SafeguardConfig, m as SafeguardError, n as SafeguardErrorDetails, o as SafeguardRule, p as SimulationResult, q as StableAsset, s as T2000ErrorCode, t as T2000ErrorData, u as TOKEN_MAP, w as TxMetadata, U as USDC_DECIMALS, x as USDC_TYPE, y as USDE_TYPE, z as USDSUI_TYPE, H as USDT_TYPE, W as WAL_TYPE, I as WBTC_TYPE, J as ZkLoginSigner, L as addCollectFeeToTx, Q as calculateFee, R as executeAutoTopUp, V as executeWithGas, X as formatAssetAmount, Y as formatSui, _ as formatUsd, $ as getDecimals, a0 as getDecimalsForCoinType, a1 as getGasStatus, a2 as mapMoveAbortCode, a3 as mapWalletError, a4 as mistToSui, a5 as rawToStable, a6 as rawToUsdc, a7 as resolveSymbol, a8 as resolveTokenType, a9 as shouldAutoTopUp, ah as simulateTransaction, aa as stableToRaw, ab as suiToMist, ai as throwIfSimulationFailed, ac as truncateAddress, ad as usdcToRaw, ae as validateAddress } from './token-registry-DIl3H4Jh.cjs';
4
+ import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-abuw6uo0.cjs';
5
+ export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ao as simulateTransaction, ah as stableToRaw, ai as suiToMist, ap as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-abuw6uo0.cjs';
6
6
  import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.cjs';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from './descriptors-Be4FAgN5.cjs';
8
8
  import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult } from './types-XWEUAS-X.cjs';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, af as SafeguardEnforcer, v as TransactionSigner, Z as ZkLoginProof, r as SupportedAsset } from './token-registry-CVba8FI2.js';
5
- export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, ag as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, K as KeypairSigner, M as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, i as SUI_DECIMALS, j as SUI_TYPE, k as SUPPORTED_ASSETS, l as SafeguardConfig, m as SafeguardError, n as SafeguardErrorDetails, o as SafeguardRule, p as SimulationResult, q as StableAsset, s as T2000ErrorCode, t as T2000ErrorData, u as TOKEN_MAP, w as TxMetadata, U as USDC_DECIMALS, x as USDC_TYPE, y as USDE_TYPE, z as USDSUI_TYPE, H as USDT_TYPE, W as WAL_TYPE, I as WBTC_TYPE, J as ZkLoginSigner, L as addCollectFeeToTx, Q as calculateFee, R as executeAutoTopUp, V as executeWithGas, X as formatAssetAmount, Y as formatSui, _ as formatUsd, $ as getDecimals, a0 as getDecimalsForCoinType, a1 as getGasStatus, a2 as mapMoveAbortCode, a3 as mapWalletError, a4 as mistToSui, a5 as rawToStable, a6 as rawToUsdc, a7 as resolveSymbol, a8 as resolveTokenType, a9 as shouldAutoTopUp, ah as simulateTransaction, aa as stableToRaw, ab as suiToMist, ai as throwIfSimulationFailed, ac as truncateAddress, ad as usdcToRaw, ae as validateAddress } from './token-registry-CVba8FI2.js';
4
+ import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-BBAPkvGS.js';
5
+ export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ao as simulateTransaction, ah as stableToRaw, ai as suiToMist, ap as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-BBAPkvGS.js';
6
6
  import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.js';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from './descriptors-Be4FAgN5.js';
8
8
  import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult } from './types-XWEUAS-X.js';
package/dist/index.js CHANGED
@@ -112,6 +112,21 @@ var init_errors = __esm({
112
112
  });
113
113
 
114
114
  // src/token-registry.ts
115
+ function isTier1(coinType) {
116
+ const meta = BY_TYPE.get(coinType);
117
+ return meta?.tier === 1;
118
+ }
119
+ function isTier2(coinType) {
120
+ const meta = BY_TYPE.get(coinType);
121
+ return meta?.tier === 2;
122
+ }
123
+ function isSupported(coinType) {
124
+ const meta = BY_TYPE.get(coinType);
125
+ return meta?.tier !== void 0;
126
+ }
127
+ function getTier(coinType) {
128
+ return BY_TYPE.get(coinType)?.tier;
129
+ }
115
130
  function getDecimalsForCoinType(coinType) {
116
131
  const direct = BY_TYPE.get(coinType);
117
132
  if (direct) return direct.decimals;
@@ -140,33 +155,30 @@ function resolveTokenType(nameOrType) {
140
155
  if (nameOrType.includes("::")) return nameOrType;
141
156
  return TOKEN_MAP[nameOrType] ?? TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
142
157
  }
143
- var COIN_REGISTRY, BY_TYPE, TOKEN_MAP, SUI_TYPE, USDC_TYPE, USDT_TYPE, USDSUI_TYPE, USDE_TYPE, ETH_TYPE, WBTC_TYPE, WAL_TYPE, NAVX_TYPE;
158
+ var COIN_REGISTRY, BY_TYPE, TOKEN_MAP, SUI_TYPE, USDC_TYPE, USDT_TYPE, USDSUI_TYPE, USDE_TYPE, ETH_TYPE, WBTC_TYPE, WAL_TYPE, NAVX_TYPE, IKA_TYPE, LOFI_TYPE, MANIFEST_TYPE;
144
159
  var init_token_registry = __esm({
145
160
  "src/token-registry.ts"() {
146
161
  COIN_REGISTRY = {
147
- SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI" },
148
- USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC" },
162
+ // ── Tier 1 Financial layer ──────────────────────────────────────────
163
+ USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC", tier: 1 },
164
+ // ── Tier 2 — Swap assets (13 tokens) ──────────────────────────────────
165
+ SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI", tier: 2 },
166
+ wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC", tier: 2 },
167
+ ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH", tier: 2 },
168
+ GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 6, symbol: "GOLD", tier: 2 },
169
+ DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP", tier: 2 },
170
+ WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL", tier: 2 },
171
+ NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS", tier: 2 },
172
+ IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA", tier: 2 },
173
+ CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS", tier: 2 },
174
+ NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX", tier: 2 },
175
+ vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI", tier: 2 },
176
+ LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI", tier: 2 },
177
+ MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST", tier: 2 },
178
+ // ── Legacy — no tier, kept for display accuracy on existing positions ──
149
179
  USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
150
180
  USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
151
- USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" },
152
- WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL" },
153
- ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH" },
154
- wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC" },
155
- NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX" },
156
- CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS" },
157
- DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP" },
158
- NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS" },
159
- GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 6, symbol: "GOLD" },
160
- MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST" },
161
- vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI" },
162
- haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e136a8bc::hasui::HASUI", decimals: 9, symbol: "haSUI" },
163
- afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI" },
164
- FDUSD: { type: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD", decimals: 6, symbol: "FDUSD" },
165
- AUSD: { type: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD", decimals: 6, symbol: "AUSD" },
166
- BUCK: { type: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK", decimals: 9, symbol: "BUCK" },
167
- BLUB: { type: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB", decimals: 9, symbol: "BLUB" },
168
- SCA: { type: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA", decimals: 9, symbol: "SCA" },
169
- TURBOS: { type: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS", decimals: 9, symbol: "TURBOS" }
181
+ USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" }
170
182
  };
171
183
  BY_TYPE = /* @__PURE__ */ new Map();
172
184
  for (const meta of Object.values(COIN_REGISTRY)) {
@@ -189,6 +201,9 @@ var init_token_registry = __esm({
189
201
  WBTC_TYPE = COIN_REGISTRY.wBTC.type;
190
202
  WAL_TYPE = COIN_REGISTRY.WAL.type;
191
203
  NAVX_TYPE = COIN_REGISTRY.NAVX.type;
204
+ IKA_TYPE = COIN_REGISTRY.IKA.type;
205
+ LOFI_TYPE = COIN_REGISTRY.LOFI.type;
206
+ MANIFEST_TYPE = COIN_REGISTRY.MANIFEST.type;
192
207
  }
193
208
  });
194
209
 
@@ -310,7 +325,9 @@ function getClient(walletAddress) {
310
325
  if (clientInstance) return clientInstance;
311
326
  clientInstance = new AggregatorClient({
312
327
  signer: walletAddress,
313
- env: Env.Mainnet
328
+ env: Env.Mainnet,
329
+ overlayFeeRate: OVERLAY_FEE_RATE,
330
+ overlayFeeReceiver: OVERLAY_FEE_RECEIVER
314
331
  });
315
332
  return clientInstance;
316
333
  }
@@ -367,10 +384,12 @@ async function simulateSwap(params) {
367
384
  return { success: false, error: err instanceof Error ? err.message : String(err) };
368
385
  }
369
386
  }
370
- var clientInstance;
387
+ var OVERLAY_FEE_RATE, OVERLAY_FEE_RECEIVER, clientInstance;
371
388
  var init_cetus_swap = __esm({
372
389
  "src/protocols/cetus-swap.ts"() {
373
390
  init_token_registry();
391
+ OVERLAY_FEE_RATE = 1e-3;
392
+ OVERLAY_FEE_RECEIVER = process.env.T2000_TREASURY_ADDRESS ?? "0x3bb501b8300125dca59019247941a42af6b292a150ce3cfcce9449456be2ec91";
374
393
  clientInstance = null;
375
394
  }
376
395
  });
@@ -442,7 +461,7 @@ var SUPPORTED_ASSETS = {
442
461
  displayName: "XAUM"
443
462
  }
444
463
  };
445
- var STABLE_ASSETS = ["USDC", "USDT", "USDe", "USDsui"];
464
+ var STABLE_ASSETS = ["USDC"];
446
465
  var ALL_NAVI_ASSETS = Object.keys(SUPPORTED_ASSETS);
447
466
  var T2000_PACKAGE_ID = process.env.T2000_PACKAGE_ID ?? "0xab92e9f1fe549ad3d6a52924a73181b45791e76120b975138fac9ec9b75db9f3";
448
467
  var T2000_CONFIG_ID = process.env.T2000_CONFIG_ID ?? "0x408add9aa9322f93cfd87523d8f603006eb8713894f4c460283c58a6888dae8a";
@@ -2586,37 +2605,26 @@ var T2000 = class _T2000 extends EventEmitter {
2586
2605
  // -- Savings --
2587
2606
  async save(params) {
2588
2607
  this.enforcer.assertNotLocked();
2589
- const asset = params.asset ?? "USDC";
2608
+ if (params.asset && params.asset !== "USDC") {
2609
+ throw new T2000Error("INVALID_ASSET", "Only USDC deposits are supported. Swap to USDC first.");
2610
+ }
2611
+ const asset = "USDC";
2590
2612
  const assetInfo = SUPPORTED_ASSETS[asset];
2591
- if (!assetInfo) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unsupported asset: ${asset}`);
2592
- const isStable = STABLE_ASSETS.includes(asset);
2593
2613
  let amount;
2594
2614
  if (params.amount === "all") {
2595
- if (isStable) {
2596
- const bal = await queryBalance(this.client, this._address);
2597
- amount = (bal.available ?? 0) - 1;
2598
- } else if (asset === "SUI") {
2599
- const suiBal = await this.client.getBalance({ owner: this._address, coinType: assetInfo.type });
2600
- const suiAmount = Number(suiBal.totalBalance) / 10 ** assetInfo.decimals;
2601
- amount = suiAmount - 0.15;
2602
- } else {
2603
- const coins = await this._fetchCoins(assetInfo.type);
2604
- const totalRaw = coins.reduce((sum, c) => sum + BigInt(c.balance), 0n);
2605
- amount = Number(totalRaw) / 10 ** assetInfo.decimals;
2606
- }
2615
+ const bal = await queryBalance(this.client, this._address);
2616
+ amount = (bal.available ?? 0) - 1;
2607
2617
  if (amount <= 0) {
2608
- throw new T2000Error("INSUFFICIENT_BALANCE", `No ${asset} available to save`, {
2618
+ throw new T2000Error("INSUFFICIENT_BALANCE", `No USDC available to save`, {
2609
2619
  reason: "insufficient_balance",
2610
2620
  asset
2611
2621
  });
2612
2622
  }
2613
2623
  } else {
2614
2624
  amount = params.amount;
2615
- if (isStable) {
2616
- const bal = await queryBalance(this.client, this._address);
2617
- if (amount > (bal.available ?? 0)) {
2618
- throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient balance. Available: $${(bal.available ?? 0).toFixed(2)}, requested: $${amount.toFixed(2)}`);
2619
- }
2625
+ const bal = await queryBalance(this.client, this._address);
2626
+ if (amount > (bal.available ?? 0)) {
2627
+ throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient balance. Available: $${(bal.available ?? 0).toFixed(2)}, requested: $${amount.toFixed(2)}`);
2620
2628
  }
2621
2629
  }
2622
2630
  const fee = calculateFee("save", amount);
@@ -2627,17 +2635,11 @@ var T2000 = class _T2000 extends EventEmitter {
2627
2635
  if (canPTB) {
2628
2636
  const tx2 = new Transaction();
2629
2637
  tx2.setSender(this._address);
2630
- let inputCoin;
2631
- if (asset === "SUI") {
2632
- const rawAmount = BigInt(Math.floor(saveAmount * 10 ** assetInfo.decimals));
2633
- [inputCoin] = tx2.splitCoins(tx2.gas, [rawAmount]);
2634
- } else {
2635
- const coins = await this._fetchCoins(assetInfo.type);
2636
- if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", `No ${asset} coins found`);
2637
- const merged = this._mergeCoinsInTx(tx2, coins);
2638
- const rawAmount = BigInt(Math.floor(saveAmount * 10 ** assetInfo.decimals));
2639
- [inputCoin] = tx2.splitCoins(merged, [rawAmount]);
2640
- }
2638
+ const coins = await this._fetchCoins(assetInfo.type);
2639
+ if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", "No USDC coins found");
2640
+ const merged = this._mergeCoinsInTx(tx2, coins);
2641
+ const rawAmount = BigInt(Math.floor(saveAmount * 10 ** assetInfo.decimals));
2642
+ const [inputCoin] = tx2.splitCoins(merged, [rawAmount]);
2641
2643
  await adapter.addSaveToTx(tx2, this._address, inputCoin, asset, { collectFee: true });
2642
2644
  return tx2;
2643
2645
  }
@@ -3348,6 +3350,6 @@ init_cetus_swap();
3348
3350
  init_token_registry();
3349
3351
  init_volo();
3350
3352
 
3351
- export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, KeypairSigner, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getDecimalsForCoinType, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
3353
+ export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KeypairSigner, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getDecimalsForCoinType, getGasStatus, getRates, getSwapQuote, getTier, getVoloStats, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
3352
3354
  //# sourceMappingURL=index.js.map
3353
3355
  //# sourceMappingURL=index.js.map