@t2000/cli 0.25.13 → 0.25.14
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/{chunk-LE7LKEOJ.js → chunk-DNBWOMKV.js} +123 -72
- package/dist/chunk-DNBWOMKV.js.map +1 -0
- package/dist/{dist-TAMLN5Z7.js → dist-JZ5RZWFT.js} +26 -2
- package/dist/{dist-4FXGI3TM.js → dist-ZHHT2ROZ.js} +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-LE7LKEOJ.js.map +0 -1
- /package/dist/{dist-TAMLN5Z7.js.map → dist-JZ5RZWFT.js.map} +0 -0
- /package/dist/{dist-4FXGI3TM.js.map → dist-ZHHT2ROZ.js.map} +0 -0
|
@@ -63840,6 +63840,96 @@ var init_errors = __esm2({
|
|
|
63840
63840
|
};
|
|
63841
63841
|
}
|
|
63842
63842
|
});
|
|
63843
|
+
function getDecimalsForCoinType(coinType) {
|
|
63844
|
+
const direct = BY_TYPE.get(coinType);
|
|
63845
|
+
if (direct) return direct.decimals;
|
|
63846
|
+
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
63847
|
+
if (suffix) {
|
|
63848
|
+
for (const meta of BY_TYPE.values()) {
|
|
63849
|
+
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
63850
|
+
if (metaSuffix === suffix) return meta.decimals;
|
|
63851
|
+
}
|
|
63852
|
+
}
|
|
63853
|
+
return 9;
|
|
63854
|
+
}
|
|
63855
|
+
function resolveSymbol(coinType) {
|
|
63856
|
+
const direct = BY_TYPE.get(coinType);
|
|
63857
|
+
if (direct) return direct.symbol;
|
|
63858
|
+
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
63859
|
+
if (suffix) {
|
|
63860
|
+
for (const meta of BY_TYPE.values()) {
|
|
63861
|
+
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
63862
|
+
if (metaSuffix === suffix) return meta.symbol;
|
|
63863
|
+
}
|
|
63864
|
+
}
|
|
63865
|
+
return coinType.split("::").pop() ?? coinType;
|
|
63866
|
+
}
|
|
63867
|
+
function resolveTokenType(nameOrType) {
|
|
63868
|
+
if (nameOrType.includes("::")) return nameOrType;
|
|
63869
|
+
return TOKEN_MAP[nameOrType] ?? TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
|
|
63870
|
+
}
|
|
63871
|
+
var COIN_REGISTRY;
|
|
63872
|
+
var BY_TYPE;
|
|
63873
|
+
var TOKEN_MAP;
|
|
63874
|
+
var SUI_TYPE;
|
|
63875
|
+
var USDC_TYPE;
|
|
63876
|
+
var USDT_TYPE;
|
|
63877
|
+
var USDSUI_TYPE;
|
|
63878
|
+
var USDE_TYPE;
|
|
63879
|
+
var ETH_TYPE;
|
|
63880
|
+
var WBTC_TYPE;
|
|
63881
|
+
var WAL_TYPE;
|
|
63882
|
+
var NAVX_TYPE;
|
|
63883
|
+
var init_token_registry = __esm2({
|
|
63884
|
+
"src/token-registry.ts"() {
|
|
63885
|
+
COIN_REGISTRY = {
|
|
63886
|
+
SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI" },
|
|
63887
|
+
USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC" },
|
|
63888
|
+
USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
|
|
63889
|
+
USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
|
|
63890
|
+
USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" },
|
|
63891
|
+
WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL" },
|
|
63892
|
+
ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH" },
|
|
63893
|
+
wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC" },
|
|
63894
|
+
NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX" },
|
|
63895
|
+
CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS" },
|
|
63896
|
+
DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP" },
|
|
63897
|
+
NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS" },
|
|
63898
|
+
GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 6, symbol: "GOLD" },
|
|
63899
|
+
MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST" },
|
|
63900
|
+
vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI" },
|
|
63901
|
+
haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e136a8bc::hasui::HASUI", decimals: 9, symbol: "haSUI" },
|
|
63902
|
+
afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI" },
|
|
63903
|
+
FDUSD: { type: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD", decimals: 6, symbol: "FDUSD" },
|
|
63904
|
+
AUSD: { type: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD", decimals: 6, symbol: "AUSD" },
|
|
63905
|
+
BUCK: { type: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK", decimals: 9, symbol: "BUCK" },
|
|
63906
|
+
BLUB: { type: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB", decimals: 9, symbol: "BLUB" },
|
|
63907
|
+
SCA: { type: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA", decimals: 9, symbol: "SCA" },
|
|
63908
|
+
TURBOS: { type: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS", decimals: 9, symbol: "TURBOS" }
|
|
63909
|
+
};
|
|
63910
|
+
BY_TYPE = /* @__PURE__ */ new Map();
|
|
63911
|
+
for (const meta of Object.values(COIN_REGISTRY)) {
|
|
63912
|
+
BY_TYPE.set(meta.type, meta);
|
|
63913
|
+
}
|
|
63914
|
+
TOKEN_MAP = (() => {
|
|
63915
|
+
const map2 = {};
|
|
63916
|
+
for (const [name, meta] of Object.entries(COIN_REGISTRY)) {
|
|
63917
|
+
map2[name] = meta.type;
|
|
63918
|
+
map2[name.toUpperCase()] = meta.type;
|
|
63919
|
+
}
|
|
63920
|
+
return map2;
|
|
63921
|
+
})();
|
|
63922
|
+
SUI_TYPE = COIN_REGISTRY.SUI.type;
|
|
63923
|
+
USDC_TYPE = COIN_REGISTRY.USDC.type;
|
|
63924
|
+
USDT_TYPE = COIN_REGISTRY.USDT.type;
|
|
63925
|
+
USDSUI_TYPE = COIN_REGISTRY.USDSUI.type;
|
|
63926
|
+
USDE_TYPE = COIN_REGISTRY.USDe.type;
|
|
63927
|
+
ETH_TYPE = COIN_REGISTRY.ETH.type;
|
|
63928
|
+
WBTC_TYPE = COIN_REGISTRY.wBTC.type;
|
|
63929
|
+
WAL_TYPE = COIN_REGISTRY.WAL.type;
|
|
63930
|
+
NAVX_TYPE = COIN_REGISTRY.NAVX.type;
|
|
63931
|
+
}
|
|
63932
|
+
});
|
|
63843
63933
|
var volo_exports = {};
|
|
63844
63934
|
__export2(volo_exports, {
|
|
63845
63935
|
MIN_STAKE_MIST: () => MIN_STAKE_MIST,
|
|
@@ -64018,39 +64108,11 @@ async function simulateSwap(params) {
|
|
|
64018
64108
|
return { success: false, error: err instanceof Error ? err.message : String(err) };
|
|
64019
64109
|
}
|
|
64020
64110
|
}
|
|
64021
|
-
function resolveTokenType(nameOrType) {
|
|
64022
|
-
if (nameOrType.includes("::")) return nameOrType;
|
|
64023
|
-
return TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
|
|
64024
|
-
}
|
|
64025
64111
|
var clientInstance;
|
|
64026
|
-
var TOKEN_MAP;
|
|
64027
64112
|
var init_cetus_swap = __esm2({
|
|
64028
64113
|
"src/protocols/cetus-swap.ts"() {
|
|
64114
|
+
init_token_registry();
|
|
64029
64115
|
clientInstance = null;
|
|
64030
|
-
TOKEN_MAP = {
|
|
64031
|
-
SUI: "0x2::sui::SUI",
|
|
64032
|
-
USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
64033
|
-
USDT: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
64034
|
-
CETUS: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
64035
|
-
DEEP: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
|
|
64036
|
-
NAVX: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX",
|
|
64037
|
-
vSUI: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
|
|
64038
|
-
haSUI: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e136a8bc::hasui::HASUI",
|
|
64039
|
-
afSUI: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI",
|
|
64040
|
-
WAL: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
64041
|
-
ETH: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH",
|
|
64042
|
-
wBTC: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC",
|
|
64043
|
-
FDUSD: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD",
|
|
64044
|
-
AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
|
|
64045
|
-
BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
|
|
64046
|
-
USDe: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE",
|
|
64047
|
-
USDSUI: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI",
|
|
64048
|
-
MANIFEST: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST",
|
|
64049
|
-
NS: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS",
|
|
64050
|
-
BLUB: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB",
|
|
64051
|
-
SCA: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",
|
|
64052
|
-
TURBOS: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS"
|
|
64053
|
-
};
|
|
64054
64116
|
}
|
|
64055
64117
|
});
|
|
64056
64118
|
var MIST_PER_SUI2 = 1000000000n;
|
|
@@ -64435,7 +64497,7 @@ async function queryBalance(client, address) {
|
|
|
64435
64497
|
stables
|
|
64436
64498
|
};
|
|
64437
64499
|
}
|
|
64438
|
-
|
|
64500
|
+
init_token_registry();
|
|
64439
64501
|
var KNOWN_TARGETS = [
|
|
64440
64502
|
[/::suilend|::obligation/, "lending"],
|
|
64441
64503
|
[/::navi|::incentive_v\d+|::oracle_pro/, "lending"],
|
|
@@ -64491,9 +64553,9 @@ function extractTransferDetails(changes, sender) {
|
|
|
64491
64553
|
const primaryOutflow = outflows.filter((c) => c.coinType !== SUI_TYPE).sort((a, b2) => Number(BigInt(a.amount) - BigInt(b2.amount)))[0] ?? outflows[0];
|
|
64492
64554
|
if (!primaryOutflow) return {};
|
|
64493
64555
|
const coinType = primaryOutflow.coinType;
|
|
64494
|
-
const decimals = coinType
|
|
64556
|
+
const decimals = getDecimalsForCoinType(coinType);
|
|
64495
64557
|
const amount = Math.abs(Number(BigInt(primaryOutflow.amount))) / 10 ** decimals;
|
|
64496
|
-
const asset =
|
|
64558
|
+
const asset = resolveSymbol(coinType);
|
|
64497
64559
|
const recipientChange = inflows.find((c) => c.coinType === coinType);
|
|
64498
64560
|
const recipient = recipientChange ? resolveOwner(recipientChange.owner) ?? void 0 : void 0;
|
|
64499
64561
|
return { amount, asset, recipient };
|
|
@@ -64533,6 +64595,7 @@ function classifyAction(targets, commandTypes) {
|
|
|
64533
64595
|
if (hasMoveCall) return "transaction";
|
|
64534
64596
|
return "transaction";
|
|
64535
64597
|
}
|
|
64598
|
+
init_token_registry();
|
|
64536
64599
|
var FEE_RATES = {
|
|
64537
64600
|
save: SAVE_FEE_BPS,
|
|
64538
64601
|
borrow: BORROW_FEE_BPS
|
|
@@ -65993,8 +66056,7 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
65993
66056
|
if (!toType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.to}. Provide the full coin type.`);
|
|
65994
66057
|
const byAmountIn = params.byAmountIn ?? true;
|
|
65995
66058
|
const slippage = Math.min(params.slippage ?? 0.01, 0.05);
|
|
65996
|
-
const
|
|
65997
|
-
const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
|
|
66059
|
+
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
65998
66060
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
65999
66061
|
const route = await findSwapRoute2({
|
|
66000
66062
|
walletAddress: this._address,
|
|
@@ -66008,8 +66070,7 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66008
66070
|
if (route.priceImpact > 0.05) {
|
|
66009
66071
|
console.warn(`[swap] High price impact: ${(route.priceImpact * 100).toFixed(2)}%`);
|
|
66010
66072
|
}
|
|
66011
|
-
const
|
|
66012
|
-
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
66073
|
+
const toDecimals = getDecimalsForCoinType(toType);
|
|
66013
66074
|
let preBalRaw = 0n;
|
|
66014
66075
|
try {
|
|
66015
66076
|
const preBal = await this.client.getBalance({ owner: this._address, coinType: toType });
|
|
@@ -66049,10 +66110,6 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66049
66110
|
pollInterval: 400
|
|
66050
66111
|
});
|
|
66051
66112
|
const changes = fullTx.balanceChanges ?? [];
|
|
66052
|
-
console.error(`[swap] balanceChanges count=${changes.length}, toType=${toType}, suffix=${toTypeSuffix}`);
|
|
66053
|
-
for (const c of changes) {
|
|
66054
|
-
console.error(`[swap] coinType=${c.coinType} amount=${c.amount} owner=${JSON.stringify(c.owner)}`);
|
|
66055
|
-
}
|
|
66056
66113
|
const received = changes.find((c) => {
|
|
66057
66114
|
if (BigInt(c.amount) <= 0n) return false;
|
|
66058
66115
|
const ownerAddr = c.owner?.AddressOwner;
|
|
@@ -66063,32 +66120,22 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66063
66120
|
if (received) {
|
|
66064
66121
|
const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
|
|
66065
66122
|
if (actual > 0) toAmount = actual;
|
|
66066
|
-
console.error(`[swap] Primary: toAmount=${toAmount}`);
|
|
66067
|
-
} else {
|
|
66068
|
-
console.error(`[swap] Primary: no matching balance change found`);
|
|
66069
66123
|
}
|
|
66070
|
-
} catch
|
|
66071
|
-
console.error(`[swap] Primary failed:`, err);
|
|
66124
|
+
} catch {
|
|
66072
66125
|
}
|
|
66073
66126
|
const cetusEstimate = Number(route.amountOut) / 10 ** toDecimals;
|
|
66074
66127
|
if (Math.abs(toAmount - cetusEstimate) < 1e-3) {
|
|
66075
|
-
console.error(`[swap] toAmount still equals Cetus estimate (${cetusEstimate}), trying balance diff`);
|
|
66076
66128
|
try {
|
|
66077
66129
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
66078
66130
|
const postBal = await this.client.getBalance({ owner: this._address, coinType: toType });
|
|
66079
66131
|
const postRaw = BigInt(postBal.totalBalance);
|
|
66080
66132
|
const delta = Number(postRaw - preBalRaw) / 10 ** toDecimals;
|
|
66081
|
-
|
|
66082
|
-
|
|
66083
|
-
toAmount = delta;
|
|
66084
|
-
console.error(`[swap] Fallback: using balance diff: ${toAmount}`);
|
|
66085
|
-
}
|
|
66086
|
-
} catch (err) {
|
|
66087
|
-
console.error(`[swap] Fallback failed:`, err);
|
|
66133
|
+
if (delta > 0) toAmount = delta;
|
|
66134
|
+
} catch {
|
|
66088
66135
|
}
|
|
66089
66136
|
}
|
|
66090
|
-
const fromName =
|
|
66091
|
-
const toName =
|
|
66137
|
+
const fromName = resolveSymbol(fromType);
|
|
66138
|
+
const toName = resolveSymbol(toType);
|
|
66092
66139
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
66093
66140
|
return {
|
|
66094
66141
|
success: true,
|
|
@@ -66110,8 +66157,7 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66110
66157
|
if (!fromType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.from}. Provide the full coin type.`);
|
|
66111
66158
|
if (!toType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.to}. Provide the full coin type.`);
|
|
66112
66159
|
const byAmountIn = params.byAmountIn ?? true;
|
|
66113
|
-
const
|
|
66114
|
-
const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
|
|
66160
|
+
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
66115
66161
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
66116
66162
|
const route = await findSwapRoute2({
|
|
66117
66163
|
walletAddress: this._address,
|
|
@@ -66122,8 +66168,7 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66122
66168
|
});
|
|
66123
66169
|
if (!route) throw new T2000Error("SWAP_NO_ROUTE", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
66124
66170
|
if (route.insufficientLiquidity) throw new T2000Error("SWAP_NO_ROUTE", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
66125
|
-
const
|
|
66126
|
-
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
66171
|
+
const toDecimals = getDecimalsForCoinType(toType);
|
|
66127
66172
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
66128
66173
|
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
66129
66174
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
@@ -66499,12 +66544,6 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66499
66544
|
}
|
|
66500
66545
|
return all3;
|
|
66501
66546
|
}
|
|
66502
|
-
_resolveTokenName(coinType, fallback) {
|
|
66503
|
-
const entry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === coinType);
|
|
66504
|
-
if (entry) return entry[0];
|
|
66505
|
-
const suffix = coinType.split("::").pop();
|
|
66506
|
-
return suffix && suffix !== coinType ? suffix : fallback;
|
|
66507
|
-
}
|
|
66508
66547
|
_mergeCoinsInTx(tx, coins) {
|
|
66509
66548
|
if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", "No coins to merge");
|
|
66510
66549
|
const primary = tx.object(coins[0].coinObjectId);
|
|
@@ -66954,6 +66993,7 @@ function parseMoveAbort2(errorStr) {
|
|
|
66954
66993
|
}
|
|
66955
66994
|
return { reason: errorStr };
|
|
66956
66995
|
}
|
|
66996
|
+
init_token_registry();
|
|
66957
66997
|
async function getSwapQuote(params) {
|
|
66958
66998
|
const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2, TOKEN_MAP: TOKEN_MAP2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
66959
66999
|
const fromType = resolveTokenType2(params.from);
|
|
@@ -66961,8 +67001,7 @@ async function getSwapQuote(params) {
|
|
|
66961
67001
|
if (!fromType) throw new Error(`Unknown token: ${params.from}. Provide the full coin type.`);
|
|
66962
67002
|
if (!toType) throw new Error(`Unknown token: ${params.to}. Provide the full coin type.`);
|
|
66963
67003
|
const byAmountIn = params.byAmountIn ?? true;
|
|
66964
|
-
const
|
|
66965
|
-
const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
|
|
67004
|
+
const fromDecimals = getDecimalsForCoinType(fromType);
|
|
66966
67005
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
66967
67006
|
const route = await findSwapRoute2({
|
|
66968
67007
|
walletAddress: params.walletAddress,
|
|
@@ -66973,8 +67012,7 @@ async function getSwapQuote(params) {
|
|
|
66973
67012
|
});
|
|
66974
67013
|
if (!route) throw new Error(`No swap route found for ${params.from} -> ${params.to}.`);
|
|
66975
67014
|
if (route.insufficientLiquidity) throw new Error(`Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
66976
|
-
const
|
|
66977
|
-
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
67015
|
+
const toDecimals = getDecimalsForCoinType(toType);
|
|
66978
67016
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
66979
67017
|
const toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
66980
67018
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
@@ -66988,6 +67026,7 @@ async function getSwapQuote(params) {
|
|
|
66988
67026
|
};
|
|
66989
67027
|
}
|
|
66990
67028
|
init_cetus_swap();
|
|
67029
|
+
init_token_registry();
|
|
66991
67030
|
init_volo();
|
|
66992
67031
|
|
|
66993
67032
|
export {
|
|
@@ -66998,6 +67037,20 @@ export {
|
|
|
66998
67037
|
mapWalletError,
|
|
66999
67038
|
mapMoveAbortCode,
|
|
67000
67039
|
T2000Error,
|
|
67040
|
+
getDecimalsForCoinType,
|
|
67041
|
+
resolveSymbol,
|
|
67042
|
+
resolveTokenType,
|
|
67043
|
+
COIN_REGISTRY,
|
|
67044
|
+
TOKEN_MAP,
|
|
67045
|
+
SUI_TYPE,
|
|
67046
|
+
USDC_TYPE,
|
|
67047
|
+
USDT_TYPE,
|
|
67048
|
+
USDSUI_TYPE,
|
|
67049
|
+
USDE_TYPE,
|
|
67050
|
+
ETH_TYPE,
|
|
67051
|
+
WBTC_TYPE,
|
|
67052
|
+
WAL_TYPE,
|
|
67053
|
+
NAVX_TYPE,
|
|
67001
67054
|
getVoloStats,
|
|
67002
67055
|
buildStakeVSuiTx,
|
|
67003
67056
|
buildUnstakeVSuiTx,
|
|
@@ -67007,8 +67060,6 @@ export {
|
|
|
67007
67060
|
VSUI_TYPE,
|
|
67008
67061
|
findSwapRoute,
|
|
67009
67062
|
buildSwapTx,
|
|
67010
|
-
resolveTokenType,
|
|
67011
|
-
TOKEN_MAP,
|
|
67012
67063
|
MIST_PER_SUI2 as MIST_PER_SUI,
|
|
67013
67064
|
SUI_DECIMALS2 as SUI_DECIMALS,
|
|
67014
67065
|
USDC_DECIMALS,
|
|
@@ -67110,4 +67161,4 @@ axios/dist/node/axios.cjs:
|
|
|
67110
67161
|
@scure/bip39/index.js:
|
|
67111
67162
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
67112
67163
|
*/
|
|
67113
|
-
//# sourceMappingURL=chunk-
|
|
67164
|
+
//# sourceMappingURL=chunk-DNBWOMKV.js.map
|