@t2000/cli 10.24.0 → 10.25.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
@@ -29311,10 +29311,19 @@ var RESOLVE_NAME_QUERY = `query ResolveSuins($name: String!) {
29311
29311
  }`;
29312
29312
  var SUI_ADDRESS_REGEX = /^0x[a-fA-F0-9]{1,64}$/i;
29313
29313
  var SUINS_NAME_REGEX = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.sui$/;
29314
+ var AUDRIC_HANDLE_RE = /^([a-z0-9-]+)@audric$/i;
29315
+ function canonicalizeRecipientInput(raw) {
29316
+ const trimmed = raw.trim();
29317
+ const m = AUDRIC_HANDLE_RE.exec(trimmed);
29318
+ if (m) {
29319
+ return `${m[1].toLowerCase()}.audric.sui`;
29320
+ }
29321
+ return trimmed;
29322
+ }
29314
29323
  var InvalidAddressError = class extends Error {
29315
29324
  constructor(raw) {
29316
29325
  super(
29317
- `"${raw}" isn't a valid Sui address or SuiNS name. Pass a 0x-prefixed hex address (e.g. 0x40cd\u20263e62) or a SuiNS name ending in .sui (e.g. alex.sui).`
29326
+ `"${raw}" isn't a valid Sui address or SuiNS name. Pass a 0x-prefixed hex address (e.g. 0x40cd\u20263e62), a SuiNS name ending in .sui (e.g. alex.sui), or a Passport handle (e.g. alex@audric).`
29318
29327
  );
29319
29328
  this.raw = raw;
29320
29329
  this.name = "InvalidAddressError";
@@ -29338,10 +29347,10 @@ var SuinsRpcError = class extends Error {
29338
29347
  };
29339
29348
  function looksLikeSuiNs(value) {
29340
29349
  if (!value) return false;
29341
- return SUINS_NAME_REGEX.test(value.trim().toLowerCase());
29350
+ return SUINS_NAME_REGEX.test(canonicalizeRecipientInput(value).toLowerCase());
29342
29351
  }
29343
29352
  async function resolveSuinsViaRpc(rawName, ctx = {}) {
29344
- const name = rawName.trim().toLowerCase();
29353
+ const name = canonicalizeRecipientInput(rawName).toLowerCase();
29345
29354
  if (!SUINS_NAME_REGEX.test(name)) {
29346
29355
  throw new InvalidAddressError(rawName);
29347
29356
  }
@@ -30403,7 +30412,7 @@ var T2000 = class _T2000 extends import_index2.default {
30403
30412
  * with the live execute path (never resolve the same input two ways).
30404
30413
  */
30405
30414
  async resolveRecipient(input) {
30406
- const trimmed = input.trim();
30415
+ const trimmed = canonicalizeRecipientInput(input);
30407
30416
  if (SUI_ADDRESS_REGEX.test(trimmed)) {
30408
30417
  return { address: trimmed.toLowerCase() };
30409
30418
  }
@@ -30427,7 +30436,7 @@ var T2000 = class _T2000 extends import_index2.default {
30427
30436
  }
30428
30437
  throw new T2000Error(
30429
30438
  "INVALID_ADDRESS",
30430
- `Cannot resolve recipient "${input}". Provide a 0x address or a .sui name.`
30439
+ `Cannot resolve recipient "${input}". Provide a 0x address, a .sui name, or a Passport handle (name@audric).`
30431
30440
  );
30432
30441
  }
30433
30442
  async balance() {
@@ -30810,6 +30819,20 @@ function cancelOpenJob(base, signer, openingId) {
30810
30819
  openingId: openingId.trim()
30811
30820
  });
30812
30821
  }
30822
+ async function resolveCreatedObjectId(client, digest, marker, opts = {}) {
30823
+ try {
30824
+ const result = await client.core.waitForTransaction({
30825
+ digest,
30826
+ include: { objectTypes: true },
30827
+ timeout: opts.timeoutMs ?? 15e3
30828
+ });
30829
+ const txn = result.$kind === "Transaction" ? result.Transaction : result.FailedTransaction;
30830
+ const types = txn.objectTypes ?? {};
30831
+ return Object.keys(types).find((id) => types[id]?.includes(marker));
30832
+ } catch {
30833
+ return void 0;
30834
+ }
30835
+ }
30813
30836
  init_coinSelection();
30814
30837
  init_cetus_swap();
30815
30838
  init_coinSelection();
@@ -35590,20 +35613,8 @@ function fmtLeft(ms) {
35590
35613
  if (hours >= 1) return `${hours}h`;
35591
35614
  return `${Math.max(1, Math.floor(left / 6e4))}m`;
35592
35615
  }
35593
- async function resolveCreated(digest, marker) {
35594
- try {
35595
- const client = getSuiClient();
35596
- const result = await client.core.waitForTransaction({
35597
- digest,
35598
- include: { objectTypes: true },
35599
- timeout: 15e3
35600
- });
35601
- const txn = result.$kind === "Transaction" ? result.Transaction : result.FailedTransaction;
35602
- const types = txn.objectTypes ?? {};
35603
- return Object.keys(types).find((id) => types[id]?.includes(marker));
35604
- } catch {
35605
- return void 0;
35606
- }
35616
+ function resolveCreated(digest, marker) {
35617
+ return resolveCreatedObjectId(getSuiClient(), digest, marker);
35607
35618
  }
35608
35619
  function registerOpenVerbs(group) {
35609
35620
  group.command("open").description("Open \u2014 post the job to the public board with no ASP picked (buyer); ESCROWS the budget on-chain now, first claim starts work").requiredOption("--title <text>", "The job's public name (up to 80 chars)").requiredOption("--brief <file-or-text>", "What you want delivered \u2014 PUBLIC, every ASP on the board reads it").requiredOption("--max <usdc>", `Budget escrowed AT POST (max ${MAX_JOB_USDC})`).option("--sla <duration>", "Delivery window once claimed (e.g. 30m, 24h, 7d)", "24h").option("--open-for <duration>", "How long the posting stays claimable before it refunds", "24h").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE6})`).action(