@t2000/cli 0.46.0 → 0.46.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-6ZRYQAOQ.js → chunk-EGIY4JBI.js} +77 -24
- package/dist/{chunk-6ZRYQAOQ.js.map → chunk-EGIY4JBI.js.map} +1 -1
- package/dist/{dist-XPK5WGV5.js → dist-ARDOW4B6.js} +56 -25
- package/dist/{dist-XPK5WGV5.js.map → dist-ARDOW4B6.js.map} +1 -1
- package/dist/{dist-M7AYQZSX.js → dist-MFJH54HH.js} +14 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-M7AYQZSX.js.map → dist-MFJH54HH.js.map} +0 -0
|
@@ -60996,12 +60996,26 @@ async function queryBalance(client, address) {
|
|
|
60996
60996
|
};
|
|
60997
60997
|
}
|
|
60998
60998
|
init_token_registry();
|
|
60999
|
-
init_token_registry();
|
|
61000
60999
|
var KNOWN_TARGETS = [
|
|
61001
61000
|
[/::suilend|::obligation/, "lending"],
|
|
61002
61001
|
[/::navi|::lending_core|::incentive_v\d+|::oracle_pro/, "lending"],
|
|
61003
|
-
|
|
61004
|
-
|
|
61002
|
+
/**
|
|
61003
|
+
* DEX modules — both direct calls and aggregator legs. The Cetus
|
|
61004
|
+
* aggregator dispatches through a per-DEX module (e.g.
|
|
61005
|
+
* `cetus::swap`, `flowx_amm::swap`, `aftermath::swap`, …) plus
|
|
61006
|
+
* router glue functions. We list every DEX module the aggregator
|
|
61007
|
+
* supports today so a single-DEX call still classifies cleanly.
|
|
61008
|
+
*/
|
|
61009
|
+
[/::cetus(?:_dlmm)?::|::pool::|::deepbook|::flowx_(?:amm|clmm)::|::kriya_(?:amm|clmm)::|::turbos::|::aftermath::|::afsui::|::bluefin::|::bluemove::|::ferra_(?:clmm|dlmm)::|::haedal_hmm::|::hasui::|::hawal::|::magma::|::momentum::|::obric::|::springsui::|::steamm_cpmm::|::fullsail::|::alphafi::|::volo_swap::/, "swap"],
|
|
61010
|
+
/**
|
|
61011
|
+
* Cetus aggregator router glue. These are the swap-context and
|
|
61012
|
+
* balance-handling helpers the aggregator emits around per-DEX
|
|
61013
|
+
* legs. Without this entry a tx that ONLY had router calls
|
|
61014
|
+
* (theoretically possible for setup/cleanup) would slip through;
|
|
61015
|
+
* in practice these always coexist with a DEX leg, but the entry
|
|
61016
|
+
* is cheap insurance.
|
|
61017
|
+
*/
|
|
61018
|
+
[/::router::(?:new_swap_context(?:_v)?|confirm_swap|transfer_balance|take_balance|transfer_or_destroy_coin)/, "swap"],
|
|
61005
61019
|
[/::transfer::public_transfer/, "send"]
|
|
61006
61020
|
];
|
|
61007
61021
|
var LABEL_PATTERNS = [
|
|
@@ -61044,6 +61058,8 @@ function classifyLabel(targets, commandTypes) {
|
|
|
61044
61058
|
}
|
|
61045
61059
|
}
|
|
61046
61060
|
if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
|
|
61061
|
+
const action = classifyAction(targets, commandTypes);
|
|
61062
|
+
if (action !== "transaction") return action;
|
|
61047
61063
|
return fallbackLabel(targets);
|
|
61048
61064
|
}
|
|
61049
61065
|
function refineLendingLabel(currentAction, currentLabel, moveCallTargets, changes, address) {
|
|
@@ -61068,6 +61084,39 @@ function classifyTransaction(moveCallTargets, commandTypes, balanceChanges, addr
|
|
|
61068
61084
|
const label = refineLendingLabel(action, baseLabel, moveCallTargets, balanceChanges, address);
|
|
61069
61085
|
return { action, label };
|
|
61070
61086
|
}
|
|
61087
|
+
function extractTransferDetails(changes, sender) {
|
|
61088
|
+
if (!changes || changes.length === 0) return {};
|
|
61089
|
+
const userChanges = changes.filter((c) => resolveOwner(c.owner) === sender);
|
|
61090
|
+
if (userChanges.length === 0) return {};
|
|
61091
|
+
const userNonSui = userChanges.filter((c) => c.coinType !== SUI_TYPE);
|
|
61092
|
+
const pool = userNonSui.length > 0 ? userNonSui : userChanges;
|
|
61093
|
+
let primary = pool[0];
|
|
61094
|
+
let primaryAbs = bigintAbs(BigInt(primary.amount));
|
|
61095
|
+
for (let i = 1; i < pool.length; i++) {
|
|
61096
|
+
const abs2 = bigintAbs(BigInt(pool[i].amount));
|
|
61097
|
+
if (abs2 > primaryAbs) {
|
|
61098
|
+
primary = pool[i];
|
|
61099
|
+
primaryAbs = abs2;
|
|
61100
|
+
}
|
|
61101
|
+
}
|
|
61102
|
+
const raw = BigInt(primary.amount);
|
|
61103
|
+
if (raw === 0n) return {};
|
|
61104
|
+
const decimals = getDecimalsForCoinType(primary.coinType);
|
|
61105
|
+
const amount = Number(primaryAbs) / 10 ** decimals;
|
|
61106
|
+
const asset = resolveSymbol(primary.coinType);
|
|
61107
|
+
const direction = raw < 0n ? "out" : "in";
|
|
61108
|
+
let recipient;
|
|
61109
|
+
if (direction === "out") {
|
|
61110
|
+
const recipientChange = changes.find(
|
|
61111
|
+
(c) => resolveOwner(c.owner) !== sender && c.coinType === primary.coinType && BigInt(c.amount) > 0n
|
|
61112
|
+
);
|
|
61113
|
+
recipient = recipientChange ? resolveOwner(recipientChange.owner) ?? void 0 : void 0;
|
|
61114
|
+
}
|
|
61115
|
+
return { amount, asset, recipient, direction };
|
|
61116
|
+
}
|
|
61117
|
+
function bigintAbs(n) {
|
|
61118
|
+
return n < 0n ? -n : n;
|
|
61119
|
+
}
|
|
61071
61120
|
async function queryHistory(client, address, limit = 20) {
|
|
61072
61121
|
const txns = await client.queryTransactionBlocks({
|
|
61073
61122
|
filter: { FromAddress: address },
|
|
@@ -61088,12 +61137,28 @@ async function queryTransaction(client, digest, senderAddress) {
|
|
|
61088
61137
|
return null;
|
|
61089
61138
|
}
|
|
61090
61139
|
}
|
|
61140
|
+
function parseSuiRpcTx(tx, address) {
|
|
61141
|
+
return parseTxRecord(tx, address);
|
|
61142
|
+
}
|
|
61143
|
+
function extractTxSender(txBlock) {
|
|
61144
|
+
try {
|
|
61145
|
+
if (!txBlock || typeof txBlock !== "object") return null;
|
|
61146
|
+
const data = "data" in txBlock ? txBlock.data : void 0;
|
|
61147
|
+
if (!data || typeof data !== "object") return null;
|
|
61148
|
+
return data.sender ?? null;
|
|
61149
|
+
} catch {
|
|
61150
|
+
return null;
|
|
61151
|
+
}
|
|
61152
|
+
}
|
|
61153
|
+
function extractTxCommands(txBlock) {
|
|
61154
|
+
return extractCommands(txBlock);
|
|
61155
|
+
}
|
|
61091
61156
|
function parseTxRecord(tx, address) {
|
|
61092
61157
|
const gasUsed = tx.effects?.gasUsed;
|
|
61093
61158
|
const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
|
|
61094
61159
|
const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
|
|
61095
61160
|
const balanceChanges = tx.balanceChanges ?? [];
|
|
61096
|
-
const { amount, asset, recipient } = extractTransferDetails(balanceChanges, address);
|
|
61161
|
+
const { amount, asset, recipient, direction } = extractTransferDetails(balanceChanges, address);
|
|
61097
61162
|
const { action, label } = classifyTransaction(
|
|
61098
61163
|
moveCallTargets,
|
|
61099
61164
|
commandTypes,
|
|
@@ -61107,29 +61172,11 @@ function parseTxRecord(tx, address) {
|
|
|
61107
61172
|
amount,
|
|
61108
61173
|
asset,
|
|
61109
61174
|
recipient,
|
|
61175
|
+
direction,
|
|
61110
61176
|
timestamp: Number(tx.timestampMs ?? 0),
|
|
61111
61177
|
gasCost
|
|
61112
61178
|
};
|
|
61113
61179
|
}
|
|
61114
|
-
function resolveOwner2(owner) {
|
|
61115
|
-
if (typeof owner === "object" && owner.AddressOwner) return owner.AddressOwner;
|
|
61116
|
-
if (typeof owner === "string") return owner;
|
|
61117
|
-
return null;
|
|
61118
|
-
}
|
|
61119
|
-
function extractTransferDetails(changes, sender) {
|
|
61120
|
-
if (!changes || changes.length === 0) return {};
|
|
61121
|
-
const outflows = changes.filter((c) => resolveOwner2(c.owner) === sender && BigInt(c.amount) < 0n);
|
|
61122
|
-
const inflows = changes.filter((c) => resolveOwner2(c.owner) !== sender && BigInt(c.amount) > 0n);
|
|
61123
|
-
const primaryOutflow = outflows.filter((c) => c.coinType !== SUI_TYPE).sort((a, b2) => Number(BigInt(a.amount) - BigInt(b2.amount)))[0] ?? outflows[0];
|
|
61124
|
-
if (!primaryOutflow) return {};
|
|
61125
|
-
const coinType = primaryOutflow.coinType;
|
|
61126
|
-
const decimals = getDecimalsForCoinType(coinType);
|
|
61127
|
-
const amount = Math.abs(Number(BigInt(primaryOutflow.amount))) / 10 ** decimals;
|
|
61128
|
-
const asset = resolveSymbol(coinType);
|
|
61129
|
-
const recipientChange = inflows.find((c) => c.coinType === coinType);
|
|
61130
|
-
const recipient = recipientChange ? resolveOwner2(recipientChange.owner) ?? void 0 : void 0;
|
|
61131
|
-
return { amount, asset, recipient };
|
|
61132
|
-
}
|
|
61133
61180
|
function extractCommands(txBlock) {
|
|
61134
61181
|
const result = { moveCallTargets: [], commandTypes: [] };
|
|
61135
61182
|
try {
|
|
@@ -67428,6 +67475,12 @@ export {
|
|
|
67428
67475
|
classifyLabel,
|
|
67429
67476
|
refineLendingLabel,
|
|
67430
67477
|
classifyTransaction,
|
|
67478
|
+
extractTransferDetails,
|
|
67479
|
+
queryHistory,
|
|
67480
|
+
queryTransaction,
|
|
67481
|
+
parseSuiRpcTx,
|
|
67482
|
+
extractTxSender,
|
|
67483
|
+
extractTxCommands,
|
|
67431
67484
|
calculateFee,
|
|
67432
67485
|
addCollectFeeToTx,
|
|
67433
67486
|
getRates,
|
|
@@ -67506,4 +67559,4 @@ axios/dist/node/axios.cjs:
|
|
|
67506
67559
|
@scure/bip39/index.js:
|
|
67507
67560
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
67508
67561
|
*/
|
|
67509
|
-
//# sourceMappingURL=chunk-
|
|
67562
|
+
//# sourceMappingURL=chunk-EGIY4JBI.js.map
|