@moonpay/cli 0.6.15 → 0.6.17

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,25 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a as xe,b as Ce,c as $e,d as Ae,e as Re,f as ne,g as d,h,i as Ie,j as I,k as ie,l as re,n as qe,p as g,q as z,r as Ee,s as q}from"./chunk-WLQU5BOQ.js";import*as l from"fs";import*as De from"os";import*as V from"path";var M=V.join(De.homedir(),".config","moonpay"),de=V.join(M,"config.json"),K=V.join(M,"credentials.json"),H=V.join(M,".credentials.lock"),me={baseUrl:"https://agents.moonpay.com"};function he(){l.existsSync(M)||l.mkdirSync(M,{recursive:!0,mode:448})}function Ue(e,t,n){let i=e+`.tmp.${process.pid}`;l.writeFileSync(i,t,{encoding:"utf-8",mode:n}),l.renameSync(i,e)}var Vt=3e4;function Gt(){he();try{let e=l.openSync(H,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(H,"utf-8"));if(Date.now()-t.ts<Vt)return null}catch{}try{l.unlinkSync(H)}catch{}try{let t=l.openSync(H,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(H)}catch{}}}function Oe(){if(!l.existsSync(de))return null;try{let e=JSON.parse(l.readFileSync(de,"utf-8"));return e.baseUrl?e:null}catch{return null}}function oe(){let e=Oe();return e||(Jt(me),me)}function E(){if(!l.existsSync(K))return null;let e=Ae();if(!e)return null;try{let t=JSON.parse(l.readFileSync(K,"utf-8")),n=xe.parse(t),i=$e(n,e),r=JSON.parse(i);return!r.accessToken||!r.baseUrl?null:r}catch{return null}}function fe(e){let t=Re(),n=Ce(JSON.stringify(e),t);he(),Ue(K,JSON.stringify(n,null,2),384)}function Jt(e){he(),Ue(de,JSON.stringify(e,null,2),384)}function Be(){l.existsSync(K)&&l.unlinkSync(K)}function D(){let e=Oe(),t=E();return e?.baseUrl??t?.baseUrl??me.baseUrl}async function ye(e,t,n){let i=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(15e3),headers:{"Content-Type":"application/json"},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 ge(e){if(!e.refreshToken)throw new Error("No refresh token available");let t=Gt();if(!t){await new Promise(i=>setTimeout(i,2e3));let n=E();if(n&&n.expiresAt>Date.now())return n;throw new Error("Token refresh failed (concurrent refresh in progress)")}try{let n=E();if(n&&n.expiresAt>Date.now()+6e4)return n;let i=await ye(e.baseUrl,"refresh",{refreshToken:e.refreshToken}),r={accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:i.expiresAt*1e3,baseUrl:e.baseUrl};return fe(r),r}finally{t()}}var Yt=300*1e3;async function Ne(){let e=E();if(!e)return null;if(Date.now()>=e.expiresAt-Yt){if(e.refreshToken)try{return(await ge(e)).accessToken}catch{return null}return null}return e.accessToken}async function be(e,t,n){let i=await Ne(),r={"Content-Type":"application/json"};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 u=E();if(u?.refreshToken)try{let _=await ge(u);o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:{"Content-Type":"application/json",Authorization:`Bearer ${_.accessToken}`},body:JSON.stringify(n)})}catch{}}if(o.status===429){let u=i?"":" Log in with `mp login` for higher limits.";throw new Error(`Rate limit exceeded. Please wait a moment and try again.${u}`)}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)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 u=p;throw new Error(u?.error??`Tool call failed (${o.status})`)}return p}async function v(e,t,n){return await be(e,t,n)}var di=[{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 of the token to buy, in token units \u2014 not fiat. For example, 1.5 means 1.5 SOL, not $1.50."},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 report, feature request, 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_swap",description:"Swap the specified amount of input token for output token.",inputSchema:{$ref:"#/definitions/token_swap_input",definitions:{token_swap_input:{type:"object",properties:{simulation:{type:"boolean",description:"If true, only simulate the transaction without executing it"},input:{type:"string",description:"The address of the input token to swap"},output:{type:"string",description:"The address of the output token to receive"},amount:{type:"number",description:"The amount of the input token to swap"}},required:["simulation","input","output","amount"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_swap_output",definitions:{token_swap_output:{type:"object",properties:{signature:{type:"string",description:"Transaction signature. Absent if execution failed."},message:{type:"string",description:"Result message or error description"}},required:["message"],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. Filter by wallet address and/or chain.",inputSchema:{$ref:"#/definitions/transaction_list_input",definitions:{transaction_list_input:{type:"object",properties:{wallet:{type:["string","null"],description:"Wallet address to filter transactions"},chain:{anyOf:[{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"]},{type:"null"}],description:"Chain to filter transactions"}},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#"}}];import*as We from"fs";import*as Fe from"os";import*as ze 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 G}from"zod";var Le=a({name:"consent_check",description:"Check whether the MoonPay Terms of Service and Privacy Policy have been accepted. Throws if not accepted.",input:G.object({}),output:G.object({accepted:G.literal(!0),tosVersion:G.string(),acceptedAt:G.string()})});var Zt=ze.join(Fe.homedir(),".config","moonpay","consent.json"),Qt="1.0",He=s(Le,async()=>{let e=null;try{e=JSON.parse(We.readFileSync(Zt,"utf-8"))}catch{}if(!e||e.tosVersion!==Qt)throw new Error("Terms of Service not yet accepted. Run `mp consent accept` first.");return{accepted:!0,tosVersion:e.tosVersion,acceptedAt:e.acceptedAt}});import{generateMnemonic as en}from"@scure/bip39";import{wordlist as tn}from"@scure/bip39/wordlists/english";import{z as U}from"zod";var Me=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:U.object({name:U.string().describe("Wallet name")}),output:U.object({name:U.string(),addresses:U.record(d,U.string())})});var Ke=s(Me,async e=>{let t=en(tn,256),n=ne(t);return z({name:e.name,type:"hd",mnemonic:t,addresses:n,createdAt:new Date().toISOString()}),{name:e.name,addresses:I(n)}});import{createInterface as nn}from"readline";import{validateMnemonic as Ge}from"@scure/bip39";import{wordlist as Je}from"@scure/bip39/wordlists/english";import{Keypair as rn}from"@solana/web3.js";import on from"bs58";import{privateKeyToAccount as an}from"viem/accounts";import{z as $}from"zod";var Ve=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:$.object({name:$.string().describe("Wallet name"),mnemonic:$.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),key:$.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),chain:d.nullable().describe("Chain for single-key import (default solana)")}),output:$.object({name:$.string(),type:$.enum(["hd","imported"]),addresses:Ie})});function sn(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=nn({input:process.stdin,output:process.stderr});process.stderr.write(e),process.stdin.setRawMode(!0);let r="",o=c=>{let p=c.toString();p===`
3
+ `||p==="\r"?(process.stdin.setRawMode(!1),process.stdin.removeListener("data",o),process.stderr.write(`
4
+ `),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 cn(e){let t=e.split(/\s+/);return t.length>=12&&t.length<=24&&Ge(e,Je)?"mnemonic":"key"}var Ye=s(Ve,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 sn("Paste your mnemonic or private key (hidden): ");if(!p)throw new Error("No input provided.");cn(p)==="mnemonic"?t=p:n=p}if(t){let p=t.trim().toLowerCase();if(!Ge(p,Je))throw new Error("Invalid BIP39 mnemonic.");let u=ne(p);return z({name:e.name,type:"hd",mnemonic:p,addresses:u,createdAt:new Date().toISOString()}),{name:e.name,type:"hd",addresses:u}}let i=e.chain?h[e.chain]:"solana",r=n??"",o,c;if(i==="solana")try{let p=on.decode(r);o=rn.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=an(`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 Xe}from"zod";var Ze=a({name:"wallet_list",description:"List all local wallets",input:Xe.object({}),output:Xe.array(ie)});var Qe=s(Ze,async()=>re().map(t=>({name:t.name,type:t.type,addresses:I(t.addresses),createdAt:t.createdAt})));import{z as et}from"zod";var tt=a({name:"wallet_retrieve",description:"Get details of a specific wallet",input:et.object({wallet:et.string().describe("Wallet name or address")}),output:ie});var P=s(tt,async e=>{let t=g(e.wallet);return{name:t.name,type:t.type,addresses:I(t.addresses),createdAt:t.createdAt}});import{z as O}from"zod";var nt=a({name:"wallet_delete",description:"Permanently delete a local wallet. This removes the private key file and cannot be undone.",input:O.object({wallet:O.string().describe("Name or address of the wallet to delete"),confirm:O.boolean().describe("Must be true to confirm deletion")}),output:O.object({name:O.string().describe("Name of the deleted wallet"),deleted:O.literal(!0)})});var it=s(nt,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 Ee(t.name),{name:t.name,deleted:!0}});import{z as B}from"zod";var rt=a({name:"wallet_rename",description:"Rename a local wallet.",input:B.object({wallet:B.string().describe("Current name or address of the wallet"),name:B.string().describe("New name for the wallet")}),output:B.object({oldName:B.string(),newName:B.string()})});var ot=s(rt,async e=>{let n=g(e.wallet).name;if(n===e.name)throw new Error(`Wallet is already named "${e.name}"`);if(re().some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);return qe(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 ae}from"zod";var at=a({name:"wallet_export",description:"Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",input:ae.object({wallet:ae.string().describe("Wallet name")}),output:ae.object({exported:ae.literal(!0)})});var st=s(at,async e=>{if(!process.stdout.isTTY)throw new Error(`Wallet export requires an interactive terminal.
5
+ Run this command directly in your terminal: mp wallet export `+e.wallet);let t=g(e.wallet);return t.type==="hd"?(process.stderr.write(`
6
+ Mnemonic for "${t.name}":
7
+
8
+ `),process.stderr.write(` ${t.mnemonic}
9
+
10
+ `),process.stderr.write(`Write this down and store it securely.
11
+
12
+ `)):(process.stderr.write(`
13
+ Private key for "${t.name}" (${t.chain}):
14
+
15
+ `),process.stderr.write(` ${t.privateKey}
16
+
17
+ `)),{exported:!0}});import{createHash as pn}from"crypto";import{Keypair as ln,VersionedTransaction as un}from"@solana/web3.js";import{privateKeyToAccount as dn}from"viem/accounts";import{parseTransaction as mn}from"viem";import{createPublicClient as hn,http as fn}from"viem";import*as f from"viem/chains";import*as pt from"tiny-secp256k1";import{z as J}from"zod";var ct=a({name:"transaction_sign",description:"Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",input:J.object({wallet:J.string().describe("Wallet name or address"),chain:d.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),transaction:J.string().describe("Base64-encoded unsigned transaction")}),output:J.object({transaction:J.string().describe("Base64-encoded signed transaction")})});var yn={1:f.mainnet,137:f.polygon,42161:f.arbitrum,8453:f.base,10:f.optimism,56:f.bsc,43114:f.avalanche},gn={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"},A=s(ct,async e=>{let t=g(e.wallet),n=e.chain,i=h[n],{privateKey:r}=q(t,n);switch(i){case"solana":return bn(r,e.transaction.trim());case"ethereum":return _n(r,e.transaction.trim());case"tron":return wn(r,e.transaction.trim());case"bitcoin":return kn(r,e.transaction.trim())}});function bn(e,t){let n=Buffer.from(t,"base64"),i=un.deserialize(n),r=ln.fromSecretKey(e);return i.sign([r]),{transaction:Buffer.from(i.serialize()).toString("base64")}}async function _n(e,t){let n=dn(`0x${Buffer.from(e).toString("hex")}`);if(t.startsWith("{")){let{to:c,data:p,value:u,chainId:_}=JSON.parse(t),y=yn[_]??f.mainnet,m=gn[_],j=hn({chain:y,transport:fn(m)}),F=await j.getTransactionCount({address:n.address}),ee=await j.estimateFeesPerGas(),te=await j.estimateGas({account:n.address,to:c,data:p,value:BigInt(u??"0")});return{transaction:await n.signTransaction({to:c,data:p,value:BigInt(u??"0"),chainId:_,nonce:F,gas:te,maxFeePerGas:ee.maxFeePerGas,maxPriorityFeePerGas:ee.maxPriorityFeePerGas,type:"eip1559"})}}let i=t.startsWith("0x")?t:`0x${Buffer.from(t,"base64").toString("hex")}`,r=mn(i);return{transaction:await n.signTransaction(r)}}function wn(e,t){let n=Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"),i=pn("sha256").update(n).digest(),r=pt.sign(i,e);if(!r)throw new Error("Tron transaction signing failed");return{transaction:Buffer.from(r).toString("hex")}}async function kn(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 ut}from"crypto";import{Keypair as vn}from"@solana/web3.js";import Sn from"bs58";import Tn from"tweetnacl";import*as _e from"tiny-secp256k1";import{keccak_256 as Pn}from"@noble/hashes/sha3";import{privateKeyToAccount as jn}from"viem/accounts";import{z as Y}from"zod";var lt=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:Y.object({wallet:Y.string().describe("Wallet address or name to sign with"),chain:d.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),message:Y.string().describe("Message text to sign")}),output:Y.object({signature:Y.string().describe("Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin")})});var se=s(lt,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 xn(r,o);case"ethereum":return Cn(r,e.message);case"tron":return $n(r,e.message);case"bitcoin":return An(r,o)}});function xn(e,t){let n=vn.fromSecretKey(e),i=Tn.sign.detached(t,n.secretKey);return{signature:Sn.encode(i)}}async function Cn(e,t){return{signature:await jn(`0x${Buffer.from(e).toString("hex")}`).signMessage({message:t})}}function $n(e,t){let n=Buffer.from(t,"utf8"),i=Buffer.from(`TRON Signed Message:
18
+ ${n.length}`,"utf8"),r=Pn(Buffer.concat([i,n])),o=_e.sign(r,e);if(!o)throw new Error("Tron message signing failed");return{signature:"0x"+Buffer.from(o).toString("hex")}}function An(e,t){let n=ut("sha256").update(t).digest(),i=ut("sha256").update(n).digest(),r=_e.sign(i,e);if(!r)throw new Error("Bitcoin message signing failed");return{signature:"0x"+Buffer.from(r).toString("hex")}}import Rn from"https";import{z as w}from"zod";var dt=a({name:"bitcoin_balance_retrieve",description:"Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",input:w.object({wallet:w.string().describe("Bitcoin address (bc1...) or wallet name")}),output:w.object({address:w.string().describe("Bitcoin address"),confirmed:w.object({btc:w.string().describe("Confirmed balance in BTC"),sats:w.number().describe("Confirmed balance in satoshis")}),unconfirmed:w.object({btc:w.string().describe("Unconfirmed (pending) balance in BTC"),sats:w.number().describe("Unconfirmed (pending) balance in satoshis")}),total:w.object({btc:w.string().describe("Total balance in BTC"),sats:w.number().describe("Total balance in satoshis")})})});var In=1e8;function we(e){return(e/In).toFixed(8)}function qn(e){return new Promise((t,n)=>{Rn.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 mt=s(dt,async e=>{let t=e.wallet;if(!t.startsWith("bc1")&&!t.startsWith("1")&&!t.startsWith("3")){let{findWalletOrThrow:c}=await import("./store-XV77WYWO.js"),u=c(t).addresses.bitcoin;if(!u)throw new Error(`Wallet "${t}" has no Bitcoin address. It may be an imported single-chain wallet.`);t=u}let n=await qn(`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:we(i),sats:i},unconfirmed:{btc:we(r),sats:r},total:{btc:we(o),sats:o}}});import{readdirSync as En,readFileSync as ht,existsSync as ke,mkdirSync as Dn,cpSync as Un}from"fs";import{join as N,dirname as On}from"path";import{homedir as Bn}from"os";import{fileURLToPath as Nn}from"url";function ve(){let e=Nn(import.meta.url),t=On(e);return N(t,"..","skills")}function Ln(){return N(Bn(),".claude","skills")}function Se(){let e=ve();return ke(e)?En(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&t.name.startsWith("moonpay-")).map(t=>{let i=ht(N(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 ft(e){if(/[/\\]|\.\./.test(e))throw new Error(`Invalid skill name: "${e}"`);let t=N(ve(),e,"SKILL.md");if(!ke(t))throw new Error(`Skill "${e}" not found. Run \`mp skill list\` to see available skills.`);return ht(t,"utf-8")}function yt(e,t){let n=ve(),i=t??Ln(),r=Se();return Dn(i,{recursive:!0}),r.map(o=>{let c=N(i,o.name);return ke(c)&&!e?{name:o.name,installed:!1}:(Un(N(n,o.name),c,{recursive:!0,force:!0}),{name:o.name,installed:!0})})}import{z as X}from"zod";var gt=a({name:"skill_list",description:"List available AI skills for Claude Code and other agents",input:X.object({}),output:X.array(X.object({name:X.string(),description:X.string()}))});var bt=s(gt,async()=>Se());import{z as Z}from"zod";var _t=a({name:"skill_retrieve",description:"Get the full instructions for a specific skill",input:Z.object({name:Z.string().describe("Skill name (e.g. moonpay-swap-tokens)")}),output:Z.object({name:Z.string(),content:Z.string()})});var wt=s(_t,async e=>({name:e.name,content:ft(e.name)}));import{z as R}from"zod";var kt=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:R.object({force:R.boolean().describe("Overwrite existing skills"),dir:R.string().nullable().describe("Target directory to install skills into (default: ~/.claude/skills/)")}),output:R.array(R.object({name:R.string(),installed:R.boolean()}))});var vt=s(kt,async e=>yt(e.force,e.dir??void 0));import{encodeFunctionData as Wn}from"viem";import{z as k}from"zod";var St=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:d.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:d.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 Fn=[{name:"approve",type:"function",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],ce=s(St,async e=>{if(!e.from.amount&&!e.to.amount)throw new Error("Provide either from.amount or to.amount.");let t=D(),n=await P.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 P.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 v(t,"swaps_transaction_build",o),p=c.transaction;if(c.requiresApproval&&"to"in p){let{to:m,chainId:j}=p,F={type:"evm",to:e.from.token,data:Wn({abi:Fn,functionName:"approve",args:[m,BigInt(c.amountIn.raw)]}),value:"0",chainId:j},{transaction:ee}=await A.handler({wallet:n.name,chain:e.from.chain,transaction:JSON.stringify(F)}),te=await v(t,"transaction_send",{transaction:ee,message:`Approve ${c.amountIn.symbol}`,chain:e.from.chain});if(!te.signature)throw new Error(`Approval failed: ${te.message}`);process.stderr.write(`Approval sent. Waiting for confirmation...
19
+ `),await new Promise(je=>setTimeout(je,5e3)),c=await v(t,"swaps_transaction_build",o)}let u="base64"in c.transaction?c.transaction.base64:JSON.stringify(c.transaction),{transaction:_}=await A.handler({wallet:n.name,chain:e.from.chain,transaction:u}),y=await v(t,"transaction_send",{transaction:_,message:c.message,chain:e.from.chain});if(!y.signature)throw new Error(`Transaction send failed: ${y.message}`);try{await v(t,"transaction_register",{transactionId:c.transactionId,transactionHash:y.signature,chain:e.from.chain})}catch{}return{signature:y.signature,message:c.message}});import{z as S}from"zod";var Tt=a({name:"token_swap",description:"Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",input:S.object({wallet:S.string().describe("Local wallet name to sign with"),chain:d.describe("Chain to swap on"),from:S.object({token:S.string().describe("Input token address (selling)"),amount:S.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")}),to:S.object({token:S.string().describe("Output token address (buying)"),amount:S.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:S.object({signature:S.string().describe("Transaction hash/signature"),message:S.string().describe("Human-readable swap description")})});var Pt=s(Tt,async e=>ce.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 x}from"zod";var jt=a({name:"token_transfer",description:"Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",input:x.object({wallet:x.string().describe("Local wallet name to sign with"),chain:d.describe("Chain to transfer on"),token:x.string().describe("Token address to transfer"),amount:x.coerce.number().describe("Amount to transfer"),to:x.string().describe("Recipient wallet name or address")}),output:x.object({signature:x.string().describe("Transaction hash/signature"),message:x.string().describe("Human-readable transfer description")})});var xt=s(jt,async e=>{let t=D(),n=await P.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 P.handler({wallet:e.to})).addresses[h[e.chain]]??e.to}catch{}let o=await v(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 A.handler({wallet:n.name,chain:e.chain,transaction:c}),u=await v(t,"transaction_send",{transaction:p,message:o.message,chain:e.chain});if(!u.signature)throw new Error(`Transaction send failed: ${u.message}`);return{signature:u.signature,message:o.message}});import{Keypair as zn,VersionedTransaction as Hn,VersionedMessage as Mn}from"@solana/web3.js";import $t from"axios";import{wrapAxiosWithPayment as At}from"@x402/axios";import{x402Client as Rt}from"@x402/core/client";import{ExactSvmScheme as Kn}from"@x402/svm";import{registerExactEvmScheme as Vn}from"@x402/evm/exact/client";import{toClientEvmSigner as Gn}from"@x402/evm";import{privateKeyToAccount as Jn}from"viem/accounts";import{createPublicClient as Yn,http as Xn}from"viem";import*as T from"viem/chains";import{z as b}from"zod";var Ct=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/api/x402/tools/market_digest_retrieve')"),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 Zn="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",Qn={ethereum:T.mainnet,base:T.base,polygon:T.polygon,arbitrum:T.arbitrum,optimism:T.optimism};function ei(e,t){let n=zn.fromSecretKey(t),i={address:e,signTransactions:async c=>c.map(p=>{let u=new Uint8Array(p.messageBytes),_=Mn.deserialize(u),y=Object.keys(p.signatures).length,m=new Hn(_,new Array(y).fill(new Uint8Array(64)));m.sign([n]);let j=_.staticAccountKeys.findIndex(F=>F.toBase58()===e);if(j===-1)throw new Error(`Wallet ${e} is not a signer for this transaction`);return{[e]:m.signatures[j]}})},r=new Rt,o=new Kn(i);return r.register(Zn,o),r.registerV1("solana",o),At($t.create(),r)}function ti(e,t){let n=Jn(`0x${Buffer.from(e).toString("hex")}`),i=Qn[t]??T.base,r=Yn({chain:i,transport:Xn()}),o=Gn(n,r),c=new Rt;return Vn(c,{signer:o}),At($t.create(),c)}var It=s(Ct,async({method:e,url:t,body:n,params:i,wallet:r,chain:o})=>{let c=g(r),p=o??"solana",{privateKey:u,address:_}=q(c,p),y=p==="solana"?ei(_,u):ti(u,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 L}from"zod";var qt=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:L.object({wallet:L.string().describe("Local wallet name"),chain:d.describe("Chain to register (solana, ethereum, etc.)")}),output:L.object({success:L.literal(!0),address:L.string().describe("Registered wallet address"),chain:L.string().describe("Chain registered on")})});var Et=s(qt,async e=>{let t=D(),n=e.chain,i=await P.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 be(t,"virtual-account_wallet_registration-message_create",{wallet:o}),{signature:p}=await se.handler({wallet:i.name,chain:n,message:c});return await v(t,"virtual-account_wallet_register",{wallet:o,message:c,signature:p,chain:n}),{success:!0,address:o,chain:n}});import*as C from"fs";import*as Ot from"os";import*as Pe from"path";import{z as pe}from"zod";var Dt=a({name:"consent_accept",description:"Accept the MoonPay Terms of Service and Privacy Policy. Required before using any CLI command.",input:pe.object({}),output:pe.object({tosVersion:pe.string(),acceptedAt:pe.string()})});var Te=Pe.join(Ot.homedir(),".config","moonpay"),Ut=Pe.join(Te,"consent.json"),ni="1.0",Bt=s(Dt,async()=>{C.existsSync(Te)||C.mkdirSync(Te,{recursive:!0,mode:448});let e=new Date().toISOString(),t={tosVersion:ni,acceptedAt:e},n=Ut+`.tmp.${process.pid}`;return C.writeFileSync(n,JSON.stringify(t,null,2),{encoding:"utf-8",mode:384}),C.renameSync(n,Ut),t});import{z as Q}from"zod";var Nt=a({name:"login",description:"Send a login verification code to your email.",input:Q.object({email:Q.string().describe("Email address")}),output:Q.object({email:Q.string(),message:Q.string()})});var Lt=s(Nt,async e=>{let{baseUrl:t}=oe(),n=`${t}/login?email=${encodeURIComponent(e.email)}`;return{email:e.email,message:`Open this link to verify:
20
+
21
+ ${n}
22
+
23
+ Then run: mp verify --email ${e.email} --code <code>`}});import{z as W}from"zod";var Wt=a({name:"verify",description:"Verify login code and store encrypted credentials.",input:W.object({email:W.string().describe("Email address"),code:W.string().describe("Verification code")}),output:W.object({email:W.string(),message:W.string()})});var Ft=s(Wt,async e=>{let{baseUrl:t}=oe(),n=await ye(t,"verify",{email:e.email,code:e.code}),i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:t};return fe(i),{email:e.email,message:"Logged in successfully."}});import{z as le}from"zod";var zt=a({name:"logout",description:"Log out and clear stored credentials.",input:le.object({}),output:le.object({success:le.literal(!0),message:le.string()})});var Ht=s(zt,async()=>(Be(),{success:!0,message:"Logged out."}));import{createRequire as ii}from"module";import{z as ue}from"zod";var Mt=a({name:"qr_generate",description:"Display a QR code in the terminal. Pass any text \u2014 wallet address, URL, token address, etc.",input:ue.object({value:ue.string().describe("Text to encode as a QR code")}),output:ue.object({value:ue.string()})});var ri=ii(import.meta.url),oi=ri("qrcode-terminal"),Kt=s(Mt,async e=>(oi.generate(e.value,{small:!0},t=>{process.stderr.write(`
24
+ ${t}
25
+ `)}),{value:e.value}));var Qs=[Ke,Ye,Qe,P,it,ot,st,A,se,mt,bt,wt,vt,Pt,ce,xt,It,Et,Bt,He,Lt,Ft,Ht,Kt];export{D as a,be as b,di as c,He as d,Qs as e};
@@ -0,0 +1,3 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{existsSync as Ee,readFileSync as ke,writeFileSync as Ae,mkdirSync as Fe,renameSync as We}from"fs";import{join as b}from"path";import{homedir as Be}from"os";import{randomBytes as Ne}from"crypto";import{z as s}from"zod";import{randomBytes as C,scryptSync as F,createCipheriv as L,createDecipheriv as J}from"crypto";import{z as a}from"zod";var E=2**18,k=8,A=1,W=32,B=512*1024*1024,v=a.object({encryption:a.object({cipher:a.literal("aes-256-gcm"),kdf:a.literal("scrypt"),kdfparams:a.object({n:a.number(),r:a.number(),p:a.number()}),salt:a.string(),iv:a.string(),tag:a.string()}),data:a.string()});function N(e,t){let r=C(32),n=F(t,r,W,{N:E,r:k,p:A,maxmem:B}),o=C(12),i=L("aes-256-gcm",n,o),c=Buffer.concat([i.update(e,"utf8"),i.final()]);return{encryption:{cipher:"aes-256-gcm",kdf:"scrypt",kdfparams:{n:E,r:k,p:A},salt:r.toString("base64"),iv:o.toString("base64"),tag:i.getAuthTag().toString("base64")},data:c.toString("base64")}}function P(e,t){let{salt:r,iv:n,tag:o,kdfparams:i}=e.encryption,c=F(t,Buffer.from(r,"base64"),W,{N:i.n,r:i.r,p:i.p,maxmem:B}),p=J("aes-256-gcm",c,Buffer.from(n,"base64"),{authTagLength:16});return p.setAuthTag(Buffer.from(o,"base64")),Buffer.concat([p.update(Buffer.from(e.data,"base64")),p.final()]).toString("utf8")}var je=s.enum(["solana","ethereum","base","arbitrum","polygon","optimism","bnb","avalanche","bitcoin","tron"]),G=s.enum(["solana","ethereum","bitcoin","tron"]),T={solana:"solana",ethereum:"ethereum",base:"ethereum",arbitrum:"ethereum",polygon:"ethereum",optimism:"ethereum",bnb:"ethereum",avalanche:"ethereum",bitcoin:"bitcoin",tron:"tron"},I=s.object({solana:s.string().optional(),ethereum:s.string().optional(),bitcoin:s.string().optional(),tron:s.string().optional()}),V=["base","arbitrum","polygon","optimism","bnb","avalanche"];function De(e){let t={};if(e.solana&&(t.solana=e.solana),e.ethereum){t.ethereum=e.ethereum;for(let r of V)t[r]=e.ethereum}return e.bitcoin&&(t.bitcoin=e.bitcoin),e.tron&&(t.tron=e.tron),t}var X=s.object({name:s.string(),type:s.literal("hd"),mnemonic:s.string(),addresses:I,createdAt:s.string()}),q=s.object({name:s.string(),type:s.literal("imported"),chain:G,privateKey:s.string(),addresses:I,createdAt:s.string()}),_=s.discriminatedUnion("type",[X,q]),ze=s.object({name:s.string(),type:s.enum(["hd","imported"]),addresses:s.record(s.string(),s.string()),createdAt:s.string()});import{execFileSync as m,execSync as Q}from"child_process";import{randomBytes as Z}from"crypto";import{existsSync as ee,mkdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{homedir as oe,platform as O}from"os";import{join as M}from"path";var d="moonpay-cli",l="encryption-key",R=M(oe(),".config","moonpay"),u=M(R,".encryption-key");function ie(e){try{m("security",["delete-generic-password","-s",d,"-a",l],{stdio:"ignore"})}catch{}m("security",["add-generic-password","-s",d,"-a",l,"-w",e],{stdio:"ignore"})}function se(){try{return m("security",["find-generic-password","-s",d,"-a",l,"-w"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function ae(e){Q(`printf '%s' | secret-tool store --label="${d}" service "${d}" account "${l}"`,{input:e,stdio:["pipe","ignore","ignore"]})}function ce(){try{return m("secret-tool",["lookup","service",d,"account",l],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function pe(e){te(R,{recursive:!0,mode:448}),ne(u,e,{encoding:"utf-8",mode:384})}function de(){try{return ee(u)&&re(u,"utf-8").trim()||null}catch{return null}}function fe(e){try{let t=O();return t==="darwin"?(ie(e),!0):t==="linux"?(ae(e),!0):!1}catch{return!1}}function le(){let e=O();return e==="darwin"?se():e==="linux"?ce():null}function S(){let e=process.env.MOONPAY_ENCRYPTION_KEY;return e||(le()??de())}function Y(){let e=S();if(e)return e;let t=Z(32).toString("hex");return fe(t)||(pe(t),process.stderr.write("Note: Keychain unavailable. Encryption key stored in "+u+`
3
+ `)),t}import{createHash as $}from"crypto";import{HDKey as x}from"@scure/bip32";import{mnemonicToSeedSync as y}from"@scure/bip39";import{keccak_256 as U}from"@noble/hashes/sha3";import{derivePath as me}from"ed25519-hd-key";import*as j from"bitcoinjs-lib";import ue from"ecpair";import*as h from"tiny-secp256k1";import{Keypair as ye}from"@solana/web3.js";import he from"bs58";var ge=ue(h);function g(e,t=0){switch(e){case"solana":return`m/44'/501'/${t}'/0'`;case"ethereum":return`m/44'/60'/${t}'/0/0`;case"bitcoin":return`m/84'/0'/${t}'/0/0`;case"tron":return`m/44'/195'/${t}'/0/0`}}function f(e,t,r=0){switch(t){case"solana":return ve(e,r);case"ethereum":return Se(e,r);case"bitcoin":return be(e,r);case"tron":return we(e,r)}}function st(e,t=0){return{solana:f(e,"solana",t).address,ethereum:f(e,"ethereum",t).address,bitcoin:f(e,"bitcoin",t).address,tron:f(e,"tron",t).address}}function ve(e,t){let r=y(e),n=g("solana",t),{key:o}=me(n,Buffer.from(r).toString("hex")),i=ye.fromSeed(Uint8Array.from(o));return{privateKey:i.secretKey,address:i.publicKey.toBase58()}}function Se(e,t){let r=y(e),n=x.fromMasterSeed(r),o=g("ethereum",t),i=n.derive(o);if(!i.privateKey)throw new Error("Failed to derive EVM private key");let c=xe(i.publicKey);return{privateKey:i.privateKey,address:c}}function xe(e){let t=h.pointCompress(e,!1),n=D(t.slice(1)).slice(-20),o="0x"+Buffer.from(n).toString("hex");return Ke(o)}function D(e){return U(e)}function Ke(e){let t=e.toLowerCase().replace("0x",""),r=Buffer.from(U(Buffer.from(t,"utf8"))).toString("hex"),n="0x";for(let o=0;o<t.length;o++)n+=parseInt(r[o],16)>=8?t[o].toUpperCase():t[o];return n}function be(e,t){let r=y(e),n=x.fromMasterSeed(r),o=g("bitcoin",t),i=n.derive(o);if(!i.privateKey)throw new Error("Failed to derive Bitcoin private key");let c=ge.fromPrivateKey(Buffer.from(i.privateKey)),{address:p}=j.payments.p2wpkh({pubkey:Buffer.from(c.publicKey)});if(!p)throw new Error("Failed to derive Bitcoin address");return{privateKey:i.privateKey,address:p}}function we(e,t){let r=y(e),n=x.fromMasterSeed(r),o=g("tron",t),i=n.derive(o);if(!i.privateKey)throw new Error("Failed to derive Tron private key");let c=Ce(i.publicKey);return{privateKey:i.privateKey,address:c}}function Ce(e){let t=h.pointCompress(e,!1),n=D(t.slice(1)).slice(-20),o=Buffer.concat([Buffer.from([65]),Buffer.from(n)]),i=$("sha256").update(o).digest(),c=$("sha256").update(i).digest(),p=Buffer.concat([o,c.slice(0,4)]);return he.encode(p)}import Pe from"bs58";var w=b(Be(),".config","moonpay"),K=b(w,"wallets.json");function Te(){Fe(w,{recursive:!0,mode:448})}function z(){if(!Ee(K))return[];let e=S();if(!e)throw new Error("Encryption key not found. Set MOONPAY_ENCRYPTION_KEY or ensure OS keychain is accessible.");let t=JSON.parse(ke(K,"utf-8")),r=v.parse(t),n=P(r,e);return(JSON.parse(n).wallets??[]).map(i=>_.parse(i))}function Ie(e){let t=Y(),r=JSON.stringify({wallets:e}),n=N(r,t);Te();let o=b(w,`.wallets.${Ne(4).toString("hex")}.tmp`);Ae(o,JSON.stringify(n,null,2),{mode:384}),We(o,K)}function H(e){let t=z();e(t),Ie(t)}function _e(e){let t=z();for(let r of t){if(r.name===e)return r;for(let n of Object.values(r.addresses))if(n===e)return r}return null}function gt(e){let t=_e(e);if(!t)throw new Error(`Wallet "${e}" not found`);return t}function vt(e){H(t=>{if(t.some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);t.push(e)})}function St(e){H(t=>{let r=t.findIndex(n=>n.name===e);if(r===-1)throw new Error(`Wallet "${e}" not found`);t.splice(r,1)})}function xt(e,t){let r=T[t];if(e.type==="imported"){if(e.chain!==r)throw new Error(`Wallet "${e.name}" was imported for ${e.chain}, cannot sign for ${t}.`);return{privateKey:Oe(e.privateKey,r),address:e.addresses[r]}}let n=f(e.mnemonic,r);return{privateKey:n.privateKey,address:n.address}}function Oe(e,t){if(t==="solana")return Pe.decode(e);let r=e.startsWith("0x")?e.slice(2):e;return Uint8Array.from(Buffer.from(r,"hex"))}export{v as a,N as b,P as c,S as d,Y as e,st as f,je as g,T as h,I as i,De as j,ze as k,z as l,Ie as m,H as n,_e as o,gt as p,vt as q,St as r,xt as s};