@moonpay/cli 0.6.9 → 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";
@@ -332,7 +331,7 @@ var schemas_default = [
332
331
  },
333
332
  {
334
333
  name: "deposit_create",
335
- description: "Create a new deposit link that generates multi-chain deposit addresses. Anyone can send crypto to these addresses from Solana, Ethereum, Bitcoin, or Tron \u2014 it automatically converts to USDC and settles to the specified destination wallet and chain.",
334
+ description: "Create a new deposit link that generates multi-chain deposit addresses. Anyone can send crypto to these addresses from Solana, Ethereum, Bitcoin, or Tron \u2014 it automatically converts to the specified stablecoin and settles to the destination wallet and chain.",
336
335
  inputSchema: {
337
336
  $ref: "#/definitions/deposit_create_input",
338
337
  definitions: {
@@ -357,13 +356,23 @@ var schemas_default = [
357
356
  "arbitrum",
358
357
  "bnb"
359
358
  ],
360
- description: "Blockchain of the destination wallet (determines which USDC the wallet receives)"
359
+ description: "Blockchain of the destination wallet"
360
+ },
361
+ token: {
362
+ type: "string",
363
+ enum: [
364
+ "USDC",
365
+ "USDC.e",
366
+ "USDT"
367
+ ],
368
+ description: "Token to receive. USDC.e (bridged USDC) is only available on Polygon."
361
369
  }
362
370
  },
363
371
  required: [
364
372
  "name",
365
373
  "wallet",
366
- "chain"
374
+ "chain",
375
+ "token"
367
376
  ],
368
377
  additionalProperties: false
369
378
  }
@@ -382,11 +391,11 @@ var schemas_default = [
382
391
  },
383
392
  destinationWallet: {
384
393
  type: "string",
385
- description: "Wallet address that will receive USDC"
394
+ description: "Wallet address that will receive the stablecoin"
386
395
  },
387
396
  destinationChain: {
388
397
  type: "string",
389
- description: "Chain where USDC will be delivered"
398
+ description: "Chain where the stablecoin will be delivered"
390
399
  },
391
400
  customerToken: {
392
401
  type: "string",
@@ -5074,10 +5083,18 @@ var schemas_default = [
5074
5083
  }
5075
5084
  ],
5076
5085
  description: "Filter: pending (need to accept, default) or accepted (already signed)"
5086
+ },
5087
+ country: {
5088
+ type: [
5089
+ "string",
5090
+ "null"
5091
+ ],
5092
+ description: "Country code for terms (e.g. USA, GBR). Defaults to USA."
5077
5093
  }
5078
5094
  },
5079
5095
  required: [
5080
- "status"
5096
+ "status",
5097
+ "country"
5081
5098
  ],
5082
5099
  additionalProperties: false
5083
5100
  }
@@ -5984,27 +6001,20 @@ var schemas_default = [
5984
6001
  description: "Signature of the message, signed by the wallet's private key"
5985
6002
  },
5986
6003
  chain: {
5987
- anyOf: [
5988
- {
5989
- type: "string",
5990
- enum: [
5991
- "solana",
5992
- "ethereum",
5993
- "base",
5994
- "polygon",
5995
- "arbitrum",
5996
- "optimism",
5997
- "bnb",
5998
- "avalanche",
5999
- "tron",
6000
- "bitcoin"
6001
- ]
6002
- },
6003
- {
6004
- type: "null"
6005
- }
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"
6006
6016
  ],
6007
- description: "Blockchain (defaults to solana)"
6017
+ description: "Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"
6008
6018
  }
6009
6019
  },
6010
6020
  required: [
@@ -6082,11 +6092,10 @@ var schemas_default = [
6082
6092
  }
6083
6093
  ];
6084
6094
 
6085
- // src/tools/wallet/create/tool.ts
6086
- import { generateMnemonic } from "@scure/bip39";
6087
- import { wordlist as english } from "@scure/bip39/wordlists/english";
6088
- import { execSync } from "child_process";
6089
- 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";
6090
6099
 
6091
6100
  // src/tools/shared.ts
6092
6101
  var defineToolSchema = (config) => config;
@@ -6099,36 +6108,59 @@ var createTool = (schema, handler) => ({
6099
6108
  }
6100
6109
  });
6101
6110
 
6102
- // src/tools/wallet/create/schema.ts
6111
+ // src/tools/consent/check/schema.ts
6103
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";
6104
6151
  var walletCreateSchema = defineToolSchema({
6105
6152
  name: "wallet_create",
6106
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.",
6107
- input: z.object({
6108
- name: z.string().describe("Wallet name")
6154
+ input: z2.object({
6155
+ name: z2.string().describe("Wallet name")
6109
6156
  }),
6110
- output: z.object({
6111
- name: z.string(),
6112
- addresses: z.record(keyChainSchema, z.string())
6157
+ output: z2.object({
6158
+ name: z2.string(),
6159
+ addresses: z2.record(chainSchema, z2.string())
6113
6160
  })
6114
6161
  });
6115
6162
 
6116
6163
  // src/tools/wallet/create/tool.ts
6117
- function copyToClipboard(text) {
6118
- try {
6119
- const os2 = platform();
6120
- if (os2 === "darwin") {
6121
- execSync("pbcopy", { input: text, stdio: ["pipe", "ignore", "ignore"] });
6122
- return true;
6123
- }
6124
- if (os2 === "linux") {
6125
- execSync("xclip -selection clipboard", { input: text, stdio: ["pipe", "ignore", "ignore"] });
6126
- return true;
6127
- }
6128
- } catch {
6129
- }
6130
- return false;
6131
- }
6132
6164
  var walletCreate = createTool(walletCreateSchema, async (params) => {
6133
6165
  const mnemonic = generateMnemonic(english, 256);
6134
6166
  const addresses = deriveAllAddresses(mnemonic);
@@ -6139,19 +6171,6 @@ var walletCreate = createTool(walletCreateSchema, async (params) => {
6139
6171
  addresses,
6140
6172
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6141
6173
  });
6142
- if (process.stdout.isTTY) {
6143
- const copied = copyToClipboard(mnemonic);
6144
- if (copied) {
6145
- process.stderr.write(
6146
- "\nMnemonic copied to clipboard. Paste it into your password manager.\nClipboard will be cleared in 30 seconds.\n\n"
6147
- );
6148
- setTimeout(() => copyToClipboard(""), 3e4).unref();
6149
- } else {
6150
- process.stderr.write(
6151
- "\nCould not copy to clipboard. Run `mp wallet export` to view your mnemonic.\n\n"
6152
- );
6153
- }
6154
- }
6155
6174
  return { name: params.name, addresses: expandAddresses(addresses) };
6156
6175
  });
6157
6176
 
@@ -6163,19 +6182,19 @@ import bs58 from "bs58";
6163
6182
  import { privateKeyToAccount } from "viem/accounts";
6164
6183
 
6165
6184
  // src/tools/wallet/import/schema.ts
6166
- import { z as z2 } from "zod";
6185
+ import { z as z3 } from "zod";
6167
6186
  var walletImportSchema = defineToolSchema({
6168
6187
  name: "wallet_import",
6169
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.",
6170
- input: z2.object({
6171
- name: z2.string().describe("Wallet name"),
6172
- mnemonic: z2.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),
6173
- 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"),
6174
6193
  chain: chainSchema.nullable().describe("Chain for single-key import (default solana)")
6175
6194
  }),
6176
- output: z2.object({
6177
- name: z2.string(),
6178
- type: z2.enum(["hd", "imported"]),
6195
+ output: z3.object({
6196
+ name: z3.string(),
6197
+ type: z3.enum(["hd", "imported"]),
6179
6198
  addresses: addressesSchema
6180
6199
  })
6181
6200
  });
@@ -6234,12 +6253,12 @@ var walletImport = createTool(walletImportSchema, async (params) => {
6234
6253
  });
6235
6254
 
6236
6255
  // src/tools/wallet/list/schema.ts
6237
- import { z as z3 } from "zod";
6256
+ import { z as z4 } from "zod";
6238
6257
  var walletListSchema = defineToolSchema({
6239
6258
  name: "wallet_list",
6240
6259
  description: "List all local wallets",
6241
- input: z3.object({}),
6242
- output: z3.array(walletInfoSchema)
6260
+ input: z4.object({}),
6261
+ output: z4.array(walletInfoSchema)
6243
6262
  });
6244
6263
 
6245
6264
  // src/tools/wallet/list/tool.ts
@@ -6254,12 +6273,12 @@ var walletList = createTool(walletListSchema, async () => {
6254
6273
  });
6255
6274
 
6256
6275
  // src/tools/wallet/retrieve/schema.ts
6257
- import { z as z4 } from "zod";
6276
+ import { z as z5 } from "zod";
6258
6277
  var walletRetrieveSchema = defineToolSchema({
6259
6278
  name: "wallet_retrieve",
6260
6279
  description: "Get details of a specific wallet",
6261
- input: z4.object({
6262
- wallet: z4.string().describe("Wallet name or address")
6280
+ input: z5.object({
6281
+ wallet: z5.string().describe("Wallet name or address")
6263
6282
  }),
6264
6283
  output: walletInfoSchema
6265
6284
  });
@@ -6276,17 +6295,17 @@ var walletRetrieve = createTool(walletRetrieveSchema, async (params) => {
6276
6295
  });
6277
6296
 
6278
6297
  // src/tools/wallet/delete/schema.ts
6279
- import { z as z5 } from "zod";
6298
+ import { z as z6 } from "zod";
6280
6299
  var walletDeleteSchema = defineToolSchema({
6281
6300
  name: "wallet_delete",
6282
6301
  description: "Permanently delete a local wallet. This removes the private key file and cannot be undone.",
6283
- input: z5.object({
6284
- wallet: z5.string().describe("Name or address of the wallet to delete"),
6285
- 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")
6286
6305
  }),
6287
- output: z5.object({
6288
- name: z5.string().describe("Name of the deleted wallet"),
6289
- deleted: z5.literal(true)
6306
+ output: z6.object({
6307
+ name: z6.string().describe("Name of the deleted wallet"),
6308
+ deleted: z6.literal(true)
6290
6309
  })
6291
6310
  });
6292
6311
 
@@ -6303,17 +6322,17 @@ var walletDelete = createTool(walletDeleteSchema, async (params) => {
6303
6322
  });
6304
6323
 
6305
6324
  // src/tools/wallet/rename/schema.ts
6306
- import { z as z6 } from "zod";
6325
+ import { z as z7 } from "zod";
6307
6326
  var walletRenameSchema = defineToolSchema({
6308
6327
  name: "wallet_rename",
6309
6328
  description: "Rename a local wallet.",
6310
- input: z6.object({
6311
- wallet: z6.string().describe("Current name or address of the wallet"),
6312
- 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")
6313
6332
  }),
6314
- output: z6.object({
6315
- oldName: z6.string(),
6316
- newName: z6.string()
6333
+ output: z7.object({
6334
+ oldName: z7.string(),
6335
+ newName: z7.string()
6317
6336
  })
6318
6337
  });
6319
6338
 
@@ -6336,6 +6355,48 @@ var walletRename = createTool(walletRenameSchema, async (params) => {
6336
6355
  return { oldName, newName: params.name };
6337
6356
  });
6338
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
+
6339
6400
  // src/tools/transaction/sign/tool.ts
6340
6401
  import { createHash } from "crypto";
6341
6402
  import { Keypair as Keypair2, VersionedTransaction } from "@solana/web3.js";
@@ -6346,19 +6407,19 @@ import * as viemChains from "viem/chains";
6346
6407
  import * as ecc from "tiny-secp256k1";
6347
6408
 
6348
6409
  // src/tools/transaction/sign/schema.ts
6349
- import { z as z7 } from "zod";
6410
+ import { z as z9 } from "zod";
6350
6411
  var transactionSignSchema = defineToolSchema({
6351
6412
  name: "transaction_sign",
6352
6413
  description: "Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",
6353
- input: z7.object({
6354
- wallet: z7.string().describe("Wallet name or address"),
6414
+ input: z9.object({
6415
+ wallet: z9.string().describe("Wallet name or address"),
6355
6416
  chain: chainSchema.describe(
6356
6417
  "Chain: solana, ethereum, base, arbitrum, or bitcoin"
6357
6418
  ),
6358
- transaction: z7.string().describe("Base64-encoded unsigned transaction")
6419
+ transaction: z9.string().describe("Base64-encoded unsigned transaction")
6359
6420
  }),
6360
- output: z7.object({
6361
- transaction: z7.string().describe("Base64-encoded signed transaction")
6421
+ output: z9.object({
6422
+ transaction: z9.string().describe("Base64-encoded signed transaction")
6362
6423
  })
6363
6424
  });
6364
6425
 
@@ -6473,19 +6534,19 @@ import { keccak_256 } from "@noble/hashes/sha3";
6473
6534
  import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
6474
6535
 
6475
6536
  // src/tools/message/sign/schema.ts
6476
- import { z as z8 } from "zod";
6537
+ import { z as z10 } from "zod";
6477
6538
  var messageSignSchema = defineToolSchema({
6478
6539
  name: "message_sign",
6479
6540
  description: "Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",
6480
- input: z8.object({
6481
- 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"),
6482
6543
  chain: chainSchema.describe(
6483
6544
  "Chain: solana, ethereum, base, arbitrum, or bitcoin"
6484
6545
  ),
6485
- message: z8.string().describe("Message text to sign")
6546
+ message: z10.string().describe("Message text to sign")
6486
6547
  }),
6487
- output: z8.object({
6488
- signature: z8.string().describe(
6548
+ output: z10.object({
6549
+ signature: z10.string().describe(
6489
6550
  "Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin"
6490
6551
  )
6491
6552
  })
@@ -6545,26 +6606,26 @@ function signBitcoin2(privateKey, messageBytes) {
6545
6606
  import https from "https";
6546
6607
 
6547
6608
  // src/tools/bitcoin/balance/schema.ts
6548
- import { z as z9 } from "zod";
6609
+ import { z as z11 } from "zod";
6549
6610
  var bitcoinBalanceRetrieveSchema = defineToolSchema({
6550
6611
  name: "bitcoin_balance_retrieve",
6551
6612
  description: "Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",
6552
- input: z9.object({
6553
- 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")
6554
6615
  }),
6555
- output: z9.object({
6556
- address: z9.string().describe("Bitcoin address"),
6557
- confirmed: z9.object({
6558
- btc: z9.string().describe("Confirmed balance in BTC"),
6559
- 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")
6560
6621
  }),
6561
- unconfirmed: z9.object({
6562
- btc: z9.string().describe("Unconfirmed (pending) balance in BTC"),
6563
- 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")
6564
6625
  }),
6565
- total: z9.object({
6566
- btc: z9.string().describe("Total balance in BTC"),
6567
- 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")
6568
6629
  })
6569
6630
  })
6570
6631
  });
@@ -6599,7 +6660,7 @@ var bitcoinBalanceRetrieve = createTool(
6599
6660
  async (params) => {
6600
6661
  let address = params.wallet;
6601
6662
  if (!address.startsWith("bc1") && !address.startsWith("1") && !address.startsWith("3")) {
6602
- const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-QVVENVIP.js");
6663
+ const { findWalletOrThrow: findWalletOrThrow2 } = await import("./store-6OIOBMHW.js");
6603
6664
  const wallet = findWalletOrThrow2(address);
6604
6665
  const btcAddress = wallet.addresses.bitcoin;
6605
6666
  if (!btcAddress) {
@@ -6624,28 +6685,141 @@ var bitcoinBalanceRetrieve = createTool(
6624
6685
  }
6625
6686
  );
6626
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
+
6627
6801
  // src/tools/token/swap/tool.ts
6628
6802
  import { encodeFunctionData } from "viem";
6629
6803
 
6630
6804
  // src/tools/token/swap/schema.ts
6631
- import { z as z10 } from "zod";
6632
- var swapOutputSchema = z10.object({
6633
- signature: z10.string().describe("Transaction hash/signature"),
6634
- 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")
6635
6809
  });
6636
6810
  var tokenSwapSchema = defineToolSchema({
6637
6811
  name: "token_swap",
6638
6812
  description: "Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",
6639
- input: z10.object({
6640
- 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"),
6641
6815
  chain: chainSchema.describe("Chain to swap on"),
6642
- from: z10.object({
6643
- token: z10.string().describe("Input token address (selling)"),
6644
- 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.")
6645
6819
  }),
6646
- to: z10.object({
6647
- token: z10.string().describe("Output token address (buying)"),
6648
- 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.")
6649
6823
  })
6650
6824
  }),
6651
6825
  output: swapOutputSchema
@@ -6653,18 +6827,18 @@ var tokenSwapSchema = defineToolSchema({
6653
6827
  var tokenBridgeSchema = defineToolSchema({
6654
6828
  name: "token_bridge",
6655
6829
  description: "Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",
6656
- input: z10.object({
6657
- from: z10.object({
6658
- 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"),
6659
6833
  chain: chainSchema.describe("Source chain"),
6660
- token: z10.string().describe("Source token address"),
6661
- 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.")
6662
6836
  }),
6663
- to: z10.object({
6664
- 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)"),
6665
6839
  chain: chainSchema.describe("Destination chain"),
6666
- token: z10.string().describe("Destination token address"),
6667
- 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.")
6668
6842
  })
6669
6843
  }),
6670
6844
  output: swapOutputSchema
@@ -6769,6 +6943,62 @@ var tokenSwap = createTool(tokenSwapSchema, async (params) => {
6769
6943
  });
6770
6944
  });
6771
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
+
6772
7002
  // src/tools/x402/request/tool.ts
6773
7003
  import { Keypair as Keypair4, VersionedTransaction as VersionedTransaction2, VersionedMessage } from "@solana/web3.js";
6774
7004
  import axios from "axios";
@@ -6782,13 +7012,13 @@ import { createPublicClient as createPublicClient2, http as http2 } from "viem";
6782
7012
  import * as viemChains2 from "viem/chains";
6783
7013
 
6784
7014
  // src/tools/x402/request/schema.ts
6785
- import { z as z11 } from "zod";
7015
+ import { z as z17 } from "zod";
6786
7016
  var x402RequestSchema = defineToolSchema({
6787
7017
  name: "x402_request",
6788
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.",
6789
- input: z11.object({
6790
- method: z11.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method"),
6791
- 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(
6792
7022
  (u) => {
6793
7023
  try {
6794
7024
  const host = new URL(u).hostname;
@@ -6801,15 +7031,15 @@ var x402RequestSchema = defineToolSchema({
6801
7031
  ).describe(
6802
7032
  "Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')"
6803
7033
  ),
6804
- body: z11.record(z11.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),
6805
- params: z11.record(z11.any()).nullable().describe("Query parameters"),
6806
- wallet: z11.string().describe("Wallet name or address to pay with"),
6807
- 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.")
6808
7038
  }),
6809
- output: z11.object({
6810
- status: z11.number().describe("HTTP status code"),
6811
- data: z11.any().describe("Response data"),
6812
- 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")
6813
7043
  })
6814
7044
  });
6815
7045
 
@@ -6901,18 +7131,18 @@ var x402Request = createTool(
6901
7131
  );
6902
7132
 
6903
7133
  // src/tools/virtual-account/wallet/register/schema.ts
6904
- import { z as z12 } from "zod";
7134
+ import { z as z18 } from "zod";
6905
7135
  var virtualAccountWalletRegisterSchema = defineToolSchema({
6906
7136
  name: "virtual-account_wallet_register",
6907
7137
  description: "Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",
6908
- input: z12.object({
6909
- wallet: z12.string().describe("Local wallet name"),
7138
+ input: z18.object({
7139
+ wallet: z18.string().describe("Local wallet name"),
6910
7140
  chain: chainSchema.describe("Chain to register (solana, ethereum, etc.)")
6911
7141
  }),
6912
- output: z12.object({
6913
- success: z12.literal(true),
6914
- address: z12.string().describe("Registered wallet address"),
6915
- 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")
6916
7146
  })
6917
7147
  });
6918
7148
 
@@ -6948,29 +7178,177 @@ var virtualAccountWalletRegister = createTool(
6948
7178
  }
6949
7179
  );
6950
7180
 
6951
- export {
6952
- getConfigOrDefault,
6953
- saveCredentials,
6954
- clearCredentials,
6955
- resolveBaseUrl,
6956
- callPublicTool,
6957
- callTool,
6958
- callRemoteTool,
6959
- schemas_default,
6960
- defineToolSchema,
6961
- 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 = [
6962
7321
  walletCreate,
6963
7322
  walletImport,
6964
7323
  walletList,
6965
7324
  walletRetrieve,
6966
7325
  walletDelete,
6967
7326
  walletRename,
7327
+ walletExport,
6968
7328
  transactionSign,
6969
7329
  messageSign,
6970
7330
  bitcoinBalanceRetrieve,
6971
- tokenBridge,
7331
+ skillList,
7332
+ skillRetrieve,
7333
+ skillInstall,
6972
7334
  tokenSwap,
7335
+ tokenBridge,
7336
+ tokenTransfer,
6973
7337
  x402Request,
6974
- 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
6975
7353
  };
6976
- //# sourceMappingURL=chunk-ZWMKESOK.js.map
7354
+ //# sourceMappingURL=chunk-6TW2YUWK.js.map