@t2000/cli 2.11.1 → 2.13.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-3DGYEM62.js → chunk-7MFY5PQG.js} +14 -4
- package/dist/{chunk-3DGYEM62.js.map → chunk-7MFY5PQG.js.map} +1 -1
- package/dist/client-YLNZOE5Z.js +146 -0
- package/dist/client-YLNZOE5Z.js.map +1 -0
- package/dist/{dist-546IUBM4.js → dist-FQOCT4Z4.js} +2 -2
- package/dist/{dist-UFYDHMQG.js → dist-L7I3XOJK.js} +108 -30
- package/dist/{dist-UFYDHMQG.js.map → dist-L7I3XOJK.js.map} +1 -1
- package/dist/index.js +3 -3
- package/package.json +3 -3
- package/dist/client-QOEU3RTY.js +0 -85
- package/dist/client-QOEU3RTY.js.map +0 -1
- /package/dist/{dist-546IUBM4.js.map → dist-FQOCT4Z4.js.map} +0 -0
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-7MFY5PQG.js";
|
|
16
16
|
import {
|
|
17
17
|
esm_default3 as esm_default,
|
|
18
18
|
esm_default8 as esm_default2
|
|
@@ -7863,7 +7863,7 @@ function registerLock(program3) {
|
|
|
7863
7863
|
});
|
|
7864
7864
|
program3.command("unlock").description("Unlock agent \u2014 resume operations").action(async () => {
|
|
7865
7865
|
try {
|
|
7866
|
-
const { T2000: T20003 } = await import("./dist-
|
|
7866
|
+
const { T2000: T20003 } = await import("./dist-FQOCT4Z4.js");
|
|
7867
7867
|
const MAX_ATTEMPTS2 = 3;
|
|
7868
7868
|
let pin;
|
|
7869
7869
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS2; attempt++) {
|
|
@@ -8037,7 +8037,7 @@ function registerMcp(program3) {
|
|
|
8037
8037
|
mcp.command("start", { isDefault: true }).description("Start MCP server (stdio transport)").option("--key <path>", "Key file path").action(async (opts) => {
|
|
8038
8038
|
let mod;
|
|
8039
8039
|
try {
|
|
8040
|
-
mod = await import("./dist-
|
|
8040
|
+
mod = await import("./dist-L7I3XOJK.js");
|
|
8041
8041
|
} catch {
|
|
8042
8042
|
console.error(
|
|
8043
8043
|
"MCP server not installed. Run:\n npm install -g @t2000/mcp"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "A bank account for AI agents on Sui — guided setup, MCP integration, send, save, borrow, swap. Same 37 tools as the engine, scriptable from any shell.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"tsup": "^8",
|
|
43
43
|
"typescript": "^5",
|
|
44
44
|
"vitest": "^3",
|
|
45
|
-
"@t2000/mcp": "2.
|
|
46
|
-
"@t2000/sdk": "2.
|
|
45
|
+
"@t2000/mcp": "2.13.0",
|
|
46
|
+
"@t2000/sdk": "2.13.0"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"scripts": {
|
package/dist/client-QOEU3RTY.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
|
|
2
|
-
import "./chunk-OCLKPYUU.js";
|
|
3
|
-
import {
|
|
4
|
-
Transaction,
|
|
5
|
-
coinWithBalance
|
|
6
|
-
} from "./chunk-UY3WLP52.js";
|
|
7
|
-
import "./chunk-3XUF7GM3.js";
|
|
8
|
-
import {
|
|
9
|
-
Credential_exports,
|
|
10
|
-
Method_exports,
|
|
11
|
-
zod_exports
|
|
12
|
-
} from "./chunk-2HBLU5GV.js";
|
|
13
|
-
import "./chunk-NGS6K3I3.js";
|
|
14
|
-
import "./chunk-77SWBATH.js";
|
|
15
|
-
import "./chunk-7LGHVVIJ.js";
|
|
16
|
-
import "./chunk-YPWSCLE3.js";
|
|
17
|
-
|
|
18
|
-
// ../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/dist/client.js
|
|
19
|
-
var suiCharge = Method_exports.from({
|
|
20
|
-
intent: "charge",
|
|
21
|
-
name: "sui",
|
|
22
|
-
schema: {
|
|
23
|
-
credential: {
|
|
24
|
-
payload: zod_exports.object({
|
|
25
|
-
digest: zod_exports.string()
|
|
26
|
-
})
|
|
27
|
-
},
|
|
28
|
-
request: zod_exports.object({
|
|
29
|
-
amount: zod_exports.string(),
|
|
30
|
-
currency: zod_exports.string(),
|
|
31
|
-
recipient: zod_exports.string()
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
function parseAmountToRaw(amount, decimals) {
|
|
36
|
-
const [whole = "0", frac = ""] = amount.split(".");
|
|
37
|
-
const paddedFrac = frac.padEnd(decimals, "0").slice(0, decimals);
|
|
38
|
-
return BigInt(whole + paddedFrac);
|
|
39
|
-
}
|
|
40
|
-
var SUI_USDC_TYPE = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
41
|
-
function sui(options) {
|
|
42
|
-
const address = options.signer.toSuiAddress();
|
|
43
|
-
const decimals = options.decimals ?? 6;
|
|
44
|
-
return Method_exports.toClient(suiCharge, {
|
|
45
|
-
async createCredential({ challenge }) {
|
|
46
|
-
const { amount, currency, recipient } = challenge.request;
|
|
47
|
-
const amountRaw = parseAmountToRaw(amount, decimals);
|
|
48
|
-
const tx = new Transaction();
|
|
49
|
-
tx.setSender(address);
|
|
50
|
-
const payment = coinWithBalance({ balance: amountRaw, type: currency });
|
|
51
|
-
tx.transferObjects([payment], recipient);
|
|
52
|
-
let result;
|
|
53
|
-
try {
|
|
54
|
-
if (options.execute) {
|
|
55
|
-
result = await options.execute(tx);
|
|
56
|
-
} else {
|
|
57
|
-
const built = await tx.build({ client: options.client });
|
|
58
|
-
const { signature } = await options.signer.signTransaction(built);
|
|
59
|
-
const execResult = await options.client.core.executeTransaction({
|
|
60
|
-
transaction: built,
|
|
61
|
-
signatures: [signature],
|
|
62
|
-
include: { effects: true }
|
|
63
|
-
});
|
|
64
|
-
if (execResult.FailedTransaction) {
|
|
65
|
-
throw new Error(execResult.FailedTransaction.status.error?.message ?? "Transaction failed");
|
|
66
|
-
}
|
|
67
|
-
result = execResult.Transaction;
|
|
68
|
-
}
|
|
69
|
-
} catch (err) {
|
|
70
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
71
|
-
throw new Error(`Payment transaction failed: ${msg}`);
|
|
72
|
-
}
|
|
73
|
-
return Credential_exports.serialize({
|
|
74
|
-
challenge,
|
|
75
|
-
payload: { digest: result.digest }
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
SUI_USDC_TYPE,
|
|
82
|
-
sui,
|
|
83
|
-
suiCharge
|
|
84
|
-
};
|
|
85
|
-
//# sourceMappingURL=client-QOEU3RTY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/method.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/utils.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/constants.ts","../../../node_modules/.pnpm/@suimpp+mpp@0.3.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_0b94899a6b1cb79b7850473c6a4b48f9/node_modules/@suimpp/mpp/src/client.ts"],"sourcesContent":["import { Method, z } from 'mppx';\n\nexport const suiCharge = Method.from({\n intent: 'charge',\n name: 'sui',\n schema: {\n credential: {\n payload: z.object({\n digest: z.string(),\n }),\n },\n request: z.object({\n amount: z.string(),\n currency: z.string(),\n recipient: z.string(),\n }),\n },\n});\n","/**\n * Parse a string amount to raw bigint units without floating-point math.\n * \"0.01\" with 6 decimals → 10000n\n */\nexport function parseAmountToRaw(amount: string, decimals: number): bigint {\n const [whole = '0', frac = ''] = amount.split('.');\n const paddedFrac = frac.padEnd(decimals, '0').slice(0, decimals);\n return BigInt(whole + paddedFrac);\n}\n\n/**\n * Retry an async function with linear backoff.\n * Throws the last error if all attempts fail.\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n { attempts = 5, baseDelayMs = 1000 }: { attempts?: number; baseDelayMs?: number } = {},\n): Promise<T> {\n let lastError: unknown;\n for (let i = 0; i < attempts; i++) {\n try {\n return await fn();\n } catch (err) {\n lastError = err;\n if (i < attempts - 1) {\n await new Promise((r) => setTimeout(r, baseDelayMs * (i + 1)));\n }\n }\n }\n throw lastError;\n}\n","export const SUI_USDC_TYPE =\n '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';\n","import { Method, Credential } from 'mppx';\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\nimport type { Signer } from '@mysten/sui/cryptography';\nimport { coinWithBalance, Transaction } from '@mysten/sui/transactions';\nimport { suiCharge } from './method.js';\nimport { parseAmountToRaw } from './utils.js';\n\nexport { suiCharge } from './method.js';\nexport { SUI_USDC_TYPE } from './constants.js';\n\nexport interface SuiChargeOptions {\n client: ClientWithCoreApi;\n signer: Signer;\n /** Number of decimal places for the currency (default: 6, e.g. USDC). */\n decimals?: number;\n /** Override transaction execution (e.g. to route through a gas manager). */\n execute?: (tx: Transaction) => Promise<{ digest: string }>;\n}\n\nexport function sui(options: SuiChargeOptions) {\n const address = options.signer.toSuiAddress();\n const decimals = options.decimals ?? 6;\n\n return Method.toClient(suiCharge, {\n async createCredential({ challenge }) {\n const { amount, currency, recipient } = challenge.request;\n const amountRaw = parseAmountToRaw(amount, decimals);\n\n const tx = new Transaction();\n tx.setSender(address);\n\n const payment = coinWithBalance({ balance: amountRaw, type: currency });\n tx.transferObjects([payment], recipient);\n\n let result;\n try {\n if (options.execute) {\n result = await options.execute(tx);\n } else {\n const built = await tx.build({ client: options.client });\n const { signature } = await options.signer.signTransaction(built);\n const execResult = await options.client.core.executeTransaction({\n transaction: built,\n signatures: [signature],\n include: { effects: true },\n });\n if (execResult.FailedTransaction) {\n throw new Error(execResult.FailedTransaction.status.error?.message ?? 'Transaction failed');\n }\n result = execResult.Transaction!;\n }\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new Error(`Payment transaction failed: ${msg}`);\n }\n\n return Credential.serialize({\n challenge,\n payload: { digest: result.digest },\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEO,IAAM,YAAY,eAAO,KAAK;EACnC,QAAQ;EACR,MAAM;EACN,QAAQ;IACN,YAAY;MACV,SAAS,YAAE,OAAO;QAChB,QAAQ,YAAE,OAAA;MAAO,CAClB;IAAA;IAEH,SAAS,YAAE,OAAO;MAChB,QAAQ,YAAE,OAAA;MACV,UAAU,YAAE,OAAA;MACZ,WAAW,YAAE,OAAA;IAAO,CACrB;EAAA;AAEL,CAAC;ACbM,SAAS,iBAAiB,QAAgB,UAA0B;AACzE,QAAM,CAAC,QAAQ,KAAK,OAAO,EAAE,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