@t2000/sdk 0.20.1 → 0.20.2

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
@@ -6,6 +6,7 @@ export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H
6
6
  import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-MP_J_nSO.cjs';
7
7
  export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-MP_J_nSO.cjs';
8
8
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
9
+ import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
9
10
 
10
11
  /**
11
12
  * Abstract signing interface that decouples the SDK from any specific
@@ -396,6 +397,74 @@ declare function getSwapQuote(params: {
396
397
  byAmountIn?: boolean;
397
398
  }): Promise<SwapQuoteResult>;
398
399
 
400
+ /**
401
+ * Cetus Aggregator V3 SDK wrapper — the ONLY file that imports @cetusprotocol/aggregator-sdk.
402
+ * Documented CLAUDE.md exception: multi-DEX routing cannot be feasibly replaced by thin tx builders.
403
+ */
404
+
405
+ interface SwapRouteResult {
406
+ routerData: RouterDataV3;
407
+ amountIn: string;
408
+ amountOut: string;
409
+ byAmountIn: boolean;
410
+ priceImpact: number;
411
+ insufficientLiquidity: boolean;
412
+ }
413
+ /**
414
+ * Find the optimal swap route via Cetus Aggregator REST API.
415
+ */
416
+ declare function findSwapRoute(params: {
417
+ walletAddress: string;
418
+ from: string;
419
+ to: string;
420
+ amount: bigint;
421
+ byAmountIn: boolean;
422
+ }): Promise<SwapRouteResult | null>;
423
+ /**
424
+ * Build a swap PTB from a route result. The caller must provide an input coin
425
+ * obtained by splitting/merging wallet coins.
426
+ */
427
+ declare function buildSwapTx(params: {
428
+ walletAddress: string;
429
+ route: SwapRouteResult;
430
+ tx: Transaction;
431
+ inputCoin: TransactionObjectArgument;
432
+ slippage: number;
433
+ }): Promise<TransactionObjectArgument>;
434
+ declare const TOKEN_MAP: Record<string, string>;
435
+ /**
436
+ * Resolve a user-friendly token name ("SUI", "USDC") to its full coin type string.
437
+ * Returns the input unchanged if already a full coin type (contains "::").
438
+ */
439
+ declare function resolveTokenType(nameOrType: string): string | null;
440
+
441
+ /**
442
+ * VOLO vSUI liquid staking — thin transaction builders.
443
+ * No SDK dependency. Two Move calls, immutable contract addresses.
444
+ */
445
+
446
+ declare const VOLO_PKG = "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20";
447
+ declare const VOLO_POOL = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
448
+ declare const VOLO_METADATA = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
449
+ declare const VSUI_TYPE = "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT";
450
+ interface VoloStats {
451
+ apy: number;
452
+ exchangeRate: number;
453
+ tvl: number;
454
+ }
455
+ /**
456
+ * Fetch VOLO vSUI staking stats (APY, exchange rate, TVL).
457
+ */
458
+ declare function getVoloStats(): Promise<VoloStats>;
459
+ /**
460
+ * Build a PTB to stake SUI for vSUI.
461
+ */
462
+ declare function buildStakeVSuiTx(_client: SuiJsonRpcClient, address: string, amountMist: bigint): Promise<Transaction>;
463
+ /**
464
+ * Build a PTB to unstake vSUI back to SUI.
465
+ */
466
+ declare function buildUnstakeVSuiTx(client: SuiJsonRpcClient, address: string, amountMist: bigint | 'all'): Promise<Transaction>;
467
+
399
468
  type SafeguardRule = 'locked' | 'maxPerTx' | 'maxDailySend';
400
469
  interface SafeguardErrorDetails {
401
470
  attempted?: number;
@@ -466,4 +535,4 @@ interface GasStatusResponse {
466
535
  }
467
536
  declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
468
537
 
469
- export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
538
+ export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H
6
6
  import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-D1DxZ1DK.js';
7
7
  export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-D1DxZ1DK.js';
8
8
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
9
+ import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
9
10
 
10
11
  /**
11
12
  * Abstract signing interface that decouples the SDK from any specific
@@ -396,6 +397,74 @@ declare function getSwapQuote(params: {
396
397
  byAmountIn?: boolean;
397
398
  }): Promise<SwapQuoteResult>;
398
399
 
400
+ /**
401
+ * Cetus Aggregator V3 SDK wrapper — the ONLY file that imports @cetusprotocol/aggregator-sdk.
402
+ * Documented CLAUDE.md exception: multi-DEX routing cannot be feasibly replaced by thin tx builders.
403
+ */
404
+
405
+ interface SwapRouteResult {
406
+ routerData: RouterDataV3;
407
+ amountIn: string;
408
+ amountOut: string;
409
+ byAmountIn: boolean;
410
+ priceImpact: number;
411
+ insufficientLiquidity: boolean;
412
+ }
413
+ /**
414
+ * Find the optimal swap route via Cetus Aggregator REST API.
415
+ */
416
+ declare function findSwapRoute(params: {
417
+ walletAddress: string;
418
+ from: string;
419
+ to: string;
420
+ amount: bigint;
421
+ byAmountIn: boolean;
422
+ }): Promise<SwapRouteResult | null>;
423
+ /**
424
+ * Build a swap PTB from a route result. The caller must provide an input coin
425
+ * obtained by splitting/merging wallet coins.
426
+ */
427
+ declare function buildSwapTx(params: {
428
+ walletAddress: string;
429
+ route: SwapRouteResult;
430
+ tx: Transaction;
431
+ inputCoin: TransactionObjectArgument;
432
+ slippage: number;
433
+ }): Promise<TransactionObjectArgument>;
434
+ declare const TOKEN_MAP: Record<string, string>;
435
+ /**
436
+ * Resolve a user-friendly token name ("SUI", "USDC") to its full coin type string.
437
+ * Returns the input unchanged if already a full coin type (contains "::").
438
+ */
439
+ declare function resolveTokenType(nameOrType: string): string | null;
440
+
441
+ /**
442
+ * VOLO vSUI liquid staking — thin transaction builders.
443
+ * No SDK dependency. Two Move calls, immutable contract addresses.
444
+ */
445
+
446
+ declare const VOLO_PKG = "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20";
447
+ declare const VOLO_POOL = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
448
+ declare const VOLO_METADATA = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
449
+ declare const VSUI_TYPE = "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT";
450
+ interface VoloStats {
451
+ apy: number;
452
+ exchangeRate: number;
453
+ tvl: number;
454
+ }
455
+ /**
456
+ * Fetch VOLO vSUI staking stats (APY, exchange rate, TVL).
457
+ */
458
+ declare function getVoloStats(): Promise<VoloStats>;
459
+ /**
460
+ * Build a PTB to stake SUI for vSUI.
461
+ */
462
+ declare function buildStakeVSuiTx(_client: SuiJsonRpcClient, address: string, amountMist: bigint): Promise<Transaction>;
463
+ /**
464
+ * Build a PTB to unstake vSUI back to SUI.
465
+ */
466
+ declare function buildUnstakeVSuiTx(client: SuiJsonRpcClient, address: string, amountMist: bigint | 'all'): Promise<Transaction>;
467
+
399
468
  type SafeguardRule = 'locked' | 'maxPerTx' | 'maxDailySend';
400
469
  interface SafeguardErrorDetails {
401
470
  attempted?: number;
@@ -466,4 +535,4 @@ interface GasStatusResponse {
466
535
  }
467
536
  declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
468
537
 
469
- export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
538
+ export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
package/dist/index.js CHANGED
@@ -3202,6 +3202,10 @@ async function getSwapQuote(params) {
3202
3202
  };
3203
3203
  }
3204
3204
 
3205
- export { BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, GAS_RESERVE_MIN, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, USDC_DECIMALS, ZkLoginSigner, addCollectFeeToTx, allDescriptors, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
3205
+ // src/index.ts
3206
+ init_cetus_swap();
3207
+ init_volo();
3208
+
3209
+ export { BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, GAS_RESERVE_MIN, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
3206
3210
  //# sourceMappingURL=index.js.map
3207
3211
  //# sourceMappingURL=index.js.map