@moonpay/cli 0.2.1 → 0.2.2

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
@@ -2771,102 +2771,52 @@ function startVersionCheck(currentVersion) {
2771
2771
  var schemas_default = [
2772
2772
  {
2773
2773
  name: "buy",
2774
- description: "Generate a buy link for purchasing crypto with fiat. Specify either from.amount (fiat to spend) or to.amount (tokens to buy), not both.",
2774
+ description: "Buy crypto with fiat via MoonPay. Returns a checkout URL to complete the purchase.",
2775
2775
  inputSchema: {
2776
2776
  $ref: "#/definitions/buy_input",
2777
2777
  definitions: {
2778
2778
  buy_input: {
2779
2779
  type: "object",
2780
2780
  properties: {
2781
+ token: {
2782
+ type: "string",
2783
+ enum: [
2784
+ "sol",
2785
+ "usdc",
2786
+ "usdc_arbitrum",
2787
+ "usdc_base",
2788
+ "usdc_optimism",
2789
+ "usdc_sol",
2790
+ "usdc_polygon",
2791
+ "eth",
2792
+ "eth_polygon",
2793
+ "eth_optimism",
2794
+ "eth_base",
2795
+ "eth_arbitrum"
2796
+ ],
2797
+ description: "MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), etc."
2798
+ },
2799
+ amount: {
2800
+ type: "number",
2801
+ description: "Amount of token to buy (e.g. 1.5 for 1.5 SOL)"
2802
+ },
2803
+ wallet: {
2804
+ type: "string",
2805
+ description: "Destination wallet address to receive the tokens"
2806
+ },
2781
2807
  email: {
2782
2808
  type: [
2783
2809
  "string",
2784
2810
  "null"
2785
2811
  ],
2786
- description: "Email address for the buyer"
2787
- },
2788
- from: {
2789
- type: "object",
2790
- properties: {
2791
- currency: {
2792
- type: "string",
2793
- enum: [
2794
- "usd",
2795
- "eur",
2796
- "gbp"
2797
- ],
2798
- description: "Payment currency to spend (e.g., usd, eur, gbp)"
2799
- },
2800
- amount: {
2801
- anyOf: [
2802
- {
2803
- type: "number",
2804
- minimum: 20
2805
- },
2806
- {
2807
- type: "null"
2808
- }
2809
- ],
2810
- description: "Amount in payment currency to spend"
2811
- }
2812
- },
2813
- required: [
2814
- "currency",
2815
- "amount"
2816
- ],
2817
- additionalProperties: false,
2818
- description: "Payment currency and amount to spend"
2819
- },
2820
- to: {
2821
- type: "object",
2822
- properties: {
2823
- chain: {
2824
- type: "string",
2825
- enum: [
2826
- "solana",
2827
- "ethereum",
2828
- "base",
2829
- "polygon",
2830
- "arbitrum",
2831
- "optimism"
2832
- ],
2833
- description: "Destination blockchain network"
2834
- },
2835
- currency: {
2836
- type: "string",
2837
- enum: [
2838
- "sol",
2839
- "usdc",
2840
- "eth"
2841
- ],
2842
- description: "The crypto currency to buy"
2843
- },
2844
- amount: {
2845
- type: [
2846
- "number",
2847
- "null"
2848
- ],
2849
- description: "Amount of tokens to buy"
2850
- },
2851
- wallet: {
2852
- type: "string",
2853
- description: "Destination wallet address"
2854
- }
2855
- },
2856
- required: [
2857
- "chain",
2858
- "currency",
2859
- "amount",
2860
- "wallet"
2861
- ],
2862
- additionalProperties: false,
2863
- description: "Destination chain, currency, token amount, and wallet"
2812
+ description: "Buyer email to pre-fill on the checkout page"
2864
2813
  }
2865
2814
  },
2866
2815
  required: [
2867
- "email",
2868
- "from",
2869
- "to"
2816
+ "token",
2817
+ "amount",
2818
+ "wallet",
2819
+ "email"
2870
2820
  ],
2871
2821
  additionalProperties: false
2872
2822
  }
@@ -4537,34 +4487,8 @@ function registerRemoteTools(parent, remoteSchemas) {
4537
4487
  });
4538
4488
  }
4539
4489
  }
4540
- var TOKENS = ["sol", "usdc", "eth"];
4541
- var CHAINS = ["solana", "ethereum", "base", "polygon", "arbitrum", "optimism"];
4542
- program.command("buy").description("Buy crypto with fiat via MoonPay").requiredOption("--email <email>", "Buyer email address").requiredOption("--token <token>", `Token to buy (${TOKENS.join(", ")})`).requiredOption("--amount <amount>", "Amount of token to buy").requiredOption("--wallet <wallet>", "Destination wallet address").option("--chain <chain>", `Blockchain (${CHAINS.join(", ")})`, "solana").action(async (options) => {
4543
- try {
4544
- const baseUrl = resolveBaseUrl();
4545
- const result = await callTool(baseUrl, "buy", {
4546
- email: options.email,
4547
- from: { currency: "usd", amount: null },
4548
- to: {
4549
- chain: options.chain,
4550
- currency: options.token,
4551
- amount: Number(options.amount),
4552
- wallet: options.wallet
4553
- }
4554
- });
4555
- printResult(result);
4556
- printUpdateNotice();
4557
- } catch (error) {
4558
- console.error(error.message);
4559
- process.exit(1);
4560
- }
4561
- });
4562
- var CUSTOM_TOOLS = /* @__PURE__ */ new Set(["buy"]);
4563
4490
  registerLocalTools(program, LOCAL_TOOLS);
4564
- registerRemoteTools(
4565
- program,
4566
- schemas_default.filter((s) => !CUSTOM_TOOLS.has(s.name))
4567
- );
4491
+ registerRemoteTools(program, schemas_default);
4568
4492
  program.command("tools").description("List available tools").action(() => {
4569
4493
  const allTools = [
4570
4494
  ...LOCAL_TOOLS.map((t) => ({