@moonpay/cli 0.6.10 → 0.6.11

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.
@@ -12,13 +12,12 @@ import {
12
12
  expandAddresses,
13
13
  findWalletOrThrow,
14
14
  getEncryptionKey,
15
- keyChainSchema,
16
15
  loadWallets,
17
16
  mutateWallets,
18
17
  removeWallet,
19
18
  resolveSigningKey,
20
19
  walletInfoSchema
21
- } from "./chunk-AL5WDHLT.js";
20
+ } from "./chunk-ZYYH3VNA.js";
22
21
 
23
22
  // src/auth.ts
24
23
  import * as fs from "fs";
@@ -6002,27 +6001,20 @@ var schemas_default = [
6002
6001
  description: "Signature of the message, signed by the wallet's private key"
6003
6002
  },
6004
6003
  chain: {
6005
- anyOf: [
6006
- {
6007
- type: "string",
6008
- enum: [
6009
- "solana",
6010
- "ethereum",
6011
- "base",
6012
- "polygon",
6013
- "arbitrum",
6014
- "optimism",
6015
- "bnb",
6016
- "avalanche",
6017
- "tron",
6018
- "bitcoin"
6019
- ]
6020
- },
6021
- {
6022
- type: "null"
6023
- }
6004
+ type: "string",
6005
+ enum: [
6006
+ "solana",
6007
+ "ethereum",
6008
+ "base",
6009
+ "polygon",
6010
+ "arbitrum",
6011
+ "optimism",
6012
+ "bnb",
6013
+ "avalanche",
6014
+ "tron",
6015
+ "bitcoin"
6024
6016
  ],
6025
- description: "Blockchain (defaults to solana)"
6017
+ description: "Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"
6026
6018
  }
6027
6019
  },
6028
6020
  required: [
@@ -6100,11 +6092,10 @@ var schemas_default = [
6100
6092
  }
6101
6093
  ];
6102
6094
 
6103
- // src/tools/wallet/create/tool.ts
6104
- import { generateMnemonic } from "@scure/bip39";
6105
- import { wordlist as english } from "@scure/bip39/wordlists/english";
6106
- import { execSync } from "child_process";
6107
- import { platform } from "os";
6095
+ // src/tools/consent/check/tool.ts
6096
+ import * as fs2 from "fs";
6097
+ import * as os2 from "os";
6098
+ import * as path2 from "path";
6108
6099
 
6109
6100
  // src/tools/shared.ts
6110
6101
  var defineToolSchema = (config) => config;
@@ -6117,36 +6108,59 @@ var createTool = (schema, handler) => ({
6117
6108
  }
6118
6109
  });
6119
6110
 
6120
- // src/tools/wallet/create/schema.ts
6111
+ // src/tools/consent/check/schema.ts
6121
6112
  import { z } from "zod";
6113
+ var consentCheckSchema = defineToolSchema({
6114
+ name: "consent_check",
6115
+ description: "Check whether the MoonPay Terms of Service and Privacy Policy have been accepted. Throws if not accepted.",
6116
+ input: z.object({}),
6117
+ output: z.object({
6118
+ accepted: z.literal(true),
6119
+ tosVersion: z.string(),
6120
+ acceptedAt: z.string()
6121
+ })
6122
+ });
6123
+
6124
+ // src/tools/consent/check/tool.ts
6125
+ var CONSENT_PATH = path2.join(os2.homedir(), ".config", "moonpay", "consent.json");
6126
+ var CURRENT_TOS_VERSION = "1.0";
6127
+ var consentCheck = createTool(consentCheckSchema, async () => {
6128
+ let consent = null;
6129
+ try {
6130
+ consent = JSON.parse(fs2.readFileSync(CONSENT_PATH, "utf-8"));
6131
+ } catch {
6132
+ }
6133
+ if (!consent || consent.tosVersion !== CURRENT_TOS_VERSION) {
6134
+ throw new Error(
6135
+ "Terms of Service not yet accepted. Run `mp consent accept` first."
6136
+ );
6137
+ }
6138
+ return {
6139
+ accepted: true,
6140
+ tosVersion: consent.tosVersion,
6141
+ acceptedAt: consent.acceptedAt
6142
+ };
6143
+ });
6144
+
6145
+ // src/tools/wallet/create/tool.ts
6146
+ import { generateMnemonic } from "@scure/bip39";
6147
+ import { wordlist as english } from "@scure/bip39/wordlists/english";
6148
+
6149
+ // src/tools/wallet/create/schema.ts
6150
+ import { z as z2 } from "zod";
6122
6151
  var walletCreateSchema = defineToolSchema({
6123
6152
  name: "wallet_create",
6124
6153
  description: "Create a new multi-chain HD wallet. Generates a BIP39 mnemonic and derives addresses for Solana, Ethereum, Bitcoin, and Tron. The mnemonic is copied to clipboard (interactive) or omitted (headless). Keys are encrypted with a random key stored in the OS keychain.",
6125
- input: z.object({
6126
- name: z.string().describe("Wallet name")
6154
+ input: z2.object({
6155
+ name: z2.string().describe("Wallet name")
6127
6156
  }),
6128
- output: z.object({
6129
- name: z.string(),
6130
- addresses: z.record(keyChainSchema, z.string())
6157
+ output: z2.object({
6158
+ name: z2.string(),
6159
+ addresses: z2.record(chainSchema, z2.string())
6131
6160
  })
6132
6161
  });
6133
6162
 
6134
6163
  // src/tools/wallet/create/tool.ts
6135
- function copyToClipboard(text) {
6136
- try {
6137
- const os2 = platform();
6138
- if (os2 === "darwin") {
6139
- execSync("pbcopy", { input: text, stdio: ["pipe", "ignore", "ignore"] });
6140
- return true;
6141
- }
6142
- if (os2 === "linux") {
6143
- execSync("xclip -selection clipboard", { input: text, stdio: ["pipe", "ignore", "ignore"] });
6144
- return true;
6145
- }
6146
- } catch {
6147
- }
6148
- return false;
6149
- }
6150
6164
  var walletCreate = createTool(walletCreateSchema, async (params) => {
6151
6165
  const mnemonic = generateMnemonic(english, 256);
6152
6166
  const addresses = deriveAllAddresses(mnemonic);
@@ -6157,19 +6171,6 @@ var walletCreate = createTool(walletCreateSchema, async (params) => {
6157
6171
  addresses,
6158
6172
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6159
6173
  });
6160
- if (process.stdout.isTTY) {
6161
- const copied = copyToClipboard(mnemonic);
6162
- if (copied) {
6163
- process.stderr.write(
6164
- "\nMnemonic copied to clipboard. Paste it into your password manager.\nClipboard will be cleared in 30 seconds.\n\n"
6165
- );
6166
- setTimeout(() => copyToClipboard(""), 3e4).unref();
6167
- } else {
6168
- process.stderr.write(
6169
- "\nCould not copy to clipboard. Run `mp wallet export` to view your mnemonic.\n\n"
6170
- );
6171
- }
6172
- }
6173
6174
  return { name: params.name, addresses: expandAddresses(addresses) };
6174
6175
  });
6175
6176
 
@@ -6181,19 +6182,19 @@ import bs58 from "bs58";
6181
6182
  import { privateKeyToAccount } from "viem/accounts";
6182
6183
 
6183
6184
  // src/tools/wallet/import/schema.ts
6184
- import { z as z2 } from "zod";
6185
+ import { z as z3 } from "zod";
6185
6186
  var walletImportSchema = defineToolSchema({
6186
6187
  name: "wallet_import",
6187
6188
  description: "Import a wallet from a BIP39 mnemonic (HD, all chains) or a single private key (one chain). Provide either --mnemonic or --key, not both.",
6188
- input: z2.object({
6189
- name: z2.string().describe("Wallet name"),
6190
- mnemonic: z2.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),
6191
- key: z2.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),
6189
+ input: z3.object({
6190
+ name: z3.string().describe("Wallet name"),
6191
+ mnemonic: z3.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),
6192
+ key: z3.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),
6192
6193
  chain: chainSchema.nullable().describe("Chain for single-key import (default solana)")
6193
6194
  }),
6194
- output: z2.object({
6195
- name: z2.string(),
6196
- type: z2.enum(["hd", "imported"]),
6195
+ output: z3.object({
6196
+ name: z3.string(),
6197
+ type: z3.enum(["hd", "imported"]),
6197
6198
  addresses: addressesSchema
6198
6199
  })
6199
6200
  });
@@ -6252,12 +6253,12 @@ var walletImport = createTool(walletImportSchema, async (params) => {
6252
6253
  });
6253
6254
 
6254
6255
  // src/tools/wallet/list/schema.ts
6255
- import { z as z3 } from "zod";
6256
+ import { z as z4 } from "zod";
6256
6257
  var walletListSchema = defineToolSchema({
6257
6258
  name: "wallet_list",
6258
6259
  description: "List all local wallets",
6259
- input: z3.object({}),
6260
- output: z3.array(walletInfoSchema)
6260
+ input: z4.object({}),
6261
+ output: z4.array(walletInfoSchema)
6261
6262
  });
6262
6263
 
6263
6264
  // src/tools/wallet/list/tool.ts
@@ -6272,12 +6273,12 @@ var walletList = createTool(walletListSchema, async () => {
6272
6273
  });
6273
6274
 
6274
6275
  // src/tools/wallet/retrieve/schema.ts
6275
- import { z as z4 } from "zod";
6276
+ import { z as z5 } from "zod";
6276
6277
  var walletRetrieveSchema = defineToolSchema({
6277
6278
  name: "wallet_retrieve",
6278
6279
  description: "Get details of a specific wallet",
6279
- input: z4.object({
6280
- wallet: z4.string().describe("Wallet name or address")
6280
+ input: z5.object({
6281
+ wallet: z5.string().describe("Wallet name or address")
6281
6282
  }),
6282
6283
  output: walletInfoSchema
6283
6284
  });
@@ -6294,17 +6295,17 @@ var walletRetrieve = createTool(walletRetrieveSchema, async (params) => {
6294
6295
  });
6295
6296
 
6296
6297
  // src/tools/wallet/delete/schema.ts
6297
- import { z as z5 } from "zod";
6298
+ import { z as z6 } from "zod";
6298
6299
  var walletDeleteSchema = defineToolSchema({
6299
6300
  name: "wallet_delete",
6300
6301
  description: "Permanently delete a local wallet. This removes the private key file and cannot be undone.",
6301
- input: z5.object({
6302
- wallet: z5.string().describe("Name or address of the wallet to delete"),
6303
- confirm: z5.boolean().describe("Must be true to confirm deletion")
6302
+ input: z6.object({
6303
+ wallet: z6.string().describe("Name or address of the wallet to delete"),
6304
+ confirm: z6.boolean().describe("Must be true to confirm deletion")
6304
6305
  }),
6305
- output: z5.object({
6306
- name: z5.string().describe("Name of the deleted wallet"),
6307
- deleted: z5.literal(true)
6306
+ output: z6.object({
6307
+ name: z6.string().describe("Name of the deleted wallet"),
6308
+ deleted: z6.literal(true)
6308
6309
  })
6309
6310
  });
6310
6311
 
@@ -6321,17 +6322,17 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
6321
6322
  });
6322
6323
 
6323
6324
  // src/tools/wallet/rename/schema.ts
6324
- import { z as z6 } from "zod";
6325
+ import { z as z7 } from "zod";
6325
6326
  var walletRenameSchema = defineToolSchema({
6326
6327
  name: "wallet_rename",
6327
6328
  description: "Rename a local wallet.",
6328
- input: z6.object({
6329
- wallet: z6.string().describe("Current name or address of the wallet"),
6330
- name: z6.string().describe("New name for the wallet")
6329
+ input: z7.object({
6330
+ wallet: z7.string().describe("Current name or address of the wallet"),
6331
+ name: z7.string().describe("New name for the wallet")
6331
6332
  }),
6332
- output: z6.object({
6333
- oldName: z6.string(),
6334
- newName: z6.string()
6333
+ output: z7.object({
6334
+ oldName: z7.string(),
6335
+ newName: z7.string()
6335
6336
  })
6336
6337
  });
6337
6338
 
@@ -6354,6 +6355,48 @@ var walletRename = createTool(walletRenameSchema, async (params) => {
6354
6355
  return { oldName, newName: params.name };
6355
6356
  });
6356
6357
 
6358
+ // src/tools/wallet/export/schema.ts
6359
+ import { z as z8 } from "zod";
6360
+ var walletExportSchema = defineToolSchema({
6361
+ name: "wallet_export",
6362
+ description: "Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",
6363
+ input: z8.object({
6364
+ wallet: z8.string().describe("Wallet name")
6365
+ }),
6366
+ output: z8.object({
6367
+ exported: z8.literal(true)
6368
+ })
6369
+ });
6370
+
6371
+ // src/tools/wallet/export/tool.ts
6372
+ var walletExport = createTool(walletExportSchema, async (params) => {
6373
+ if (!process.stdout.isTTY) {
6374
+ throw new Error(
6375
+ "Wallet export requires an interactive terminal.\nRun this command directly in your terminal: mp wallet export " + params.wallet
6376
+ );
6377
+ }
6378
+ const wallet = findWalletOrThrow(params.wallet);
6379
+ if (wallet.type === "hd") {
6380
+ process.stderr.write(`
6381
+ Mnemonic for "${wallet.name}":
6382
+
6383
+ `);
6384
+ process.stderr.write(` ${wallet.mnemonic}
6385
+
6386
+ `);
6387
+ process.stderr.write("Write this down and store it securely.\n\n");
6388
+ } else {
6389
+ process.stderr.write(`
6390
+ Private key for "${wallet.name}" (${wallet.chain}):
6391
+
6392
+ `);
6393
+ process.stderr.write(` ${wallet.privateKey}
6394
+
6395
+ `);
6396
+ }
6397
+ return { exported: true };
6398
+ });
6399
+
6357
6400
  // src/tools/transaction/sign/tool.ts
6358
6401
  import { createHash } from "crypto";
6359
6402
  import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
@@ -6364,19 +6407,19 @@ import * as viemChains from "viem/chains";
6364
6407
  import * as ecc from "tiny-secp256k1";
6365
6408
 
6366
6409
  // src/tools/transaction/sign/schema.ts
6367
- import { z as z7 } from "zod";
6410
+ import { z as z9 } from "zod";
6368
6411
  var transactionSignSchema = defineToolSchema({
6369
6412
  name: "transaction_sign",
6370
6413
  description: "Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",
6371
- input: z7.object({
6372
- wallet: z7.string().describe("Wallet name or address"),
6414
+ input: z9.object({
6415
+ wallet: z9.string().describe("Wallet name or address"),
6373
6416
  chain: chainSchema.describe(
6374
6417
  "Chain: solana, ethereum, base, arbitrum, or bitcoin"
6375
6418
  ),
6376
- transaction: z7.string().describe("Base64-encoded unsigned transaction")
6419
+ transaction: z9.string().describe("Base64-encoded unsigned transaction")
6377
6420
  }),
6378
- output: z7.object({
6379
- transaction: z7.string().describe("Base64-encoded signed transaction")
6421
+ output: z9.object({
6422
+ transaction: z9.string().describe("Base64-encoded signed transaction")
6380
6423
  })
6381
6424
  });
6382
6425
 
@@ -6491,19 +6534,19 @@ import { keccak_256 } from "@noble/hashes/sha3";
6491
6534
  import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
6492
6535
 
6493
6536
  // src/tools/message/sign/schema.ts
6494
- import { z as z8 } from "zod";
6537
+ import { z as z10 } from "zod";
6495
6538
  var messageSignSchema = defineToolSchema({
6496
6539
  name: "message_sign",
6497
6540
  description: "Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",
6498
- input: z8.object({
6499
- wallet: z8.string().describe("Wallet address or name to sign with"),
6541
+ input: z10.object({
6542
+ wallet: z10.string().describe("Wallet address or name to sign with"),
6500
6543
  chain: chainSchema.describe(
6501
6544
  "Chain: solana, ethereum, base, arbitrum, or bitcoin"
6502
6545
  ),
6503
- message: z8.string().describe("Message text to sign")
6546
+ message: z10.string().describe("Message text to sign")
6504
6547
  }),
6505
- output: z8.object({
6506
- signature: z8.string().describe(
6548
+ output: z10.object({
6549
+ signature: z10.string().describe(
6507
6550
  "Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin"
6508
6551
  )
6509
6552
  })
@@ -6563,26 +6606,26 @@ function signBitcoin2(privateKey, messageBytes) {
6563
6606
  import https from "https";
6564
6607
 
6565
6608
  // src/tools/bitcoin/balance/schema.ts
6566
- import { z as z9 } from "zod";
6609
+ import { z as z11 } from "zod";
6567
6610
  var bitcoinBalanceRetrieveSchema = defineToolSchema({
6568
6611
  name: "bitcoin_balance_retrieve",
6569
6612
  description: "Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",
6570
- input: z9.object({
6571
- wallet: z9.string().describe("Bitcoin address (bc1...) or wallet name")
6613
+ input: z11.object({
6614
+ wallet: z11.string().describe("Bitcoin address (bc1...) or wallet name")
6572
6615
  }),
6573
- output: z9.object({
6574
- address: z9.string().describe("Bitcoin address"),
6575
- confirmed: z9.object({
6576
- btc: z9.string().describe("Confirmed balance in BTC"),
6577
- sats: z9.number().describe("Confirmed balance in satoshis")
6616
+ output: z11.object({
6617
+ address: z11.string().describe("Bitcoin address"),
6618
+ confirmed: z11.object({
6619
+ btc: z11.string().describe("Confirmed balance in BTC"),
6620
+ sats: z11.number().describe("Confirmed balance in satoshis")
6578
6621
  }),
6579
- unconfirmed: z9.object({
6580
- btc: z9.string().describe("Unconfirmed (pending) balance in BTC"),
6581
- sats: z9.number().describe("Unconfirmed (pending) balance in satoshis")
6622
+ unconfirmed: z11.object({
6623
+ btc: z11.string().describe("Unconfirmed (pending) balance in BTC"),
6624
+ sats: z11.number().describe("Unconfirmed (pending) balance in satoshis")
6582
6625
  }),
6583
- total: z9.object({
6584
- btc: z9.string().describe("Total balance in BTC"),
6585
- sats: z9.number().describe("Total balance in satoshis")
6626
+ total: z11.object({
6627
+ btc: z11.string().describe("Total balance in BTC"),
6628
+ sats: z11.number().describe("Total balance in satoshis")
6586
6629
  })
6587
6630
  })
6588
6631
  });
@@ -6617,7 +6660,7 @@ var bitcoinBalanceRetrieve = createTool(
6617
6660
  async (params) => {
6618
6661
  let address = params.wallet;
6619
6662
  if (!address.startsWith("bc1") && !address.startsWith("1") && !address.startsWith("3")) {
6620
- const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-QVVENVIP.js");
6663
+ const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-6OIOBMHW.js");
6621
6664
  const wallet = findWalletOrThrow2(address);
6622
6665
  const btcAddress = wallet.addresses.bitcoin;
6623
6666
  if (!btcAddress) {
@@ -6642,28 +6685,141 @@ var bitcoinBalanceRetrieve = createTool(
6642
6685
  }
6643
6686
  );
6644
6687
 
6688
+ // src/tools/skill/server.ts
6689
+ import { readdirSync, readFileSync as readFileSync3, existsSync as existsSync2, mkdirSync as mkdirSync2, cpSync } from "fs";
6690
+ import { join as join3, dirname } from "path";
6691
+ import { homedir as homedir3 } from "os";
6692
+ import { fileURLToPath } from "url";
6693
+ function getSkillsDir() {
6694
+ const __filename = fileURLToPath(import.meta.url);
6695
+ const distDir = dirname(__filename);
6696
+ return join3(distDir, "..", "skills");
6697
+ }
6698
+ function getClaudeSkillsDir() {
6699
+ return join3(homedir3(), ".claude", "skills");
6700
+ }
6701
+ function listBundledSkills() {
6702
+ const dir = getSkillsDir();
6703
+ if (!existsSync2(dir)) return [];
6704
+ return readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name.startsWith("moonpay-")).map((e) => {
6705
+ const md = readFileSync3(join3(dir, e.name, "SKILL.md"), "utf-8");
6706
+ const descMatch = md.match(/^description:\s*(.+)$/m);
6707
+ return {
6708
+ name: e.name,
6709
+ description: descMatch?.[1]?.replace(/^["']|["']$/g, "") ?? ""
6710
+ };
6711
+ }).sort((a, b) => a.name.localeCompare(b.name));
6712
+ }
6713
+ function readSkill(name) {
6714
+ if (/[/\\]|\.\./.test(name)) throw new Error(`Invalid skill name: "${name}"`);
6715
+ const skillPath = join3(getSkillsDir(), name, "SKILL.md");
6716
+ if (!existsSync2(skillPath)) {
6717
+ throw new Error(`Skill "${name}" not found. Run \`mp skill list\` to see available skills.`);
6718
+ }
6719
+ return readFileSync3(skillPath, "utf-8");
6720
+ }
6721
+ function installSkills(force, dir) {
6722
+ const srcDir = getSkillsDir();
6723
+ const destDir = dir ?? getClaudeSkillsDir();
6724
+ const skills = listBundledSkills();
6725
+ mkdirSync2(destDir, { recursive: true });
6726
+ return skills.map((s) => {
6727
+ const dest = join3(destDir, s.name);
6728
+ if (existsSync2(dest) && !force) {
6729
+ return { name: s.name, installed: false };
6730
+ }
6731
+ cpSync(join3(srcDir, s.name), dest, { recursive: true, force: true });
6732
+ return { name: s.name, installed: true };
6733
+ });
6734
+ }
6735
+
6736
+ // src/tools/skill/list/schema.ts
6737
+ import { z as z12 } from "zod";
6738
+ var skillListSchema = defineToolSchema({
6739
+ name: "skill_list",
6740
+ description: "List available AI skills for Claude Code and other agents",
6741
+ input: z12.object({}),
6742
+ output: z12.array(
6743
+ z12.object({
6744
+ name: z12.string(),
6745
+ description: z12.string()
6746
+ })
6747
+ )
6748
+ });
6749
+
6750
+ // src/tools/skill/list/tool.ts
6751
+ var skillList = createTool(skillListSchema, async () => {
6752
+ return listBundledSkills();
6753
+ });
6754
+
6755
+ // src/tools/skill/retrieve/schema.ts
6756
+ import { z as z13 } from "zod";
6757
+ var skillRetrieveSchema = defineToolSchema({
6758
+ name: "skill_retrieve",
6759
+ description: "Get the full instructions for a specific skill",
6760
+ input: z13.object({
6761
+ name: z13.string().describe("Skill name (e.g. moonpay-swap-tokens)")
6762
+ }),
6763
+ output: z13.object({
6764
+ name: z13.string(),
6765
+ content: z13.string()
6766
+ })
6767
+ });
6768
+
6769
+ // src/tools/skill/retrieve/tool.ts
6770
+ var skillRetrieve = createTool(skillRetrieveSchema, async (params) => {
6771
+ return {
6772
+ name: params.name,
6773
+ content: readSkill(params.name)
6774
+ };
6775
+ });
6776
+
6777
+ // src/tools/skill/install/schema.ts
6778
+ import { z as z14 } from "zod";
6779
+ var skillInstallSchema = defineToolSchema({
6780
+ name: "skill_install",
6781
+ description: "Install AI skills for Claude Code. Defaults to ~/.claude/skills/, or specify --dir for a custom location (e.g. project-local, ~/.agents/skills).",
6782
+ input: z14.object({
6783
+ force: z14.boolean().describe("Overwrite existing skills"),
6784
+ dir: z14.string().nullable().describe(
6785
+ "Target directory to install skills into (default: ~/.claude/skills/)"
6786
+ )
6787
+ }),
6788
+ output: z14.array(
6789
+ z14.object({
6790
+ name: z14.string(),
6791
+ installed: z14.boolean()
6792
+ })
6793
+ )
6794
+ });
6795
+
6796
+ // src/tools/skill/install/tool.ts
6797
+ var skillInstall = createTool(skillInstallSchema, async (params) => {
6798
+ return installSkills(params.force, params.dir ?? void 0);
6799
+ });
6800
+
6645
6801
  // src/tools/token/swap/tool.ts
6646
6802
  import { encodeFunctionData } from "viem";
6647
6803
 
6648
6804
  // src/tools/token/swap/schema.ts
6649
- import { z as z10 } from "zod";
6650
- var swapOutputSchema = z10.object({
6651
- signature: z10.string().describe("Transaction hash/signature"),
6652
- message: z10.string().describe("Human-readable swap description")
6805
+ import { z as z15 } from "zod";
6806
+ var swapOutputSchema = z15.object({
6807
+ signature: z15.string().describe("Transaction hash/signature"),
6808
+ message: z15.string().describe("Human-readable swap description")
6653
6809
  });
6654
6810
  var tokenSwapSchema = defineToolSchema({
6655
6811
  name: "token_swap",
6656
6812
  description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
6657
- input: z10.object({
6658
- wallet: z10.string().describe("Local wallet name to sign with"),
6813
+ input: z15.object({
6814
+ wallet: z15.string().describe("Local wallet name to sign with"),
6659
6815
  chain: chainSchema.describe("Chain to swap on"),
6660
- from: z10.object({
6661
- token: z10.string().describe("Input token address (selling)"),
6662
- amount: z10.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
6816
+ from: z15.object({
6817
+ token: z15.string().describe("Input token address (selling)"),
6818
+ amount: z15.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")
6663
6819
  }),
6664
- to: z10.object({
6665
- token: z10.string().describe("Output token address (buying)"),
6666
- amount: z10.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
6820
+ to: z15.object({
6821
+ token: z15.string().describe("Output token address (buying)"),
6822
+ amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
6667
6823
  })
6668
6824
  }),
6669
6825
  output: swapOutputSchema
@@ -6671,18 +6827,18 @@ var tokenSwapSchema = defineToolSchema({
6671
6827
  var tokenBridgeSchema = defineToolSchema({
6672
6828
  name: "token_bridge",
6673
6829
  description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
6674
- input: z10.object({
6675
- from: z10.object({
6676
- wallet: z10.string().describe("Local wallet name to sign with"),
6830
+ input: z15.object({
6831
+ from: z15.object({
6832
+ wallet: z15.string().describe("Local wallet name to sign with"),
6677
6833
  chain: chainSchema.describe("Source chain"),
6678
- token: z10.string().describe("Source token address"),
6679
- amount: z10.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")
6834
+ token: z15.string().describe("Source token address"),
6835
+ amount: z15.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")
6680
6836
  }),
6681
- to: z10.object({
6682
- wallet: z10.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),
6837
+ to: z15.object({
6838
+ wallet: z15.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),
6683
6839
  chain: chainSchema.describe("Destination chain"),
6684
- token: z10.string().describe("Destination token address"),
6685
- amount: z10.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
6840
+ token: z15.string().describe("Destination token address"),
6841
+ amount: z15.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")
6686
6842
  })
6687
6843
  }),
6688
6844
  output: swapOutputSchema
@@ -6787,6 +6943,62 @@ var tokenSwap = createTool(tokenSwapSchema, async (params) => {
6787
6943
  });
6788
6944
  });
6789
6945
 
6946
+ // src/tools/token/transfer/schema.ts
6947
+ import { z as z16 } from "zod";
6948
+ var tokenTransferSchema = defineToolSchema({
6949
+ name: "token_transfer",
6950
+ description: "Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",
6951
+ input: z16.object({
6952
+ wallet: z16.string().describe("Local wallet name to sign with"),
6953
+ chain: chainSchema.describe("Chain to transfer on"),
6954
+ token: z16.string().describe("Token address to transfer"),
6955
+ amount: z16.coerce.number().describe("Amount to transfer"),
6956
+ to: z16.string().describe("Recipient wallet name or address")
6957
+ }),
6958
+ output: z16.object({
6959
+ signature: z16.string().describe("Transaction hash/signature"),
6960
+ message: z16.string().describe("Human-readable transfer description")
6961
+ })
6962
+ });
6963
+
6964
+ // src/tools/token/transfer/tool.ts
6965
+ var tokenTransfer = createTool(tokenTransferSchema, async (params) => {
6966
+ const baseUrl = resolveBaseUrl();
6967
+ const wallet = await walletRetrieve.handler({ wallet: params.wallet });
6968
+ const fromAddress = wallet.addresses[KEY_CHAIN_MAP[params.chain]];
6969
+ if (!fromAddress) {
6970
+ throw new Error(`Wallet "${wallet.name}" has no address on ${params.chain}.`);
6971
+ }
6972
+ let toAddress = params.to;
6973
+ try {
6974
+ const toWallet = await walletRetrieve.handler({ wallet: params.to });
6975
+ toAddress = toWallet.addresses[KEY_CHAIN_MAP[params.chain]] ?? params.to;
6976
+ } catch {
6977
+ }
6978
+ const buildResult = await callRemoteTool(baseUrl, "token_transfer", {
6979
+ wallet: fromAddress,
6980
+ token: params.token,
6981
+ to: toAddress,
6982
+ amount: params.amount,
6983
+ chain: params.chain
6984
+ });
6985
+ const txPayload = "base64" in buildResult.transaction ? buildResult.transaction.base64 : JSON.stringify(buildResult.transaction);
6986
+ const { transaction: signedTransaction } = await transactionSign.handler({
6987
+ wallet: wallet.name,
6988
+ chain: params.chain,
6989
+ transaction: txPayload
6990
+ });
6991
+ const sendResult = await callRemoteTool(baseUrl, "transaction_send", {
6992
+ transaction: signedTransaction,
6993
+ message: buildResult.message,
6994
+ chain: params.chain
6995
+ });
6996
+ if (!sendResult.signature) {
6997
+ throw new Error(`Transaction send failed: ${sendResult.message}`);
6998
+ }
6999
+ return { signature: sendResult.signature, message: buildResult.message };
7000
+ });
7001
+
6790
7002
  // src/tools/x402/request/tool.ts
6791
7003
  import { Keypair as Keypair4, VersionedTransaction as VersionedTransaction2, VersionedMessage } from "@solana/web3.js";
6792
7004
  import axios from "axios";
@@ -6800,13 +7012,13 @@ import { createPublicClient as createPublicClient2, http as http2 } from "viem";
6800
7012
  import * as viemChains2 from "viem/chains";
6801
7013
 
6802
7014
  // src/tools/x402/request/schema.ts
6803
- import { z as z11 } from "zod";
7015
+ import { z as z17 } from "zod";
6804
7016
  var x402RequestSchema = defineToolSchema({
6805
7017
  name: "x402_request",
6806
7018
  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.",
6807
- input: z11.object({
6808
- method: z11.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
6809
- url: z11.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
7019
+ input: z17.object({
7020
+ method: z17.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
7021
+ url: z17.string().url().refine((u) => u.startsWith("https://"), { message: "URL must use HTTPS" }).refine(
6810
7022
  (u) => {
6811
7023
  try {
6812
7024
  const host = new URL(u).hostname;
@@ -6819,15 +7031,15 @@ var x402RequestSchema = defineToolSchema({
6819
7031
  ).describe(
6820
7032
  "Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
6821
7033
  ),
6822
- body: z11.record(z11.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
6823
- params: z11.record(z11.any()).nullable().describe("Query parameters"),
6824
- wallet: z11.string().describe("Wallet name or address to pay with"),
6825
- chain: z11.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.")
7034
+ body: z17.record(z17.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
7035
+ params: z17.record(z17.any()).nullable().describe("Query parameters"),
7036
+ wallet: z17.string().describe("Wallet name or address to pay with"),
7037
+ 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.")
6826
7038
  }),
6827
- output: z11.object({
6828
- status: z11.number().describe("HTTP status code"),
6829
- data: z11.any().describe("Response data"),
6830
- headers: z11.record(z11.any()).describe("Response headers")
7039
+ output: z17.object({
7040
+ status: z17.number().describe("HTTP status code"),
7041
+ data: z17.any().describe("Response data"),
7042
+ headers: z17.record(z17.any()).describe("Response headers")
6831
7043
  })
6832
7044
  });
6833
7045
 
@@ -6919,18 +7131,18 @@ var x402Request = createTool(
6919
7131
  );
6920
7132
 
6921
7133
  // src/tools/virtual-account/wallet/register/schema.ts
6922
- import { z as z12 } from "zod";
7134
+ import { z as z18 } from "zod";
6923
7135
  var virtualAccountWalletRegisterSchema = defineToolSchema({
6924
7136
  name: "virtual-account_wallet_register",
6925
7137
  description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
6926
- input: z12.object({
6927
- wallet: z12.string().describe("Local wallet name"),
7138
+ input: z18.object({
7139
+ wallet: z18.string().describe("Local wallet name"),
6928
7140
  chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
6929
7141
  }),
6930
- output: z12.object({
6931
- success: z12.literal(true),
6932
- address: z12.string().describe("Registered wallet address"),
6933
- chain: z12.string().describe("Chain registered on")
7142
+ output: z18.object({
7143
+ success: z18.literal(true),
7144
+ address: z18.string().describe("Registered wallet address"),
7145
+ chain: z18.string().describe("Chain registered on")
6934
7146
  })
6935
7147
  });
6936
7148
 
@@ -6966,29 +7178,177 @@ var virtualAccountWalletRegister = createTool(
6966
7178
  }
6967
7179
  );
6968
7180
 
6969
- export {
6970
- getConfigOrDefault,
6971
- saveCredentials,
6972
- clearCredentials,
6973
- resolveBaseUrl,
6974
- callPublicTool,
6975
- callTool,
6976
- callRemoteTool,
6977
- schemas_default,
6978
- defineToolSchema,
6979
- createTool,
7181
+ // src/tools/consent/accept/tool.ts
7182
+ import * as fs3 from "fs";
7183
+ import * as os3 from "os";
7184
+ import * as path3 from "path";
7185
+
7186
+ // src/tools/consent/accept/schema.ts
7187
+ import { z as z19 } from "zod";
7188
+ var consentAcceptSchema = defineToolSchema({
7189
+ name: "consent_accept",
7190
+ description: "Accept the MoonPay Terms of Service and Privacy Policy. Required before using any CLI command.",
7191
+ input: z19.object({}),
7192
+ output: z19.object({
7193
+ tosVersion: z19.string(),
7194
+ acceptedAt: z19.string()
7195
+ })
7196
+ });
7197
+
7198
+ // src/tools/consent/accept/tool.ts
7199
+ var CONFIG_DIR2 = path3.join(os3.homedir(), ".config", "moonpay");
7200
+ var CONSENT_PATH2 = path3.join(CONFIG_DIR2, "consent.json");
7201
+ var CURRENT_TOS_VERSION2 = "1.0";
7202
+ var consentAccept = createTool(consentAcceptSchema, async () => {
7203
+ if (!fs3.existsSync(CONFIG_DIR2)) {
7204
+ fs3.mkdirSync(CONFIG_DIR2, { recursive: true, mode: 448 });
7205
+ }
7206
+ const now = (/* @__PURE__ */ new Date()).toISOString();
7207
+ const consent = { tosVersion: CURRENT_TOS_VERSION2, acceptedAt: now };
7208
+ const tmp = CONSENT_PATH2 + `.tmp.${process.pid}`;
7209
+ fs3.writeFileSync(tmp, JSON.stringify(consent, null, 2), {
7210
+ encoding: "utf-8",
7211
+ mode: 384
7212
+ });
7213
+ fs3.renameSync(tmp, CONSENT_PATH2);
7214
+ return consent;
7215
+ });
7216
+
7217
+ // src/tools/login/schema.ts
7218
+ import { z as z20 } from "zod";
7219
+ var loginSchema = defineToolSchema({
7220
+ name: "login",
7221
+ description: "Send a login verification code to your email.",
7222
+ input: z20.object({
7223
+ email: z20.string().describe("Email address")
7224
+ }),
7225
+ output: z20.object({
7226
+ email: z20.string(),
7227
+ message: z20.string()
7228
+ })
7229
+ });
7230
+
7231
+ // src/tools/login/tool.ts
7232
+ var login = createTool(loginSchema, async (params) => {
7233
+ const { baseUrl } = getConfigOrDefault();
7234
+ await callPublicTool(baseUrl, "login", { email: params.email });
7235
+ return {
7236
+ email: params.email,
7237
+ message: `Verification code sent to ${params.email}. Run: mp verify --email ${params.email} --code <code>`
7238
+ };
7239
+ });
7240
+
7241
+ // src/tools/verify/schema.ts
7242
+ import { z as z21 } from "zod";
7243
+ var verifySchema = defineToolSchema({
7244
+ name: "verify",
7245
+ description: "Verify login code and store encrypted credentials.",
7246
+ input: z21.object({
7247
+ email: z21.string().describe("Email address"),
7248
+ code: z21.string().describe("Verification code")
7249
+ }),
7250
+ output: z21.object({
7251
+ email: z21.string(),
7252
+ message: z21.string()
7253
+ })
7254
+ });
7255
+
7256
+ // src/tools/verify/tool.ts
7257
+ var verify = createTool(verifySchema, async (params) => {
7258
+ const { baseUrl } = getConfigOrDefault();
7259
+ const tokens = await callPublicTool(baseUrl, "verify", {
7260
+ email: params.email,
7261
+ code: params.code
7262
+ });
7263
+ const creds = {
7264
+ accessToken: tokens.accessToken,
7265
+ refreshToken: tokens.refreshToken,
7266
+ expiresAt: tokens.expiresAt * 1e3,
7267
+ baseUrl
7268
+ };
7269
+ saveCredentials(creds);
7270
+ return { email: params.email, message: "Logged in successfully." };
7271
+ });
7272
+
7273
+ // src/tools/logout/schema.ts
7274
+ import { z as z22 } from "zod";
7275
+ var logoutSchema = defineToolSchema({
7276
+ name: "logout",
7277
+ description: "Log out and clear stored credentials.",
7278
+ input: z22.object({}),
7279
+ output: z22.object({
7280
+ success: z22.literal(true),
7281
+ message: z22.string()
7282
+ })
7283
+ });
7284
+
7285
+ // src/tools/logout/tool.ts
7286
+ var logout = createTool(logoutSchema, async () => {
7287
+ clearCredentials();
7288
+ return { success: true, message: "Logged out." };
7289
+ });
7290
+
7291
+ // src/tools/qr/tool.ts
7292
+ import { createRequire } from "module";
7293
+
7294
+ // src/tools/qr/schema.ts
7295
+ import { z as z23 } from "zod";
7296
+ var qrGenerateSchema = defineToolSchema({
7297
+ name: "qr_generate",
7298
+ description: "Display a QR code in the terminal. Pass any text \u2014 wallet address, URL, token address, etc.",
7299
+ input: z23.object({
7300
+ value: z23.string().describe("Text to encode as a QR code")
7301
+ }),
7302
+ output: z23.object({
7303
+ value: z23.string()
7304
+ })
7305
+ });
7306
+
7307
+ // src/tools/qr/tool.ts
7308
+ var require2 = createRequire(import.meta.url);
7309
+ var qrcode = require2("qrcode-terminal");
7310
+ var qrGenerate = createTool(qrGenerateSchema, async (params) => {
7311
+ qrcode.generate(params.value, { small: true }, (code) => {
7312
+ process.stderr.write(`
7313
+ ${code}
7314
+ `);
7315
+ });
7316
+ return { value: params.value };
7317
+ });
7318
+
7319
+ // src/local-tools.ts
7320
+ var LOCAL_TOOLS = [
6980
7321
  walletCreate,
6981
7322
  walletImport,
6982
7323
  walletList,
6983
7324
  walletRetrieve,
6984
7325
  walletDelete,
6985
7326
  walletRename,
7327
+ walletExport,
6986
7328
  transactionSign,
6987
7329
  messageSign,
6988
7330
  bitcoinBalanceRetrieve,
6989
- tokenBridge,
7331
+ skillList,
7332
+ skillRetrieve,
7333
+ skillInstall,
6990
7334
  tokenSwap,
7335
+ tokenBridge,
7336
+ tokenTransfer,
6991
7337
  x402Request,
6992
- virtualAccountWalletRegister
7338
+ virtualAccountWalletRegister,
7339
+ consentAccept,
7340
+ consentCheck,
7341
+ login,
7342
+ verify,
7343
+ logout,
7344
+ qrGenerate
7345
+ ];
7346
+
7347
+ export {
7348
+ resolveBaseUrl,
7349
+ callTool,
7350
+ schemas_default,
7351
+ consentCheck,
7352
+ LOCAL_TOOLS
6993
7353
  };
6994
- //# sourceMappingURL=chunk-TIV6G4KD.js.map
7354
+ //# sourceMappingURL=chunk-6TW2YUWK.js.map