@moonpay/cli 0.6.28 → 0.6.29

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.
@@ -0,0 +1,31 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a as qe,b as Oe,c as Ne,d as Le,e as Be,f as ae,g as u,h,i as We,j as D,k as se,l as ce,n as Ve,p as g,q as z,r as Fe,s as q}from"./chunk-WLQU5BOQ.js";import{readFileSync as sn}from"fs";import{join as cn}from"path";import{homedir as pn}from"os";var _e="0.6.29",ln="X-CLI-Version",dn="X-Agent-Id",K;function un(){if(K!==void 0)return K;try{K=JSON.parse(sn(cn(pn(),".config","moonpay","consent.json"),"utf-8")).agentId??null}catch{K=null}return K??null}function A(){let e={"Content-Type":"application/json",[ln]:_e},t=un();return t&&(e[dn]=t),e}import*as l from"fs";import*as He from"os";import*as X from"path";var J=X.join(He.homedir(),".config","moonpay"),we=X.join(J,"config.json"),Y=X.join(J,"credentials.json"),G=X.join(J,".credentials.lock"),Se={baseUrl:"https://agents.moonpay.com"};function ke(){l.existsSync(J)||l.mkdirSync(J,{recursive:!0,mode:448})}function Me(e,t,n){let i=e+`.tmp.${process.pid}`;l.writeFileSync(i,t,{encoding:"utf-8",mode:n}),l.renameSync(i,e)}var mn=3e4;function hn(){ke();try{let e=l.openSync(G,l.constants.O_CREAT|l.constants.O_EXCL|l.constants.O_WRONLY,384);l.writeSync(e,JSON.stringify({pid:process.pid,ts:Date.now()})),l.closeSync(e)}catch(e){if(e.code!=="EEXIST")throw e;try{let t=JSON.parse(l.readFileSync(G,"utf-8"));if(Date.now()-t.ts<mn)return null}catch{}try{l.unlinkSync(G)}catch{}try{let t=l.openSync(G,l.constants.O_CREAT|l.constants.O_EXCL|l.constants.O_WRONLY,384);l.writeSync(t,JSON.stringify({pid:process.pid,ts:Date.now()})),l.closeSync(t)}catch{return null}}return()=>{try{l.unlinkSync(G)}catch{}}}function ze(){if(!l.existsSync(we))return null;try{let e=JSON.parse(l.readFileSync(we,"utf-8"));return e.baseUrl?e:null}catch{return null}}function pe(){let e=ze();return e||(fn(Se),Se)}function O(){if(!l.existsSync(Y))return null;let e=Le();if(!e)return null;try{let t=JSON.parse(l.readFileSync(Y,"utf-8")),n=qe.parse(t),i=Ne(n,e),r=JSON.parse(i);return!r.accessToken||!r.baseUrl?null:r}catch{return null}}function ve(e){let t=Be(),n=Oe(JSON.stringify(e),t);ke(),Me(Y,JSON.stringify(n,null,2),384)}function fn(e){ke(),Me(we,JSON.stringify(e,null,2),384)}function Ke(){l.existsSync(Y)&&l.unlinkSync(Y)}function v(){let e=ze(),t=O();return e?.baseUrl??t?.baseUrl??Se.baseUrl}async function Te(e,t,n){let i=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(15e3),headers:A(),body:JSON.stringify(n)}),r=await i.json();if(!i.ok){let o=r;throw new Error(o?.error??`${t} failed (${i.status})`)}return r}async function Pe(e){if(!e.refreshToken)throw new Error("No refresh token available");let t=hn();if(!t){await new Promise(i=>setTimeout(i,2e3));let n=O();if(n&&n.expiresAt>Date.now())return n;throw new Error("Token refresh failed (concurrent refresh in progress)")}try{let n=O();if(n&&n.expiresAt>Date.now()+6e4)return n;let i=await Te(e.baseUrl,"refresh",{refreshToken:e.refreshToken}),r={accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:i.expiresAt*1e3,baseUrl:e.baseUrl};return ve(r),r}finally{t()}}var yn=300*1e3;async function N(){let e=O();if(!e)return null;if(Date.now()>=e.expiresAt-yn){if(e.refreshToken)try{return(await Pe(e)).accessToken}catch{return null}return null}return e.accessToken}async function je(e,t,n){let i=await N(),r=A();i&&(r.Authorization=`Bearer ${i}`);let o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:r,body:JSON.stringify(n)});if(o.status===401&&i){let d=O();if(d?.refreshToken)try{let _=await Pe(d);o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:{...A(),Authorization:`Bearer ${_.accessToken}`},body:JSON.stringify(n)})}catch{}}if(o.status===401)throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");let c=await o.text();if(!c){if(o.status===429){let d=i?" Run `mp upgrade` to increase your rate limit.":" Log in with `mp login` for higher limits.";throw new Error(`Rate limit exceeded.${d}`)}throw new Error(`Empty response from server (${o.status})`)}let p;try{p=JSON.parse(c)}catch{throw new Error(`Unexpected response from server (${o.status})`)}if(o.status<200||o.status>=300){let d=p;throw new Error(d?.error??`Tool call failed (${o.status})`)}return p}async function w(e,t,n){return await je(e,t,n)}var Ni=[{name:"buy",description:"Buy crypto with fiat via MoonPay. Returns a checkout URL to complete the purchase.",inputSchema:{$ref:"#/definitions/buy_input",definitions:{buy_input:{type:"object",properties:{token:{type:"string",enum:["btc","pol_polygon","sol","trx","usdc","usdc_arbitrum","usdc_base","usdc_optimism","usdc_sol","usdc_polygon","usdt_trx","eth","eth_polygon","eth_optimism","eth_base","eth_arbitrum"],description:"MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), trx (TRX on Tron), usdt_trx (USDT on Tron), etc."},amount:{type:"number",description:"Amount in USD to spend. For example, 50 means $50 worth of the selected token."},wallet:{type:"string",description:"Destination wallet address to receive tokens (must match the chain for the selected token)"},email:{type:["string","null"],description:"Buyer email to pre-fill on the checkout page"}},required:["token","amount","wallet","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/buy_output",definitions:{buy_output:{type:"object",properties:{url:{type:"string",description:"MoonPay checkout URL \u2014 open in browser to complete purchase"}},required:["url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_create",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.",inputSchema:{$ref:"#/definitions/deposit_create_input",definitions:{deposit_create_input:{type:"object",properties:{name:{type:"string",description:"Human-readable label for this deposit link (e.g. 'Treasury Base USDC')"},wallet:{type:"string",description:"Destination wallet address where USDC will be delivered"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","bnb"],description:"Blockchain of the destination wallet"},token:{type:"string",enum:["USDC","USDC.e","USDT"],description:"Token to receive. USDC.e (bridged USDC) is only available on Polygon."}},required:["name","wallet","chain","token"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_create_output",definitions:{deposit_create_output:{type:"object",properties:{id:{type:"string",description:"Unique deposit ID \u2014 use with deposit_transaction_list to check incoming payments"},destinationWallet:{type:"string",description:"Wallet address that will receive the stablecoin"},destinationChain:{type:"string",description:"Chain where the stablecoin will be delivered"},customerToken:{type:"string",description:"Token to check deposit transactions \u2014 pass to deposit_transaction_list"},depositUrl:{type:"string",description:"Shareable URL \u2014 open in browser or share with senders to deposit funds"},wallets:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address to send funds to"},chain:{type:"string",description:"Chain this address is on (solana, ethereum, bitcoin, tron)"},qrCode:{type:"string",description:"URL to a QR code image for the deposit address"}},required:["address","chain","qrCode"],additionalProperties:!1},description:"Deposit addresses across all supported chains \u2014 send any token to any of these"},instructions:{type:"string",description:"Human-readable instructions explaining how to use the deposit"}},required:["id","destinationWallet","destinationChain","customerToken","depositUrl","wallets","instructions"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_retrieve",description:"Retrieve details of a deposit by ID. Returns the deposit name, status, destination wallet, and deposit addresses.",inputSchema:{$ref:"#/definitions/deposit_retrieve_input",definitions:{deposit_retrieve_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_retrieve_output",definitions:{deposit_retrieve_output:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string"},destinationWallet:{type:["string","null"]},depositUrl:{type:"string"}},required:["id","name","status","destinationWallet","depositUrl"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_transaction_list",description:"List transactions for a deposit. Pass the deposit id from deposit_create to check incoming payment status.",inputSchema:{$ref:"#/definitions/deposit_transaction_list_input",definitions:{deposit_transaction_list_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_transaction_list_output",definitions:{deposit_transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},amount:{type:"number"},token:{type:"string"},from:{type:"string"},status:{type:"string"},settledAmount:{type:["number","null"]},settledCurrency:{type:["string","null"]},timestamp:{type:"string"}},required:["id","amount","token","from","status","settledAmount","settledCurrency","timestamp"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"feedback_create",description:"Submit feedback, a bug report, or a feature request. Requires authentication.",inputSchema:{$ref:"#/definitions/feedback_create_input",definitions:{feedback_create_input:{type:"object",properties:{type:{type:"string",enum:["bug","feature","general"],description:"Type of feedback: bug, feature, or general"},message:{type:"string",minLength:1,maxLength:280,description:"Your feedback message"}},required:["type","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/feedback_create_output",definitions:{feedback_create_output:{type:"object",properties:{id:{type:"string",description:"Feedback ID"},message:{type:"string",description:"Confirmation message"}},required:["id","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"login",description:"Send a verification code to the provided email to sign in or create an account. Requires an hCaptcha token.",inputSchema:{$ref:"#/definitions/login_input",definitions:{login_input:{type:"object",properties:{email:{type:"string",format:"email",description:"The email of the user to login"},captchaToken:{type:"string",description:"hCaptcha response token"}},required:["email","captchaToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/login_output",definitions:{login_output:{type:"object",properties:{email:{type:"string",description:"The email the OTP was sent to"}},required:["email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"refresh",description:"Refresh an expired access token using a refresh token.",inputSchema:{$ref:"#/definitions/refresh_input",definitions:{refresh_input:{type:"object",properties:{refreshToken:{type:"string",description:"The refresh token from a previous login"}},required:["refreshToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/refresh_output",definitions:{refresh_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"swaps_transaction_build",description:"Build a swap or bridge transaction. Returns an unsigned transaction with a human-readable message, amounts, exchange rate, and estimated time. Supports same-chain swaps and cross-chain bridges. Accepts UI amounts (e.g. 0.1 SOL) \u2014 decimal conversion is handled automatically.",inputSchema:{$ref:"#/definitions/swaps_transaction_build_input",definitions:{swaps_transaction_build_input:{type:"object",properties:{from:{type:"object",properties:{wallet:{type:"string",description:"Source wallet address (Solana pubkey or EVM 0x address)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Source blockchain"},token:{type:"string",description:"Source token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},amount:{type:["number","null"],description:"Amount to swap (exact-in). Null for exact-out."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Source: wallet, chain, token, amount"},to:{type:"object",properties:{wallet:{type:"string",description:"Destination wallet address. Same as source wallet for same-chain swaps."},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Destination blockchain"},token:{type:"string",description:"Destination token address (mint on Solana, contract on EVM)"},amount:{type:["number","null"],description:"Amount to receive (exact-out). Null for exact-in."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Destination: wallet, chain, token, amount"}},required:["from","to"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/swaps_transaction_build_output",definitions:{swaps_transaction_build_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID for tracking"},transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Contract address"},data:{type:"string",description:"Calldata"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}],description:"Unsigned transaction"},message:{type:"string",description:"Human-readable description (e.g. Swap 0.1 SOL \u2192 42.5 USDC on Solana)"},amountIn:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},amountOut:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},exchangeRate:{type:"number",description:"Exchange rate (amountOut / amountIn)"},estimatedTime:{type:["number","null"],description:"Estimated completion time in seconds"},requiresApproval:{type:"boolean",description:"Whether an ERC20 approval transaction is needed first"}},required:["transactionId","transaction","message","amountIn","amountOut","exchangeRate","estimatedTime","requiresApproval"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_balance_list",description:"List all token balances held in a wallet, including amount owned, current value in USD, and token details. Shows the complete token portfolio.",inputSchema:{$ref:"#/definitions/token_balance_list_input",definitions:{token_balance_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address to check token balances for"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to check balances on (e.g. 'solana', 'ethereum', 'base')"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_balance_list_output",definitions:{token_balance_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},balance:{type:"object",properties:{amount:{type:"number",description:"Number of tokens owned"},value:{type:"number",description:"Total value of the token in USD"},price:{type:"number",description:"Current price of the token"}},required:["amount","value","price"],additionalProperties:!1}},required:["address","name","symbol","chain","decimals","balance"],additionalProperties:!1},description:"Array of all tokens in the wallet with their balances and current values"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_retrieve",description:"Get detailed token information including market data, price changes, volume, trades, and holder statistics by token address",inputSchema:{$ref:"#/definitions/token_retrieve_input",definitions:{token_retrieve_input:{type:"object",properties:{token:{type:"string",description:"Address of the token to retrieve"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain network where the token exists"}},required:["token","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_retrieve_output",definitions:{token_retrieve_output:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_search",description:"Search for tokens by name, symbol, or address. Returns matching tokens with their market data including price, volume, and liquidity.",inputSchema:{$ref:"#/definitions/token_search_input",definitions:{token_search_input:{type:"object",properties:{query:{type:"string",description:"Search term - can be token name (e.g. 'Bitcoin'), symbol (e.g. 'BTC'), or partial match"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to search on (e.g. 'solana', 'ethereum', 'base')"},limit:{type:["number","null"],description:"Maximum number of results to return (optional, defaults to 5)"}},required:["query","chain","limit"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_search_output",definitions:{token_search_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of tokens matching the search query with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_transfer",description:"Build an unsigned transfer transaction. Returns a transaction ready for signing. Handles both native and token transfers.",inputSchema:{$ref:"#/definitions/token_transfer_input",definitions:{token_transfer_input:{type:"object",properties:{wallet:{type:"string",description:"Sender wallet address (Solana pubkey or EVM 0x address)"},token:{type:"string",description:"Token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},to:{type:"string",description:"Recipient wallet address or name"},amount:{type:"number",description:"Amount to transfer in human-readable units (e.g. 1.5)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to execute the transfer on"}},required:["wallet","token","to","amount","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_transfer_output",definitions:{token_transfer_output:{type:"object",properties:{transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Recipient or contract address"},data:{type:"string",description:"Calldata (0x for native transfers)"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}]},message:{type:"string",description:"Human-readable description of the transfer"}},required:["transaction","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_trending_list",description:"Get currently trending tokens on a blockchain. Perfect for discovering what's hot right now.",inputSchema:{$ref:"#/definitions/token_trending_list_input",definitions:{token_trending_list_input:{type:"object",properties:{chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to get trending tokens from (e.g. 'solana', 'ethereum', 'base')"},limit:{type:"integer",minimum:1,description:"Number of results per page"},page:{type:"integer",minimum:1,description:"Page number (starts at 1)"}},required:["chain","limit","page"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_trending_list_output",definitions:{token_trending_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of trending tokens with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_list",description:"List swap and bridge transaction history for a wallet.",inputSchema:{$ref:"#/definitions/transaction_list_input",definitions:{transaction_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address that signed and sent the transactions"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain the wallet is on"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_list_output",definitions:{transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds"}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1},description:"List of swap/bridge transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_register",description:"Register a broadcast transaction for tracking. Call after transaction_send to enable status tracking via transaction_retrieve.",inputSchema:{$ref:"#/definitions/transaction_register_input",definitions:{transaction_register_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build"},transactionHash:{type:"string",description:"Transaction hash/signature after broadcasting"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain where the transaction was broadcast"}},required:["transactionId","transactionHash","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_register_output",definitions:{transaction_register_output:{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_retrieve",description:"Get the status and details of a transaction by its ID.",inputSchema:{$ref:"#/definitions/transaction_retrieve_input",definitions:{transaction_retrieve_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build or transaction_register"}},required:["transactionId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_retrieve_output",definitions:{transaction_retrieve_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash. Null while bridge is in progress."}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds. Null for same-chain swaps."}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_send",description:"Broadcast a signed transaction to the network. Supports Solana, EVM chains, and Bitcoin.",inputSchema:{$ref:"#/definitions/transaction_send_input",definitions:{transaction_send_input:{type:"object",properties:{transaction:{type:"string",description:"Signed transaction: base64-encoded for Solana, hex-encoded (0x...) for EVM, raw hex for Bitcoin"},message:{type:"string",description:"Human-readable message describing the transaction"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to broadcast on"}},required:["transaction","message","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_send_output",definitions:{transaction_send_output:{type:"object",properties:{signature:{type:"string",description:"Transaction signature/hash. Absent if broadcast failed."},message:{type:"string",description:"Result message or error description"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"user_retrieve",description:"Get the currently authenticated user",inputSchema:{$ref:"#/definitions/user_retrieve_input",definitions:{user_retrieve_input:{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/user_retrieve_output",definitions:{user_retrieve_output:{type:"object",properties:{id:{type:"string",description:"User ID"},email:{type:["string","null"],description:"User email address"}},required:["id","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"verify",description:"Verify a login code for the user.",inputSchema:{$ref:"#/definitions/verify_input",definitions:{verify_input:{type:"object",properties:{code:{type:"string",pattern:"^\\d{6}$",description:"The code to verify"},email:{type:"string",format:"email",description:"The email the OTP was sent to"}},required:["code","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/verify_output",definitions:{verify_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_accept",description:"Accept a required legal agreement. Pass the content ID from virtual-account_agreement_list to mark the agreement as accepted.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_input",definitions:{"virtual-account_agreement_accept_input":{type:"object",properties:{contentId:{type:"string",description:"Content ID from virtual-account_agreement_list"}},required:["contentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_output",definitions:{"virtual-account_agreement_accept_output":{type:"object",properties:{id:{type:"string",description:"Signing record ID"},contentId:{type:["string","null"],description:"Content ID of the accepted agreement"},documentId:{type:["string","null"],description:"Document ID"}},required:["id","contentId","documentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_list",description:"List legal agreements. By default shows pending agreements that must be accepted to activate the account. Use status=accepted to see previously accepted agreements.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_list_input",definitions:{"virtual-account_agreement_list_input":{type:"object",properties:{status:{anyOf:[{type:"string",enum:["pending","accepted"]},{type:"null"}],description:"Filter: pending (need to accept, default) or accepted (already signed)"},country:{type:["string","null"],description:"Country code for terms (e.g. USA, GBR). Defaults to USA."}},required:["status","country"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_list_output",definitions:{"virtual-account_agreement_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Content ID \u2014 pass to virtual-account_agreement_accept to accept"},name:{type:"string",description:"Document name (e.g. 'USA Terms and Conditions')"},url:{type:"string",description:"URL to view the document"}},required:["id","name","url"],additionalProperties:!1},description:"List of agreements"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_create",description:"Create a virtual account and start KYC verification",inputSchema:{$ref:"#/definitions/virtual-account_create_input",definitions:{"virtual-account_create_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_create_output",definitions:{"virtual-account_create_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_continue",description:"Get the current KYC verification status and URL. Use this to check progress or get the verification link again.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_input",definitions:{"virtual-account_kyc_continue_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_output",definitions:{"virtual-account_kyc_continue_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."}},required:["id","status","url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_restart",description:"Restart KYC verification. Creates a fresh verification link. Only available when account status is IdentificationRequired.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_input",definitions:{"virtual-account_kyc_restart_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_output",definitions:{"virtual-account_kyc_restart_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."},message:{type:["string","null"],description:"Instructions for the user"}},required:["id","status","url","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_create",description:"Create a fiat-to-stablecoin onramp. Returns a deposit account (bank IBAN or account number) where the user sends fiat. Incoming fiat is automatically converted to stablecoin and sent to the registered wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_create_input",definitions:{"virtual-account_onramp_create_input":{type:"object",properties:{name:{type:"string",description:"A label for this onramp (e.g. 'My USD onramp')"},fiat:{type:"string",enum:["USD","EUR"],description:"Fiat currency: usd or eur"},stablecoin:{type:"string",enum:["USDC","USDT","EURC"],description:"Target stablecoin: usdc, usdt, or eurc"},wallet:{type:"string",description:"Registered wallet address (must be registered via virtual-account_wallet_register first)"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"],description:"Blockchain to receive stablecoin on (Solana, Ethereum, Polygon, Arbitrum, Base)"}},required:["name","fiat","stablecoin","wallet","blockchain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_create_output",definitions:{"virtual-account_onramp_create_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_delete",description:"Cancel an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_input",definitions:{"virtual-account_onramp_delete_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to cancel"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_output",definitions:{"virtual-account_onramp_delete_output":{type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_list",description:"List all fiat-to-stablecoin onramps. Shows each onramp's deposit account details, status, and destination wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_list_input",definitions:{"virtual-account_onramp_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_list_output",definitions:{"virtual-account_onramp_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1},description:"List of configured onramps"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_create",description:"Create an open banking payment link for an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_input",definitions:{"virtual-account_onramp_payment_create_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp"},amount:{type:"string",description:"The amount to pay"},fiat:{type:"string",enum:["USD","EUR"],description:"The fiat currency (USD or EUR)"}},required:["onrampId","amount","fiat"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_output",definitions:{"virtual-account_onramp_payment_create_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_retrieve",description:"Get the status of an open banking payment",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_input",definitions:{"virtual-account_onramp_payment_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp this payment belongs to"},paymentId:{type:"string",format:"uuid",description:"The ID of the payment to retrieve"}},required:["onrampId","paymentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_output",definitions:{"virtual-account_onramp_payment_retrieve_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_retrieve",description:"Get onramp details and banking info",inputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_input",definitions:{"virtual-account_onramp_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to retrieve"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_output",definitions:{"virtual-account_onramp_retrieve_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_retrieve",description:"Get your virtual account status",inputSchema:{$ref:"#/definitions/virtual-account_retrieve_input",definitions:{"virtual-account_retrieve_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_retrieve_output",definitions:{"virtual-account_retrieve_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_transaction_list",description:"List fiat-to-stablecoin conversion transactions. Shows status, fiat amount sent, and stablecoin amount received for each conversion.",inputSchema:{$ref:"#/definitions/virtual-account_transaction_list_input",definitions:{"virtual-account_transaction_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_transaction_list_output",definitions:{"virtual-account_transaction_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Transaction ID"},state:{type:"string",enum:["Pending","PayoutPending","Payout","PayoutCompleted","Completed","Failed","InAmlReview","AmlRejected","AmountRejected"],description:"Transaction state (e.g. pending, completed, failed)"},sourceAmount:{type:"string",description:"Fiat amount sent (e.g. '100.00 USD')"},destinationAmount:{type:"string",description:"Stablecoin amount received (e.g. '99.50 USDC')"},createdAt:{type:"string",format:"date-time",description:"Transaction creation timestamp"}},required:["id","state","sourceAmount","destinationAmount","createdAt"],additionalProperties:!1},description:"List of onramp conversion transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_list",description:"List wallets registered for the virtual account. Only registered wallets can receive onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_list_input",definitions:{"virtual-account_wallet_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_list_output",definitions:{"virtual-account_wallet_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},address:{type:"string"},blockchain:{type:"string"}},required:["id","address","blockchain"],additionalProperties:!1},description:"List of registered wallets"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_register",description:"Register a wallet by submitting a signed proof-of-ownership message. The wallet can then be used as a destination for onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_register_input",definitions:{"virtual-account_wallet_register_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"},message:{type:"string",description:"Verification message from virtual-account_wallet_registration-message_create"},signature:{type:"string",description:"Signature of the message, signed by the wallet's private key"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"}},required:["wallet","message","signature","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_register_output",definitions:{"virtual-account_wallet_register_output":{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_registration-message_create",description:"Generate a proof-of-ownership message for wallet registration. The message must be signed by the wallet's private key and submitted via virtual-account_wallet_register.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_input",definitions:{"virtual-account_wallet_registration-message_create_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"}},required:["wallet"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_output",definitions:{"virtual-account_wallet_registration-message_create_output":{type:"object",properties:{message:{type:"string",description:"Message to sign with the wallet's private key"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}}];var bn="https://www.moonpay.com/legal/terms_of_use_europe_hypermint",_n="https://www.moonpay.com/legal/privacy_policy",wn="https://swaps.xyz/terms",le=` Terms of Use: ${bn}
3
+ Privacy Policy: ${_n}
4
+ Swaps by: ${wn}`;import*as Je from"fs";import*as Ye from"os";import*as Xe from"path";var a=e=>e,s=(e,t)=>({schema:e,handler:async n=>{let i=e.input.parse(n),r=await t(i);return e.output.parse(r)}});import{z as Z}from"zod";var Ge=a({name:"consent_check",description:"Check whether the MoonPay Terms of Use have been accepted. Throws if not accepted.",input:Z.object({}),output:Z.object({accepted:Z.literal(!0),tosVersion:Z.string(),acceptedAt:Z.string()})});var Sn=Xe.join(Ye.homedir(),".config","moonpay","consent.json"),Ze=s(Ge,async()=>{let e=null;try{e=JSON.parse(Je.readFileSync(Sn,"utf-8"))}catch{}if(!e||e.tosVersion!=="1.2")throw new Error(`Terms of Service not yet accepted. Run \`mp consent accept\` first.
5
+
6
+ ${le}`);return{accepted:!0,tosVersion:e.tosVersion,acceptedAt:e.acceptedAt}});import{generateMnemonic as kn}from"@scure/bip39";import{wordlist as vn}from"@scure/bip39/wordlists/english";import{z as L}from"zod";var Qe=a({name:"wallet_create",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.",input:L.object({name:L.string().describe("Wallet name")}),output:L.object({name:L.string(),addresses:L.record(u,L.string())})});var et=s(Qe,async e=>{let t=kn(vn,256),n=ae(t);return z({name:e.name,type:"hd",mnemonic:t,addresses:n,createdAt:new Date().toISOString()}),{name:e.name,addresses:D(n)}});import{createInterface as Tn}from"readline";import{validateMnemonic as nt}from"@scure/bip39";import{wordlist as it}from"@scure/bip39/wordlists/english";import{Keypair as Pn}from"@solana/web3.js";import jn from"bs58";import{privateKeyToAccount as xn}from"viem/accounts";import{z as R}from"zod";var tt=a({name:"wallet_import",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.",input:R.object({name:R.string().describe("Wallet name"),mnemonic:R.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),key:R.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),chain:u.nullable().describe("Chain for single-key import (default solana)")}),output:R.object({name:R.string(),type:R.enum(["hd","imported"]),addresses:We})});function Cn(e){return new Promise((t,n)=>{if(!process.stdin.isTTY){n(new Error("Interactive import requires a terminal. Pass --mnemonic or --key instead."));return}let i=Tn({input:process.stdin,output:process.stderr});process.stderr.write(e),process.stdin.setRawMode(!0);let r="",o=c=>{let p=c.toString();p===`
7
+ `||p==="\r"?(process.stdin.setRawMode(!1),process.stdin.removeListener("data",o),process.stderr.write(`
8
+ `),i.close(),t(r.trim())):p===""?(process.stdin.setRawMode(!1),i.close(),process.exit(0)):p==="\x7F"||p==="\b"?r=r.slice(0,-1):r+=p};process.stdin.on("data",o)})}function An(e){let t=e.split(/\s+/);return t.length>=12&&t.length<=24&&nt(e,it)?"mnemonic":"key"}var rt=s(tt,async e=>{if(e.mnemonic&&e.key)throw new Error("Provide either --mnemonic or --key, not both.");let t=e.mnemonic,n=e.key;if(!t&&!n){let p=await Cn("Paste your mnemonic or private key (hidden): ");if(!p)throw new Error("No input provided.");An(p)==="mnemonic"?t=p:n=p}if(t){let p=t.trim().toLowerCase();if(!nt(p,it))throw new Error("Invalid BIP39 mnemonic.");let d=ae(p);return z({name:e.name,type:"hd",mnemonic:p,addresses:d,createdAt:new Date().toISOString()}),{name:e.name,type:"hd",addresses:d}}let i=e.chain?h[e.chain]:"solana",r=n??"",o,c;if(i==="solana")try{let p=jn.decode(r);o=Pn.fromSecretKey(p).publicKey.toBase58(),c=r}catch{throw new Error("Invalid Solana private key. Expected base58-encoded secret key.")}else if(i==="ethereum"){if(c=r.startsWith("0x")?r.slice(2):r,!/^[0-9a-fA-F]{64}$/.test(c))throw new Error("Invalid EVM private key. Expected 64-character hex string.");o=xn(`0x${c}`).address}else throw new Error(`Single-key import for ${i} is not yet supported. Use a mnemonic instead.`);return z({name:e.name,type:"imported",chain:i,privateKey:c,addresses:{[i]:o},createdAt:new Date().toISOString()}),{name:e.name,type:"imported",addresses:{[i]:o}}});import{z as ot}from"zod";var at=a({name:"wallet_list",description:"List all local wallets",input:ot.object({}),output:ot.array(se)});var st=s(at,async()=>ce().map(t=>({name:t.name,type:t.type,addresses:D(t.addresses),createdAt:t.createdAt})));import{z as ct}from"zod";var pt=a({name:"wallet_retrieve",description:"Get details of a specific wallet",input:ct.object({wallet:ct.string().describe("Wallet name or address")}),output:se});var j=s(pt,async e=>{let t=g(e.wallet);return{name:t.name,type:t.type,addresses:D(t.addresses),createdAt:t.createdAt}});import{z as B}from"zod";var lt=a({name:"wallet_delete",description:"Permanently delete a local wallet. This removes the private key file and cannot be undone.",input:B.object({wallet:B.string().describe("Name or address of the wallet to delete"),confirm:B.boolean().describe("Must be true to confirm deletion")}),output:B.object({name:B.string().describe("Name of the deleted wallet"),deleted:B.literal(!0)})});var dt=s(lt,async e=>{if(!e.confirm)throw new Error("Back up your wallet before deleting! Run `mp wallet export "+e.wallet+"` to save your recovery phrase, then re-run with --confirm to permanently delete.");let t=g(e.wallet);return Fe(t.name),{name:t.name,deleted:!0}});import{z as W}from"zod";var ut=a({name:"wallet_rename",description:"Rename a local wallet.",input:W.object({wallet:W.string().describe("Current name or address of the wallet"),name:W.string().describe("New name for the wallet")}),output:W.object({oldName:W.string(),newName:W.string()})});var mt=s(ut,async e=>{let n=g(e.wallet).name;if(n===e.name)return{oldName:n,newName:e.name};if(ce().some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);return Ve(r=>{let o=r.find(c=>c.name===n);if(!o)throw new Error(`Wallet "${n}" not found`);o.name=e.name}),{oldName:n,newName:e.name}});import{z as ue}from"zod";var ht=a({name:"wallet_export",description:"Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",input:ue.object({wallet:ue.string().describe("Wallet name")}),output:ue.object({exported:ue.literal(!0)})});var ft=s(ht,async e=>{if(!process.stdout.isTTY)throw new Error(`Wallet export requires an interactive terminal.
9
+ Run this command directly in your terminal: mp wallet export `+e.wallet);let t=g(e.wallet);return t.type==="hd"?(process.stderr.write(`
10
+ Mnemonic for "${t.name}":
11
+
12
+ `),process.stderr.write(` ${t.mnemonic}
13
+
14
+ `),process.stderr.write(`Write this down and store it securely.
15
+
16
+ `)):(process.stderr.write(`
17
+ Private key for "${t.name}" (${t.chain}):
18
+
19
+ `),process.stderr.write(` ${t.privateKey}
20
+
21
+ `)),{exported:!0}});import{createHash as In}from"crypto";import{Keypair as $n,VersionedTransaction as Rn}from"@solana/web3.js";import{privateKeyToAccount as En}from"viem/accounts";import{parseTransaction as Un}from"viem";import{createPublicClient as Dn,http as qn}from"viem";import*as f from"viem/chains";import*as gt from"tiny-secp256k1";import{z as Q}from"zod";var yt=a({name:"transaction_sign",description:"Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",input:Q.object({wallet:Q.string().describe("Wallet name or address"),chain:u.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),transaction:Q.string().describe("Base64-encoded unsigned transaction")}),output:Q.object({transaction:Q.string().describe("Base64-encoded signed transaction")})});var On={1:f.mainnet,137:f.polygon,42161:f.arbitrum,8453:f.base,10:f.optimism,56:f.bsc,43114:f.avalanche},Nn={137:"https://polygon-bor-rpc.publicnode.com",42161:"https://arbitrum-one-rpc.publicnode.com",10:"https://optimism-rpc.publicnode.com",8453:"https://base-rpc.publicnode.com",56:"https://bsc-rpc.publicnode.com",43114:"https://avalanche-c-chain-rpc.publicnode.com"},E=s(yt,async e=>{let t=g(e.wallet),n=e.chain,i=h[n],{privateKey:r}=q(t,n);switch(i){case"solana":return Ln(r,e.transaction.trim());case"ethereum":return Bn(r,e.transaction.trim());case"tron":return Wn(r,e.transaction.trim());case"bitcoin":return Vn(r,e.transaction.trim())}});function Ln(e,t){let n=Buffer.from(t,"base64"),i=Rn.deserialize(n),r=$n.fromSecretKey(e);return i.sign([r]),{transaction:Buffer.from(i.serialize()).toString("base64")}}async function Bn(e,t){let n=En(`0x${Buffer.from(e).toString("hex")}`);if(t.startsWith("{")){let{to:c,data:p,value:d,chainId:_}=JSON.parse(t),y=On[_]??f.mainnet,m=Nn[_],C=Dn({chain:y,transport:qn(m)}),M=await C.getTransactionCount({address:n.address}),re=await C.estimateFeesPerGas(),oe=await C.estimateGas({account:n.address,to:c,data:p,value:BigInt(d??"0")});return{transaction:await n.signTransaction({to:c,data:p,value:BigInt(d??"0"),chainId:_,nonce:M,gas:oe,maxFeePerGas:re.maxFeePerGas,maxPriorityFeePerGas:re.maxPriorityFeePerGas,type:"eip1559"})}}let i=t.startsWith("0x")?t:`0x${Buffer.from(t,"base64").toString("hex")}`,r=Un(i);return{transaction:await n.signTransaction(r)}}function Wn(e,t){let n=Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"),i=In("sha256").update(n).digest(),r=gt.sign(i,e);if(!r)throw new Error("Tron transaction signing failed");return{transaction:Buffer.from(r).toString("hex")}}async function Vn(e,t){let n=await import("bitcoinjs-lib"),i=(await import("ecpair")).default,r=await import("tiny-secp256k1"),c=i(r).fromPrivateKey(Buffer.from(e)),p=n.Psbt.fromBase64(t);return p.signAllInputs(c),p.finalizeAllInputs(),{transaction:p.toBase64()}}import{createHash as _t}from"crypto";import{Keypair as Fn}from"@solana/web3.js";import Hn from"bs58";import Mn from"tweetnacl";import*as xe from"tiny-secp256k1";import{keccak_256 as zn}from"@noble/hashes/sha3";import{privateKeyToAccount as Kn}from"viem/accounts";import{z as ee}from"zod";var bt=a({name:"message_sign",description:"Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",input:ee.object({wallet:ee.string().describe("Wallet address or name to sign with"),chain:u.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),message:ee.string().describe("Message text to sign")}),output:ee.object({signature:ee.string().describe("Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin")})});var me=s(bt,async e=>{let t=g(e.wallet),n=e.chain,i=h[n],{privateKey:r}=q(t,n),o=Buffer.from(e.message,"utf8");switch(i){case"solana":return Gn(r,o);case"ethereum":return Jn(r,e.message);case"tron":return Yn(r,e.message);case"bitcoin":return Xn(r,o)}});function Gn(e,t){let n=Fn.fromSecretKey(e),i=Mn.sign.detached(t,n.secretKey);return{signature:Hn.encode(i)}}async function Jn(e,t){return{signature:await Kn(`0x${Buffer.from(e).toString("hex")}`).signMessage({message:t})}}function Yn(e,t){let n=Buffer.from(t,"utf8"),i=Buffer.from(`TRON Signed Message:
22
+ ${n.length}`,"utf8"),r=zn(Buffer.concat([i,n])),o=xe.sign(r,e);if(!o)throw new Error("Tron message signing failed");return{signature:"0x"+Buffer.from(o).toString("hex")}}function Xn(e,t){let n=_t("sha256").update(t).digest(),i=_t("sha256").update(n).digest(),r=xe.sign(i,e);if(!r)throw new Error("Bitcoin message signing failed");return{signature:"0x"+Buffer.from(r).toString("hex")}}import Zn from"https";import{z as S}from"zod";var wt=a({name:"bitcoin_balance_retrieve",description:"Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",input:S.object({wallet:S.string().describe("Bitcoin address (bc1...) or wallet name")}),output:S.object({address:S.string().describe("Bitcoin address"),confirmed:S.object({btc:S.string().describe("Confirmed balance in BTC"),sats:S.number().describe("Confirmed balance in satoshis")}),unconfirmed:S.object({btc:S.string().describe("Unconfirmed (pending) balance in BTC"),sats:S.number().describe("Unconfirmed (pending) balance in satoshis")}),total:S.object({btc:S.string().describe("Total balance in BTC"),sats:S.number().describe("Total balance in satoshis")})})});var Qn=1e8;function Ce(e){return(e/Qn).toFixed(8)}function ei(e){return new Promise((t,n)=>{Zn.get(e,{headers:{"User-Agent":"moonpay-cli"}},i=>{if(i.statusCode!==200){n(new Error(`HTTP ${i.statusCode} from ${e}`)),i.resume();return}let r="";i.on("data",o=>r+=o),i.on("end",()=>{try{t(JSON.parse(r))}catch{n(new Error("Invalid JSON response"))}})}).on("error",n)})}var St=s(wt,async e=>{let t=e.wallet;if(!t.startsWith("bc1")&&!t.startsWith("1")&&!t.startsWith("3")){let{findWalletOrThrow:c}=await import("./store-XV77WYWO.js"),d=c(t).addresses.bitcoin;if(!d)throw new Error(`Wallet "${t}" has no Bitcoin address. It may be an imported single-chain wallet.`);t=d}let n=await ei(`https://mempool.space/api/address/${encodeURIComponent(t)}`),i=n.chain_stats.funded_txo_sum-n.chain_stats.spent_txo_sum,r=n.mempool_stats.funded_txo_sum-n.mempool_stats.spent_txo_sum,o=i+r;return{address:t,confirmed:{btc:Ce(i),sats:i},unconfirmed:{btc:Ce(r),sats:r},total:{btc:Ce(o),sats:o}}});import{readdirSync as ti,readFileSync as kt,existsSync as Ae,mkdirSync as ni,cpSync as ii}from"fs";import{join as V,dirname as ri}from"path";import{homedir as oi}from"os";import{fileURLToPath as ai}from"url";function Ie(){let e=ai(import.meta.url),t=ri(e);return V(t,"..","skills")}function si(){return V(oi(),".claude","skills")}function $e(){let e=Ie();return Ae(e)?ti(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&t.name.startsWith("moonpay-")).map(t=>{let i=kt(V(e,t.name,"SKILL.md"),"utf-8").match(/^description:\s*(.+)$/m);return{name:t.name,description:i?.[1]?.replace(/^["']|["']$/g,"")??""}}).sort((t,n)=>t.name.localeCompare(n.name)):[]}function vt(e){if(/[/\\]|\.\./.test(e))throw new Error(`Invalid skill name: "${e}"`);let t=V(Ie(),e,"SKILL.md");if(!Ae(t))throw new Error(`Skill "${e}" not found. Run \`mp skill list\` to see available skills.`);return kt(t,"utf-8")}function Tt(e,t){let n=Ie(),i=t??si(),r=$e();return ni(i,{recursive:!0}),r.map(o=>{let c=V(i,o.name);return Ae(c)&&!e?{name:o.name,installed:!1}:(ii(V(n,o.name),c,{recursive:!0,force:!0}),{name:o.name,installed:!0})})}import{z as te}from"zod";var Pt=a({name:"skill_list",description:"List available AI skills for Claude Code and other agents",input:te.object({}),output:te.array(te.object({name:te.string(),description:te.string()}))});var jt=s(Pt,async()=>$e());import{z as ne}from"zod";var xt=a({name:"skill_retrieve",description:"Get the full instructions for a specific skill",input:ne.object({name:ne.string().describe("Skill name (e.g. moonpay-swap-tokens)")}),output:ne.object({name:ne.string(),content:ne.string()})});var Ct=s(xt,async e=>({name:e.name,content:vt(e.name)}));import{z as U}from"zod";var At=a({name:"skill_install",description:"Install AI skills for Claude Code. Defaults to ~/.claude/skills/, or specify --dir for a custom location (e.g. project-local, ~/.agents/skills).",input:U.object({force:U.boolean().describe("Overwrite existing skills"),dir:U.string().nullable().describe("Target directory to install skills into (default: ~/.claude/skills/)")}),output:U.array(U.object({name:U.string(),installed:U.boolean()}))});var It=s(At,async e=>Tt(e.force,e.dir??void 0));import{encodeFunctionData as ci}from"viem";import{z as k}from"zod";var $t=a({name:"token_bridge",description:"Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",input:k.object({from:k.object({wallet:k.string().describe("Local wallet name to sign with"),chain:u.describe("Source chain"),token:k.string().describe("Source token address"),amount:k.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")}),to:k.object({wallet:k.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),chain:u.describe("Destination chain"),token:k.string().describe("Destination token address"),amount:k.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:k.object({signature:k.string().describe("Transaction hash/signature"),message:k.string().describe("Human-readable bridge description")})});var pi=[{name:"approve",type:"function",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],he=s($t,async e=>{if(!e.from.amount&&!e.to.amount)throw new Error("Provide either from.amount or to.amount.");let t=v(),n=await j.handler({wallet:e.from.wallet}),i=n.addresses[h[e.from.chain]];if(!i)throw new Error(`Wallet "${n.name}" has no address on ${e.from.chain}.`);let r=i;if(e.to.wallet)try{r=(await j.handler({wallet:e.to.wallet})).addresses[h[e.to.chain]]??e.to.wallet}catch{r=e.to.wallet}else e.from.chain!==e.to.chain&&(r=n.addresses[h[e.to.chain]]??i);let o={from:{wallet:i,chain:e.from.chain,token:e.from.token,amount:e.from.amount},to:{wallet:r,chain:e.to.chain,token:e.to.token,amount:e.to.amount}},c=await w(t,"swaps_transaction_build",o),p=c.transaction;if(c.requiresApproval&&"to"in p){let{to:m,chainId:C}=p,M={type:"evm",to:e.from.token,data:ci({abi:pi,functionName:"approve",args:[m,BigInt(c.amountIn.raw)]}),value:"0",chainId:C},{transaction:re}=await E.handler({wallet:n.name,chain:e.from.chain,transaction:JSON.stringify(M)}),oe=await w(t,"transaction_send",{transaction:re,message:`Approve ${c.amountIn.symbol}`,chain:e.from.chain});if(!oe.signature)throw new Error(`Approval failed: ${oe.message}`);process.stderr.write(`Approval sent. Waiting for confirmation...
23
+ `),await new Promise(De=>setTimeout(De,5e3)),c=await w(t,"swaps_transaction_build",o)}let d="base64"in c.transaction?c.transaction.base64:JSON.stringify(c.transaction),{transaction:_}=await E.handler({wallet:n.name,chain:e.from.chain,transaction:d}),y=await w(t,"transaction_send",{transaction:_,message:c.message,chain:e.from.chain});if(!y.signature)throw new Error(`Transaction send failed: ${y.message}`);try{await w(t,"transaction_register",{transactionId:c.transactionId,transactionHash:y.signature,chain:e.from.chain})}catch{}return{signature:y.signature,message:c.message}});import{z as T}from"zod";var Rt=a({name:"token_swap",description:"Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",input:T.object({wallet:T.string().describe("Local wallet name to sign with"),chain:u.describe("Chain to swap on"),from:T.object({token:T.string().describe("Input token address (selling)"),amount:T.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")}),to:T.object({token:T.string().describe("Output token address (buying)"),amount:T.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:T.object({signature:T.string().describe("Transaction hash/signature"),message:T.string().describe("Human-readable swap description")})});var Et=s(Rt,async e=>he.handler({from:{wallet:e.wallet,chain:e.chain,token:e.from.token,amount:e.from.amount},to:{wallet:null,chain:e.chain,token:e.to.token,amount:e.to.amount}}));import{z as I}from"zod";var Ut=a({name:"token_transfer",description:"Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",input:I.object({wallet:I.string().describe("Local wallet name to sign with"),chain:u.describe("Chain to transfer on"),token:I.string().describe("Token address to transfer"),amount:I.coerce.number().describe("Amount to transfer"),to:I.string().describe("Recipient wallet name or address")}),output:I.object({signature:I.string().describe("Transaction hash/signature"),message:I.string().describe("Human-readable transfer description")})});var Dt=s(Ut,async e=>{let t=v(),n=await j.handler({wallet:e.wallet}),i=n.addresses[h[e.chain]];if(!i)throw new Error(`Wallet "${n.name}" has no address on ${e.chain}.`);let r=e.to;try{r=(await j.handler({wallet:e.to})).addresses[h[e.chain]]??e.to}catch{}let o=await w(t,"token_transfer",{wallet:i,token:e.token,to:r,amount:e.amount,chain:e.chain}),c="base64"in o.transaction?o.transaction.base64:JSON.stringify(o.transaction),{transaction:p}=await E.handler({wallet:n.name,chain:e.chain,transaction:c}),d=await w(t,"transaction_send",{transaction:p,message:o.message,chain:e.chain});if(!d.signature)throw new Error(`Transaction send failed: ${d.message}`);return{signature:d.signature,message:o.message}});import{Keypair as li,VersionedTransaction as di,VersionedMessage as ui}from"@solana/web3.js";import Ot from"axios";import{wrapAxiosWithPayment as Nt}from"@x402/axios";import{x402Client as Lt}from"@x402/core/client";import{ExactSvmScheme as mi}from"@x402/svm";import{registerExactEvmScheme as hi}from"@x402/evm/exact/client";import{toClientEvmSigner as fi}from"@x402/evm";import{privateKeyToAccount as yi}from"viem/accounts";import{createPublicClient as gi,http as bi}from"viem";import*as P from"viem/chains";import{z as b}from"zod";var qt=a({name:"x402_request",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.",input:b.object({method:b.enum(["GET","POST","PUT","PATCH","DELETE"]).describe("HTTP method"),url:b.string().url().refine(e=>e.startsWith("https://"),{message:"URL must use HTTPS"}).refine(e=>{try{return!new URL(e).hostname.match(/^(localhost|127\.|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|\[::1\])/)}catch{return!1}},{message:"URL must not target private/internal addresses"}).describe("Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/x402/upgrade')"),body:b.record(b.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),params:b.record(b.any()).nullable().describe("Query parameters"),wallet:b.string().describe("Wallet name or address to pay with"),chain:b.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.")}),output:b.object({status:b.number().describe("HTTP status code"),data:b.any().describe("Response data"),headers:b.record(b.any()).describe("Response headers")})});var _i="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",wi={ethereum:P.mainnet,base:P.base,polygon:P.polygon,arbitrum:P.arbitrum,optimism:P.optimism};function Si(e,t){let n=li.fromSecretKey(t),i={address:e,signTransactions:async c=>c.map(p=>{let d=new Uint8Array(p.messageBytes),_=ui.deserialize(d),y=Object.keys(p.signatures).length,m=new di(_,new Array(y).fill(new Uint8Array(64)));m.sign([n]);let C=_.staticAccountKeys.findIndex(M=>M.toBase58()===e);if(C===-1)throw new Error(`Wallet ${e} is not a signer for this transaction`);return{[e]:m.signatures[C]}})},r=new Lt,o=new mi(i);return r.register(_i,o),r.registerV1("solana",o),Nt(Ot.create(),r)}function ki(e,t){let n=yi(`0x${Buffer.from(e).toString("hex")}`),i=wi[t]??P.base,r=gi({chain:i,transport:bi()}),o=fi(n,r),c=new Lt;return hi(c,{signer:o}),Nt(Ot.create(),c)}var fe=s(qt,async({method:e,url:t,body:n,params:i,wallet:r,chain:o})=>{let c=g(r),p=o??"solana",{privateKey:d,address:_}=q(c,p),y=p==="solana"?Si(_,d):ki(d,p),m;switch(e){case"GET":m=await y.get(t,{params:i});break;case"POST":m=await y.post(t,n||{},{params:i});break;case"PUT":m=await y.put(t,n||{},{params:i});break;case"PATCH":m=await y.patch(t,n||{},{params:i});break;case"DELETE":m=await y.delete(t,{params:i});break;default:throw new Error(`Unsupported HTTP method: ${e}`)}return{status:m.status,data:m.data,headers:m.headers}});import{z as F}from"zod";var Bt=a({name:"virtual-account_wallet_register",description:"Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",input:F.object({wallet:F.string().describe("Local wallet name"),chain:u.describe("Chain to register (solana, ethereum, etc.)")}),output:F.object({success:F.literal(!0),address:F.string().describe("Registered wallet address"),chain:F.string().describe("Chain registered on")})});var Wt=s(Bt,async e=>{let t=v(),n=e.chain,i=await j.handler({wallet:e.wallet}),r=h[n],o=i.addresses[r];if(!o)throw new Error(`Wallet "${i.name}" has no ${r} address.`);let{message:c}=await je(t,"virtual-account_wallet_registration-message_create",{wallet:o}),{signature:p}=await me.handler({wallet:i.name,chain:n,message:c});return await w(t,"virtual-account_wallet_register",{wallet:o,message:c,signature:p,chain:n}),{success:!0,address:o,chain:n}});import*as x from"fs";import*as zt from"os";import*as Ue from"path";import*as Kt from"crypto";import{z as ye}from"zod";var Vt=a({name:"consent_accept",description:"Accept the MoonPay Terms of Use. Required before using any CLI command.",input:ye.object({}),output:ye.object({tosVersion:ye.string(),acceptedAt:ye.string()})});import*as ge from"os";var Ft=3e3;function Ht(e){let t=v(),n=JSON.stringify({agentId:e.agentId,tosVersion:e.tosVersion,cliVersion:e.cliVersion,nodeVersion:process.version,os:ge.platform(),arch:ge.arch()});fetch(`${t}/api/tools/cli_activation_create`,{method:"POST",headers:A(),body:n,signal:AbortSignal.timeout(Ft)}).catch(()=>{})}async function Mt(e){let t=v(),n=await N();n&&fetch(`${t}/api/tools/cli_activation_update`,{method:"POST",headers:{...A(),Authorization:`Bearer ${n}`},body:JSON.stringify({agentId:e}),signal:AbortSignal.timeout(Ft)}).catch(()=>{})}var Re=Ue.join(zt.homedir(),".config","moonpay"),Ee=Ue.join(Re,"consent.json");function vi(){try{return JSON.parse(x.readFileSync(Ee,"utf-8"))}catch{return null}}var Gt=s(Vt,async()=>{x.existsSync(Re)||x.mkdirSync(Re,{recursive:!0,mode:448});let t=vi()?.agentId??Kt.randomUUID(),n=new Date().toISOString(),i={tosVersion:"1.2",acceptedAt:n,agentId:t},r=Ee+`.tmp.${process.pid}`;return x.writeFileSync(r,JSON.stringify(i,null,2),{encoding:"utf-8",mode:384}),x.renameSync(r,Ee),process.stderr.write(`
24
+ By using this CLI, you agree to:
25
+ ${le}
26
+
27
+ `),Ht({agentId:t,tosVersion:"1.2",cliVersion:_e}),{tosVersion:i.tosVersion,acceptedAt:i.acceptedAt}});import{z as ie}from"zod";var Jt=a({name:"login",description:"Send a login verification code to your email.",input:ie.object({email:ie.string().describe("Email address")}),output:ie.object({email:ie.string(),message:ie.string()})});var Yt=s(Jt,async e=>{let{baseUrl:t}=pe(),n=`${t}/login?email=${encodeURIComponent(e.email)}`;return{email:e.email,message:`Open this link to verify:
28
+
29
+ ${n}
30
+
31
+ Then run: mp verify --email ${e.email} --code <code>`}});import*as Zt from"fs";import*as Qt from"os";import*as en from"path";import{z as H}from"zod";var Xt=a({name:"verify",description:"Verify login code and store encrypted credentials.",input:H.object({email:H.string().describe("Email address"),code:H.string().describe("Verification code")}),output:H.object({email:H.string(),message:H.string()})});var Ti=en.join(Qt.homedir(),".config","moonpay","consent.json");function Pi(){try{return JSON.parse(Zt.readFileSync(Ti,"utf-8")).agentId??null}catch{return null}}var tn=s(Xt,async e=>{let{baseUrl:t}=pe(),n=await Te(t,"verify",{email:e.email,code:e.code}),i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:t};ve(i);let r=Pi();return r&&Mt(r).catch(()=>{}),{email:e.email,message:"Logged in successfully."}});import{z as be}from"zod";var nn=a({name:"logout",description:"Log out and clear stored credentials.",input:be.object({}),output:be.object({success:be.literal(!0),message:be.string()})});var rn=s(nn,async()=>(Ke(),{success:!0,message:"Logged out."}));import{z as $}from"zod";var on=a({name:"upgrade",description:"Purchase a rate limit upgrade via x402. Increases your API rate limit. Requires login and a funded wallet.",input:$.object({duration:$.enum(["day","month"]).describe("Upgrade duration: day ($1 USDC, 24h) or month ($20 USDC, 30 days)"),wallet:$.string().describe("Wallet name or address to pay with"),chain:$.enum(["solana","base"]).describe("Chain to pay from. x402 payments accepted on Solana and Base.")}),output:$.object({duration:$.string(),expiresAt:$.string().describe("When the upgrade expires"),message:$.string()})});var an=s(on,async e=>{if(!await N())throw new Error("Login required to upgrade. Run `mp login` first.");let n=v(),i=await w(n,"user_retrieve",{}),r=await fe.handler({method:"POST",url:`${n}/x402/upgrade`,body:{userId:i.id,duration:e.duration},params:null,wallet:e.wallet,chain:e.chain});if(r.status>=400){let o=r.data?.error??"Upgrade failed";throw new Error(o)}return r.data});var qc=[et,rt,st,j,dt,mt,ft,E,me,St,jt,Ct,It,Et,he,Dt,fe,Wt,Gt,Ze,Yt,tn,rn,an];export{_e as a,v as b,je as c,Ni as d,le as e,Ze as f,qc as g};
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
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 _,b as A,c as C,d as J,e as S,f as k}from"./chunk-W7HRRMKL.js";import"./chunk-WLQU5BOQ.js";import{createRequire as X}from"module";import{Command as ee}from"commander";var Z=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function $(e){return t=>Z?`${e}${t}\x1B[0m`:t}var p={bold:$("\x1B[1m"),dim:$("\x1B[2m"),green:$("\x1B[32m"),yellow:$("\x1B[33m"),cyan:$("\x1B[36m"),red:$("\x1B[31m")};function N(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function O(e){return e==null?"-":String(e)}function j(e,t=0){let n=" ".repeat(t);return N(e)?`${n}${O(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(N)?e.map(r=>`${n}- ${O(r)}`).join(`
4
- `):e.map(r=>{if(typeof r!="object"||r===null)return`${n}- ${O(r)}`;let o=Object.entries(r),a=[],[c,f]=o[0];N(f)?a.push(`${n}- ${p.bold(c)}: ${O(f)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(j(f,t+2)));for(let[m,y]of o.slice(1))N(y)?a.push(`${n} ${p.bold(m)}: ${O(y)}`):(a.push(`${n} ${p.bold(m)}:`),a.push(j(y,t+2)));return a.join(`
3
+ import{a as S,b as A,c as J,d as j,e as R,f as _,g as k}from"./chunk-AYAAQSBK.js";import"./chunk-WLQU5BOQ.js";import{Command as X}from"commander";var M=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function $(e){return t=>M?`${e}${t}\x1B[0m`:t}var p={bold:$("\x1B[1m"),dim:$("\x1B[2m"),green:$("\x1B[32m"),yellow:$("\x1B[33m"),cyan:$("\x1B[36m"),red:$("\x1B[31m")};function N(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function O(e){return e==null?"-":String(e)}function C(e,t=0){let n=" ".repeat(t);return N(e)?`${n}${O(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(N)?e.map(r=>`${n}- ${O(r)}`).join(`
4
+ `):e.map(r=>{if(typeof r!="object"||r===null)return`${n}- ${O(r)}`;let o=Object.entries(r),a=[],[c,f]=o[0];N(f)?a.push(`${n}- ${p.bold(c)}: ${O(f)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(C(f,t+2)));for(let[m,y]of o.slice(1))N(y)?a.push(`${n} ${p.bold(m)}: ${O(y)}`):(a.push(`${n} ${p.bold(m)}:`),a.push(C(y,t+2)));return a.join(`
5
5
  `)}).join(`
6
6
 
7
7
  `):typeof e=="object"&&e!==null?Object.entries(e).map(([o,a])=>N(a)?`${n}${p.bold(o)}: ${O(a)}`:`${n}${p.bold(o)}:
8
- ${j(a,t+1)}`).join(`
9
- `):""}function M(e){if(typeof e!="object"||e===null)return e;let t=e;return"data"in t?t.data:"items"in t&&Array.isArray(t.items)&&Object.keys(t).filter(r=>r!=="items").length===0?t.items:e}function R(e,t){return t==="json"?JSON.stringify(e,null,2):j(M(e))}import{readFileSync as Y,writeFileSync as z,mkdirSync as H}from"fs";import{join as F}from"path";import{homedir as B}from"os";var K=F(B(),".config","moonpay"),x=F(K,"update-check.json"),G=1440*60*1e3,W=3e3;function Q(){try{let e=Y(x,"utf-8");return JSON.parse(e)}catch{return null}}function V(e){try{H(K,{recursive:!0}),z(x,JSON.stringify(e))}catch{}}function v(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<3;o++){if((n[o]??0)>(r[o]??0))return!0;if((n[o]??0)<(r[o]??0))return!1}return!1}function T(e,t){return["",p.yellow(`Update available: ${e} \u2192 ${t}`),p.dim("Run `npm i -g @moonpay/cli` to update."),""].join(`
10
- `)}function P(e){let t=null,n=Q();if(n&&Date.now()-n.checkedAt<G)return v(n.latest,e)&&(t=T(e,n.latest)),()=>t;let r=new AbortController,o=setTimeout(()=>r.abort(),W);return fetch("https://registry.npmjs.org/@moonpay%2fcli/latest",{signal:r.signal}).then(a=>a.json()).then(a=>{let c=a.version;c&&(V({latest:c,checkedAt:Date.now()}),v(c,e)&&(t=T(e,c)))}).catch(()=>{}).finally(()=>clearTimeout(o)),()=>t}var ne=X(import.meta.url),{version:E}=ne("../package.json"),te=P(E),h=new ee;h.name("moonpay").description(`MoonPay CLI \u2014 the crypto onramp for AI agents
8
+ ${C(a,t+1)}`).join(`
9
+ `):""}function q(e){if(typeof e!="object"||e===null)return e;let t=e;return"data"in t?t.data:"items"in t&&Array.isArray(t.items)&&Object.keys(t).filter(r=>r!=="items").length===0?t.items:e}function v(e,t){return t==="json"?JSON.stringify(e,null,2):C(q(e))}import{readFileSync as Y,writeFileSync as z,mkdirSync as H}from"fs";import{join as K}from"path";import{homedir as B}from"os";var x=K(B(),".config","moonpay"),E=K(x,"update-check.json"),G=1440*60*1e3,V=3e3;function W(){try{let e=Y(E,"utf-8");return JSON.parse(e)}catch{return null}}function Q(e){try{H(x,{recursive:!0}),z(E,JSON.stringify(e))}catch{}}function T(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<3;o++){if((n[o]??0)>(r[o]??0))return!0;if((n[o]??0)<(r[o]??0))return!1}return!1}function F(e,t){return["",p.yellow(`Update available: ${e} \u2192 ${t}`),p.dim("Run `npm i -g @moonpay/cli` to update."),""].join(`
10
+ `)}function P(e){let t=null,n=W();if(n&&Date.now()-n.checkedAt<G)return T(n.latest,e)&&(t=F(e,n.latest)),()=>t;let r=new AbortController,o=setTimeout(()=>r.abort(),V);return fetch("https://registry.npmjs.org/@moonpay%2fcli/latest",{signal:r.signal}).then(a=>a.json()).then(a=>{let c=a.version;c&&(Q({latest:c,checkedAt:Date.now()}),T(c,e)&&(t=F(e,c)))}).catch(()=>{}).finally(()=>clearTimeout(o)),()=>t}var ee=P(S),h=new X;h.name("moonpay").description(`MoonPay CLI \u2014 the crypto onramp for AI agents
11
11
 
12
12
  Your agents need money. MoonPay gives them wallets, funds, and tools
13
13
  to buy, swap, bridge, and transact \u2014 all from the command line.
14
14
 
15
15
  Run \`mp skill install\` to install AI skills for Claude Code.
16
16
 
17
- `+J).version(E).option("--json","Output as JSON instead of YAML");function re(){return h.opts().json?"json":"yaml"}function L(e){console.log(R(e,re()))}function D(){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-NXQYEHWK.js");await e()});function I(e,t){let n=e;for(let r of t){let o=n.commands.find(a=>a.name()===r);o||(o=n.command(r)),n=o}return n}function U(e,t=""){let n=[];for(let[r,o]of Object.entries(e)){let a=t?`${t}-${r}`:r,c=o;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let f=c;f._def.typeName==="ZodNullable"&&(f=f._def.innerType),f._def.typeName==="ZodObject"&&f.shape?n.push(...U(f.shape,a)):n.push({flatKey:a,field:o,path:a.split("-")})}return n}function oe(e,t){let n={};for(let{flatKey:r,path:o}of t){let a=r.replace(/-([a-z])/g,(f,m)=>m.toUpperCase()),c=a in e?e[a]:e[r];if(o.length===1)n[o[0]]=c;else{let f=n;for(let m=0;m<o.length-1;m++)(!f[o[m]]||typeof f[o[m]]!="object")&&(f[o[m]]={}),f=f[o[m]];f[o[o.length-1]]=c}}return n}function se(e,t){for(let n of t){let r=n.schema.name.split("_"),o=r.pop(),c=I(e,r).command(o).description(n.schema.description),f=n.schema.input.shape??{},m=U(f),y=[],b=[],w=[];for(let{flatKey:u,field:i}of m){let s=i.description??u,l=i;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let g=l._def.typeName,d=l;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(u),d._def.typeName==="ZodRecord"&&w.push(u),g==="ZodBoolean"?c.option(`--${u}`,s,!1):g==="ZodNullable"?(c.option(`--${u} <${u}>`,s),y.push(u)):c.requiredOption(`--${u} <${u}>`,s)}c.action(async u=>{n.schema.name.startsWith("consent_")||await S.handler({});for(let s of y){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]===void 0&&(u[l]=null)}for(let s of b){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]!=null&&typeof u[l]=="string"&&(u[l]=Number(u[l]))}for(let s of w){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof u[l]=="string")try{u[l]=JSON.parse(u[l])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}}let i=oe(u,m);try{let s=await n.handler(i);L(s)}catch(s){console.error(s.message),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 q=new Set(["swaps_transaction_build","token_transfer","transaction_register"]);function fe(e,t){for(let n of t){if(q.has(n.name))continue;let r=n.name.split("_"),o=r.pop(),a=I(e,r);if(a.commands.find(i=>i.name()===o))continue;let c=a.command(o).description(n.description),f=ie(n.inputSchema),m=f.properties??{},y=new Set(f.required??[]),b=[],w=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=ae(s),d=ce(s);le(s)&&w.push(i),d?(u.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${l} (as JSON)`):(c.option(`--${i} <json>`,`${l} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,l),b.push(i)):c.requiredOption(`--${i} <${i}>`,l)}c.action(async i=>{await S.handler({});for(let s of b)i[s]===void 0&&(i[s]=null);for(let s of w)i[s]!=null&&typeof i[s]=="string"&&(i[s]=Number(i[s]));for(let s of u)if(typeof i[s]=="string")try{i[s]=JSON.parse(i[s])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}try{let s=_(),l=await A(s,n.name,i);L(l),D()}catch(s){console.error(s.message),process.exit(1)}})}}se(h,k);fe(h,C);h.command("tools").description("List available tools").action(()=>{let e=[...k.map(n=>({name:n.schema.name,description:n.schema.description})),...C.filter(n=>!k.some(r=>r.schema.name===n.name)&&!q.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,r)=>n.name.localeCompare(r.name)),t=[];for(let n of e){let r=n.name.replace(/_/g," ");t.push(` ${p.green(r.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
18
- `)),D()});h.parse();
17
+ `+R).version(S).option("--json","Output as JSON instead of YAML");function ne(){return h.opts().json?"json":"yaml"}function I(e){console.log(v(e,ne()))}function L(){let e=ee();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-NGQW4C74.js");await e()});function D(e,t){let n=e;for(let r of t){let o=n.commands.find(a=>a.name()===r);o||(o=n.command(r)),n=o}return n}function U(e,t=""){let n=[];for(let[r,o]of Object.entries(e)){let a=t?`${t}-${r}`:r,c=o;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let f=c;f._def.typeName==="ZodNullable"&&(f=f._def.innerType),f._def.typeName==="ZodObject"&&f.shape?n.push(...U(f.shape,a)):n.push({flatKey:a,field:o,path:a.split("-")})}return n}function te(e,t){let n={};for(let{flatKey:r,path:o}of t){let a=r.replace(/-([a-z])/g,(f,m)=>m.toUpperCase()),c=a in e?e[a]:e[r];if(o.length===1)n[o[0]]=c;else{let f=n;for(let m=0;m<o.length-1;m++)(!f[o[m]]||typeof f[o[m]]!="object")&&(f[o[m]]={}),f=f[o[m]];f[o[o.length-1]]=c}}return n}function re(e,t){for(let n of t){let r=n.schema.name.split("_"),o=r.pop(),c=D(e,r).command(o).description(n.schema.description),f=n.schema.input.shape??{},m=U(f),y=[],b=[],w=[];for(let{flatKey:u,field:i}of m){let s=i.description??u,l=i;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let g=l._def.typeName,d=l;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(u),d._def.typeName==="ZodRecord"&&w.push(u),g==="ZodBoolean"?c.option(`--${u}`,s,!1):g==="ZodNullable"?(c.option(`--${u} <${u}>`,s),y.push(u)):c.requiredOption(`--${u} <${u}>`,s)}c.action(async u=>{n.schema.name.startsWith("consent_")||await _.handler({});for(let s of y){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]===void 0&&(u[l]=null)}for(let s of b){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]!=null&&typeof u[l]=="string"&&(u[l]=Number(u[l]))}for(let s of w){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof u[l]=="string")try{u[l]=JSON.parse(u[l])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}}let i=te(u,m);try{let s=await n.handler(i);I(s)}catch(s){console.error(s.message),process.exit(1)}})}}function oe(e){if(e.$ref&&e.definitions){let t=e.$ref.replace("#/definitions/","");return e.definitions[t]}return e}function se(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(t=>t.type==="null"):!1}function ie(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(t=>t.type==="object"):e.type==="object"}function ae(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 Z=new Set(["swaps_transaction_build","token_transfer","transaction_register"]);function ce(e,t){for(let n of t){if(Z.has(n.name))continue;let r=n.name.split("_"),o=r.pop(),a=D(e,r);if(a.commands.find(i=>i.name()===o))continue;let c=a.command(o).description(n.description),f=oe(n.inputSchema),m=f.properties??{},y=new Set(f.required??[]),b=[],w=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=se(s),d=ie(s);ae(s)&&w.push(i),d?(u.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${l} (as JSON)`):(c.option(`--${i} <json>`,`${l} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,l),b.push(i)):c.requiredOption(`--${i} <${i}>`,l)}c.action(async i=>{await _.handler({});for(let s of b)i[s]===void 0&&(i[s]=null);for(let s of w)i[s]!=null&&typeof i[s]=="string"&&(i[s]=Number(i[s]));for(let s of u)if(typeof i[s]=="string")try{i[s]=JSON.parse(i[s])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}try{let s=A(),l=await J(s,n.name,i);I(l),L()}catch(s){console.error(s.message),process.exit(1)}})}}re(h,k);ce(h,j);h.command("tools").description("List available tools").action(()=>{let e=[...k.map(n=>({name:n.schema.name,description:n.schema.description})),...j.filter(n=>!k.some(r=>r.schema.name===n.name)&&!Z.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,r)=>n.name.localeCompare(r.name)),t=[];for(let n of e){let r=n.name.replace(/_/g," ");t.push(` ${p.green(r.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
18
+ `)),L()});h.parse();
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{b as u,c as f,d,g as l}from"./chunk-AYAAQSBK.js";import"./chunk-WLQU5BOQ.js";import{Server as R}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as x}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as v}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as N}from"zod-to-json-schema";var y=new Map(l.map(s=>[s.schema.name,s]));function q(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let p=n.$ref.replace("#/definitions/","");return n.definitions[p]??n}return n}async function C(){let s=new R({name:"moonpay",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),n=l.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:N(e.schema.input)})),p=new Map;for(let e of d){if(y.has(e.name))continue;let t=q(e);p.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(v,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 c=i.schema.input.shape??{};for(let[m,a]of Object.entries(c))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=p.get(t)??{};for(let[c,r]of Object.entries(S))o[c]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(O=>O.type==="null"))&&(o[c]=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[c]=="string"&&(o[c]=Number(o[c]));let b=u(),w=await f(b,t,o);return{content:[{type:"text",text:JSON.stringify(w,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let g=new x;await s.connect(g)}export{C as startMcpServer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonpay/cli",
3
- "version": "0.6.28",
3
+ "version": "0.6.29",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -15,7 +15,7 @@
15
15
  "mp": "dist/index.js"
16
16
  },
17
17
  "scripts": {
18
- "build": "tsup",
18
+ "build": "tsup && node dist/index.js --version",
19
19
  "dev": "tsx src/index.ts",
20
20
  "test": "jest"
21
21
  },
@@ -35,7 +35,6 @@
35
35
  "commander": "^12.1.0",
36
36
  "ecpair": "^3.0.1",
37
37
  "ed25519-hd-key": "^1.3.0",
38
- "qrcode-terminal": "^0.12.0",
39
38
  "tiny-secp256k1": "^2.2.4",
40
39
  "tweetnacl": "^1.0.3",
41
40
  "viem": "^2.46.2",
@@ -1,33 +0,0 @@
1
- process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{a as De,b as Oe,c as Ne,d as Be,e as Le,f as ae,g as u,h,i as We,j as U,k as se,l as ce,n as Fe,p as g,q as M,r as He,s as D}from"./chunk-WLQU5BOQ.js";import*as l from"fs";import*as Ve from"os";import*as X from"path";import{readFileSync as pn}from"fs";import{join as ln}from"path";import{homedir as dn}from"os";import{createRequire as un}from"module";var mn=un(import.meta.url),hn=mn("../package.json"),fn=hn.version,yn="X-CLI-Version",gn="X-Agent-Id",K;function bn(){if(K!==void 0)return K;try{K=JSON.parse(pn(ln(dn(),".config","moonpay","consent.json"),"utf-8")).agentId??null}catch{K=null}return K??null}function A(){let e={"Content-Type":"application/json",[yn]:fn},t=bn();return t&&(e[gn]=t),e}var J=X.join(Ve.homedir(),".config","moonpay"),we=X.join(J,"config.json"),Y=X.join(J,"credentials.json"),G=X.join(J,".credentials.lock"),Se={baseUrl:"https://agents.moonpay.com"};function ve(){l.existsSync(J)||l.mkdirSync(J,{recursive:!0,mode:448})}function ze(e,t,n){let r=e+`.tmp.${process.pid}`;l.writeFileSync(r,t,{encoding:"utf-8",mode:n}),l.renameSync(r,e)}var _n=3e4;function wn(){ve();try{let e=l.openSync(G,l.constants.O_CREAT|l.constants.O_EXCL|l.constants.O_WRONLY,384);l.writeSync(e,JSON.stringify({pid:process.pid,ts:Date.now()})),l.closeSync(e)}catch(e){if(e.code!=="EEXIST")throw e;try{let t=JSON.parse(l.readFileSync(G,"utf-8"));if(Date.now()-t.ts<_n)return null}catch{}try{l.unlinkSync(G)}catch{}try{let t=l.openSync(G,l.constants.O_CREAT|l.constants.O_EXCL|l.constants.O_WRONLY,384);l.writeSync(t,JSON.stringify({pid:process.pid,ts:Date.now()})),l.closeSync(t)}catch{return null}}return()=>{try{l.unlinkSync(G)}catch{}}}function Me(){if(!l.existsSync(we))return null;try{let e=JSON.parse(l.readFileSync(we,"utf-8"));return e.baseUrl?e:null}catch{return null}}function pe(){let e=Me();return e||(Sn(Se),Se)}function O(){if(!l.existsSync(Y))return null;let e=Be();if(!e)return null;try{let t=JSON.parse(l.readFileSync(Y,"utf-8")),n=De.parse(t),r=Ne(n,e),i=JSON.parse(r);return!i.accessToken||!i.baseUrl?null:i}catch{return null}}function ke(e){let t=Le(),n=Oe(JSON.stringify(e),t);ve(),ze(Y,JSON.stringify(n,null,2),384)}function Sn(e){ve(),ze(we,JSON.stringify(e,null,2),384)}function Ke(){l.existsSync(Y)&&l.unlinkSync(Y)}function k(){let e=Me(),t=O();return e?.baseUrl??t?.baseUrl??Se.baseUrl}async function Te(e,t,n){let r=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(15e3),headers:A(),body:JSON.stringify(n)}),i=await r.json();if(!r.ok){let o=i;throw new Error(o?.error??`${t} failed (${r.status})`)}return i}async function Pe(e){if(!e.refreshToken)throw new Error("No refresh token available");let t=wn();if(!t){await new Promise(r=>setTimeout(r,2e3));let n=O();if(n&&n.expiresAt>Date.now())return n;throw new Error("Token refresh failed (concurrent refresh in progress)")}try{let n=O();if(n&&n.expiresAt>Date.now()+6e4)return n;let r=await Te(e.baseUrl,"refresh",{refreshToken:e.refreshToken}),i={accessToken:r.accessToken,refreshToken:r.refreshToken,expiresAt:r.expiresAt*1e3,baseUrl:e.baseUrl};return ke(i),i}finally{t()}}var vn=300*1e3;async function N(){let e=O();if(!e)return null;if(Date.now()>=e.expiresAt-vn){if(e.refreshToken)try{return(await Pe(e)).accessToken}catch{return null}return null}return e.accessToken}async function je(e,t,n){let r=await N(),i=A();r&&(i.Authorization=`Bearer ${r}`);let o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:i,body:JSON.stringify(n)});if(o.status===401&&r){let d=O();if(d?.refreshToken)try{let _=await Pe(d);o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:{...A(),Authorization:`Bearer ${_.accessToken}`},body:JSON.stringify(n)})}catch{}}if(o.status===401)throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");let c=await o.text();if(!c){if(o.status===429){let d=r?" Run `mp upgrade` to increase your rate limit.":" Log in with `mp login` for higher limits.";throw new Error(`Rate limit exceeded.${d}`)}throw new Error(`Empty response from server (${o.status})`)}let p;try{p=JSON.parse(c)}catch{throw new Error(`Unexpected response from server (${o.status})`)}if(o.status<200||o.status>=300){let d=p;throw new Error(d?.error??`Tool call failed (${o.status})`)}return p}async function w(e,t,n){return await je(e,t,n)}var Xr=[{name:"buy",description:"Buy crypto with fiat via MoonPay. Returns a checkout URL to complete the purchase.",inputSchema:{$ref:"#/definitions/buy_input",definitions:{buy_input:{type:"object",properties:{token:{type:"string",enum:["btc","pol_polygon","sol","trx","usdc","usdc_arbitrum","usdc_base","usdc_optimism","usdc_sol","usdc_polygon","usdt_trx","eth","eth_polygon","eth_optimism","eth_base","eth_arbitrum"],description:"MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), trx (TRX on Tron), usdt_trx (USDT on Tron), etc."},amount:{type:"number",description:"Amount in USD to spend. For example, 50 means $50 worth of the selected token."},wallet:{type:"string",description:"Destination wallet address to receive tokens (must match the chain for the selected token)"},email:{type:["string","null"],description:"Buyer email to pre-fill on the checkout page"}},required:["token","amount","wallet","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/buy_output",definitions:{buy_output:{type:"object",properties:{url:{type:"string",description:"MoonPay checkout URL \u2014 open in browser to complete purchase"}},required:["url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_create",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.",inputSchema:{$ref:"#/definitions/deposit_create_input",definitions:{deposit_create_input:{type:"object",properties:{name:{type:"string",description:"Human-readable label for this deposit link (e.g. 'Treasury Base USDC')"},wallet:{type:"string",description:"Destination wallet address where USDC will be delivered"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","bnb"],description:"Blockchain of the destination wallet"},token:{type:"string",enum:["USDC","USDC.e","USDT"],description:"Token to receive. USDC.e (bridged USDC) is only available on Polygon."}},required:["name","wallet","chain","token"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_create_output",definitions:{deposit_create_output:{type:"object",properties:{id:{type:"string",description:"Unique deposit ID \u2014 use with deposit_transaction_list to check incoming payments"},destinationWallet:{type:"string",description:"Wallet address that will receive the stablecoin"},destinationChain:{type:"string",description:"Chain where the stablecoin will be delivered"},customerToken:{type:"string",description:"Token to check deposit transactions \u2014 pass to deposit_transaction_list"},depositUrl:{type:"string",description:"Shareable URL \u2014 open in browser or share with senders to deposit funds"},wallets:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address to send funds to"},chain:{type:"string",description:"Chain this address is on (solana, ethereum, bitcoin, tron)"},qrCode:{type:"string",description:"URL to a QR code image for the deposit address"}},required:["address","chain","qrCode"],additionalProperties:!1},description:"Deposit addresses across all supported chains \u2014 send any token to any of these"},instructions:{type:"string",description:"Human-readable instructions explaining how to use the deposit"}},required:["id","destinationWallet","destinationChain","customerToken","depositUrl","wallets","instructions"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_retrieve",description:"Retrieve details of a deposit by ID. Returns the deposit name, status, destination wallet, and deposit addresses.",inputSchema:{$ref:"#/definitions/deposit_retrieve_input",definitions:{deposit_retrieve_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_retrieve_output",definitions:{deposit_retrieve_output:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string"},destinationWallet:{type:["string","null"]},depositUrl:{type:"string"}},required:["id","name","status","destinationWallet","depositUrl"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_transaction_list",description:"List transactions for a deposit. Pass the deposit id from deposit_create to check incoming payment status.",inputSchema:{$ref:"#/definitions/deposit_transaction_list_input",definitions:{deposit_transaction_list_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_transaction_list_output",definitions:{deposit_transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},amount:{type:"number"},token:{type:"string"},from:{type:"string"},status:{type:"string"},settledAmount:{type:["number","null"]},settledCurrency:{type:["string","null"]},timestamp:{type:"string"}},required:["id","amount","token","from","status","settledAmount","settledCurrency","timestamp"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"feedback_create",description:"Submit feedback, a bug report, or a feature request. Requires authentication.",inputSchema:{$ref:"#/definitions/feedback_create_input",definitions:{feedback_create_input:{type:"object",properties:{type:{type:"string",enum:["bug","feature","general"],description:"Type of feedback: bug, feature, or general"},message:{type:"string",minLength:1,maxLength:280,description:"Your feedback message"}},required:["type","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/feedback_create_output",definitions:{feedback_create_output:{type:"object",properties:{id:{type:"string",description:"Feedback ID"},message:{type:"string",description:"Confirmation message"}},required:["id","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"login",description:"Send a verification code to the provided email to sign in or create an account. Requires an hCaptcha token.",inputSchema:{$ref:"#/definitions/login_input",definitions:{login_input:{type:"object",properties:{email:{type:"string",format:"email",description:"The email of the user to login"},captchaToken:{type:"string",description:"hCaptcha response token"}},required:["email","captchaToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/login_output",definitions:{login_output:{type:"object",properties:{email:{type:"string",description:"The email the OTP was sent to"}},required:["email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"refresh",description:"Refresh an expired access token using a refresh token.",inputSchema:{$ref:"#/definitions/refresh_input",definitions:{refresh_input:{type:"object",properties:{refreshToken:{type:"string",description:"The refresh token from a previous login"}},required:["refreshToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/refresh_output",definitions:{refresh_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"swaps_transaction_build",description:"Build a swap or bridge transaction. Returns an unsigned transaction with a human-readable message, amounts, exchange rate, and estimated time. Supports same-chain swaps and cross-chain bridges. Accepts UI amounts (e.g. 0.1 SOL) \u2014 decimal conversion is handled automatically.",inputSchema:{$ref:"#/definitions/swaps_transaction_build_input",definitions:{swaps_transaction_build_input:{type:"object",properties:{from:{type:"object",properties:{wallet:{type:"string",description:"Source wallet address (Solana pubkey or EVM 0x address)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Source blockchain"},token:{type:"string",description:"Source token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},amount:{type:["number","null"],description:"Amount to swap (exact-in). Null for exact-out."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Source: wallet, chain, token, amount"},to:{type:"object",properties:{wallet:{type:"string",description:"Destination wallet address. Same as source wallet for same-chain swaps."},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Destination blockchain"},token:{type:"string",description:"Destination token address (mint on Solana, contract on EVM)"},amount:{type:["number","null"],description:"Amount to receive (exact-out). Null for exact-in."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Destination: wallet, chain, token, amount"}},required:["from","to"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/swaps_transaction_build_output",definitions:{swaps_transaction_build_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID for tracking"},transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Contract address"},data:{type:"string",description:"Calldata"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}],description:"Unsigned transaction"},message:{type:"string",description:"Human-readable description (e.g. Swap 0.1 SOL \u2192 42.5 USDC on Solana)"},amountIn:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},amountOut:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},exchangeRate:{type:"number",description:"Exchange rate (amountOut / amountIn)"},estimatedTime:{type:["number","null"],description:"Estimated completion time in seconds"},requiresApproval:{type:"boolean",description:"Whether an ERC20 approval transaction is needed first"}},required:["transactionId","transaction","message","amountIn","amountOut","exchangeRate","estimatedTime","requiresApproval"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_balance_list",description:"List all token balances held in a wallet, including amount owned, current value in USD, and token details. Shows the complete token portfolio.",inputSchema:{$ref:"#/definitions/token_balance_list_input",definitions:{token_balance_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address to check token balances for"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to check balances on (e.g. 'solana', 'ethereum', 'base')"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_balance_list_output",definitions:{token_balance_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},balance:{type:"object",properties:{amount:{type:"number",description:"Number of tokens owned"},value:{type:"number",description:"Total value of the token in USD"},price:{type:"number",description:"Current price of the token"}},required:["amount","value","price"],additionalProperties:!1}},required:["address","name","symbol","chain","decimals","balance"],additionalProperties:!1},description:"Array of all tokens in the wallet with their balances and current values"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_retrieve",description:"Get detailed token information including market data, price changes, volume, trades, and holder statistics by token address",inputSchema:{$ref:"#/definitions/token_retrieve_input",definitions:{token_retrieve_input:{type:"object",properties:{token:{type:"string",description:"Address of the token to retrieve"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain network where the token exists"}},required:["token","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_retrieve_output",definitions:{token_retrieve_output:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_search",description:"Search for tokens by name, symbol, or address. Returns matching tokens with their market data including price, volume, and liquidity.",inputSchema:{$ref:"#/definitions/token_search_input",definitions:{token_search_input:{type:"object",properties:{query:{type:"string",description:"Search term - can be token name (e.g. 'Bitcoin'), symbol (e.g. 'BTC'), or partial match"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to search on (e.g. 'solana', 'ethereum', 'base')"},limit:{type:["number","null"],description:"Maximum number of results to return (optional, defaults to 5)"}},required:["query","chain","limit"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_search_output",definitions:{token_search_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of tokens matching the search query with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_transfer",description:"Build an unsigned transfer transaction. Returns a transaction ready for signing. Handles both native and token transfers.",inputSchema:{$ref:"#/definitions/token_transfer_input",definitions:{token_transfer_input:{type:"object",properties:{wallet:{type:"string",description:"Sender wallet address (Solana pubkey or EVM 0x address)"},token:{type:"string",description:"Token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},to:{type:"string",description:"Recipient wallet address or name"},amount:{type:"number",description:"Amount to transfer in human-readable units (e.g. 1.5)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to execute the transfer on"}},required:["wallet","token","to","amount","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_transfer_output",definitions:{token_transfer_output:{type:"object",properties:{transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Recipient or contract address"},data:{type:"string",description:"Calldata (0x for native transfers)"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}]},message:{type:"string",description:"Human-readable description of the transfer"}},required:["transaction","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_trending_list",description:"Get currently trending tokens on a blockchain. Perfect for discovering what's hot right now.",inputSchema:{$ref:"#/definitions/token_trending_list_input",definitions:{token_trending_list_input:{type:"object",properties:{chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to get trending tokens from (e.g. 'solana', 'ethereum', 'base')"},limit:{type:"integer",minimum:1,description:"Number of results per page"},page:{type:"integer",minimum:1,description:"Page number (starts at 1)"}},required:["chain","limit","page"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_trending_list_output",definitions:{token_trending_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of trending tokens with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_list",description:"List swap and bridge transaction history for a wallet.",inputSchema:{$ref:"#/definitions/transaction_list_input",definitions:{transaction_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address that signed and sent the transactions"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain the wallet is on"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_list_output",definitions:{transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds"}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1},description:"List of swap/bridge transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_register",description:"Register a broadcast transaction for tracking. Call after transaction_send to enable status tracking via transaction_retrieve.",inputSchema:{$ref:"#/definitions/transaction_register_input",definitions:{transaction_register_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build"},transactionHash:{type:"string",description:"Transaction hash/signature after broadcasting"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain where the transaction was broadcast"}},required:["transactionId","transactionHash","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_register_output",definitions:{transaction_register_output:{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_retrieve",description:"Get the status and details of a transaction by its ID.",inputSchema:{$ref:"#/definitions/transaction_retrieve_input",definitions:{transaction_retrieve_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build or transaction_register"}},required:["transactionId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_retrieve_output",definitions:{transaction_retrieve_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash. Null while bridge is in progress."}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds. Null for same-chain swaps."}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_send",description:"Broadcast a signed transaction to the network. Supports Solana, EVM chains, and Bitcoin.",inputSchema:{$ref:"#/definitions/transaction_send_input",definitions:{transaction_send_input:{type:"object",properties:{transaction:{type:"string",description:"Signed transaction: base64-encoded for Solana, hex-encoded (0x...) for EVM, raw hex for Bitcoin"},message:{type:"string",description:"Human-readable message describing the transaction"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to broadcast on"}},required:["transaction","message","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_send_output",definitions:{transaction_send_output:{type:"object",properties:{signature:{type:"string",description:"Transaction signature/hash. Absent if broadcast failed."},message:{type:"string",description:"Result message or error description"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"user_retrieve",description:"Get the currently authenticated user",inputSchema:{$ref:"#/definitions/user_retrieve_input",definitions:{user_retrieve_input:{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/user_retrieve_output",definitions:{user_retrieve_output:{type:"object",properties:{id:{type:"string",description:"User ID"},email:{type:["string","null"],description:"User email address"}},required:["id","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"verify",description:"Verify a login code for the user.",inputSchema:{$ref:"#/definitions/verify_input",definitions:{verify_input:{type:"object",properties:{code:{type:"string",pattern:"^\\d{6}$",description:"The code to verify"},email:{type:"string",format:"email",description:"The email the OTP was sent to"}},required:["code","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/verify_output",definitions:{verify_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_accept",description:"Accept a required legal agreement. Pass the content ID from virtual-account_agreement_list to mark the agreement as accepted.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_input",definitions:{"virtual-account_agreement_accept_input":{type:"object",properties:{contentId:{type:"string",description:"Content ID from virtual-account_agreement_list"}},required:["contentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_output",definitions:{"virtual-account_agreement_accept_output":{type:"object",properties:{id:{type:"string",description:"Signing record ID"},contentId:{type:["string","null"],description:"Content ID of the accepted agreement"},documentId:{type:["string","null"],description:"Document ID"}},required:["id","contentId","documentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_list",description:"List legal agreements. By default shows pending agreements that must be accepted to activate the account. Use status=accepted to see previously accepted agreements.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_list_input",definitions:{"virtual-account_agreement_list_input":{type:"object",properties:{status:{anyOf:[{type:"string",enum:["pending","accepted"]},{type:"null"}],description:"Filter: pending (need to accept, default) or accepted (already signed)"},country:{type:["string","null"],description:"Country code for terms (e.g. USA, GBR). Defaults to USA."}},required:["status","country"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_list_output",definitions:{"virtual-account_agreement_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Content ID \u2014 pass to virtual-account_agreement_accept to accept"},name:{type:"string",description:"Document name (e.g. 'USA Terms and Conditions')"},url:{type:"string",description:"URL to view the document"}},required:["id","name","url"],additionalProperties:!1},description:"List of agreements"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_create",description:"Create a virtual account and start KYC verification",inputSchema:{$ref:"#/definitions/virtual-account_create_input",definitions:{"virtual-account_create_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_create_output",definitions:{"virtual-account_create_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_continue",description:"Get the current KYC verification status and URL. Use this to check progress or get the verification link again.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_input",definitions:{"virtual-account_kyc_continue_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_output",definitions:{"virtual-account_kyc_continue_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."}},required:["id","status","url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_restart",description:"Restart KYC verification. Creates a fresh verification link. Only available when account status is IdentificationRequired.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_input",definitions:{"virtual-account_kyc_restart_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_output",definitions:{"virtual-account_kyc_restart_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."},message:{type:["string","null"],description:"Instructions for the user"}},required:["id","status","url","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_create",description:"Create a fiat-to-stablecoin onramp. Returns a deposit account (bank IBAN or account number) where the user sends fiat. Incoming fiat is automatically converted to stablecoin and sent to the registered wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_create_input",definitions:{"virtual-account_onramp_create_input":{type:"object",properties:{name:{type:"string",description:"A label for this onramp (e.g. 'My USD onramp')"},fiat:{type:"string",enum:["USD","EUR"],description:"Fiat currency: usd or eur"},stablecoin:{type:"string",enum:["USDC","USDT","EURC"],description:"Target stablecoin: usdc, usdt, or eurc"},wallet:{type:"string",description:"Registered wallet address (must be registered via virtual-account_wallet_register first)"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"],description:"Blockchain to receive stablecoin on (Solana, Ethereum, Polygon, Arbitrum, Base)"}},required:["name","fiat","stablecoin","wallet","blockchain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_create_output",definitions:{"virtual-account_onramp_create_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_delete",description:"Cancel an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_input",definitions:{"virtual-account_onramp_delete_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to cancel"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_output",definitions:{"virtual-account_onramp_delete_output":{type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_list",description:"List all fiat-to-stablecoin onramps. Shows each onramp's deposit account details, status, and destination wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_list_input",definitions:{"virtual-account_onramp_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_list_output",definitions:{"virtual-account_onramp_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1},description:"List of configured onramps"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_create",description:"Create an open banking payment link for an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_input",definitions:{"virtual-account_onramp_payment_create_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp"},amount:{type:"string",description:"The amount to pay"},fiat:{type:"string",enum:["USD","EUR"],description:"The fiat currency (USD or EUR)"}},required:["onrampId","amount","fiat"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_output",definitions:{"virtual-account_onramp_payment_create_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_retrieve",description:"Get the status of an open banking payment",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_input",definitions:{"virtual-account_onramp_payment_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp this payment belongs to"},paymentId:{type:"string",format:"uuid",description:"The ID of the payment to retrieve"}},required:["onrampId","paymentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_output",definitions:{"virtual-account_onramp_payment_retrieve_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_retrieve",description:"Get onramp details and banking info",inputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_input",definitions:{"virtual-account_onramp_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to retrieve"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_output",definitions:{"virtual-account_onramp_retrieve_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_retrieve",description:"Get your virtual account status",inputSchema:{$ref:"#/definitions/virtual-account_retrieve_input",definitions:{"virtual-account_retrieve_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_retrieve_output",definitions:{"virtual-account_retrieve_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_transaction_list",description:"List fiat-to-stablecoin conversion transactions. Shows status, fiat amount sent, and stablecoin amount received for each conversion.",inputSchema:{$ref:"#/definitions/virtual-account_transaction_list_input",definitions:{"virtual-account_transaction_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_transaction_list_output",definitions:{"virtual-account_transaction_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Transaction ID"},state:{type:"string",enum:["Pending","PayoutPending","Payout","PayoutCompleted","Completed","Failed","InAmlReview","AmlRejected","AmountRejected"],description:"Transaction state (e.g. pending, completed, failed)"},sourceAmount:{type:"string",description:"Fiat amount sent (e.g. '100.00 USD')"},destinationAmount:{type:"string",description:"Stablecoin amount received (e.g. '99.50 USDC')"},createdAt:{type:"string",format:"date-time",description:"Transaction creation timestamp"}},required:["id","state","sourceAmount","destinationAmount","createdAt"],additionalProperties:!1},description:"List of onramp conversion transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_list",description:"List wallets registered for the virtual account. Only registered wallets can receive onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_list_input",definitions:{"virtual-account_wallet_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_list_output",definitions:{"virtual-account_wallet_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},address:{type:"string"},blockchain:{type:"string"}},required:["id","address","blockchain"],additionalProperties:!1},description:"List of registered wallets"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_register",description:"Register a wallet by submitting a signed proof-of-ownership message. The wallet can then be used as a destination for onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_register_input",definitions:{"virtual-account_wallet_register_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"},message:{type:"string",description:"Verification message from virtual-account_wallet_registration-message_create"},signature:{type:"string",description:"Signature of the message, signed by the wallet's private key"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"}},required:["wallet","message","signature","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_register_output",definitions:{"virtual-account_wallet_register_output":{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_registration-message_create",description:"Generate a proof-of-ownership message for wallet registration. The message must be signed by the wallet's private key and submitted via virtual-account_wallet_register.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_input",definitions:{"virtual-account_wallet_registration-message_create_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"}},required:["wallet"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_output",definitions:{"virtual-account_wallet_registration-message_create_output":{type:"object",properties:{message:{type:"string",description:"Message to sign with the wallet's private key"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}}];var Tn="https://www.moonpay.com/legal/terms_of_use_europe_hypermint",Pn="https://www.moonpay.com/legal/privacy_policy",jn="https://swaps.xyz/terms",le=` Terms of Use: ${Tn}
3
- Privacy Policy: ${Pn}
4
- Swaps by: ${jn}`;import*as Je from"fs";import*as Ye from"os";import*as Xe from"path";var a=e=>e,s=(e,t)=>({schema:e,handler:async n=>{let r=e.input.parse(n),i=await t(r);return e.output.parse(i)}});import{z as Z}from"zod";var Ge=a({name:"consent_check",description:"Check whether the MoonPay Terms of Use have been accepted. Throws if not accepted.",input:Z.object({}),output:Z.object({accepted:Z.literal(!0),tosVersion:Z.string(),acceptedAt:Z.string()})});var xn=Xe.join(Ye.homedir(),".config","moonpay","consent.json"),Ze=s(Ge,async()=>{let e=null;try{e=JSON.parse(Je.readFileSync(xn,"utf-8"))}catch{}if(!e||e.tosVersion!=="1.2")throw new Error(`Terms of Service not yet accepted. Run \`mp consent accept\` first.
5
-
6
- ${le}`);return{accepted:!0,tosVersion:e.tosVersion,acceptedAt:e.acceptedAt}});import{generateMnemonic as Cn}from"@scure/bip39";import{wordlist as An}from"@scure/bip39/wordlists/english";import{z as B}from"zod";var Qe=a({name:"wallet_create",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.",input:B.object({name:B.string().describe("Wallet name")}),output:B.object({name:B.string(),addresses:B.record(u,B.string())})});var et=s(Qe,async e=>{let t=Cn(An,256),n=ae(t);return M({name:e.name,type:"hd",mnemonic:t,addresses:n,createdAt:new Date().toISOString()}),{name:e.name,addresses:U(n)}});import{createInterface as $n}from"readline";import{validateMnemonic as nt}from"@scure/bip39";import{wordlist as rt}from"@scure/bip39/wordlists/english";import{Keypair as In}from"@solana/web3.js";import Rn from"bs58";import{privateKeyToAccount as En}from"viem/accounts";import{z as R}from"zod";var tt=a({name:"wallet_import",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.",input:R.object({name:R.string().describe("Wallet name"),mnemonic:R.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),key:R.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),chain:u.nullable().describe("Chain for single-key import (default solana)")}),output:R.object({name:R.string(),type:R.enum(["hd","imported"]),addresses:We})});function qn(e){return new Promise((t,n)=>{if(!process.stdin.isTTY){n(new Error("Interactive import requires a terminal. Pass --mnemonic or --key instead."));return}let r=$n({input:process.stdin,output:process.stderr});process.stderr.write(e),process.stdin.setRawMode(!0);let i="",o=c=>{let p=c.toString();p===`
7
- `||p==="\r"?(process.stdin.setRawMode(!1),process.stdin.removeListener("data",o),process.stderr.write(`
8
- `),r.close(),t(i.trim())):p===""?(process.stdin.setRawMode(!1),r.close(),process.exit(0)):p==="\x7F"||p==="\b"?i=i.slice(0,-1):i+=p};process.stdin.on("data",o)})}function Un(e){let t=e.split(/\s+/);return t.length>=12&&t.length<=24&&nt(e,rt)?"mnemonic":"key"}var it=s(tt,async e=>{if(e.mnemonic&&e.key)throw new Error("Provide either --mnemonic or --key, not both.");let t=e.mnemonic,n=e.key;if(!t&&!n){let p=await qn("Paste your mnemonic or private key (hidden): ");if(!p)throw new Error("No input provided.");Un(p)==="mnemonic"?t=p:n=p}if(t){let p=t.trim().toLowerCase();if(!nt(p,rt))throw new Error("Invalid BIP39 mnemonic.");let d=ae(p);return M({name:e.name,type:"hd",mnemonic:p,addresses:d,createdAt:new Date().toISOString()}),{name:e.name,type:"hd",addresses:d}}let r=e.chain?h[e.chain]:"solana",i=n??"",o,c;if(r==="solana")try{let p=Rn.decode(i);o=In.fromSecretKey(p).publicKey.toBase58(),c=i}catch{throw new Error("Invalid Solana private key. Expected base58-encoded secret key.")}else if(r==="ethereum"){if(c=i.startsWith("0x")?i.slice(2):i,!/^[0-9a-fA-F]{64}$/.test(c))throw new Error("Invalid EVM private key. Expected 64-character hex string.");o=En(`0x${c}`).address}else throw new Error(`Single-key import for ${r} is not yet supported. Use a mnemonic instead.`);return M({name:e.name,type:"imported",chain:r,privateKey:c,addresses:{[r]:o},createdAt:new Date().toISOString()}),{name:e.name,type:"imported",addresses:{[r]:o}}});import{z as ot}from"zod";var at=a({name:"wallet_list",description:"List all local wallets",input:ot.object({}),output:ot.array(se)});var st=s(at,async()=>ce().map(t=>({name:t.name,type:t.type,addresses:U(t.addresses),createdAt:t.createdAt})));import{z as ct}from"zod";var pt=a({name:"wallet_retrieve",description:"Get details of a specific wallet",input:ct.object({wallet:ct.string().describe("Wallet name or address")}),output:se});var j=s(pt,async e=>{let t=g(e.wallet);return{name:t.name,type:t.type,addresses:U(t.addresses),createdAt:t.createdAt}});import{z as L}from"zod";var lt=a({name:"wallet_delete",description:"Permanently delete a local wallet. This removes the private key file and cannot be undone.",input:L.object({wallet:L.string().describe("Name or address of the wallet to delete"),confirm:L.boolean().describe("Must be true to confirm deletion")}),output:L.object({name:L.string().describe("Name of the deleted wallet"),deleted:L.literal(!0)})});var dt=s(lt,async e=>{if(!e.confirm)throw new Error("Back up your wallet before deleting! Run `mp wallet export "+e.wallet+"` to save your recovery phrase, then re-run with --confirm to permanently delete.");let t=g(e.wallet);return He(t.name),{name:t.name,deleted:!0}});import{z as W}from"zod";var ut=a({name:"wallet_rename",description:"Rename a local wallet.",input:W.object({wallet:W.string().describe("Current name or address of the wallet"),name:W.string().describe("New name for the wallet")}),output:W.object({oldName:W.string(),newName:W.string()})});var mt=s(ut,async e=>{let n=g(e.wallet).name;if(n===e.name)return{oldName:n,newName:e.name};if(ce().some(i=>i.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);return Fe(i=>{let o=i.find(c=>c.name===n);if(!o)throw new Error(`Wallet "${n}" not found`);o.name=e.name}),{oldName:n,newName:e.name}});import{z as ue}from"zod";var ht=a({name:"wallet_export",description:"Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",input:ue.object({wallet:ue.string().describe("Wallet name")}),output:ue.object({exported:ue.literal(!0)})});var ft=s(ht,async e=>{if(!process.stdout.isTTY)throw new Error(`Wallet export requires an interactive terminal.
9
- Run this command directly in your terminal: mp wallet export `+e.wallet);let t=g(e.wallet);return t.type==="hd"?(process.stderr.write(`
10
- Mnemonic for "${t.name}":
11
-
12
- `),process.stderr.write(` ${t.mnemonic}
13
-
14
- `),process.stderr.write(`Write this down and store it securely.
15
-
16
- `)):(process.stderr.write(`
17
- Private key for "${t.name}" (${t.chain}):
18
-
19
- `),process.stderr.write(` ${t.privateKey}
20
-
21
- `)),{exported:!0}});import{createHash as Dn}from"crypto";import{Keypair as On,VersionedTransaction as Nn}from"@solana/web3.js";import{privateKeyToAccount as Bn}from"viem/accounts";import{parseTransaction as Ln}from"viem";import{createPublicClient as Wn,http as Fn}from"viem";import*as f from"viem/chains";import*as gt from"tiny-secp256k1";import{z as Q}from"zod";var yt=a({name:"transaction_sign",description:"Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",input:Q.object({wallet:Q.string().describe("Wallet name or address"),chain:u.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),transaction:Q.string().describe("Base64-encoded unsigned transaction")}),output:Q.object({transaction:Q.string().describe("Base64-encoded signed transaction")})});var Hn={1:f.mainnet,137:f.polygon,42161:f.arbitrum,8453:f.base,10:f.optimism,56:f.bsc,43114:f.avalanche},Vn={137:"https://polygon-bor-rpc.publicnode.com",42161:"https://arbitrum-one-rpc.publicnode.com",10:"https://optimism-rpc.publicnode.com",8453:"https://base-rpc.publicnode.com",56:"https://bsc-rpc.publicnode.com",43114:"https://avalanche-c-chain-rpc.publicnode.com"},E=s(yt,async e=>{let t=g(e.wallet),n=e.chain,r=h[n],{privateKey:i}=D(t,n);switch(r){case"solana":return zn(i,e.transaction.trim());case"ethereum":return Mn(i,e.transaction.trim());case"tron":return Kn(i,e.transaction.trim());case"bitcoin":return Gn(i,e.transaction.trim())}});function zn(e,t){let n=Buffer.from(t,"base64"),r=Nn.deserialize(n),i=On.fromSecretKey(e);return r.sign([i]),{transaction:Buffer.from(r.serialize()).toString("base64")}}async function Mn(e,t){let n=Bn(`0x${Buffer.from(e).toString("hex")}`);if(t.startsWith("{")){let{to:c,data:p,value:d,chainId:_}=JSON.parse(t),y=Hn[_]??f.mainnet,m=Vn[_],C=Wn({chain:y,transport:Fn(m)}),z=await C.getTransactionCount({address:n.address}),ie=await C.estimateFeesPerGas(),oe=await C.estimateGas({account:n.address,to:c,data:p,value:BigInt(d??"0")});return{transaction:await n.signTransaction({to:c,data:p,value:BigInt(d??"0"),chainId:_,nonce:z,gas:oe,maxFeePerGas:ie.maxFeePerGas,maxPriorityFeePerGas:ie.maxPriorityFeePerGas,type:"eip1559"})}}let r=t.startsWith("0x")?t:`0x${Buffer.from(t,"base64").toString("hex")}`,i=Ln(r);return{transaction:await n.signTransaction(i)}}function Kn(e,t){let n=Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"),r=Dn("sha256").update(n).digest(),i=gt.sign(r,e);if(!i)throw new Error("Tron transaction signing failed");return{transaction:Buffer.from(i).toString("hex")}}async function Gn(e,t){let n=await import("bitcoinjs-lib"),r=(await import("ecpair")).default,i=await import("tiny-secp256k1"),c=r(i).fromPrivateKey(Buffer.from(e)),p=n.Psbt.fromBase64(t);return p.signAllInputs(c),p.finalizeAllInputs(),{transaction:p.toBase64()}}import{createHash as _t}from"crypto";import{Keypair as Jn}from"@solana/web3.js";import Yn from"bs58";import Xn from"tweetnacl";import*as xe from"tiny-secp256k1";import{keccak_256 as Zn}from"@noble/hashes/sha3";import{privateKeyToAccount as Qn}from"viem/accounts";import{z as ee}from"zod";var bt=a({name:"message_sign",description:"Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",input:ee.object({wallet:ee.string().describe("Wallet address or name to sign with"),chain:u.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),message:ee.string().describe("Message text to sign")}),output:ee.object({signature:ee.string().describe("Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin")})});var me=s(bt,async e=>{let t=g(e.wallet),n=e.chain,r=h[n],{privateKey:i}=D(t,n),o=Buffer.from(e.message,"utf8");switch(r){case"solana":return er(i,o);case"ethereum":return tr(i,e.message);case"tron":return nr(i,e.message);case"bitcoin":return rr(i,o)}});function er(e,t){let n=Jn.fromSecretKey(e),r=Xn.sign.detached(t,n.secretKey);return{signature:Yn.encode(r)}}async function tr(e,t){return{signature:await Qn(`0x${Buffer.from(e).toString("hex")}`).signMessage({message:t})}}function nr(e,t){let n=Buffer.from(t,"utf8"),r=Buffer.from(`TRON Signed Message:
22
- ${n.length}`,"utf8"),i=Zn(Buffer.concat([r,n])),o=xe.sign(i,e);if(!o)throw new Error("Tron message signing failed");return{signature:"0x"+Buffer.from(o).toString("hex")}}function rr(e,t){let n=_t("sha256").update(t).digest(),r=_t("sha256").update(n).digest(),i=xe.sign(r,e);if(!i)throw new Error("Bitcoin message signing failed");return{signature:"0x"+Buffer.from(i).toString("hex")}}import ir from"https";import{z as S}from"zod";var wt=a({name:"bitcoin_balance_retrieve",description:"Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",input:S.object({wallet:S.string().describe("Bitcoin address (bc1...) or wallet name")}),output:S.object({address:S.string().describe("Bitcoin address"),confirmed:S.object({btc:S.string().describe("Confirmed balance in BTC"),sats:S.number().describe("Confirmed balance in satoshis")}),unconfirmed:S.object({btc:S.string().describe("Unconfirmed (pending) balance in BTC"),sats:S.number().describe("Unconfirmed (pending) balance in satoshis")}),total:S.object({btc:S.string().describe("Total balance in BTC"),sats:S.number().describe("Total balance in satoshis")})})});var or=1e8;function Ce(e){return(e/or).toFixed(8)}function ar(e){return new Promise((t,n)=>{ir.get(e,{headers:{"User-Agent":"moonpay-cli"}},r=>{if(r.statusCode!==200){n(new Error(`HTTP ${r.statusCode} from ${e}`)),r.resume();return}let i="";r.on("data",o=>i+=o),r.on("end",()=>{try{t(JSON.parse(i))}catch{n(new Error("Invalid JSON response"))}})}).on("error",n)})}var St=s(wt,async e=>{let t=e.wallet;if(!t.startsWith("bc1")&&!t.startsWith("1")&&!t.startsWith("3")){let{findWalletOrThrow:c}=await import("./store-XV77WYWO.js"),d=c(t).addresses.bitcoin;if(!d)throw new Error(`Wallet "${t}" has no Bitcoin address. It may be an imported single-chain wallet.`);t=d}let n=await ar(`https://mempool.space/api/address/${encodeURIComponent(t)}`),r=n.chain_stats.funded_txo_sum-n.chain_stats.spent_txo_sum,i=n.mempool_stats.funded_txo_sum-n.mempool_stats.spent_txo_sum,o=r+i;return{address:t,confirmed:{btc:Ce(r),sats:r},unconfirmed:{btc:Ce(i),sats:i},total:{btc:Ce(o),sats:o}}});import{readdirSync as sr,readFileSync as vt,existsSync as Ae,mkdirSync as cr,cpSync as pr}from"fs";import{join as F,dirname as lr}from"path";import{homedir as dr}from"os";import{fileURLToPath as ur}from"url";function $e(){let e=ur(import.meta.url),t=lr(e);return F(t,"..","skills")}function mr(){return F(dr(),".claude","skills")}function Ie(){let e=$e();return Ae(e)?sr(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&t.name.startsWith("moonpay-")).map(t=>{let r=vt(F(e,t.name,"SKILL.md"),"utf-8").match(/^description:\s*(.+)$/m);return{name:t.name,description:r?.[1]?.replace(/^["']|["']$/g,"")??""}}).sort((t,n)=>t.name.localeCompare(n.name)):[]}function kt(e){if(/[/\\]|\.\./.test(e))throw new Error(`Invalid skill name: "${e}"`);let t=F($e(),e,"SKILL.md");if(!Ae(t))throw new Error(`Skill "${e}" not found. Run \`mp skill list\` to see available skills.`);return vt(t,"utf-8")}function Tt(e,t){let n=$e(),r=t??mr(),i=Ie();return cr(r,{recursive:!0}),i.map(o=>{let c=F(r,o.name);return Ae(c)&&!e?{name:o.name,installed:!1}:(pr(F(n,o.name),c,{recursive:!0,force:!0}),{name:o.name,installed:!0})})}import{z as te}from"zod";var Pt=a({name:"skill_list",description:"List available AI skills for Claude Code and other agents",input:te.object({}),output:te.array(te.object({name:te.string(),description:te.string()}))});var jt=s(Pt,async()=>Ie());import{z as ne}from"zod";var xt=a({name:"skill_retrieve",description:"Get the full instructions for a specific skill",input:ne.object({name:ne.string().describe("Skill name (e.g. moonpay-swap-tokens)")}),output:ne.object({name:ne.string(),content:ne.string()})});var Ct=s(xt,async e=>({name:e.name,content:kt(e.name)}));import{z as q}from"zod";var At=a({name:"skill_install",description:"Install AI skills for Claude Code. Defaults to ~/.claude/skills/, or specify --dir for a custom location (e.g. project-local, ~/.agents/skills).",input:q.object({force:q.boolean().describe("Overwrite existing skills"),dir:q.string().nullable().describe("Target directory to install skills into (default: ~/.claude/skills/)")}),output:q.array(q.object({name:q.string(),installed:q.boolean()}))});var $t=s(At,async e=>Tt(e.force,e.dir??void 0));import{encodeFunctionData as hr}from"viem";import{z as v}from"zod";var It=a({name:"token_bridge",description:"Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",input:v.object({from:v.object({wallet:v.string().describe("Local wallet name to sign with"),chain:u.describe("Source chain"),token:v.string().describe("Source token address"),amount:v.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")}),to:v.object({wallet:v.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),chain:u.describe("Destination chain"),token:v.string().describe("Destination token address"),amount:v.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:v.object({signature:v.string().describe("Transaction hash/signature"),message:v.string().describe("Human-readable bridge description")})});var fr=[{name:"approve",type:"function",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],he=s(It,async e=>{if(!e.from.amount&&!e.to.amount)throw new Error("Provide either from.amount or to.amount.");let t=k(),n=await j.handler({wallet:e.from.wallet}),r=n.addresses[h[e.from.chain]];if(!r)throw new Error(`Wallet "${n.name}" has no address on ${e.from.chain}.`);let i=r;if(e.to.wallet)try{i=(await j.handler({wallet:e.to.wallet})).addresses[h[e.to.chain]]??e.to.wallet}catch{i=e.to.wallet}else e.from.chain!==e.to.chain&&(i=n.addresses[h[e.to.chain]]??r);let o={from:{wallet:r,chain:e.from.chain,token:e.from.token,amount:e.from.amount},to:{wallet:i,chain:e.to.chain,token:e.to.token,amount:e.to.amount}},c=await w(t,"swaps_transaction_build",o),p=c.transaction;if(c.requiresApproval&&"to"in p){let{to:m,chainId:C}=p,z={type:"evm",to:e.from.token,data:hr({abi:fr,functionName:"approve",args:[m,BigInt(c.amountIn.raw)]}),value:"0",chainId:C},{transaction:ie}=await E.handler({wallet:n.name,chain:e.from.chain,transaction:JSON.stringify(z)}),oe=await w(t,"transaction_send",{transaction:ie,message:`Approve ${c.amountIn.symbol}`,chain:e.from.chain});if(!oe.signature)throw new Error(`Approval failed: ${oe.message}`);process.stderr.write(`Approval sent. Waiting for confirmation...
23
- `),await new Promise(Ue=>setTimeout(Ue,5e3)),c=await w(t,"swaps_transaction_build",o)}let d="base64"in c.transaction?c.transaction.base64:JSON.stringify(c.transaction),{transaction:_}=await E.handler({wallet:n.name,chain:e.from.chain,transaction:d}),y=await w(t,"transaction_send",{transaction:_,message:c.message,chain:e.from.chain});if(!y.signature)throw new Error(`Transaction send failed: ${y.message}`);try{await w(t,"transaction_register",{transactionId:c.transactionId,transactionHash:y.signature,chain:e.from.chain})}catch{}return{signature:y.signature,message:c.message}});import{z as T}from"zod";var Rt=a({name:"token_swap",description:"Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",input:T.object({wallet:T.string().describe("Local wallet name to sign with"),chain:u.describe("Chain to swap on"),from:T.object({token:T.string().describe("Input token address (selling)"),amount:T.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")}),to:T.object({token:T.string().describe("Output token address (buying)"),amount:T.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:T.object({signature:T.string().describe("Transaction hash/signature"),message:T.string().describe("Human-readable swap description")})});var Et=s(Rt,async e=>he.handler({from:{wallet:e.wallet,chain:e.chain,token:e.from.token,amount:e.from.amount},to:{wallet:null,chain:e.chain,token:e.to.token,amount:e.to.amount}}));import{z as $}from"zod";var qt=a({name:"token_transfer",description:"Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",input:$.object({wallet:$.string().describe("Local wallet name to sign with"),chain:u.describe("Chain to transfer on"),token:$.string().describe("Token address to transfer"),amount:$.coerce.number().describe("Amount to transfer"),to:$.string().describe("Recipient wallet name or address")}),output:$.object({signature:$.string().describe("Transaction hash/signature"),message:$.string().describe("Human-readable transfer description")})});var Ut=s(qt,async e=>{let t=k(),n=await j.handler({wallet:e.wallet}),r=n.addresses[h[e.chain]];if(!r)throw new Error(`Wallet "${n.name}" has no address on ${e.chain}.`);let i=e.to;try{i=(await j.handler({wallet:e.to})).addresses[h[e.chain]]??e.to}catch{}let o=await w(t,"token_transfer",{wallet:r,token:e.token,to:i,amount:e.amount,chain:e.chain}),c="base64"in o.transaction?o.transaction.base64:JSON.stringify(o.transaction),{transaction:p}=await E.handler({wallet:n.name,chain:e.chain,transaction:c}),d=await w(t,"transaction_send",{transaction:p,message:o.message,chain:e.chain});if(!d.signature)throw new Error(`Transaction send failed: ${d.message}`);return{signature:d.signature,message:o.message}});import{Keypair as yr,VersionedTransaction as gr,VersionedMessage as br}from"@solana/web3.js";import Ot from"axios";import{wrapAxiosWithPayment as Nt}from"@x402/axios";import{x402Client as Bt}from"@x402/core/client";import{ExactSvmScheme as _r}from"@x402/svm";import{registerExactEvmScheme as wr}from"@x402/evm/exact/client";import{toClientEvmSigner as Sr}from"@x402/evm";import{privateKeyToAccount as vr}from"viem/accounts";import{createPublicClient as kr,http as Tr}from"viem";import*as P from"viem/chains";import{z as b}from"zod";var Dt=a({name:"x402_request",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.",input:b.object({method:b.enum(["GET","POST","PUT","PATCH","DELETE"]).describe("HTTP method"),url:b.string().url().refine(e=>e.startsWith("https://"),{message:"URL must use HTTPS"}).refine(e=>{try{return!new URL(e).hostname.match(/^(localhost|127\.|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|\[::1\])/)}catch{return!1}},{message:"URL must not target private/internal addresses"}).describe("Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/x402/upgrade')"),body:b.record(b.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),params:b.record(b.any()).nullable().describe("Query parameters"),wallet:b.string().describe("Wallet name or address to pay with"),chain:b.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.")}),output:b.object({status:b.number().describe("HTTP status code"),data:b.any().describe("Response data"),headers:b.record(b.any()).describe("Response headers")})});var Pr="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",jr={ethereum:P.mainnet,base:P.base,polygon:P.polygon,arbitrum:P.arbitrum,optimism:P.optimism};function xr(e,t){let n=yr.fromSecretKey(t),r={address:e,signTransactions:async c=>c.map(p=>{let d=new Uint8Array(p.messageBytes),_=br.deserialize(d),y=Object.keys(p.signatures).length,m=new gr(_,new Array(y).fill(new Uint8Array(64)));m.sign([n]);let C=_.staticAccountKeys.findIndex(z=>z.toBase58()===e);if(C===-1)throw new Error(`Wallet ${e} is not a signer for this transaction`);return{[e]:m.signatures[C]}})},i=new Bt,o=new _r(r);return i.register(Pr,o),i.registerV1("solana",o),Nt(Ot.create(),i)}function Cr(e,t){let n=vr(`0x${Buffer.from(e).toString("hex")}`),r=jr[t]??P.base,i=kr({chain:r,transport:Tr()}),o=Sr(n,i),c=new Bt;return wr(c,{signer:o}),Nt(Ot.create(),c)}var fe=s(Dt,async({method:e,url:t,body:n,params:r,wallet:i,chain:o})=>{let c=g(i),p=o??"solana",{privateKey:d,address:_}=D(c,p),y=p==="solana"?xr(_,d):Cr(d,p),m;switch(e){case"GET":m=await y.get(t,{params:r});break;case"POST":m=await y.post(t,n||{},{params:r});break;case"PUT":m=await y.put(t,n||{},{params:r});break;case"PATCH":m=await y.patch(t,n||{},{params:r});break;case"DELETE":m=await y.delete(t,{params:r});break;default:throw new Error(`Unsupported HTTP method: ${e}`)}return{status:m.status,data:m.data,headers:m.headers}});import{z as H}from"zod";var Lt=a({name:"virtual-account_wallet_register",description:"Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",input:H.object({wallet:H.string().describe("Local wallet name"),chain:u.describe("Chain to register (solana, ethereum, etc.)")}),output:H.object({success:H.literal(!0),address:H.string().describe("Registered wallet address"),chain:H.string().describe("Chain registered on")})});var Wt=s(Lt,async e=>{let t=k(),n=e.chain,r=await j.handler({wallet:e.wallet}),i=h[n],o=r.addresses[i];if(!o)throw new Error(`Wallet "${r.name}" has no ${i} address.`);let{message:c}=await je(t,"virtual-account_wallet_registration-message_create",{wallet:o}),{signature:p}=await me.handler({wallet:r.name,chain:n,message:c});return await w(t,"virtual-account_wallet_register",{wallet:o,message:c,signature:p,chain:n}),{success:!0,address:o,chain:n}});import*as x from"fs";import*as Mt from"os";import*as qe from"path";import*as Kt from"crypto";import{createRequire as Ar}from"module";import{z as ye}from"zod";var Ft=a({name:"consent_accept",description:"Accept the MoonPay Terms of Use. Required before using any CLI command.",input:ye.object({}),output:ye.object({tosVersion:ye.string(),acceptedAt:ye.string()})});import*as ge from"os";var Ht=3e3;function Vt(e){let t=k(),n=JSON.stringify({agentId:e.agentId,tosVersion:e.tosVersion,cliVersion:e.cliVersion,nodeVersion:process.version,os:ge.platform(),arch:ge.arch()});fetch(`${t}/api/tools/cli_activation_create`,{method:"POST",headers:A(),body:n,signal:AbortSignal.timeout(Ht)}).catch(()=>{})}async function zt(e){let t=k(),n=await N();n&&fetch(`${t}/api/tools/cli_activation_update`,{method:"POST",headers:{...A(),Authorization:`Bearer ${n}`},body:JSON.stringify({agentId:e}),signal:AbortSignal.timeout(Ht)}).catch(()=>{})}var $r=Ar(import.meta.url),{version:Ir}=$r("../../../../package.json"),Re=qe.join(Mt.homedir(),".config","moonpay"),Ee=qe.join(Re,"consent.json");function Rr(){try{return JSON.parse(x.readFileSync(Ee,"utf-8"))}catch{return null}}var Gt=s(Ft,async()=>{x.existsSync(Re)||x.mkdirSync(Re,{recursive:!0,mode:448});let t=Rr()?.agentId??Kt.randomUUID(),n=new Date().toISOString(),r={tosVersion:"1.2",acceptedAt:n,agentId:t},i=Ee+`.tmp.${process.pid}`;return x.writeFileSync(i,JSON.stringify(r,null,2),{encoding:"utf-8",mode:384}),x.renameSync(i,Ee),process.stderr.write(`
24
- By using this CLI, you agree to:
25
- ${le}
26
-
27
- `),Vt({agentId:t,tosVersion:"1.2",cliVersion:Ir}),{tosVersion:r.tosVersion,acceptedAt:r.acceptedAt}});import{z as re}from"zod";var Jt=a({name:"login",description:"Send a login verification code to your email.",input:re.object({email:re.string().describe("Email address")}),output:re.object({email:re.string(),message:re.string()})});var Yt=s(Jt,async e=>{let{baseUrl:t}=pe(),n=`${t}/login?email=${encodeURIComponent(e.email)}`;return{email:e.email,message:`Open this link to verify:
28
-
29
- ${n}
30
-
31
- Then run: mp verify --email ${e.email} --code <code>`}});import*as Zt from"fs";import*as Qt from"os";import*as en from"path";import{z as V}from"zod";var Xt=a({name:"verify",description:"Verify login code and store encrypted credentials.",input:V.object({email:V.string().describe("Email address"),code:V.string().describe("Verification code")}),output:V.object({email:V.string(),message:V.string()})});var Er=en.join(Qt.homedir(),".config","moonpay","consent.json");function qr(){try{return JSON.parse(Zt.readFileSync(Er,"utf-8")).agentId??null}catch{return null}}var tn=s(Xt,async e=>{let{baseUrl:t}=pe(),n=await Te(t,"verify",{email:e.email,code:e.code}),r={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:t};ke(r);let i=qr();return i&&zt(i).catch(()=>{}),{email:e.email,message:"Logged in successfully."}});import{z as be}from"zod";var nn=a({name:"logout",description:"Log out and clear stored credentials.",input:be.object({}),output:be.object({success:be.literal(!0),message:be.string()})});var rn=s(nn,async()=>(Ke(),{success:!0,message:"Logged out."}));import{createRequire as Ur}from"module";import{z as _e}from"zod";var on=a({name:"qr_generate",description:"Display a QR code in the terminal. Pass any text \u2014 wallet address, URL, token address, etc.",input:_e.object({value:_e.string().describe("Text to encode as a QR code")}),output:_e.object({value:_e.string()})});var Dr=Ur(import.meta.url),Or=Dr("qrcode-terminal"),an=s(on,async e=>(Or.generate(e.value,{small:!0},t=>{process.stderr.write(`
32
- ${t}
33
- `)}),{value:e.value}));import{z as I}from"zod";var sn=a({name:"upgrade",description:"Purchase a rate limit upgrade via x402. Increases your API rate limit. Requires login and a funded wallet.",input:I.object({duration:I.enum(["day","month"]).describe("Upgrade duration: day ($1 USDC, 24h) or month ($20 USDC, 30 days)"),wallet:I.string().describe("Wallet name or address to pay with"),chain:I.enum(["solana","base"]).describe("Chain to pay from. x402 payments accepted on Solana and Base.")}),output:I.object({duration:I.string(),expiresAt:I.string().describe("When the upgrade expires"),message:I.string()})});var cn=s(sn,async e=>{if(!await N())throw new Error("Login required to upgrade. Run `mp login` first.");let n=k(),r=await w(n,"user_retrieve",{}),i=await fe.handler({method:"POST",url:`${n}/x402/upgrade`,body:{userId:r.id,duration:e.duration},params:null,wallet:e.wallet,chain:e.chain});if(i.status>=400){let o=i.data?.error??"Upgrade failed";throw new Error(o)}return i.data});var rp=[et,it,st,j,dt,mt,ft,E,me,St,jt,Ct,$t,Et,he,Ut,fe,Wt,Gt,Ze,Yt,tn,rn,an,cn];export{k as a,je as b,Xr as c,le as d,Ze as e,rp as f};
@@ -1,2 +0,0 @@
1
- process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{a as u,b as f,c as d,f as l}from"./chunk-W7HRRMKL.js";import"./chunk-WLQU5BOQ.js";import{Server as R}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as x}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as v}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as N}from"zod-to-json-schema";var y=new Map(l.map(s=>[s.schema.name,s]));function q(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let p=n.$ref.replace("#/definitions/","");return n.definitions[p]??n}return n}async function C(){let s=new R({name:"moonpay",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),n=l.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:N(e.schema.input)})),p=new Map;for(let e of d){if(y.has(e.name))continue;let t=q(e);p.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(v,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 c=i.schema.input.shape??{};for(let[m,a]of Object.entries(c))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=p.get(t)??{};for(let[c,r]of Object.entries(S))o[c]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(O=>O.type==="null"))&&(o[c]=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[c]=="string"&&(o[c]=Number(o[c]));let b=u(),w=await f(b,t,o);return{content:[{type:"text",text:JSON.stringify(w,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let g=new x;await s.connect(g)}export{C as startMcpServer};