@t2000/sdk 3.2.0 → 3.3.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/README.md +1 -4
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/index.cjs +10 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -135
- package/dist/index.d.ts +17 -135
- package/dist/index.js +12 -233
- package/dist/index.js.map +1 -1
- package/dist/{types-Bh_0d-te.d.cts → types-C1DH4kPA.d.cts} +1 -1
- package/dist/{types-BmgPRlnq.d.ts → types-DjeENMuV.d.ts} +1 -1
- package/dist/{types-Bk7NncQ_.d.cts → types-HJGbXJ37.d.cts} +1 -16
- package/dist/{types-Bk7NncQ_.d.ts → types-HJGbXJ37.d.ts} +1 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,8 +99,6 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
99
99
|
| `agent.borrow({ amount, asset? })` | Borrow **USDC or USDsui** against collateral (v0.51.0+). `asset` defaults to `'USDC'`. | `BorrowResult` |
|
|
100
100
|
| `agent.repay({ amount, asset? })` | Repay outstanding **USDC or USDsui** debt (v0.51.1+). Pass `asset` to target a specific debt; omit for highest-APY repay. **Symmetry enforced:** USDsui debt is repaid with USDsui coins (and USDC with USDC). `amount` can be `'all'`. | `RepayResult` |
|
|
101
101
|
| `agent.swap({ from, to, amount, slippage? })` | Swap tokens via Cetus Aggregator (20+ DEXs). User-friendly names or full coin types. | `SwapResult` |
|
|
102
|
-
| `agent.stakeVSui({ amount })` | Stake SUI for vSUI via VOLO liquid staking (min 1 SUI) | `StakeVSuiResult` |
|
|
103
|
-
| `agent.unstakeVSui({ amount })` | Unstake vSUI back to SUI. `amount` can be `'all'`. | `UnstakeVSuiResult` |
|
|
104
102
|
| `agent.exportKey()` | Export private key (bech32 format) | `string` |
|
|
105
103
|
|
|
106
104
|
### Query Methods
|
|
@@ -309,7 +307,6 @@ t2000 uses an MCP-first integration model: NAVI MCP for reads, thin transaction
|
|
|
309
307
|
|----------|------------|----------|
|
|
310
308
|
| NAVI | MCP (reads) + thin tx builders (writes) | Lending positions, deposits, withdrawals, borrows, rewards |
|
|
311
309
|
| Cetus Aggregator V3 | `@cetusprotocol/aggregator-sdk` (isolated) | Multi-DEX swap routing — overlay fee on swaps (`cetus-swap.ts`) |
|
|
312
|
-
| VOLO | Thin tx builders (direct Move calls) | Stake SUI → vSUI, unstake vSUI → SUI |
|
|
313
310
|
|
|
314
311
|
## Testing
|
|
315
312
|
|
|
@@ -332,7 +329,7 @@ Fees only apply when the **Audric** consumer app calls these primitives. Audric
|
|
|
332
329
|
| Save (deposit) | 0.10% | Free | USDC only; USDsui save is free in Audric too |
|
|
333
330
|
| Borrow | 0.05% | Free | USDC only; USDsui borrow is free in Audric too |
|
|
334
331
|
| Swap | 0.10% | Free | Audric passes Cetus `overlayFee`. CLI omits it. Cetus Aggregator network fees still apply both ways. |
|
|
335
|
-
| Withdraw / Repay / Send / Receive /
|
|
332
|
+
| Withdraw / Repay / Send / Receive / Pay (MPP) | Free | Free | No surcharge anywhere. |
|
|
336
333
|
|
|
337
334
|
How Audric collects fees: `prepare/route.ts` calls `addFeeTransfer(tx, paymentCoin, FEE_BPS, T2000_OVERLAY_FEE_WALLET, amount)` for save/borrow and passes `overlayFee.receiver = T2000_OVERLAY_FEE_WALLET` for swaps. Both flows produce a USDC transfer to the treasury wallet inside the same atomic Payment Intent. The t2000 server-side indexer detects the on-chain USDC inflow and records a `ProtocolFeeLedger` row — no off-chain submission is involved.
|
|
338
335
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DqIb4AnV.cjs';
|
|
2
2
|
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DqIb4AnV.cjs';
|
|
3
|
-
import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-HJGbXJ37.cjs';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
import '@cetusprotocol/aggregator-sdk';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DqIb4AnV.js';
|
|
2
2
|
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DqIb4AnV.js';
|
|
3
|
-
import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-HJGbXJ37.js';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
import '@cetusprotocol/aggregator-sdk';
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SafeguardConfig, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, v as SupportedAsset, T as T2000Error, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, H as TransactionSigner, J as TxDirection, Q as TxMetadata, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, _ as ZkLoginProof, $ as ZkLoginSigner, a0 as addFeeTransfer, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, am as parseSuiRpcTx, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, as as stableToRaw, at as suiToMist, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SafeguardConfig, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, v as SupportedAsset, T as T2000Error, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, H as TransactionSigner, J as TxDirection, Q as TxMetadata, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, _ as ZkLoginProof, $ as ZkLoginSigner, a0 as addFeeTransfer, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, am as parseSuiRpcTx, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, as as stableToRaw, at as suiToMist, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-C1DH4kPA.cjs';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-HJGbXJ37.cjs';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SafeguardConfig, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, v as SupportedAsset, T as T2000Error, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, H as TransactionSigner, J as TxDirection, Q as TxMetadata, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, _ as ZkLoginProof, $ as ZkLoginSigner, a0 as addFeeTransfer, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, am as parseSuiRpcTx, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, as as stableToRaw, at as suiToMist, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SafeguardConfig, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, v as SupportedAsset, T as T2000Error, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, H as TransactionSigner, J as TxDirection, Q as TxMetadata, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, _ as ZkLoginProof, $ as ZkLoginSigner, a0 as addFeeTransfer, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, am as parseSuiRpcTx, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, as as stableToRaw, at as suiToMist, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-DjeENMuV.js';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-HJGbXJ37.js';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
package/dist/index.cjs
CHANGED
|
@@ -651,155 +651,6 @@ var require_lodash = __commonJS({
|
|
|
651
651
|
}
|
|
652
652
|
});
|
|
653
653
|
|
|
654
|
-
// src/protocols/volo.ts
|
|
655
|
-
var volo_exports = {};
|
|
656
|
-
__export(volo_exports, {
|
|
657
|
-
MIN_STAKE_MIST: () => MIN_STAKE_MIST,
|
|
658
|
-
SUI_SYSTEM_STATE: () => SUI_SYSTEM_STATE,
|
|
659
|
-
VOLO_METADATA: () => exports.VOLO_METADATA,
|
|
660
|
-
VOLO_PKG: () => exports.VOLO_PKG,
|
|
661
|
-
VOLO_POOL: () => exports.VOLO_POOL,
|
|
662
|
-
VSUI_TYPE: () => exports.VSUI_TYPE,
|
|
663
|
-
addStakeVSuiToTx: () => addStakeVSuiToTx,
|
|
664
|
-
addUnstakeVSuiToTx: () => addUnstakeVSuiToTx,
|
|
665
|
-
buildStakeVSuiTx: () => buildStakeVSuiTx,
|
|
666
|
-
buildUnstakeVSuiTx: () => buildUnstakeVSuiTx,
|
|
667
|
-
getVoloStats: () => getVoloStats
|
|
668
|
-
});
|
|
669
|
-
async function getVoloStats() {
|
|
670
|
-
const res = await fetch(VOLO_STATS_URL, {
|
|
671
|
-
signal: AbortSignal.timeout(8e3)
|
|
672
|
-
});
|
|
673
|
-
if (!res.ok) {
|
|
674
|
-
throw new Error(`VOLO stats API error: HTTP ${res.status}`);
|
|
675
|
-
}
|
|
676
|
-
const data = await res.json();
|
|
677
|
-
const d = data.data ?? data;
|
|
678
|
-
return {
|
|
679
|
-
apy: d.apy ?? 0,
|
|
680
|
-
exchangeRate: d.exchange_rate ?? d.exchangeRate ?? 1,
|
|
681
|
-
tvl: d.tvl ?? 0
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
async function buildStakeVSuiTx(_client, address, amountMist) {
|
|
685
|
-
if (amountMist < MIN_STAKE_MIST) {
|
|
686
|
-
throw new Error(`Minimum stake is 1 SUI (${MIN_STAKE_MIST} MIST). Got: ${amountMist}`);
|
|
687
|
-
}
|
|
688
|
-
const tx = new transactions.Transaction();
|
|
689
|
-
tx.setSender(address);
|
|
690
|
-
const [suiCoin] = tx.splitCoins(tx.gas, [amountMist]);
|
|
691
|
-
const [vSuiCoin] = tx.moveCall({
|
|
692
|
-
target: `${exports.VOLO_PKG}::stake_pool::stake`,
|
|
693
|
-
arguments: [
|
|
694
|
-
tx.object(exports.VOLO_POOL),
|
|
695
|
-
tx.object(exports.VOLO_METADATA),
|
|
696
|
-
tx.object(SUI_SYSTEM_STATE),
|
|
697
|
-
suiCoin
|
|
698
|
-
]
|
|
699
|
-
});
|
|
700
|
-
tx.transferObjects([vSuiCoin], address);
|
|
701
|
-
return tx;
|
|
702
|
-
}
|
|
703
|
-
async function buildUnstakeVSuiTx(client, address, amountMist) {
|
|
704
|
-
const balResp = await client.getBalance({ owner: address, coinType: exports.VSUI_TYPE });
|
|
705
|
-
const totalBalance = BigInt(balResp.totalBalance);
|
|
706
|
-
if (totalBalance === 0n) {
|
|
707
|
-
throw new Error("No vSUI found in wallet.");
|
|
708
|
-
}
|
|
709
|
-
const tx = new transactions.Transaction();
|
|
710
|
-
tx.setSender(address);
|
|
711
|
-
const requested = amountMist === "all" ? totalBalance : amountMist;
|
|
712
|
-
if (requested > totalBalance) {
|
|
713
|
-
throw new Error(`Insufficient vSUI: need ${requested} MIST, have ${totalBalance}`);
|
|
714
|
-
}
|
|
715
|
-
const vSuiCoin = transactions.coinWithBalance({ type: exports.VSUI_TYPE, balance: requested })(tx);
|
|
716
|
-
const [suiCoin] = tx.moveCall({
|
|
717
|
-
target: `${exports.VOLO_PKG}::stake_pool::unstake`,
|
|
718
|
-
arguments: [
|
|
719
|
-
tx.object(exports.VOLO_POOL),
|
|
720
|
-
tx.object(exports.VOLO_METADATA),
|
|
721
|
-
tx.object(SUI_SYSTEM_STATE),
|
|
722
|
-
vSuiCoin
|
|
723
|
-
]
|
|
724
|
-
});
|
|
725
|
-
tx.transferObjects([suiCoin], address);
|
|
726
|
-
return tx;
|
|
727
|
-
}
|
|
728
|
-
async function addStakeVSuiToTx(tx, client, address, input) {
|
|
729
|
-
if (input.amountMist < MIN_STAKE_MIST) {
|
|
730
|
-
throw new Error(`Minimum stake is 1 SUI (${MIN_STAKE_MIST} MIST). Got: ${input.amountMist}`);
|
|
731
|
-
}
|
|
732
|
-
let suiCoin;
|
|
733
|
-
if (input.inputCoin) {
|
|
734
|
-
suiCoin = input.inputCoin;
|
|
735
|
-
} else {
|
|
736
|
-
const balResp = await client.getBalance({ owner: address, coinType: exports.SUI_TYPE });
|
|
737
|
-
const totalBalance = BigInt(balResp.totalBalance);
|
|
738
|
-
if (totalBalance < input.amountMist) {
|
|
739
|
-
throw new Error(`Insufficient SUI: need ${input.amountMist} MIST, have ${totalBalance}`);
|
|
740
|
-
}
|
|
741
|
-
suiCoin = transactions.coinWithBalance({
|
|
742
|
-
type: exports.SUI_TYPE,
|
|
743
|
-
balance: input.amountMist,
|
|
744
|
-
useGasCoin: false
|
|
745
|
-
})(tx);
|
|
746
|
-
}
|
|
747
|
-
const [vSuiCoin] = tx.moveCall({
|
|
748
|
-
target: `${exports.VOLO_PKG}::stake_pool::stake`,
|
|
749
|
-
arguments: [
|
|
750
|
-
tx.object(exports.VOLO_POOL),
|
|
751
|
-
tx.object(exports.VOLO_METADATA),
|
|
752
|
-
tx.object(SUI_SYSTEM_STATE),
|
|
753
|
-
suiCoin
|
|
754
|
-
]
|
|
755
|
-
});
|
|
756
|
-
return { coin: vSuiCoin, effectiveAmountMist: input.amountMist };
|
|
757
|
-
}
|
|
758
|
-
async function addUnstakeVSuiToTx(tx, client, address, input) {
|
|
759
|
-
let vSuiCoin;
|
|
760
|
-
if (input.inputCoin) {
|
|
761
|
-
if (input.amountMist === "all") {
|
|
762
|
-
vSuiCoin = input.inputCoin;
|
|
763
|
-
} else {
|
|
764
|
-
[vSuiCoin] = tx.splitCoins(input.inputCoin, [input.amountMist]);
|
|
765
|
-
}
|
|
766
|
-
} else {
|
|
767
|
-
const balResp = await client.getBalance({ owner: address, coinType: exports.VSUI_TYPE });
|
|
768
|
-
const totalBalance = BigInt(balResp.totalBalance);
|
|
769
|
-
if (totalBalance === 0n) {
|
|
770
|
-
throw new Error("No vSUI found in wallet.");
|
|
771
|
-
}
|
|
772
|
-
const requested = input.amountMist === "all" ? totalBalance : input.amountMist;
|
|
773
|
-
if (requested > totalBalance) {
|
|
774
|
-
throw new Error(`Insufficient vSUI: need ${requested} MIST, have ${totalBalance}`);
|
|
775
|
-
}
|
|
776
|
-
vSuiCoin = transactions.coinWithBalance({ type: exports.VSUI_TYPE, balance: requested })(tx);
|
|
777
|
-
}
|
|
778
|
-
const [suiCoin] = tx.moveCall({
|
|
779
|
-
target: `${exports.VOLO_PKG}::stake_pool::unstake`,
|
|
780
|
-
arguments: [
|
|
781
|
-
tx.object(exports.VOLO_POOL),
|
|
782
|
-
tx.object(exports.VOLO_METADATA),
|
|
783
|
-
tx.object(SUI_SYSTEM_STATE),
|
|
784
|
-
vSuiCoin
|
|
785
|
-
]
|
|
786
|
-
});
|
|
787
|
-
return { coin: suiCoin, effectiveAmountMist: input.amountMist };
|
|
788
|
-
}
|
|
789
|
-
exports.VOLO_PKG = void 0; exports.VOLO_POOL = void 0; exports.VOLO_METADATA = void 0; exports.VSUI_TYPE = void 0; var SUI_SYSTEM_STATE, MIN_STAKE_MIST, VOLO_STATS_URL;
|
|
790
|
-
var init_volo = __esm({
|
|
791
|
-
"src/protocols/volo.ts"() {
|
|
792
|
-
init_token_registry();
|
|
793
|
-
exports.VOLO_PKG = "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20";
|
|
794
|
-
exports.VOLO_POOL = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
|
|
795
|
-
exports.VOLO_METADATA = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
|
|
796
|
-
exports.VSUI_TYPE = "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT";
|
|
797
|
-
SUI_SYSTEM_STATE = "0x05";
|
|
798
|
-
MIN_STAKE_MIST = 1000000000n;
|
|
799
|
-
VOLO_STATS_URL = "https://open-api.naviprotocol.io/api/volo/stats";
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
|
-
|
|
803
654
|
// src/wallet/coinSelection.ts
|
|
804
655
|
var coinSelection_exports = {};
|
|
805
656
|
__export(coinSelection_exports, {
|
|
@@ -6705,51 +6556,14 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
6705
6556
|
receipt: paymentDigest ? { reference: paymentDigest, timestamp: (/* @__PURE__ */ new Date()).toISOString() } : void 0
|
|
6706
6557
|
};
|
|
6707
6558
|
}
|
|
6708
|
-
//
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
});
|
|
6717
|
-
const vSuiReceived = params.amount / stats.exchangeRate;
|
|
6718
|
-
return {
|
|
6719
|
-
success: true,
|
|
6720
|
-
tx: gasResult.digest,
|
|
6721
|
-
amountSui: params.amount,
|
|
6722
|
-
vSuiReceived,
|
|
6723
|
-
apy: stats.apy,
|
|
6724
|
-
gasCost: gasResult.gasCostSui
|
|
6725
|
-
};
|
|
6726
|
-
}
|
|
6727
|
-
async unstakeVSui(params) {
|
|
6728
|
-
this.enforcer.assertNotLocked();
|
|
6729
|
-
const { buildUnstakeVSuiTx: buildUnstakeVSuiTx2, getVoloStats: getVoloStats2, VSUI_TYPE: VSUI_TYPE2 } = await Promise.resolve().then(() => (init_volo(), volo_exports));
|
|
6730
|
-
let amountMist;
|
|
6731
|
-
let vSuiAmount;
|
|
6732
|
-
if (params.amount === "all") {
|
|
6733
|
-
amountMist = "all";
|
|
6734
|
-
const bal = await this.client.getBalance({ owner: this._address, coinType: VSUI_TYPE2 });
|
|
6735
|
-
vSuiAmount = Number(bal.totalBalance) / 1e9;
|
|
6736
|
-
} else {
|
|
6737
|
-
amountMist = BigInt(Math.floor(params.amount * 1e9));
|
|
6738
|
-
vSuiAmount = params.amount;
|
|
6739
|
-
}
|
|
6740
|
-
const stats = await getVoloStats2();
|
|
6741
|
-
const gasResult = await executeTx(this.client, this._signer, async () => {
|
|
6742
|
-
return buildUnstakeVSuiTx2(this.client, this._address, amountMist);
|
|
6743
|
-
});
|
|
6744
|
-
const suiReceived = vSuiAmount * stats.exchangeRate;
|
|
6745
|
-
return {
|
|
6746
|
-
success: true,
|
|
6747
|
-
tx: gasResult.digest,
|
|
6748
|
-
vSuiAmount,
|
|
6749
|
-
suiReceived,
|
|
6750
|
-
gasCost: gasResult.gasCostSui
|
|
6751
|
-
};
|
|
6752
|
-
}
|
|
6559
|
+
// [S.323 / 2026-05-25] VOLO vSUI staking surfaces removed (full cut).
|
|
6560
|
+
// Engine cut Volo in S.277; SDK + CLI + MCP followed in S.323 because the
|
|
6561
|
+
// product surface (five products: Passport / Intelligence / Finance / Pay
|
|
6562
|
+
// / Store) doesn't include a staking primitive. vSUI still appears in the
|
|
6563
|
+
// codebase as a passive token (NAVI reward rewards, Cetus swap routing),
|
|
6564
|
+
// but there is no longer any way to MINT or REDEEM vSUI through t2000.
|
|
6565
|
+
// History: see spec/archive/v07e/AUDIT_V07E_EARNS_ITS_KEEP_2026-05-23.md
|
|
6566
|
+
// and the S.323 build-tracker entry.
|
|
6753
6567
|
// -- Swap --
|
|
6754
6568
|
async swap(params) {
|
|
6755
6569
|
this.enforcer.assertNotLocked();
|
|
@@ -7976,7 +7790,6 @@ async function buildHarvestRewardsTx(client, address, options = {}) {
|
|
|
7976
7790
|
|
|
7977
7791
|
// src/composeTx.ts
|
|
7978
7792
|
init_cetus_swap();
|
|
7979
|
-
init_volo();
|
|
7980
7793
|
init_coinSelection();
|
|
7981
7794
|
init_token_registry();
|
|
7982
7795
|
init_errors();
|
|
@@ -8200,41 +8013,8 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
8200
8013
|
expectedUsdcDeposited: plan.expectedUsdcDeposited
|
|
8201
8014
|
}
|
|
8202
8015
|
};
|
|
8203
|
-
},
|
|
8204
|
-
volo_stake: async (tx, input, ctx) => {
|
|
8205
|
-
if (input.amountSui <= 0) {
|
|
8206
|
-
throw new exports.T2000Error("INVALID_AMOUNT", "Stake amount must be greater than zero");
|
|
8207
|
-
}
|
|
8208
|
-
const amountMist = BigInt(Math.floor(input.amountSui * 1e9));
|
|
8209
|
-
const result = await addStakeVSuiToTx(tx, ctx.client, ctx.sender, {
|
|
8210
|
-
amountMist,
|
|
8211
|
-
inputCoin: ctx.chainedCoin
|
|
8212
|
-
});
|
|
8213
|
-
if (!ctx.isOutputConsumed) {
|
|
8214
|
-
tx.transferObjects([result.coin], ctx.sender);
|
|
8215
|
-
}
|
|
8216
|
-
return {
|
|
8217
|
-
preview: { toolName: "volo_stake", effectiveAmountMist: result.effectiveAmountMist },
|
|
8218
|
-
outputCoin: result.coin
|
|
8219
|
-
};
|
|
8220
|
-
},
|
|
8221
|
-
volo_unstake: async (tx, input, ctx) => {
|
|
8222
|
-
const amountMist = input.amountVSui === "all" ? "all" : BigInt(Math.floor(input.amountVSui * 1e9));
|
|
8223
|
-
if (amountMist !== "all" && amountMist <= 0n) {
|
|
8224
|
-
throw new exports.T2000Error("INVALID_AMOUNT", "Unstake amount must be greater than zero");
|
|
8225
|
-
}
|
|
8226
|
-
const result = await addUnstakeVSuiToTx(tx, ctx.client, ctx.sender, {
|
|
8227
|
-
amountMist,
|
|
8228
|
-
inputCoin: ctx.chainedCoin
|
|
8229
|
-
});
|
|
8230
|
-
if (!ctx.isOutputConsumed) {
|
|
8231
|
-
tx.transferObjects([result.coin], ctx.sender);
|
|
8232
|
-
}
|
|
8233
|
-
return {
|
|
8234
|
-
preview: { toolName: "volo_unstake", effectiveAmountMist: result.effectiveAmountMist },
|
|
8235
|
-
outputCoin: result.coin
|
|
8236
|
-
};
|
|
8237
8016
|
}
|
|
8017
|
+
// [S.323 / 2026-05-25] volo_stake / volo_unstake appenders removed.
|
|
8238
8018
|
};
|
|
8239
8019
|
function deriveAllowedAddressesFromPtb(tx) {
|
|
8240
8020
|
const addresses = /* @__PURE__ */ new Set();
|
|
@@ -8295,7 +8075,7 @@ async function composeTx(opts) {
|
|
|
8295
8075
|
if (producer.toolName === "save_deposit" || producer.toolName === "repay_debt" || producer.toolName === "send_transfer" || producer.toolName === "claim_rewards") {
|
|
8296
8076
|
throw new exports.T2000Error(
|
|
8297
8077
|
"CHAIN_MODE_INVALID",
|
|
8298
|
-
`Step ${i} (${step.toolName}) references step ${idx} (${producer.toolName}) as producer, but '${producer.toolName}' is a terminal consumer that does not produce a chainable coin handle. Allowed producers: withdraw, borrow, swap_execute
|
|
8078
|
+
`Step ${i} (${step.toolName}) references step ${idx} (${producer.toolName}) as producer, but '${producer.toolName}' is a terminal consumer that does not produce a chainable coin handle. Allowed producers: withdraw, borrow, swap_execute.`
|
|
8299
8079
|
);
|
|
8300
8080
|
}
|
|
8301
8081
|
consumedSteps.add(idx);
|
|
@@ -8515,7 +8295,6 @@ function parseMoveAbort(errorStr) {
|
|
|
8515
8295
|
init_swap_quote();
|
|
8516
8296
|
init_cetus_swap();
|
|
8517
8297
|
init_token_registry();
|
|
8518
|
-
init_volo();
|
|
8519
8298
|
var AUDRIC_PARENT_NAME = "audric.sui";
|
|
8520
8299
|
var AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
|
|
8521
8300
|
var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
@@ -8626,9 +8405,7 @@ exports.ZkLoginSigner = ZkLoginSigner;
|
|
|
8626
8405
|
exports.addClaimRewardsToTx = addClaimRewardsToTx;
|
|
8627
8406
|
exports.addFeeTransfer = addFeeTransfer;
|
|
8628
8407
|
exports.addSendToTx = addSendToTx;
|
|
8629
|
-
exports.addStakeVSuiToTx = addStakeVSuiToTx;
|
|
8630
8408
|
exports.addSwapToTx = addSwapToTx;
|
|
8631
|
-
exports.addUnstakeVSuiToTx = addUnstakeVSuiToTx;
|
|
8632
8409
|
exports.aggregateClaimableRewards = aggregateClaimableRewards;
|
|
8633
8410
|
exports.allDescriptors = allDescriptors;
|
|
8634
8411
|
exports.assertAllowedAsset = assertAllowedAsset;
|
|
@@ -8637,9 +8414,7 @@ exports.buildClaimRewardsTx = buildClaimRewardsTx;
|
|
|
8637
8414
|
exports.buildHarvestRewardsTx = buildHarvestRewardsTx;
|
|
8638
8415
|
exports.buildRevokeLeafTx = buildRevokeLeafTx;
|
|
8639
8416
|
exports.buildSendTx = buildSendTx;
|
|
8640
|
-
exports.buildStakeVSuiTx = buildStakeVSuiTx;
|
|
8641
8417
|
exports.buildSwapTx = buildSwapTx;
|
|
8642
|
-
exports.buildUnstakeVSuiTx = buildUnstakeVSuiTx;
|
|
8643
8418
|
exports.calculateFee = calculateFee;
|
|
8644
8419
|
exports.classifyAction = classifyAction;
|
|
8645
8420
|
exports.classifyLabel = classifyLabel;
|
|
@@ -8672,7 +8447,6 @@ exports.getRates = getRates;
|
|
|
8672
8447
|
exports.getSponsoredSwapProviders = getSponsoredSwapProviders;
|
|
8673
8448
|
exports.getSwapQuote = getSwapQuote;
|
|
8674
8449
|
exports.getTier = getTier;
|
|
8675
|
-
exports.getVoloStats = getVoloStats;
|
|
8676
8450
|
exports.isAllowedAsset = isAllowedAsset;
|
|
8677
8451
|
exports.isCetusRouteFresh = isCetusRouteFresh;
|
|
8678
8452
|
exports.isInRegistry = isInRegistry;
|