@t2000/cli 1.27.0 → 1.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GGXOFR5Y.js → chunk-Y2HI3L2W.js} +38 -3
- package/dist/{chunk-GGXOFR5Y.js.map → chunk-Y2HI3L2W.js.map} +1 -1
- package/dist/{dist-X5FWXI7K.js → dist-NTKXLT3L.js} +8 -2
- package/dist/{dist-OECMFTLF.js → dist-VMYL2LVD.js} +34 -3
- package/dist/{dist-OECMFTLF.js.map → dist-VMYL2LVD.js.map} +1 -1
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-X5FWXI7K.js.map → dist-NTKXLT3L.js.map} +0 -0
|
@@ -16716,6 +16716,7 @@ __export(cetus_swap_exports, {
|
|
|
16716
16716
|
deserializeCetusRoute: () => deserializeCetusRoute,
|
|
16717
16717
|
findSwapRoute: () => findSwapRoute,
|
|
16718
16718
|
isCetusRouteFresh: () => isCetusRouteFresh,
|
|
16719
|
+
isPrecomputedRouteCompatibleWithProviders: () => isPrecomputedRouteCompatibleWithProviders,
|
|
16719
16720
|
resolveTokenType: () => resolveTokenType,
|
|
16720
16721
|
serializeCetusRoute: () => serializeCetusRoute,
|
|
16721
16722
|
simulateSwap: () => simulateSwap,
|
|
@@ -16832,6 +16833,14 @@ function getClient(walletAddress, overlayFee) {
|
|
|
16832
16833
|
clientCache.set(key, client);
|
|
16833
16834
|
return client;
|
|
16834
16835
|
}
|
|
16836
|
+
function isPrecomputedRouteCompatibleWithProviders(route, providers) {
|
|
16837
|
+
if (!providers || providers.length === 0) return true;
|
|
16838
|
+
const allowed = new Set(providers);
|
|
16839
|
+
for (const path of route.routerData.paths) {
|
|
16840
|
+
if (!allowed.has(path.provider)) return false;
|
|
16841
|
+
}
|
|
16842
|
+
return true;
|
|
16843
|
+
}
|
|
16835
16844
|
async function findSwapRoute(params) {
|
|
16836
16845
|
const client = getClient(params.walletAddress, params.overlayFee);
|
|
16837
16846
|
const findParams = {
|
|
@@ -16909,7 +16918,7 @@ async function addSwapToTx(tx, client, address, input) {
|
|
|
16909
16918
|
}
|
|
16910
16919
|
let route;
|
|
16911
16920
|
let usedPrecomputedRoute = false;
|
|
16912
|
-
if (input.precomputedRoute && input.precomputedRoute.amountIn === effectiveRaw.toString() && input.precomputedRoute.byAmountIn === byAmountIn) {
|
|
16921
|
+
if (input.precomputedRoute && input.precomputedRoute.amountIn === effectiveRaw.toString() && input.precomputedRoute.byAmountIn === byAmountIn && isPrecomputedRouteCompatibleWithProviders(input.precomputedRoute, input.providers)) {
|
|
16913
16922
|
route = input.precomputedRoute;
|
|
16914
16923
|
usedPrecomputedRoute = true;
|
|
16915
16924
|
} else {
|
|
@@ -17500,6 +17509,26 @@ function extractTransferDetails(changes, sender) {
|
|
|
17500
17509
|
function bigintAbs(n) {
|
|
17501
17510
|
return n < 0n ? -n : n;
|
|
17502
17511
|
}
|
|
17512
|
+
function extractAllUserLegs(changes, sender) {
|
|
17513
|
+
if (!changes || changes.length === 0) return [];
|
|
17514
|
+
const legs = [];
|
|
17515
|
+
for (const c of changes) {
|
|
17516
|
+
if (resolveOwner(c.owner) !== sender) continue;
|
|
17517
|
+
const raw = BigInt(c.amount);
|
|
17518
|
+
if (raw === 0n) continue;
|
|
17519
|
+
const decimals = getDecimalsForCoinType(c.coinType);
|
|
17520
|
+
const absAmount = bigintAbs(raw);
|
|
17521
|
+
legs.push({
|
|
17522
|
+
coinType: c.coinType,
|
|
17523
|
+
asset: resolveSymbol(c.coinType),
|
|
17524
|
+
decimals,
|
|
17525
|
+
amount: Number(absAmount) / 10 ** decimals,
|
|
17526
|
+
rawAmount: raw.toString(),
|
|
17527
|
+
direction: raw < 0n ? "out" : "in"
|
|
17528
|
+
});
|
|
17529
|
+
}
|
|
17530
|
+
return legs;
|
|
17531
|
+
}
|
|
17503
17532
|
async function queryHistory(client, address, limit = 20) {
|
|
17504
17533
|
const txns = await client.queryTransactionBlocks({
|
|
17505
17534
|
filter: { FromAddress: address },
|
|
@@ -17541,6 +17570,7 @@ function parseTxRecord(tx, address) {
|
|
|
17541
17570
|
const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
|
|
17542
17571
|
const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
|
|
17543
17572
|
const balanceChanges = tx.balanceChanges ?? [];
|
|
17573
|
+
const legs = extractAllUserLegs(balanceChanges, address);
|
|
17544
17574
|
const { amount, asset, recipient, direction } = extractTransferDetails(balanceChanges, address);
|
|
17545
17575
|
const { action, label } = classifyTransaction(
|
|
17546
17576
|
moveCallTargets,
|
|
@@ -17552,6 +17582,7 @@ function parseTxRecord(tx, address) {
|
|
|
17552
17582
|
digest: tx.digest,
|
|
17553
17583
|
action,
|
|
17554
17584
|
label,
|
|
17585
|
+
legs,
|
|
17555
17586
|
amount,
|
|
17556
17587
|
asset,
|
|
17557
17588
|
recipient,
|
|
@@ -24047,7 +24078,8 @@ async function getSwapQuote(params) {
|
|
|
24047
24078
|
from: fromType,
|
|
24048
24079
|
to: toType,
|
|
24049
24080
|
amount: rawAmount,
|
|
24050
|
-
byAmountIn
|
|
24081
|
+
byAmountIn,
|
|
24082
|
+
providers: params.providers
|
|
24051
24083
|
});
|
|
24052
24084
|
if (!route) throw new T2000Error("SWAP_FAILED", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
24053
24085
|
if (route.insufficientLiquidity) {
|
|
@@ -24231,6 +24263,7 @@ export {
|
|
|
24231
24263
|
refineLendingLabel,
|
|
24232
24264
|
classifyTransaction,
|
|
24233
24265
|
extractTransferDetails,
|
|
24266
|
+
extractAllUserLegs,
|
|
24234
24267
|
queryHistory,
|
|
24235
24268
|
queryTransaction,
|
|
24236
24269
|
parseSuiRpcTx,
|
|
@@ -24253,6 +24286,8 @@ export {
|
|
|
24253
24286
|
ContactManager,
|
|
24254
24287
|
T2000,
|
|
24255
24288
|
buildHarvestRewardsTx,
|
|
24289
|
+
SPONSORED_PYTH_DEPENDENT_PROVIDERS,
|
|
24290
|
+
getSponsoredSwapProviders,
|
|
24256
24291
|
WRITE_APPENDER_REGISTRY,
|
|
24257
24292
|
deriveAllowedAddressesFromPtb,
|
|
24258
24293
|
composeTx,
|
|
@@ -24295,4 +24330,4 @@ axios/dist/node/axios.cjs:
|
|
|
24295
24330
|
@scure/bip39/index.js:
|
|
24296
24331
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
24297
24332
|
*/
|
|
24298
|
-
//# sourceMappingURL=chunk-
|
|
24333
|
+
//# sourceMappingURL=chunk-Y2HI3L2W.js.map
|