@t2000/cli 9.12.0 → 9.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/README.md +4 -1
- package/dist/{chunk-KHOU3HJU.js → chunk-XPCTSCTS.js} +91 -1
- package/dist/chunk-XPCTSCTS.js.map +1 -0
- package/dist/{dist-PAYZWJCN.js → dist-WU4EKM5J.js} +589 -23
- package/dist/{dist-PAYZWJCN.js.map → dist-WU4EKM5J.js.map} +1 -1
- package/dist/{dist-24ZYDGZH.js → dist-ZIRF2Q6M.js} +12 -2
- package/dist/index.js +11 -54
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-KHOU3HJU.js.map +0 -1
- /package/dist/{dist-24ZYDGZH.js.map → dist-ZIRF2Q6M.js.map} +0 -0
package/README.md
CHANGED
|
@@ -24,7 +24,10 @@ t2 send 5 USDC alice.sui # gasless USDC send to a SuiNS name
|
|
|
24
24
|
t2 swap 100 USDC SUI # best-route swap via Cetus
|
|
25
25
|
t2 pay https://mpp.t2000.ai/openai/v1/chat/completions --data '…'
|
|
26
26
|
t2 agents # look up agents in the directory (agents.t2000.ai)
|
|
27
|
-
t2
|
|
27
|
+
t2 offering create --name "Sui market report" --price 5 --sla 24h # sell deliverable work — no server needed
|
|
28
|
+
t2 browse "market report" # find offerings; hire with t2 job create --agent … --offering …
|
|
29
|
+
t2 job watch --mine # your provider inbox — every job selling to you
|
|
30
|
+
t2 agent sell https://api.you.com/v1 # or list your own x402 endpoint (per-call, live-probed)
|
|
28
31
|
t2 mcp install # wire Claude Desktop / Cursor / Windsurf
|
|
29
32
|
```
|
|
30
33
|
|
|
@@ -10365,6 +10365,18 @@ async function buildSendTx({
|
|
|
10365
10365
|
required: amount
|
|
10366
10366
|
});
|
|
10367
10367
|
}
|
|
10368
|
+
if (asset === "USDC" || asset === "USDsui") {
|
|
10369
|
+
const rawFloor = displayToRaw(GASLESS_MIN_STABLE_AMOUNT, assetInfo.decimals);
|
|
10370
|
+
const remainder = totalBalance - rawAmount;
|
|
10371
|
+
if (remainder > 0n && remainder < rawFloor) {
|
|
10372
|
+
const total = Number(totalBalance) / 10 ** assetInfo.decimals;
|
|
10373
|
+
throw new T2000Error(
|
|
10374
|
+
"INVALID_AMOUNT",
|
|
10375
|
+
`Gasless ${asset} transfers must send the entire balance or leave at least ${GASLESS_MIN_STABLE_AMOUNT} ${asset}. Sending ${amount} of ${total} leaves ${(total - amount).toFixed(assetInfo.decimals)}. Send ${total} (everything) or at most ${(total - GASLESS_MIN_STABLE_AMOUNT).toFixed(assetInfo.decimals)}.`,
|
|
10376
|
+
{ available: total, required: amount }
|
|
10377
|
+
);
|
|
10378
|
+
}
|
|
10379
|
+
}
|
|
10368
10380
|
if (asset === "SUI") {
|
|
10369
10381
|
const [sendCoin] = tx.splitCoins(tx.gas, [rawAmount]);
|
|
10370
10382
|
tx.transferObjects([sendCoin], recipient);
|
|
@@ -12170,6 +12182,79 @@ async function verifyJobForSeller({
|
|
|
12170
12182
|
}
|
|
12171
12183
|
return { ok: problems.length === 0, job, problems };
|
|
12172
12184
|
}
|
|
12185
|
+
var DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
12186
|
+
async function commerceFetchJson(url, init) {
|
|
12187
|
+
const res = await fetch(url, {
|
|
12188
|
+
method: init?.method ?? "GET",
|
|
12189
|
+
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
12190
|
+
body: init?.body ? JSON.stringify(init.body) : void 0
|
|
12191
|
+
});
|
|
12192
|
+
const json = await res.json().catch(() => ({}));
|
|
12193
|
+
if (!res.ok) {
|
|
12194
|
+
const err = json.error;
|
|
12195
|
+
const msg = typeof err === "string" ? err : err?.message ?? `HTTP ${res.status}`;
|
|
12196
|
+
throw new Error(msg);
|
|
12197
|
+
}
|
|
12198
|
+
return json;
|
|
12199
|
+
}
|
|
12200
|
+
async function listOfferings(base, filter = {}) {
|
|
12201
|
+
const params = new URLSearchParams();
|
|
12202
|
+
if (filter.agent) params.set("agent", filter.agent);
|
|
12203
|
+
if (filter.query) params.set("q", filter.query);
|
|
12204
|
+
const qs = params.size > 0 ? `?${params.toString()}` : "";
|
|
12205
|
+
const json = await commerceFetchJson(`${base}/offerings${qs}`);
|
|
12206
|
+
const offerings = json.offerings ?? [];
|
|
12207
|
+
return { total: json.total ?? offerings.length, offerings };
|
|
12208
|
+
}
|
|
12209
|
+
async function fetchOffering(base, agent, slug) {
|
|
12210
|
+
const { offerings: rows } = await listOfferings(base, { agent });
|
|
12211
|
+
const match = rows.find((o) => o.slug === slug.trim().toLowerCase());
|
|
12212
|
+
if (!match) {
|
|
12213
|
+
const live = rows.filter((o) => !o.retired).map((o) => o.slug);
|
|
12214
|
+
throw new Error(
|
|
12215
|
+
`Agent ${truncateAddress(agent)} has no offering "${slug}".` + (live.length > 0 ? ` Live offerings: ${live.join(", ")}` : "")
|
|
12216
|
+
);
|
|
12217
|
+
}
|
|
12218
|
+
if (match.retired) {
|
|
12219
|
+
throw new Error(
|
|
12220
|
+
`Offering "${slug}" is retired \u2014 the seller no longer sells it.`
|
|
12221
|
+
);
|
|
12222
|
+
}
|
|
12223
|
+
return match;
|
|
12224
|
+
}
|
|
12225
|
+
async function sha256Hex(content) {
|
|
12226
|
+
const digest = await crypto.subtle.digest(
|
|
12227
|
+
"SHA-256",
|
|
12228
|
+
new TextEncoder().encode(content)
|
|
12229
|
+
);
|
|
12230
|
+
return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
12231
|
+
}
|
|
12232
|
+
async function putJobSpec(base, content) {
|
|
12233
|
+
const json = await commerceFetchJson(`${base}/job/spec`, {
|
|
12234
|
+
method: "POST",
|
|
12235
|
+
body: { content }
|
|
12236
|
+
});
|
|
12237
|
+
const hash = json.hash;
|
|
12238
|
+
if (!hash) {
|
|
12239
|
+
throw new Error("Failed to store the job spec.");
|
|
12240
|
+
}
|
|
12241
|
+
return hash;
|
|
12242
|
+
}
|
|
12243
|
+
async function getJobSpec(base, hash) {
|
|
12244
|
+
const clean3 = hash.trim().toLowerCase().replace(/^0x/, "");
|
|
12245
|
+
const json = await commerceFetchJson(`${base}/job/spec/${clean3}`);
|
|
12246
|
+
const content = json.content;
|
|
12247
|
+
if (content === void 0) {
|
|
12248
|
+
throw new Error("No spec stored for this hash.");
|
|
12249
|
+
}
|
|
12250
|
+
const actual = await sha256Hex(content);
|
|
12251
|
+
if (actual !== clean3) {
|
|
12252
|
+
throw new Error(
|
|
12253
|
+
"Spec content does NOT match its hash \u2014 the store returned tampered data. Do not trust it."
|
|
12254
|
+
);
|
|
12255
|
+
}
|
|
12256
|
+
return content;
|
|
12257
|
+
}
|
|
12173
12258
|
init_coinSelection();
|
|
12174
12259
|
init_cetus_swap();
|
|
12175
12260
|
init_coinSelection();
|
|
@@ -12734,6 +12819,11 @@ export {
|
|
|
12734
12819
|
getJob,
|
|
12735
12820
|
jobActionsFor,
|
|
12736
12821
|
verifyJobForSeller,
|
|
12822
|
+
DEFAULT_COMMERCE_API_BASE,
|
|
12823
|
+
listOfferings,
|
|
12824
|
+
fetchOffering,
|
|
12825
|
+
putJobSpec,
|
|
12826
|
+
getJobSpec,
|
|
12737
12827
|
SPONSORED_PYTH_DEPENDENT_PROVIDERS,
|
|
12738
12828
|
getSponsoredSwapProviders,
|
|
12739
12829
|
WRITE_APPENDER_REGISTRY,
|
|
@@ -12773,4 +12863,4 @@ export {
|
|
|
12773
12863
|
@scure/bip39/index.js:
|
|
12774
12864
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
12775
12865
|
*/
|
|
12776
|
-
//# sourceMappingURL=chunk-
|
|
12866
|
+
//# sourceMappingURL=chunk-XPCTSCTS.js.map
|