@moonpay/cli 1.80.0 → 1.81.1
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.
- package/dist/{chunk-5HSFWT26.js → chunk-BZQ767AV.js} +2 -2
- package/dist/{chunk-RMFER25H.js → chunk-EMAK4COO.js} +1 -1
- package/dist/{chunk-56V32C2Y.js → chunk-NVXIV2XH.js} +9 -9
- package/dist/{chunk-X2FQHRHK.js → chunk-RUXMHUNO.js} +1 -1
- package/dist/{client-D55L5TLC.js → client-DJLXQHBE.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{ledger-PERLCGY5.js → ledger-R6GCILUS.js} +2 -2
- package/dist/{mcp-Z4DMHO22.js → mcp-4FKAQTPB.js} +1 -1
- package/dist/{store-HOELKB2W.js → store-QEALYBX5.js} +1 -1
- package/package.json +1 -1
- package/skills/moonpay-fund-polymarket/SKILL.md +2 -2
- package/skills/moonpay-kalshi/SKILL.md +25 -2
- package/skills/moonpay-missions/SKILL.md +1 -1
- package/skills/moonpay-polymarket/SKILL.md +8 -0
- package/skills/moonpay-polymarket-feeds/SKILL.md +1 -1
- package/skills/moonpay-prediction-market/SKILL.md +4 -0
- package/skills/moonpay-artifact-builder/SKILL.md +0 -667
- package/skills/moonpay-automation-builder/SKILL.md +0 -148
- package/skills/moonpay-onboarding/SKILL.md +0 -171
- package/skills/moonpay-skill-builder/SKILL.md +0 -157
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{f as Rt,g as Vt,j as ft,m as Lt,n as wt,o as Tt,p as xt}from"./chunk-RMFER25H.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 bt="https://agents.moonpay.com",St=36e4,h=class{constructor(t={}){this.baseUrl=(t.baseUrl??bt).replace(/\/$/,""),this.auth=t.auth??{type:"none"},this.timeout=t.timeout??St,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 Mt=await this.auth.refreshToken();u.Authorization=`Bearer ${Mt}`,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 _=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_approve_transaction_build",t)}},O=class{constructor(t){this.client=t}get transaction(){return new _(this.client)}},v=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_revoke_transaction_build",t)}},P=class{constructor(t){this.client=t}get transaction(){return new v(this.client)}},C=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_delegation_token_retrieve",t)}},y=class{constructor(t){this.client=t}get approve(){return new O(this.client)}get revoke(){return new P(this.client)}get token(){return new C(this.client)}},I=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)}},g=class{constructor(t){this.client=t}list(t){return this.client._call("card_transaction_list",t)}},k=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_user_retrieve",t)}},A=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)}},R=class{constructor(t){this.client=t}get delegation(){return new y(this.client)}get onboarding(){return new I(this.client)}get transaction(){return new g(this.client)}get user(){return new k(this.client)}get wallet(){return new A(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)}},f=class{constructor(t){this.client=t}list(t){return this.client._call("chain_list",t)}retrieve(t){return this.client._call("chain_retrieve",t)}},L=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)}},w=class{constructor(t){this.client=t}get activation(){return new L(this.client)}},T=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)}},M=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)}},V=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)}},x=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 T(this.client)}get checkout(){return new M(this.client)}get product(){return new V(this.client)}get store(){return new x(this.client)}search(t){return this.client._call("commerce_search",t)}},S=class{constructor(t){this.client=t}list(t){return this.client._call("deposit_transaction_list",t)}},B=class{constructor(t){this.client=t}get transaction(){return new S(this.client)}create(t){return this.client._call("deposit_create",t)}retrieve(t){return this.client._call("deposit_retrieve",t)}},U=class{constructor(t){this.client=t}create(t){return this.client._call("feedback_create",t)}},q=class{constructor(t){this.client=t}buy(t){return this.client._call("gateway_buy",t)}search(t){return this.client._call("gateway_search",t)}},H=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_balance_retrieve",t)}},W=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_candle_list",t)}},E=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_funding_payment_list",t)}},D=class{constructor(t){this.client=t}get payment(){return new E(this.client)}},F=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_market_list",t)}},z=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_order_list",t)}},$=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_orderbook_retrieve",t)}},G=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_position_list",t)}},K=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_predicted_funding_list",t)}},j=class{constructor(t){this.client=t}get funding(){return new K(this.client)}},J=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_price_list",t)}},Q=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_trade_list",t)}},X=class{constructor(t){this.client=t}get balance(){return new H(this.client)}get candle(){return new W(this.client)}get funding(){return new D(this.client)}get market(){return new F(this.client)}get order(){return new z(this.client)}get orderbook(){return new $(this.client)}get position(){return new G(this.client)}get predicted(){return new j(this.client)}get price(){return new J(this.client)}get trade(){return new Q(this.client)}},Y=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 Y(this.client)}},N=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)}},tt=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_ohlcv_list",t)}},et=class{constructor(t){this.client=t}get ohlcv(){return new tt(this.client)}},rt=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)}},nt=class{constructor(t){this.client=t}get event(){return new N(this.client)}get market(){return new et(this.client)}get position(){return new rt(this.client)}},it=class{constructor(t){this.client=t}build(t){return this.client._call("swaps_transaction_build",t)}},ut=class{constructor(t){this.client=t}get transaction(){return new it(this.client)}},ot=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)}},at=class{constructor(t){this.client=t}list(t){return this.client._call("token_ohlcv_list",t)}},lt=class{constructor(t){this.client=t}list(t){return this.client._call("token_trending_list",t)}},st=class{constructor(t){this.client=t}get balance(){return new ot(this.client)}get holder(){return new ct(this.client)}get ohlcv(){return new at(this.client)}get trending(){return new lt(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)}},pt=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)}},dt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("user_retrieve",t)}},ht=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)}},mt=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)}},_t=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)}},Ot=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)}},vt=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)}},Pt=class{constructor(t){this.client=t}get payment(){return new vt(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)}},Ct=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_transaction_list",t)}},yt=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)}},It=class{constructor(t){this.client=t}get agreement(){return new ht(this.client)}get bankAccount(){return new mt(this.client)}get kyc(){return new _t(this.client)}get offramp(){return new Ot(this.client)}get onramp(){return new Pt(this.client)}get transaction(){return new Ct(this.client)}get wallet(){return new yt(this.client)}create(t){return this.client._call("virtual-account_create",t)}retrieve(t){return this.client._call("virtual-account_retrieve",t)}},gt=class{constructor(t){this.client=t}list(t){return this.client._call("wallet_activity_list",t)}},kt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("wallet_pnl_retrieve",t)}},At=class{constructor(t){this.client=t}get activity(){return new gt(this.client)}get pnl(){return new kt(this.client)}discover(t){return this.client._call("wallet_discover",t)}},d=class extends h{constructor(t={}){super(t)}get card(){return new R(this)}get chain(){return new f(this)}get cli(){return new w(this)}get commerce(){return new b(this)}get deposit(){return new B(this)}get feedback(){return new U(this)}get gateway(){return new q(this)}get hyperliquid(){return new X(this)}get polymarket(){return new Z(this)}get predictionMarket(){return new nt(this)}get swaps(){return new ut(this)}get token(){return new st(this)}get transaction(){return new pt(this)}get user(){return new dt(this)}get virtualAccount(){return new It(this)}get wallet(){return new At(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)}};xt();Vt();var m=null;function Bt(){return m||(m=new d({baseUrl:Lt(),auth:{type:"bearer",getToken:Tt,refreshToken:async()=>{let e=ft();if(!e?.refreshToken)throw new Error("No refresh token available");return(await wt(e)).accessToken}},headers:Rt()})),m}var Jt=new Proxy({},{get(e,t){return Reflect.get(Bt(),t)}});function Qt(){m=null}export{d as a,Jt as b,Qt as c};
|
|
2
|
+
import{f as Rt,g as Vt,j as ft,m as Lt,n as wt,o as Tt,p as xt}from"./chunk-EMAK4COO.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 bt="https://agents.moonpay.com",St=36e4,h=class{constructor(t={}){this.baseUrl=(t.baseUrl??bt).replace(/\/$/,""),this.auth=t.auth??{type:"none"},this.timeout=t.timeout??St,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 Mt=await this.auth.refreshToken();u.Authorization=`Bearer ${Mt}`,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 _=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_approve_transaction_build",t)}},O=class{constructor(t){this.client=t}get transaction(){return new _(this.client)}},v=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_revoke_transaction_build",t)}},P=class{constructor(t){this.client=t}get transaction(){return new v(this.client)}},C=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_delegation_token_retrieve",t)}},y=class{constructor(t){this.client=t}get approve(){return new O(this.client)}get revoke(){return new P(this.client)}get token(){return new C(this.client)}},I=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)}},g=class{constructor(t){this.client=t}list(t){return this.client._call("card_transaction_list",t)}},k=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_user_retrieve",t)}},A=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)}},R=class{constructor(t){this.client=t}get delegation(){return new y(this.client)}get onboarding(){return new I(this.client)}get transaction(){return new g(this.client)}get user(){return new k(this.client)}get wallet(){return new A(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)}},f=class{constructor(t){this.client=t}list(t){return this.client._call("chain_list",t)}retrieve(t){return this.client._call("chain_retrieve",t)}},L=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)}},w=class{constructor(t){this.client=t}get activation(){return new L(this.client)}},T=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)}},M=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)}},V=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)}},x=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 T(this.client)}get checkout(){return new M(this.client)}get product(){return new V(this.client)}get store(){return new x(this.client)}search(t){return this.client._call("commerce_search",t)}},S=class{constructor(t){this.client=t}list(t){return this.client._call("deposit_transaction_list",t)}},B=class{constructor(t){this.client=t}get transaction(){return new S(this.client)}create(t){return this.client._call("deposit_create",t)}retrieve(t){return this.client._call("deposit_retrieve",t)}},U=class{constructor(t){this.client=t}create(t){return this.client._call("feedback_create",t)}},q=class{constructor(t){this.client=t}buy(t){return this.client._call("gateway_buy",t)}search(t){return this.client._call("gateway_search",t)}},H=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_balance_retrieve",t)}},W=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_candle_list",t)}},E=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_funding_payment_list",t)}},D=class{constructor(t){this.client=t}get payment(){return new E(this.client)}},F=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_market_list",t)}},z=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_order_list",t)}},$=class{constructor(t){this.client=t}retrieve(t){return this.client._call("hyperliquid_orderbook_retrieve",t)}},G=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_position_list",t)}},K=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_predicted_funding_list",t)}},j=class{constructor(t){this.client=t}get funding(){return new K(this.client)}},J=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_price_list",t)}},Q=class{constructor(t){this.client=t}list(t){return this.client._call("hyperliquid_trade_list",t)}},X=class{constructor(t){this.client=t}get balance(){return new H(this.client)}get candle(){return new W(this.client)}get funding(){return new D(this.client)}get market(){return new F(this.client)}get order(){return new z(this.client)}get orderbook(){return new $(this.client)}get position(){return new G(this.client)}get predicted(){return new j(this.client)}get price(){return new J(this.client)}get trade(){return new Q(this.client)}},Y=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 Y(this.client)}},N=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)}},tt=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_ohlcv_list",t)}},et=class{constructor(t){this.client=t}get ohlcv(){return new tt(this.client)}},rt=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)}},nt=class{constructor(t){this.client=t}get event(){return new N(this.client)}get market(){return new et(this.client)}get position(){return new rt(this.client)}},it=class{constructor(t){this.client=t}build(t){return this.client._call("swaps_transaction_build",t)}},ut=class{constructor(t){this.client=t}get transaction(){return new it(this.client)}},ot=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)}},at=class{constructor(t){this.client=t}list(t){return this.client._call("token_ohlcv_list",t)}},lt=class{constructor(t){this.client=t}list(t){return this.client._call("token_trending_list",t)}},st=class{constructor(t){this.client=t}get balance(){return new ot(this.client)}get holder(){return new ct(this.client)}get ohlcv(){return new at(this.client)}get trending(){return new lt(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)}},pt=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)}},dt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("user_retrieve",t)}},ht=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)}},mt=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)}},_t=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)}},Ot=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)}},vt=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)}},Pt=class{constructor(t){this.client=t}get payment(){return new vt(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)}},Ct=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_transaction_list",t)}},yt=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)}},It=class{constructor(t){this.client=t}get agreement(){return new ht(this.client)}get bankAccount(){return new mt(this.client)}get kyc(){return new _t(this.client)}get offramp(){return new Ot(this.client)}get onramp(){return new Pt(this.client)}get transaction(){return new Ct(this.client)}get wallet(){return new yt(this.client)}create(t){return this.client._call("virtual-account_create",t)}retrieve(t){return this.client._call("virtual-account_retrieve",t)}},gt=class{constructor(t){this.client=t}list(t){return this.client._call("wallet_activity_list",t)}},kt=class{constructor(t){this.client=t}retrieve(t){return this.client._call("wallet_pnl_retrieve",t)}},At=class{constructor(t){this.client=t}get activity(){return new gt(this.client)}get pnl(){return new kt(this.client)}discover(t){return this.client._call("wallet_discover",t)}},d=class extends h{constructor(t={}){super(t)}get card(){return new R(this)}get chain(){return new f(this)}get cli(){return new w(this)}get commerce(){return new b(this)}get deposit(){return new B(this)}get feedback(){return new U(this)}get gateway(){return new q(this)}get hyperliquid(){return new X(this)}get polymarket(){return new Z(this)}get predictionMarket(){return new nt(this)}get swaps(){return new ut(this)}get token(){return new st(this)}get transaction(){return new pt(this)}get user(){return new dt(this)}get virtualAccount(){return new It(this)}get wallet(){return new At(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)}};xt();Vt();var m=null;function Bt(){return m||(m=new d({baseUrl:Lt(),auth:{type:"bearer",getToken:Tt,refreshToken:async()=>{let e=ft();if(!e?.refreshToken)throw new Error("No refresh token available");return(await wt(e)).accessToken}},headers:Rt()})),m}var Jt=new Proxy({},{get(e,t){return Reflect.get(Bt(),t)}});function Qt(){m=null}export{d as a,Jt as b,Qt 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{b as a,c as b}from"./chunk-
|
|
2
|
+
import{b as a,c as b}from"./chunk-RUXMHUNO.js";import"./chunk-EMAK4COO.js";import"./chunk-LMDE72OE.js";export{a as moonpay,b as resetClient};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 J,b as K,c as R,d as C}from"./chunk-
|
|
3
|
+
import{a as J,b as K,c as R,d as C}from"./chunk-NVXIV2XH.js";import{b as N}from"./chunk-RUXMHUNO.js";import{m as A}from"./chunk-BZQ767AV.js";import{e as v,g as H}from"./chunk-EMAK4COO.js";import"./chunk-LMDE72OE.js";import{Command as se}from"commander";var W=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function _(e){return n=>W?`${e}${n}\x1B[0m`:n}var d={bold:_("\x1B[1m"),dim:_("\x1B[2m"),green:_("\x1B[32m"),yellow:_("\x1B[33m"),cyan:_("\x1B[36m"),red:_("\x1B[31m")};function O(e){if(e==null)return!0;let n=typeof e;return n==="string"||n==="number"||n==="boolean"}function w(e){return e==null?"-":String(e)}function S(e,n=0){let t=" ".repeat(n);return O(e)?`${t}${w(e)}`:Array.isArray(e)?e.length===0?`${t}${d.dim("(empty)")}`:e.every(O)?e.map(s=>`${t}- ${w(s)}`).join(`
|
|
4
4
|
`):e.map(s=>{if(typeof s!="object"||s===null)return`${t}- ${w(s)}`;let r=Object.entries(s),c=[],[l,u]=r[0];O(u)?c.push(`${t}- ${d.bold(l)}: ${w(u)}`):(c.push(`${t}- ${d.bold(l)}:`),c.push(S(u,n+2)));for(let[p,g]of r.slice(1))O(g)?c.push(`${t} ${d.bold(p)}: ${w(g)}`):(c.push(`${t} ${d.bold(p)}:`),c.push(S(g,n+2)));return c.join(`
|
|
5
5
|
`)}).join(`
|
|
6
6
|
|
|
@@ -14,5 +14,5 @@ ${S(c,n+1)}`).join(`
|
|
|
14
14
|
|
|
15
15
|
Run \`mp skill install\` to install AI skills for Claude Code.
|
|
16
16
|
|
|
17
|
-
`+K).version(v).option("--json","Output as JSON instead of YAML");function ae(){return h.opts().json?"json":"yaml"}function U(e){console.log(F(e,ae()))}function M(){let e=ie();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-
|
|
17
|
+
`+K).version(v).option("--json","Output as JSON instead of YAML");function ae(){return h.opts().json?"json":"yaml"}function U(e){console.log(F(e,ae()))}function M(){let e=ie();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-4FKAQTPB.js");await e()});function q(e,n){let t=e;for(let s of n){let r=t.commands.find(c=>c.name()===s);r||(r=t.command(s)),t=r}return t}function z(e,n=""){let t=[];for(let[s,r]of Object.entries(e)){let c=n?`${n}-${s}`:s,l=r;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let u=l;u._def.typeName==="ZodNullable"&&(u=u._def.innerType),u._def.typeName==="ZodObject"&&u.shape?t.push(...z(u.shape,c)):t.push({flatKey:c,field:r,path:c.split("-")})}return t}function ce(e,n){let t={};for(let{flatKey:s,path:r}of n){let c=s.replace(/-([a-z])/g,(u,p)=>p.toUpperCase()),l=c in e?e[c]:e[s];if(r.length===1)t[r[0]]=l;else{let u=t;for(let p=0;p<r.length-1;p++)(!u[r[p]]||typeof u[r[p]]!="object")&&(u[r[p]]={}),u=u[r[p]];u[r[r.length-1]]=l}}return t}function le(e,n){for(let t of n){let s=t.schema.name.split("_"),r=s.pop(),l=q(e,s).command(r).description(t.schema.description),u=t.schema.input.shape??{},p=z(u),g=[],b=[],k=[],$=[];for(let{flatKey:f,field:i}of p){let o=i.description??f,a=i;for(;a._def.typeName==="ZodEffects";)a=a._def.schema;let y=a._def.typeName,m=a;m._def.typeName==="ZodNullable"&&(m=m._def.innerType),m._def.typeName==="ZodNumber"&&b.push(f),m._def.typeName==="ZodRecord"&&k.push(f),m._def.typeName==="ZodBoolean"&&$.push(f),y==="ZodBoolean"?l.option(`--${f} [${f}]`,o,!1):y==="ZodNullable"?(l.option(`--${f} <${f}>`,o),g.push(f)):l.requiredOption(`--${f} <${f}>`,o)}l.action(async f=>{t.schema.name.startsWith("consent_")||await R.handler({});for(let o of g){let a=o.replace(/-([a-z])/g,(y,m)=>m.toUpperCase());f[a]===void 0&&(f[a]=null)}for(let o of b){let a=o.replace(/-([a-z])/g,(y,m)=>m.toUpperCase());f[a]!=null&&typeof f[a]=="string"&&(f[a]=Number(f[a]))}for(let o of $){let a=o.replace(/-([a-z])/g,(m,j)=>j.toUpperCase()),y=f[a];if(typeof y=="string"){let m=y.toLowerCase();m==="true"||m==="1"?f[a]=!0:(m==="false"||m==="0")&&(f[a]=!1)}}for(let o of k){let a=o.replace(/-([a-z])/g,(y,m)=>m.toUpperCase());if(typeof f[a]=="string")try{f[a]=JSON.parse(f[a])}catch{console.error(`Invalid JSON for --${o}`),process.exit(1)}}let i=ce(f,p);try{let o=await t.handler(i);U(o)}catch(o){console.error(Z(o)),process.exit(1)}})}}function fe(e){if(e.$ref&&e.definitions){let n=e.$ref.replace("#/definitions/","");return e.definitions[n]}return e}function ue(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(n=>n.type==="null"):!1}function me(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(n=>n.type==="object"):e.type==="object"}function pe(e){return Array.isArray(e.type)?e.type.some(n=>n==="number"||n==="integer"):e.anyOf?e.anyOf.some(n=>n.type==="number"||n.type==="integer"):e.type==="number"||e.type==="integer"}function de(e){return Array.isArray(e.type)?e.type.includes("boolean"):e.anyOf?e.anyOf.some(n=>n.type==="boolean"):e.type==="boolean"}var Y=new Set(["swaps_transaction_build","transaction_register","virtual-account_offramp_initiate","prediction-market_position_buy","prediction-market_position_sell","prediction-market_position_redeem","commerce_cart_update","commerce_checkout_start","commerce_checkout_pay","card_delegation_approve_transaction_build","card_delegation_revoke_transaction_build","card_delegation_token_retrieve","card_wallet_link","card_wallet_unlink"]);function ye(e,n){for(let t of n){if(Y.has(t.name))continue;let s=t.name.split("_"),r=s.pop(),c=q(e,s);if(c.commands.find(i=>i.name()===r))continue;let l=c.command(r).description(t.description),u=fe(t.inputSchema),p=u.properties??{},g=new Set(u.required??[]),b=[],k=[],$=[],f=[];for(let[i,o]of Object.entries(p)){let a=o.description??i,y=ue(o),m=me(o),j=pe(o),B=de(o);j&&k.push(i),B&&f.push(i),m?($.push(i),g.has(i)&&!y?l.requiredOption(`--${i} <json>`,`${a} (as JSON)`):(l.option(`--${i} <json>`,`${a} (as JSON)`),b.push(i))):y||!g.has(i)?(l.option(`--${i} <${i}>`,a),b.push(i)):l.requiredOption(`--${i} <${i}>`,a)}l.action(async i=>{await R.handler({});for(let o of b)i[o]===void 0&&(i[o]=null);for(let o of k)i[o]!=null&&typeof i[o]=="string"&&(i[o]=Number(i[o]));for(let o of f)if(typeof i[o]=="string"){let a=i[o].toLowerCase();a==="true"||a==="1"?i[o]=!0:(a==="false"||a==="0")&&(i[o]=!1)}for(let o of $)if(typeof i[o]=="string")try{i[o]=JSON.parse(i[o])}catch{console.error(`Invalid JSON for --${o}`),process.exit(1)}try{await I(i);let o=await N._call(t.name,i);U(o),M()}catch(o){console.error(Z(o)),process.exit(1)}})}}le(h,C);ye(h,J);h.command("tools").description("List available tools").action(()=>{let e=[...C.map(t=>({name:t.schema.name,description:t.schema.description})),...J.filter(t=>!C.some(s=>s.schema.name===t.name)&&!Y.has(t.name)).map(t=>({name:t.name,description:t.description}))].sort((t,s)=>t.name.localeCompare(s.name)),n=[];for(let t of e){let s=t.name.replace(/_/g," ");n.push(` ${d.green(s.padEnd(28))} ${d.dim(t.description)}`)}n.push(""),n.push(d.dim(`${e.length} tools`)),console.log(n.join(`
|
|
18
18
|
`)),M()});h.parse();
|
|
@@ -7,6 +7,6 @@ Run: npm i -g @moonpay/cli --include=optional`;function y(){try{let e=S("@ledger
|
|
|
7
7
|
`),p}async function U(){if(!p)return null;try{let e=y(),i=f().getDeviceSessionState({sessionId:p}),s=await e.firstValueFrom(i.pipe(e.take(1),e.timeout(3e3)));return s.sessionStateType>=1?s.currentApp?.name??null:null}catch{return null}}var M={evm:"Ethereum",solana:"Solana"};function _(e){let n=String(e);return n.includes("6807")||n.includes("6a15")||n.includes("UnknownDeviceExchangeError")}async function C(e){process.stderr.write(`Installing ${e} app on your Ledger...
|
|
8
8
|
`);let{OpenAppWithDependenciesDeviceAction:n}=y(),i=new n({input:{appName:e}}),t=f().executeDeviceAction({sessionId:E(),deviceAction:i});await m(t,`Install ${e}`,18e4),process.stderr.write(`Installed ${e} app
|
|
9
9
|
`)}async function R(e){let n=M[e];if(!n||await U()===n)return;process.stderr.write(`Opening ${n} app on your Ledger...
|
|
10
|
-
`);let{OpenAppDeviceAction:s}=y(),t=new s({input:{appName:n}}),u=f().executeDeviceAction({sessionId:E(),deviceAction:t});try{await m(u,`Open ${n}`)}catch(c){if(_(c)){await D(),await C(n),await D();return}if(!String(c).includes("isconnect"))throw c}await D()}async function D(){try{await f().disconnect({sessionId:p})}catch{}p=null,await new Promise(e=>setTimeout(e,500)),await P()}function $(e,n=0){switch(e){case"evm":return`44'/60'/${n}'/0/0`;case"solana":return`44'/501'/${n}'/0'`;default:throw new Error(`${e} derivation via Ledger is not supported.`)}}function k(e){return e.startsWith("0x")?e.slice(2):e}function T(e){return e.startsWith("0x")?e:`0x${e}`}async function x(e){let{moonpay:n}=await import("./client-
|
|
10
|
+
`);let{OpenAppDeviceAction:s}=y(),t=new s({input:{appName:n}}),u=f().executeDeviceAction({sessionId:E(),deviceAction:t});try{await m(u,`Open ${n}`)}catch(c){if(_(c)){await D(),await C(n),await D();return}if(!String(c).includes("isconnect"))throw c}await D()}async function D(){try{await f().disconnect({sessionId:p})}catch{}p=null,await new Promise(e=>setTimeout(e,500)),await P()}function $(e,n=0){switch(e){case"evm":return`44'/60'/${n}'/0/0`;case"solana":return`44'/501'/${n}'/0'`;default:throw new Error(`${e} derivation via Ledger is not supported.`)}}function k(e){return e.startsWith("0x")?e.slice(2):e}function T(e){return e.startsWith("0x")?e:`0x${e}`}async function x(e){let{moonpay:n}=await import("./client-DJLXQHBE.js"),s=(await n.chain.retrieve({chain:e})).keyFamily;if(s==="bitcoin")throw new Error("Bitcoin address derivation via Ledger is not yet supported.");if(s==="tron")throw new Error("Tron address derivation via Ledger is not supported. The Ethereum signer cannot interact with the Tron Ledger app.");await R(s);let t=$(s),a=E(),u=f();switch(s){case"evm":{let{SignerEthBuilder:c}=I(),l=new c({dmk:u,sessionId:a}).build().getAddress(t,{skipOpenApp:!1});return(await m(l,"Get Ethereum address")).address}case"solana":{let{SignerSolanaBuilder:c}=L(),l=new c({dmk:u,sessionId:a}).build().getAddress(t,{skipOpenApp:!1});return await m(l,"Get Solana address")}default:throw new Error(`Ledger address derivation not supported for ${s}`)}}async function F(){let e={};try{e.ethereum=await x("ethereum")}catch(n){process.stderr.write(`Failed to get Ethereum address: ${n}
|
|
11
11
|
`)}try{e.solana=await x("solana")}catch(n){process.stderr.write(`Failed to get Solana address: ${n}
|
|
12
|
-
`)}if(!e.ethereum&&!e.solana)throw new Error("Could not derive any addresses from Ledger device");return e}async function H(e,n){let{moonpay:i}=await import("./client-
|
|
12
|
+
`)}if(!e.ethereum&&!e.solana)throw new Error("Could not derive any addresses from Ledger device");return e}async function H(e,n){let{moonpay:i}=await import("./client-DJLXQHBE.js"),t=(await i.chain.retrieve({chain:e})).keyFamily;if(t==="bitcoin")throw new Error("Bitcoin transaction signing via Ledger is not yet supported. Use a software wallet for Bitcoin transactions.");if(t==="tron")throw new Error("Tron transaction signing via Ledger is not supported. Use a software wallet for Tron transactions.");await R(t);let a=$(t),u=E(),c=f();switch(t){case"evm":{let{SignerEthBuilder:d}=I(),l=new d({dmk:c,sessionId:u}).build(),w=T(n.startsWith("0x")?n:Buffer.from(n,"base64").toString("hex")),o=Uint8Array.from(Buffer.from(k(w),"hex")),r=l.signTransaction(a,o,{skipOpenApp:!1}),g=await m(r,"Sign transaction"),{parseTransaction:v,serializeTransaction:A}=await import("viem"),B=v(w);return{transaction:A(B,{r:T(k(g.r)),s:T(k(g.s)),v:BigInt(g.v)})}}case"solana":{let{SignerSolanaBuilder:d}=L(),l=new d({dmk:c,sessionId:u}).build(),{VersionedTransaction:w}=await import("@solana/web3.js"),o=Uint8Array.from(Buffer.from(n,"base64")),r=w.deserialize(o),g=r.message.serialize(),v=l.signTransaction(a,g,{skipOpenApp:!1}),A=await m(v,"Sign Solana transaction");return r.signatures[0]=A,{transaction:Buffer.from(r.serialize()).toString("base64")}}default:throw new Error(`Ledger transaction signing not supported for ${t}`)}}async function V(e,n){let{moonpay:i}=await import("./client-DJLXQHBE.js"),t=(await i.chain.retrieve({chain:e})).keyFamily;if(t==="bitcoin")throw new Error("Bitcoin message signing via Ledger is not yet supported. Use a software wallet for Bitcoin message signing.");if(t==="tron")throw new Error("Tron message signing via Ledger is not supported. Use a software wallet for Tron message signing.");await R(t);let a=$(t),u=E(),c=f();switch(t){case"evm":{let{SignerEthBuilder:d}=I(),w=new d({dmk:c,sessionId:u}).build().signMessage(a,n,{skipOpenApp:!1}),o=await m(w,"Sign message"),r=k(o.r),g=k(o.s),v=o.v.toString(16).padStart(2,"0");return{signature:`0x${r}${g}${v}`}}case"solana":{let{SignerSolanaBuilder:d}=L(),l=new d({dmk:c,sessionId:u}).build(),w=Buffer.from(n,"utf8").toString("hex"),o=l.signMessage(a,w,{skipOpenApp:!1}),r=await m(o,"Sign Solana message");return{signature:(await import("bs58")).default.encode(r)}}default:throw new Error(`Ledger message signing not supported for ${t}`)}}async function q(){if(p){try{await f().disconnect({sessionId:p})}catch{}p=null}if(h){try{h.close()}catch{}h=null}}export{P as connectLedger,q as disconnectLedger,x as ledgerGetAddress,F as ledgerGetAllAddresses,V as ledgerSignMessage,H as ledgerSignTransaction};
|
|
@@ -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 f,d as u}from"./chunk-
|
|
2
|
+
import{a as f,d as u}from"./chunk-NVXIV2XH.js";import{b as d}from"./chunk-RUXMHUNO.js";import"./chunk-BZQ767AV.js";import{e as l,g as R}from"./chunk-EMAK4COO.js";import"./chunk-LMDE72OE.js";import{Server as N}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as O}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as T,ListToolsRequestSchema as x}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as k}from"zod-to-json-schema";R();var y=new Map(u.map(s=>[s.schema.name,s]));function q(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 P(){let s=new N({name:"moonpay",version:l},{capabilities:{tools:{listChanged:!0}}}),n=u.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:k(e.schema.input)})),c=new Map;for(let e of f){if(y.has(e.name))continue;let t=q(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 h=new Map(n.map(e=>[e.name,e]));s.setRequestHandler(x,async()=>({tools:n.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))})),s.setRequestHandler(T,async e=>{let{name:t,arguments:o={}}=e.params;if(!h.has(t))return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0};try{let i=y.get(t);if(i){let 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 S=c.get(t)??{};for(let[p,r]of Object.entries(S))o[p]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(w=>w.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 b=await d._call(t,o);return{content:[{type:"text",text:JSON.stringify(b,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let g=new O;await s.connect(g)}export{P 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{A as v,B as w,f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"./chunk-
|
|
2
|
+
import{A as v,B as w,f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"./chunk-BZQ767AV.js";import"./chunk-EMAK4COO.js";import"./chunk-LMDE72OE.js";export{m as addHardwareWallet,u as addWallet,d as createWallet,j as deleteWallet,l as exportSecret,h as findWallet,i as findWalletOrThrow,a as getVaultPath,e as importMnemonic,f as importPrivateKey,g as listWallets,s as loadWallets,c as migrateWallets,w as mutateWallets,p as owsSignMessage,o as owsSignTransaction,q as owsSignTypedData,n as refreshHardwareAddresses,t as removeWallet,k as renameWallet,b as requireMigrationCheck,r as resolveSigningKey,v as saveWallets};
|
package/package.json
CHANGED
|
@@ -133,8 +133,8 @@ Confirm both POL and pUSD are present.
|
|
|
133
133
|
Once funded, trade directly via MoonPay CLI:
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
|
-
# Search
|
|
137
|
-
mp prediction-market
|
|
136
|
+
# Search events
|
|
137
|
+
mp prediction-market event search --provider polymarket --query "bitcoin"
|
|
138
138
|
|
|
139
139
|
# Get trending markets
|
|
140
140
|
# Register wallet (one-time)
|
|
@@ -84,6 +84,21 @@ mp prediction-market position sell \
|
|
|
84
84
|
- `size` is the share count. **`size × price` must be ≥ $1** (Kalshi's minimum order value).
|
|
85
85
|
- If YES resolves, each share pays $1 → profit = (1 − price) × size.
|
|
86
86
|
|
|
87
|
+
## Verify the fill after EVERY order — required
|
|
88
|
+
|
|
89
|
+
A landed Solana transaction does **not** mean the order filled. Kalshi orders route through dFlow as fill-and-kill: the tx can confirm on-chain, fill **nothing**, and refund your input — sometimes as **CASH** (dFlow's intermediate token), not USDC. One real order did exactly this: `status: closed`, `filled: false`, ~$19.98 refunded as CASH, zero position created.
|
|
90
|
+
|
|
91
|
+
So after you sign and submit **any** `position buy`, `position sell`, or `position redeem`, take the submitted transaction signature and confirm the result:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mp prediction-market order retrieve --provider kalshi --orderId <submitted-signature>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- `filled: true` → the order executed. Now report the position / exit / redemption.
|
|
98
|
+
- `filled: false` → it did **not** execute. The input was refunded — check `reverts[]` for the amount and mint (it may be CASH, not USDC). **Do not report a position or a successful trade.** Tell the user it didn't fill and exactly what was refunded.
|
|
99
|
+
|
|
100
|
+
Never skip this. Reporting a fill you didn't verify is the worst failure mode on Kalshi — the user thinks they hold a position they don't.
|
|
101
|
+
|
|
87
102
|
## Track + redeem positions
|
|
88
103
|
|
|
89
104
|
```bash
|
|
@@ -98,6 +113,8 @@ mp prediction-market position redeem \
|
|
|
98
113
|
--outcomeId <outcome-id>
|
|
99
114
|
```
|
|
100
115
|
|
|
116
|
+
After submitting a redeem, verify it with `order retrieve` (see above) — a redemption can land on-chain and still fill nothing.
|
|
117
|
+
|
|
101
118
|
Position status is `"open" | "redeemable" | "redeemed"`. Derived on-chain from the market's `status` + the account's `redemptionStatus` — no separate API needed.
|
|
102
119
|
|
|
103
120
|
## Example flow — NBA championship
|
|
@@ -115,13 +132,19 @@ mp prediction-market position buy \
|
|
|
115
132
|
--provider kalshi --wallet funded-sol \
|
|
116
133
|
--tokenId <yes-outcome-id> --price 0.38 --size 10
|
|
117
134
|
|
|
118
|
-
# 4.
|
|
135
|
+
# 4. REQUIRED — confirm it actually filled (a landed tx can fill nothing + refund)
|
|
136
|
+
mp prediction-market order retrieve --provider kalshi --orderId <signature-from-step-3>
|
|
137
|
+
|
|
138
|
+
# 5. Watch
|
|
119
139
|
mp prediction-market position list --provider kalshi --wallet <solana-address>
|
|
120
140
|
|
|
121
|
-
#
|
|
141
|
+
# 6. Exit
|
|
122
142
|
mp prediction-market position sell \
|
|
123
143
|
--provider kalshi --wallet funded-sol \
|
|
124
144
|
--marketId <market-ticker> --outcomeId <yes-outcome-id> --size 10
|
|
145
|
+
|
|
146
|
+
# 7. REQUIRED — confirm the exit filled
|
|
147
|
+
mp prediction-market order retrieve --provider kalshi --orderId <signature-from-step-6>
|
|
125
148
|
```
|
|
126
149
|
|
|
127
150
|
## Tips
|
|
@@ -166,7 +166,7 @@ mp token bridge \
|
|
|
166
166
|
Step 1 — Search:
|
|
167
167
|
|
|
168
168
|
```bash
|
|
169
|
-
mp prediction-market
|
|
169
|
+
mp prediction-market event search --provider kalshi --query "NBA"
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
Step 2 — Look at the `KXNBA-26` series ("Pro Basketball Champion — 2026"). Find sub-markets with `status === "open"` and real `outcomes[].ask` prices. Pick one with a story — a heavy favorite (OKC, Boston) for clean execution, or a value underdog if the spread looks juicy.
|
|
@@ -87,6 +87,14 @@ mp prediction-market position redeem \
|
|
|
87
87
|
|
|
88
88
|
Same two-step flow as sell: `position redeem` returns EIP-712 typedData (`BoxPolymarketRedeemPosition`), the CLI signs with the user's EVM EOA, then submits via `polymarket_position_redeem`. This closes LABS-271 / SWA-1868 — Box can no longer trigger redemptions without an explicit per-action signature.
|
|
89
89
|
|
|
90
|
+
**`marketId` must be the conditionId, NOT the outcome token id.** Redeem takes two *different* ids and they're easy to swap:
|
|
91
|
+
- `marketId` = the **conditionId**, a `0x`-prefixed 64-hex string (`position_list[].marketId`).
|
|
92
|
+
- `outcomeId` = the **numeric** ERC-1155 token id (`position_list[].outcomeId`).
|
|
93
|
+
|
|
94
|
+
Passing the numeric `outcomeId` value into `marketId` makes swaps.xyz return **"No redeemable position for conditionId …"** even though the position is clearly redeemable. The CLI now rejects a mismatched shape up front (`marketId must be a Polymarket conditionId (0x-prefixed 64-hex)`), so round-trip both fields straight from `position list` — don't reuse the position's `id`.
|
|
95
|
+
|
|
96
|
+
Note on custody: Polymarket settles into a per-user Gnosis-Safe proxy, but the user's EVM EOA is an owner of that Safe (threshold 1), so the EOA's signature is sufficient to redeem — the funds are *not* stranded outside the agent's control.
|
|
97
|
+
|
|
90
98
|
## Example flow
|
|
91
99
|
|
|
92
100
|
```bash
|
|
@@ -14,7 +14,7 @@ This skill is **infrastructure knowledge** — what endpoints exist and how to u
|
|
|
14
14
|
|
|
15
15
|
| Need | Command |
|
|
16
16
|
|---|---|
|
|
17
|
-
| Search events by keyword
|
|
17
|
+
| Search events by keyword | `mp prediction-market event search --provider polymarket --query "..."` |
|
|
18
18
|
| Full event details (every sub-market, every outcome, current price + bid/ask + volume + liquidity) | `mp prediction-market event retrieve --provider polymarket --slug <event-slug>` |
|
|
19
19
|
| Historical price series (OHLCV) | `mp prediction-market market ohlcv list --provider polymarket --tokenId <outcome-id> --interval <1hr\|1d\|1w\|1m\|max>` |
|
|
20
20
|
|
|
@@ -43,6 +43,9 @@ mp prediction-market event search --provider kalshi --query "..."
|
|
|
43
43
|
# Position list (per-venue, same shape)
|
|
44
44
|
mp prediction-market position list --provider <venue> --wallet <addr>
|
|
45
45
|
mp prediction-market position list --provider <venue> --wallet <addr> --status closed
|
|
46
|
+
|
|
47
|
+
# Confirm an order filled after you submit it (Kalshi: the Solana signature; Polymarket: the swaps txId)
|
|
48
|
+
mp prediction-market order retrieve --provider <venue> --orderId <id>
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
The actual buy/sell flow + funding requirements diverge — read **moonpay-polymarket** or **moonpay-kalshi** for the venue-specific recipe.
|
|
@@ -53,6 +56,7 @@ The actual buy/sell flow + funding requirements diverge — read **moonpay-polym
|
|
|
53
56
|
- `status === "open"` must hold before any buy — closed/resolved markets reject orders.
|
|
54
57
|
- Don't fund Polymarket with regular USDC — it's pUSD on Polygon (a different mint, Polymarket-issued, 1:1 USDC-backed). See **moonpay-fund-polymarket**.
|
|
55
58
|
- Polymarket and Kalshi both enforce a $1 minimum order: 1 share at 30¢ won't fill; 4 shares at 30¢ ($1.20) will.
|
|
59
|
+
- **Always verify the fill after submitting** — especially on Kalshi, where a landed Solana tx can fill nothing and refund (sometimes as CASH). Call `order retrieve` with the submitted id; `filled: false` means no position exists, so don't report one. See **moonpay-kalshi**.
|
|
56
60
|
|
|
57
61
|
## Related skills
|
|
58
62
|
|