@t2000/cli 3.1.1 → 3.2.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/README.md +12 -7
- package/dist/{chunk-R7KXQRHQ.js → chunk-ZH6PX6WS.js} +91 -82
- package/dist/{chunk-R7KXQRHQ.js.map → chunk-ZH6PX6WS.js.map} +1 -1
- package/dist/{dist-2LJUAYXZ.js → dist-NH7XYB4F.js} +105 -50
- package/dist/{dist-2LJUAYXZ.js.map → dist-NH7XYB4F.js.map} +1 -1
- package/dist/{dist-A7D5R6SM.js → dist-UOJPIH47.js} +4 -2
- package/dist/index.js +52 -37
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- /package/dist/{dist-A7D5R6SM.js.map → dist-UOJPIH47.js.map} +0 -0
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
OUTBOUND_OPS,
|
|
30
30
|
OVERLAY_FEE_RATE,
|
|
31
31
|
ProtocolRegistry,
|
|
32
|
+
SAVEABLE_ASSETS,
|
|
32
33
|
SAVE_FEE_BPS,
|
|
33
34
|
SPONSORED_PYTH_DEPENDENT_PROVIDERS,
|
|
34
35
|
STABLE_ASSETS,
|
|
@@ -149,7 +150,7 @@ import {
|
|
|
149
150
|
validateLabel,
|
|
150
151
|
verifyCetusRouteCoinMatch,
|
|
151
152
|
walletExists
|
|
152
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-ZH6PX6WS.js";
|
|
153
154
|
import "./chunk-ZRPJE7U5.js";
|
|
154
155
|
import "./chunk-OCLKPYUU.js";
|
|
155
156
|
import "./chunk-SI54PO2N.js";
|
|
@@ -190,6 +191,7 @@ export {
|
|
|
190
191
|
OUTBOUND_OPS,
|
|
191
192
|
OVERLAY_FEE_RATE,
|
|
192
193
|
ProtocolRegistry,
|
|
194
|
+
SAVEABLE_ASSETS,
|
|
193
195
|
SAVE_FEE_BPS,
|
|
194
196
|
SPONSORED_PYTH_DEPENDENT_PROVIDERS,
|
|
195
197
|
STABLE_ASSETS,
|
|
@@ -311,4 +313,4 @@ export {
|
|
|
311
313
|
verifyCetusRouteCoinMatch,
|
|
312
314
|
walletExists
|
|
313
315
|
};
|
|
314
|
-
//# sourceMappingURL=dist-
|
|
316
|
+
//# sourceMappingURL=dist-UOJPIH47.js.map
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
saveKey,
|
|
13
13
|
truncateAddress,
|
|
14
14
|
walletExists
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZH6PX6WS.js";
|
|
16
16
|
import {
|
|
17
17
|
esm_default3 as esm_default,
|
|
18
18
|
esm_default8 as esm_default2
|
|
@@ -3613,13 +3613,13 @@ async function installMcpForPlatforms(platforms) {
|
|
|
3613
3613
|
}
|
|
3614
3614
|
}
|
|
3615
3615
|
function registerInit(program3) {
|
|
3616
|
-
program3.command("init").description("Create a new
|
|
3616
|
+
program3.command("init").description("Create a new Agentic Wallet \u2014 guided setup with MCP + safeguards").option("--key <path>", "Key file path").action(async (opts) => {
|
|
3617
3617
|
try {
|
|
3618
3618
|
const { checkbox, input, password } = await import("./esm-G2QBGTGV.js");
|
|
3619
3619
|
console.log("");
|
|
3620
3620
|
console.log(` \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`);
|
|
3621
3621
|
console.log(` \u2502 ${import_picocolors2.default.bold("Welcome to t2000")} \u2502`);
|
|
3622
|
-
console.log(` \u2502
|
|
3622
|
+
console.log(` \u2502 Agentic Wallet for AI agents \u2502`);
|
|
3623
3623
|
console.log(` \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518`);
|
|
3624
3624
|
console.log("");
|
|
3625
3625
|
const hasWallet = await walletExists(opts.key);
|
|
@@ -3655,7 +3655,7 @@ function registerInit(program3) {
|
|
|
3655
3655
|
` ${import_picocolors2.default.green("\u2713")} Checking ${import_picocolors2.default.green("\u2713")} Savings ${import_picocolors2.default.green("\u2713")} Credit`
|
|
3656
3656
|
);
|
|
3657
3657
|
printBlank();
|
|
3658
|
-
printLine(` \u{1F389} ${import_picocolors2.default.green("
|
|
3658
|
+
printLine(` \u{1F389} ${import_picocolors2.default.green("Agentic Wallet created")}`);
|
|
3659
3659
|
printLine(` Address: ${import_picocolors2.default.yellow(address.slice(0, 6) + "..." + address.slice(-4))}`);
|
|
3660
3660
|
printBlank();
|
|
3661
3661
|
printInfo("Fund your wallet to start:");
|
|
@@ -3875,23 +3875,28 @@ function registerAddress(program3) {
|
|
|
3875
3875
|
});
|
|
3876
3876
|
}
|
|
3877
3877
|
|
|
3878
|
-
// src/commands/
|
|
3879
|
-
function
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
return;
|
|
3888
|
-
}
|
|
3889
|
-
printHeader("Fund your wallet");
|
|
3890
|
-
console.log(info.instructions);
|
|
3891
|
-
printBlank();
|
|
3892
|
-
} catch (error) {
|
|
3893
|
-
handleError(error);
|
|
3878
|
+
// src/commands/fund.ts
|
|
3879
|
+
async function runFund(opts) {
|
|
3880
|
+
try {
|
|
3881
|
+
const pin = await resolvePin();
|
|
3882
|
+
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
3883
|
+
const info = await agent.fund();
|
|
3884
|
+
if (isJsonMode()) {
|
|
3885
|
+
printJson(info);
|
|
3886
|
+
return;
|
|
3894
3887
|
}
|
|
3888
|
+
printHeader("Fund your Agentic Wallet");
|
|
3889
|
+
console.log(info.instructions);
|
|
3890
|
+
printBlank();
|
|
3891
|
+
} catch (error) {
|
|
3892
|
+
handleError(error);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
function registerFund(program3) {
|
|
3896
|
+
program3.command("fund").description("Show how to fund your Agentic Wallet (receive address + supported networks)").option("--key <path>", "Key file path").action(runFund);
|
|
3897
|
+
program3.command("deposit").description("[deprecated] Use `t2000 fund` instead").option("--key <path>", "Key file path").action(async (opts) => {
|
|
3898
|
+
console.error("Warning: `t2000 deposit` is deprecated. Use `t2000 fund` instead.");
|
|
3899
|
+
await runFund(opts);
|
|
3895
3900
|
});
|
|
3896
3901
|
}
|
|
3897
3902
|
|
|
@@ -4139,7 +4144,6 @@ function registerSave(program3) {
|
|
|
4139
4144
|
}
|
|
4140
4145
|
};
|
|
4141
4146
|
program3.command("save").description("Deposit USDC or USDsui into NAVI lending to earn yield").argument("<amount>", 'Amount of the chosen asset to save (or "all")').option("--key <path>", "Key file path").option("--protocol <name>", "Protocol to use (e.g. navi)").option("--asset <symbol>", "Asset to save: USDC (default) or USDsui").action(action);
|
|
4142
|
-
program3.command("supply").description("Deposit USDC or USDsui into NAVI lending (alias for save)").argument("<amount>", 'Amount of the chosen asset to save (or "all")').option("--key <path>", "Key file path").option("--protocol <name>", "Protocol to use (e.g. navi)").option("--asset <symbol>", "Asset to save: USDC (default) or USDsui").action(action);
|
|
4143
4147
|
}
|
|
4144
4148
|
|
|
4145
4149
|
// src/commands/withdraw.ts
|
|
@@ -7877,7 +7881,7 @@ function registerLock(program3) {
|
|
|
7877
7881
|
});
|
|
7878
7882
|
program3.command("unlock").description("Unlock agent \u2014 resume operations").action(async () => {
|
|
7879
7883
|
try {
|
|
7880
|
-
const { T2000: T20003 } = await import("./dist-
|
|
7884
|
+
const { T2000: T20003 } = await import("./dist-UOJPIH47.js");
|
|
7881
7885
|
const MAX_ATTEMPTS2 = 3;
|
|
7882
7886
|
let pin;
|
|
7883
7887
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS2; attempt++) {
|
|
@@ -8051,7 +8055,7 @@ function registerMcp(program3) {
|
|
|
8051
8055
|
mcp.command("start", { isDefault: true }).description("Start MCP server (stdio transport)").option("--key <path>", "Key file path").action(async (opts) => {
|
|
8052
8056
|
let mod;
|
|
8053
8057
|
try {
|
|
8054
|
-
mod = await import("./dist-
|
|
8058
|
+
mod = await import("./dist-NH7XYB4F.js");
|
|
8055
8059
|
} catch {
|
|
8056
8060
|
console.error(
|
|
8057
8061
|
"MCP server not installed. Run:\n npm install -g @t2000/mcp"
|
|
@@ -8243,17 +8247,24 @@ function registerClaimRewards(program3) {
|
|
|
8243
8247
|
|
|
8244
8248
|
// src/commands/swap.ts
|
|
8245
8249
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
8250
|
+
function parseSwapArgs(amountStr, from, toKeywordOrTo, to) {
|
|
8251
|
+
const amount = parseFloat(amountStr);
|
|
8252
|
+
if (isNaN(amount) || amount <= 0) {
|
|
8253
|
+
throw new Error("Amount must be a positive number");
|
|
8254
|
+
}
|
|
8255
|
+
if (toKeywordOrTo?.toLowerCase() === "for" && !to) {
|
|
8256
|
+
throw new Error("Usage: t2000 swap <amount> <from> [for] <to>");
|
|
8257
|
+
}
|
|
8258
|
+
const actualTo = to ?? toKeywordOrTo;
|
|
8259
|
+
if (!actualTo) {
|
|
8260
|
+
throw new Error("Usage: t2000 swap <amount> <from> [for] <to>");
|
|
8261
|
+
}
|
|
8262
|
+
return { amount, from, to: actualTo };
|
|
8263
|
+
}
|
|
8246
8264
|
function registerSwap(program3) {
|
|
8247
8265
|
program3.command("swap").description("Swap tokens via Cetus Aggregator (20+ DEXs)").argument("<amount>", "Amount to swap").argument("<from>", "Source token (e.g. SUI, USDC, CETUS)").argument("[to_keyword]", '"for" keyword (optional)').argument("<to>", "Target token (e.g. USDC, SUI, DEEP)").option("--slippage <pct>", "Max slippage percentage (default: 1)", "1").option("--key <path>", "Key file path").action(async (amountStr, from, toKeywordOrTo, to, opts) => {
|
|
8248
8266
|
try {
|
|
8249
|
-
const amount =
|
|
8250
|
-
if (isNaN(amount) || amount <= 0) {
|
|
8251
|
-
throw new Error("Amount must be a positive number");
|
|
8252
|
-
}
|
|
8253
|
-
if (toKeywordOrTo?.toLowerCase() === "for" && !to) {
|
|
8254
|
-
throw new Error("Usage: t2000 swap <amount> <from> [for] <to>");
|
|
8255
|
-
}
|
|
8256
|
-
const actualTo = to ?? toKeywordOrTo;
|
|
8267
|
+
const { amount, to: actualTo } = parseSwapArgs(amountStr, from, toKeywordOrTo, to);
|
|
8257
8268
|
const slippage = Math.min(parseFloat(opts.slippage ?? "1") / 100, 0.05);
|
|
8258
8269
|
const pin = await resolvePin();
|
|
8259
8270
|
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
@@ -8423,23 +8434,27 @@ var require2 = createRequire(import.meta.url);
|
|
|
8423
8434
|
var { version: CLI_VERSION } = require2("../package.json");
|
|
8424
8435
|
function createProgram() {
|
|
8425
8436
|
const program3 = new Command();
|
|
8426
|
-
program3.name("t2000").description("
|
|
8437
|
+
program3.name("t2000").description("Agentic Wallet for AI agents").version(`${CLI_VERSION} (beta)`).option("--json", "Output in JSON format").hook("preAction", (thisCommand) => {
|
|
8427
8438
|
const opts = thisCommand.optsWithGlobals();
|
|
8428
8439
|
if (opts.json) setJsonMode(true);
|
|
8429
8440
|
}).addHelpText("after", `
|
|
8430
8441
|
Examples:
|
|
8431
|
-
$ t2000 init Create a new
|
|
8442
|
+
$ t2000 init Create a new Agentic Wallet
|
|
8443
|
+
$ t2000 fund Show how to fund your wallet
|
|
8432
8444
|
$ t2000 balance Show wallet balance
|
|
8433
|
-
$ t2000 save 100 Save $100 to earn yield
|
|
8434
|
-
$ t2000
|
|
8445
|
+
$ t2000 save 100 Save $100 USDC to earn yield
|
|
8446
|
+
$ t2000 save 50 --asset USDsui Save 50 USDsui to NAVI
|
|
8447
|
+
$ t2000 send 50 to 0xabc... Send $50 USDC
|
|
8448
|
+
$ t2000 receive --amount 25 Generate a payment link
|
|
8449
|
+
$ t2000 swap 100 USDC SUI Swap 100 USDC for SUI
|
|
8435
8450
|
$ t2000 borrow 200 Borrow $200 against savings
|
|
8436
8451
|
$ t2000 pay openai ... Pay for an API via MPP gateway
|
|
8437
|
-
$ t2000 mcp install
|
|
8452
|
+
$ t2000 mcp install Connect Claude / Cursor / Windsurf`);
|
|
8438
8453
|
registerInit(program3);
|
|
8439
8454
|
registerSend(program3);
|
|
8440
8455
|
registerBalance(program3);
|
|
8441
8456
|
registerAddress(program3);
|
|
8442
|
-
|
|
8457
|
+
registerFund(program3);
|
|
8443
8458
|
registerHistory(program3);
|
|
8444
8459
|
registerExport(program3);
|
|
8445
8460
|
registerImport(program3);
|