@t2000/sdk 1.24.13 → 1.25.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/adapters/index.d.cts +2 -1
- package/dist/adapters/index.d.ts +2 -1
- package/dist/browser.cjs +1 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +135 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +128 -14
- package/dist/index.js.map +1 -1
- package/dist/types-BaYOyGKJ.d.cts +509 -0
- package/dist/types-BaYOyGKJ.d.ts +509 -0
- package/dist/{types-D1-rO-J4.d.ts → types-Bheg9UZP.d.ts} +84 -228
- package/dist/{types-DvNhsBbN.d.cts → types-Cv9ZQ7KK.d.cts} +84 -228
- package/package.json +3 -1
- package/dist/types-jAD-e7Pq.d.cts +0 -254
- package/dist/types-jAD-e7Pq.d.ts +0 -254
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 {
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR,
|
|
4
|
+
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-Cv9ZQ7KK.cjs';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, aw 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, ax as OPERATION_ASSETS, O as OUTBOUND_OPS, ay 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, az as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractTransferDetails, a6 as extractTxCommands, a7 as extractTxSender, a8 as fallbackLabel, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aA as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, ae as getTier, aB as isAllowedAsset, aC as isInRegistry, af as isSupported, ag as isTier1, ah as isTier2, ai as mapMoveAbortCode, aj as mapWalletError, ak as mistToSui, aD as normalizeAsset, aE as normalizeCoinType, al as parseSuiRpcTx, aF as queryHistory, aG as queryTransaction, am as rawToStable, an as rawToUsdc, ao as refineLendingLabel, ap as resolveSymbol, aq as resolveTokenType, aH as simulateTransaction, ar as stableToRaw, as as suiToMist, aI as throwIfSimulationFailed, at as truncateAddress, au as usdcToRaw, av as validateAddress } from './types-Cv9ZQ7KK.cjs';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-BnbL3xN8.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-BnbL3xN8.cjs';
|
|
8
|
-
import {
|
|
9
|
-
export { A as AssetRates, G as GasReserve,
|
|
8
|
+
import { m as T2000Options, P as PayOptions, d as PayResult, n as StakeVSuiResult, U as UnstakeVSuiResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, q 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, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, j as SwapRouteResult, s as FinancialSummary } from './types-BaYOyGKJ.cjs';
|
|
9
|
+
export { A as AssetRates, G as GasReserve, t as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, u as SerializedCetusRoute, v as SerializedCetusRoutePath, w as SerializedRouterDataV3, x as addSwapToTx, k as buildSwapTx, y as deserializeCetusRoute, l as findSwapRoute, z as isCetusRouteFresh, I as serializeCetusRoute, J as verifyCetusRouteCoinMatch } from './types-BaYOyGKJ.cjs';
|
|
10
10
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
11
11
|
import { SuinsClient } from '@mysten/suins';
|
|
12
12
|
export { NaviAdapter, ProtocolRegistry } from './adapters/index.cjs';
|
|
@@ -473,6 +473,15 @@ interface SwapExecuteInput {
|
|
|
473
473
|
* to remove Pyth-dependent providers — see addSwapToTx JSDoc. composeTx
|
|
474
474
|
* derives this automatically from `sponsoredContext` if omitted. */
|
|
475
475
|
providers?: string[];
|
|
476
|
+
/**
|
|
477
|
+
* [SPEC 20.2 / D-1 (a)] Optional precomputed Cetus route discovered at
|
|
478
|
+
* `swap_quote` time. Bypasses `findSwapRoute()` (-400-500ms) inside
|
|
479
|
+
* `addSwapToTx`. Caller (audric prepare-route) is responsible for
|
|
480
|
+
* coin-type verification (D-2) + freshness check (D-3) before passing.
|
|
481
|
+
* `addSwapToTx` performs an additional sanity check on `amountIn` +
|
|
482
|
+
* `byAmountIn` and falls back to fresh discovery on mismatch.
|
|
483
|
+
*/
|
|
484
|
+
precomputedRoute?: SwapRouteResult;
|
|
476
485
|
}
|
|
477
486
|
type ClaimRewardsInput = Record<string, never>;
|
|
478
487
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 {
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR,
|
|
4
|
+
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof, v as SupportedAsset } from './types-Bheg9UZP.js';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, aw 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, ax as OPERATION_ASSETS, O as OUTBOUND_OPS, ay 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, az as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, a5 as extractTransferDetails, a6 as extractTxCommands, a7 as extractTxSender, a8 as fallbackLabel, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aA as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, ae as getTier, aB as isAllowedAsset, aC as isInRegistry, af as isSupported, ag as isTier1, ah as isTier2, ai as mapMoveAbortCode, aj as mapWalletError, ak as mistToSui, aD as normalizeAsset, aE as normalizeCoinType, al as parseSuiRpcTx, aF as queryHistory, aG as queryTransaction, am as rawToStable, an as rawToUsdc, ao as refineLendingLabel, ap as resolveSymbol, aq as resolveTokenType, aH as simulateTransaction, ar as stableToRaw, as as suiToMist, aI as throwIfSimulationFailed, at as truncateAddress, au as usdcToRaw, av as validateAddress } from './types-Bheg9UZP.js';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-BnbL3xN8.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-BnbL3xN8.js';
|
|
8
|
-
import {
|
|
9
|
-
export { A as AssetRates, G as GasReserve,
|
|
8
|
+
import { m as T2000Options, P as PayOptions, d as PayResult, n as StakeVSuiResult, U as UnstakeVSuiResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, q 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, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, j as SwapRouteResult, s as FinancialSummary } from './types-BaYOyGKJ.js';
|
|
9
|
+
export { A as AssetRates, G as GasReserve, t as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, u as SerializedCetusRoute, v as SerializedCetusRoutePath, w as SerializedRouterDataV3, x as addSwapToTx, k as buildSwapTx, y as deserializeCetusRoute, l as findSwapRoute, z as isCetusRouteFresh, I as serializeCetusRoute, J as verifyCetusRouteCoinMatch } from './types-BaYOyGKJ.js';
|
|
10
10
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
11
11
|
import { SuinsClient } from '@mysten/suins';
|
|
12
12
|
export { NaviAdapter, ProtocolRegistry } from './adapters/index.js';
|
|
@@ -473,6 +473,15 @@ interface SwapExecuteInput {
|
|
|
473
473
|
* to remove Pyth-dependent providers — see addSwapToTx JSDoc. composeTx
|
|
474
474
|
* derives this automatically from `sponsoredContext` if omitted. */
|
|
475
475
|
providers?: string[];
|
|
476
|
+
/**
|
|
477
|
+
* [SPEC 20.2 / D-1 (a)] Optional precomputed Cetus route discovered at
|
|
478
|
+
* `swap_quote` time. Bypasses `findSwapRoute()` (-400-500ms) inside
|
|
479
|
+
* `addSwapToTx`. Caller (audric prepare-route) is responsible for
|
|
480
|
+
* coin-type verification (D-2) + freshness check (D-3) before passing.
|
|
481
|
+
* `addSwapToTx` performs an additional sanity check on `amountIn` +
|
|
482
|
+
* `byAmountIn` and falls back to fresh discovery on mismatch.
|
|
483
|
+
*/
|
|
484
|
+
precomputedRoute?: SwapRouteResult;
|
|
476
485
|
}
|
|
477
486
|
type ClaimRewardsInput = Record<string, never>;
|
|
478
487
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
|
|
3
|
+
import BN from 'bn.js';
|
|
3
4
|
import { EventEmitter } from 'eventemitter3';
|
|
4
5
|
import { createPaymentTransactionUri } from '@mysten/payment-kit';
|
|
5
6
|
import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc';
|
|
@@ -917,10 +918,111 @@ __export(cetus_swap_exports, {
|
|
|
917
918
|
TOKEN_MAP: () => TOKEN_MAP,
|
|
918
919
|
addSwapToTx: () => addSwapToTx,
|
|
919
920
|
buildSwapTx: () => buildSwapTx,
|
|
921
|
+
deserializeCetusRoute: () => deserializeCetusRoute,
|
|
920
922
|
findSwapRoute: () => findSwapRoute,
|
|
923
|
+
isCetusRouteFresh: () => isCetusRouteFresh,
|
|
921
924
|
resolveTokenType: () => resolveTokenType,
|
|
922
|
-
|
|
925
|
+
serializeCetusRoute: () => serializeCetusRoute,
|
|
926
|
+
simulateSwap: () => simulateSwap,
|
|
927
|
+
verifyCetusRouteCoinMatch: () => verifyCetusRouteCoinMatch
|
|
923
928
|
});
|
|
929
|
+
function serializeCetusRoute(route, context) {
|
|
930
|
+
return {
|
|
931
|
+
routerData: serializeRouterDataV3(route.routerData),
|
|
932
|
+
amountIn: route.amountIn,
|
|
933
|
+
amountOut: route.amountOut,
|
|
934
|
+
byAmountIn: route.byAmountIn,
|
|
935
|
+
priceImpact: route.priceImpact,
|
|
936
|
+
insufficientLiquidity: route.insufficientLiquidity,
|
|
937
|
+
discoveredAt: Date.now(),
|
|
938
|
+
fromCoinType: context.fromCoinType,
|
|
939
|
+
toCoinType: context.toCoinType
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function deserializeCetusRoute(serialized) {
|
|
943
|
+
return {
|
|
944
|
+
routerData: deserializeRouterDataV3(serialized.routerData),
|
|
945
|
+
amountIn: serialized.amountIn,
|
|
946
|
+
amountOut: serialized.amountOut,
|
|
947
|
+
byAmountIn: serialized.byAmountIn,
|
|
948
|
+
priceImpact: serialized.priceImpact,
|
|
949
|
+
insufficientLiquidity: serialized.insufficientLiquidity
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function serializeRouterDataV3(rd) {
|
|
953
|
+
const out = {
|
|
954
|
+
amountIn: rd.amountIn.toString(),
|
|
955
|
+
amountOut: rd.amountOut.toString(),
|
|
956
|
+
byAmountIn: rd.byAmountIn,
|
|
957
|
+
paths: rd.paths.map(serializeCetusRoutePath),
|
|
958
|
+
insufficientLiquidity: rd.insufficientLiquidity,
|
|
959
|
+
deviationRatio: rd.deviationRatio
|
|
960
|
+
};
|
|
961
|
+
if (rd.quoteID !== void 0) out.quoteID = rd.quoteID;
|
|
962
|
+
if (rd.packages) {
|
|
963
|
+
const obj = {};
|
|
964
|
+
for (const [k2, v] of rd.packages) obj[k2] = v;
|
|
965
|
+
out.packages = obj;
|
|
966
|
+
}
|
|
967
|
+
if (rd.totalDeepFee !== void 0) out.totalDeepFee = rd.totalDeepFee;
|
|
968
|
+
if (rd.error) out.error = { code: rd.error.code, msg: rd.error.msg };
|
|
969
|
+
if (rd.overlayFee !== void 0) out.overlayFee = rd.overlayFee;
|
|
970
|
+
return out;
|
|
971
|
+
}
|
|
972
|
+
function deserializeRouterDataV3(s) {
|
|
973
|
+
const out = {
|
|
974
|
+
amountIn: new BN(s.amountIn),
|
|
975
|
+
amountOut: new BN(s.amountOut),
|
|
976
|
+
byAmountIn: s.byAmountIn,
|
|
977
|
+
paths: s.paths.map(deserializeCetusRoutePath),
|
|
978
|
+
insufficientLiquidity: s.insufficientLiquidity,
|
|
979
|
+
deviationRatio: s.deviationRatio
|
|
980
|
+
};
|
|
981
|
+
if (s.quoteID !== void 0) out.quoteID = s.quoteID;
|
|
982
|
+
if (s.packages) out.packages = new Map(Object.entries(s.packages));
|
|
983
|
+
if (s.totalDeepFee !== void 0) out.totalDeepFee = s.totalDeepFee;
|
|
984
|
+
if (s.error) out.error = { code: s.error.code, msg: s.error.msg };
|
|
985
|
+
if (s.overlayFee !== void 0) out.overlayFee = s.overlayFee;
|
|
986
|
+
return out;
|
|
987
|
+
}
|
|
988
|
+
function serializeCetusRoutePath(p) {
|
|
989
|
+
const out = {
|
|
990
|
+
id: p.id,
|
|
991
|
+
direction: p.direction,
|
|
992
|
+
provider: p.provider,
|
|
993
|
+
from: p.from,
|
|
994
|
+
target: p.target,
|
|
995
|
+
feeRate: p.feeRate,
|
|
996
|
+
amountIn: p.amountIn,
|
|
997
|
+
amountOut: p.amountOut
|
|
998
|
+
};
|
|
999
|
+
if (p.version !== void 0) out.version = p.version;
|
|
1000
|
+
if (p.publishedAt !== void 0) out.publishedAt = p.publishedAt;
|
|
1001
|
+
if (p.extendedDetails) out.extendedDetails = { ...p.extendedDetails };
|
|
1002
|
+
return out;
|
|
1003
|
+
}
|
|
1004
|
+
function deserializeCetusRoutePath(p) {
|
|
1005
|
+
const out = {
|
|
1006
|
+
id: p.id,
|
|
1007
|
+
direction: p.direction,
|
|
1008
|
+
provider: p.provider,
|
|
1009
|
+
from: p.from,
|
|
1010
|
+
target: p.target,
|
|
1011
|
+
feeRate: p.feeRate,
|
|
1012
|
+
amountIn: p.amountIn,
|
|
1013
|
+
amountOut: p.amountOut
|
|
1014
|
+
};
|
|
1015
|
+
if (p.version !== void 0) out.version = p.version;
|
|
1016
|
+
if (p.publishedAt !== void 0) out.publishedAt = p.publishedAt;
|
|
1017
|
+
if (p.extendedDetails) out.extendedDetails = { ...p.extendedDetails };
|
|
1018
|
+
return out;
|
|
1019
|
+
}
|
|
1020
|
+
function verifyCetusRouteCoinMatch(serialized, expected) {
|
|
1021
|
+
return serialized.fromCoinType === expected.fromCoinType && serialized.toCoinType === expected.toCoinType;
|
|
1022
|
+
}
|
|
1023
|
+
function isCetusRouteFresh(serialized, maxAgeMs = 3e4) {
|
|
1024
|
+
return Date.now() - serialized.discoveredAt < maxAgeMs;
|
|
1025
|
+
}
|
|
924
1026
|
function getClient(walletAddress, overlayFee) {
|
|
925
1027
|
const rate = overlayFee?.rate ?? 0;
|
|
926
1028
|
const receiver = overlayFee?.receiver ?? "";
|
|
@@ -1010,15 +1112,22 @@ async function addSwapToTx(tx, client, address, input) {
|
|
|
1010
1112
|
inputCoin = result.coin;
|
|
1011
1113
|
effectiveRaw = result.effectiveAmount;
|
|
1012
1114
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1115
|
+
let route;
|
|
1116
|
+
let usedPrecomputedRoute = false;
|
|
1117
|
+
if (input.precomputedRoute && input.precomputedRoute.amountIn === effectiveRaw.toString() && input.precomputedRoute.byAmountIn === byAmountIn) {
|
|
1118
|
+
route = input.precomputedRoute;
|
|
1119
|
+
usedPrecomputedRoute = true;
|
|
1120
|
+
} else {
|
|
1121
|
+
route = await findSwapRoute({
|
|
1122
|
+
walletAddress: address,
|
|
1123
|
+
from: fromType,
|
|
1124
|
+
to: toType,
|
|
1125
|
+
amount: effectiveRaw,
|
|
1126
|
+
byAmountIn,
|
|
1127
|
+
overlayFee: input.overlayFee,
|
|
1128
|
+
providers: input.providers
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1022
1131
|
if (!route) {
|
|
1023
1132
|
throw new T2000Error2("SWAP_NO_ROUTE", `No swap route found for ${input.from} \u2192 ${input.to}`);
|
|
1024
1133
|
}
|
|
@@ -1037,7 +1146,8 @@ async function addSwapToTx(tx, client, address, input) {
|
|
|
1037
1146
|
coin: outputCoin,
|
|
1038
1147
|
effectiveAmountIn: Number(effectiveRaw) / 10 ** fromDecimals,
|
|
1039
1148
|
expectedAmountOut: Number(route.amountOut) / 10 ** toDecimals,
|
|
1040
|
-
route
|
|
1149
|
+
route,
|
|
1150
|
+
usedPrecomputedRoute
|
|
1041
1151
|
};
|
|
1042
1152
|
}
|
|
1043
1153
|
async function simulateSwap(params) {
|
|
@@ -7837,7 +7947,8 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
7837
7947
|
byAmountIn: input.byAmountIn,
|
|
7838
7948
|
overlayFee: ctx.overlayFee,
|
|
7839
7949
|
providers,
|
|
7840
|
-
inputCoin: ctx.chainedCoin
|
|
7950
|
+
inputCoin: ctx.chainedCoin,
|
|
7951
|
+
precomputedRoute: input.precomputedRoute
|
|
7841
7952
|
});
|
|
7842
7953
|
if (!ctx.isOutputConsumed) {
|
|
7843
7954
|
tx.transferObjects([result.coin], ctx.sender);
|
|
@@ -8228,13 +8339,16 @@ async function getSwapQuote(params) {
|
|
|
8228
8339
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
8229
8340
|
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
8230
8341
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
8342
|
+
const { serializeCetusRoute: serializeCetusRoute2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
8343
|
+
const serializedRoute = serializeCetusRoute2(route, { fromCoinType: fromType, toCoinType: toType });
|
|
8231
8344
|
return {
|
|
8232
8345
|
fromToken: params.from,
|
|
8233
8346
|
toToken: params.to,
|
|
8234
8347
|
fromAmount,
|
|
8235
8348
|
toAmount,
|
|
8236
8349
|
priceImpact: route.priceImpact,
|
|
8237
|
-
route: routeDesc
|
|
8350
|
+
route: routeDesc,
|
|
8351
|
+
serializedRoute
|
|
8238
8352
|
};
|
|
8239
8353
|
}
|
|
8240
8354
|
|
|
@@ -8309,6 +8423,6 @@ function displayHandle(label) {
|
|
|
8309
8423
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
8310
8424
|
*/
|
|
8311
8425
|
|
|
8312
|
-
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, 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, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, 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, displayHandle, exportPrivateKey, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, walletExists };
|
|
8426
|
+
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, 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, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, 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, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isCetusRouteFresh, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, walletExists };
|
|
8313
8427
|
//# sourceMappingURL=index.js.map
|
|
8314
8428
|
//# sourceMappingURL=index.js.map
|