@moonpay/cli 0.6.13 → 0.6.14

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.
@@ -611,9 +611,68 @@ var schemas_default = [
611
611
  $schema: "http://json-schema.org/draft-07/schema#"
612
612
  }
613
613
  },
614
+ {
615
+ name: "feedback_create",
616
+ description: "Submit feedback, a bug report, or a feature request. Requires authentication.",
617
+ inputSchema: {
618
+ $ref: "#/definitions/feedback_create_input",
619
+ definitions: {
620
+ feedback_create_input: {
621
+ type: "object",
622
+ properties: {
623
+ type: {
624
+ type: "string",
625
+ enum: [
626
+ "bug",
627
+ "feature",
628
+ "general"
629
+ ],
630
+ description: "Type of feedback: bug report, feature request, or general"
631
+ },
632
+ message: {
633
+ type: "string",
634
+ minLength: 1,
635
+ maxLength: 280,
636
+ description: "Your feedback message"
637
+ }
638
+ },
639
+ required: [
640
+ "type",
641
+ "message"
642
+ ],
643
+ additionalProperties: false
644
+ }
645
+ },
646
+ $schema: "http://json-schema.org/draft-07/schema#"
647
+ },
648
+ outputSchema: {
649
+ $ref: "#/definitions/feedback_create_output",
650
+ definitions: {
651
+ feedback_create_output: {
652
+ type: "object",
653
+ properties: {
654
+ id: {
655
+ type: "string",
656
+ description: "Feedback ID"
657
+ },
658
+ message: {
659
+ type: "string",
660
+ description: "Confirmation message"
661
+ }
662
+ },
663
+ required: [
664
+ "id",
665
+ "message"
666
+ ],
667
+ additionalProperties: false
668
+ }
669
+ },
670
+ $schema: "http://json-schema.org/draft-07/schema#"
671
+ }
672
+ },
614
673
  {
615
674
  name: "login",
616
- description: "Send a verification code to the provided email to sign in or create an account.",
675
+ description: "Send a verification code to the provided email to sign in or create an account. Requires an hCaptcha token.",
617
676
  inputSchema: {
618
677
  $ref: "#/definitions/login_input",
619
678
  definitions: {
@@ -624,10 +683,15 @@ var schemas_default = [
624
683
  type: "string",
625
684
  format: "email",
626
685
  description: "The email of the user to login"
686
+ },
687
+ captchaToken: {
688
+ type: "string",
689
+ description: "hCaptcha response token"
627
690
  }
628
691
  },
629
692
  required: [
630
- "email"
693
+ "email",
694
+ "captchaToken"
631
695
  ],
632
696
  additionalProperties: false
633
697
  }
@@ -6547,6 +6611,7 @@ var walletCreate = createTool(walletCreateSchema, async (params) => {
6547
6611
  });
6548
6612
 
6549
6613
  // src/tools/wallet/import/tool.ts
6614
+ import { createInterface } from "readline";
6550
6615
  import { validateMnemonic } from "@scure/bip39";
6551
6616
  import { wordlist as english2 } from "@scure/bip39/wordlists/english";
6552
6617
  import { Keypair } from "@solana/web3.js";
@@ -6572,12 +6637,64 @@ var walletImportSchema = defineToolSchema({
6572
6637
  });
6573
6638
 
6574
6639
  // src/tools/wallet/import/tool.ts
6640
+ function readSecret(prompt) {
6641
+ return new Promise((resolve, reject) => {
6642
+ if (!process.stdin.isTTY) {
6643
+ reject(new Error("Interactive import requires a terminal. Pass --mnemonic or --key instead."));
6644
+ return;
6645
+ }
6646
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
6647
+ process.stderr.write(prompt);
6648
+ process.stdin.setRawMode(true);
6649
+ let input = "";
6650
+ const onData = (ch) => {
6651
+ const c = ch.toString();
6652
+ if (c === "\n" || c === "\r") {
6653
+ process.stdin.setRawMode(false);
6654
+ process.stdin.removeListener("data", onData);
6655
+ process.stderr.write("\n");
6656
+ rl.close();
6657
+ resolve(input.trim());
6658
+ } else if (c === "") {
6659
+ process.stdin.setRawMode(false);
6660
+ rl.close();
6661
+ process.exit(0);
6662
+ } else if (c === "\x7F" || c === "\b") {
6663
+ input = input.slice(0, -1);
6664
+ } else {
6665
+ input += c;
6666
+ }
6667
+ };
6668
+ process.stdin.on("data", onData);
6669
+ });
6670
+ }
6671
+ function detectSecretType(secret) {
6672
+ const words = secret.split(/\s+/);
6673
+ if (words.length >= 12 && words.length <= 24 && validateMnemonic(secret, english2)) {
6674
+ return "mnemonic";
6675
+ }
6676
+ return "key";
6677
+ }
6575
6678
  var walletImport = createTool(walletImportSchema, async (params) => {
6576
6679
  if (params.mnemonic && params.key) {
6577
6680
  throw new Error("Provide either --mnemonic or --key, not both.");
6578
6681
  }
6579
- if (params.mnemonic) {
6580
- const trimmed = params.mnemonic.trim().toLowerCase();
6682
+ let mnemonic = params.mnemonic;
6683
+ let key = params.key;
6684
+ if (!mnemonic && !key) {
6685
+ const secret = await readSecret("Paste your mnemonic or private key (hidden): ");
6686
+ if (!secret) {
6687
+ throw new Error("No input provided.");
6688
+ }
6689
+ const type = detectSecretType(secret);
6690
+ if (type === "mnemonic") {
6691
+ mnemonic = secret;
6692
+ } else {
6693
+ key = secret;
6694
+ }
6695
+ }
6696
+ if (mnemonic) {
6697
+ const trimmed = mnemonic.trim().toLowerCase();
6581
6698
  if (!validateMnemonic(trimmed, english2)) {
6582
6699
  throw new Error("Invalid BIP39 mnemonic.");
6583
6700
  }
@@ -6592,20 +6709,20 @@ var walletImport = createTool(walletImportSchema, async (params) => {
6592
6709
  return { name: params.name, type: "hd", addresses };
6593
6710
  }
6594
6711
  const chain = params.chain ? KEY_CHAIN_MAP[params.chain] : "solana";
6595
- const key = params.key ?? "";
6712
+ const keyValue = key ?? "";
6596
6713
  let address;
6597
6714
  let cleanKey;
6598
6715
  if (chain === "solana") {
6599
6716
  try {
6600
- const secretKeyBytes = bs58.decode(key);
6717
+ const secretKeyBytes = bs58.decode(keyValue);
6601
6718
  const keypair = Keypair.fromSecretKey(secretKeyBytes);
6602
6719
  address = keypair.publicKey.toBase58();
6603
- cleanKey = key;
6720
+ cleanKey = keyValue;
6604
6721
  } catch {
6605
6722
  throw new Error("Invalid Solana private key. Expected base58-encoded secret key.");
6606
6723
  }
6607
6724
  } else if (chain === "ethereum") {
6608
- cleanKey = key.startsWith("0x") ? key.slice(2) : key;
6725
+ cleanKey = keyValue.startsWith("0x") ? keyValue.slice(2) : keyValue;
6609
6726
  if (!/^[0-9a-fA-F]{64}$/.test(cleanKey)) {
6610
6727
  throw new Error("Invalid EVM private key. Expected 64-character hex string.");
6611
6728
  }
@@ -6685,7 +6802,7 @@ var walletDeleteSchema = defineToolSchema({
6685
6802
  var walletDelete = createTool(walletDeleteSchema, async (params) => {
6686
6803
  if (!params.confirm) {
6687
6804
  throw new Error(
6688
- "Deletion not confirmed. Pass --confirm to permanently delete this wallet."
6805
+ "Back up your wallet before deleting! Run `mp wallet export " + params.wallet + "` to save your recovery phrase, then re-run with --confirm to permanently delete."
6689
6806
  );
6690
6807
  }
6691
6808
  const wallet = findWalletOrThrow(params.wallet);
@@ -7603,10 +7720,14 @@ var loginSchema = defineToolSchema({
7603
7720
  // src/tools/login/tool.ts
7604
7721
  var login = createTool(loginSchema, async (params) => {
7605
7722
  const { baseUrl } = getConfigOrDefault();
7606
- await callPublicTool(baseUrl, "login", { email: params.email });
7723
+ const url = `${baseUrl}/login?email=${encodeURIComponent(params.email)}`;
7607
7724
  return {
7608
7725
  email: params.email,
7609
- message: `Verification code sent to ${params.email}. Run: mp verify --email ${params.email} --code <code>`
7726
+ message: `Open this link to verify:
7727
+
7728
+ ${url}
7729
+
7730
+ Then run: mp verify --email ${params.email} --code <code>`
7610
7731
  };
7611
7732
  });
7612
7733
 
@@ -7723,4 +7844,4 @@ export {
7723
7844
  consentCheck,
7724
7845
  LOCAL_TOOLS
7725
7846
  };
7726
- //# sourceMappingURL=chunk-AFUYZK7C.js.map
7847
+ //# sourceMappingURL=chunk-CTYZ36RZ.js.map