@moonpay/cli 0.6.14 → 0.6.16

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.
@@ -236,7 +236,8 @@ async function callTool(baseUrl, toolName, params) {
236
236
  }
237
237
  }
238
238
  if (res.status === 429) {
239
- throw new Error("Rate limit exceeded. Please wait a moment and try again.");
239
+ const hint = token ? "" : " Log in with `mp login` for higher limits.";
240
+ throw new Error(`Rate limit exceeded. Please wait a moment and try again.${hint}`);
240
241
  }
241
242
  if (res.status === 401) {
242
243
  throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");
@@ -7287,32 +7288,11 @@ var skillInstall = createTool(skillInstallSchema, async (params) => {
7287
7288
  return installSkills(params.force, params.dir ?? void 0);
7288
7289
  });
7289
7290
 
7290
- // src/tools/token/swap/tool.ts
7291
+ // src/tools/token/bridge/tool.ts
7291
7292
  import { encodeFunctionData } from "viem";
7292
7293
 
7293
- // src/tools/token/swap/schema.ts
7294
+ // src/tools/token/bridge/schema.ts
7294
7295
  import { z as z15 } from "zod";
7295
- var swapOutputSchema = z15.object({
7296
- signature: z15.string().describe("Transaction hash/signature"),
7297
- message: z15.string().describe("Human-readable swap description")
7298
- });
7299
- var tokenSwapSchema = defineToolSchema({
7300
- name: "token_swap",
7301
- description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
7302
- input: z15.object({
7303
- wallet: z15.string().describe("Local wallet name to sign with"),
7304
- chain: chainSchema.describe("Chain to swap on"),
7305
- from: z15.object({
7306
- token: z15.string().describe("Input token address (selling)"),
7307
- amount: z15.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
7308
- }),
7309
- to: z15.object({
7310
- token: z15.string().describe("Output token address (buying)"),
7311
- amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
7312
- })
7313
- }),
7314
- output: swapOutputSchema
7315
- });
7316
7296
  var tokenBridgeSchema = defineToolSchema({
7317
7297
  name: "token_bridge",
7318
7298
  description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
@@ -7330,10 +7310,13 @@ var tokenBridgeSchema = defineToolSchema({
7330
7310
  amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
7331
7311
  })
7332
7312
  }),
7333
- output: swapOutputSchema
7313
+ output: z15.object({
7314
+ signature: z15.string().describe("Transaction hash/signature"),
7315
+ message: z15.string().describe("Human-readable bridge description")
7316
+ })
7334
7317
  });
7335
7318
 
7336
- // src/tools/token/swap/tool.ts
7319
+ // src/tools/token/bridge/tool.ts
7337
7320
  var ERC20_APPROVE_ABI = [
7338
7321
  {
7339
7322
  name: "approve",
@@ -7398,6 +7381,8 @@ var tokenBridge = createTool(tokenBridgeSchema, async (params) => {
7398
7381
  if (!approvalResult.signature) {
7399
7382
  throw new Error(`Approval failed: ${approvalResult.message}`);
7400
7383
  }
7384
+ process.stderr.write("Approval sent. Waiting for confirmation...\n");
7385
+ await new Promise((r) => setTimeout(r, 5e3));
7401
7386
  buildResult = await callRemoteTool(baseUrl, "swaps_transaction_build", buildParams);
7402
7387
  }
7403
7388
  const txPayload = "base64" in buildResult.transaction ? buildResult.transaction.base64 : JSON.stringify(buildResult.transaction);
@@ -7414,17 +7399,41 @@ var tokenBridge = createTool(tokenBridgeSchema, async (params) => {
7414
7399
  if (!sendResult.signature) {
7415
7400
  throw new Error(`Transaction send failed: ${sendResult.message}`);
7416
7401
  }
7417
- const signature = sendResult.signature;
7418
7402
  try {
7419
7403
  await callRemoteTool(baseUrl, "transaction_register", {
7420
7404
  transactionId: buildResult.transactionId,
7421
- transactionHash: signature,
7405
+ transactionHash: sendResult.signature,
7422
7406
  chain: params.from.chain
7423
7407
  });
7424
7408
  } catch {
7425
7409
  }
7426
- return { signature, message: buildResult.message };
7410
+ return { signature: sendResult.signature, message: buildResult.message };
7427
7411
  });
7412
+
7413
+ // src/tools/token/swap/schema.ts
7414
+ import { z as z16 } from "zod";
7415
+ var tokenSwapSchema = defineToolSchema({
7416
+ name: "token_swap",
7417
+ description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
7418
+ input: z16.object({
7419
+ wallet: z16.string().describe("Local wallet name to sign with"),
7420
+ chain: chainSchema.describe("Chain to swap on"),
7421
+ from: z16.object({
7422
+ token: z16.string().describe("Input token address (selling)"),
7423
+ amount: z16.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
7424
+ }),
7425
+ to: z16.object({
7426
+ token: z16.string().describe("Output token address (buying)"),
7427
+ amount: z16.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
7428
+ })
7429
+ }),
7430
+ output: z16.object({
7431
+ signature: z16.string().describe("Transaction hash/signature"),
7432
+ message: z16.string().describe("Human-readable swap description")
7433
+ })
7434
+ });
7435
+
7436
+ // src/tools/token/swap/tool.ts
7428
7437
  var tokenSwap = createTool(tokenSwapSchema, async (params) => {
7429
7438
  return tokenBridge.handler({
7430
7439
  from: { wallet: params.wallet, chain: params.chain, token: params.from.token, amount: params.from.amount },
@@ -7433,20 +7442,20 @@ var tokenSwap = createTool(tokenSwapSchema, async (params) => {
7433
7442
  });
7434
7443
 
7435
7444
  // src/tools/token/transfer/schema.ts
7436
- import { z as z16 } from "zod";
7445
+ import { z as z17 } from "zod";
7437
7446
  var tokenTransferSchema = defineToolSchema({
7438
7447
  name: "token_transfer",
7439
7448
  description: "Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",
7440
- input: z16.object({
7441
- wallet: z16.string().describe("Local wallet name to sign with"),
7449
+ input: z17.object({
7450
+ wallet: z17.string().describe("Local wallet name to sign with"),
7442
7451
  chain: chainSchema.describe("Chain to transfer on"),
7443
- token: z16.string().describe("Token address to transfer"),
7444
- amount: z16.coerce.number().describe("Amount to transfer"),
7445
- to: z16.string().describe("Recipient wallet name or address")
7452
+ token: z17.string().describe("Token address to transfer"),
7453
+ amount: z17.coerce.number().describe("Amount to transfer"),
7454
+ to: z17.string().describe("Recipient wallet name or address")
7446
7455
  }),
7447
- output: z16.object({
7448
- signature: z16.string().describe("Transaction hash/signature"),
7449
- message: z16.string().describe("Human-readable transfer description")
7456
+ output: z17.object({
7457
+ signature: z17.string().describe("Transaction hash/signature"),
7458
+ message: z17.string().describe("Human-readable transfer description")
7450
7459
  })
7451
7460
  });
7452
7461
 
@@ -7501,13 +7510,13 @@ import { createPublicClient as createPublicClient2, http as http2 } from "viem";
7501
7510
  import * as viemChains2 from "viem/chains";
7502
7511
 
7503
7512
  // src/tools/x402/request/schema.ts
7504
- import { z as z17 } from "zod";
7513
+ import { z as z18 } from "zod";
7505
7514
  var x402RequestSchema = defineToolSchema({
7506
7515
  name: "x402_request",
7507
7516
  description: "Make an HTTP request to an x402-protected endpoint. Automatically handles payment when a 402 Payment Required response is received, signing the payment transaction with the local wallet.",
7508
- input: z17.object({
7509
- method: z17.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
7510
- url: z17.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
7517
+ input: z18.object({
7518
+ method: z18.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
7519
+ url: z18.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
7511
7520
  (u) => {
7512
7521
  try {
7513
7522
  const host = new URL(u).hostname;
@@ -7520,15 +7529,15 @@ var x402RequestSchema = defineToolSchema({
7520
7529
  ).describe(
7521
7530
  "Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
7522
7531
  ),
7523
- body: z17.record(z17.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
7524
- params: z17.record(z17.any()).nullable().describe("Query parameters"),
7525
- wallet: z17.string().describe("Wallet name or address to pay with"),
7526
- chain: z17.enum(["solana", "base", "ethereum", "arbitrum", "polygon", "optimism"]).nullable().describe("Chain to pay from (default: solana). Use an EVM chain like 'base' to pay with an EVM wallet.")
7532
+ body: z18.record(z18.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
7533
+ params: z18.record(z18.any()).nullable().describe("Query parameters"),
7534
+ wallet: z18.string().describe("Wallet name or address to pay with"),
7535
+ chain: z18.enum(["solana", "base", "ethereum", "arbitrum", "polygon", "optimism"]).nullable().describe("Chain to pay from (default: solana). Use an EVM chain like 'base' to pay with an EVM wallet.")
7527
7536
  }),
7528
- output: z17.object({
7529
- status: z17.number().describe("HTTP status code"),
7530
- data: z17.any().describe("Response data"),
7531
- headers: z17.record(z17.any()).describe("Response headers")
7537
+ output: z18.object({
7538
+ status: z18.number().describe("HTTP status code"),
7539
+ data: z18.any().describe("Response data"),
7540
+ headers: z18.record(z18.any()).describe("Response headers")
7532
7541
  })
7533
7542
  });
7534
7543
 
@@ -7620,18 +7629,18 @@ var x402Request = createTool(
7620
7629
  );
7621
7630
 
7622
7631
  // src/tools/virtual-account/wallet/register/schema.ts
7623
- import { z as z18 } from "zod";
7632
+ import { z as z19 } from "zod";
7624
7633
  var virtualAccountWalletRegisterSchema = defineToolSchema({
7625
7634
  name: "virtual-account_wallet_register",
7626
7635
  description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
7627
- input: z18.object({
7628
- wallet: z18.string().describe("Local wallet name"),
7636
+ input: z19.object({
7637
+ wallet: z19.string().describe("Local wallet name"),
7629
7638
  chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
7630
7639
  }),
7631
- output: z18.object({
7632
- success: z18.literal(true),
7633
- address: z18.string().describe("Registered wallet address"),
7634
- chain: z18.string().describe("Chain registered on")
7640
+ output: z19.object({
7641
+ success: z19.literal(true),
7642
+ address: z19.string().describe("Registered wallet address"),
7643
+ chain: z19.string().describe("Chain registered on")
7635
7644
  })
7636
7645
  });
7637
7646
 
@@ -7673,14 +7682,14 @@ import * as os3 from "os";
7673
7682
  import * as path3 from "path";
7674
7683
 
7675
7684
  // src/tools/consent/accept/schema.ts
7676
- import { z as z19 } from "zod";
7685
+ import { z as z20 } from "zod";
7677
7686
  var consentAcceptSchema = defineToolSchema({
7678
7687
  name: "consent_accept",
7679
7688
  description: "Accept the MoonPay Terms of Service and Privacy Policy. Required before using any CLI command.",
7680
- input: z19.object({}),
7681
- output: z19.object({
7682
- tosVersion: z19.string(),
7683
- acceptedAt: z19.string()
7689
+ input: z20.object({}),
7690
+ output: z20.object({
7691
+ tosVersion: z20.string(),
7692
+ acceptedAt: z20.string()
7684
7693
  })
7685
7694
  });
7686
7695
 
@@ -7704,16 +7713,16 @@ var consentAccept = createTool(consentAcceptSchema, async () => {
7704
7713
  });
7705
7714
 
7706
7715
  // src/tools/login/schema.ts
7707
- import { z as z20 } from "zod";
7716
+ import { z as z21 } from "zod";
7708
7717
  var loginSchema = defineToolSchema({
7709
7718
  name: "login",
7710
7719
  description: "Send a login verification code to your email.",
7711
- input: z20.object({
7712
- email: z20.string().describe("Email address")
7720
+ input: z21.object({
7721
+ email: z21.string().describe("Email address")
7713
7722
  }),
7714
- output: z20.object({
7715
- email: z20.string(),
7716
- message: z20.string()
7723
+ output: z21.object({
7724
+ email: z21.string(),
7725
+ message: z21.string()
7717
7726
  })
7718
7727
  });
7719
7728
 
@@ -7732,17 +7741,17 @@ Then run: mp verify --email ${params.email} --code <code>`
7732
7741
  });
7733
7742
 
7734
7743
  // src/tools/verify/schema.ts
7735
- import { z as z21 } from "zod";
7744
+ import { z as z22 } from "zod";
7736
7745
  var verifySchema = defineToolSchema({
7737
7746
  name: "verify",
7738
7747
  description: "Verify login code and store encrypted credentials.",
7739
- input: z21.object({
7740
- email: z21.string().describe("Email address"),
7741
- code: z21.string().describe("Verification code")
7748
+ input: z22.object({
7749
+ email: z22.string().describe("Email address"),
7750
+ code: z22.string().describe("Verification code")
7742
7751
  }),
7743
- output: z21.object({
7744
- email: z21.string(),
7745
- message: z21.string()
7752
+ output: z22.object({
7753
+ email: z22.string(),
7754
+ message: z22.string()
7746
7755
  })
7747
7756
  });
7748
7757
 
@@ -7764,14 +7773,14 @@ var verify = createTool(verifySchema, async (params) => {
7764
7773
  });
7765
7774
 
7766
7775
  // src/tools/logout/schema.ts
7767
- import { z as z22 } from "zod";
7776
+ import { z as z23 } from "zod";
7768
7777
  var logoutSchema = defineToolSchema({
7769
7778
  name: "logout",
7770
7779
  description: "Log out and clear stored credentials.",
7771
- input: z22.object({}),
7772
- output: z22.object({
7773
- success: z22.literal(true),
7774
- message: z22.string()
7780
+ input: z23.object({}),
7781
+ output: z23.object({
7782
+ success: z23.literal(true),
7783
+ message: z23.string()
7775
7784
  })
7776
7785
  });
7777
7786
 
@@ -7785,15 +7794,15 @@ var logout = createTool(logoutSchema, async () => {
7785
7794
  import { createRequire } from "module";
7786
7795
 
7787
7796
  // src/tools/qr/schema.ts
7788
- import { z as z23 } from "zod";
7797
+ import { z as z24 } from "zod";
7789
7798
  var qrGenerateSchema = defineToolSchema({
7790
7799
  name: "qr_generate",
7791
7800
  description: "Display a QR code in the terminal. Pass any text \u2014 wallet address, URL, token address, etc.",
7792
- input: z23.object({
7793
- value: z23.string().describe("Text to encode as a QR code")
7801
+ input: z24.object({
7802
+ value: z24.string().describe("Text to encode as a QR code")
7794
7803
  }),
7795
- output: z23.object({
7796
- value: z23.string()
7804
+ output: z24.object({
7805
+ value: z24.string()
7797
7806
  })
7798
7807
  });
7799
7808
 
@@ -7844,4 +7853,4 @@ export {
7844
7853
  consentCheck,
7845
7854
  LOCAL_TOOLS
7846
7855
  };
7847
- //# sourceMappingURL=chunk-CTYZ36RZ.js.map
7856
+ //# sourceMappingURL=chunk-2GHQM7DN.js.map