@moonpay/cli 1.37.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BRWE5FV5.js → chunk-FWEGM6S2.js} +1 -1
- package/dist/{chunk-YK3I5Y7V.js → chunk-PCT66UYJ.js} +2 -2
- package/dist/{chunk-46OAKYZW.js → chunk-Q3LM7T7N.js} +1 -1
- package/dist/{chunk-HBO7D4I7.js → chunk-UKTF4P2L.js} +9 -9
- package/dist/{client-3OMUSZ3D.js → client-Z4ICZ5ZI.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{ledger-BUI4WTJP.js → ledger-N7IKOYXV.js} +2 -2
- package/dist/{mcp-QYP4QMUJ.js → mcp-H42TRT74.js} +1 -1
- package/dist/{store-DCRPKBYE.js → store-PLPUHSTF.js} +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b}from"./chunk-
|
|
2
|
+
import{b as a,c as b}from"./chunk-FWEGM6S2.js";import"./chunk-Q3LM7T7N.js";import"./chunk-LMDE72OE.js";export{a as moonpay,b as resetClient};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as j,b as J,c as v,d as N}from"./chunk-
|
|
3
|
+
import{a as j,b as J,c as v,d as N}from"./chunk-UKTF4P2L.js";import{b as O}from"./chunk-FWEGM6S2.js";import{m as R}from"./chunk-PCT66UYJ.js";import{e as C,g as q}from"./chunk-Q3LM7T7N.js";import"./chunk-LMDE72OE.js";import{Command as ne}from"commander";var Y=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function w(e){return t=>Y?`${e}${t}\x1B[0m`:t}var p={bold:w("\x1B[1m"),dim:w("\x1B[2m"),green:w("\x1B[32m"),yellow:w("\x1B[33m"),cyan:w("\x1B[36m"),red:w("\x1B[31m")};function k(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function $(e){return e==null?"-":String(e)}function S(e,t=0){let n=" ".repeat(t);return k(e)?`${n}${$(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(k)?e.map(s=>`${n}- ${$(s)}`).join(`
|
|
4
4
|
`):e.map(s=>{if(typeof s!="object"||s===null)return`${n}- ${$(s)}`;let r=Object.entries(s),a=[],[c,l]=r[0];k(l)?a.push(`${n}- ${p.bold(c)}: ${$(l)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(S(l,t+2)));for(let[u,y]of r.slice(1))k(y)?a.push(`${n} ${p.bold(u)}: ${$(y)}`):(a.push(`${n} ${p.bold(u)}:`),a.push(S(y,t+2)));return a.join(`
|
|
5
5
|
`)}).join(`
|
|
6
6
|
|
|
@@ -14,5 +14,5 @@ ${S(a,t+1)}`).join(`
|
|
|
14
14
|
|
|
15
15
|
Run \`mp skill install\` to install AI skills for Claude Code.
|
|
16
16
|
|
|
17
|
-
`+J).version(C).option("--json","Output as JSON instead of YAML");function re(){return h.opts().json?"json":"yaml"}function L(e){console.log(A(e,re()))}function I(){let e=te();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-
|
|
17
|
+
`+J).version(C).option("--json","Output as JSON instead of YAML");function re(){return h.opts().json?"json":"yaml"}function L(e){console.log(A(e,re()))}function I(){let e=te();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-H42TRT74.js");await e()});function Z(e,t){let n=e;for(let s of t){let r=n.commands.find(a=>a.name()===s);r||(r=n.command(s)),n=r}return n}function M(e,t=""){let n=[];for(let[s,r]of Object.entries(e)){let a=t?`${t}-${s}`:s,c=r;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let l=c;l._def.typeName==="ZodNullable"&&(l=l._def.innerType),l._def.typeName==="ZodObject"&&l.shape?n.push(...M(l.shape,a)):n.push({flatKey:a,field:r,path:a.split("-")})}return n}function oe(e,t){let n={};for(let{flatKey:s,path:r}of t){let a=s.replace(/-([a-z])/g,(l,u)=>u.toUpperCase()),c=a in e?e[a]:e[s];if(r.length===1)n[r[0]]=c;else{let l=n;for(let u=0;u<r.length-1;u++)(!l[r[u]]||typeof l[r[u]]!="object")&&(l[r[u]]={}),l=l[r[u]];l[r[r.length-1]]=c}}return n}function se(e,t){for(let n of t){let s=n.schema.name.split("_"),r=s.pop(),c=Z(e,s).command(r).description(n.schema.description),l=n.schema.input.shape??{},u=M(l),y=[],b=[],_=[];for(let{flatKey:f,field:i}of u){let o=i.description??f,m=i;for(;m._def.typeName==="ZodEffects";)m=m._def.schema;let g=m._def.typeName,d=m;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(f),d._def.typeName==="ZodRecord"&&_.push(f),g==="ZodBoolean"?c.option(`--${f}`,o,!1):g==="ZodNullable"?(c.option(`--${f} <${f}>`,o),y.push(f)):c.requiredOption(`--${f} <${f}>`,o)}c.action(async f=>{n.schema.name.startsWith("consent_")||await v.handler({});for(let o of y){let m=o.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());f[m]===void 0&&(f[m]=null)}for(let o of b){let m=o.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());f[m]!=null&&typeof f[m]=="string"&&(f[m]=Number(f[m]))}for(let o of _){let m=o.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof f[m]=="string")try{f[m]=JSON.parse(f[m])}catch{console.error(`Invalid JSON for --${o}`),process.exit(1)}}let i=oe(f,u);try{let o=await n.handler(i);L(o)}catch(o){console.error(o instanceof Error?o.message:String(o)),process.exit(1)}})}}function ie(e){if(e.$ref&&e.definitions){let t=e.$ref.replace("#/definitions/","");return e.definitions[t]}return e}function ae(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(t=>t.type==="null"):!1}function ce(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(t=>t.type==="object"):e.type==="object"}function le(e){return Array.isArray(e.type)?e.type.some(t=>t==="number"||t==="integer"):e.anyOf?e.anyOf.some(t=>t.type==="number"||t.type==="integer"):e.type==="number"||e.type==="integer"}var U=new Set(["swaps_transaction_build","transaction_register","virtual-account_offramp_initiate","prediction-market_position_buy","prediction-market_position_sell","prediction-market_position_redeem","commerce_cart_update","commerce_checkout_start","commerce_checkout_pay"]);function fe(e,t){for(let n of t){if(U.has(n.name))continue;let s=n.name.split("_"),r=s.pop(),a=Z(e,s);if(a.commands.find(i=>i.name()===r))continue;let c=a.command(r).description(n.description),l=ie(n.inputSchema),u=l.properties??{},y=new Set(l.required??[]),b=[],_=[],f=[];for(let[i,o]of Object.entries(u)){let m=o.description??i,g=ae(o),d=ce(o);le(o)&&_.push(i),d?(f.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${m} (as JSON)`):(c.option(`--${i} <json>`,`${m} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,m),b.push(i)):c.requiredOption(`--${i} <${i}>`,m)}c.action(async i=>{await v.handler({});for(let o of b)i[o]===void 0&&(i[o]=null);for(let o of _)i[o]!=null&&typeof i[o]=="string"&&(i[o]=Number(i[o]));for(let o of f)if(typeof i[o]=="string")try{i[o]=JSON.parse(i[o])}catch{console.error(`Invalid JSON for --${o}`),process.exit(1)}try{await D(i);let o=await O._call(n.name,i);L(o),I()}catch(o){console.error(o instanceof Error?o.message:String(o)),process.exit(1)}})}}se(h,N);fe(h,j);h.command("tools").description("List available tools").action(()=>{let e=[...N.map(n=>({name:n.schema.name,description:n.schema.description})),...j.filter(n=>!N.some(s=>s.schema.name===n.name)&&!U.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,s)=>n.name.localeCompare(s.name)),t=[];for(let n of e){let s=n.name.replace(/_/g," ");t.push(` ${p.green(s.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
|
|
18
18
|
`)),I()});h.parse();
|
|
@@ -7,6 +7,6 @@ Run: npm i -g @moonpay/cli --include=optional`;function y(){try{let e=S("@ledger
|
|
|
7
7
|
`),p}async function U(){if(!p)return null;try{let e=y(),i=f().getDeviceSessionState({sessionId:p}),s=await e.firstValueFrom(i.pipe(e.take(1),e.timeout(3e3)));return s.sessionStateType>=1?s.currentApp?.name??null:null}catch{return null}}var M={evm:"Ethereum",solana:"Solana"};function _(e){let n=String(e);return n.includes("6807")||n.includes("6a15")||n.includes("UnknownDeviceExchangeError")}async function C(e){process.stderr.write(`Installing ${e} app on your Ledger...
|
|
8
8
|
`);let{OpenAppWithDependenciesDeviceAction:n}=y(),i=new n({input:{appName:e}}),t=f().executeDeviceAction({sessionId:E(),deviceAction:i});await m(t,`Install ${e}`,18e4),process.stderr.write(`Installed ${e} app
|
|
9
9
|
`)}async function R(e){let n=M[e];if(!n||await U()===n)return;process.stderr.write(`Opening ${n} app on your Ledger...
|
|
10
|
-
`);let{OpenAppDeviceAction:s}=y(),t=new s({input:{appName:n}}),u=f().executeDeviceAction({sessionId:E(),deviceAction:t});try{await m(u,`Open ${n}`)}catch(c){if(_(c)){await D(),await C(n),await D();return}if(!String(c).includes("isconnect"))throw c}await D()}async function D(){try{await f().disconnect({sessionId:p})}catch{}p=null,await new Promise(e=>setTimeout(e,500)),await P()}function $(e,n=0){switch(e){case"evm":return`44'/60'/${n}'/0/0`;case"solana":return`44'/501'/${n}'/0'`;default:throw new Error(`${e} derivation via Ledger is not supported.`)}}function k(e){return e.startsWith("0x")?e.slice(2):e}function T(e){return e.startsWith("0x")?e:`0x${e}`}async function x(e){let{moonpay:n}=await import("./client-
|
|
10
|
+
`);let{OpenAppDeviceAction:s}=y(),t=new s({input:{appName:n}}),u=f().executeDeviceAction({sessionId:E(),deviceAction:t});try{await m(u,`Open ${n}`)}catch(c){if(_(c)){await D(),await C(n),await D();return}if(!String(c).includes("isconnect"))throw c}await D()}async function D(){try{await f().disconnect({sessionId:p})}catch{}p=null,await new Promise(e=>setTimeout(e,500)),await P()}function $(e,n=0){switch(e){case"evm":return`44'/60'/${n}'/0/0`;case"solana":return`44'/501'/${n}'/0'`;default:throw new Error(`${e} derivation via Ledger is not supported.`)}}function k(e){return e.startsWith("0x")?e.slice(2):e}function T(e){return e.startsWith("0x")?e:`0x${e}`}async function x(e){let{moonpay:n}=await import("./client-Z4ICZ5ZI.js"),s=(await n.chain.retrieve({chain:e})).keyFamily;if(s==="bitcoin")throw new Error("Bitcoin address derivation via Ledger is not yet supported.");if(s==="tron")throw new Error("Tron address derivation via Ledger is not supported. The Ethereum signer cannot interact with the Tron Ledger app.");await R(s);let t=$(s),a=E(),u=f();switch(s){case"evm":{let{SignerEthBuilder:c}=I(),l=new c({dmk:u,sessionId:a}).build().getAddress(t,{skipOpenApp:!1});return(await m(l,"Get Ethereum address")).address}case"solana":{let{SignerSolanaBuilder:c}=L(),l=new c({dmk:u,sessionId:a}).build().getAddress(t,{skipOpenApp:!1});return await m(l,"Get Solana address")}default:throw new Error(`Ledger address derivation not supported for ${s}`)}}async function F(){let e={};try{e.ethereum=await x("ethereum")}catch(n){process.stderr.write(`Failed to get Ethereum address: ${n}
|
|
11
11
|
`)}try{e.solana=await x("solana")}catch(n){process.stderr.write(`Failed to get Solana address: ${n}
|
|
12
|
-
`)}if(!e.ethereum&&!e.solana)throw new Error("Could not derive any addresses from Ledger device");return e}async function H(e,n){let{moonpay:i}=await import("./client-
|
|
12
|
+
`)}if(!e.ethereum&&!e.solana)throw new Error("Could not derive any addresses from Ledger device");return e}async function H(e,n){let{moonpay:i}=await import("./client-Z4ICZ5ZI.js"),t=(await i.chain.retrieve({chain:e})).keyFamily;if(t==="bitcoin")throw new Error("Bitcoin transaction signing via Ledger is not yet supported. Use a software wallet for Bitcoin transactions.");if(t==="tron")throw new Error("Tron transaction signing via Ledger is not supported. Use a software wallet for Tron transactions.");await R(t);let a=$(t),u=E(),c=f();switch(t){case"evm":{let{SignerEthBuilder:d}=I(),l=new d({dmk:c,sessionId:u}).build(),w=T(n.startsWith("0x")?n:Buffer.from(n,"base64").toString("hex")),o=Uint8Array.from(Buffer.from(k(w),"hex")),r=l.signTransaction(a,o,{skipOpenApp:!1}),g=await m(r,"Sign transaction"),{parseTransaction:v,serializeTransaction:A}=await import("viem"),B=v(w);return{transaction:A(B,{r:T(k(g.r)),s:T(k(g.s)),v:BigInt(g.v)})}}case"solana":{let{SignerSolanaBuilder:d}=L(),l=new d({dmk:c,sessionId:u}).build(),{VersionedTransaction:w}=await import("@solana/web3.js"),o=Uint8Array.from(Buffer.from(n,"base64")),r=w.deserialize(o),g=r.message.serialize(),v=l.signTransaction(a,g,{skipOpenApp:!1}),A=await m(v,"Sign Solana transaction");return r.signatures[0]=A,{transaction:Buffer.from(r.serialize()).toString("base64")}}default:throw new Error(`Ledger transaction signing not supported for ${t}`)}}async function V(e,n){let{moonpay:i}=await import("./client-Z4ICZ5ZI.js"),t=(await i.chain.retrieve({chain:e})).keyFamily;if(t==="bitcoin")throw new Error("Bitcoin message signing via Ledger is not yet supported. Use a software wallet for Bitcoin message signing.");if(t==="tron")throw new Error("Tron message signing via Ledger is not supported. Use a software wallet for Tron message signing.");await R(t);let a=$(t),u=E(),c=f();switch(t){case"evm":{let{SignerEthBuilder:d}=I(),w=new d({dmk:c,sessionId:u}).build().signMessage(a,n,{skipOpenApp:!1}),o=await m(w,"Sign message"),r=k(o.r),g=k(o.s),v=o.v.toString(16).padStart(2,"0");return{signature:`0x${r}${g}${v}`}}case"solana":{let{SignerSolanaBuilder:d}=L(),l=new d({dmk:c,sessionId:u}).build(),w=Buffer.from(n,"utf8").toString("hex"),o=l.signMessage(a,w,{skipOpenApp:!1}),r=await m(o,"Sign Solana message");return{signature:(await import("bs58")).default.encode(r)}}default:throw new Error(`Ledger message signing not supported for ${t}`)}}async function q(){if(p){try{await f().disconnect({sessionId:p})}catch{}p=null}if(h){try{h.close()}catch{}h=null}}export{P as connectLedger,q as disconnectLedger,x as ledgerGetAddress,F as ledgerGetAllAddresses,V as ledgerSignMessage,H as ledgerSignTransaction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{a as f,d as u}from"./chunk-
|
|
2
|
+
import{a as f,d as u}from"./chunk-UKTF4P2L.js";import{b as d}from"./chunk-FWEGM6S2.js";import"./chunk-PCT66UYJ.js";import{e as l,g as R}from"./chunk-Q3LM7T7N.js";import"./chunk-LMDE72OE.js";import{Server as N}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as O}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as x}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as k}from"zod-to-json-schema";R();var y=new Map(u.map(s=>[s.schema.name,s]));function q(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let c=n.$ref.replace("#/definitions/","");return n.definitions[c]??n}return n}async function P(){let s=new N({name:"moonpay",version:l},{capabilities:{tools:{listChanged:!0}}}),n=u.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:k(e.schema.input)})),c=new Map;for(let e of f){if(y.has(e.name))continue;let t=q(e);c.set(e.name,t.properties??{}),n.push({name:e.name,description:e.description,inputSchema:{type:"object",properties:t.properties??{},...t.required?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}})}let h=new Map(n.map(e=>[e.name,e]));s.setRequestHandler(x,async()=>({tools:n.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))})),s.setRequestHandler(T,async e=>{let{name:t,arguments:o={}}=e.params;if(!h.has(t))return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0};try{let i=y.get(t);if(i){let p=i.schema.input.shape??{};for(let[m,a]of Object.entries(p))o[m]===void 0&&a._def.typeName==="ZodNullable"&&(o[m]=null);let r=await i.handler(o);return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}let S=c.get(t)??{};for(let[p,r]of Object.entries(S))o[p]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(w=>w.type==="null"))&&(o[p]=null),(r.type==="number"||r.type==="integer"||Array.isArray(r.type)&&r.type.some(a=>a==="number"||a==="integer")||r.anyOf?.some(a=>a.type==="number"||a.type==="integer"))&&typeof o[p]=="string"&&(o[p]=Number(o[p]));let b=await d._call(t,o);return{content:[{type:"text",text:JSON.stringify(b,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let g=new O;await s.connect(g)}export{P as startMcpServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{A as v,B as w,f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"./chunk-
|
|
2
|
+
import{A as v,B as w,f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"./chunk-PCT66UYJ.js";import"./chunk-Q3LM7T7N.js";import"./chunk-LMDE72OE.js";export{m as addHardwareWallet,u as addWallet,d as createWallet,j as deleteWallet,l as exportSecret,h as findWallet,i as findWalletOrThrow,a as getVaultPath,e as importMnemonic,f as importPrivateKey,g as listWallets,s as loadWallets,c as migrateWallets,w as mutateWallets,p as owsSignMessage,o as owsSignTransaction,q as owsSignTypedData,n as refreshHardwareAddresses,t as removeWallet,k as renameWallet,b as requireMigrationCheck,r as resolveSigningKey,v as saveWallets};
|