@t2000/sdk 3.1.1 → 3.2.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 +4 -4
- package/dist/adapters/index.cjs +3 -3
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +3 -3
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +91 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +91 -83
- package/dist/index.js.map +1 -1
- package/dist/{types-DOnXJXL2.d.cts → types-Bh_0d-te.d.cts} +4 -2
- package/dist/{types-CfBlFLmU.d.ts → types-BmgPRlnq.d.ts} +4 -2
- package/package.json +2 -2
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 { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ax as CETUS_USDC_SUI_POOL, 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, ay as OPERATION_ASSETS, O as OUTBOUND_OPS, az as Operation, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, 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 ZkLoginSigner, a0 as addFeeTransfer,
|
|
4
|
+
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-Bh_0d-te.cjs';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ax as CETUS_USDC_SUI_POOL, 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, ay as OPERATION_ASSETS, O as OUTBOUND_OPS, az as Operation, P as ProtocolFeeInfo, aA as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aB as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, 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 ZkLoginSigner, a0 as addFeeTransfer, aC as assertAllowedAsset, 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 getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, aE as isAllowedAsset, aF as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aG as normalizeAsset, aH as normalizeCoinType, am as parseSuiRpcTx, aI as queryHistory, aJ as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aK as simulateTransaction, as as stableToRaw, at as suiToMist, aL as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-Bh_0d-te.cjs';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DqIb4AnV.cjs';
|
|
7
7
|
export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DqIb4AnV.cjs';
|
|
8
8
|
import { n as T2000Options, P as PayOptions, d as PayResult, o as StakeVSuiResult, U as UnstakeVSuiResult, p as SwapResult, q as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, r as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, s as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, j as SwapRouteResult, t as FinancialSummary } from './types-Bk7NncQ_.cjs';
|
|
@@ -124,11 +124,20 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
124
124
|
byAmountIn?: boolean;
|
|
125
125
|
slippage?: number;
|
|
126
126
|
}): Promise<SwapResult>;
|
|
127
|
+
/**
|
|
128
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
129
|
+
* Thin wrapper around the standalone `getSwapQuote()`. Pre-Phase 1 this method
|
|
130
|
+
* was ~50 LoC duplicating `swap-quote.ts` — missing `serializedRoute` (SPEC 20.2
|
|
131
|
+
* fast-path) and the `providers` allow-list (Bug A fix / Pyth-dependent
|
|
132
|
+
* provider filter for sponsored callers). Routing both API surfaces through
|
|
133
|
+
* one implementation ensures fixes land for both.
|
|
134
|
+
*/
|
|
127
135
|
swapQuote(params: {
|
|
128
136
|
from: string;
|
|
129
137
|
to: string;
|
|
130
138
|
amount: number;
|
|
131
139
|
byAmountIn?: boolean;
|
|
140
|
+
providers?: string[];
|
|
132
141
|
}): Promise<SwapQuoteResult>;
|
|
133
142
|
address(): string;
|
|
134
143
|
send(params: {
|
|
@@ -173,6 +182,14 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
173
182
|
}): Promise<TransactionRecord[]>;
|
|
174
183
|
transactionDetail(digest: string): Promise<TransactionRecord | null>;
|
|
175
184
|
deposit(): Promise<DepositInfo>;
|
|
185
|
+
/**
|
|
186
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 (CLI rename support) — 2026-05-25]
|
|
187
|
+
* Preferred alias of `deposit()`. The CLI surface is `t2000 fund` post-Phase 1
|
|
188
|
+
* (more intuitive than "deposit" which sounds like a NAVI lending action).
|
|
189
|
+
* `deposit()` stays as the canonical method name for back-compat; it is NOT
|
|
190
|
+
* deprecated. This wrapper exists so SDK consumers can mirror CLI naming.
|
|
191
|
+
*/
|
|
192
|
+
fund(): Promise<DepositInfo>;
|
|
176
193
|
receive(params?: {
|
|
177
194
|
amount?: number;
|
|
178
195
|
currency?: string;
|
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 { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ax as CETUS_USDC_SUI_POOL, 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, ay as OPERATION_ASSETS, O as OUTBOUND_OPS, az as Operation, P as ProtocolFeeInfo, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, 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 ZkLoginSigner, a0 as addFeeTransfer,
|
|
4
|
+
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-BmgPRlnq.js';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ax as CETUS_USDC_SUI_POOL, 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, ay as OPERATION_ASSETS, O as OUTBOUND_OPS, az as Operation, P as ProtocolFeeInfo, aA as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aB as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, 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 ZkLoginSigner, a0 as addFeeTransfer, aC as assertAllowedAsset, 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 getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, af as getTier, aE as isAllowedAsset, aF as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aG as normalizeAsset, aH as normalizeCoinType, am as parseSuiRpcTx, aI as queryHistory, aJ as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aK as simulateTransaction, as as stableToRaw, at as suiToMist, aL as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-BmgPRlnq.js';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DqIb4AnV.js';
|
|
7
7
|
export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DqIb4AnV.js';
|
|
8
8
|
import { n as T2000Options, P as PayOptions, d as PayResult, o as StakeVSuiResult, U as UnstakeVSuiResult, p as SwapResult, q as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, r as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, s as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, j as SwapRouteResult, t as FinancialSummary } from './types-Bk7NncQ_.js';
|
|
@@ -124,11 +124,20 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
124
124
|
byAmountIn?: boolean;
|
|
125
125
|
slippage?: number;
|
|
126
126
|
}): Promise<SwapResult>;
|
|
127
|
+
/**
|
|
128
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
129
|
+
* Thin wrapper around the standalone `getSwapQuote()`. Pre-Phase 1 this method
|
|
130
|
+
* was ~50 LoC duplicating `swap-quote.ts` — missing `serializedRoute` (SPEC 20.2
|
|
131
|
+
* fast-path) and the `providers` allow-list (Bug A fix / Pyth-dependent
|
|
132
|
+
* provider filter for sponsored callers). Routing both API surfaces through
|
|
133
|
+
* one implementation ensures fixes land for both.
|
|
134
|
+
*/
|
|
127
135
|
swapQuote(params: {
|
|
128
136
|
from: string;
|
|
129
137
|
to: string;
|
|
130
138
|
amount: number;
|
|
131
139
|
byAmountIn?: boolean;
|
|
140
|
+
providers?: string[];
|
|
132
141
|
}): Promise<SwapQuoteResult>;
|
|
133
142
|
address(): string;
|
|
134
143
|
send(params: {
|
|
@@ -173,6 +182,14 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
173
182
|
}): Promise<TransactionRecord[]>;
|
|
174
183
|
transactionDetail(digest: string): Promise<TransactionRecord | null>;
|
|
175
184
|
deposit(): Promise<DepositInfo>;
|
|
185
|
+
/**
|
|
186
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 (CLI rename support) — 2026-05-25]
|
|
187
|
+
* Preferred alias of `deposit()`. The CLI surface is `t2000 fund` post-Phase 1
|
|
188
|
+
* (more intuitive than "deposit" which sounds like a NAVI lending action).
|
|
189
|
+
* `deposit()` stays as the canonical method name for back-compat; it is NOT
|
|
190
|
+
* deprecated. This wrapper exists so SDK consumers can mirror CLI naming.
|
|
191
|
+
*/
|
|
192
|
+
fund(): Promise<DepositInfo>;
|
|
176
193
|
receive(params?: {
|
|
177
194
|
amount?: number;
|
|
178
195
|
currency?: string;
|
package/dist/index.js
CHANGED
|
@@ -1139,6 +1139,65 @@ var init_cetus_swap = __esm({
|
|
|
1139
1139
|
}
|
|
1140
1140
|
});
|
|
1141
1141
|
|
|
1142
|
+
// src/swap-quote.ts
|
|
1143
|
+
var swap_quote_exports = {};
|
|
1144
|
+
__export(swap_quote_exports, {
|
|
1145
|
+
getSwapQuote: () => getSwapQuote
|
|
1146
|
+
});
|
|
1147
|
+
async function getSwapQuote(params) {
|
|
1148
|
+
const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
1149
|
+
const fromType = resolveTokenType2(params.from);
|
|
1150
|
+
const toType = resolveTokenType2(params.to);
|
|
1151
|
+
if (!fromType) {
|
|
1152
|
+
throw new T2000Error(
|
|
1153
|
+
"ASSET_NOT_SUPPORTED",
|
|
1154
|
+
`Unknown token: ${params.from}. Provide the symbol (USDC, SUI, ...) or full coin type.`
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
if (!toType) {
|
|
1158
|
+
throw new T2000Error(
|
|
1159
|
+
"ASSET_NOT_SUPPORTED",
|
|
1160
|
+
`Unknown token: ${params.to}. Provide the symbol (USDC, SUI, ...) or full coin type.`
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
const byAmountIn = params.byAmountIn ?? true;
|
|
1164
|
+
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
1165
|
+
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
1166
|
+
const route = await findSwapRoute2({
|
|
1167
|
+
walletAddress: params.walletAddress,
|
|
1168
|
+
from: fromType,
|
|
1169
|
+
to: toType,
|
|
1170
|
+
amount: rawAmount,
|
|
1171
|
+
byAmountIn,
|
|
1172
|
+
providers: params.providers
|
|
1173
|
+
});
|
|
1174
|
+
if (!route) throw new T2000Error("SWAP_FAILED", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
1175
|
+
if (route.insufficientLiquidity) {
|
|
1176
|
+
throw new T2000Error("SWAP_FAILED", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
1177
|
+
}
|
|
1178
|
+
const toDecimals = getDecimalsForCoinType(toType);
|
|
1179
|
+
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
1180
|
+
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
1181
|
+
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
1182
|
+
const { serializeCetusRoute: serializeCetusRoute2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
1183
|
+
const serializedRoute = serializeCetusRoute2(route, { fromCoinType: fromType, toCoinType: toType });
|
|
1184
|
+
return {
|
|
1185
|
+
fromToken: params.from,
|
|
1186
|
+
toToken: params.to,
|
|
1187
|
+
fromAmount,
|
|
1188
|
+
toAmount,
|
|
1189
|
+
priceImpact: route.priceImpact,
|
|
1190
|
+
route: routeDesc,
|
|
1191
|
+
serializedRoute
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
var init_swap_quote = __esm({
|
|
1195
|
+
"src/swap-quote.ts"() {
|
|
1196
|
+
init_errors();
|
|
1197
|
+
init_token_registry();
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1142
1201
|
// src/constants.ts
|
|
1143
1202
|
init_errors();
|
|
1144
1203
|
var MIST_PER_SUI = 1000000000n;
|
|
@@ -1204,7 +1263,8 @@ var SUPPORTED_ASSETS = {
|
|
|
1204
1263
|
displayName: "XAUM"
|
|
1205
1264
|
}
|
|
1206
1265
|
};
|
|
1207
|
-
var STABLE_ASSETS = ["USDC"];
|
|
1266
|
+
var STABLE_ASSETS = ["USDC", "USDsui"];
|
|
1267
|
+
var SAVEABLE_ASSETS = ["USDC", "USDsui"];
|
|
1208
1268
|
var ALL_NAVI_ASSETS = Object.keys(SUPPORTED_ASSETS);
|
|
1209
1269
|
var OPERATION_ASSETS = {
|
|
1210
1270
|
save: ["USDC", "USDsui"],
|
|
@@ -6009,7 +6069,7 @@ var ProtocolRegistry = class {
|
|
|
6009
6069
|
}
|
|
6010
6070
|
async bestSaveRateAcrossAssets() {
|
|
6011
6071
|
const candidates = [];
|
|
6012
|
-
for (const asset of
|
|
6072
|
+
for (const asset of SAVEABLE_ASSETS) {
|
|
6013
6073
|
for (const adapter of this.lending.values()) {
|
|
6014
6074
|
if (!adapter.supportedAssets.includes(asset)) continue;
|
|
6015
6075
|
if (!adapter.capabilities.includes("save")) continue;
|
|
@@ -6029,7 +6089,7 @@ var ProtocolRegistry = class {
|
|
|
6029
6089
|
async allRatesAcrossAssets() {
|
|
6030
6090
|
const results = [];
|
|
6031
6091
|
const seen = /* @__PURE__ */ new Set();
|
|
6032
|
-
for (const asset of
|
|
6092
|
+
for (const asset of SAVEABLE_ASSETS) {
|
|
6033
6093
|
if (seen.has(asset)) continue;
|
|
6034
6094
|
seen.add(asset);
|
|
6035
6095
|
for (const adapter of this.lending.values()) {
|
|
@@ -6791,36 +6851,24 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
6791
6851
|
gasCost: gasResult.gasCostSui
|
|
6792
6852
|
};
|
|
6793
6853
|
}
|
|
6854
|
+
/**
|
|
6855
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
6856
|
+
* Thin wrapper around the standalone `getSwapQuote()`. Pre-Phase 1 this method
|
|
6857
|
+
* was ~50 LoC duplicating `swap-quote.ts` — missing `serializedRoute` (SPEC 20.2
|
|
6858
|
+
* fast-path) and the `providers` allow-list (Bug A fix / Pyth-dependent
|
|
6859
|
+
* provider filter for sponsored callers). Routing both API surfaces through
|
|
6860
|
+
* one implementation ensures fixes land for both.
|
|
6861
|
+
*/
|
|
6794
6862
|
async swapQuote(params) {
|
|
6795
|
-
const {
|
|
6796
|
-
|
|
6797
|
-
const toType = resolveTokenType2(params.to);
|
|
6798
|
-
if (!fromType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.from}. Provide the full coin type.`);
|
|
6799
|
-
if (!toType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.to}. Provide the full coin type.`);
|
|
6800
|
-
const byAmountIn = params.byAmountIn ?? true;
|
|
6801
|
-
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
6802
|
-
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
6803
|
-
const route = await findSwapRoute2({
|
|
6863
|
+
const { getSwapQuote: getSwapQuote2 } = await Promise.resolve().then(() => (init_swap_quote(), swap_quote_exports));
|
|
6864
|
+
return getSwapQuote2({
|
|
6804
6865
|
walletAddress: this._address,
|
|
6805
|
-
from:
|
|
6806
|
-
to:
|
|
6807
|
-
amount:
|
|
6808
|
-
byAmountIn
|
|
6866
|
+
from: params.from,
|
|
6867
|
+
to: params.to,
|
|
6868
|
+
amount: params.amount,
|
|
6869
|
+
byAmountIn: params.byAmountIn,
|
|
6870
|
+
providers: params.providers
|
|
6809
6871
|
});
|
|
6810
|
-
if (!route) throw new T2000Error("SWAP_NO_ROUTE", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
6811
|
-
if (route.insufficientLiquidity) throw new T2000Error("SWAP_NO_ROUTE", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
6812
|
-
const toDecimals = getDecimalsForCoinType(toType);
|
|
6813
|
-
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
6814
|
-
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
6815
|
-
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
6816
|
-
return {
|
|
6817
|
-
fromToken: params.from,
|
|
6818
|
-
toToken: params.to,
|
|
6819
|
-
fromAmount,
|
|
6820
|
-
toAmount,
|
|
6821
|
-
priceImpact: route.priceImpact,
|
|
6822
|
-
route: routeDesc
|
|
6823
|
-
};
|
|
6824
6872
|
}
|
|
6825
6873
|
// -- Wallet --
|
|
6826
6874
|
address() {
|
|
@@ -6951,6 +6999,16 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
6951
6999
|
].join("\n")
|
|
6952
7000
|
};
|
|
6953
7001
|
}
|
|
7002
|
+
/**
|
|
7003
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 (CLI rename support) — 2026-05-25]
|
|
7004
|
+
* Preferred alias of `deposit()`. The CLI surface is `t2000 fund` post-Phase 1
|
|
7005
|
+
* (more intuitive than "deposit" which sounds like a NAVI lending action).
|
|
7006
|
+
* `deposit()` stays as the canonical method name for back-compat; it is NOT
|
|
7007
|
+
* deprecated. This wrapper exists so SDK consumers can mirror CLI naming.
|
|
7008
|
+
*/
|
|
7009
|
+
async fund() {
|
|
7010
|
+
return this.deposit();
|
|
7011
|
+
}
|
|
6954
7012
|
receive(params) {
|
|
6955
7013
|
const amount = params?.amount ?? null;
|
|
6956
7014
|
const currency = params?.currency ?? "USDC";
|
|
@@ -7665,7 +7723,7 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
7665
7723
|
this.emit("yield", {
|
|
7666
7724
|
earned: result.dailyEarning,
|
|
7667
7725
|
total: result.totalYieldEarned,
|
|
7668
|
-
apy: result.currentApy
|
|
7726
|
+
apy: result.currentApy,
|
|
7669
7727
|
timestamp: Date.now()
|
|
7670
7728
|
});
|
|
7671
7729
|
}
|
|
@@ -8447,58 +8505,8 @@ function parseMoveAbort(errorStr) {
|
|
|
8447
8505
|
return { reason: errorStr };
|
|
8448
8506
|
}
|
|
8449
8507
|
|
|
8450
|
-
// src/swap-quote.ts
|
|
8451
|
-
init_errors();
|
|
8452
|
-
init_token_registry();
|
|
8453
|
-
async function getSwapQuote(params) {
|
|
8454
|
-
const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
8455
|
-
const fromType = resolveTokenType2(params.from);
|
|
8456
|
-
const toType = resolveTokenType2(params.to);
|
|
8457
|
-
if (!fromType) {
|
|
8458
|
-
throw new T2000Error(
|
|
8459
|
-
"ASSET_NOT_SUPPORTED",
|
|
8460
|
-
`Unknown token: ${params.from}. Provide the symbol (USDC, SUI, ...) or full coin type.`
|
|
8461
|
-
);
|
|
8462
|
-
}
|
|
8463
|
-
if (!toType) {
|
|
8464
|
-
throw new T2000Error(
|
|
8465
|
-
"ASSET_NOT_SUPPORTED",
|
|
8466
|
-
`Unknown token: ${params.to}. Provide the symbol (USDC, SUI, ...) or full coin type.`
|
|
8467
|
-
);
|
|
8468
|
-
}
|
|
8469
|
-
const byAmountIn = params.byAmountIn ?? true;
|
|
8470
|
-
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
8471
|
-
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
8472
|
-
const route = await findSwapRoute2({
|
|
8473
|
-
walletAddress: params.walletAddress,
|
|
8474
|
-
from: fromType,
|
|
8475
|
-
to: toType,
|
|
8476
|
-
amount: rawAmount,
|
|
8477
|
-
byAmountIn,
|
|
8478
|
-
providers: params.providers
|
|
8479
|
-
});
|
|
8480
|
-
if (!route) throw new T2000Error("SWAP_FAILED", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
8481
|
-
if (route.insufficientLiquidity) {
|
|
8482
|
-
throw new T2000Error("SWAP_FAILED", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
8483
|
-
}
|
|
8484
|
-
const toDecimals = getDecimalsForCoinType(toType);
|
|
8485
|
-
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
8486
|
-
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
8487
|
-
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
8488
|
-
const { serializeCetusRoute: serializeCetusRoute2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
8489
|
-
const serializedRoute = serializeCetusRoute2(route, { fromCoinType: fromType, toCoinType: toType });
|
|
8490
|
-
return {
|
|
8491
|
-
fromToken: params.from,
|
|
8492
|
-
toToken: params.to,
|
|
8493
|
-
fromAmount,
|
|
8494
|
-
toAmount,
|
|
8495
|
-
priceImpact: route.priceImpact,
|
|
8496
|
-
route: routeDesc,
|
|
8497
|
-
serializedRoute
|
|
8498
|
-
};
|
|
8499
|
-
}
|
|
8500
|
-
|
|
8501
8508
|
// src/index.ts
|
|
8509
|
+
init_swap_quote();
|
|
8502
8510
|
init_cetus_swap();
|
|
8503
8511
|
init_token_registry();
|
|
8504
8512
|
init_volo();
|
|
@@ -8569,6 +8577,6 @@ function displayHandle(label) {
|
|
|
8569
8577
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
8570
8578
|
*/
|
|
8571
8579
|
|
|
8572
|
-
export { ALL_NAVI_ASSETS, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, BORROW_FEE_BPS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, InvalidAddressError, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, OVERLAY_FEE_RATE, ProtocolRegistry, SAVE_FEE_BPS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addClaimRewardsToTx, addFeeTransfer, addSendToTx, addStakeVSuiToTx, addSwapToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, allDescriptors, assertAllowedAsset, buildAddLeafTx, buildClaimRewardsTx, buildHarvestRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, classifyAction, classifyLabel, classifyTransaction, composeTx, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSponsoredSwapProviders, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isCetusRouteFresh, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, walletExists };
|
|
8580
|
+
export { ALL_NAVI_ASSETS, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, BORROW_FEE_BPS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, InvalidAddressError, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, OVERLAY_FEE_RATE, ProtocolRegistry, SAVEABLE_ASSETS, SAVE_FEE_BPS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addClaimRewardsToTx, addFeeTransfer, addSendToTx, addStakeVSuiToTx, addSwapToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, allDescriptors, assertAllowedAsset, buildAddLeafTx, buildClaimRewardsTx, buildHarvestRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, classifyAction, classifyLabel, classifyTransaction, composeTx, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSponsoredSwapProviders, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isCetusRouteFresh, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, walletExists };
|
|
8573
8581
|
//# sourceMappingURL=index.js.map
|
|
8574
8582
|
//# sourceMappingURL=index.js.map
|