@moonpay/cli 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{existsSync as qe,readFileSync as Qe,writeFileSync as Ze,renameSync as et}from"fs";import{join as W}from"path";import{homedir as tt}from"os";import{randomBytes as rt}from"crypto";import{z as c}from"zod";import{randomBytes as P,scryptSync as L,createCipheriv as oe,createDecipheriv as ie}from"crypto";import{z as a}from"zod";var B=2**18,D=8,U=1,j=32,$=512*1024*1024,m=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 v(e,t){let r=P(32),n=L(t,r,j,{N:B,r:D,p:U,maxmem:$}),o=P(12),s=oe("aes-256-gcm",n,o),f=Buffer.concat([s.update(e,"utf8"),s.final()]);return{encryption:{cipher:"aes-256-gcm",kdf:"scrypt",kdfparams:{n:B,r:D,p:U},salt:r.toString("base64"),iv:o.toString("base64"),tag:s.getAuthTag().toString("base64")},data:f.toString("base64")}}function E(e,t){let{salt:r,iv:n,tag:o,kdfparams:s}=e.encryption,f=L(t,Buffer.from(r,"base64"),j,{N:s.n,r:s.r,p:s.p,maxmem:$}),p=ie("aes-256-gcm",f,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 ut=c.enum(["solana","ethereum","base","arbitrum","polygon","optimism","bnb","avalanche","bitcoin","tron"]),se=c.enum(["solana","ethereum","bitcoin","tron"]),Y={solana:"solana",ethereum:"ethereum",base:"ethereum",arbitrum:"ethereum",polygon:"ethereum",optimism:"ethereum",bnb:"ethereum",avalanche:"ethereum",bitcoin:"bitcoin",tron:"tron"},H=c.object({solana:c.string().optional(),ethereum:c.string().optional(),bitcoin:c.string().optional(),tron:c.string().optional()}),ce=["base","arbitrum","polygon","optimism","bnb","avalanche"];function dt(e){let t={};if(e.solana&&(t.solana=e.solana),e.ethereum){t.ethereum=e.ethereum;for(let r of ce)t[r]=e.ethereum}return e.bitcoin&&(t.bitcoin=e.bitcoin),e.tron&&(t.tron=e.tron),t}var ae=c.object({name:c.string(),type:c.literal("hd"),mnemonic:c.string(),addresses:H,createdAt:c.string()}),fe=c.object({name:c.string(),type:c.literal("imported"),chain:se,privateKey:c.string(),addresses:H,createdAt:c.string()}),J=c.discriminatedUnion("type",[ae,fe]),mt=c.object({name:c.string(),type:c.enum(["hd","imported"]),addresses:c.record(c.string(),c.string()),createdAt:c.string()});import{execFileSync as k,execSync as we}from"child_process";import{randomBytes as Ke}from"crypto";import{existsSync as ke,readFileSync as _e,writeFileSync as Ae}from"fs";import{homedir as Te,platform as G}from"os";import{join as Oe}from"path";import*as i from"fs";import*as V from"os";import*as C from"path";import{readFileSync as pe}from"fs";import{join as le}from"path";import{homedir as ue}from"os";var de="0.7.0",me="X-CLI-Version",ye="X-Agent-Id",y;function he(){if(y!==void 0)return y;try{y=JSON.parse(pe(le(ue(),".config","moonpay","consent.json"),"utf-8")).agentId??null}catch{y=null}return y??null}function M(){let e={"Content-Type":"application/json",[me]:de},t=he();return t&&(e[ye]=t),e}var g=C.join(V.homedir(),".config","moonpay"),N=C.join(g,"config.json"),S=C.join(g,"credentials.json"),h=C.join(g,".credentials.lock"),I={baseUrl:"https://agents.moonpay.com"};function l(){i.existsSync(g)||i.mkdirSync(g,{recursive:!0,mode:448})}function z(e,t,r){let n=e+`.tmp.${process.pid}`;i.writeFileSync(n,t,{encoding:"utf-8",mode:r}),i.renameSync(n,e)}var ge=3e4;function Se(){l();try{let e=i.openSync(h,i.constants.O_CREAT|i.constants.O_EXCL|i.constants.O_WRONLY,384);i.writeSync(e,JSON.stringify({pid:process.pid,ts:Date.now()})),i.closeSync(e)}catch(e){if(e.code!=="EEXIST")throw e;try{let t=JSON.parse(i.readFileSync(h,"utf-8"));if(Date.now()-t.ts<ge)return null}catch{}try{i.unlinkSync(h)}catch{}try{let t=i.openSync(h,i.constants.O_CREAT|i.constants.O_EXCL|i.constants.O_WRONLY,384);i.writeSync(t,JSON.stringify({pid:process.pid,ts:Date.now()})),i.closeSync(t)}catch{return null}}return()=>{try{i.unlinkSync(h)}catch{}}}function X(){if(!i.existsSync(N))return null;try{let e=JSON.parse(i.readFileSync(N,"utf-8"));return e.baseUrl?e:null}catch{return null}}function Et(){let e=X();return e||(Ce(I),I)}function w(){if(!i.existsSync(S))return null;let e=x();if(!e)return null;try{let t=JSON.parse(i.readFileSync(S,"utf-8")),r=m.parse(t),n=E(r,e),o=JSON.parse(n);return!o.accessToken||!o.baseUrl?null:o}catch{return null}}function xe(e){let t=K(),r=v(JSON.stringify(e),t);l(),z(S,JSON.stringify(r,null,2),384)}function Ce(e){l(),z(N,JSON.stringify(e,null,2),384)}function wt(){i.existsSync(S)&&i.unlinkSync(S)}function Kt(){let e=X(),t=w();return e?.baseUrl??t?.baseUrl??I.baseUrl}async function be(e,t,r){let n=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(15e3),headers:M(),body:JSON.stringify(r)}),o=await n.json();if(!n.ok){let s=o;throw new Error(s?.error??`${t} failed (${n.status})`)}return o}async function ve(e){if(!e.refreshToken)throw new Error("No refresh token available");let t=Se();if(!t){await new Promise(n=>setTimeout(n,2e3));let r=w();if(r&&r.expiresAt>Date.now())return r;throw new Error("Token refresh failed (concurrent refresh in progress)")}try{let r=w();if(r&&r.expiresAt>Date.now()+6e4)return r;let n=await be(e.baseUrl,"refresh",{refreshToken:e.refreshToken}),o={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:e.baseUrl};return xe(o),o}finally{t()}}var Ee=300*1e3;async function kt(){let e=w();if(!e)return null;if(Date.now()>=e.expiresAt-Ee){if(e.refreshToken)try{return(await ve(e)).accessToken}catch{return null}return null}return e.accessToken}var u="moonpay-cli",b="encryption-key",_=Oe(Te(),".config","moonpay",".encryption-key");function Ne(e){try{k("security",["delete-generic-password","-s",u,"-a",b],{stdio:"ignore"})}catch{}k("security",["add-generic-password","-s",u,"-a",b,"-w",e],{stdio:"ignore"})}function Ie(){try{return k("security",["find-generic-password","-s",u,"-a",b,"-w"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function Fe(e){we(`printf '%s' | secret-tool store --label="${u}" service "${u}" account "${b}"`,{input:e,stdio:["pipe","ignore","ignore"]})}function Re(){try{return k("secret-tool",["lookup","service",u,"account",b],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function We(e){l(),Ae(_,e,{encoding:"utf-8",mode:384})}function Pe(){try{return ke(_)&&_e(_,"utf-8").trim()||null}catch{return null}}function Be(e){try{let t=G();return t==="darwin"?(Ne(e),!0):t==="linux"?(Fe(e),!0):!1}catch{return!1}}function De(){let e=G();return e==="darwin"?Ie():e==="linux"?Re():null}function x(){let e=process.env.MOONPAY_ENCRYPTION_KEY;return e||(De()??Pe())}function K(){let e=x();if(e)return e;let t=Ke(32).toString("hex");return Be(t)||(We(t),process.stderr.write("Note: Keychain unavailable. Encryption key stored in "+_+`
2
+ import{existsSync as qe,readFileSync as Qe,writeFileSync as Ze,renameSync as et}from"fs";import{join as W}from"path";import{homedir as tt}from"os";import{randomBytes as rt}from"crypto";import{z as c}from"zod";import{randomBytes as P,scryptSync as L,createCipheriv as oe,createDecipheriv as ie}from"crypto";import{z as a}from"zod";var B=2**18,D=8,U=1,j=32,$=512*1024*1024,m=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 v(e,t){let r=P(32),n=L(t,r,j,{N:B,r:D,p:U,maxmem:$}),o=P(12),s=oe("aes-256-gcm",n,o),f=Buffer.concat([s.update(e,"utf8"),s.final()]);return{encryption:{cipher:"aes-256-gcm",kdf:"scrypt",kdfparams:{n:B,r:D,p:U},salt:r.toString("base64"),iv:o.toString("base64"),tag:s.getAuthTag().toString("base64")},data:f.toString("base64")}}function E(e,t){let{salt:r,iv:n,tag:o,kdfparams:s}=e.encryption,f=L(t,Buffer.from(r,"base64"),j,{N:s.n,r:s.r,p:s.p,maxmem:$}),p=ie("aes-256-gcm",f,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 ut=c.enum(["solana","ethereum","base","arbitrum","polygon","optimism","bnb","avalanche","bitcoin","tron"]),se=c.enum(["solana","ethereum","bitcoin","tron"]),Y={solana:"solana",ethereum:"ethereum",base:"ethereum",arbitrum:"ethereum",polygon:"ethereum",optimism:"ethereum",bnb:"ethereum",avalanche:"ethereum",bitcoin:"bitcoin",tron:"tron"},H=c.object({solana:c.string().optional(),ethereum:c.string().optional(),bitcoin:c.string().optional(),tron:c.string().optional()}),ce=["base","arbitrum","polygon","optimism","bnb","avalanche"];function dt(e){let t={};if(e.solana&&(t.solana=e.solana),e.ethereum){t.ethereum=e.ethereum;for(let r of ce)t[r]=e.ethereum}return e.bitcoin&&(t.bitcoin=e.bitcoin),e.tron&&(t.tron=e.tron),t}var ae=c.object({name:c.string(),type:c.literal("hd"),mnemonic:c.string(),addresses:H,createdAt:c.string()}),fe=c.object({name:c.string(),type:c.literal("imported"),chain:se,privateKey:c.string(),addresses:H,createdAt:c.string()}),J=c.discriminatedUnion("type",[ae,fe]),mt=c.object({name:c.string(),type:c.enum(["hd","imported"]),addresses:c.record(c.string(),c.string()),createdAt:c.string()});import{execFileSync as k,execSync as we}from"child_process";import{randomBytes as Ke}from"crypto";import{existsSync as ke,readFileSync as _e,writeFileSync as Ae}from"fs";import{homedir as Te,platform as G}from"os";import{join as Oe}from"path";import*as i from"fs";import*as V from"os";import*as C from"path";import{readFileSync as pe}from"fs";import{join as le}from"path";import{homedir as ue}from"os";var de="0.8.0",me="X-CLI-Version",ye="X-Agent-Id",y;function he(){if(y!==void 0)return y;try{y=JSON.parse(pe(le(ue(),".config","moonpay","consent.json"),"utf-8")).agentId??null}catch{y=null}return y??null}function M(){let e={"Content-Type":"application/json",[me]:de},t=he();return t&&(e[ye]=t),e}var g=C.join(V.homedir(),".config","moonpay"),N=C.join(g,"config.json"),S=C.join(g,"credentials.json"),h=C.join(g,".credentials.lock"),I={baseUrl:"https://agents.moonpay.com"};function l(){i.existsSync(g)||i.mkdirSync(g,{recursive:!0,mode:448})}function z(e,t,r){let n=e+`.tmp.${process.pid}`;i.writeFileSync(n,t,{encoding:"utf-8",mode:r}),i.renameSync(n,e)}var ge=3e4;function Se(){l();try{let e=i.openSync(h,i.constants.O_CREAT|i.constants.O_EXCL|i.constants.O_WRONLY,384);i.writeSync(e,JSON.stringify({pid:process.pid,ts:Date.now()})),i.closeSync(e)}catch(e){if(e.code!=="EEXIST")throw e;try{let t=JSON.parse(i.readFileSync(h,"utf-8"));if(Date.now()-t.ts<ge)return null}catch{}try{i.unlinkSync(h)}catch{}try{let t=i.openSync(h,i.constants.O_CREAT|i.constants.O_EXCL|i.constants.O_WRONLY,384);i.writeSync(t,JSON.stringify({pid:process.pid,ts:Date.now()})),i.closeSync(t)}catch{return null}}return()=>{try{i.unlinkSync(h)}catch{}}}function X(){if(!i.existsSync(N))return null;try{let e=JSON.parse(i.readFileSync(N,"utf-8"));return e.baseUrl?e:null}catch{return null}}function Et(){let e=X();return e||(Ce(I),I)}function w(){if(!i.existsSync(S))return null;let e=x();if(!e)return null;try{let t=JSON.parse(i.readFileSync(S,"utf-8")),r=m.parse(t),n=E(r,e),o=JSON.parse(n);return!o.accessToken||!o.baseUrl?null:o}catch{return null}}function xe(e){let t=K(),r=v(JSON.stringify(e),t);l(),z(S,JSON.stringify(r,null,2),384)}function Ce(e){l(),z(N,JSON.stringify(e,null,2),384)}function wt(){i.existsSync(S)&&i.unlinkSync(S)}function Kt(){let e=X(),t=w();return e?.baseUrl??t?.baseUrl??I.baseUrl}async function be(e,t,r){let n=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(15e3),headers:M(),body:JSON.stringify(r)}),o=await n.json();if(!n.ok){let s=o;throw new Error(s?.error??`${t} failed (${n.status})`)}return o}async function ve(e){if(!e.refreshToken)throw new Error("No refresh token available");let t=Se();if(!t){await new Promise(n=>setTimeout(n,2e3));let r=w();if(r&&r.expiresAt>Date.now())return r;throw new Error("Token refresh failed (concurrent refresh in progress)")}try{let r=w();if(r&&r.expiresAt>Date.now()+6e4)return r;let n=await be(e.baseUrl,"refresh",{refreshToken:e.refreshToken}),o={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:e.baseUrl};return xe(o),o}finally{t()}}var Ee=300*1e3;async function kt(){let e=w();if(!e)return null;if(Date.now()>=e.expiresAt-Ee){if(e.refreshToken)try{return(await ve(e)).accessToken}catch{return null}return null}return e.accessToken}var u="moonpay-cli",b="encryption-key",_=Oe(Te(),".config","moonpay",".encryption-key");function Ne(e){try{k("security",["delete-generic-password","-s",u,"-a",b],{stdio:"ignore"})}catch{}k("security",["add-generic-password","-s",u,"-a",b,"-w",e],{stdio:"ignore"})}function Ie(){try{return k("security",["find-generic-password","-s",u,"-a",b,"-w"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function Fe(e){we(`printf '%s' | secret-tool store --label="${u}" service "${u}" account "${b}"`,{input:e,stdio:["pipe","ignore","ignore"]})}function Re(){try{return k("secret-tool",["lookup","service",u,"account",b],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}}function We(e){l(),Ae(_,e,{encoding:"utf-8",mode:384})}function Pe(){try{return ke(_)&&_e(_,"utf-8").trim()||null}catch{return null}}function Be(e){try{let t=G();return t==="darwin"?(Ne(e),!0):t==="linux"?(Fe(e),!0):!1}catch{return!1}}function De(){let e=G();return e==="darwin"?Ie():e==="linux"?Re():null}function x(){let e=process.env.MOONPAY_ENCRYPTION_KEY;return e||(De()??Pe())}function K(){let e=x();if(e)return e;let t=Ke(32).toString("hex");return Be(t)||(We(t),process.stderr.write("Note: Keychain unavailable. Encryption key stored in "+_+`
3
3
  `)),t}import{createHash as q}from"crypto";import{HDKey as F}from"@scure/bip32";import{mnemonicToSeedSync as A}from"@scure/bip39";import{keccak_256 as Q}from"@noble/hashes/sha3";import{derivePath as Ue}from"ed25519-hd-key";import*as Z from"bitcoinjs-lib";import Le from"ecpair";import*as T from"tiny-secp256k1";import{Keypair as je}from"@solana/web3.js";import $e from"bs58";var Ye=Le(T);function O(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 d(e,t,r=0){switch(t){case"solana":return He(e,r);case"ethereum":return Je(e,r);case"bitcoin":return ze(e,r);case"tron":return Xe(e,r)}}function Yt(e,t=0){return{solana:d(e,"solana",t).address,ethereum:d(e,"ethereum",t).address,bitcoin:d(e,"bitcoin",t).address,tron:d(e,"tron",t).address}}function He(e,t){let r=A(e),n=O("solana",t),{key:o}=Ue(n,Buffer.from(r).toString("hex")),s=je.fromSeed(Uint8Array.from(o));return{privateKey:s.secretKey,address:s.publicKey.toBase58()}}function Je(e,t){let r=A(e),n=F.fromMasterSeed(r),o=O("ethereum",t),s=n.derive(o);if(!s.privateKey)throw new Error("Failed to derive EVM private key");let f=Me(s.publicKey);return{privateKey:s.privateKey,address:f}}function Me(e){let t=T.pointCompress(e,!1),n=ee(t.slice(1)).slice(-20),o="0x"+Buffer.from(n).toString("hex");return Ve(o)}function ee(e){return Q(e)}function Ve(e){let t=e.toLowerCase().replace("0x",""),r=Buffer.from(Q(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 ze(e,t){let r=A(e),n=F.fromMasterSeed(r),o=O("bitcoin",t),s=n.derive(o);if(!s.privateKey)throw new Error("Failed to derive Bitcoin private key");let f=Ye.fromPrivateKey(Buffer.from(s.privateKey)),{address:p}=Z.payments.p2wpkh({pubkey:Buffer.from(f.publicKey)});if(!p)throw new Error("Failed to derive Bitcoin address");return{privateKey:s.privateKey,address:p}}function Xe(e,t){let r=A(e),n=F.fromMasterSeed(r),o=O("tron",t),s=n.derive(o);if(!s.privateKey)throw new Error("Failed to derive Tron private key");let f=Ge(s.publicKey);return{privateKey:s.privateKey,address:f}}function Ge(e){let t=T.pointCompress(e,!1),n=ee(t.slice(1)).slice(-20),o=Buffer.concat([Buffer.from([65]),Buffer.from(n)]),s=q("sha256").update(o).digest(),f=q("sha256").update(s).digest(),p=Buffer.concat([o,f.slice(0,4)]);return $e.encode(p)}import nt from"bs58";var te=W(tt(),".config","moonpay"),R=W(te,"wallets.json");function re(){if(!qe(R))return[];let e=x();if(!e)throw new Error("Encryption key not found. Set MOONPAY_ENCRYPTION_KEY or ensure OS keychain is accessible.");let t=JSON.parse(Qe(R,"utf-8")),r=m.parse(t),n=E(r,e);return(JSON.parse(n).wallets??[]).map(s=>J.parse(s))}function ot(e){let t=K(),r=JSON.stringify({wallets:e}),n=v(r,t);l();let o=W(te,`.wallets.${rt(4).toString("hex")}.tmp`);Ze(o,JSON.stringify(n,null,2),{mode:384}),et(o,R)}function ne(e){let t=re();e(t),ot(t)}function it(e){let t=re();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 tr(e){let t=it(e);if(!t)throw new Error(`Wallet "${e}" not found`);return t}function rr(e){ne(t=>{if(t.some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);t.push(e)})}function nr(e){ne(t=>{let r=t.findIndex(n=>n.name===e);if(r===-1)throw new Error(`Wallet "${e}" not found`);t.splice(r,1)})}function or(e,t){let r=Y[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:st(e.privateKey,r),address:e.addresses[r]}}let n=d(e.mnemonic,r);return{privateKey:n.privateKey,address:n.address}}function st(e,t){if(t==="solana")return nt.decode(e);let r=e.startsWith("0x")?e.slice(2):e;return Uint8Array.from(Buffer.from(r,"hex"))}export{de as a,M as b,l as c,Et as d,w as e,xe as f,wt as g,Kt as h,be as i,ve as j,kt as k,Yt as l,ut as m,Y as n,H as o,dt as p,mt as q,re as r,ot as s,ne as t,it as u,tr as v,rr as w,nr as x,or as y};
@@ -0,0 +1,29 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a as Se,b as $,c as ve,d as ee,e as we,f as ke,g as Pe,h as S,i as je,j as Te,k as q,l as te,m,n as y,o as Ce,p as I,q as ie,r as ne,t as Ae,v as b,w as M,x as Ue,y as D}from"./chunk-BLK26RGL.js";async function Mt(e,t,i){let n=await q(),r=$();n&&(r.Authorization=`Bearer ${n}`);let o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:r,body:JSON.stringify(i)});if(o.status===401&&n){let d=we();if(d?.refreshToken)try{let f=await Te(d);o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:{...$(),Authorization:`Bearer ${f.accessToken}`},body:JSON.stringify(i)})}catch{}}if(o.status===401)throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");let a=await o.text();if(!a){if(o.status===429){let d=n?" Run `mp upgrade` to increase your rate limit.":" Log in with `mp login` for higher limits.";throw new Error(`Rate limit exceeded.${d}`)}throw new Error(`Empty response from server (${o.status})`)}let s;try{s=JSON.parse(a)}catch{throw new Error(`Unexpected response from server (${o.status})`)}if(o.status<200||o.status>=300){let d=s;throw new Error(d?.error??`Tool call failed (${o.status})`)}return s}async function l(e,t,i){return await Mt(e,t,i)}var pn=[{name:"buy",description:"Buy crypto with fiat via MoonPay. Returns a checkout URL to complete the purchase.",inputSchema:{$ref:"#/definitions/buy_input",definitions:{buy_input:{type:"object",properties:{token:{type:"string",enum:["btc","pol_polygon","sol","trx","usdc","usdc_arbitrum","usdc_base","usdc_optimism","usdc_sol","usdc_polygon","usdt_trx","eth","eth_polygon","eth_optimism","eth_base","eth_arbitrum"],description:"MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), trx (TRX on Tron), usdt_trx (USDT on Tron), etc."},amount:{type:"number",description:"Amount in USD to spend. For example, 50 means $50 worth of the selected token."},wallet:{type:"string",description:"Destination wallet address to receive tokens (must match the chain for the selected token)"},email:{type:["string","null"],description:"Buyer email to pre-fill on the checkout page"}},required:["token","amount","wallet","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/buy_output",definitions:{buy_output:{type:"object",properties:{url:{type:"string",description:"MoonPay checkout URL \u2014 open in browser to complete purchase"}},required:["url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_create",description:"Create a new deposit link that generates multi-chain deposit addresses. Anyone can send crypto to these addresses from Solana, Ethereum, Bitcoin, or Tron \u2014 it automatically converts to the specified stablecoin and settles to the destination wallet and chain.",inputSchema:{$ref:"#/definitions/deposit_create_input",definitions:{deposit_create_input:{type:"object",properties:{name:{type:"string",description:"Human-readable label for this deposit link (e.g. 'Treasury Base USDC')"},wallet:{type:"string",description:"Destination wallet address where USDC will be delivered"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","bnb"],description:"Blockchain of the destination wallet"},token:{type:"string",enum:["USDC","USDC.e","USDT"],description:"Token to receive. USDC.e (bridged USDC) is only available on Polygon."}},required:["name","wallet","chain","token"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_create_output",definitions:{deposit_create_output:{type:"object",properties:{id:{type:"string",description:"Unique deposit ID \u2014 use with deposit_transaction_list to check incoming payments"},destinationWallet:{type:"string",description:"Wallet address that will receive the stablecoin"},destinationChain:{type:"string",description:"Chain where the stablecoin will be delivered"},customerToken:{type:"string",description:"Token to check deposit transactions \u2014 pass to deposit_transaction_list"},depositUrl:{type:"string",description:"Shareable URL \u2014 open in browser or share with senders to deposit funds"},wallets:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address to send funds to"},chain:{type:"string",description:"Chain this address is on (solana, ethereum, bitcoin, tron)"},qrCode:{type:"string",description:"URL to a QR code image for the deposit address"}},required:["address","chain","qrCode"],additionalProperties:!1},description:"Deposit addresses across all supported chains \u2014 send any token to any of these"},instructions:{type:"string",description:"Human-readable instructions explaining how to use the deposit"}},required:["id","destinationWallet","destinationChain","customerToken","depositUrl","wallets","instructions"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_retrieve",description:"Retrieve details of a deposit by ID. Returns the deposit name, status, destination wallet, and deposit addresses.",inputSchema:{$ref:"#/definitions/deposit_retrieve_input",definitions:{deposit_retrieve_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_retrieve_output",definitions:{deposit_retrieve_output:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string"},destinationWallet:{type:["string","null"]},depositUrl:{type:"string"}},required:["id","name","status","destinationWallet","depositUrl"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_transaction_list",description:"List transactions for a deposit. Pass the deposit id from deposit_create to check incoming payment status.",inputSchema:{$ref:"#/definitions/deposit_transaction_list_input",definitions:{deposit_transaction_list_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_transaction_list_output",definitions:{deposit_transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},amount:{type:"number"},token:{type:"string"},from:{type:"string"},status:{type:"string"},settledAmount:{type:["number","null"]},settledCurrency:{type:["string","null"]},timestamp:{type:"string"}},required:["id","amount","token","from","status","settledAmount","settledCurrency","timestamp"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"feedback_create",description:"Submit feedback, a bug report, or a feature request. Requires authentication.",inputSchema:{$ref:"#/definitions/feedback_create_input",definitions:{feedback_create_input:{type:"object",properties:{type:{type:"string",enum:["bug","feature","general"],description:"Type of feedback: bug, feature, or general"},message:{type:"string",minLength:1,maxLength:280,description:"Your feedback message"}},required:["type","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/feedback_create_output",definitions:{feedback_create_output:{type:"object",properties:{id:{type:"string",description:"Feedback ID"},message:{type:"string",description:"Confirmation message"}},required:["id","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"login",description:"Send a verification code to the provided email to sign in or create an account. Requires an hCaptcha token.",inputSchema:{$ref:"#/definitions/login_input",definitions:{login_input:{type:"object",properties:{email:{type:"string",format:"email",description:"The email of the user to login"},captchaToken:{type:"string",description:"hCaptcha response token"}},required:["email","captchaToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/login_output",definitions:{login_output:{type:"object",properties:{email:{type:"string",description:"The email the OTP was sent to"}},required:["email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"refresh",description:"Refresh an expired access token using a refresh token.",inputSchema:{$ref:"#/definitions/refresh_input",definitions:{refresh_input:{type:"object",properties:{refreshToken:{type:"string",description:"The refresh token from a previous login"}},required:["refreshToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/refresh_output",definitions:{refresh_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"swaps_transaction_build",description:"Build a swap or bridge transaction. Returns an unsigned transaction with a human-readable message, amounts, exchange rate, and estimated time. Supports same-chain swaps and cross-chain bridges. Accepts UI amounts (e.g. 0.1 SOL) \u2014 decimal conversion is handled automatically.",inputSchema:{$ref:"#/definitions/swaps_transaction_build_input",definitions:{swaps_transaction_build_input:{type:"object",properties:{from:{type:"object",properties:{wallet:{type:"string",description:"Source wallet address (Solana pubkey or EVM 0x address)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Source blockchain"},token:{type:"string",description:"Source token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},amount:{type:["number","null"],description:"Amount to swap (exact-in). Null for exact-out."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Source: wallet, chain, token, amount"},to:{type:"object",properties:{wallet:{type:"string",description:"Destination wallet address. Same as source wallet for same-chain swaps."},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Destination blockchain"},token:{type:"string",description:"Destination token address (mint on Solana, contract on EVM)"},amount:{type:["number","null"],description:"Amount to receive (exact-out). Null for exact-in."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Destination: wallet, chain, token, amount"}},required:["from","to"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/swaps_transaction_build_output",definitions:{swaps_transaction_build_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID for tracking"},transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Contract address"},data:{type:"string",description:"Calldata"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}],description:"Unsigned transaction"},message:{type:"string",description:"Human-readable description (e.g. Swap 0.1 SOL \u2192 42.5 USDC on Solana)"},amountIn:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},amountOut:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},exchangeRate:{type:"number",description:"Exchange rate (amountOut / amountIn)"},estimatedTime:{type:["number","null"],description:"Estimated completion time in seconds"},requiresApproval:{type:"boolean",description:"Whether an ERC20 approval transaction is needed first"}},required:["transactionId","transaction","message","amountIn","amountOut","exchangeRate","estimatedTime","requiresApproval"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_balance_list",description:"List all token balances held in a wallet, including amount owned, current value in USD, and token details. Shows the complete token portfolio.",inputSchema:{$ref:"#/definitions/token_balance_list_input",definitions:{token_balance_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address to check token balances for"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to check balances on (e.g. 'solana', 'ethereum', 'base')"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_balance_list_output",definitions:{token_balance_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},balance:{type:"object",properties:{amount:{type:"number",description:"Number of tokens owned"},value:{type:"number",description:"Total value of the token in USD"},price:{type:"number",description:"Current price of the token"}},required:["amount","value","price"],additionalProperties:!1}},required:["address","name","symbol","chain","decimals","balance"],additionalProperties:!1},description:"Array of all tokens in the wallet with their balances and current values"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_retrieve",description:"Get detailed token information including market data, price changes, volume, trades, and holder statistics by token address",inputSchema:{$ref:"#/definitions/token_retrieve_input",definitions:{token_retrieve_input:{type:"object",properties:{token:{type:"string",description:"Address of the token to retrieve"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain network where the token exists"}},required:["token","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_retrieve_output",definitions:{token_retrieve_output:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_search",description:"Search for tokens by name, symbol, or address. Returns matching tokens with their market data including price, volume, and liquidity.",inputSchema:{$ref:"#/definitions/token_search_input",definitions:{token_search_input:{type:"object",properties:{query:{type:"string",description:"Search term - can be token name (e.g. 'Bitcoin'), symbol (e.g. 'BTC'), or partial match"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to search on (e.g. 'solana', 'ethereum', 'base')"},limit:{type:["number","null"],description:"Maximum number of results to return (optional, defaults to 5)"}},required:["query","chain","limit"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_search_output",definitions:{token_search_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of tokens matching the search query with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_transfer",description:"Build an unsigned transfer transaction. Returns a transaction ready for signing. Handles both native and token transfers.",inputSchema:{$ref:"#/definitions/token_transfer_input",definitions:{token_transfer_input:{type:"object",properties:{wallet:{type:"string",description:"Sender wallet address (Solana pubkey or EVM 0x address)"},token:{type:"string",description:"Token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},to:{type:"string",description:"Recipient wallet address or name"},amount:{type:"number",description:"Amount to transfer in human-readable units (e.g. 1.5)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to execute the transfer on"}},required:["wallet","token","to","amount","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_transfer_output",definitions:{token_transfer_output:{type:"object",properties:{transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Recipient or contract address"},data:{type:"string",description:"Calldata (0x for native transfers)"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}]},message:{type:"string",description:"Human-readable description of the transfer"}},required:["transaction","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_trending_list",description:"Get currently trending tokens on a blockchain. Perfect for discovering what's hot right now.",inputSchema:{$ref:"#/definitions/token_trending_list_input",definitions:{token_trending_list_input:{type:"object",properties:{chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to get trending tokens from (e.g. 'solana', 'ethereum', 'base')"},limit:{type:"integer",minimum:1,description:"Number of results per page"},page:{type:"integer",minimum:1,description:"Page number (starts at 1)"}},required:["chain","limit","page"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_trending_list_output",definitions:{token_trending_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of trending tokens with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_list",description:"List swap and bridge transaction history for a wallet.",inputSchema:{$ref:"#/definitions/transaction_list_input",definitions:{transaction_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address that signed and sent the transactions"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain the wallet is on"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_list_output",definitions:{transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds"}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1},description:"List of swap/bridge transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_register",description:"Register a broadcast transaction for tracking. Call after transaction_send to enable status tracking via transaction_retrieve.",inputSchema:{$ref:"#/definitions/transaction_register_input",definitions:{transaction_register_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from the swap build step"},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 swap 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_bank-account_delete",description:"Delete a bank account",inputSchema:{$ref:"#/definitions/virtual-account_bank-account_delete_input",definitions:{"virtual-account_bank-account_delete_input":{type:"object",properties:{bankAccountId:{type:"string",format:"uuid",description:"The ID of the bank account to delete"}},required:["bankAccountId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_bank-account_delete_output",definitions:{"virtual-account_bank-account_delete_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_bank-account_list",description:"List registered bank accounts",inputSchema:{$ref:"#/definitions/virtual-account_bank-account_list_input",definitions:{"virtual-account_bank-account_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_bank-account_list_output",definitions:{"virtual-account_bank-account_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},bank_account_identifier:{anyOf:[{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"}},required:["type","iban"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"ACH"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Wire"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1}]},bank_name:{type:"string"},country:{type:"string"},created_at:{type:"string",format:"date-time"},currency:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"},customer_id:{type:"string"},is_third_party:{type:"boolean"},label:{type:["string","null"]},ownership_verified:{type:"boolean"},status:{type:"string",enum:["AuthorizationRequired","AuthorizationFailed","RegistrationPending","RegistrationFailed","Registered"]},updated_at:{type:"string",format:"date-time"}},required:["id","bank_account_identifier","bank_name","country","created_at","currency","customer_id","is_third_party","label","ownership_verified","status","updated_at"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_bank-account_register",description:"Register a bank account for offramp payouts. USD accounts use ACH/Wire with account+routing numbers. EUR accounts use SEPA with IBAN.",inputSchema:{$ref:"#/definitions/virtual-account_bank-account_register_input",definitions:{"virtual-account_bank-account_register_input":{type:"object",properties:{currency:{type:"string",enum:["USD","EUR"],description:"Currency of the bank account (USD or EUR)"},type:{type:"string",enum:["ACH","Wire","SEPA"],description:"Account type: ACH or Wire for USD, SEPA for EUR"},accountNumber:{type:["string","null"],description:"Account number (required for USD ACH/Wire)"},routingNumber:{type:["string","null"],description:"Routing number (required for USD ACH/Wire)"},iban:{type:["string","null"],description:"IBAN (required for EUR SEPA)"},address:{type:"object",properties:{street:{type:"string",description:"Street address"},city:{type:"string",description:"City"},state:{type:"string",description:"State or province"},country:{type:"string",enum:["US","GB","CA","AU","DE","FR","IT","ES","NL","BE","AT","CH","SE","NO","DK","FI","IE","PT","PL","CZ","GR","JP","KR","CN","IN","BR","MX","AR","ZA","NZ","SG","HK","AE"],description:"ISO 3166-1 Alpha-2 country code"},postalCode:{type:"string",description:"Postal or ZIP code"}},required:["street","city","state","country","postalCode"],additionalProperties:!1,description:"Address of the account holder"},email:{type:"string",description:"Email address of the account holder"},phoneNumber:{type:"string",description:"Phone number of the account holder"},providerCountry:{type:"string",enum:["US","GB","CA","AU","DE","FR","IT","ES","NL","BE","AT","CH","SE","NO","DK","FI","IE","PT","PL","CZ","GR","JP","KR","CN","IN","BR","MX","AR","ZA","NZ","SG","HK","AE"],description:"ISO 3166-1 Alpha-2 country code where the bank is located"},providerName:{type:"string",description:"Name of the bank"},givenName:{type:"string",description:"First/given name of the account holder"},familyName:{type:"string",description:"Last/family name of the account holder"}},required:["currency","type","accountNumber","routingNumber","iban","address","email","phoneNumber","providerCountry","providerName","givenName","familyName"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_bank-account_register_output",definitions:{"virtual-account_bank-account_register_output":{type:"object",properties:{id:{type:"string"},bank_account_identifier:{anyOf:[{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"}},required:["type","iban"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"ACH"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Wire"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1}]},bank_name:{type:"string"},country:{type:"string"},created_at:{type:"string",format:"date-time"},currency:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"},customer_id:{type:"string"},is_third_party:{type:"boolean"},label:{type:["string","null"]},ownership_verified:{type:"boolean"},status:{type:"string",enum:["AuthorizationRequired","AuthorizationFailed","RegistrationPending","RegistrationFailed","Registered"]},updated_at:{type:"string",format:"date-time"}},required:["id","bank_account_identifier","bank_name","country","created_at","currency","customer_id","is_third_party","label","ownership_verified","status","updated_at"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_bank-account_retrieve",description:"Get a bank account by currency",inputSchema:{$ref:"#/definitions/virtual-account_bank-account_retrieve_input",definitions:{"virtual-account_bank-account_retrieve_input":{type:"object",properties:{currency:{type:"string",enum:["USD","EUR"],description:"The fiat currency code (USD or EUR)"}},required:["currency"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_bank-account_retrieve_output",definitions:{"virtual-account_bank-account_retrieve_output":{type:"object",properties:{id:{type:"string"},bank_account_identifier:{anyOf:[{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"}},required:["type","iban"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"ACH"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Wire"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","routing_number"],additionalProperties:!1}]},bank_name:{type:"string"},country:{type:"string"},created_at:{type:"string",format:"date-time"},currency:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"},customer_id:{type:"string"},is_third_party:{type:"boolean"},label:{type:["string","null"]},ownership_verified:{type:"boolean"},status:{type:"string",enum:["AuthorizationRequired","AuthorizationFailed","RegistrationPending","RegistrationFailed","Registered"]},updated_at:{type:"string",format:"date-time"}},required:["id","bank_account_identifier","bank_name","country","created_at","currency","customer_id","is_third_party","label","ownership_verified","status","updated_at"],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_offramp_cancel",description:"Cancel an offramp",inputSchema:{$ref:"#/definitions/virtual-account_offramp_cancel_input",definitions:{"virtual-account_offramp_cancel_input":{type:"object",properties:{offrampId:{type:"string",format:"uuid",description:"The ID of the offramp to cancel"}},required:["offrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_cancel_output",definitions:{"virtual-account_offramp_cancel_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_offramp_create",description:"Create an offramp to convert stablecoin to fiat",inputSchema:{$ref:"#/definitions/virtual-account_offramp_create_input",definitions:{"virtual-account_offramp_create_input":{type:"object",properties:{name:{type:"string",description:"The name of the offramp"},fiat:{type:"string",enum:["USD","EUR"],description:"The fiat currency to convert to"},stablecoin:{type:"string",enum:["USDC","USDT","EURC"],description:"The stablecoin token to convert from"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain the stablecoin is on (solana, ethereum, polygon, arbitrum, base)"}},required:["name","fiat","stablecoin","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_create_output",definitions:{"virtual-account_offramp_create_output":{type:"object",properties:{created_at:{type:"string",format:"date-time"},deposit_account:{anyOf:[{anyOf:[{type:"object",properties:{type:{type:"string",const:"ACHWire"},account_number:{type:"string"},bank_address:{type:"string"},bank_name:{type:"string"},recipient_address:{type:"string"},recipient_name:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","bank_address","bank_name","recipient_address","recipient_name","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"AfricanBankTransfer"},account_name:{type:"string"},account_number:{type:"string"},amount:{type:"string"},bank_name:{type:"string"},currency:{type:"string"},financial_institution:{type:"string"}},required:["type","account_name","account_number","amount","bank_name","currency","financial_institution"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Crypto"},address:{type:"string"},chain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]}},required:["type","address","chain"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"MobileMoney"},instruction:{type:"string"},mobile_number:{type:"string"}},required:["type","mobile_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Pix"},instruction:{type:"string"},pix_key:{type:"string"}},required:["type","instruction","pix_key"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"},address:{type:"string"},beneficiary_name:{type:["string","null"]},bic:{type:"string"},name:{type:"string"},phone:{type:"string"}},required:["type","iban","beneficiary_name"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Spei"},clabe:{type:"string"},instruction:{type:"string"}},required:["type","clabe","instruction"],additionalProperties:!1}]},{type:"null"}]},destination_currency:{anyOf:[{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Fiat"},code:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"}},required:["type","code"],additionalProperties:!1}]},id:{type:"string",description:"The ID of the autoramp"},name:{type:"string"},recipient:{type:"object",properties:{type:{type:"string",const:"BankAccount"},provider_name:{type:"string"},provider_country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},is_third_party:{type:"boolean"},account_identifier:{type:"object",properties:{type:{type:"string",enum:["SEPA","ACH","Wire"]},iban:{type:"string"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type"],additionalProperties:!1},address:{type:"object",properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},postal_code:{type:"string"}},required:["street","city","state","country","postal_code"],additionalProperties:!1},recipient:{type:"object",properties:{type:{type:"string",enum:["Individual","Business"]},family_name:{type:"string"},given_name:{type:"string"},name:{type:"string"}},required:["type"],additionalProperties:!1}},required:["type","provider_name","provider_country","is_third_party","account_identifier","address","recipient"],additionalProperties:!1},source:{type:"string",enum:["Standalone","Quote"]},source_currencies:{type:"array",items:{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1}},status:{type:"string",enum:["Created","EditPending","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]}},required:["created_at","deposit_account","destination_currency","id","name","recipient","source","source_currencies","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_offramp_initiate",description:"Build an unsigned transaction to send stablecoin to an offramp deposit address",inputSchema:{$ref:"#/definitions/virtual-account_offramp_initiate_input",definitions:{"virtual-account_offramp_initiate_input":{type:"object",properties:{wallet:{type:"string",description:"The wallet address to send from"},offrampId:{type:"string",description:"The ID of the offramp to initiate"},amount:{type:"number",minimum:0,description:"The amount of stablecoin to send (in human-readable units, e.g., 100.5)"}},required:["wallet","offrampId","amount"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_initiate_output",definitions:{"virtual-account_offramp_initiate_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:"virtual-account_offramp_list",description:"List all offramps",inputSchema:{$ref:"#/definitions/virtual-account_offramp_list_input",definitions:{"virtual-account_offramp_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_list_output",definitions:{"virtual-account_offramp_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{created_at:{type:"string",format:"date-time"},deposit_account:{anyOf:[{anyOf:[{type:"object",properties:{type:{type:"string",const:"ACHWire"},account_number:{type:"string"},bank_address:{type:"string"},bank_name:{type:"string"},recipient_address:{type:"string"},recipient_name:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","bank_address","bank_name","recipient_address","recipient_name","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"AfricanBankTransfer"},account_name:{type:"string"},account_number:{type:"string"},amount:{type:"string"},bank_name:{type:"string"},currency:{type:"string"},financial_institution:{type:"string"}},required:["type","account_name","account_number","amount","bank_name","currency","financial_institution"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Crypto"},address:{type:"string"},chain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]}},required:["type","address","chain"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"MobileMoney"},instruction:{type:"string"},mobile_number:{type:"string"}},required:["type","mobile_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Pix"},instruction:{type:"string"},pix_key:{type:"string"}},required:["type","instruction","pix_key"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"},address:{type:"string"},beneficiary_name:{type:["string","null"]},bic:{type:"string"},name:{type:"string"},phone:{type:"string"}},required:["type","iban","beneficiary_name"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Spei"},clabe:{type:"string"},instruction:{type:"string"}},required:["type","clabe","instruction"],additionalProperties:!1}]},{type:"null"}]},destination_currency:{anyOf:[{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Fiat"},code:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"}},required:["type","code"],additionalProperties:!1}]},id:{type:"string",description:"The ID of the autoramp"},name:{type:"string"},recipient:{type:"object",properties:{type:{type:"string",const:"BankAccount"},provider_name:{type:"string"},provider_country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},is_third_party:{type:"boolean"},account_identifier:{type:"object",properties:{type:{type:"string",enum:["SEPA","ACH","Wire"]},iban:{type:"string"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type"],additionalProperties:!1},address:{type:"object",properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},postal_code:{type:"string"}},required:["street","city","state","country","postal_code"],additionalProperties:!1},recipient:{type:"object",properties:{type:{type:"string",enum:["Individual","Business"]},family_name:{type:"string"},given_name:{type:"string"},name:{type:"string"}},required:["type"],additionalProperties:!1}},required:["type","provider_name","provider_country","is_third_party","account_identifier","address","recipient"],additionalProperties:!1},source:{type:"string",enum:["Standalone","Quote"]},source_currencies:{type:"array",items:{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1}},status:{type:"string",enum:["Created","EditPending","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]}},required:["created_at","deposit_account","destination_currency","id","name","recipient","source","source_currencies","status"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_offramp_retrieve",description:"Get offramp details",inputSchema:{$ref:"#/definitions/virtual-account_offramp_retrieve_input",definitions:{"virtual-account_offramp_retrieve_input":{type:"object",properties:{offrampId:{type:"string",format:"uuid",description:"The ID of the offramp to retrieve"}},required:["offrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_retrieve_output",definitions:{"virtual-account_offramp_retrieve_output":{type:"object",properties:{created_at:{type:"string",format:"date-time"},deposit_account:{anyOf:[{anyOf:[{type:"object",properties:{type:{type:"string",const:"ACHWire"},account_number:{type:"string"},bank_address:{type:"string"},bank_name:{type:"string"},recipient_address:{type:"string"},recipient_name:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","bank_address","bank_name","recipient_address","recipient_name","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"AfricanBankTransfer"},account_name:{type:"string"},account_number:{type:"string"},amount:{type:"string"},bank_name:{type:"string"},currency:{type:"string"},financial_institution:{type:"string"}},required:["type","account_name","account_number","amount","bank_name","currency","financial_institution"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Crypto"},address:{type:"string"},chain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]}},required:["type","address","chain"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"MobileMoney"},instruction:{type:"string"},mobile_number:{type:"string"}},required:["type","mobile_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Pix"},instruction:{type:"string"},pix_key:{type:"string"}},required:["type","instruction","pix_key"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"},address:{type:"string"},beneficiary_name:{type:["string","null"]},bic:{type:"string"},name:{type:"string"},phone:{type:"string"}},required:["type","iban","beneficiary_name"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Spei"},clabe:{type:"string"},instruction:{type:"string"}},required:["type","clabe","instruction"],additionalProperties:!1}]},{type:"null"}]},destination_currency:{anyOf:[{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Fiat"},code:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"}},required:["type","code"],additionalProperties:!1}]},id:{type:"string",description:"The ID of the autoramp"},name:{type:"string"},recipient:{type:"object",properties:{type:{type:"string",const:"BankAccount"},provider_name:{type:"string"},provider_country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},is_third_party:{type:"boolean"},account_identifier:{type:"object",properties:{type:{type:"string",enum:["SEPA","ACH","Wire"]},iban:{type:"string"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type"],additionalProperties:!1},address:{type:"object",properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},postal_code:{type:"string"}},required:["street","city","state","country","postal_code"],additionalProperties:!1},recipient:{type:"object",properties:{type:{type:"string",enum:["Individual","Business"]},family_name:{type:"string"},given_name:{type:"string"},name:{type:"string"}},required:["type"],additionalProperties:!1}},required:["type","provider_name","provider_country","is_third_party","account_identifier","address","recipient"],additionalProperties:!1},source:{type:"string",enum:["Standalone","Quote"]},source_currencies:{type:"array",items:{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1}},status:{type:"string",enum:["Created","EditPending","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]}},required:["created_at","deposit_account","destination_currency","id","name","recipient","source","source_currencies","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_offramp_update",description:"Update an existing offramp's destination bank account or fiat currency.",inputSchema:{$ref:"#/definitions/virtual-account_offramp_update_input",definitions:{"virtual-account_offramp_update_input":{type:"object",properties:{offrampId:{type:"string",description:"The ID of the offramp to update"},fiat:{anyOf:[{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"},{type:"null"}],description:"New destination fiat currency (USD or EUR)"}},required:["offrampId","fiat"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_offramp_update_output",definitions:{"virtual-account_offramp_update_output":{type:"object",properties:{created_at:{type:"string",format:"date-time"},deposit_account:{anyOf:[{anyOf:[{type:"object",properties:{type:{type:"string",const:"ACHWire"},account_number:{type:"string"},bank_address:{type:"string"},bank_name:{type:"string"},recipient_address:{type:"string"},recipient_name:{type:"string"},routing_number:{type:"string"}},required:["type","account_number","bank_address","bank_name","recipient_address","recipient_name","routing_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"AfricanBankTransfer"},account_name:{type:"string"},account_number:{type:"string"},amount:{type:"string"},bank_name:{type:"string"},currency:{type:"string"},financial_institution:{type:"string"}},required:["type","account_name","account_number","amount","bank_name","currency","financial_institution"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Crypto"},address:{type:"string"},chain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]}},required:["type","address","chain"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"MobileMoney"},instruction:{type:"string"},mobile_number:{type:"string"}},required:["type","mobile_number"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Pix"},instruction:{type:"string"},pix_key:{type:"string"}},required:["type","instruction","pix_key"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"SEPA"},iban:{type:"string"},address:{type:"string"},beneficiary_name:{type:["string","null"]},bic:{type:"string"},name:{type:"string"},phone:{type:"string"}},required:["type","iban","beneficiary_name"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Spei"},clabe:{type:"string"},instruction:{type:"string"}},required:["type","clabe","instruction"],additionalProperties:!1}]},{type:"null"}]},destination_currency:{anyOf:[{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"Fiat"},code:{type:"string",enum:["USD","EUR"],description:"Fiat currency code. USD: US Dollar, EUR: Euro"}},required:["type","code"],additionalProperties:!1}]},id:{type:"string",description:"The ID of the autoramp"},name:{type:"string"},recipient:{type:"object",properties:{type:{type:"string",const:"BankAccount"},provider_name:{type:"string"},provider_country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},is_third_party:{type:"boolean"},account_identifier:{type:"object",properties:{type:{type:"string",enum:["SEPA","ACH","Wire"]},iban:{type:"string"},account_number:{type:"string"},routing_number:{type:"string"}},required:["type"],additionalProperties:!1},address:{type:"object",properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"object",properties:{code:{type:"string",minLength:2,maxLength:2}},required:["code"],additionalProperties:!1},postal_code:{type:"string"}},required:["street","city","state","country","postal_code"],additionalProperties:!1},recipient:{type:"object",properties:{type:{type:"string",enum:["Individual","Business"]},family_name:{type:"string"},given_name:{type:"string"},name:{type:"string"}},required:["type"],additionalProperties:!1}},required:["type","provider_name","provider_country","is_third_party","account_identifier","address","recipient"],additionalProperties:!1},source:{type:"string",enum:["Standalone","Quote"]},source_currencies:{type:"array",items:{type:"object",properties:{type:{type:"string",const:"Crypto"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"]},token:{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"}},required:["type","blockchain","token"],additionalProperties:!1}},status:{type:"string",enum:["Created","EditPending","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]}},required:["created_at","deposit_account","destination_currency","id","name","recipient","source","source_currencies","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_cancel",description:"Cancel an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_cancel_input",definitions:{"virtual-account_onramp_cancel_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_cancel_output",definitions:{"virtual-account_onramp_cancel_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_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)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to receive stablecoin on (solana, ethereum, polygon, arbitrum, base)"}},required:["name","fiat","stablecoin","wallet","chain"],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","EditPending","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_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","EditPending","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","EditPending","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_update",description:"Update an existing onramp's destination wallet, chain, or stablecoin.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_update_input",definitions:{"virtual-account_onramp_update_input":{type:"object",properties:{onrampId:{type:"string",description:"The ID of the onramp to update"},wallet:{type:["string","null"],description:"New destination wallet address (must be registered)"},chain:{anyOf:[{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"]},{type:"null"}],description:"New destination chain (solana, ethereum, polygon, arbitrum, base)"},stablecoin:{anyOf:[{type:"string",enum:["USDC","USDT","EURC"],description:"Stablecoin token code. USDC: USD Coin, USDT: Tether, EURC: Euro Coin"},{type:"null"}],description:"New destination stablecoin (USDC, USDT, EURC)"}},required:["onrampId","wallet","chain","stablecoin"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_update_output",definitions:{"virtual-account_onramp_update_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","EditPending","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:"Proof-of-ownership verification message"},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#"}}];var Kt="https://www.moonpay.com/legal/terms_of_use_europe_hypermint",Gt="https://www.moonpay.com/legal/privacy_policy",Yt="https://swaps.xyz/terms",xe=` Terms of Use: ${Kt}
3
+ Privacy Policy: ${Gt}
4
+ Swaps by: ${Yt}`;import*as Oe from"fs";import*as Le from"os";import*as We from"path";var p=e=>e,c=(e,t)=>({schema:e,handler:async i=>{let n=e.input.parse(i),r=await t(n);return e.output.parse(r)}});import{z as V}from"zod";var Re=p({name:"consent_check",description:"Check whether the MoonPay Terms of Use have been accepted. Throws if not accepted.",input:V.object({}),output:V.object({accepted:V.literal(!0),tosVersion:V.string(),acceptedAt:V.string()})});import*as B from"fs";import*as De from"os";import*as Be from"path";import*as Ne from"crypto";import{z as re}from"zod";var Ee=p({name:"consent_accept",description:"Accept the MoonPay Terms of Use. Required before using any CLI command.",input:re.object({}),output:re.object({tosVersion:re.string(),acceptedAt:re.string()})});import*as oe from"os";var $e=3e3;function qe(e){let t=S(),i=JSON.stringify({agentId:e.agentId,tosVersion:e.tosVersion,cliVersion:e.cliVersion,nodeVersion:process.version,os:oe.platform(),arch:oe.arch()});fetch(`${t}/api/tools/cli_activation_create`,{method:"POST",headers:$(),body:i,signal:AbortSignal.timeout($e)}).catch(()=>{})}async function Ie(e){let t=S(),i=await q();i&&fetch(`${t}/api/tools/cli_activation_update`,{method:"POST",headers:{...$(),Authorization:`Bearer ${i}`},body:JSON.stringify({agentId:e}),signal:AbortSignal.timeout($e)}).catch(()=>{})}var me=Be.join(De.homedir(),".config","moonpay","consent.json");function Jt(){try{return JSON.parse(B.readFileSync(me,"utf-8"))}catch{return null}}var se=c(Ee,async()=>{ve();let t=Jt()?.agentId??Ne.randomUUID(),i=new Date().toISOString(),n={tosVersion:"1.2",acceptedAt:i,agentId:t},r=me+`.tmp.${process.pid}`;return B.writeFileSync(r,JSON.stringify(n,null,2),{encoding:"utf-8",mode:384}),B.renameSync(r,me),process.stderr.write(`
5
+ By using this CLI, you agree to:
6
+ ${xe}
7
+
8
+ `),qe({agentId:t,tosVersion:"1.2",cliVersion:Se}),{tosVersion:n.tosVersion,acceptedAt:n.acceptedAt}});var Zt=We.join(Le.homedir(),".config","moonpay","consent.json"),He=c(Re,async()=>{let e=null;try{e=JSON.parse(Oe.readFileSync(Zt,"utf-8"))}catch{}if(!e||e.tosVersion!=="1.2"){let t=await se.handler({});return{accepted:!0,tosVersion:t.tosVersion,acceptedAt:t.acceptedAt}}return{accepted:!0,tosVersion:e.tosVersion,acceptedAt:e.acceptedAt}});import{generateMnemonic as Xt}from"@scure/bip39";import{wordlist as Qt}from"@scure/bip39/wordlists/english";import{z as N}from"zod";var Fe=p({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:N.object({name:N.string().describe("Wallet name")}),output:N.object({name:N.string(),addresses:N.record(m,N.string())})});var ze=c(Fe,async e=>{let t=Xt(Qt,256),i=te(t);return M({name:e.name,type:"hd",mnemonic:t,addresses:i,createdAt:new Date().toISOString()}),{name:e.name,addresses:I(i)}});import{createInterface as ei}from"readline";import{validateMnemonic as Ve}from"@scure/bip39";import{wordlist as Ke}from"@scure/bip39/wordlists/english";import{Keypair as ti}from"@solana/web3.js";import ii from"bs58";import{privateKeyToAccount as ni}from"viem/accounts";import{z as x}from"zod";var Me=p({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:x.object({name:x.string().describe("Wallet name"),mnemonic:x.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),key:x.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),chain:m.nullable().describe("Chain for single-key import (default solana)")}),output:x.object({name:x.string(),type:x.enum(["hd","imported"]),addresses:Ce})});function ri(e){return new Promise((t,i)=>{if(!process.stdin.isTTY){i(new Error("Interactive import requires a terminal. Pass --mnemonic or --key instead."));return}let n=ei({input:process.stdin,output:process.stderr});process.stderr.write(e),process.stdin.setRawMode(!0);let r="",o=a=>{let s=a.toString();s===`
9
+ `||s==="\r"?(process.stdin.setRawMode(!1),process.stdin.removeListener("data",o),process.stderr.write(`
10
+ `),n.close(),t(r.trim())):s===""?(process.stdin.setRawMode(!1),n.close(),process.exit(0)):s==="\x7F"||s==="\b"?r=r.slice(0,-1):r+=s};process.stdin.on("data",o)})}function oi(e){let t=e.split(/\s+/);return t.length>=12&&t.length<=24&&Ve(e,Ke)?"mnemonic":"key"}var Ge=c(Me,async e=>{if(e.mnemonic&&e.key)throw new Error("Provide either --mnemonic or --key, not both.");let t=e.mnemonic,i=e.key;if(!t&&!i){let s=await ri("Paste your mnemonic or private key (hidden): ");if(!s)throw new Error("No input provided.");oi(s)==="mnemonic"?t=s:i=s}if(t){let s=t.trim().toLowerCase();if(!Ve(s,Ke))throw new Error("Invalid BIP39 mnemonic.");let d=te(s);return M({name:e.name,type:"hd",mnemonic:s,addresses:d,createdAt:new Date().toISOString()}),{name:e.name,type:"hd",addresses:d}}let n=e.chain?y[e.chain]:"solana",r=i??"",o,a;if(n==="solana")try{let s=ii.decode(r);o=ti.fromSecretKey(s).publicKey.toBase58(),a=r}catch{throw new Error("Invalid Solana private key. Expected base58-encoded secret key.")}else if(n==="ethereum"){if(a=r.startsWith("0x")?r.slice(2):r,!/^[0-9a-fA-F]{64}$/.test(a))throw new Error("Invalid EVM private key. Expected 64-character hex string.");o=ni(`0x${a}`).address}else throw new Error(`Single-key import for ${n} is not yet supported. Use a mnemonic instead.`);return M({name:e.name,type:"imported",chain:n,privateKey:a,addresses:{[n]:o},createdAt:new Date().toISOString()}),{name:e.name,type:"imported",addresses:{[n]:o}}});import{z as Ye}from"zod";var Je=p({name:"wallet_list",description:"List all local wallets",input:Ye.object({}),output:Ye.array(ie)});var Ze=c(Je,async()=>ne().map(t=>({name:t.name,type:t.type,addresses:I(t.addresses),createdAt:t.createdAt})));import{z as Xe}from"zod";var Qe=p({name:"wallet_retrieve",description:"Get details of a specific wallet",input:Xe.object({wallet:Xe.string().describe("Wallet name or address")}),output:ie});var w=c(Qe,async e=>{let t=b(e.wallet);return{name:t.name,type:t.type,addresses:I(t.addresses),createdAt:t.createdAt}});import{z as O}from"zod";var et=p({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 tt=c(et,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=b(e.wallet);return Ue(t.name),{name:t.name,deleted:!0}});import{z as L}from"zod";var it=p({name:"wallet_rename",description:"Rename a local wallet.",input:L.object({wallet:L.string().describe("Current name or address of the wallet"),name:L.string().describe("New name for the wallet")}),output:L.object({oldName:L.string(),newName:L.string()})});var nt=c(it,async e=>{let i=b(e.wallet).name;if(i===e.name)return{oldName:i,newName:e.name};if(ne().some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);return Ae(r=>{let o=r.find(a=>a.name===i);if(!o)throw new Error(`Wallet "${i}" not found`);o.name=e.name}),{oldName:i,newName:e.name}});import{z as pe}from"zod";var rt=p({name:"wallet_export",description:"Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",input:pe.object({wallet:pe.string().describe("Wallet name")}),output:pe.object({exported:pe.literal(!0)})});var ot=c(rt,async e=>{if(!process.stdout.isTTY)throw new Error(`Wallet export requires an interactive terminal.
11
+ Run this command directly in your terminal: mp wallet export `+e.wallet);let t=b(e.wallet);return t.type==="hd"?(process.stderr.write(`
12
+ Mnemonic for "${t.name}":
13
+
14
+ `),process.stderr.write(` ${t.mnemonic}
15
+
16
+ `),process.stderr.write(`Write this down and store it securely.
17
+
18
+ `)):(process.stderr.write(`
19
+ Private key for "${t.name}" (${t.chain}):
20
+
21
+ `),process.stderr.write(` ${t.privateKey}
22
+
23
+ `)),{exported:!0}});import{createHash as ai}from"crypto";import{Keypair as si,VersionedTransaction as pi}from"@solana/web3.js";import{privateKeyToAccount as ci}from"viem/accounts";import{parseTransaction as di}from"viem";import{createPublicClient as ui,http as li}from"viem";import*as g from"viem/chains";import*as st from"tiny-secp256k1";import{z as K}from"zod";var at=p({name:"transaction_sign",description:"Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",input:K.object({wallet:K.string().describe("Wallet name or address"),chain:m.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),transaction:K.string().describe("Base64-encoded unsigned transaction")}),output:K.object({transaction:K.string().describe("Base64-encoded signed transaction")})});var mi={1:g.mainnet,137:g.polygon,42161:g.arbitrum,8453:g.base,10:g.optimism,56:g.bsc,43114:g.avalanche},yi={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"},T=c(at,async e=>{let t=b(e.wallet),i=e.chain,n=y[i],{privateKey:r}=D(t,i);switch(n){case"solana":return hi(r,e.transaction.trim());case"ethereum":return fi(r,e.transaction.trim());case"tron":return gi(r,e.transaction.trim());case"bitcoin":return bi(r,e.transaction.trim())}});function hi(e,t){let i=Buffer.from(t,"base64"),n=pi.deserialize(i),r=si.fromSecretKey(e);return n.sign([r]),{transaction:Buffer.from(n.serialize()).toString("base64")}}async function fi(e,t){let i=ci(`0x${Buffer.from(e).toString("hex")}`);if(t.startsWith("{")){let{to:a,data:s,value:d,chainId:f}=JSON.parse(t),u=mi[f]??g.mainnet,h=yi[f],C=ui({chain:u,transport:li(h)}),z=await C.getTransactionCount({address:i.address}),X=await C.estimateFeesPerGas(),Q=await C.estimateGas({account:i.address,to:a,data:s,value:BigInt(d??"0")});return{transaction:await i.signTransaction({to:a,data:s,value:BigInt(d??"0"),chainId:f,nonce:z,gas:Q,maxFeePerGas:X.maxFeePerGas,maxPriorityFeePerGas:X.maxPriorityFeePerGas,type:"eip1559"})}}let n=t.startsWith("0x")?t:`0x${Buffer.from(t,"base64").toString("hex")}`,r=di(n);return{transaction:await i.signTransaction(r)}}function gi(e,t){let i=Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"),n=ai("sha256").update(i).digest(),r=st.sign(n,e);if(!r)throw new Error("Tron transaction signing failed");return{transaction:Buffer.from(r).toString("hex")}}async function bi(e,t){let i=await import("bitcoinjs-lib"),n=(await import("ecpair")).default,r=await import("tiny-secp256k1"),a=n(r).fromPrivateKey(Buffer.from(e)),s=i.Psbt.fromBase64(t);return s.signAllInputs(a),s.finalizeAllInputs(),{transaction:s.toBase64()}}import{createHash as ct}from"crypto";import{Keypair as _i}from"@solana/web3.js";import Si from"bs58";import vi from"tweetnacl";import*as ye from"tiny-secp256k1";import{keccak_256 as wi}from"@noble/hashes/sha3";import{privateKeyToAccount as ki}from"viem/accounts";import{z as G}from"zod";var pt=p({name:"message_sign",description:"Sign a message with a local wallet. Supports Solana (ed25519), EVM (EIP-191 personal sign), and Bitcoin (secp256k1 ECDSA).",input:G.object({wallet:G.string().describe("Wallet address or name to sign with"),chain:m.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),message:G.string().describe("Message text to sign")}),output:G.object({signature:G.string().describe("Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin")})});var ce=c(pt,async e=>{let t=b(e.wallet),i=e.chain,n=y[i],{privateKey:r}=D(t,i),o=Buffer.from(e.message,"utf8");switch(n){case"solana":return Pi(r,o);case"ethereum":return ji(r,e.message);case"tron":return Ti(r,e.message);case"bitcoin":return Ci(r,o)}});function Pi(e,t){let i=_i.fromSecretKey(e),n=vi.sign.detached(t,i.secretKey);return{signature:Si.encode(n)}}async function ji(e,t){return{signature:await ki(`0x${Buffer.from(e).toString("hex")}`).signMessage({message:t})}}function Ti(e,t){let i=Buffer.from(t,"utf8"),n=Buffer.from(`TRON Signed Message:
24
+ ${i.length}`,"utf8"),r=wi(Buffer.concat([n,i])),o=ye.sign(r,e);if(!o)throw new Error("Tron message signing failed");return{signature:"0x"+Buffer.from(o).toString("hex")}}function Ci(e,t){let i=ct("sha256").update(t).digest(),n=ct("sha256").update(i).digest(),r=ye.sign(n,e);if(!r)throw new Error("Bitcoin message signing failed");return{signature:"0x"+Buffer.from(r).toString("hex")}}import Ai from"https";import{z as v}from"zod";var dt=p({name:"bitcoin_balance_retrieve",description:"Get the BTC balance of a Bitcoin address. Returns confirmed and unconfirmed balances in BTC and satoshis.",input:v.object({wallet:v.string().describe("Bitcoin address (bc1...) or wallet name")}),output:v.object({address:v.string().describe("Bitcoin address"),confirmed:v.object({btc:v.string().describe("Confirmed balance in BTC"),sats:v.number().describe("Confirmed balance in satoshis")}),unconfirmed:v.object({btc:v.string().describe("Unconfirmed (pending) balance in BTC"),sats:v.number().describe("Unconfirmed (pending) balance in satoshis")}),total:v.object({btc:v.string().describe("Total balance in BTC"),sats:v.number().describe("Total balance in satoshis")})})});var Ui=1e8;function he(e){return(e/Ui).toFixed(8)}function xi(e){return new Promise((t,i)=>{Ai.get(e,{headers:{"User-Agent":"moonpay-cli"}},n=>{if(n.statusCode!==200){i(new Error(`HTTP ${n.statusCode} from ${e}`)),n.resume();return}let r="";n.on("data",o=>r+=o),n.on("end",()=>{try{t(JSON.parse(r))}catch{i(new Error("Invalid JSON response"))}})}).on("error",i)})}var ut=c(dt,async e=>{let t=e.wallet;if(!t.startsWith("bc1")&&!t.startsWith("1")&&!t.startsWith("3")){let{findWalletOrThrow:a}=await import("./store-4MOR35O4.js"),d=a(t).addresses.bitcoin;if(!d)throw new Error(`Wallet "${t}" has no Bitcoin address. It may be an imported single-chain wallet.`);t=d}let i=await xi(`https://mempool.space/api/address/${encodeURIComponent(t)}`),n=i.chain_stats.funded_txo_sum-i.chain_stats.spent_txo_sum,r=i.mempool_stats.funded_txo_sum-i.mempool_stats.spent_txo_sum,o=n+r;return{address:t,confirmed:{btc:he(n),sats:n},unconfirmed:{btc:he(r),sats:r},total:{btc:he(o),sats:o}}});import{readdirSync as Ri,readFileSync as lt,existsSync as fe,mkdirSync as Ei,cpSync as $i}from"fs";import{join as W,dirname as qi}from"path";import{homedir as Ii}from"os";import{fileURLToPath as Di}from"url";function ge(){let e=Di(import.meta.url),t=qi(e);return W(t,"..","skills")}function Bi(){return W(Ii(),".claude","skills")}function be(){let e=ge();return fe(e)?Ri(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&t.name.startsWith("moonpay-")).map(t=>{let n=lt(W(e,t.name,"SKILL.md"),"utf-8").match(/^description:\s*(.+)$/m);return{name:t.name,description:n?.[1]?.replace(/^["']|["']$/g,"")??""}}).sort((t,i)=>t.name.localeCompare(i.name)):[]}function mt(e){if(/[/\\]|\.\./.test(e))throw new Error(`Invalid skill name: "${e}"`);let t=W(ge(),e,"SKILL.md");if(!fe(t))throw new Error(`Skill "${e}" not found. Run \`mp skill list\` to see available skills.`);return lt(t,"utf-8")}function yt(e,t){let i=ge(),n=t??Bi(),r=be();return Ei(n,{recursive:!0}),r.map(o=>{let a=W(n,o.name);return fe(a)&&!e?{name:o.name,installed:!1}:($i(W(i,o.name),a,{recursive:!0,force:!0}),{name:o.name,installed:!0})})}import{z as Y}from"zod";var ht=p({name:"skill_list",description:"List available AI skills for Claude Code and other agents",input:Y.object({}),output:Y.array(Y.object({name:Y.string(),description:Y.string()}))});var ft=c(ht,async()=>be());import{z as J}from"zod";var gt=p({name:"skill_retrieve",description:"Get the full instructions for a specific skill",input:J.object({name:J.string().describe("Skill name (e.g. moonpay-swap-tokens)")}),output:J.object({name:J.string(),content:J.string()})});var bt=c(gt,async e=>({name:e.name,content:mt(e.name)}));import{z as R}from"zod";var _t=p({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 St=c(_t,async e=>yt(e.force,e.dir??void 0));import{encodeFunctionData as Ni}from"viem";import{z as k}from"zod";var vt=p({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:m.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:m.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 Oi=[{name:"approve",type:"function",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],de=c(vt,async e=>{if(!e.from.amount&&!e.to.amount)throw new Error("Provide either from.amount or to.amount.");let t=S(),i=await w.handler({wallet:e.from.wallet}),n=i.addresses[y[e.from.chain]];if(!n)throw new Error(`Wallet "${i.name}" has no address on ${e.from.chain}.`);let r=n;if(e.to.wallet)try{r=(await w.handler({wallet:e.to.wallet})).addresses[y[e.to.chain]]??e.to.wallet}catch{r=e.to.wallet}else e.from.chain!==e.to.chain&&(r=i.addresses[y[e.to.chain]]??n);let o={from:{wallet:n,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}},a=await l(t,"swaps_transaction_build",o),s=a.transaction;if(a.requiresApproval&&"to"in s){let{to:h,chainId:C}=s,z={type:"evm",to:e.from.token,data:Ni({abi:Oi,functionName:"approve",args:[h,BigInt(a.amountIn.raw)]}),value:"0",chainId:C},{transaction:X}=await T.handler({wallet:i.name,chain:e.from.chain,transaction:JSON.stringify(z)}),Q=await l(t,"transaction_send",{transaction:X,message:`Approve ${a.amountIn.symbol}`,chain:e.from.chain});if(!Q.signature)throw new Error(`Approval failed: ${Q.message}`);process.stderr.write(`Approval sent. Waiting for confirmation...
25
+ `),await new Promise(_e=>setTimeout(_e,5e3)),a=await l(t,"swaps_transaction_build",o)}let d="base64"in a.transaction?a.transaction.base64:JSON.stringify(a.transaction),{transaction:f}=await T.handler({wallet:i.name,chain:e.from.chain,transaction:d}),u=await l(t,"transaction_send",{transaction:f,message:a.message,chain:e.from.chain});if(!u.signature)throw new Error(`Transaction send failed: ${u.message}`);try{await l(t,"transaction_register",{transactionId:a.transactionId,transactionHash:u.signature,chain:e.from.chain})}catch{}return{signature:u.signature,message:a.message}});import{z as P}from"zod";var wt=p({name:"token_swap",description:"Swap tokens on the same chain. Builds, signs locally, broadcasts, and registers.",input:P.object({wallet:P.string().describe("Local wallet name to sign with"),chain:m.describe("Chain to swap on"),from:P.object({token:P.string().describe("Input token address (selling)"),amount:P.coerce.number().nullable().describe("Amount to sell (exact-in). Null for exact-out.")}),to:P.object({token:P.string().describe("Output token address (buying)"),amount:P.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:P.object({signature:P.string().describe("Transaction hash/signature"),message:P.string().describe("Human-readable swap description")})});var kt=c(wt,async e=>de.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 A}from"zod";var Pt=p({name:"token_transfer",description:"Transfer tokens to another wallet on the same chain. Builds, signs locally, and broadcasts.",input:A.object({wallet:A.string().describe("Local wallet name to sign with"),chain:m.describe("Chain to transfer on"),token:A.string().describe("Token address to transfer"),amount:A.coerce.number().describe("Amount to transfer"),to:A.string().describe("Recipient wallet name or address")}),output:A.object({signature:A.string().describe("Transaction hash/signature"),message:A.string().describe("Human-readable transfer description")})});var jt=c(Pt,async e=>{let t=S(),i=await w.handler({wallet:e.wallet}),n=i.addresses[y[e.chain]];if(!n)throw new Error(`Wallet "${i.name}" has no address on ${e.chain}.`);let r=e.to;try{r=(await w.handler({wallet:e.to})).addresses[y[e.chain]]??e.to}catch{}let o=await l(t,"token_transfer",{wallet:n,token:e.token,to:r,amount:e.amount,chain:e.chain}),a="base64"in o.transaction?o.transaction.base64:JSON.stringify(o.transaction),{transaction:s}=await T.handler({wallet:i.name,chain:e.chain,transaction:a}),d=await l(t,"transaction_send",{transaction:s,message:o.message,chain:e.chain});if(!d.signature)throw new Error(`Transaction send failed: ${d.message}`);return{signature:d.signature,message:o.message}});import{Keypair as Li,VersionedTransaction as Wi,VersionedMessage as Hi}from"@solana/web3.js";import Ct from"axios";import{wrapAxiosWithPayment as At}from"@x402/axios";import{x402Client as Ut}from"@x402/core/client";import{ExactSvmScheme as Fi}from"@x402/svm";import{registerExactEvmScheme as zi}from"@x402/evm/exact/client";import{toClientEvmSigner as Mi}from"@x402/evm";import{privateKeyToAccount as Vi}from"viem/accounts";import{createPublicClient as Ki,http as Gi}from"viem";import*as j from"viem/chains";import{z as _}from"zod";var Tt=p({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:_.object({method:_.enum(["GET","POST","PUT","PATCH","DELETE"]).describe("HTTP method"),url:_.string().url().refine(e=>e.startsWith("https://"),{message:"URL must use HTTPS"}).refine(e=>{try{return!new URL(e).hostname.match(/^(localhost|127\.|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|\[::1\])/)}catch{return!1}},{message:"URL must not target private/internal addresses"}).describe("Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/x402/upgrade')"),body:_.record(_.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),params:_.record(_.any()).nullable().describe("Query parameters"),wallet:_.string().describe("Wallet name or address to pay with"),chain:_.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:_.object({status:_.number().describe("HTTP status code"),data:_.any().describe("Response data"),headers:_.record(_.any()).describe("Response headers")})});var Yi="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",Ji={ethereum:j.mainnet,base:j.base,polygon:j.polygon,arbitrum:j.arbitrum,optimism:j.optimism};function Zi(e,t){let i=Li.fromSecretKey(t),n={address:e,signTransactions:async a=>a.map(s=>{let d=new Uint8Array(s.messageBytes),f=Hi.deserialize(d),u=Object.keys(s.signatures).length,h=new Wi(f,new Array(u).fill(new Uint8Array(64)));h.sign([i]);let C=f.staticAccountKeys.findIndex(z=>z.toBase58()===e);if(C===-1)throw new Error(`Wallet ${e} is not a signer for this transaction`);return{[e]:h.signatures[C]}})},r=new Ut,o=new Fi(n);return r.register(Yi,o),r.registerV1("solana",o),At(Ct.create(),r)}function Xi(e,t){let i=Vi(`0x${Buffer.from(e).toString("hex")}`),n=Ji[t]??j.base,r=Ki({chain:n,transport:Gi()}),o=Mi(i,r),a=new Ut;return zi(a,{signer:o}),At(Ct.create(),a)}var ue=c(Tt,async({method:e,url:t,body:i,params:n,wallet:r,chain:o})=>{let a=b(r),s=o??"solana",{privateKey:d,address:f}=D(a,s),u=s==="solana"?Zi(f,d):Xi(d,s),h;switch(e){case"GET":h=await u.get(t,{params:n});break;case"POST":h=await u.post(t,i||{},{params:n});break;case"PUT":h=await u.put(t,i||{},{params:n});break;case"PATCH":h=await u.patch(t,i||{},{params:n});break;case"DELETE":h=await u.delete(t,{params:n});break;default:throw new Error(`Unsupported HTTP method: ${e}`)}return{status:h.status,data:h.data,headers:h.headers}});import{z as H}from"zod";var xt=p({name:"virtual-account_wallet_register",description:"Register a local wallet with your virtual account. Creates the verification message, signs it locally, and registers in one step.",input:H.object({wallet:H.string().describe("Local wallet name"),chain:m.describe("Chain to register (solana, ethereum, etc.)")}),output:H.object({success:H.literal(!0),address:H.string().describe("Registered wallet address"),chain:H.string().describe("Chain registered on")})});function Qi(e,t){let i=new Date,n=`${String(i.getUTCDate()).padStart(2,"0")}/${String(i.getUTCMonth()+1).padStart(2,"0")}/${i.getUTCFullYear()}`;return`I am verifying ownership of the wallet address ${e} as customer ${t}. This message was signed on ${n} to confirm my control over this wallet.`}var Rt=c(xt,async e=>{let t=S(),i=e.chain,[n,r]=await Promise.all([w.handler({wallet:e.wallet}),l(t,"virtual-account_retrieve",{})]),o=y[i],a=n.addresses[o];if(!a)throw new Error(`Wallet "${n.name}" has no ${o} address.`);let s=Qi(a,r.id),{signature:d}=await ce.handler({wallet:n.name,chain:i,message:s});return await l(t,"virtual-account_wallet_register",{wallet:a,message:s,signature:d,chain:i}),{success:!0,address:a,chain:i}});import{z as E}from"zod";var Et=p({name:"virtual-account_offramp_initiate",description:"Send stablecoin to an approved offramp. Builds the transfer, signs locally, and broadcasts.",input:E.object({wallet:E.string().describe("Local wallet name to sign with"),offrampId:E.string().describe("The ID of the approved offramp"),amount:E.coerce.number().describe("Amount of stablecoin to send")}),output:E.object({signature:E.string().describe("Transaction hash/signature"),message:E.string().describe("Human-readable transfer description")})});var en={Solana:"solana",Ethereum:"ethereum",Polygon:"polygon",Base:"base",Arbitrum:"arbitrum"},$t=c(Et,async e=>{let t=S(),i=await w.handler({wallet:e.wallet}),r=(await l(t,"virtual-account_offramp_retrieve",{offrampId:e.offrampId})).source_currencies[0];if(!r||r.type!=="Crypto")throw new Error("Offramp does not have a valid crypto source currency.");let o=en[r.blockchain];if(!o)throw new Error(`Unsupported blockchain "${r.blockchain}".`);let a=i.addresses[y[o]];if(!a)throw new Error(`Wallet "${i.name}" has no address on ${o}.`);let s=await l(t,"virtual-account_offramp_initiate",{wallet:a,offrampId:e.offrampId,amount:e.amount}),d="base64"in s.transaction?s.transaction.base64:JSON.stringify(s.transaction),{transaction:f}=await T.handler({wallet:i.name,chain:o,transaction:d}),u=await l(t,"transaction_send",{transaction:f,message:s.message,chain:o});if(!u.signature)throw new Error(`Transaction send failed: ${u.message}`);return{signature:u.signature,message:s.message}});import{z as Z}from"zod";var qt=p({name:"login",description:"Generate a sign-in link. Open it in a browser to get a verification code, then use `mp verify` to complete login.",input:Z.object({email:Z.string().describe("Email address")}),output:Z.object({email:Z.string(),message:Z.string()})});var It=c(qt,async e=>{let{baseUrl:t}=ee(),i=`${t}/login?email=${encodeURIComponent(e.email)}`;return{email:e.email,message:`Open this link to verify:
26
+
27
+ ${i}
28
+
29
+ Then run: mp verify --email ${e.email} --code <code>`}});import*as Bt from"fs";import*as Nt from"os";import*as Ot from"path";import{z as F}from"zod";var Dt=p({name:"verify",description:"Verify login code and store encrypted credentials.",input:F.object({email:F.string().describe("Email address"),code:F.string().describe("Verification code")}),output:F.object({email:F.string(),message:F.string()})});var tn=Ot.join(Nt.homedir(),".config","moonpay","consent.json");function nn(){try{return JSON.parse(Bt.readFileSync(tn,"utf-8")).agentId??null}catch{return null}}var Lt=c(Dt,async e=>{let{baseUrl:t}=ee(),i=await je(t,"verify",{email:e.email,code:e.code}),n={accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:i.expiresAt*1e3,baseUrl:t};ke(n);let r=nn();return r&&Ie(r).catch(()=>{}),{email:e.email,message:"Logged in successfully."}});import{z as le}from"zod";var Wt=p({name:"logout",description:"Log out and clear stored credentials.",input:le.object({}),output:le.object({success:le.literal(!0),message:le.string()})});var Ht=c(Wt,async()=>(Pe(),{success:!0,message:"Logged out."}));import{z as U}from"zod";var Ft=p({name:"upgrade",description:"Purchase a rate limit upgrade via x402. Increases your API rate limit. Requires login and a funded wallet.",input:U.object({duration:U.enum(["day","month"]).describe("Upgrade duration: day ($1 USDC, 24h) or month ($20 USDC, 30 days)"),wallet:U.string().describe("Wallet name or address to pay with"),chain:U.enum(["solana","base"]).describe("Chain to pay from. x402 payments accepted on Solana and Base.")}),output:U.object({duration:U.string(),expiresAt:U.string().describe("When the upgrade expires"),message:U.string()})});var zt=c(Ft,async e=>{if(!await q())throw new Error("Login required to upgrade. Run `mp login` first.");let i=S(),n=await l(i,"user_retrieve",{}),r=await ue.handler({method:"POST",url:`${i}/x402/upgrade`,body:{userId:n.id,duration:e.duration},params:null,wallet:e.wallet,chain:e.chain});if(r.status>=400){let o=r.data?.error??"Upgrade failed";throw new Error(o)}return r.data});var Sp=[ze,Ge,Ze,w,tt,nt,ot,T,ce,ut,ft,bt,St,kt,de,jt,ue,Rt,$t,se,He,It,Lt,Ht,zt];export{Mt as a,pn as b,xe as c,He as d,Sp as e};
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
3
- import{a as R,b as _,c as T,d as j,e as k}from"./chunk-E46PBBMC.js";import{a as S,h as A,n as J,u as v}from"./chunk-3D35PTKH.js";import{Command as ne}from"commander";var Y=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function $(e){return t=>Y?`${e}${t}\x1B[0m`:t}var p={bold:$("\x1B[1m"),dim:$("\x1B[2m"),green:$("\x1B[32m"),yellow:$("\x1B[33m"),cyan:$("\x1B[36m"),red:$("\x1B[31m")};function N(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function w(e){return e==null?"-":String(e)}function C(e,t=0){let n=" ".repeat(t);return N(e)?`${n}${w(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(N)?e.map(r=>`${n}- ${w(r)}`).join(`
3
+ import{a as R,b as S,c as T,d as j,e as k}from"./chunk-SGJ5VT64.js";import{a as _,h as A,n as v,u as J}from"./chunk-BLK26RGL.js";import{Command as ne}from"commander";var Y=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function $(e){return t=>Y?`${e}${t}\x1B[0m`:t}var p={bold:$("\x1B[1m"),dim:$("\x1B[2m"),green:$("\x1B[32m"),yellow:$("\x1B[33m"),cyan:$("\x1B[36m"),red:$("\x1B[31m")};function N(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function w(e){return e==null?"-":String(e)}function C(e,t=0){let n=" ".repeat(t);return N(e)?`${n}${w(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(N)?e.map(r=>`${n}- ${w(r)}`).join(`
4
4
  `):e.map(r=>{if(typeof r!="object"||r===null)return`${n}- ${w(r)}`;let o=Object.entries(r),a=[],[c,f]=o[0];N(f)?a.push(`${n}- ${p.bold(c)}: ${w(f)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(C(f,t+2)));for(let[m,y]of o.slice(1))N(y)?a.push(`${n} ${p.bold(m)}: ${w(y)}`):(a.push(`${n} ${p.bold(m)}:`),a.push(C(y,t+2)));return a.join(`
5
5
  `)}).join(`
6
6
 
7
7
  `):typeof e=="object"&&e!==null?Object.entries(e).map(([o,a])=>N(a)?`${n}${p.bold(o)}: ${w(a)}`:`${n}${p.bold(o)}:
8
8
  ${C(a,t+1)}`).join(`
9
9
  `):""}function H(e){if(typeof e!="object"||e===null)return e;let t=e;return"data"in t?t.data:"items"in t&&Array.isArray(t.items)&&Object.keys(t).filter(r=>r!=="items").length===0?t.items:e}function F(e,t){return t==="json"?JSON.stringify(e,null,2):C(H(e))}import{readFileSync as z,writeFileSync as W,mkdirSync as B}from"fs";import{join as E}from"path";import{homedir as G}from"os";var x=E(G(),".config","moonpay"),I=E(x,"update-check.json"),V=1440*60*1e3,Q=3e3;function X(){try{let e=z(I,"utf-8");return JSON.parse(e)}catch{return null}}function ee(e){try{B(x,{recursive:!0}),W(I,JSON.stringify(e))}catch{}}function K(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<3;o++){if((n[o]??0)>(r[o]??0))return!0;if((n[o]??0)<(r[o]??0))return!1}return!1}function P(e,t){return["",p.yellow(`Update available: ${e} \u2192 ${t}`),p.dim("Run `npm i -g @moonpay/cli` to update."),""].join(`
10
- `)}function L(e){let t=null,n=X();if(n&&Date.now()-n.checkedAt<V)return K(n.latest,e)&&(t=P(e,n.latest)),()=>t;let r=new AbortController,o=setTimeout(()=>r.abort(),Q);return fetch("https://registry.npmjs.org/@moonpay%2fcli/latest",{signal:r.signal}).then(a=>a.json()).then(a=>{let c=a.version;c&&(ee({latest:c,checkedAt:Date.now()}),K(c,e)&&(t=P(e,c)))}).catch(()=>{}).finally(()=>clearTimeout(o)),()=>t}var te=L(S),h=new ne;h.name("moonpay").description(`MoonPay CLI \u2014 the crypto onramp for AI agents
10
+ `)}function L(e){let t=null,n=X();if(n&&Date.now()-n.checkedAt<V)return K(n.latest,e)&&(t=P(e,n.latest)),()=>t;let r=new AbortController,o=setTimeout(()=>r.abort(),Q);return fetch("https://registry.npmjs.org/@moonpay%2fcli/latest",{signal:r.signal}).then(a=>a.json()).then(a=>{let c=a.version;c&&(ee({latest:c,checkedAt:Date.now()}),K(c,e)&&(t=P(e,c)))}).catch(()=>{}).finally(()=>clearTimeout(o)),()=>t}var te=L(_),h=new ne;h.name("moonpay").description(`MoonPay CLI \u2014 the crypto onramp for AI agents
11
11
 
12
12
  Your agents need money. MoonPay gives them wallets, funds, and tools
13
13
  to buy, swap, bridge, and transact \u2014 all from the command line.
14
14
 
15
15
  Run \`mp skill install\` to install AI skills for Claude Code.
16
16
 
17
- `+T).version(S).option("--json","Output as JSON instead of YAML");function re(){return h.opts().json?"json":"yaml"}function D(e){console.log(F(e,re()))}function U(){let e=te();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-APIF4XDI.js");await e()});function M(e,t){let n=e;for(let r of t){let o=n.commands.find(a=>a.name()===r);o||(o=n.command(r)),n=o}return n}function Z(e,t=""){let n=[];for(let[r,o]of Object.entries(e)){let a=t?`${t}-${r}`:r,c=o;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let f=c;f._def.typeName==="ZodNullable"&&(f=f._def.innerType),f._def.typeName==="ZodObject"&&f.shape?n.push(...Z(f.shape,a)):n.push({flatKey:a,field:o,path:a.split("-")})}return n}function oe(e,t){let n={};for(let{flatKey:r,path:o}of t){let a=r.replace(/-([a-z])/g,(f,m)=>m.toUpperCase()),c=a in e?e[a]:e[r];if(o.length===1)n[o[0]]=c;else{let f=n;for(let m=0;m<o.length-1;m++)(!f[o[m]]||typeof f[o[m]]!="object")&&(f[o[m]]={}),f=f[o[m]];f[o[o.length-1]]=c}}return n}function se(e,t){for(let n of t){let r=n.schema.name.split("_"),o=r.pop(),c=M(e,r).command(o).description(n.schema.description),f=n.schema.input.shape??{},m=Z(f),y=[],b=[],O=[];for(let{flatKey:u,field:i}of m){let s=i.description??u,l=i;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let g=l._def.typeName,d=l;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(u),d._def.typeName==="ZodRecord"&&O.push(u),g==="ZodBoolean"?c.option(`--${u}`,s,!1):g==="ZodNullable"?(c.option(`--${u} <${u}>`,s),y.push(u)):c.requiredOption(`--${u} <${u}>`,s)}c.action(async u=>{n.schema.name.startsWith("consent_")||await j.handler({});for(let s of y){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]===void 0&&(u[l]=null)}for(let s of b){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]!=null&&typeof u[l]=="string"&&(u[l]=Number(u[l]))}for(let s of O){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof u[l]=="string")try{u[l]=JSON.parse(u[l])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}}let i=oe(u,m);try{let s=await n.handler(i);D(s)}catch(s){console.error(s.message),process.exit(1)}})}}function ie(e){if(e.$ref&&e.definitions){let t=e.$ref.replace("#/definitions/","");return e.definitions[t]}return e}function ae(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(t=>t.type==="null"):!1}function ce(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(t=>t.type==="object"):e.type==="object"}function le(e){return Array.isArray(e.type)?e.type.some(t=>t==="number"||t==="integer"):e.anyOf?e.anyOf.some(t=>t.type==="number"||t.type==="integer"):e.type==="number"||e.type==="integer"}function fe(e){let t=e.wallet,n=e.chain;if(typeof t!="string"||typeof n!="string")return;let r=v(t);if(!r)return;let o=J[n];if(!o)return;let a=r.addresses[o];a&&(e.wallet=a)}var q=new Set(["swaps_transaction_build","token_transfer","transaction_register"]);function ue(e,t){for(let n of t){if(q.has(n.name))continue;let r=n.name.split("_"),o=r.pop(),a=M(e,r);if(a.commands.find(i=>i.name()===o))continue;let c=a.command(o).description(n.description),f=ie(n.inputSchema),m=f.properties??{},y=new Set(f.required??[]),b=[],O=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=ae(s),d=ce(s);le(s)&&O.push(i),d?(u.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${l} (as JSON)`):(c.option(`--${i} <json>`,`${l} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,l),b.push(i)):c.requiredOption(`--${i} <${i}>`,l)}c.action(async i=>{await j.handler({});for(let s of b)i[s]===void 0&&(i[s]=null);for(let s of O)i[s]!=null&&typeof i[s]=="string"&&(i[s]=Number(i[s]));for(let s of u)if(typeof i[s]=="string")try{i[s]=JSON.parse(i[s])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}try{fe(i);let s=A(),l=await R(s,n.name,i);D(l),U()}catch(s){console.error(s.message),process.exit(1)}})}}se(h,k);ue(h,_);h.command("tools").description("List available tools").action(()=>{let e=[...k.map(n=>({name:n.schema.name,description:n.schema.description})),..._.filter(n=>!k.some(r=>r.schema.name===n.name)&&!q.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,r)=>n.name.localeCompare(r.name)),t=[];for(let n of e){let r=n.name.replace(/_/g," ");t.push(` ${p.green(r.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
17
+ `+T).version(_).option("--json","Output as JSON instead of YAML");function re(){return h.opts().json?"json":"yaml"}function D(e){console.log(F(e,re()))}function U(){let e=te();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-PTJ57OZ3.js");await e()});function M(e,t){let n=e;for(let r of t){let o=n.commands.find(a=>a.name()===r);o||(o=n.command(r)),n=o}return n}function Z(e,t=""){let n=[];for(let[r,o]of Object.entries(e)){let a=t?`${t}-${r}`:r,c=o;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let f=c;f._def.typeName==="ZodNullable"&&(f=f._def.innerType),f._def.typeName==="ZodObject"&&f.shape?n.push(...Z(f.shape,a)):n.push({flatKey:a,field:o,path:a.split("-")})}return n}function oe(e,t){let n={};for(let{flatKey:r,path:o}of t){let a=r.replace(/-([a-z])/g,(f,m)=>m.toUpperCase()),c=a in e?e[a]:e[r];if(o.length===1)n[o[0]]=c;else{let f=n;for(let m=0;m<o.length-1;m++)(!f[o[m]]||typeof f[o[m]]!="object")&&(f[o[m]]={}),f=f[o[m]];f[o[o.length-1]]=c}}return n}function se(e,t){for(let n of t){let r=n.schema.name.split("_"),o=r.pop(),c=M(e,r).command(o).description(n.schema.description),f=n.schema.input.shape??{},m=Z(f),y=[],b=[],O=[];for(let{flatKey:u,field:i}of m){let s=i.description??u,l=i;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let g=l._def.typeName,d=l;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(u),d._def.typeName==="ZodRecord"&&O.push(u),g==="ZodBoolean"?c.option(`--${u}`,s,!1):g==="ZodNullable"?(c.option(`--${u} <${u}>`,s),y.push(u)):c.requiredOption(`--${u} <${u}>`,s)}c.action(async u=>{n.schema.name.startsWith("consent_")||await j.handler({});for(let s of y){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]===void 0&&(u[l]=null)}for(let s of b){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]!=null&&typeof u[l]=="string"&&(u[l]=Number(u[l]))}for(let s of O){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof u[l]=="string")try{u[l]=JSON.parse(u[l])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}}let i=oe(u,m);try{let s=await n.handler(i);D(s)}catch(s){console.error(s.message),process.exit(1)}})}}function ie(e){if(e.$ref&&e.definitions){let t=e.$ref.replace("#/definitions/","");return e.definitions[t]}return e}function ae(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(t=>t.type==="null"):!1}function ce(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(t=>t.type==="object"):e.type==="object"}function le(e){return Array.isArray(e.type)?e.type.some(t=>t==="number"||t==="integer"):e.anyOf?e.anyOf.some(t=>t.type==="number"||t.type==="integer"):e.type==="number"||e.type==="integer"}function fe(e){let t=e.wallet,n=e.chain;if(typeof t!="string"||typeof n!="string")return;let r=J(t);if(!r)return;let o=v[n];if(!o)return;let a=r.addresses[o];a&&(e.wallet=a)}var q=new Set(["swaps_transaction_build","token_transfer","transaction_register","virtual-account_offramp_initiate"]);function ue(e,t){for(let n of t){if(q.has(n.name))continue;let r=n.name.split("_"),o=r.pop(),a=M(e,r);if(a.commands.find(i=>i.name()===o))continue;let c=a.command(o).description(n.description),f=ie(n.inputSchema),m=f.properties??{},y=new Set(f.required??[]),b=[],O=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=ae(s),d=ce(s);le(s)&&O.push(i),d?(u.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${l} (as JSON)`):(c.option(`--${i} <json>`,`${l} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,l),b.push(i)):c.requiredOption(`--${i} <${i}>`,l)}c.action(async i=>{await j.handler({});for(let s of b)i[s]===void 0&&(i[s]=null);for(let s of O)i[s]!=null&&typeof i[s]=="string"&&(i[s]=Number(i[s]));for(let s of u)if(typeof i[s]=="string")try{i[s]=JSON.parse(i[s])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}try{fe(i);let s=A(),l=await R(s,n.name,i);D(l),U()}catch(s){console.error(s.message),process.exit(1)}})}}se(h,k);ue(h,S);h.command("tools").description("List available tools").action(()=>{let e=[...k.map(n=>({name:n.schema.name,description:n.schema.description})),...S.filter(n=>!k.some(r=>r.schema.name===n.name)&&!q.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,r)=>n.name.localeCompare(r.name)),t=[];for(let n of e){let r=n.name.replace(/_/g," ");t.push(` ${p.green(r.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
18
18
  `)),U()});h.parse();
@@ -1,2 +1,2 @@
1
1
  process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{a as d,b as y,e as l}from"./chunk-E46PBBMC.js";import{a as u,h as f}from"./chunk-3D35PTKH.js";import{Server as x}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as N}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as v}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as q}from"zod-to-json-schema";var h=new Map(l.map(s=>[s.schema.name,s]));function A(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let c=n.$ref.replace("#/definitions/","");return n.definitions[c]??n}return n}async function J(){let s=new x({name:"moonpay",version:u},{capabilities:{tools:{listChanged:!0}}}),n=l.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:q(e.schema.input)})),c=new Map;for(let e of y){if(h.has(e.name))continue;let t=A(e);c.set(e.name,t.properties??{}),n.push({name:e.name,description:e.description,inputSchema:{type:"object",properties:t.properties??{},...t.required?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}})}let g=new Map(n.map(e=>[e.name,e]));s.setRequestHandler(v,async()=>({tools:n.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))})),s.setRequestHandler(T,async e=>{let{name:t,arguments:o={}}=e.params;if(!g.has(t))return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0};try{let i=h.get(t);if(i){let p=i.schema.input.shape??{};for(let[m,a]of Object.entries(p))o[m]===void 0&&a._def.typeName==="ZodNullable"&&(o[m]=null);let r=await i.handler(o);return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}let b=c.get(t)??{};for(let[p,r]of Object.entries(b))o[p]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(R=>R.type==="null"))&&(o[p]=null),(r.type==="number"||r.type==="integer"||Array.isArray(r.type)&&r.type.some(a=>a==="number"||a==="integer")||r.anyOf?.some(a=>a.type==="number"||a.type==="integer"))&&typeof o[p]=="string"&&(o[p]=Number(o[p]));let w=f(),O=await d(w,t,o);return{content:[{type:"text",text:JSON.stringify(O,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let S=new N;await s.connect(S)}export{J as startMcpServer};
2
+ import{a as d,b as y,e as l}from"./chunk-SGJ5VT64.js";import{a as u,h as f}from"./chunk-BLK26RGL.js";import{Server as x}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as N}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as v}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as q}from"zod-to-json-schema";var h=new Map(l.map(s=>[s.schema.name,s]));function A(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let c=n.$ref.replace("#/definitions/","");return n.definitions[c]??n}return n}async function J(){let s=new x({name:"moonpay",version:u},{capabilities:{tools:{listChanged:!0}}}),n=l.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:q(e.schema.input)})),c=new Map;for(let e of y){if(h.has(e.name))continue;let t=A(e);c.set(e.name,t.properties??{}),n.push({name:e.name,description:e.description,inputSchema:{type:"object",properties:t.properties??{},...t.required?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}})}let g=new Map(n.map(e=>[e.name,e]));s.setRequestHandler(v,async()=>({tools:n.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))})),s.setRequestHandler(T,async e=>{let{name:t,arguments:o={}}=e.params;if(!g.has(t))return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0};try{let i=h.get(t);if(i){let p=i.schema.input.shape??{};for(let[m,a]of Object.entries(p))o[m]===void 0&&a._def.typeName==="ZodNullable"&&(o[m]=null);let r=await i.handler(o);return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}let b=c.get(t)??{};for(let[p,r]of Object.entries(b))o[p]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(R=>R.type==="null"))&&(o[p]=null),(r.type==="number"||r.type==="integer"||Array.isArray(r.type)&&r.type.some(a=>a==="number"||a==="integer")||r.anyOf?.some(a=>a.type==="number"||a.type==="integer"))&&typeof o[p]=="string"&&(o[p]=Number(o[p]));let w=f(),O=await d(w,t,o);return{content:[{type:"text",text:JSON.stringify(O,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let S=new N;await s.connect(S)}export{J as startMcpServer};
@@ -1,2 +1,2 @@
1
1
  process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{r as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h}from"./chunk-3D35PTKH.js";export{f as addWallet,d as findWallet,e as findWalletOrThrow,a as loadWallets,c as mutateWallets,g as removeWallet,h as resolveSigningKey,b as saveWallets};
2
+ import{r as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h}from"./chunk-BLK26RGL.js";export{f as addWallet,d as findWallet,e as findWalletOrThrow,a as loadWallets,c as mutateWallets,g as removeWallet,h as resolveSigningKey,b as saveWallets};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonpay/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "MoonPay CLI — the crypto onramp for AI agents",
5
5
  "homepage": "https://agents.moonpay.com",
6
6
  "publishConfig": {
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: moonpay-virtual-account
3
- description: Set up a virtual account for fiat on-ramp. Covers KYC, wallet registration, and onramp (fiat to stablecoin).
3
+ description: Set up a virtual account for fiat on-ramp and off-ramp. Covers KYC, wallet registration, bank accounts, onramp (fiat to stablecoin), and offramp (stablecoin to fiat).
4
4
  tags: [fiat]
5
5
  ---
6
6
 
7
- # Virtual account (fiat on-ramp)
7
+ # Virtual account (fiat on-ramp & off-ramp)
8
8
 
9
9
  ## Goal
10
10
 
11
- Set up and use a MoonPay virtual account to convert fiat (USD/EUR) to stablecoins (USDC/USDT/EURC) on Solana.
11
+ Set up and use a MoonPay virtual account to convert between fiat (USD/EUR) and stablecoins (USDC/USDT/EURC) on Solana, Ethereum, Polygon, Base, or Arbitrum.
12
12
 
13
13
  ## Setup flow
14
14
 
@@ -55,13 +55,13 @@ mp virtual-account agreement accept --contentId <content-id>
55
55
  mp virtual-account agreement list --status accepted
56
56
  ```
57
57
 
58
- ### 5. Register a wallet (one step)
58
+ ### 5. Register a wallet
59
59
 
60
60
  ```bash
61
61
  mp virtual-account wallet register --wallet main --chain solana
62
62
  ```
63
63
 
64
- This creates the verification message, signs it locally, and registers — all in one command.
64
+ This creates the verification message, signs it locally, and registers — all in one command. Supported chains: solana, ethereum, polygon, base, arbitrum.
65
65
 
66
66
  ```bash
67
67
  # List registered wallets
@@ -71,18 +71,25 @@ mp virtual-account wallet list
71
71
  ## Onramp (fiat to stablecoin)
72
72
 
73
73
  ```bash
74
- # Create an onramp (specify which registered wallet receives funds)
74
+ # Create an onramp — returns deposit account (bank IBAN or account number)
75
75
  mp virtual-account onramp create \
76
76
  --name "My Onramp" \
77
77
  --fiat USD \
78
78
  --stablecoin USDC \
79
- --wallet <registered-wallet-address>
79
+ --wallet <registered-wallet-address> \
80
+ --chain solana
80
81
 
81
- # Get onramp details (includes bank info for wire/ACH)
82
+ # Get onramp details (includes deposit account, fees, legal disclaimer)
82
83
  mp virtual-account onramp retrieve --onrampId <id>
83
84
 
84
85
  # List onramps
85
- mp virtual-account onramp list --status Approved
86
+ mp virtual-account onramp list
87
+
88
+ # Update an onramp (change wallet, chain, or stablecoin)
89
+ mp virtual-account onramp update --onrampId <id> --chain ethereum
90
+
91
+ # Cancel an onramp
92
+ mp virtual-account onramp cancel --onrampId <id>
86
93
 
87
94
  # Create an open banking payment
88
95
  mp virtual-account onramp payment create \
@@ -96,6 +103,65 @@ mp virtual-account onramp payment retrieve \
96
103
  --paymentId <payment-id>
97
104
  ```
98
105
 
106
+ ## Offramp (stablecoin to fiat)
107
+
108
+ ### Register a bank account first
109
+
110
+ ```bash
111
+ # Register a USD bank account (ACH)
112
+ mp virtual-account bank-account register \
113
+ --currency USD \
114
+ --type ACH \
115
+ --accountNumber <number> \
116
+ --routingNumber <number> \
117
+ --providerName "Chase" \
118
+ --providerCountry US \
119
+ --givenName John \
120
+ --familyName Doe \
121
+ --email john@example.com \
122
+ --phoneNumber +14155551234 \
123
+ --address.street "123 Main St" \
124
+ --address.city "New York" \
125
+ --address.state NY \
126
+ --address.country US \
127
+ --address.postalCode 10001
128
+
129
+ # List registered bank accounts
130
+ mp virtual-account bank-account list
131
+
132
+ # Delete a bank account
133
+ mp virtual-account bank-account delete --bankAccountId <id>
134
+ ```
135
+
136
+ ### Create and use an offramp
137
+
138
+ ```bash
139
+ # Create an offramp
140
+ mp virtual-account offramp create \
141
+ --name "My Offramp" \
142
+ --fiat USD \
143
+ --stablecoin USDC \
144
+ --chain solana
145
+
146
+ # List offramps
147
+ mp virtual-account offramp list
148
+
149
+ # Get offramp details
150
+ mp virtual-account offramp retrieve --offrampId <id>
151
+
152
+ # Update an offramp (change fiat currency / bank account)
153
+ mp virtual-account offramp update --offrampId <id> --fiat EUR
154
+
155
+ # Cancel an offramp
156
+ mp virtual-account offramp cancel --offrampId <id>
157
+
158
+ # Send stablecoin to an approved offramp (signs and broadcasts locally)
159
+ mp virtual-account offramp initiate \
160
+ --wallet main \
161
+ --offrampId <id> \
162
+ --amount 100
163
+ ```
164
+
99
165
  ## Other commands
100
166
 
101
167
  ```bash
@@ -1,29 +0,0 @@
1
- process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
- import{a as we,b as R,c as ve,d as Q,e as ke,f as Se,g as Te,h as k,i as Pe,j as je,k as q,l as ee,m as d,n as m,o as xe,p as U,q as te,r as ne,t as Ce,v as f,w as H,x as Ae,y as E}from"./chunk-3D35PTKH.js";async function ue(e,t,n){let i=await q(),r=R();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 l=ke();if(l?.refreshToken)try{let b=await je(l);o=await fetch(`${e}/api/tools/${encodeURIComponent(t)}`,{method:"POST",signal:AbortSignal.timeout(6e4),headers:{...R(),Authorization:`Bearer ${b.accessToken}`},body:JSON.stringify(n)})}catch{}}if(o.status===401)throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");let c=await o.text();if(!c){if(o.status===429){let l=i?" Run `mp upgrade` to increase your rate limit.":" Log in with `mp login` for higher limits.";throw new Error(`Rate limit exceeded.${l}`)}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 l=p;throw new Error(l?.error??`Tool call failed (${o.status})`)}return p}async function _(e,t,n){return await ue(e,t,n)}var ii=[{name:"buy",description:"Buy crypto with fiat via MoonPay. Returns a checkout URL to complete the purchase.",inputSchema:{$ref:"#/definitions/buy_input",definitions:{buy_input:{type:"object",properties:{token:{type:"string",enum:["btc","pol_polygon","sol","trx","usdc","usdc_arbitrum","usdc_base","usdc_optimism","usdc_sol","usdc_polygon","usdt_trx","eth","eth_polygon","eth_optimism","eth_base","eth_arbitrum"],description:"MoonPay currency code: sol (Solana), usdc_sol (USDC on Solana), eth (Ethereum), usdc (USDC on Ethereum), usdc_base (USDC on Base), trx (TRX on Tron), usdt_trx (USDT on Tron), etc."},amount:{type:"number",description:"Amount in USD to spend. For example, 50 means $50 worth of the selected token."},wallet:{type:"string",description:"Destination wallet address to receive tokens (must match the chain for the selected token)"},email:{type:["string","null"],description:"Buyer email to pre-fill on the checkout page"}},required:["token","amount","wallet","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/buy_output",definitions:{buy_output:{type:"object",properties:{url:{type:"string",description:"MoonPay checkout URL \u2014 open in browser to complete purchase"}},required:["url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_create",description:"Create a new deposit link that generates multi-chain deposit addresses. Anyone can send crypto to these addresses from Solana, Ethereum, Bitcoin, or Tron \u2014 it automatically converts to the specified stablecoin and settles to the destination wallet and chain.",inputSchema:{$ref:"#/definitions/deposit_create_input",definitions:{deposit_create_input:{type:"object",properties:{name:{type:"string",description:"Human-readable label for this deposit link (e.g. 'Treasury Base USDC')"},wallet:{type:"string",description:"Destination wallet address where USDC will be delivered"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","bnb"],description:"Blockchain of the destination wallet"},token:{type:"string",enum:["USDC","USDC.e","USDT"],description:"Token to receive. USDC.e (bridged USDC) is only available on Polygon."}},required:["name","wallet","chain","token"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_create_output",definitions:{deposit_create_output:{type:"object",properties:{id:{type:"string",description:"Unique deposit ID \u2014 use with deposit_transaction_list to check incoming payments"},destinationWallet:{type:"string",description:"Wallet address that will receive the stablecoin"},destinationChain:{type:"string",description:"Chain where the stablecoin will be delivered"},customerToken:{type:"string",description:"Token to check deposit transactions \u2014 pass to deposit_transaction_list"},depositUrl:{type:"string",description:"Shareable URL \u2014 open in browser or share with senders to deposit funds"},wallets:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address to send funds to"},chain:{type:"string",description:"Chain this address is on (solana, ethereum, bitcoin, tron)"},qrCode:{type:"string",description:"URL to a QR code image for the deposit address"}},required:["address","chain","qrCode"],additionalProperties:!1},description:"Deposit addresses across all supported chains \u2014 send any token to any of these"},instructions:{type:"string",description:"Human-readable instructions explaining how to use the deposit"}},required:["id","destinationWallet","destinationChain","customerToken","depositUrl","wallets","instructions"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_retrieve",description:"Retrieve details of a deposit by ID. Returns the deposit name, status, destination wallet, and deposit addresses.",inputSchema:{$ref:"#/definitions/deposit_retrieve_input",definitions:{deposit_retrieve_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_retrieve_output",definitions:{deposit_retrieve_output:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string"},destinationWallet:{type:["string","null"]},depositUrl:{type:"string"}},required:["id","name","status","destinationWallet","depositUrl"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"deposit_transaction_list",description:"List transactions for a deposit. Pass the deposit id from deposit_create to check incoming payment status.",inputSchema:{$ref:"#/definitions/deposit_transaction_list_input",definitions:{deposit_transaction_list_input:{type:"object",properties:{id:{type:"string",description:"Deposit ID returned from deposit_create"}},required:["id"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/deposit_transaction_list_output",definitions:{deposit_transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},amount:{type:"number"},token:{type:"string"},from:{type:"string"},status:{type:"string"},settledAmount:{type:["number","null"]},settledCurrency:{type:["string","null"]},timestamp:{type:"string"}},required:["id","amount","token","from","status","settledAmount","settledCurrency","timestamp"],additionalProperties:!1}}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"feedback_create",description:"Submit feedback, a bug report, or a feature request. Requires authentication.",inputSchema:{$ref:"#/definitions/feedback_create_input",definitions:{feedback_create_input:{type:"object",properties:{type:{type:"string",enum:["bug","feature","general"],description:"Type of feedback: bug, feature, or general"},message:{type:"string",minLength:1,maxLength:280,description:"Your feedback message"}},required:["type","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/feedback_create_output",definitions:{feedback_create_output:{type:"object",properties:{id:{type:"string",description:"Feedback ID"},message:{type:"string",description:"Confirmation message"}},required:["id","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"login",description:"Send a verification code to the provided email to sign in or create an account. Requires an hCaptcha token.",inputSchema:{$ref:"#/definitions/login_input",definitions:{login_input:{type:"object",properties:{email:{type:"string",format:"email",description:"The email of the user to login"},captchaToken:{type:"string",description:"hCaptcha response token"}},required:["email","captchaToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/login_output",definitions:{login_output:{type:"object",properties:{email:{type:"string",description:"The email the OTP was sent to"}},required:["email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"refresh",description:"Refresh an expired access token using a refresh token.",inputSchema:{$ref:"#/definitions/refresh_input",definitions:{refresh_input:{type:"object",properties:{refreshToken:{type:"string",description:"The refresh token from a previous login"}},required:["refreshToken"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/refresh_output",definitions:{refresh_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"swaps_transaction_build",description:"Build a swap or bridge transaction. Returns an unsigned transaction with a human-readable message, amounts, exchange rate, and estimated time. Supports same-chain swaps and cross-chain bridges. Accepts UI amounts (e.g. 0.1 SOL) \u2014 decimal conversion is handled automatically.",inputSchema:{$ref:"#/definitions/swaps_transaction_build_input",definitions:{swaps_transaction_build_input:{type:"object",properties:{from:{type:"object",properties:{wallet:{type:"string",description:"Source wallet address (Solana pubkey or EVM 0x address)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Source blockchain"},token:{type:"string",description:"Source token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},amount:{type:["number","null"],description:"Amount to swap (exact-in). Null for exact-out."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Source: wallet, chain, token, amount"},to:{type:"object",properties:{wallet:{type:"string",description:"Destination wallet address. Same as source wallet for same-chain swaps."},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Destination blockchain"},token:{type:"string",description:"Destination token address (mint on Solana, contract on EVM)"},amount:{type:["number","null"],description:"Amount to receive (exact-out). Null for exact-in."}},required:["wallet","chain","token","amount"],additionalProperties:!1,description:"Destination: wallet, chain, token, amount"}},required:["from","to"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/swaps_transaction_build_output",definitions:{swaps_transaction_build_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID for tracking"},transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Contract address"},data:{type:"string",description:"Calldata"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}],description:"Unsigned transaction"},message:{type:"string",description:"Human-readable description (e.g. Swap 0.1 SOL \u2192 42.5 USDC on Solana)"},amountIn:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},amountOut:{type:"object",properties:{amount:{type:"number",description:"Human-readable amount (e.g. 1.5)"},raw:{type:"string",description:"Raw amount in smallest unit (e.g. wei, lamports)"},symbol:{type:"string"},usd:{type:["number","null"]}},required:["amount","raw","symbol","usd"],additionalProperties:!1},exchangeRate:{type:"number",description:"Exchange rate (amountOut / amountIn)"},estimatedTime:{type:["number","null"],description:"Estimated completion time in seconds"},requiresApproval:{type:"boolean",description:"Whether an ERC20 approval transaction is needed first"}},required:["transactionId","transaction","message","amountIn","amountOut","exchangeRate","estimatedTime","requiresApproval"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_balance_list",description:"List all token balances held in a wallet, including amount owned, current value in USD, and token details. Shows the complete token portfolio.",inputSchema:{$ref:"#/definitions/token_balance_list_input",definitions:{token_balance_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address to check token balances for"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to check balances on (e.g. 'solana', 'ethereum', 'base')"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_balance_list_output",definitions:{token_balance_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},balance:{type:"object",properties:{amount:{type:"number",description:"Number of tokens owned"},value:{type:"number",description:"Total value of the token in USD"},price:{type:"number",description:"Current price of the token"}},required:["amount","value","price"],additionalProperties:!1}},required:["address","name","symbol","chain","decimals","balance"],additionalProperties:!1},description:"Array of all tokens in the wallet with their balances and current values"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_retrieve",description:"Get detailed token information including market data, price changes, volume, trades, and holder statistics by token address",inputSchema:{$ref:"#/definitions/token_retrieve_input",definitions:{token_retrieve_input:{type:"object",properties:{token:{type:"string",description:"Address of the token to retrieve"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain network where the token exists"}},required:["token","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_retrieve_output",definitions:{token_retrieve_output:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_search",description:"Search for tokens by name, symbol, or address. Returns matching tokens with their market data including price, volume, and liquidity.",inputSchema:{$ref:"#/definitions/token_search_input",definitions:{token_search_input:{type:"object",properties:{query:{type:"string",description:"Search term - can be token name (e.g. 'Bitcoin'), symbol (e.g. 'BTC'), or partial match"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to search on (e.g. 'solana', 'ethereum', 'base')"},limit:{type:["number","null"],description:"Maximum number of results to return (optional, defaults to 5)"}},required:["query","chain","limit"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_search_output",definitions:{token_search_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of tokens matching the search query with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_transfer",description:"Build an unsigned transfer transaction. Returns a transaction ready for signing. Handles both native and token transfers.",inputSchema:{$ref:"#/definitions/token_transfer_input",definitions:{token_transfer_input:{type:"object",properties:{wallet:{type:"string",description:"Sender wallet address (Solana pubkey or EVM 0x address)"},token:{type:"string",description:"Token address (mint on Solana, contract on EVM). Use native token address for SOL/ETH."},to:{type:"string",description:"Recipient wallet address or name"},amount:{type:"number",description:"Amount to transfer in human-readable units (e.g. 1.5)"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to execute the transfer on"}},required:["wallet","token","to","amount","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_transfer_output",definitions:{token_transfer_output:{type:"object",properties:{transaction:{anyOf:[{type:"object",properties:{type:{type:"string",const:"solana"},base64:{type:"string",description:"Base64-encoded transaction"}},required:["type","base64"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"evm"},to:{type:"string",description:"Recipient or contract address"},data:{type:"string",description:"Calldata (0x for native transfers)"},value:{type:"string",description:"Native token value in wei"},chainId:{type:"number",description:"EVM chain ID"}},required:["type","to","data","value","chainId"],additionalProperties:!1}]},message:{type:"string",description:"Human-readable description of the transfer"}},required:["transaction","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"token_trending_list",description:"Get currently trending tokens on a blockchain. Perfect for discovering what's hot right now.",inputSchema:{$ref:"#/definitions/token_trending_list_input",definitions:{token_trending_list_input:{type:"object",properties:{chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to get trending tokens from (e.g. 'solana', 'ethereum', 'base')"},limit:{type:"integer",minimum:1,description:"Number of results per page"},page:{type:"integer",minimum:1,description:"Page number (starts at 1)"}},required:["chain","limit","page"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/token_trending_list_output",definitions:{token_trending_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{address:{type:"string",description:"Address of the token"},name:{type:"string",description:"Name of the token"},symbol:{type:"string",description:"Symbol of the token"},image:{type:["string","null"],description:"Image of the token"},description:{type:["string","null"],description:"Description of the token"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain of the token"},decimals:{type:"number",description:"Number of decimals of the token"},externalLinks:{anyOf:[{type:"object",properties:{website:{type:["string","null"],description:"Official website URL"},twitter:{type:["string","null"],description:"Twitter/X profile URL"},telegram:{type:["string","null"],description:"Telegram group URL"},discord:{type:["string","null"],description:"Discord server URL"},github:{type:["string","null"],description:"GitHub repository URL"},coingeckoId:{type:["string","null"],description:"CoinGecko token ID"}},additionalProperties:!1},{type:"null"}],description:"External links and social media"},marketData:{type:"object",properties:{liquidity:{type:["number","null"],description:"Total liquidity"},marketCap:{type:["number","null"],description:"Market capitalization"},fdv:{type:["number","null"],description:"Fully diluted valuation"},price:{type:["number","null"],description:"Current price"},priceChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in price across time intervals"},volume:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Trading volume in USD across time intervals"},volumeChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in trading volume across time intervals"},trades:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of trades across time intervals"},tradesChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of trades across time intervals"},buys:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of buys across time intervals"},buysChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of buys across time intervals"},sells:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of sells across time intervals"},sellsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of sells across time intervals"},uniqueWallets:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Number of unique wallets trading across time intervals"},uniqueWalletsChangePercent:{type:"object",properties:{"1m":{type:["number","null"],description:"1-minute data"},"5m":{type:["number","null"],description:"5-minute data"},"30m":{type:["number","null"],description:"30-minute data"},"1h":{type:["number","null"],description:"1-hour data"},"2h":{type:["number","null"],description:"2-hour data"},"4h":{type:["number","null"],description:"4-hour data"},"6h":{type:["number","null"],description:"6-hour data"},"8h":{type:["number","null"],description:"8-hour data"},"12h":{type:["number","null"],description:"12-hour data"},"24h":{type:["number","null"],description:"24-hour data"}},additionalProperties:!1,description:"Percentage change in number of unique wallets trading across time intervals"}},additionalProperties:!1}},required:["address","name","symbol","chain","decimals"],additionalProperties:!1},description:"Array of trending tokens with their market data"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_list",description:"List swap and bridge transaction history for a wallet.",inputSchema:{$ref:"#/definitions/transaction_list_input",definitions:{transaction_list_input:{type:"object",properties:{wallet:{type:"string",description:"Wallet address that signed and sent the transactions"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Chain the wallet is on"}},required:["wallet","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_list_output",definitions:{transaction_list_output:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds"}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1},description:"List of swap/bridge transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_register",description:"Register a broadcast transaction for tracking. Call after transaction_send to enable status tracking via transaction_retrieve.",inputSchema:{$ref:"#/definitions/transaction_register_input",definitions:{transaction_register_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build"},transactionHash:{type:"string",description:"Transaction hash/signature after broadcasting"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain where the transaction was broadcast"}},required:["transactionId","transactionHash","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_register_output",definitions:{transaction_register_output:{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_retrieve",description:"Get the status and details of a transaction by its ID.",inputSchema:{$ref:"#/definitions/transaction_retrieve_input",definitions:{transaction_retrieve_input:{type:"object",properties:{transactionId:{type:"string",description:"Transaction ID from swaps_transaction_build or transaction_register"}},required:["transactionId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_retrieve_output",definitions:{transaction_retrieve_output:{type:"object",properties:{transactionId:{type:"string",description:"Transaction tracking ID"},status:{type:"string",description:"Current status: pending, success, or failed"},type:{type:"string",enum:["swap","bridge"],description:"Transaction type"},from:{type:"object",properties:{chain:{type:"string",description:"Source blockchain"},token:{type:"string",description:"Source token symbol"},amount:{type:["number","null"],description:"Amount sent"},txHash:{type:"string",description:"Source chain transaction hash"}},required:["chain","token","amount","txHash"],additionalProperties:!1},to:{type:"object",properties:{chain:{type:"string",description:"Destination blockchain"},token:{type:"string",description:"Destination token symbol"},amount:{type:["number","null"],description:"Amount received"},txHash:{type:["string","null"],description:"Destination chain transaction hash. Null while bridge is in progress."}},required:["chain","token","amount","txHash"],additionalProperties:!1},usd:{type:["number","null"],description:"USD value of the transaction"},bridgeTime:{type:["number","null"],description:"Bridge completion time in seconds. Null for same-chain swaps."}},required:["transactionId","status","type","from","to","usd","bridgeTime"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"transaction_send",description:"Broadcast a signed transaction to the network. Supports Solana, EVM chains, and Bitcoin.",inputSchema:{$ref:"#/definitions/transaction_send_input",definitions:{transaction_send_input:{type:"object",properties:{transaction:{type:"string",description:"Signed transaction: base64-encoded for Solana, hex-encoded (0x...) for EVM, raw hex for Bitcoin"},message:{type:"string",description:"Human-readable message describing the transaction"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain to broadcast on"}},required:["transaction","message","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/transaction_send_output",definitions:{transaction_send_output:{type:"object",properties:{signature:{type:"string",description:"Transaction signature/hash. Absent if broadcast failed."},message:{type:"string",description:"Result message or error description"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"user_retrieve",description:"Get the currently authenticated user",inputSchema:{$ref:"#/definitions/user_retrieve_input",definitions:{user_retrieve_input:{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/user_retrieve_output",definitions:{user_retrieve_output:{type:"object",properties:{id:{type:"string",description:"User ID"},email:{type:["string","null"],description:"User email address"}},required:["id","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"verify",description:"Verify a login code for the user.",inputSchema:{$ref:"#/definitions/verify_input",definitions:{verify_input:{type:"object",properties:{code:{type:"string",pattern:"^\\d{6}$",description:"The code to verify"},email:{type:"string",format:"email",description:"The email the OTP was sent to"}},required:["code","email"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/verify_output",definitions:{verify_output:{type:"object",properties:{accessToken:{type:"string"},refreshToken:{type:"string"},expiresAt:{type:"number"}},required:["accessToken","refreshToken","expiresAt"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_accept",description:"Accept a required legal agreement. Pass the content ID from virtual-account_agreement_list to mark the agreement as accepted.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_input",definitions:{"virtual-account_agreement_accept_input":{type:"object",properties:{contentId:{type:"string",description:"Content ID from virtual-account_agreement_list"}},required:["contentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_accept_output",definitions:{"virtual-account_agreement_accept_output":{type:"object",properties:{id:{type:"string",description:"Signing record ID"},contentId:{type:["string","null"],description:"Content ID of the accepted agreement"},documentId:{type:["string","null"],description:"Document ID"}},required:["id","contentId","documentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_agreement_list",description:"List legal agreements. By default shows pending agreements that must be accepted to activate the account. Use status=accepted to see previously accepted agreements.",inputSchema:{$ref:"#/definitions/virtual-account_agreement_list_input",definitions:{"virtual-account_agreement_list_input":{type:"object",properties:{status:{anyOf:[{type:"string",enum:["pending","accepted"]},{type:"null"}],description:"Filter: pending (need to accept, default) or accepted (already signed)"},country:{type:["string","null"],description:"Country code for terms (e.g. USA, GBR). Defaults to USA."}},required:["status","country"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_agreement_list_output",definitions:{"virtual-account_agreement_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Content ID \u2014 pass to virtual-account_agreement_accept to accept"},name:{type:"string",description:"Document name (e.g. 'USA Terms and Conditions')"},url:{type:"string",description:"URL to view the document"}},required:["id","name","url"],additionalProperties:!1},description:"List of agreements"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_create",description:"Create a virtual account and start KYC verification",inputSchema:{$ref:"#/definitions/virtual-account_create_input",definitions:{"virtual-account_create_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_create_output",definitions:{"virtual-account_create_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_continue",description:"Get the current KYC verification status and URL. Use this to check progress or get the verification link again.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_input",definitions:{"virtual-account_kyc_continue_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_continue_output",definitions:{"virtual-account_kyc_continue_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."}},required:["id","status","url"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_kyc_restart",description:"Restart KYC verification. Creates a fresh verification link. Only available when account status is IdentificationRequired.",inputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_input",definitions:{"virtual-account_kyc_restart_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_kyc_restart_output",definitions:{"virtual-account_kyc_restart_output":{type:"object",properties:{id:{type:"string",description:"Identification record ID"},status:{type:"string",enum:["Pending","Processed","PendingReview","Approved","Declined","Expired"],description:"KYC status: Pending, Processed, PendingReview, Approved, Declined, or Expired"},url:{type:["string","null"],description:"URL to complete KYC verification. Null if already submitted."},message:{type:["string","null"],description:"Instructions for the user"}},required:["id","status","url","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_create",description:"Create a fiat-to-stablecoin onramp. Returns a deposit account (bank IBAN or account number) where the user sends fiat. Incoming fiat is automatically converted to stablecoin and sent to the registered wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_create_input",definitions:{"virtual-account_onramp_create_input":{type:"object",properties:{name:{type:"string",description:"A label for this onramp (e.g. 'My USD onramp')"},fiat:{type:"string",enum:["USD","EUR"],description:"Fiat currency: usd or eur"},stablecoin:{type:"string",enum:["USDC","USDT","EURC"],description:"Target stablecoin: usdc, usdt, or eurc"},wallet:{type:"string",description:"Registered wallet address (must be registered via virtual-account_wallet_register first)"},blockchain:{type:"string",enum:["Solana","Ethereum","Polygon","Arbitrum","Base","Stellar","Citrea"],description:"Blockchain to receive stablecoin on (Solana, Ethereum, Polygon, Arbitrum, Base)"}},required:["name","fiat","stablecoin","wallet","blockchain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_create_output",definitions:{"virtual-account_onramp_create_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_delete",description:"Cancel an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_input",definitions:{"virtual-account_onramp_delete_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to cancel"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_delete_output",definitions:{"virtual-account_onramp_delete_output":{type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_list",description:"List all fiat-to-stablecoin onramps. Shows each onramp's deposit account details, status, and destination wallet.",inputSchema:{$ref:"#/definitions/virtual-account_onramp_list_input",definitions:{"virtual-account_onramp_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_list_output",definitions:{"virtual-account_onramp_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1},description:"List of configured onramps"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_create",description:"Create an open banking payment link for an onramp",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_input",definitions:{"virtual-account_onramp_payment_create_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp"},amount:{type:"string",description:"The amount to pay"},fiat:{type:"string",enum:["USD","EUR"],description:"The fiat currency (USD or EUR)"}},required:["onrampId","amount","fiat"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_create_output",definitions:{"virtual-account_onramp_payment_create_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_payment_retrieve",description:"Get the status of an open banking payment",inputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_input",definitions:{"virtual-account_onramp_payment_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp this payment belongs to"},paymentId:{type:"string",format:"uuid",description:"The ID of the payment to retrieve"}},required:["onrampId","paymentId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_payment_retrieve_output",definitions:{"virtual-account_onramp_payment_retrieve_output":{type:"object",properties:{id:{type:"string"},paymentLink:{type:["string","null"]},status:{type:"string",enum:["Pending","Ready","Processing","Completed","Failed"]}},required:["id","paymentLink","status"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_onramp_retrieve",description:"Get onramp details and banking info",inputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_input",definitions:{"virtual-account_onramp_retrieve_input":{type:"object",properties:{onrampId:{type:"string",format:"uuid",description:"The ID of the onramp to retrieve"}},required:["onrampId"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_onramp_retrieve_output",definitions:{"virtual-account_onramp_retrieve_output":{type:"object",properties:{id:{type:"string"},name:{type:"string"},status:{type:"string",enum:["Created","Authorized","DepositAccountAdded","Approved","Rejected","Cancelled"]},fiat:{type:"string"},stablecoin:{type:"string"},depositAccount:{anyOf:[{type:"object",properties:{type:{type:"string"},iban:{type:["string","null"]},bic:{type:["string","null"]},accountNumber:{type:["string","null"]},routingNumber:{type:["string","null"]},bankName:{type:["string","null"]},bankAddress:{type:["string","null"]},recipientName:{type:["string","null"]}},required:["type","iban","bic","accountNumber","routingNumber","bankName","bankAddress","recipientName"],additionalProperties:!1},{type:"null"}]},walletAddress:{type:"string"},fees:{anyOf:[{type:"object",properties:{transactionFee:{type:"string",description:"e.g. '0.50%'"},bankingFee:{type:["string","null"],description:"e.g. '0.50 EUR (SEPA)'"},networkFee:{type:"string",description:"'subsidized' or 'charged'"}},required:["transactionFee","bankingFee","networkFee"],additionalProperties:!1},{type:"null"}]},legalDisclaimer:{type:"string"}},required:["id","name","status","fiat","stablecoin","depositAccount","walletAddress","fees","legalDisclaimer"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_retrieve",description:"Get your virtual account status",inputSchema:{$ref:"#/definitions/virtual-account_retrieve_input",definitions:{"virtual-account_retrieve_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_retrieve_output",definitions:{"virtual-account_retrieve_output":{type:"object",properties:{id:{type:"string"},email:{type:"string"},customerType:{type:"string",enum:["Person","Business"]},status:{type:"string",enum:["UserRequired","SigningsRequired","IdentificationRequired","Active","Suspended"]},nextStep:{type:["string","null"]}},required:["id","email","customerType","status","nextStep"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_transaction_list",description:"List fiat-to-stablecoin conversion transactions. Shows status, fiat amount sent, and stablecoin amount received for each conversion.",inputSchema:{$ref:"#/definitions/virtual-account_transaction_list_input",definitions:{"virtual-account_transaction_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_transaction_list_output",definitions:{"virtual-account_transaction_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Transaction ID"},state:{type:"string",enum:["Pending","PayoutPending","Payout","PayoutCompleted","Completed","Failed","InAmlReview","AmlRejected","AmountRejected"],description:"Transaction state (e.g. pending, completed, failed)"},sourceAmount:{type:"string",description:"Fiat amount sent (e.g. '100.00 USD')"},destinationAmount:{type:"string",description:"Stablecoin amount received (e.g. '99.50 USDC')"},createdAt:{type:"string",format:"date-time",description:"Transaction creation timestamp"}},required:["id","state","sourceAmount","destinationAmount","createdAt"],additionalProperties:!1},description:"List of onramp conversion transactions"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_list",description:"List wallets registered for the virtual account. Only registered wallets can receive onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_list_input",definitions:{"virtual-account_wallet_list_input":{type:"object",properties:{},additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_list_output",definitions:{"virtual-account_wallet_list_output":{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{id:{type:"string"},address:{type:"string"},blockchain:{type:"string"}},required:["id","address","blockchain"],additionalProperties:!1},description:"List of registered wallets"}},required:["items"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_register",description:"Register a wallet by submitting a signed proof-of-ownership message. The wallet can then be used as a destination for onramp payouts.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_register_input",definitions:{"virtual-account_wallet_register_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"},message:{type:"string",description:"Verification message from virtual-account_wallet_registration-message_create"},signature:{type:"string",description:"Signature of the message, signed by the wallet's private key"},chain:{type:"string",enum:["solana","ethereum","base","polygon","arbitrum","optimism","bnb","avalanche","tron","bitcoin"],description:"Blockchain for wallet registration (solana, ethereum, polygon, base, arbitrum)"}},required:["wallet","message","signature","chain"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_register_output",definitions:{"virtual-account_wallet_register_output":{type:"object",properties:{success:{type:"boolean",description:"Whether the operation was successful"}},required:["success"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}},{name:"virtual-account_wallet_registration-message_create",description:"Generate a proof-of-ownership message for wallet registration. The message must be signed by the wallet's private key and submitted via virtual-account_wallet_register.",inputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_input",definitions:{"virtual-account_wallet_registration-message_create_input":{type:"object",properties:{wallet:{type:"string",description:"Wallet address to register"}},required:["wallet"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"},outputSchema:{$ref:"#/definitions/virtual-account_wallet_registration-message_create_output",definitions:{"virtual-account_wallet_registration-message_create_output":{type:"object",properties:{message:{type:"string",description:"Message to sign with the wallet's private key"}},required:["message"],additionalProperties:!1}},$schema:"http://json-schema.org/draft-07/schema#"}}];var Ht="https://www.moonpay.com/legal/terms_of_use_europe_hypermint",Mt="https://www.moonpay.com/legal/privacy_policy",Ft="https://swaps.xyz/terms",$e=` Terms of Use: ${Ht}
3
- Privacy Policy: ${Mt}
4
- Swaps by: ${Ft}`;import*as Oe from"fs";import*as Le from"os";import*as We 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 M}from"zod";var Ie=a({name:"consent_check",description:"Check whether the MoonPay Terms of Use have been accepted. Throws if not accepted.",input:M.object({}),output:M.object({accepted:M.literal(!0),tosVersion:M.string(),acceptedAt:M.string()})});import*as D from"fs";import*as De from"os";import*as Be from"path";import*as Ne from"crypto";import{z as ie}from"zod";var Re=a({name:"consent_accept",description:"Accept the MoonPay Terms of Use. Required before using any CLI command.",input:ie.object({}),output:ie.object({tosVersion:ie.string(),acceptedAt:ie.string()})});import*as re from"os";var qe=3e3;function Ue(e){let t=k(),n=JSON.stringify({agentId:e.agentId,tosVersion:e.tosVersion,cliVersion:e.cliVersion,nodeVersion:process.version,os:re.platform(),arch:re.arch()});fetch(`${t}/api/tools/cli_activation_create`,{method:"POST",headers:R(),body:n,signal:AbortSignal.timeout(qe)}).catch(()=>{})}async function Ee(e){let t=k(),n=await q();n&&fetch(`${t}/api/tools/cli_activation_update`,{method:"POST",headers:{...R(),Authorization:`Bearer ${n}`},body:JSON.stringify({agentId:e}),signal:AbortSignal.timeout(qe)}).catch(()=>{})}var me=Be.join(De.homedir(),".config","moonpay","consent.json");function Kt(){try{return JSON.parse(D.readFileSync(me,"utf-8"))}catch{return null}}var ae=s(Re,async()=>{ve();let t=Kt()?.agentId??Ne.randomUUID(),n=new Date().toISOString(),i={tosVersion:"1.2",acceptedAt:n,agentId:t},r=me+`.tmp.${process.pid}`;return D.writeFileSync(r,JSON.stringify(i,null,2),{encoding:"utf-8",mode:384}),D.renameSync(r,me),process.stderr.write(`
5
- By using this CLI, you agree to:
6
- ${$e}
7
-
8
- `),Ue({agentId:t,tosVersion:"1.2",cliVersion:we}),{tosVersion:i.tosVersion,acceptedAt:i.acceptedAt}});var Gt=We.join(Le.homedir(),".config","moonpay","consent.json"),Ve=s(Ie,async()=>{let e=null;try{e=JSON.parse(Oe.readFileSync(Gt,"utf-8"))}catch{}if(!e||e.tosVersion!=="1.2"){let t=await ae.handler({});return{accepted:!0,tosVersion:t.tosVersion,acceptedAt:t.acceptedAt}}return{accepted:!0,tosVersion:e.tosVersion,acceptedAt:e.acceptedAt}});import{generateMnemonic as Yt}from"@scure/bip39";import{wordlist as Jt}from"@scure/bip39/wordlists/english";import{z as B}from"zod";var ze=a({name:"wallet_create",description:"Create a new multi-chain HD wallet. Generates a BIP39 mnemonic and derives addresses for Solana, Ethereum, Bitcoin, and Tron. The mnemonic is copied to clipboard (interactive) or omitted (headless). Keys are encrypted with a random key stored in the OS keychain.",input:B.object({name:B.string().describe("Wallet name")}),output:B.object({name:B.string(),addresses:B.record(d,B.string())})});var He=s(ze,async e=>{let t=Yt(Jt,256),n=ee(t);return H({name:e.name,type:"hd",mnemonic:t,addresses:n,createdAt:new Date().toISOString()}),{name:e.name,addresses:U(n)}});import{createInterface as Xt}from"readline";import{validateMnemonic as Fe}from"@scure/bip39";import{wordlist as Ke}from"@scure/bip39/wordlists/english";import{Keypair as Zt}from"@solana/web3.js";import Qt from"bs58";import{privateKeyToAccount as en}from"viem/accounts";import{z as A}from"zod";var Me=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:A.object({name:A.string().describe("Wallet name"),mnemonic:A.string().nullable().describe("BIP39 mnemonic seed phrase (for HD wallet import)"),key:A.string().nullable().describe("Private key: base58 for Solana, hex for EVM/Bitcoin"),chain:d.nullable().describe("Chain for single-key import (default solana)")}),output:A.object({name:A.string(),type:A.enum(["hd","imported"]),addresses:xe})});function tn(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=Xt({input:process.stdin,output:process.stderr});process.stderr.write(e),process.stdin.setRawMode(!0);let r="",o=c=>{let p=c.toString();p===`
9
- `||p==="\r"?(process.stdin.setRawMode(!1),process.stdin.removeListener("data",o),process.stderr.write(`
10
- `),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 nn(e){let t=e.split(/\s+/);return t.length>=12&&t.length<=24&&Fe(e,Ke)?"mnemonic":"key"}var Ge=s(Me,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 tn("Paste your mnemonic or private key (hidden): ");if(!p)throw new Error("No input provided.");nn(p)==="mnemonic"?t=p:n=p}if(t){let p=t.trim().toLowerCase();if(!Fe(p,Ke))throw new Error("Invalid BIP39 mnemonic.");let l=ee(p);return H({name:e.name,type:"hd",mnemonic:p,addresses:l,createdAt:new Date().toISOString()}),{name:e.name,type:"hd",addresses:l}}let i=e.chain?m[e.chain]:"solana",r=n??"",o,c;if(i==="solana")try{let p=Qt.decode(r);o=Zt.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=en(`0x${c}`).address}else throw new Error(`Single-key import for ${i} is not yet supported. Use a mnemonic instead.`);return H({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 Ye}from"zod";var Je=a({name:"wallet_list",description:"List all local wallets",input:Ye.object({}),output:Ye.array(te)});var Xe=s(Je,async()=>ne().map(t=>({name:t.name,type:t.type,addresses:U(t.addresses),createdAt:t.createdAt})));import{z as Ze}from"zod";var Qe=a({name:"wallet_retrieve",description:"Get details of a specific wallet",input:Ze.object({wallet:Ze.string().describe("Wallet name or address")}),output:te});var P=s(Qe,async e=>{let t=f(e.wallet);return{name:t.name,type:t.type,addresses:U(t.addresses),createdAt:t.createdAt}});import{z as N}from"zod";var et=a({name:"wallet_delete",description:"Permanently delete a local wallet. This removes the private key file and cannot be undone.",input:N.object({wallet:N.string().describe("Name or address of the wallet to delete"),confirm:N.boolean().describe("Must be true to confirm deletion")}),output:N.object({name:N.string().describe("Name of the deleted wallet"),deleted:N.literal(!0)})});var tt=s(et,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=f(e.wallet);return Ae(t.name),{name:t.name,deleted:!0}});import{z as O}from"zod";var nt=a({name:"wallet_rename",description:"Rename a local wallet.",input:O.object({wallet:O.string().describe("Current name or address of the wallet"),name:O.string().describe("New name for the wallet")}),output:O.object({oldName:O.string(),newName:O.string()})});var it=s(nt,async e=>{let n=f(e.wallet).name;if(n===e.name)return{oldName:n,newName:e.name};if(ne().some(r=>r.name===e.name))throw new Error(`Wallet "${e.name}" already exists`);return Ce(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 se}from"zod";var rt=a({name:"wallet_export",description:"Export wallet secret (mnemonic or private key). Interactive only \u2014 cannot be run by agents or piped.",input:se.object({wallet:se.string().describe("Wallet name")}),output:se.object({exported:se.literal(!0)})});var ot=s(rt,async e=>{if(!process.stdout.isTTY)throw new Error(`Wallet export requires an interactive terminal.
11
- Run this command directly in your terminal: mp wallet export `+e.wallet);let t=f(e.wallet);return t.type==="hd"?(process.stderr.write(`
12
- Mnemonic for "${t.name}":
13
-
14
- `),process.stderr.write(` ${t.mnemonic}
15
-
16
- `),process.stderr.write(`Write this down and store it securely.
17
-
18
- `)):(process.stderr.write(`
19
- Private key for "${t.name}" (${t.chain}):
20
-
21
- `),process.stderr.write(` ${t.privateKey}
22
-
23
- `)),{exported:!0}});import{createHash as rn}from"crypto";import{Keypair as on,VersionedTransaction as an}from"@solana/web3.js";import{privateKeyToAccount as sn}from"viem/accounts";import{parseTransaction as cn}from"viem";import{createPublicClient as pn,http as ln}from"viem";import*as h from"viem/chains";import*as st from"tiny-secp256k1";import{z as F}from"zod";var at=a({name:"transaction_sign",description:"Sign a transaction with a local wallet. Supports Solana (VersionedTransaction), EVM (RLP-encoded), and Bitcoin (PSBT) transactions.",input:F.object({wallet:F.string().describe("Wallet name or address"),chain:d.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),transaction:F.string().describe("Base64-encoded unsigned transaction")}),output:F.object({transaction:F.string().describe("Base64-encoded signed transaction")})});var dn={1:h.mainnet,137:h.polygon,42161:h.arbitrum,8453:h.base,10:h.optimism,56:h.bsc,43114:h.avalanche},un={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"},$=s(at,async e=>{let t=f(e.wallet),n=e.chain,i=m[n],{privateKey:r}=E(t,n);switch(i){case"solana":return mn(r,e.transaction.trim());case"ethereum":return hn(r,e.transaction.trim());case"tron":return yn(r,e.transaction.trim());case"bitcoin":return fn(r,e.transaction.trim())}});function mn(e,t){let n=Buffer.from(t,"base64"),i=an.deserialize(n),r=on.fromSecretKey(e);return i.sign([r]),{transaction:Buffer.from(i.serialize()).toString("base64")}}async function hn(e,t){let n=sn(`0x${Buffer.from(e).toString("hex")}`);if(t.startsWith("{")){let{to:c,data:p,value:l,chainId:b}=JSON.parse(t),y=dn[b]??h.mainnet,u=un[b],j=pn({chain:y,transport:ln(u)}),z=await j.getTransactionCount({address:n.address}),X=await j.estimateFeesPerGas(),Z=await j.estimateGas({account:n.address,to:c,data:p,value:BigInt(l??"0")});return{transaction:await n.signTransaction({to:c,data:p,value:BigInt(l??"0"),chainId:b,nonce:z,gas:Z,maxFeePerGas:X.maxFeePerGas,maxPriorityFeePerGas:X.maxPriorityFeePerGas,type:"eip1559"})}}let i=t.startsWith("0x")?t:`0x${Buffer.from(t,"base64").toString("hex")}`,r=cn(i);return{transaction:await n.signTransaction(r)}}function yn(e,t){let n=Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"),i=rn("sha256").update(n).digest(),r=st.sign(i,e);if(!r)throw new Error("Tron transaction signing failed");return{transaction:Buffer.from(r).toString("hex")}}async function fn(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 pt}from"crypto";import{Keypair as gn}from"@solana/web3.js";import bn from"bs58";import _n from"tweetnacl";import*as he from"tiny-secp256k1";import{keccak_256 as wn}from"@noble/hashes/sha3";import{privateKeyToAccount as vn}from"viem/accounts";import{z as K}from"zod";var ct=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:K.object({wallet:K.string().describe("Wallet address or name to sign with"),chain:d.describe("Chain: solana, ethereum, base, arbitrum, or bitcoin"),message:K.string().describe("Message text to sign")}),output:K.object({signature:K.string().describe("Signature: base58 for Solana, hex (0x-prefixed) for EVM/Bitcoin")})});var ce=s(ct,async e=>{let t=f(e.wallet),n=e.chain,i=m[n],{privateKey:r}=E(t,n),o=Buffer.from(e.message,"utf8");switch(i){case"solana":return kn(r,o);case"ethereum":return Sn(r,e.message);case"tron":return Tn(r,e.message);case"bitcoin":return Pn(r,o)}});function kn(e,t){let n=gn.fromSecretKey(e),i=_n.sign.detached(t,n.secretKey);return{signature:bn.encode(i)}}async function Sn(e,t){return{signature:await vn(`0x${Buffer.from(e).toString("hex")}`).signMessage({message:t})}}function Tn(e,t){let n=Buffer.from(t,"utf8"),i=Buffer.from(`TRON Signed Message:
24
- ${n.length}`,"utf8"),r=wn(Buffer.concat([i,n])),o=he.sign(r,e);if(!o)throw new Error("Tron message signing failed");return{signature:"0x"+Buffer.from(o).toString("hex")}}function Pn(e,t){let n=pt("sha256").update(t).digest(),i=pt("sha256").update(n).digest(),r=he.sign(i,e);if(!r)throw new Error("Bitcoin message signing failed");return{signature:"0x"+Buffer.from(r).toString("hex")}}import jn from"https";import{z as w}from"zod";var lt=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 xn=1e8;function ye(e){return(e/xn).toFixed(8)}function Cn(e){return new Promise((t,n)=>{jn.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 dt=s(lt,async e=>{let t=e.wallet;if(!t.startsWith("bc1")&&!t.startsWith("1")&&!t.startsWith("3")){let{findWalletOrThrow:c}=await import("./store-JKUH5YZS.js"),l=c(t).addresses.bitcoin;if(!l)throw new Error(`Wallet "${t}" has no Bitcoin address. It may be an imported single-chain wallet.`);t=l}let n=await Cn(`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:ye(i),sats:i},unconfirmed:{btc:ye(r),sats:r},total:{btc:ye(o),sats:o}}});import{readdirSync as An,readFileSync as ut,existsSync as fe,mkdirSync as $n,cpSync as In}from"fs";import{join as L,dirname as Rn}from"path";import{homedir as qn}from"os";import{fileURLToPath as Un}from"url";function ge(){let e=Un(import.meta.url),t=Rn(e);return L(t,"..","skills")}function En(){return L(qn(),".claude","skills")}function be(){let e=ge();return fe(e)?An(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&t.name.startsWith("moonpay-")).map(t=>{let i=ut(L(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 mt(e){if(/[/\\]|\.\./.test(e))throw new Error(`Invalid skill name: "${e}"`);let t=L(ge(),e,"SKILL.md");if(!fe(t))throw new Error(`Skill "${e}" not found. Run \`mp skill list\` to see available skills.`);return ut(t,"utf-8")}function ht(e,t){let n=ge(),i=t??En(),r=be();return $n(i,{recursive:!0}),r.map(o=>{let c=L(i,o.name);return fe(c)&&!e?{name:o.name,installed:!1}:(In(L(n,o.name),c,{recursive:!0,force:!0}),{name:o.name,installed:!0})})}import{z as G}from"zod";var yt=a({name:"skill_list",description:"List available AI skills for Claude Code and other agents",input:G.object({}),output:G.array(G.object({name:G.string(),description:G.string()}))});var ft=s(yt,async()=>be());import{z as Y}from"zod";var gt=a({name:"skill_retrieve",description:"Get the full instructions for a specific skill",input:Y.object({name:Y.string().describe("Skill name (e.g. moonpay-swap-tokens)")}),output:Y.object({name:Y.string(),content:Y.string()})});var bt=s(gt,async e=>({name:e.name,content:mt(e.name)}));import{z as I}from"zod";var _t=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:I.object({force:I.boolean().describe("Overwrite existing skills"),dir:I.string().nullable().describe("Target directory to install skills into (default: ~/.claude/skills/)")}),output:I.array(I.object({name:I.string(),installed:I.boolean()}))});var wt=s(_t,async e=>ht(e.force,e.dir??void 0));import{encodeFunctionData as Dn}from"viem";import{z as v}from"zod";var vt=a({name:"token_bridge",description:"Bridge tokens across chains. Builds, signs locally, broadcasts, and registers.",input:v.object({from:v.object({wallet:v.string().describe("Local wallet name to sign with"),chain:d.describe("Source chain"),token:v.string().describe("Source token address"),amount:v.coerce.number().nullable().describe("Amount to send (exact-in). Null for exact-out.")}),to:v.object({wallet:v.string().nullable().describe("Destination wallet name or address (defaults to from wallet)"),chain:d.describe("Destination chain"),token:v.string().describe("Destination token address"),amount:v.coerce.number().nullable().describe("Amount to receive (exact-out). Null for exact-in.")})}),output:v.object({signature:v.string().describe("Transaction hash/signature"),message:v.string().describe("Human-readable bridge description")})});var Bn=[{name:"approve",type:"function",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],pe=s(vt,async e=>{if(!e.from.amount&&!e.to.amount)throw new Error("Provide either from.amount or to.amount.");let t=k(),n=await P.handler({wallet:e.from.wallet}),i=n.addresses[m[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[m[e.to.chain]]??e.to.wallet}catch{r=e.to.wallet}else e.from.chain!==e.to.chain&&(r=n.addresses[m[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 _(t,"swaps_transaction_build",o),p=c.transaction;if(c.requiresApproval&&"to"in p){let{to:u,chainId:j}=p,z={type:"evm",to:e.from.token,data:Dn({abi:Bn,functionName:"approve",args:[u,BigInt(c.amountIn.raw)]}),value:"0",chainId:j},{transaction:X}=await $.handler({wallet:n.name,chain:e.from.chain,transaction:JSON.stringify(z)}),Z=await _(t,"transaction_send",{transaction:X,message:`Approve ${c.amountIn.symbol}`,chain:e.from.chain});if(!Z.signature)throw new Error(`Approval failed: ${Z.message}`);process.stderr.write(`Approval sent. Waiting for confirmation...
25
- `),await new Promise(_e=>setTimeout(_e,5e3)),c=await _(t,"swaps_transaction_build",o)}let l="base64"in c.transaction?c.transaction.base64:JSON.stringify(c.transaction),{transaction:b}=await $.handler({wallet:n.name,chain:e.from.chain,transaction:l}),y=await _(t,"transaction_send",{transaction:b,message:c.message,chain:e.from.chain});if(!y.signature)throw new Error(`Transaction send failed: ${y.message}`);try{await _(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 kt=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 St=s(kt,async e=>pe.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 Tt=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 Pt=s(Tt,async e=>{let t=k(),n=await P.handler({wallet:e.wallet}),i=n.addresses[m[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[m[e.chain]]??e.to}catch{}let o=await _(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 $.handler({wallet:n.name,chain:e.chain,transaction:c}),l=await _(t,"transaction_send",{transaction:p,message:o.message,chain:e.chain});if(!l.signature)throw new Error(`Transaction send failed: ${l.message}`);return{signature:l.signature,message:o.message}});import{Keypair as Nn,VersionedTransaction as On,VersionedMessage as Ln}from"@solana/web3.js";import xt from"axios";import{wrapAxiosWithPayment as Ct}from"@x402/axios";import{x402Client as At}from"@x402/core/client";import{ExactSvmScheme as Wn}from"@x402/svm";import{registerExactEvmScheme as Vn}from"@x402/evm/exact/client";import{toClientEvmSigner as zn}from"@x402/evm";import{privateKeyToAccount as Hn}from"viem/accounts";import{createPublicClient as Mn,http as Fn}from"viem";import*as T from"viem/chains";import{z as g}from"zod";var jt=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:g.object({method:g.enum(["GET","POST","PUT","PATCH","DELETE"]).describe("HTTP method"),url:g.string().url().refine(e=>e.startsWith("https://"),{message:"URL must use HTTPS"}).refine(e=>{try{return!new URL(e).hostname.match(/^(localhost|127\.|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|169\.254\.|0\.0\.0\.0|\[::1\])/)}catch{return!1}},{message:"URL must not target private/internal addresses"}).describe("Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/x402/upgrade')"),body:g.record(g.any()).nullable().describe("Request body (for POST, PUT, PATCH)"),params:g.record(g.any()).nullable().describe("Query parameters"),wallet:g.string().describe("Wallet name or address to pay with"),chain:g.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:g.object({status:g.number().describe("HTTP status code"),data:g.any().describe("Response data"),headers:g.record(g.any()).describe("Response headers")})});var Kn="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",Gn={ethereum:T.mainnet,base:T.base,polygon:T.polygon,arbitrum:T.arbitrum,optimism:T.optimism};function Yn(e,t){let n=Nn.fromSecretKey(t),i={address:e,signTransactions:async c=>c.map(p=>{let l=new Uint8Array(p.messageBytes),b=Ln.deserialize(l),y=Object.keys(p.signatures).length,u=new On(b,new Array(y).fill(new Uint8Array(64)));u.sign([n]);let j=b.staticAccountKeys.findIndex(z=>z.toBase58()===e);if(j===-1)throw new Error(`Wallet ${e} is not a signer for this transaction`);return{[e]:u.signatures[j]}})},r=new At,o=new Wn(i);return r.register(Kn,o),r.registerV1("solana",o),Ct(xt.create(),r)}function Jn(e,t){let n=Hn(`0x${Buffer.from(e).toString("hex")}`),i=Gn[t]??T.base,r=Mn({chain:i,transport:Fn()}),o=zn(n,r),c=new At;return Vn(c,{signer:o}),Ct(xt.create(),c)}var le=s(jt,async({method:e,url:t,body:n,params:i,wallet:r,chain:o})=>{let c=f(r),p=o??"solana",{privateKey:l,address:b}=E(c,p),y=p==="solana"?Yn(b,l):Jn(l,p),u;switch(e){case"GET":u=await y.get(t,{params:i});break;case"POST":u=await y.post(t,n||{},{params:i});break;case"PUT":u=await y.put(t,n||{},{params:i});break;case"PATCH":u=await y.patch(t,n||{},{params:i});break;case"DELETE":u=await y.delete(t,{params:i});break;default:throw new Error(`Unsupported HTTP method: ${e}`)}return{status:u.status,data:u.data,headers:u.headers}});import{z as W}from"zod";var $t=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:W.object({wallet:W.string().describe("Local wallet name"),chain:d.describe("Chain to register (solana, ethereum, etc.)")}),output:W.object({success:W.literal(!0),address:W.string().describe("Registered wallet address"),chain:W.string().describe("Chain registered on")})});var It=s($t,async e=>{let t=k(),n=e.chain,i=await P.handler({wallet:e.wallet}),r=m[n],o=i.addresses[r];if(!o)throw new Error(`Wallet "${i.name}" has no ${r} address.`);let{message:c}=await ue(t,"virtual-account_wallet_registration-message_create",{wallet:o}),{signature:p}=await ce.handler({wallet:i.name,chain:n,message:c});return await _(t,"virtual-account_wallet_register",{wallet:o,message:c,signature:p,chain:n}),{success:!0,address:o,chain:n}});import{z as J}from"zod";var Rt=a({name:"login",description:"Send a login verification code to your email.",input:J.object({email:J.string().describe("Email address")}),output:J.object({email:J.string(),message:J.string()})});var qt=s(Rt,async e=>{let{baseUrl:t}=Q(),n=`${t}/login?email=${encodeURIComponent(e.email)}`;return{email:e.email,message:`Open this link to verify:
26
-
27
- ${n}
28
-
29
- Then run: mp verify --email ${e.email} --code <code>`}});import*as Et from"fs";import*as Dt from"os";import*as Bt from"path";import{z as V}from"zod";var Ut=a({name:"verify",description:"Verify login code and store encrypted credentials.",input:V.object({email:V.string().describe("Email address"),code:V.string().describe("Verification code")}),output:V.object({email:V.string(),message:V.string()})});var Xn=Bt.join(Dt.homedir(),".config","moonpay","consent.json");function Zn(){try{return JSON.parse(Et.readFileSync(Xn,"utf-8")).agentId??null}catch{return null}}var Nt=s(Ut,async e=>{let{baseUrl:t}=Q(),n=await Pe(t,"verify",{email:e.email,code:e.code}),i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt*1e3,baseUrl:t};Se(i);let r=Zn();return r&&Ee(r).catch(()=>{}),{email:e.email,message:"Logged in successfully."}});import{z as de}from"zod";var Ot=a({name:"logout",description:"Log out and clear stored credentials.",input:de.object({}),output:de.object({success:de.literal(!0),message:de.string()})});var Lt=s(Ot,async()=>(Te(),{success:!0,message:"Logged out."}));import{z as C}from"zod";var Wt=a({name:"upgrade",description:"Purchase a rate limit upgrade via x402. Increases your API rate limit. Requires login and a funded wallet.",input:C.object({duration:C.enum(["day","month"]).describe("Upgrade duration: day ($1 USDC, 24h) or month ($20 USDC, 30 days)"),wallet:C.string().describe("Wallet name or address to pay with"),chain:C.enum(["solana","base"]).describe("Chain to pay from. x402 payments accepted on Solana and Base.")}),output:C.object({duration:C.string(),expiresAt:C.string().describe("When the upgrade expires"),message:C.string()})});var Vt=s(Wt,async e=>{if(!await q())throw new Error("Login required to upgrade. Run `mp login` first.");let n=k(),i=await _(n,"user_retrieve",{}),r=await le.handler({method:"POST",url:`${n}/x402/upgrade`,body:{userId:i.id,duration:e.duration},params:null,wallet:e.wallet,chain:e.chain});if(r.status>=400){let o=r.data?.error??"Upgrade failed";throw new Error(o)}return r.data});var ic=[He,Ge,Xe,P,tt,it,ot,$,ce,dt,ft,bt,wt,St,pe,Pt,le,It,ae,Ve,qt,Nt,Lt,Vt];export{ue as a,ii as b,$e as c,Ve as d,ic as e};