@t2000/cli 4.0.0 → 4.0.1
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/index.js
CHANGED
|
@@ -43752,7 +43752,8 @@ function registerReceive(program3) {
|
|
|
43752
43752
|
if (!opts.qrOnly) {
|
|
43753
43753
|
printKeyValue("Address", address);
|
|
43754
43754
|
printBlank();
|
|
43755
|
-
printLine(import_picocolors2.default.dim("
|
|
43755
|
+
printLine(import_picocolors2.default.dim("Accepts USDC, USDsui, or SUI on Sui mainnet."));
|
|
43756
|
+
printLine(import_picocolors2.default.dim("Scan to send to this wallet:"));
|
|
43756
43757
|
printBlank();
|
|
43757
43758
|
}
|
|
43758
43759
|
const qr = await import_qrcode.default.toString(address, {
|
|
@@ -43772,64 +43773,50 @@ function registerReceive(program3) {
|
|
|
43772
43773
|
});
|
|
43773
43774
|
}
|
|
43774
43775
|
|
|
43775
|
-
// src/commands/wallet/balance.ts
|
|
43776
|
-
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
43777
|
-
async function runWalletBalance(opts) {
|
|
43778
|
-
const agent = await withAgent({ keyPath: opts.key });
|
|
43779
|
-
const bal = await agent.balance();
|
|
43780
|
-
if (isJsonMode()) {
|
|
43781
|
-
printJson({
|
|
43782
|
-
available: bal.available,
|
|
43783
|
-
stables: bal.stables,
|
|
43784
|
-
gasReserve: bal.gasReserve,
|
|
43785
|
-
walletTotal: walletTotal(bal)
|
|
43786
|
-
});
|
|
43787
|
-
return;
|
|
43788
|
-
}
|
|
43789
|
-
printBlank();
|
|
43790
|
-
const stables = bal.stables ?? {};
|
|
43791
|
-
const stableEntries = Object.entries(stables).filter(([, v]) => v >= 0.01).sort(([a], [b2]) => a === "USDC" ? -1 : b2 === "USDC" ? 1 : a.localeCompare(b2));
|
|
43792
|
-
if (stableEntries.length === 0) {
|
|
43793
|
-
printKeyValue("Stablecoins", `${import_picocolors3.default.dim("none")}`);
|
|
43794
|
-
} else {
|
|
43795
|
-
for (const [symbol, amount] of stableEntries) {
|
|
43796
|
-
const label = symbol.padEnd(8);
|
|
43797
|
-
printKeyValue(label, formatUsd(amount));
|
|
43798
|
-
}
|
|
43799
|
-
}
|
|
43800
|
-
if (bal.gasReserve && bal.gasReserve.usdEquiv >= 1e-3) {
|
|
43801
|
-
printKeyValue(
|
|
43802
|
-
"SUI",
|
|
43803
|
-
`${formatUsd(bal.gasReserve.usdEquiv)} ${import_picocolors3.default.dim(`(${bal.gasReserve.sui.toFixed(4)} SUI \u2014 gas)`)}`
|
|
43804
|
-
);
|
|
43805
|
-
}
|
|
43806
|
-
printSeparator();
|
|
43807
|
-
printKeyValue("Wallet total", formatUsd(walletTotal(bal)));
|
|
43808
|
-
printBlank();
|
|
43809
|
-
}
|
|
43810
|
-
function walletTotal(bal) {
|
|
43811
|
-
return bal.available + (bal.gasReserve?.usdEquiv ?? 0);
|
|
43812
|
-
}
|
|
43813
|
-
function registerWalletBalance(parent) {
|
|
43814
|
-
parent.command("balance").description("Show stablecoin + SUI holdings (wallet only; not savings/debt)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
43815
|
-
try {
|
|
43816
|
-
await runWalletBalance(opts);
|
|
43817
|
-
} catch (error) {
|
|
43818
|
-
handleError(error);
|
|
43819
|
-
}
|
|
43820
|
-
});
|
|
43821
|
-
}
|
|
43822
|
-
|
|
43823
43776
|
// src/commands/balance.ts
|
|
43777
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
43824
43778
|
function registerBalance(program3) {
|
|
43825
|
-
program3.command("balance").description("Show
|
|
43779
|
+
program3.command("balance").description("Show stablecoin + SUI holdings (USDC, USDsui, SUI; wallet only)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
43826
43780
|
try {
|
|
43827
|
-
await
|
|
43781
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
43782
|
+
const bal = await agent.balance();
|
|
43783
|
+
if (isJsonMode()) {
|
|
43784
|
+
printJson({
|
|
43785
|
+
available: bal.available,
|
|
43786
|
+
stables: bal.stables,
|
|
43787
|
+
gasReserve: bal.gasReserve,
|
|
43788
|
+
walletTotal: walletTotal(bal)
|
|
43789
|
+
});
|
|
43790
|
+
return;
|
|
43791
|
+
}
|
|
43792
|
+
printBlank();
|
|
43793
|
+
const stables = bal.stables ?? {};
|
|
43794
|
+
const stableEntries = Object.entries(stables).filter(([, v]) => v >= 0.01).sort(([a], [b2]) => a === "USDC" ? -1 : b2 === "USDC" ? 1 : a.localeCompare(b2));
|
|
43795
|
+
if (stableEntries.length === 0) {
|
|
43796
|
+
printKeyValue("Stablecoins", `${import_picocolors3.default.dim("none")}`);
|
|
43797
|
+
} else {
|
|
43798
|
+
for (const [symbol, amount] of stableEntries) {
|
|
43799
|
+
const label = symbol.padEnd(8);
|
|
43800
|
+
printKeyValue(label, formatUsd(amount));
|
|
43801
|
+
}
|
|
43802
|
+
}
|
|
43803
|
+
if (bal.gasReserve && bal.gasReserve.usdEquiv >= 1e-3) {
|
|
43804
|
+
printKeyValue(
|
|
43805
|
+
"SUI",
|
|
43806
|
+
`${formatUsd(bal.gasReserve.usdEquiv)} ${import_picocolors3.default.dim(`(${bal.gasReserve.sui.toFixed(4)} SUI \u2014 gas)`)}`
|
|
43807
|
+
);
|
|
43808
|
+
}
|
|
43809
|
+
printSeparator();
|
|
43810
|
+
printKeyValue("Wallet total", formatUsd(walletTotal(bal)));
|
|
43811
|
+
printBlank();
|
|
43828
43812
|
} catch (error) {
|
|
43829
43813
|
handleError(error);
|
|
43830
43814
|
}
|
|
43831
43815
|
});
|
|
43832
43816
|
}
|
|
43817
|
+
function walletTotal(bal) {
|
|
43818
|
+
return bal.available + (bal.gasReserve?.usdEquiv ?? 0);
|
|
43819
|
+
}
|
|
43833
43820
|
|
|
43834
43821
|
// src/commands/history.ts
|
|
43835
43822
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
@@ -43919,31 +43906,6 @@ function registerHistory(program3) {
|
|
|
43919
43906
|
});
|
|
43920
43907
|
}
|
|
43921
43908
|
|
|
43922
|
-
// src/commands/wallet/address.ts
|
|
43923
|
-
function registerWalletAddress(parent) {
|
|
43924
|
-
parent.command("address").description("Print the wallet Sui address").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
43925
|
-
try {
|
|
43926
|
-
const agent = await withAgent({ keyPath: opts.key });
|
|
43927
|
-
const address = agent.address();
|
|
43928
|
-
if (isJsonMode()) {
|
|
43929
|
-
printJson({ address });
|
|
43930
|
-
return;
|
|
43931
|
-
}
|
|
43932
|
-
process.stdout.write(`${address}
|
|
43933
|
-
`);
|
|
43934
|
-
} catch (error) {
|
|
43935
|
-
handleError(error);
|
|
43936
|
-
}
|
|
43937
|
-
});
|
|
43938
|
-
}
|
|
43939
|
-
|
|
43940
|
-
// src/commands/wallet/index.ts
|
|
43941
|
-
function registerWallet(program3) {
|
|
43942
|
-
const wallet = program3.command("wallet").description("Wallet management \u2014 address, balance");
|
|
43943
|
-
registerWalletAddress(wallet);
|
|
43944
|
-
registerWalletBalance(wallet);
|
|
43945
|
-
}
|
|
43946
|
-
|
|
43947
43909
|
// src/commands/send.ts
|
|
43948
43910
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
43949
43911
|
|
|
@@ -44777,7 +44739,7 @@ function registerMcpStart(parent) {
|
|
|
44777
44739
|
parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
44778
44740
|
let mod2;
|
|
44779
44741
|
try {
|
|
44780
|
-
mod2 = await import("./dist-
|
|
44742
|
+
mod2 = await import("./dist-NXNOD5S6.js");
|
|
44781
44743
|
} catch {
|
|
44782
44744
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
44783
44745
|
process.exit(1);
|
|
@@ -45190,11 +45152,10 @@ function createProgram() {
|
|
|
45190
45152
|
if (opts.json) setJsonMode(true);
|
|
45191
45153
|
}).addHelpText("after", `
|
|
45192
45154
|
Examples:
|
|
45193
|
-
$ t2 init Create a new Agent Wallet
|
|
45155
|
+
$ t2 init Create a new Agent Wallet
|
|
45194
45156
|
$ t2 init --import Import an existing Bech32 secret (interactive)
|
|
45195
45157
|
$ t2 receive Show address + QR for incoming transfers
|
|
45196
|
-
$ t2 balance Show
|
|
45197
|
-
$ t2 wallet address Print address (machine-parseable)
|
|
45158
|
+
$ t2 balance Show USDC / USDsui / SUI holdings
|
|
45198
45159
|
$ t2 send 5 USDC alice.sui Send 5 USDC (gasless; asset required)
|
|
45199
45160
|
$ t2 swap 100 USDC SUI Swap 100 USDC for SUI via Cetus
|
|
45200
45161
|
$ t2 pay <mpp_url> Pay an MPP / x402 service
|
|
@@ -45207,7 +45168,6 @@ Examples:
|
|
|
45207
45168
|
registerReceive(program3);
|
|
45208
45169
|
registerBalance(program3);
|
|
45209
45170
|
registerHistory(program3);
|
|
45210
|
-
registerWallet(program3);
|
|
45211
45171
|
registerSend(program3);
|
|
45212
45172
|
registerSwap(program3);
|
|
45213
45173
|
registerPay(program3);
|