@capxul/sandbox 3.2.0 → 4.0.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.
Files changed (2) hide show
  1. package/dist/main.mjs +12 -32
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -231,10 +231,9 @@ function createConvexPathRunner({ target, env: sourceEnv = process.env, spawn =
231
231
  };
232
232
  };
233
233
  }
234
- const ORG_HANDLE_SHAPE_PATTERN = /^[a-zA-Z0-9-]+$/;
234
+ const HANDLE_SHAPE_PATTERN = /^[a-zA-Z0-9_-]+$/;
235
235
  /**
236
- * Classify a faucet recipient prompt value: Capxul email, @org-handle, or
237
- * as an explicit escape hatch — a raw EVM address. Canonical normalization
236
+ * Classify a faucet recipient prompt value as an email, handle, or EVM address. Canonical normalization
238
237
  * (email lowercasing, handle validation) is left to the backend resolver.
239
238
  */
240
239
  function parseFaucetRecipient(value) {
@@ -247,12 +246,12 @@ function parseFaucetRecipient(value) {
247
246
  kind: "email",
248
247
  email: trimmed
249
248
  };
250
- const orgHandle = trimmed.startsWith("@") ? trimmed.slice(1) : trimmed;
251
- if (orgHandle.length > 0 && !orgHandle.toLowerCase().startsWith("0x") && ORG_HANDLE_SHAPE_PATTERN.test(orgHandle)) return {
252
- kind: "orgHandle",
253
- orgHandle
249
+ const handle = trimmed.startsWith("@") ? trimmed.slice(1) : trimmed;
250
+ if (handle.length > 0 && !handle.toLowerCase().startsWith("0x") && HANDLE_SHAPE_PATTERN.test(handle)) return {
251
+ kind: "handle",
252
+ handle
254
253
  };
255
- throw new Error("Recipient must be a Capxul email, @org-handle, or 0x address (escape hatch).");
254
+ throw new Error("Recipient must be an email, handle, or 0x address.");
256
255
  }
257
256
  function usdAmountToBaseUnits(value) {
258
257
  const amount = value.trim();
@@ -281,18 +280,17 @@ function canonicalConvexRunner(env = process.env) {
281
280
  //#endregion
282
281
  //#region src/commands/faucet-send.ts
283
282
  const DEFAULT_FAUCET_AMOUNT = "10";
284
- const FAUCET_ADDRESS_FUNCTION = "dev/faucetMintTo:mintTo";
285
283
  const FAUCET_RECIPIENT_FUNCTION = "dev/faucetMintTo:mintToRecipient";
286
284
  function recipientLabel(recipient) {
287
285
  switch (recipient.kind) {
288
286
  case "address": return recipient.address;
289
287
  case "email": return recipient.email;
290
- case "orgHandle": return `@${recipient.orgHandle}`;
288
+ case "handle": return `@${recipient.handle}`;
291
289
  }
292
290
  }
293
291
  function mintFailureMessage(recipient, output) {
294
292
  const message = output.length > 0 ? output : "Faucet mint failed.";
295
- if (recipient.kind === "orgHandle" && message.includes("INVALID_INPUT")) return [message, "Hint: personal payee handles are owner-scoped and cannot be funded by the faucet — use a Capxul email or an org handle."].join("\n");
293
+ if (recipient.kind === "handle" && message.includes("INVALID_INPUT")) return `${message}\nHint: no Capxul account uses this handle.`;
296
294
  return message;
297
295
  }
298
296
  async function runFaucetSend() {
@@ -304,7 +302,7 @@ async function runFaucetSend() {
304
302
  "This command calls the canonical backend dev faucet and cannot select live/mainnet."
305
303
  ].join("\n"), "Canonical sandbox");
306
304
  const recipientPrompt = await text({
307
- message: "Recipient (Capxul email or @org-handle)",
305
+ message: "Recipient (email, handle, or 0x address)",
308
306
  validate(value) {
309
307
  try {
310
308
  parseFaucetRecipient(value ?? "");
@@ -336,16 +334,6 @@ async function runFaucetSend() {
336
334
  const rawAmount = usdAmountToBaseUnits(amountPrompt);
337
335
  const displayAmount = amountPrompt.trim();
338
336
  const identity = recipientLabel(recipient);
339
- if (recipient.kind === "address") {
340
- const escapeHatch = await confirm({
341
- message: `Raw-address escape hatch — this skips Capxul identity resolution. Fund ${identity} directly?`,
342
- initialValue: false
343
- });
344
- if (isCancel(escapeHatch) || escapeHatch === false) {
345
- cancel("No faucet funds sent.");
346
- return 0;
347
- }
348
- }
349
337
  const shouldSend = await confirm({
350
338
  message: `Mint ${displayAmount} test USDX to ${identity}?`,
351
339
  initialValue: true
@@ -357,15 +345,7 @@ async function runFaucetSend() {
357
345
  const s = spinner();
358
346
  s.start("Minting testnet funds");
359
347
  try {
360
- const runConvex = canonicalConvexRunner();
361
- const result = recipient.kind === "address" ? runConvex("", [
362
- "run",
363
- FAUCET_ADDRESS_FUNCTION,
364
- JSON.stringify({
365
- holderAddress: recipient.address,
366
- rawAmount
367
- })
368
- ]) : runConvex("", [
348
+ const result = canonicalConvexRunner()("", [
369
349
  "run",
370
350
  FAUCET_RECIPIENT_FUNCTION,
371
351
  JSON.stringify({
@@ -375,7 +355,7 @@ async function runFaucetSend() {
375
355
  ]);
376
356
  if (!result.ok) throw new Error(mintFailureMessage(recipient, result.output));
377
357
  const txHash = extractField(result.output, "txHash");
378
- const safeAddress = recipient.kind === "address" ? recipient.address : extractField(result.output, "safeAddress");
358
+ const safeAddress = extractField(result.output, "safeAddress");
379
359
  s.stop("Faucet funds sent");
380
360
  note([
381
361
  `Recipient: ${identity}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sandbox",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "private": false,
5
5
  "description": "Capxul sandbox CLI for canonical quickstart keys and testnet faucet funds.",
6
6
  "keywords": [