@t2000/cli 0.44.0 → 0.46.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/{chunk-MISDVBTN.js → chunk-6ZRYQAOQ.js} +87 -20
- package/dist/chunk-6ZRYQAOQ.js.map +1 -0
- package/dist/{dist-7CFAS7YK.js → dist-M7AYQZSX.js} +16 -2
- package/dist/{dist-UHRQXWYX.js → dist-XPK5WGV5.js} +81 -21
- package/dist/{dist-UHRQXWYX.js.map → dist-XPK5WGV5.js.map} +1 -1
- package/dist/index.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-MISDVBTN.js.map +0 -1
- /package/dist/{dist-7CFAS7YK.js.map → dist-M7AYQZSX.js.map} +0 -0
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
HF_CRITICAL_THRESHOLD,
|
|
15
15
|
HF_WARN_THRESHOLD,
|
|
16
16
|
IKA_TYPE,
|
|
17
|
+
KNOWN_TARGETS,
|
|
17
18
|
KeypairSigner,
|
|
19
|
+
LABEL_PATTERNS,
|
|
18
20
|
LOFI_TYPE,
|
|
19
21
|
MANIFEST_TYPE,
|
|
20
22
|
MIST_PER_SUI,
|
|
@@ -53,9 +55,13 @@ import {
|
|
|
53
55
|
buildSwapTx,
|
|
54
56
|
buildUnstakeVSuiTx,
|
|
55
57
|
calculateFee,
|
|
58
|
+
classifyAction,
|
|
59
|
+
classifyLabel,
|
|
60
|
+
classifyTransaction,
|
|
56
61
|
executeAutoTopUp,
|
|
57
62
|
executeWithGas,
|
|
58
63
|
exportPrivateKey,
|
|
64
|
+
fallbackLabel,
|
|
59
65
|
findSwapRoute,
|
|
60
66
|
formatAssetAmount,
|
|
61
67
|
formatSui,
|
|
@@ -83,6 +89,7 @@ import {
|
|
|
83
89
|
naviDescriptor,
|
|
84
90
|
rawToStable,
|
|
85
91
|
rawToUsdc,
|
|
92
|
+
refineLendingLabel,
|
|
86
93
|
resolveSymbol,
|
|
87
94
|
resolveTokenType,
|
|
88
95
|
saveKey,
|
|
@@ -96,7 +103,7 @@ import {
|
|
|
96
103
|
usdcToRaw,
|
|
97
104
|
validateAddress,
|
|
98
105
|
walletExists
|
|
99
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-6ZRYQAOQ.js";
|
|
100
107
|
import "./chunk-V7PXDEKG.js";
|
|
101
108
|
import "./chunk-Q2LY5BHK.js";
|
|
102
109
|
import "./chunk-3XUF7GM3.js";
|
|
@@ -116,7 +123,9 @@ export {
|
|
|
116
123
|
HF_CRITICAL_THRESHOLD,
|
|
117
124
|
HF_WARN_THRESHOLD,
|
|
118
125
|
IKA_TYPE,
|
|
126
|
+
KNOWN_TARGETS,
|
|
119
127
|
KeypairSigner,
|
|
128
|
+
LABEL_PATTERNS,
|
|
120
129
|
LOFI_TYPE,
|
|
121
130
|
MANIFEST_TYPE,
|
|
122
131
|
MIST_PER_SUI,
|
|
@@ -155,9 +164,13 @@ export {
|
|
|
155
164
|
buildSwapTx,
|
|
156
165
|
buildUnstakeVSuiTx,
|
|
157
166
|
calculateFee,
|
|
167
|
+
classifyAction,
|
|
168
|
+
classifyLabel,
|
|
169
|
+
classifyTransaction,
|
|
158
170
|
executeAutoTopUp,
|
|
159
171
|
executeWithGas,
|
|
160
172
|
exportPrivateKey,
|
|
173
|
+
fallbackLabel,
|
|
161
174
|
findSwapRoute,
|
|
162
175
|
formatAssetAmount,
|
|
163
176
|
formatSui,
|
|
@@ -185,6 +198,7 @@ export {
|
|
|
185
198
|
naviDescriptor,
|
|
186
199
|
rawToStable,
|
|
187
200
|
rawToUsdc,
|
|
201
|
+
refineLendingLabel,
|
|
188
202
|
resolveSymbol,
|
|
189
203
|
resolveTokenType,
|
|
190
204
|
saveKey,
|
|
@@ -199,4 +213,4 @@ export {
|
|
|
199
213
|
validateAddress,
|
|
200
214
|
walletExists
|
|
201
215
|
};
|
|
202
|
-
//# sourceMappingURL=dist-
|
|
216
|
+
//# sourceMappingURL=dist-M7AYQZSX.js.map
|
|
@@ -130548,13 +130548,78 @@ async function queryBalance(client, address2) {
|
|
|
130548
130548
|
};
|
|
130549
130549
|
}
|
|
130550
130550
|
init_token_registry();
|
|
130551
|
+
init_token_registry();
|
|
130551
130552
|
var KNOWN_TARGETS = [
|
|
130552
130553
|
[/::suilend|::obligation/, "lending"],
|
|
130553
|
-
[/::navi|::incentive_v\d+|::oracle_pro/, "lending"],
|
|
130554
|
+
[/::navi|::lending_core|::incentive_v\d+|::oracle_pro/, "lending"],
|
|
130554
130555
|
[/::cetus|::pool/, "swap"],
|
|
130555
130556
|
[/::deepbook/, "swap"],
|
|
130556
130557
|
[/::transfer::public_transfer/, "send"]
|
|
130557
130558
|
];
|
|
130559
|
+
var LABEL_PATTERNS = [
|
|
130560
|
+
[/::pay(?:ment_kit|_kit)?::|::create_payment_link|::pay_link/, "payment_link"],
|
|
130561
|
+
[/::create_invoice|::invoice::/, "invoice"],
|
|
130562
|
+
[/::deposit|::supply|::mint_ctokens/, "deposit"],
|
|
130563
|
+
[/::withdraw|::redeem|::redeem_ctokens/, "withdraw"],
|
|
130564
|
+
[/::borrow/, "borrow"],
|
|
130565
|
+
[/::repay/, "repay"],
|
|
130566
|
+
[/::claim_reward|::claim::|::claim_incentive/, "claim"],
|
|
130567
|
+
[/::stake/, "stake"],
|
|
130568
|
+
[/::unstake|::burn::/, "unstake"],
|
|
130569
|
+
[/::liquidate/, "liquidate"]
|
|
130570
|
+
];
|
|
130571
|
+
function resolveOwner(owner) {
|
|
130572
|
+
if (typeof owner === "object" && owner.AddressOwner) return owner.AddressOwner;
|
|
130573
|
+
if (typeof owner === "string") return owner;
|
|
130574
|
+
return null;
|
|
130575
|
+
}
|
|
130576
|
+
function classifyAction(targets, commandTypes) {
|
|
130577
|
+
for (const target of targets) {
|
|
130578
|
+
for (const [pattern, label] of KNOWN_TARGETS) {
|
|
130579
|
+
if (pattern.test(target)) return label;
|
|
130580
|
+
}
|
|
130581
|
+
}
|
|
130582
|
+
if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
|
|
130583
|
+
return "transaction";
|
|
130584
|
+
}
|
|
130585
|
+
function fallbackLabel(targets) {
|
|
130586
|
+
if (!targets.length) return "on-chain";
|
|
130587
|
+
const first = targets[0];
|
|
130588
|
+
const parts = first.split("::");
|
|
130589
|
+
if (parts.length >= 2 && parts[1]) return parts[1].toLowerCase();
|
|
130590
|
+
return "on-chain";
|
|
130591
|
+
}
|
|
130592
|
+
function classifyLabel(targets, commandTypes) {
|
|
130593
|
+
for (const target of targets) {
|
|
130594
|
+
for (const [pattern, label] of LABEL_PATTERNS) {
|
|
130595
|
+
if (pattern.test(target)) return label;
|
|
130596
|
+
}
|
|
130597
|
+
}
|
|
130598
|
+
if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
|
|
130599
|
+
return fallbackLabel(targets);
|
|
130600
|
+
}
|
|
130601
|
+
function refineLendingLabel(currentAction, currentLabel, moveCallTargets, changes, address2) {
|
|
130602
|
+
if (currentAction !== "lending") return currentLabel;
|
|
130603
|
+
const labelMatchedSpecific = LABEL_PATTERNS.some(
|
|
130604
|
+
([p]) => moveCallTargets.some((t) => p.test(t))
|
|
130605
|
+
);
|
|
130606
|
+
if (labelMatchedSpecific) return currentLabel;
|
|
130607
|
+
const userNonSuiOutflow = changes.find(
|
|
130608
|
+
(c) => resolveOwner(c.owner) === address2 && c.coinType !== SUI_TYPE2 && BigInt(c.amount) < 0n
|
|
130609
|
+
);
|
|
130610
|
+
if (userNonSuiOutflow) return "deposit";
|
|
130611
|
+
const userNonSuiInflow = changes.find(
|
|
130612
|
+
(c) => resolveOwner(c.owner) === address2 && c.coinType !== SUI_TYPE2 && BigInt(c.amount) > 0n
|
|
130613
|
+
);
|
|
130614
|
+
if (userNonSuiInflow) return "withdraw";
|
|
130615
|
+
return currentLabel;
|
|
130616
|
+
}
|
|
130617
|
+
function classifyTransaction(moveCallTargets, commandTypes, balanceChanges, address2) {
|
|
130618
|
+
const action = classifyAction(moveCallTargets, commandTypes);
|
|
130619
|
+
const baseLabel = classifyLabel(moveCallTargets, commandTypes);
|
|
130620
|
+
const label = refineLendingLabel(action, baseLabel, moveCallTargets, balanceChanges, address2);
|
|
130621
|
+
return { action, label };
|
|
130622
|
+
}
|
|
130558
130623
|
async function queryHistory(client, address2, limit = 20) {
|
|
130559
130624
|
const txns = await client.queryTransactionBlocks({
|
|
130560
130625
|
filter: { FromAddress: address2 },
|
|
@@ -130579,11 +130644,18 @@ function parseTxRecord(tx, address2) {
|
|
|
130579
130644
|
const gasUsed = tx.effects?.gasUsed;
|
|
130580
130645
|
const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
|
|
130581
130646
|
const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
|
|
130582
|
-
const
|
|
130583
|
-
const
|
|
130647
|
+
const balanceChanges = tx.balanceChanges ?? [];
|
|
130648
|
+
const { amount: amount2, asset, recipient } = extractTransferDetails(balanceChanges, address2);
|
|
130649
|
+
const { action, label } = classifyTransaction(
|
|
130650
|
+
moveCallTargets,
|
|
130651
|
+
commandTypes,
|
|
130652
|
+
balanceChanges,
|
|
130653
|
+
address2
|
|
130654
|
+
);
|
|
130584
130655
|
return {
|
|
130585
130656
|
digest: tx.digest,
|
|
130586
130657
|
action,
|
|
130658
|
+
label,
|
|
130587
130659
|
amount: amount2,
|
|
130588
130660
|
asset,
|
|
130589
130661
|
recipient,
|
|
@@ -130591,15 +130663,15 @@ function parseTxRecord(tx, address2) {
|
|
|
130591
130663
|
gasCost
|
|
130592
130664
|
};
|
|
130593
130665
|
}
|
|
130594
|
-
function
|
|
130666
|
+
function resolveOwner2(owner) {
|
|
130595
130667
|
if (typeof owner === "object" && owner.AddressOwner) return owner.AddressOwner;
|
|
130596
130668
|
if (typeof owner === "string") return owner;
|
|
130597
130669
|
return null;
|
|
130598
130670
|
}
|
|
130599
130671
|
function extractTransferDetails(changes, sender) {
|
|
130600
130672
|
if (!changes || changes.length === 0) return {};
|
|
130601
|
-
const outflows = changes.filter((c) =>
|
|
130602
|
-
const inflows = changes.filter((c) =>
|
|
130673
|
+
const outflows = changes.filter((c) => resolveOwner2(c.owner) === sender && BigInt(c.amount) < 0n);
|
|
130674
|
+
const inflows = changes.filter((c) => resolveOwner2(c.owner) !== sender && BigInt(c.amount) > 0n);
|
|
130603
130675
|
const primaryOutflow = outflows.filter((c) => c.coinType !== SUI_TYPE2).sort((a, b2) => Number(BigInt(a.amount) - BigInt(b2.amount)))[0] ?? outflows[0];
|
|
130604
130676
|
if (!primaryOutflow) return {};
|
|
130605
130677
|
const coinType = primaryOutflow.coinType;
|
|
@@ -130607,7 +130679,7 @@ function extractTransferDetails(changes, sender) {
|
|
|
130607
130679
|
const amount2 = Math.abs(Number(BigInt(primaryOutflow.amount))) / 10 ** decimals2;
|
|
130608
130680
|
const asset = resolveSymbol(coinType);
|
|
130609
130681
|
const recipientChange = inflows.find((c) => c.coinType === coinType);
|
|
130610
|
-
const recipient = recipientChange ?
|
|
130682
|
+
const recipient = recipientChange ? resolveOwner2(recipientChange.owner) ?? void 0 : void 0;
|
|
130611
130683
|
return { amount: amount2, asset, recipient };
|
|
130612
130684
|
}
|
|
130613
130685
|
function extractCommands(txBlock) {
|
|
@@ -130633,18 +130705,6 @@ function extractCommands(txBlock) {
|
|
|
130633
130705
|
}
|
|
130634
130706
|
return result;
|
|
130635
130707
|
}
|
|
130636
|
-
function classifyAction(targets, commandTypes) {
|
|
130637
|
-
for (const target of targets) {
|
|
130638
|
-
for (const [pattern, label] of KNOWN_TARGETS) {
|
|
130639
|
-
if (pattern.test(target)) return label;
|
|
130640
|
-
}
|
|
130641
|
-
}
|
|
130642
|
-
const hasTransfer = commandTypes.includes("TransferObjects");
|
|
130643
|
-
const hasMoveCall = commandTypes.includes("MoveCall");
|
|
130644
|
-
if (hasTransfer && !hasMoveCall) return "send";
|
|
130645
|
-
if (hasMoveCall) return "transaction";
|
|
130646
|
-
return "transaction";
|
|
130647
|
-
}
|
|
130648
130708
|
init_token_registry();
|
|
130649
130709
|
var FEE_RATES = {
|
|
130650
130710
|
save: SAVE_FEE_BPS,
|
|
@@ -137969,7 +138029,7 @@ ${context}
|
|
|
137969
138029
|
})
|
|
137970
138030
|
);
|
|
137971
138031
|
}
|
|
137972
|
-
var PKG_VERSION = "0.
|
|
138032
|
+
var PKG_VERSION = "0.46.0";
|
|
137973
138033
|
console.log = (...args) => console.error("[log]", ...args);
|
|
137974
138034
|
console.warn = (...args) => console.error("[warn]", ...args);
|
|
137975
138035
|
async function startMcpServer(opts) {
|
|
@@ -138059,4 +138119,4 @@ axios/dist/node/axios.cjs:
|
|
|
138059
138119
|
*)
|
|
138060
138120
|
*)
|
|
138061
138121
|
*/
|
|
138062
|
-
//# sourceMappingURL=dist-
|
|
138122
|
+
//# sourceMappingURL=dist-XPK5WGV5.js.map
|