@moonpay/cli 1.95.2 → 1.95.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{f as Ht,g as $t,j as Ut,m as Wt,n as Et,o as Dt,p as Gt}from"./chunk-XVRE4KRD.js";var n=class extends Error{constructor(r,u,i){super(r);this.status=u;this.toolName=i;this.name="MoonPayError"}},o=class extends n{constructor(t="Authentication required"){super(t,401),this.name="AuthError"}},c=class extends n{constructor(t="Rate limit exceeded"){super(t,429),this.name="RateLimitError"}},a=class extends n{constructor(t,r){super(t,400,r),this.name="ValidationError"}},l=class extends n{constructor(t){super(`Tool not found: ${t}`,404,t),this.name="ToolNotFoundError"}},s=class extends n{constructor(t,r){super(`Tool "${t}" has been renamed to "${r}"`,410,t),this.name="ToolRenamedError",this.newName=r}};var Kt="https://agents.moonpay.com",jt=36e4;function Ft(e){return!!e&&typeof e=="object"}function d(e){if(typeof e=="string")return e.length>0&&e!=="[object Object]"?e:void 0;if(typeof e=="number"||typeof e=="boolean")return String(e);if(!Ft(e))return;let t=d(e.error)??d(e.message)??d(e.errorMessage);if(t)return t;try{return JSON.stringify(e)}catch{return}}function Jt(e,t){if(!Ft(e))return;let r=e[t];return typeof r=="string"?r:void 0}var h=class{constructor(t={}){this.baseUrl=(t.baseUrl??Kt).replace(/\/$/,""),this.auth=t.auth??{type:"none"},this.timeout=t.timeout??jt,this.headers=t.headers??{}}async _call(t,r){let u=`${this.baseUrl}/api/tools/${encodeURIComponent(t)}`,i=await this.buildHeaders(),_=await fetch(u,{method:"POST",headers:i,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)});if(_.status===401&&this.auth.type==="bearer"&&this.auth.refreshToken)try{let zt=await this.auth.refreshToken();i.Authorization=`Bearer ${zt}`,_=await fetch(u,{method:"POST",headers:i,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)})}catch{throw new o("Token refresh failed")}return this.handleResponse(_,t)}async buildHeaders(){let t={"Content-Type":"application/json",...this.headers};if(this.auth.type==="bearer"){let r=await this.auth.getToken();r&&(t.Authorization=`Bearer ${r}`)}return t}async handleResponse(t,r){if(t.ok)return t.json();let u;try{u=await t.json()}catch{u={error:t.statusText}}let i=d(u)??`Request failed with status ${t.status}`;switch(t.status){case 400:throw new a(i,r);case 401:throw new o(i);case 404:throw new l(r);case 410:throw new s(r,Jt(u,"newName")??"unknown");case 429:throw new c(i);default:throw new n(i,t.status,r)}}};var O=class{constructor(t){this.client=t}create(t){return this.client._call("app_activation_create",t)}},P=class{constructor(t){this.client=t}get activation(){return new O(this.client)}},v=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_approve_transaction_build",t)}},C=class{constructor(t){this.client=t}get transaction(){return new v(this.client)}},y=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_revoke_transaction_build",t)}},I=class{constructor(t){this.client=t}get transaction(){return new y(this.client)}},g=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_delegation_token_retrieve",t)}},k=class{constructor(t){this.client=t}get approve(){return new C(this.client)}get revoke(){return new I(this.client)}get token(){return new g(this.client)}},A=class{constructor(t){this.client=t}check(t){return this.client._call("card_onboarding_check",t)}finish(t){return this.client._call("card_onboarding_finish",t)}start(t){return this.client._call("card_onboarding_start",t)}},w=class{constructor(t){this.client=t}list(t){return this.client._call("card_transaction_list",t)}},f=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_user_retrieve",t)}},R=class{constructor(t){this.client=t}check(t){return this.client._call("card_wallet_check",t)}link(t){return this.client._call("card_wallet_link",t)}list(t){return this.client._call("card_wallet_list",t)}unlink(t){return this.client._call("card_wallet_unlink",t)}},L=class{constructor(t){this.client=t}get delegation(){return new k(this.client)}get onboarding(){return new A(this.client)}get transaction(){return new w(this.client)}get user(){return new f(this.client)}get wallet(){return new R(this.client)}create(t){return this.client._call("card_create",t)}freeze(t){return this.client._call("card_freeze",t)}retrieve(t){return this.client._call("card_retrieve",t)}reveal(t){return this.client._call("card_reveal",t)}unfreeze(t){return this.client._call("card_unfreeze",t)}},M=class{constructor(t){this.client=t}list(t){return this.client._call("chain_list",t)}retrieve(t){return this.client._call("chain_retrieve",t)}},T=class{constructor(t){this.client=t}create(t){return this.client._call("cli_activation_create",t)}update(t){return this.client._call("cli_activation_update",t)}},x=class{constructor(t){this.client=t}get activation(){return new T(this.client)}},V=class{constructor(t){this.client=t}add(t){return this.client._call("commerce_cart_add",t)}remove(t){return this.client._call("commerce_cart_remove",t)}retrieve(t){return this.client._call("commerce_cart_retrieve",t)}update(t){return this.client._call("commerce_cart_update",t)}},b=class{constructor(t){this.client=t}pay(t){return this.client._call("commerce_checkout_pay",t)}start(t){return this.client._call("commerce_checkout_start",t)}},S=class{constructor(t){this.client=t}retrieve(t){return this.client._call("commerce_product_retrieve",t)}search(t){return this.client._call("commerce_product_search",t)}},B=class{constructor(t){this.client=t}list(t){return this.client._call("commerce_store_list",t)}retrieve(t){return this.client._call("commerce_store_retrieve",t)}},q=class{constructor(t){this.client=t}get cart(){return new V(this.client)}get checkout(){return new b(this.client)}get product(){return new S(this.client)}get store(){return new B(this.client)}search(t){return this.client._call("commerce_search",t)}},H=class{constructor(t){this.client=t}list(t){return this.client._call("deposit_transaction_list",t)}},U=class{constructor(t){this.client=t}get transaction(){return new H(this.client)}create(t){return this.client._call("deposit_create",t)}retrieve(t){return this.client._call("deposit_retrieve",t)}},W=class{constructor(t){this.client=t}create(t){return this.client._call("feedback_create",t)}},E=class{constructor(t){this.client=t}buy(t){return this.client._call("gateway_buy",t)}search(t){return this.client._call("gateway_search",t)}},D=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_balance_retrieve",t)}},F=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_candle_list",t)}},z=class{constructor(t){this.client=t}create(t){return this.client._call("hyperliquid_deposit_create",t)}},$=class{constructor(t){this.client=t}submit(t){return this.client._call("hyperliquid_exchange_submit",t)}},G=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_funding_payment_list",t)}},K=class{constructor(t){this.client=t}get payment(){return new G(this.client)}},j=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_market_list",t)}},J=class{constructor(t){this.client=t}create(t){return this.client._call("hyperliquid_order_create",t)}list(t){return this.client._call("hyperliquid_order_list",t)}},Q=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_orderbook_retrieve",t)}},X=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_position_list",t)}},Y=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_predicted_funding_list",t)}},Z=class{constructor(t){this.client=t}get funding(){return new Y(this.client)}},N=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_price_list",t)}},tt=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_trade_list",t)}},et=class{constructor(t){this.client=t}get balance(){return new D(this.client)}get candle(){return new F(this.client)}get deposit(){return new z(this.client)}get exchange(){return new $(this.client)}get funding(){return new K(this.client)}get market(){return new j(this.client)}get order(){return new J(this.client)}get orderbook(){return new Q(this.client)}get position(){return new X(this.client)}get predicted(){return new Z(this.client)}get price(){return new N(this.client)}get trade(){return new tt(this.client)}},rt=class{constructor(t){this.client=t}prepare(t){return this.client._call("polymarket_balance_withdraw_prepare",t)}submit(t){return this.client._call("polymarket_balance_withdraw_submit",t)}},nt=class{constructor(t){this.client=t}get withdraw(){return new rt(this.client)}},it=class{constructor(t){this.client=t}redeem(t){return this.client._call("polymarket_position_redeem",t)}sell(t){return this.client._call("polymarket_position_sell",t)}},ut=class{constructor(t){this.client=t}get balance(){return new nt(this.client)}get position(){return new it(this.client)}},ot=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_event_list",t)}retrieve(t){return this.client._call("prediction-market_event_retrieve",t)}search(t){return this.client._call("prediction-market_event_search",t)}},ct=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_ohlcv_list",t)}},at=class{constructor(t){this.client=t}get ohlcv(){return new ct(this.client)}},lt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("prediction-market_order_retrieve",t)}},st=class{constructor(t){this.client=t}buy(t){return this.client._call("prediction-market_position_buy",t)}list(t){return this.client._call("prediction-market_position_list",t)}redeem(t){return this.client._call("prediction-market_position_redeem",t)}sell(t){return this.client._call("prediction-market_position_sell",t)}},pt=class{constructor(t){this.client=t}get event(){return new ot(this.client)}get market(){return new at(this.client)}get order(){return new lt(this.client)}get position(){return new st(this.client)}},dt=class{constructor(t){this.client=t}check(t){return this.client._call("solana_balance_check",t)}},ht=class{constructor(t){this.client=t}get balance(){return new dt(this.client)}},mt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("swaps_quote_retrieve",t)}},_t=class{constructor(t){this.client=t}build(t){return this.client._call("swaps_transaction_build",t)}},Ot=class{constructor(t){this.client=t}get quote(){return new mt(this.client)}get transaction(){return new _t(this.client)}},Pt=class{constructor(t){this.client=t}list(t){return this.client._call("token_activity_list",t)}},vt=class{constructor(t){this.client=t}list(t){return this.client._call("token_balance_list",t)}},Ct=class{constructor(t){this.client=t}list(t){return this.client._call("token_holder_list",t)}},yt=class{constructor(t){this.client=t}list(t){return this.client._call("token_ohlcv_list",t)}},It=class{constructor(t){this.client=t}list(t){return this.client._call("token_trending_list",t)}},gt=class{constructor(t){this.client=t}get activity(){return new Pt(this.client)}get balance(){return new vt(this.client)}get holder(){return new Ct(this.client)}get ohlcv(){return new yt(this.client)}get trending(){return new It(this.client)}check(t){return this.client._call("token_check",t)}list(t){return this.client._call("token_list",t)}retrieve(t){return this.client._call("token_retrieve",t)}search(t){return this.client._call("token_search",t)}},kt=class{constructor(t){this.client=t}list(t){return this.client._call("transaction_list",t)}prepare(t){return this.client._call("transaction_prepare",t)}register(t){return this.client._call("transaction_register",t)}retrieve(t){return this.client._call("transaction_retrieve",t)}send(t){return this.client._call("transaction_send",t)}},At=class{constructor(t){this.client=t}retrieve(t){return this.client._call("user_retrieve",t)}},wt=class{constructor(t){this.client=t}accept(t){return this.client._call("virtual-account_agreement_accept",t)}list(t){return this.client._call("virtual-account_agreement_list",t)}},ft=class{constructor(t){this.client=t}delete(t){return this.client._call("virtual-account_bank-account_delete",t)}list(t){return this.client._call("virtual-account_bank-account_list",t)}register(t){return this.client._call("virtual-account_bank-account_register",t)}retrieve(t){return this.client._call("virtual-account_bank-account_retrieve",t)}},Rt=class{constructor(t){this.client=t}continue(t){return this.client._call("virtual-account_kyc_continue",t)}restart(t){return this.client._call("virtual-account_kyc_restart",t)}},Lt=class{constructor(t){this.client=t}cancel(t){return this.client._call("virtual-account_offramp_cancel",t)}create(t){return this.client._call("virtual-account_offramp_create",t)}initiate(t){return this.client._call("virtual-account_offramp_initiate",t)}list(t){return this.client._call("virtual-account_offramp_list",t)}retrieve(t){return this.client._call("virtual-account_offramp_retrieve",t)}update(t){return this.client._call("virtual-account_offramp_update",t)}},Mt=class{constructor(t){this.client=t}create(t){return this.client._call("virtual-account_onramp_payment_create",t)}retrieve(t){return this.client._call("virtual-account_onramp_payment_retrieve",t)}},Tt=class{constructor(t){this.client=t}get payment(){return new Mt(this.client)}cancel(t){return this.client._call("virtual-account_onramp_cancel",t)}create(t){return this.client._call("virtual-account_onramp_create",t)}list(t){return this.client._call("virtual-account_onramp_list",t)}retrieve(t){return this.client._call("virtual-account_onramp_retrieve",t)}update(t){return this.client._call("virtual-account_onramp_update",t)}},xt=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_transaction_list",t)}},Vt=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_wallet_list",t)}register(t){return this.client._call("virtual-account_wallet_register",t)}},bt=class{constructor(t){this.client=t}get agreement(){return new wt(this.client)}get bankAccount(){return new ft(this.client)}get kyc(){return new Rt(this.client)}get offramp(){return new Lt(this.client)}get onramp(){return new Tt(this.client)}get transaction(){return new xt(this.client)}get wallet(){return new Vt(this.client)}create(t){return this.client._call("virtual-account_create",t)}retrieve(t){return this.client._call("virtual-account_retrieve",t)}},St=class{constructor(t){this.client=t}list(t){return this.client._call("wallet_activity_list",t)}},Bt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("wallet_pnl_retrieve",t)}},qt=class{constructor(t){this.client=t}get activity(){return new St(this.client)}get pnl(){return new Bt(this.client)}discover(t){return this.client._call("wallet_discover",t)}},p=class extends h{constructor(t={}){super(t)}get app(){return new P(this)}get card(){return new L(this)}get chain(){return new M(this)}get cli(){return new x(this)}get commerce(){return new q(this)}get deposit(){return new U(this)}get feedback(){return new W(this)}get gateway(){return new E(this)}get hyperliquid(){return new et(this)}get polymarket(){return new ut(this)}get predictionMarket(){return new pt(this)}get solana(){return new ht(this)}get swaps(){return new Ot(this)}get token(){return new gt(this)}get transaction(){return new kt(this)}get user(){return new At(this)}get virtualAccount(){return new bt(this)}get wallet(){return new qt(this)}buy(t){return this._call("buy",t)}login(t){return this._call("login",t)}refresh(t){return this._call("refresh",t)}verify(t){return this._call("verify",t)}};Gt();$t();var m=null;function Qt(){return m||(m=new p({baseUrl:Wt(),auth:{type:"bearer",getToken:Dt,refreshToken:async()=>{let e=Ut();if(!e?.refreshToken)throw new Error("No refresh token available");return(await Et(e)).accessToken}},headers:Ht()})),m}var ae=new Proxy({},{get(e,t){return Reflect.get(Qt(),t)}});function le(){m=null}export{p as a,ae as b,le as c};
@@ -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 m,d as c,g as a}from"./chunk-BDM2U2ST.js";import{b as f}from"./chunk-WKZIYMFB.js";import{zodToJsonSchema as y}from"zod-to-json-schema";var l=new Map(a.map(o=>[o.schema.name,o]));function h(o){let e=o.inputSchema;if(e.$ref&&e.definitions){let n=e.$ref.replace("#/definitions/","");return e.definitions[n]??e}return e}function g(){let o=a.map(n=>({name:n.schema.name,description:n.schema.description,inputSchema:c(y(n.schema.input))})),e=new Map;for(let n of m){if(l.has(n.name))continue;let r=h(n),t=c({type:"object",properties:r.properties??{},...r.required?{required:r.required}:{},...r.additionalProperties!==void 0?{additionalProperties:r.additionalProperties}:{}});e.set(n.name,t.properties??{}),o.push({name:n.name,description:n.description,inputSchema:t})}return{toolDefs:o,toolDefMap:new Map(o.map(n=>[n.name,n])),remotePropsMap:e}}var i=g();function S(){return i.toolDefs}function R(o){return i.toolDefMap.has(o)}function w(o,e){let n=l.get(o);if(!n)return e;let r=n.schema.input.shape??{};for(let[t,u]of Object.entries(r))e[t]===void 0&&u._def.typeName==="ZodNullable"&&(e[t]=null);return e}function T(o,e){let n=i.remotePropsMap.get(o)??{};for(let[r,t]of Object.entries(n))e[r]===void 0&&(Array.isArray(t.type)?t.type.includes("null"):t.anyOf?.some(d=>d.type==="null"))&&(e[r]=null),(t.type==="number"||t.type==="integer"||Array.isArray(t.type)&&t.type.some(s=>s==="number"||s==="integer")||t.anyOf?.some(s=>s.type==="number"||s.type==="integer"))&&typeof e[r]=="string"&&(e[r]=Number(e[r]));return e}var p=class extends Error{constructor(e){super(`Unknown tool: ${e}`),this.name="UnknownToolError"}};async function x(o,e={}){if(!i.toolDefMap.has(o))throw new p(o);let n=l.get(o);if(n){let t=w(o,{...e});return n.handler(t)}let r=T(o,{...e});return f._call(o,r)}export{S as a,R as b,p as c,x as d};
2
+ import{a as m,d as c,g as a}from"./chunk-PNZU6NOU.js";import{b as f}from"./chunk-BQJYZQYQ.js";import{zodToJsonSchema as y}from"zod-to-json-schema";var l=new Map(a.map(o=>[o.schema.name,o]));function h(o){let e=o.inputSchema;if(e.$ref&&e.definitions){let n=e.$ref.replace("#/definitions/","");return e.definitions[n]??e}return e}function g(){let o=a.map(n=>({name:n.schema.name,description:n.schema.description,inputSchema:c(y(n.schema.input))})),e=new Map;for(let n of m){if(l.has(n.name))continue;let r=h(n),t=c({type:"object",properties:r.properties??{},...r.required?{required:r.required}:{},...r.additionalProperties!==void 0?{additionalProperties:r.additionalProperties}:{}});e.set(n.name,t.properties??{}),o.push({name:n.name,description:n.description,inputSchema:t})}return{toolDefs:o,toolDefMap:new Map(o.map(n=>[n.name,n])),remotePropsMap:e}}var i=g();function S(){return i.toolDefs}function R(o){return i.toolDefMap.has(o)}function w(o,e){let n=l.get(o);if(!n)return e;let r=n.schema.input.shape??{};for(let[t,u]of Object.entries(r))e[t]===void 0&&u._def.typeName==="ZodNullable"&&(e[t]=null);return e}function T(o,e){let n=i.remotePropsMap.get(o)??{};for(let[r,t]of Object.entries(n))e[r]===void 0&&(Array.isArray(t.type)?t.type.includes("null"):t.anyOf?.some(d=>d.type==="null"))&&(e[r]=null),(t.type==="number"||t.type==="integer"||Array.isArray(t.type)&&t.type.some(s=>s==="number"||s==="integer")||t.anyOf?.some(s=>s.type==="number"||s.type==="integer"))&&typeof e[r]=="string"&&(e[r]=Number(e[r]));return e}var p=class extends Error{constructor(e){super(`Unknown tool: ${e}`),this.name="UnknownToolError"}};async function x(o,e={}){if(!i.toolDefMap.has(o))throw new p(o);let n=l.get(o);if(n){let t=w(o,{...e});return n.handler(t)}let r=T(o,{...e});return f._call(o,r)}export{S as a,R as b,p as c,x as d};