@moonpay/cli 1.85.1 → 1.85.2

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 Ot,g as yt,j as Ct,m as Pt,n as It,o as kt,p as At}from"./chunk-JXIJ5G4H.js";var n=class extends Error{constructor(r,i,u){super(r);this.status=i;this.toolName=u;this.name="MoonPayError"}},c=class extends n{constructor(t="Authentication required"){super(t,401),this.name="AuthError"}},a=class extends n{constructor(t="Rate limit exceeded"){super(t,429),this.name="RateLimitError"}},l=class extends n{constructor(t,r){super(t,400,r),this.name="ValidationError"}},s=class extends n{constructor(t){super(`Tool not found: ${t}`,404,t),this.name="ToolNotFoundError"}},p=class extends n{constructor(t,r){super(`Tool "${t}" has been renamed to "${r}"`,410,t),this.name="ToolRenamedError",this.newName=r}};var Rt="https://agents.moonpay.com",ft=36e4,m=class{constructor(t={}){this.baseUrl=(t.baseUrl??Rt).replace(/\/$/,""),this.auth=t.auth??{type:"none"},this.timeout=t.timeout??ft,this.headers=t.headers??{}}async _call(t,r){let i=`${this.baseUrl}/api/tools/${encodeURIComponent(t)}`,u=await this.buildHeaders(),o=await fetch(i,{method:"POST",headers:u,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)});if(o.status===401&&this.auth.type==="bearer"&&this.auth.refreshToken)try{let gt=await this.auth.refreshToken();u.Authorization=`Bearer ${gt}`,o=await fetch(i,{method:"POST",headers:u,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)})}catch{throw new c("Token refresh failed")}return this.handleResponse(o,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 i;try{i=await t.json()}catch{i={error:t.statusText}}let u=i?.error??i?.message,o=typeof u=="string"?u:u?JSON.stringify(u):`Request failed with status ${t.status}`;switch(t.status){case 400:throw new l(o,r);case 401:throw new c(o);case 404:throw new s(r);case 410:throw new p(r,i?.newName??"unknown");case 429:throw new a(o);default:throw new n(o,t.status,r)}}};var v=class{constructor(t){this.client=t}create(t){return this.client._call("app_activation_create",t)}},_=class{constructor(t){this.client=t}get activation(){return new v(this.client)}},O=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 O(this.client)}},P=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 P(this.client)}},k=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_delegation_token_retrieve",t)}},g=class{constructor(t){this.client=t}get approve(){return new C(this.client)}get revoke(){return new I(this.client)}get token(){return new k(this.client)}},y=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)}},A=class{constructor(t){this.client=t}list(t){return this.client._call("card_transaction_list",t)}},R=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_user_retrieve",t)}},f=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)}},w=class{constructor(t){this.client=t}get delegation(){return new g(this.client)}get onboarding(){return new y(this.client)}get transaction(){return new A(this.client)}get user(){return new R(this.client)}get wallet(){return new f(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)}},T=class{constructor(t){this.client=t}list(t){return this.client._call("chain_list",t)}retrieve(t){return this.client._call("chain_retrieve",t)}},V=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)}},M=class{constructor(t){this.client=t}get activation(){return new V(this.client)}},L=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)}},x=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)}},b=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)}},S=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)}},B=class{constructor(t){this.client=t}get cart(){return new L(this.client)}get checkout(){return new x(this.client)}get product(){return new b(this.client)}get store(){return new S(this.client)}search(t){return this.client._call("commerce_search",t)}},U=class{constructor(t){this.client=t}list(t){return this.client._call("deposit_transaction_list",t)}},W=class{constructor(t){this.client=t}get transaction(){return new U(this.client)}create(t){return this.client._call("deposit_create",t)}retrieve(t){return this.client._call("deposit_retrieve",t)}},E=class{constructor(t){this.client=t}create(t){return this.client._call("feedback_create",t)}},D=class{constructor(t){this.client=t}buy(t){return this.client._call("gateway_buy",t)}search(t){return this.client._call("gateway_search",t)}},F=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)}},z=class{constructor(t){this.client=t}get position(){return new F(this.client)}},$=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)}},G=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_ohlcv_list",t)}},K=class{constructor(t){this.client=t}get ohlcv(){return new G(this.client)}},H=class{constructor(t){this.client=t}retrieve(t){return this.client._call("prediction-market_order_retrieve",t)}},j=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)}},J=class{constructor(t){this.client=t}get event(){return new $(this.client)}get market(){return new K(this.client)}get order(){return new H(this.client)}get position(){return new j(this.client)}},q=class{constructor(t){this.client=t}check(t){return this.client._call("solana_balance_check",t)}},Q=class{constructor(t){this.client=t}get balance(){return new q(this.client)}},X=class{constructor(t){this.client=t}build(t){return this.client._call("swaps_transaction_build",t)}},Y=class{constructor(t){this.client=t}get transaction(){return new X(this.client)}},Z=class{constructor(t){this.client=t}list(t){return this.client._call("token_balance_list",t)}},N=class{constructor(t){this.client=t}list(t){return this.client._call("token_holder_list",t)}},tt=class{constructor(t){this.client=t}list(t){return this.client._call("token_ohlcv_list",t)}},et=class{constructor(t){this.client=t}list(t){return this.client._call("token_trending_list",t)}},rt=class{constructor(t){this.client=t}get balance(){return new Z(this.client)}get holder(){return new N(this.client)}get ohlcv(){return new tt(this.client)}get trending(){return new et(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)}},nt=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)}},it=class{constructor(t){this.client=t}retrieve(t){return this.client._call("user_retrieve",t)}},ut=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)}},ot=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)}},ct=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)}},at=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)}},lt=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)}},st=class{constructor(t){this.client=t}get payment(){return new lt(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)}},pt=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_transaction_list",t)}},ht=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)}},mt=class{constructor(t){this.client=t}get agreement(){return new ut(this.client)}get bankAccount(){return new ot(this.client)}get kyc(){return new ct(this.client)}get offramp(){return new at(this.client)}get onramp(){return new st(this.client)}get transaction(){return new pt(this.client)}get wallet(){return new ht(this.client)}create(t){return this.client._call("virtual-account_create",t)}retrieve(t){return this.client._call("virtual-account_retrieve",t)}},dt=class{constructor(t){this.client=t}list(t){return this.client._call("wallet_activity_list",t)}},vt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("wallet_pnl_retrieve",t)}},_t=class{constructor(t){this.client=t}get activity(){return new dt(this.client)}get pnl(){return new vt(this.client)}discover(t){return this.client._call("wallet_discover",t)}},h=class extends m{constructor(t={}){super(t)}get app(){return new _(this)}get card(){return new w(this)}get chain(){return new T(this)}get cli(){return new M(this)}get commerce(){return new B(this)}get deposit(){return new W(this)}get feedback(){return new E(this)}get gateway(){return new D(this)}get polymarket(){return new z(this)}get predictionMarket(){return new J(this)}get solana(){return new Q(this)}get swaps(){return new Y(this)}get token(){return new rt(this)}get transaction(){return new nt(this)}get user(){return new it(this)}get virtualAccount(){return new mt(this)}get wallet(){return new _t(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)}};At();yt();var d=null;function wt(){return d||(d=new h({baseUrl:Pt(),auth:{type:"bearer",getToken:kt,refreshToken:async()=>{let e=Ct();if(!e?.refreshToken)throw new Error("No refresh token available");return(await It(e)).accessToken}},headers:Ot()})),d}var Ft=new Proxy({},{get(e,t){return Reflect.get(wt(),t)}});function zt(){d=null}export{h as a,Ft as b,zt as c};