@moonpay/cli 0.11.1 → 0.12.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{a as h,b as l,c as m}from"./chunk-JLT4XDAY.js";var k=class f{constructor(e){this.registeredClientSchemes=new Map,this.policies=[],this.registeredExtensions=new Map,this.beforePaymentCreationHooks=[],this.afterPaymentCreationHooks=[],this.onPaymentCreationFailureHooks=[],this.paymentRequirementsSelector=e||((r,t)=>t[0])}static fromConfig(e){let r=new f(e.paymentRequirementsSelector);return e.schemes.forEach(t=>{t.x402Version===1?r.registerV1(t.network,t.client):r.register(t.network,t.client)}),e.policies?.forEach(t=>{r.registerPolicy(t)}),r}register(e,r){return this._registerScheme(h,e,r)}registerV1(e,r){return this._registerScheme(1,e,r)}registerPolicy(e){return this.policies.push(e),this}registerExtension(e){return this.registeredExtensions.set(e.key,e),this}onBeforePaymentCreation(e){return this.beforePaymentCreationHooks.push(e),this}onAfterPaymentCreation(e){return this.afterPaymentCreationHooks.push(e),this}onPaymentCreationFailure(e){return this.onPaymentCreationFailureHooks.push(e),this}async createPaymentPayload(e){let r=this.registeredClientSchemes.get(e.x402Version);if(!r)throw new Error(`No client registered for x402 version: ${e.x402Version}`);let t=this.selectPaymentRequirements(e.x402Version,e.accepts),i={paymentRequired:e,selectedRequirements:t};for(let s of this.beforePaymentCreationHooks){let o=await s(i);if(o&&"abort"in o&&o.abort)throw new Error(`Payment creation aborted: ${o.reason}`)}try{let s=m(r,t.scheme,t.network);if(!s)throw new Error(`No client registered for scheme: ${t.scheme} and network: ${t.network}`);let o=await s.createPaymentPayload(e.x402Version,t,{extensions:e.extensions}),n;if(o.x402Version==1)n=o;else{let c=this.mergeExtensions(e.extensions,o.extensions);n={x402Version:o.x402Version,payload:o.payload,extensions:c,resource:e.resource,accepted:t}}n=await this.enrichPaymentPayloadWithExtensions(n,e);let a={...i,paymentPayload:n};for(let c of this.afterPaymentCreationHooks)await c(a);return n}catch(s){let o={...i,error:s};for(let n of this.onPaymentCreationFailureHooks){let a=await n(o);if(a&&"recovered"in a&&a.recovered)return a.payload}throw s}}mergeExtensions(e,r){if(!r)return e;if(!e)return r;let t={...e};for(let[i,s]of Object.entries(r)){let o=t[i];o&&typeof o=="object"&&s&&typeof s=="object"?t[i]={...o,...s}:t[i]=s}return t}async enrichPaymentPayloadWithExtensions(e,r){if(!r.extensions||this.registeredExtensions.size===0)return e;let t=e;for(let[i,s]of this.registeredExtensions)i in r.extensions&&s.enrichPaymentPayload&&(t=await s.enrichPaymentPayload(t,r));return t}selectPaymentRequirements(e,r){let t=this.registeredClientSchemes.get(e);if(!t)throw new Error(`No client registered for x402 version: ${e}`);let i=r.filter(o=>{let n=l(t,o.network);return n?n.has(o.scheme):!1});if(i.length===0)throw new Error(`No network/scheme registered for x402 version: ${e} which comply with the payment requirements. ${JSON.stringify({x402Version:e,paymentRequirements:r,x402Versions:Array.from(this.registeredClientSchemes.keys()),networks:Array.from(t.keys()),schemes:Array.from(t.values()).map(o=>Array.from(o.keys())).flat()})}`);let s=i;for(let o of this.policies)if(s=o(e,s),s.length===0)throw new Error(`All payment requirements were filtered out by policies for x402 version: ${e}`);return this.paymentRequirementsSelector(e,s)}_registerScheme(e,r,t){this.registeredClientSchemes.has(e)||this.registeredClientSchemes.set(e,new Map);let i=this.registeredClientSchemes.get(e);i.has(r)||i.set(r,new Map);let s=i.get(r);return s.has(t.scheme)||s.set(t.scheme,t),this}};export{k as a};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{h as e,i as r,j as m,k as t,l as a}from"./chunk-RR34RWPO.js";import"./chunk-KBP3ULPH.js";import"./chunk-JLT4XDAY.js";import"./chunk-LMDE72OE.js";export{t as ExactEvmScheme,r as createPermit2ApprovalTx,e as erc20AllowanceAbi,m as getPermit2AllowanceReadParams,a as registerExactEvmScheme};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a as b}from"./chunk-SEOEJZOL.js";import{d as a}from"./chunk-JLT4XDAY.js";import"./chunk-LMDE72OE.js";export{b as x402Client,a as x402HTTPClient};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{Da as D,Gl as ct,a as V,b as G,c as j,cd as z,d as K,e as f,f as H,fa as at,g as C,h as b,i as q,j as J,k as Y,l as P,m as k,n as I,o as Z,p as X,q as Q,r as $,s as tt,t as et,u as nt,v as rt,w as T,x as ot}from"./chunk-AT2QGHZK.js";import"./chunk-LMDE72OE.js";function it(t){return JSON.parse(Wt(t),(e,n)=>jt(n)?Gt(n):n)}function Wt(t){let e=[],n=!1;for(let r=0;r<t.length;r++){let o=!1;if(t[r]==="\\"&&(e.push(t[r++]),o=!o),t[r]==='"'){e.push(t[r]),o||(n=!n);continue}if(!n){let a=Ft(t,r);if(a?.length){r+=a.length-1,a.match(/\.|[eE]-/)?e.push(a):e.push(Vt(a));continue}}e.push(t[r])}return e.join("")}function Ft(t,e){let n=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;if(!t[e]?.match(/[-\d]/))return null;let r=t.slice(e).match(n);return r?r[0]:null}function Vt(t){return`{"$n":"${t}"}`}function Gt({$n:t}){if(t.match(/[eE]/)){let[e,n]=t.split(/[eE]/);return BigInt(e)*BigInt(10)**BigInt(n)}return BigInt(t)}function jt(t){return!!t&&typeof t=="object"&&"$n"in t&&typeof t.$n=="string"}var st=0n;function Kt(){let t=st;return st++,t.toString()}function ut(t){return{id:Kt(),jsonrpc:"2.0",method:t.methodName,params:t.params}}function dt(t,e){return qt(JSON.stringify(t,(n,r)=>typeof r=="bigint"?Ht(r):r,e))}function Ht(t){return{$n:`${t}`}}function qt(t){return t.replace(/\{\s*"\$n"\s*:\s*"(-?\d+)"\s*\}/g,"$1")}function lt(t){return Jt(t)}function Jt(t){return new Proxy(t.api,{defineProperty(){return!1},deleteProperty(){return!1},get(e,n,r){if(n!=="then")return function(...o){let a=n.toString(),s=Reflect.get(e,a,r);if(!s)throw new f(K,{method:a,params:o});let u=s(...o);return Yt(t,u)}}})}function Yt({transport:t},e){return{async send(n){return await e.execute({signal:n?.abortSignal,transport:t})}}}function mt(t){return new Proxy({},{defineProperty(){return!1},deleteProperty(){return!1},get(...e){let[n,r]=e,o=r.toString();return function(...a){let s=Object.freeze({methodName:o,params:a}),u=t?.requestTransformer?t?.requestTransformer(s):s;return Object.freeze({execute:async({signal:i,transport:l})=>{let m=ut(u),d=await l({payload:m,signal:i});return t?.responseTransformer?t.responseTransformer(d,u):d}})}}})}function h(t){return t==null||typeof t!="object"||Array.isArray(t)?!1:"jsonrpc"in t&&t.jsonrpc==="2.0"&&"method"in t&&typeof t.method=="string"&&"params"in t}function Zt(t){return typeof t=="bigint"?Number(t):t}var c={};function gt(t){return function e(n,r){if(Array.isArray(n))return n.map((o,a)=>{let s={...r,keyPath:[...r.keyPath,a]};return e(o,s)});if(typeof n=="object"&&n!==null){let o={};for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let s={...r,keyPath:[...r.keyPath,a]};o[a]=e(n[a],s)}return o}else return t.reduce((o,a)=>a(o,r),n)}}function At(t,e){return n=>{let r=gt(t);return Object.freeze({...n,params:r(n.params,e)})}}function ft(t,e){return n=>gt(t)(n,e)}function Xt(){return At([Zt],{keyPath:[]})}function Qt({commitmentPropertyName:t,params:e,optionsObjectPositionInParams:n,overrideCommitment:r}){let o=e[n];if(o===void 0||o&&typeof o=="object"&&!Array.isArray(o)){if(o&&t in o){if(!o[t]||o[t]==="finalized"){let a=[...e],{[t]:s,...u}=o;return Object.keys(u).length>0?a[n]=u:n===a.length-1?a.length--:a[n]=void 0,a}}else if(r!=="finalized"){let a=[...e];return a[n]={...o,[t]:r},a}}return e}function $t({defaultCommitment:t,optionsObjectPositionByMethod:e}){return n=>{let{params:r,methodName:o}=n;if(!Array.isArray(r))return n;let a=e[o];return a==null?n:Object.freeze({methodName:o,params:Qt({commitmentPropertyName:o==="sendTransaction"?"preflightCommitment":"commitment",optionsObjectPositionInParams:a,overrideCommitment:t,params:r})})}}function te(t){return(e,{keyPath:n})=>(typeof e=="bigint"&&t&&(e>Number.MAX_SAFE_INTEGER||e<-Number.MAX_SAFE_INTEGER)&&t(n,e),e)}function ee(t){return e=>At([te((...r)=>t(e,...r))],{keyPath:[]})(e)}var ne={accountNotifications:1,blockNotifications:1,getAccountInfo:1,getBalance:1,getBlock:1,getBlockHeight:0,getBlockProduction:0,getBlocks:2,getBlocksWithLimit:2,getEpochInfo:0,getFeeForMessage:1,getInflationGovernor:0,getInflationReward:1,getLargestAccounts:0,getLatestBlockhash:0,getLeaderSchedule:1,getMinimumBalanceForRentExemption:1,getMultipleAccounts:1,getProgramAccounts:1,getSignaturesForAddress:1,getSlot:0,getSlotLeader:0,getStakeMinimumDelegation:0,getSupply:0,getTokenAccountBalance:1,getTokenAccountsByDelegate:2,getTokenAccountsByOwner:2,getTokenLargestAccounts:1,getTokenSupply:1,getTransaction:1,getTransactionCount:0,getVoteAccounts:0,isBlockhashValid:1,logsNotifications:1,programNotifications:1,requestAirdrop:2,sendTransaction:1,signatureNotifications:1,simulateTransaction:1};function It(t){let e=t?.onIntegerOverflow;return n=>I(n,e?ee(e):r=>r,Xt(),$t({defaultCommitment:t?.defaultCommitment,optionsObjectPositionByMethod:ne}))}function pt(t){return function(n,{keyPath:r}){return typeof n=="number"&&Number.isInteger(n)||typeof n=="bigint"?re(r,t)?Number(n):BigInt(n):n}}function re(t,e){return e.some(n=>{if(n.length!==t.length)return!1;for(let r=t.length-1;r>=0;r--){let o=t[r],a=n[r];if(a!==o&&(a!==c||typeof o!="number"))return!1}return!0})}function oe(t){return ft([pt(t)],{keyPath:[]})}function ae(){return t=>t.result}var v=[["data","parsed","info","tokenAmount","decimals"],["data","parsed","info","tokenAmount","uiAmount"],["data","parsed","info","rentExemptReserve","decimals"],["data","parsed","info","rentExemptReserve","uiAmount"],["data","parsed","info","delegatedAmount","decimals"],["data","parsed","info","delegatedAmount","uiAmount"],["data","parsed","info","extensions",c,"state","olderTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",c,"state","newerTransferFee","transferFeeBasisPoints"],["data","parsed","info","extensions",c,"state","preUpdateAverageRate"],["data","parsed","info","extensions",c,"state","currentRate"]],p=[...v,["data","parsed","info","lastExtendedSlotStartIndex"],["data","parsed","info","slashPenalty"],["data","parsed","info","warmupCooldownRate"],["data","parsed","info","decimals"],["data","parsed","info","numRequiredSigners"],["data","parsed","info","numValidSigners"],["data","parsed","info","stake","delegation","warmupCooldownRate"],["data","parsed","info","exemptionThreshold"],["data","parsed","info","burnPercent"],["data","parsed","info","commission"],["data","parsed","info","votes",c,"confirmationCount"]],E=[["index"],["instructions",c,"accounts",c],["instructions",c,"programIdIndex"],["instructions",c,"stackHeight"]],U=[["addressTableLookups",c,"writableIndexes",c],["addressTableLookups",c,"readonlyIndexes",c],["header","numReadonlySignedAccounts"],["header","numReadonlyUnsignedAccounts"],["header","numRequiredSignatures"],["instructions",c,"accounts",c],["instructions",c,"programIdIndex"],["instructions",c,"stackHeight"]];function ce(){return[["loadedAccountsDataSize"],...p.map(t=>["accounts",c,...t]),...E.map(t=>["innerInstructions",c,...t])]}function se(){return(t,e)=>{let n=t;if("error"in n){let{error:r}=n;if(r&&typeof r=="object"&&"code"in r&&(r.code===-32002||r.code===-32002n)&&"data"in r&&r.data){let s=ft([pt(ce())],{keyPath:[]})(r.data,e),u={...r,data:s};throw C(u)}throw C(n.error)}return n}}function Tt(t){return(e,n)=>{let r=n.methodName,o=t?.allowedNumericKeyPaths&&r?t.allowedNumericKeyPaths[r]:void 0;return I(e,a=>se()(a,n),a=>ae()(a,n),a=>oe(o??[])(a,n))}}function Et(t){return mt({requestTransformer:It(t),responseTransformer:Tt({allowedNumericKeyPaths:ie()})})}var L;function ie(){return L||(L={getAccountInfo:p.map(t=>["value",...t]),getBlock:[["transactions",c,"meta","preTokenBalances",c,"accountIndex"],["transactions",c,"meta","preTokenBalances",c,"uiTokenAmount","decimals"],["transactions",c,"meta","postTokenBalances",c,"accountIndex"],["transactions",c,"meta","postTokenBalances",c,"uiTokenAmount","decimals"],["transactions",c,"meta","rewards",c,"commission"],...E.map(t=>["transactions",c,"meta","innerInstructions",c,...t]),...U.map(t=>["transactions",c,"transaction","message",...t]),["rewards",c,"commission"]],getClusterNodes:[[c,"featureSet"],[c,"shredVersion"]],getInflationGovernor:[["initial"],["foundation"],["foundationTerm"],["taper"],["terminal"]],getInflationRate:[["foundation"],["total"],["validator"]],getInflationReward:[[c,"commission"]],getMultipleAccounts:p.map(t=>["value",c,...t]),getProgramAccounts:p.flatMap(t=>[["value",c,"account",...t],[c,"account",...t]]),getRecentPerformanceSamples:[[c,"samplePeriodSecs"]],getTokenAccountBalance:[["value","decimals"],["value","uiAmount"]],getTokenAccountsByDelegate:v.map(t=>["value",c,"account",...t]),getTokenAccountsByOwner:v.map(t=>["value",c,"account",...t]),getTokenLargestAccounts:[["value",c,"decimals"],["value",c,"uiAmount"]],getTokenSupply:[["value","decimals"],["value","uiAmount"]],getTransaction:[["meta","preTokenBalances",c,"accountIndex"],["meta","preTokenBalances",c,"uiTokenAmount","decimals"],["meta","postTokenBalances",c,"accountIndex"],["meta","postTokenBalances",c,"uiTokenAmount","decimals"],["meta","rewards",c,"commission"],...E.map(t=>["meta","innerInstructions",c,...t]),...U.map(t=>["transaction","message",...t])],getVersion:[["feature-set"]],getVoteAccounts:[["current",c,"commission"],["delinquent",c,"commission"]],simulateTransaction:[["value","loadedAccountsDataSize"],...p.map(t=>["value","accounts",c,...t]),...E.map(t=>["value","innerInstructions",c,...t])]}),L}var ue={accept:!0,"content-length":!0,"content-type":!0},de=Object.assign({"accept-charset":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,"permissions-policy":!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,via:!0},void 0,void 0);function le(t){let e=Object.keys(t).filter(n=>{let r=n.toLowerCase();return ue[n.toLowerCase()]===!0||de[n.toLowerCase()]===!0||r.startsWith("proxy-")||r.startsWith("sec-")});if(e.length>0)throw new f(G,{headers:e})}function me(t){let e={};for(let n in t)e[n.toLowerCase()]=t[n];return e}function ge(t){process.env.NODE_ENV;let{fromJson:e,headers:n,toJson:r,url:o}=t;process.env.NODE_ENV!=="production"&&n&&le(n);let a;"dispatcher_NODE_ONLY"in t&&(a={dispatcher:t.dispatcher_NODE_ONLY});let s=n&&me(n);return async function({payload:i,signal:l}){let m=r?r(i):JSON.stringify(i),d={...a,body:m,headers:{...s,accept:"application/json","content-length":m.length.toString(),"content-type":"application/json; charset=utf-8"},method:"POST",signal:l},g=await fetch(o,d);if(!g.ok)throw new f(j,{headers:g.headers,message:g.statusText,statusCode:g.status});return e?e(await g.text(),i):await g.json()}}var Ae=["getAccountInfo","getBalance","getBlock","getBlockCommitment","getBlockHeight","getBlockProduction","getBlocks","getBlocksWithLimit","getBlockTime","getClusterNodes","getEpochInfo","getEpochSchedule","getFeeForMessage","getFirstAvailableBlock","getGenesisHash","getHealth","getHighestSnapshotSlot","getIdentity","getInflationGovernor","getInflationRate","getInflationReward","getLargestAccounts","getLatestBlockhash","getLeaderSchedule","getMaxRetransmitSlot","getMaxShredInsertSlot","getMinimumBalanceForRentExemption","getMultipleAccounts","getProgramAccounts","getRecentPerformanceSamples","getRecentPrioritizationFees","getSignaturesForAddress","getSignatureStatuses","getSlot","getSlotLeader","getSlotLeaders","getStakeMinimumDelegation","getSupply","getTokenAccountBalance","getTokenAccountsByDelegate","getTokenAccountsByOwner","getTokenLargestAccounts","getTokenSupply","getTransaction","getTransactionCount","getVersion","getVoteAccounts","index","isBlockhashValid","minimumLedgerSlot","requestAirdrop","sendTransaction","simulateTransaction"];function Rt(t){return h(t)&&Ae.includes(t.method)}function St(t){return ge({...t,fromJson:(e,n)=>Rt(n)?it(e):JSON.parse(e),toJson:e=>Rt(e)?dt(e):JSON.stringify(e)})}import{setMaxListeners as pe}from"events";var fe=Object.prototype.toString,Ie=Object.keys||function(t){let e=[];for(let n in t)e.push(n);return e};function R(t,e){let n,r,o,a,s,u,i;if(t===!0)return"true";if(t===!1)return"false";switch(typeof t){case"object":if(t===null)return null;if("toJSON"in t&&typeof t.toJSON=="function")return R(t.toJSON(),e);if(i=fe.call(t),i==="[object Array]"){for(o="[",r=t.length-1,n=0;n<r;n++)o+=R(t[n],!0)+",";return r>-1&&(o+=R(t[n],!0)),o+"]"}else if(i==="[object Object]"){for(a=Ie(t).sort(),r=a.length,o="",n=0;n<r;)s=a[n],u=R(t[s],!1),u!==void 0&&(o&&(o+=","),o+=JSON.stringify(s)+":"+u),n++;return"{"+o+"}"}else return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"bigint":return`${t.toString()}n`;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}function _t(t){let e=R(t,!1);if(e!==void 0)return""+e}function ht(t,e,n){let r="";if(typeof e[0]=="number"){let s=e[0]+1,u=s%10,i=s%100;u==1&&i!=11?r=s+"st":u==2&&i!=12?r=s+"nd":u==3&&i!=13?r=s+"rd":r=s+"th"}else r=`\`${e[0].toString()}\``;let o=e.length>1?e.slice(1).map(s=>typeof s=="number"?`[${s}]`:s).join("."):void 0,a=new f(V,{argumentLabel:r,keyPath:e,methodName:t,optionalPathLabel:o?` at path \`${o}\``:"",value:n,...o!==void 0?{path:o}:void 0});return H(a,ht),a}var Te={defaultCommitment:"confirmed",onIntegerOverflow(t,e,n){throw ht(t.methodName,e,n)}},Ee=class extends globalThis.AbortController{constructor(...t){super(...t),pe(Number.MAX_SAFE_INTEGER,this.signal)}},Nt;function Dt(){return process.env.NODE_ENV!=="production"?{EXPLICIT_ABORT_TOKEN:"This object is thrown from the request that underlies a series of coalesced requests when the last request in that series aborts"}:{}}function Re(t,e){let n;return async function(o){let{payload:a,signal:s}=o,u=e(a);if(u===void 0)return await t(o);if(n||(queueMicrotask(()=>{n=void 0}),n={}),n[u]==null){let l=new Ee,m=(async()=>{try{return await t({...o,signal:l.signal})}catch(d){if(d===(Nt||=Dt()))return;throw d}})();n[u]={abortController:l,numConsumers:0,responsePromise:m}}let i=n[u];if(i.numConsumers++,s){let l=i.responsePromise;return await new Promise((m,d)=>{let g=M=>{s.removeEventListener("abort",g),i.numConsumers-=1,queueMicrotask(()=>{i.numConsumers===0&&i.abortController.abort(Nt||=Dt())}),d(M.target.reason)};s.addEventListener("abort",g),l.then(m).catch(d).finally(()=>{s.removeEventListener("abort",g)})})}else return await i.responsePromise}}function Se(t){return h(t)?_t([t.method,t.params]):void 0}function _e(t){let e={};for(let n in t)e[n.toLowerCase()]=t[n];return e}function Ne(t){return I(St({...t,headers:{"accept-encoding":"br,gzip,deflate",...t.headers?_e(t.headers):void 0,"solana-client":"js/5.5.1"}}),e=>Re(e,Se))}function w(t,e){return De(Ne({url:t,...e}))}function De(t){return lt({api:Et(Te),transport:t})}var y="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";var he=0,ve;process.env.NODE_ENV!=="production"&&(ve={[he]:"Associated token account owner does not match address derivation"});var we=0,ye=1,Oe=2,Me=3,Ce=4,be=5,Pe=6,ke=7,ze=8,Ue=9,Le=10,xe=11,Be=12,We=13,Fe=14,Ve=15,Ge=16,je=17,Ke=18,He=19,qe;process.env.NODE_ENV!=="production"&&(qe={[je]:"Account is frozen",[Pe]:"Already in use",[Ve]:"Account does not support specified authority type",[be]:"Fixed supply",[ye]:"Insufficient funds",[Be]:"Invalid instruction",[Oe]:"Invalid Mint",[ke]:"Invalid number of provided signers",[ze]:"Invalid number of required signers",[We]:"State is invalid for requested operation",[Ge]:"This token mint cannot freeze accounts",[Ke]:"The provided decimals value different from the Mint decimals",[Me]:"Account not associated with this Mint",[Le]:"Instruction does not support native tokens",[xe]:"Non-native account can only be closed if its balance is zero",[He]:"Instruction does not support non-native tokens",[we]:"Lamport balance below rent-exempt threshold",[Fe]:"Operation overflowed",[Ce]:"Owner does not match",[Ue]:"State is unititialized"});process.env.NODE_ENV;var Je="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",Ye="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",Ze="ComputeBudget111111111111111111111111111111",x="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr",Xe="L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95",vt="https://api.devnet.solana.com",wt="https://api.testnet.solana.com",yt="https://api.mainnet-beta.solana.com",Qe="wss://api.devnet.solana.com",$e="wss://api.testnet.solana.com",tn="wss://api.mainnet-beta.solana.com",Ot="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",Mt="4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",Ct="4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",B=1,en=5e6,W=2e4,bt=/^[1-9A-HJ-NP-Za-km-z]{32,44}$/,S="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",_="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",N="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",Pt={solana:S,"solana-devnet":_,"solana-testnet":N};function F(t){if(t.includes(":")){if(![S,_,N].includes(t))throw new Error(`Unsupported SVM network: ${t}`);return t}let e=Pt[t];if(!e)throw new Error(`Unsupported SVM network: ${t}`);return e}function nn(t){return bt.test(t)}function kt(t){try{let n=q().encode(t.transaction);return rt().decode(n)}catch(e){throw console.error("Error decoding transaction:",e),new Error("invalid_exact_svm_payload_transaction")}}function rn(t){let e=X().decode(t.messageBytes),n=e.staticAccounts??[],r=e.instructions??[];for(let o of r){let a=o.programAddressIndex,s=n[a].toString();if(s===y.toString()||s===D.toString()){let u=o.accountIndices??[];if(u.length>=4){let i=u[3],l=n[i].toString();if(l)return l}}}return""}function O(t,e){switch(F(t)){case _:return w(e||vt);case N:return w(e||wt);case S:return w(e||yt);default:throw new Error(`Unsupported network: ${t}`)}}function on(t){switch(F(t)){case S:return Ot;case _:return Mt;case N:return Ct;default:throw new Error(`No USDC address configured for network: ${t}`)}}function an(t,e){let n=parseFloat(t);if(isNaN(n))throw new Error(`Invalid amount: ${t}`);let[r,o=""]=String(n).split("."),a=o.padEnd(e,"0").slice(0,e);return(r+a).replace(/^0+/,"")||"0"}var zt="ComputeBudget111111111111111111111111111111";var cn=2;function sn(){return b(k([["discriminator",P()],["units",J()]]),t=>({...t,discriminator:cn}))}function Ut(t,e){let n=e?.programAddress??zt,r={...t};return Object.freeze({data:sn().encode(r),programAddress:n})}var un=3;function dn(){return b(k([["discriminator",P()],["microLamports",Y()]]),t=>({...t,discriminator:un}))}function ln(t,e){let n=e?.programAddress??zt,r={...t};return Object.freeze({data:dn().encode(r),programAddress:n})}function Lt(t,e){return tt(ln({microLamports:t}),e)}var mn=class{constructor(t,e){this.signer=t,this.config=e,this.scheme="exact"}async createPaymentPayload(t,e){let n=O(e.network,this.config?.rpcUrl),r=await at(n,e.asset),o=r.programAddress;if(o.toString()!==y.toString()&&o.toString()!==D.toString())throw new Error("Asset was not created by a known token program");let[a]=await z({mint:e.asset,owner:this.signer.address,tokenProgram:o}),[s]=await z({mint:e.asset,owner:e.payTo,tokenProgram:o}),u=ct({source:a,mint:e.asset,destination:s,authority:this.signer,amount:BigInt(e.amount),decimals:r.data.decimals},{programAddress:o}),i=e.extra?.feePayer;if(!i)throw new Error("feePayer is required in paymentRequirements.extra for SVM transactions");let{value:l}=await n.getLatestBlockhash().send(),m=crypto.getRandomValues(new Uint8Array(16)),d={programAddress:x,accounts:[],data:new TextEncoder().encode(Array.from(m).map(A=>A.toString(16).padStart(2,"0")).join(""))},g=I(Q({version:0}),A=>Lt(B,A),A=>$(i,A),A=>nt(Ut({units:W}),A),A=>et([u,d],A),A=>Z(l,A)),M=await ot(g),Bt={transaction:T(M)};return{x402Version:t,payload:Bt}}};function pr(t){return t}function gn(t){return{getBalance:async e=>(await t.getBalance(e).send()).value,getTokenAccountBalance:async e=>{let n=await t.getAccountInfo(e,{encoding:"jsonParsed"}).send();if(!n.value)throw new Error(`Token account not found: ${e}`);let r=n.value.data;return BigInt(r.parsed.info.tokenAmount.amount)},getLatestBlockhash:async()=>{let e=await t.getLatestBlockhash().send();return{blockhash:e.value.blockhash,lastValidBlockHeight:e.value.lastValidBlockHeight}},simulateTransaction:async(e,n)=>await t.simulateTransaction(e,n).send(),sendTransaction:async e=>await t.sendTransaction(e,{encoding:"base64"}).send(),confirmTransaction:async e=>{let n=!1,r=0,o=30;for(;!n&&r<o;){let a=await t.getSignatureStatuses([e]).send();if(a.value[0]?.confirmationStatus==="confirmed"||a.value[0]?.confirmationStatus==="finalized")return n=!0,a.value[0];await new Promise(s=>setTimeout(s,1e3)),r++}throw new Error("Transaction confirmation timeout")},fetchMint:async e=>{let{fetchMint:n}=await import("./src-X7XKGWIB.js");return await n(t,e)}}}function Tr(t,e){let n={},r;e&&("defaultRpcUrl"in e&&typeof e.defaultRpcUrl=="string"?r=e.defaultRpcUrl:"getBalance"in e||"getSlot"in e?n["*"]=e:n=e);let o=a=>n[a]?n[a]:n["*"]?n["*"]:O(a,r);return{getAddresses:()=>[t.address],signTransaction:async(a,s,u)=>{if(s!==t.address)throw new Error(`No signer for feePayer ${s}. Available: ${t.address}`);let i=kt({transaction:a}),l={content:i.messageBytes,signatures:i.signatures},[m]=await t.signMessages([l]),d={...i,signatures:{...i.signatures,...m}};return T(d)},simulateTransaction:async(a,s)=>{let i=await o(s).simulateTransaction(a,{sigVerify:!0,replaceRecentBlockhash:!1,commitment:"confirmed",encoding:"base64"}).send();if(i.value.err){let l=JSON.stringify(i.value.err,(m,d)=>typeof d=="bigint"?d.toString():d);throw new Error(`Simulation failed: ${l}`)}},sendTransaction:async(a,s)=>await o(s).sendTransaction(a,{encoding:"base64"}).send(),confirmTransaction:async(a,s)=>{let u=o(s);await gn(u).confirmTransaction(a)}}}export{Ze as COMPUTE_BUDGET_PROGRAM_ADDRESS,W as DEFAULT_COMPUTE_UNIT_LIMIT,B as DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS,vt as DEVNET_RPC_URL,Qe as DEVNET_WS_URL,mn as ExactSvmScheme,Xe as LIGHTHOUSE_PROGRAM_ADDRESS,yt as MAINNET_RPC_URL,tn as MAINNET_WS_URL,en as MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS,x as MEMO_PROGRAM_ADDRESS,_ as SOLANA_DEVNET_CAIP2,S as SOLANA_MAINNET_CAIP2,N as SOLANA_TESTNET_CAIP2,bt as SVM_ADDRESS_REGEX,wt as TESTNET_RPC_URL,$e as TESTNET_WS_URL,Ye as TOKEN_2022_PROGRAM_ADDRESS,Je as TOKEN_PROGRAM_ADDRESS,Mt as USDC_DEVNET_ADDRESS,Ot as USDC_MAINNET_ADDRESS,Ct as USDC_TESTNET_ADDRESS,Pt as V1_TO_V2_NETWORK_MAP,an as convertToTokenAmount,O as createRpcClient,kt as decodeTransactionFromPayload,rn as getTokenPayerFromTransaction,on as getUsdcAddress,F as normalizeNetwork,pr as toClientSvmSigner,Tr as toFacilitatorSvmSigner,nn as validateSvmAddress};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a,b as o,c as n,d as s,e as d,f as c,g as m,h as p,i as P,j as l,k as u}from"./chunk-RR34RWPO.js";import"./chunk-KBP3ULPH.js";import"./chunk-JLT4XDAY.js";import"./chunk-LMDE72OE.js";function x(r){return"permit2Authorization"in r}function A(r){return"authorization"in r}function h(r,t){let e=r.readContract??t?.readContract.bind(t);if(!e)throw new Error("toClientEvmSigner requires either a signer with readContract or a publicClient. Use createWalletClient(...).extend(publicActions) or pass a publicClient.");return{address:r.address,signTypedData:i=>r.signTypedData(i),readContract:e}}function g(r){return{...r,getAddresses:()=>[r.address]}}export{u as ExactEvmScheme,s as PERMIT2_ADDRESS,a as authorizationTypes,P as createPermit2ApprovalTx,n as eip3009ABI,p as erc20AllowanceAbi,l as getPermit2AllowanceReadParams,A as isEIP3009Payload,x as isPermit2Payload,o as permit2WitnessTypes,h as toClientEvmSigner,g as toFacilitatorEvmSigner,m as x402ExactPermit2ProxyABI,d as x402ExactPermit2ProxyAddress,c as x402UptoPermit2ProxyAddress};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{a as p}from"./chunk-SEOEJZOL.js";import"./chunk-KBP3ULPH.js";import{d,e as h}from"./chunk-JLT4XDAY.js";import"./chunk-LMDE72OE.js";function l(n,s){let a=s instanceof d?s:new d(s);return n.interceptors.response.use(t=>t,async t=>{if(!t.response||t.response.status!==402)return Promise.reject(t);let r=t.config;if(!r||!r.headers)return Promise.reject(new Error("Missing axios request configuration"));if(r.__is402Retry)return Promise.reject(t);try{let i;try{let e=t.response,o=c=>{let f=e.headers[c]??e.headers[c.toLowerCase()];return typeof f=="string"?f:void 0},m=e.data;i=a.getPaymentRequiredResponse(o,m)}catch(e){return Promise.reject(new Error(`Failed to parse payment requirements: ${e instanceof Error?e.message:"Unknown error"}`))}let u=await a.handlePaymentRequired(i);if(u){let e={...r};e.headers={...r.headers},Object.entries(u).forEach(([m,c])=>{e.headers.set(m,c)});let o=await n.request(e);if(o.status!==402)return o}let y;try{y=await s.createPaymentPayload(i)}catch(e){return Promise.reject(new Error(`Failed to create payment payload: ${e instanceof Error?e.message:"Unknown error"}`))}let P=a.encodePaymentSignatureHeader(y);return r.__is402Retry=!0,Object.entries(P).forEach(([e,o])=>{r.headers.set(e,o)}),r.headers.set("Access-Control-Expose-Headers","PAYMENT-RESPONSE,X-PAYMENT-RESPONSE"),await n.request(r)}catch(i){return Promise.reject(i)}}),n}function R(n,s){let a=p.fromConfig(s);return l(n,a)}export{h as decodePaymentResponseHeader,l as wrapAxiosWithPayment,R as wrapAxiosWithPaymentFromConfig,p as x402Client,d as x402HTTPClient};
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 R,b as S,c as T,d as j,e as k}from"./chunk-VNKUCDMG.js";import{a as C,h as A,n as v,u as J}from"./chunk-5JISHR3O.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 O(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function _(e){return e==null?"-":String(e)}function N(e,t=0){let n=" ".repeat(t);return O(e)?`${n}${_(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(O)?e.map(r=>`${n}- ${_(r)}`).join(`
3
+ import{a as R,b as S,c as T,d as j,e as k}from"./chunk-NZ4AUIQB.js";import{a as C,h as A,p as J}from"./chunk-5R67DV4J.js";import{e as v}from"./chunk-INE4OXJA.js";import"./chunk-LMDE72OE.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 O(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function _(e){return e==null?"-":String(e)}function N(e,t=0){let n=" ".repeat(t);return O(e)?`${n}${_(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(O)?e.map(r=>`${n}- ${_(r)}`).join(`
4
4
  `):e.map(r=>{if(typeof r!="object"||r===null)return`${n}- ${_(r)}`;let o=Object.entries(r),a=[],[c,f]=o[0];O(f)?a.push(`${n}- ${p.bold(c)}: ${_(f)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(N(f,t+2)));for(let[m,y]of o.slice(1))O(y)?a.push(`${n} ${p.bold(m)}: ${_(y)}`):(a.push(`${n} ${p.bold(m)}:`),a.push(N(y,t+2)));return a.join(`
5
5
  `)}).join(`
6
6
 
@@ -14,5 +14,5 @@ ${N(a,t+1)}`).join(`
14
14
 
15
15
  Run \`mp skill install\` to install AI skills for Claude Code.
16
16
 
17
- `+T).version(C).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-JMWCGUIQ.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=[],w=[];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"&&w.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 w){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","prediction-market_position_buy","prediction-market_position_sell","commerce_cart_update","commerce_checkout_start","commerce_checkout_pay"]);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=[],w=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=ae(s),d=ce(s);le(s)&&w.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 w)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(`
17
+ `+T).version(C).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-UCK2YO4V.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=[],w=[];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"&&w.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 w){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","prediction-market_position_buy","prediction-market_position_sell","commerce_cart_update","commerce_checkout_start","commerce_checkout_pay"]);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=[],w=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=ae(s),d=ce(s);le(s)&&w.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 w)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();
@@ -0,0 +1,11 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{e as f}from"./chunk-INE4OXJA.js";import"./chunk-LMDE72OE.js";var L=3e4,$=new Set(["BOLOS","dashboard",""]),v=`Ledger support requires additional packages.
3
+ Run: npm i -g @moonpay/cli --include=optional`;async function b(){try{let[e,t,n]=await Promise.all([import("@ledgerhq/device-management-kit"),import("@ledgerhq/device-transport-kit-node-hid"),import("rxjs")]);return{...e,...t,...n}}catch{throw new Error(v)}}async function A(){try{return await import("@ledgerhq/device-signer-kit-ethereum")}catch{throw new Error(v)}}async function E(){try{return await import("@ledgerhq/device-signer-kit-solana")}catch{throw new Error(v)}}var k=null,p=null;async function w(){if(!k){let e=await b();k=new e.DeviceManagementKitBuilder().addTransport(e.nodeHidTransportFactory).build()}return k}function y(){if(!p)throw new Error("No Ledger device connected. Connect first.");return p}var T={"unlock-device":"Unlock your Ledger device","confirm-open-app":"Confirm opening the app on your Ledger","sign-transaction":"Review and sign the transaction on your Ledger","sign-personal-message":"Review and sign the message on your Ledger","verify-address":"Verify the address shown on your Ledger"};async function m(e,t,n=6e4){let{DeviceActionStatus:s}=await import("@ledgerhq/device-management-kit");return new Promise((a,o)=>{let d="",c=!1,i=l=>{c||(c=!0,clearTimeout(u),g.unsubscribe(),l())},u=setTimeout(()=>{i(()=>{e.cancel(),o(new Error(`${t} timed out after ${n/1e3}s. Make sure the correct app is open on your Ledger and try again.`))})},n),g=e.observable.subscribe({next:l=>{switch(l.status){case s.Pending:{let r=l.intermediateValue?.requiredUserInteraction??"";if(r&&r!=="none"&&r!==d){d=r;let h=T[r]??r;h&&process.stderr.write(` ${h}
4
+ `)}break}case s.Completed:i(()=>a(l.output));break;case s.Error:i(()=>{let r=l.error,h=r instanceof Error?r.message:r&&typeof r=="object"?r._tag??r.message??JSON.stringify(r):String(r);o(new Error(`${t} failed: ${h}`))});break;case s.Stopped:i(()=>o(new Error(`${t} was cancelled`)));break}},error:l=>i(()=>o(l))})})}async function O(){try{let e=await b(),t=await w(),n=t.startDiscovering({});return await e.firstValueFrom(n.pipe(e.take(1),e.timeout(3e3))).finally(()=>{t.stopDiscovering()}),!0}catch{return!1}}async function x(){let e=await b(),t=(await w()).startDiscovering({});process.stderr.write(`Scanning for Ledger devices via USB...
5
+ `);let n=await e.firstValueFrom(t.pipe(e.take(1),e.timeout(L))).finally(()=>{(async()=>(await w()).stopDiscovering())()}),s=n.deviceModel.model??n.deviceModel.id;return process.stderr.write(`Connecting to Ledger ${s}...
6
+ `),p=await(await w()).connect({device:n,sessionRefresherOptions:{isRefresherDisabled:!0}}),process.stderr.write(`Connected to Ledger ${s}
7
+ `),p}async function C(){if(!p)return null;try{let t=(await w()).getDeviceSessionState({sessionId:p}),n=null;return t.subscribe(a=>{a.sessionStateType==="readyWithoutSecureChannel"&&(n=a.currentApp?.name??null)}).unsubscribe(),n}catch{return null}}var P={ethereum:"Ethereum",solana:"Solana",bitcoin:"Bitcoin",tron:"Tron"};async function D(e){let t=f[e],n=P[t],s=await C();if(s===n||!s||$.has(s))return;process.stderr.write(`Opening ${n} app on your Ledger...
8
+ `);let{OpenAppDeviceAction:a}=await import("@ledgerhq/device-management-kit"),o=new a({input:{appName:n}}),c=(await w()).executeDeviceAction({sessionId:y(),deviceAction:o});await m(c,`Open ${n}`),await new Promise(i=>setTimeout(i,2e3)),await C()||(p=null,await x())}function B(e,t=0){switch(e){case"ethereum":return`44'/60'/${t}'/0/0`;case"solana":return`44'/501'/${t}'/0'`;case"bitcoin":return`84'/0'/${t}'/0/0`;case"tron":return`44'/195'/${t}'/0/0`}}async function S(e){let t=f[e];await D(e);let n=B(t),s=y(),a=await w();switch(t){case"ethereum":case"tron":{let{SignerEthBuilder:o}=await A(),c=new o({dmk:a,sessionId:s}).build().getAddress(n,{skipOpenApp:!1});return(await m(c,`Get ${t} address`)).address}case"solana":{let{SignerSolanaBuilder:o}=await E(),c=new o({dmk:a,sessionId:s}).build().getAddress(n,{skipOpenApp:!1});return await m(c,"Get Solana address")}case"bitcoin":throw new Error("Bitcoin address derivation via Ledger is not yet supported.")}}async function I(){let e={};try{e.ethereum=await S("ethereum")}catch(t){process.stderr.write(`Failed to get Ethereum address: ${t}
9
+ `)}try{e.solana=await S("solana")}catch(t){process.stderr.write(`Failed to get Solana address: ${t}
10
+ `)}try{e.tron=await S("tron")}catch(t){process.stderr.write(`Failed to get Tron address: ${t}
11
+ `)}if(!e.ethereum&&!e.solana&&!e.tron)throw new Error("Could not derive any addresses from Ledger device");return e}async function M(e,t){let n=f[e];await D(e);let s=B(n),a=y(),o=await w();switch(n){case"ethereum":case"tron":{let{SignerEthBuilder:d}=await A(),c=new d({dmk:o,sessionId:a}).build(),i=t.startsWith("0x")?Uint8Array.from(Buffer.from(t.slice(2),"hex")):Uint8Array.from(Buffer.from(t,"base64")),u=c.signTransaction(s,i,{skipOpenApp:!1}),g=await m(u,"Sign transaction");return{transaction:JSON.stringify({r:g.r,s:g.s,v:g.v})}}case"solana":{let{SignerSolanaBuilder:d}=await E(),c=new d({dmk:o,sessionId:a}).build(),i=Uint8Array.from(Buffer.from(t,"base64")),u=c.signTransaction(s,i,{skipOpenApp:!1}),g=await m(u,"Sign Solana transaction"),{VersionedTransaction:l}=await import("@solana/web3.js"),r=l.deserialize(i);return r.signatures[0]=g,{transaction:Buffer.from(r.serialize()).toString("base64")}}case"bitcoin":throw new Error("Bitcoin transaction signing via Ledger is not yet supported. Use a software wallet for Bitcoin transactions.")}}async function _(e,t){let n=f[e];await D(e);let s=B(n),a=y(),o=await w();switch(n){case"ethereum":case"tron":{let{SignerEthBuilder:d}=await A(),i=new d({dmk:o,sessionId:a}).build().signMessage(s,t,{skipOpenApp:!1}),u=await m(i,"Sign message"),g=u.v.toString(16).padStart(2,"0");return{signature:`0x${u.r}${u.s}${g}`}}case"solana":{let{SignerSolanaBuilder:d}=await E(),c=new d({dmk:o,sessionId:a}).build(),i=Buffer.from(t,"utf8").toString("hex"),u=c.signMessage(s,i,{skipOpenApp:!1}),g=await m(u,"Sign Solana message");return{signature:(await import("bs58")).default.encode(g)}}case"bitcoin":throw new Error("Bitcoin message signing via Ledger is not yet supported. Use a software wallet for Bitcoin message signing.")}}async function N(){p&&(await(await w()).disconnect({sessionId:p}),p=null)}export{x as connectLedger,N as disconnectLedger,O as isLedgerConnected,S as ledgerGetAddress,I as ledgerGetAllAddresses,_ as ledgerSignMessage,M as ledgerSignTransaction};
@@ -0,0 +1,2 @@
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-NZ4AUIQB.js";import{a as u,h as f}from"./chunk-5R67DV4J.js";import"./chunk-INE4OXJA.js";import"./chunk-LMDE72OE.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};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{$ as D,$a as Da,$b as Db,$c as Dc,$d as Dd,$e as De,$f as Ef,$g as Eg,$h as Eh,$i as Ei,$j as Ej,$k as Ek,$l as El,$m as Em,$n as Fn,A as c,Aa as ca,Ab as cb,Ac as cc,Ad as cd,Ae as ce,Af as cf,Ag as dg,Ah as dh,Ai as di,Aj as dj,Ak as dk,Al as dl,Am as dm,An as dn,Ao as fo,B as d,Ba as da,Bb as db,Bc as dc,Bd as dd,Be as de,Bf as df,Bg as eg,Bh as eh,Bi as ei,Bj as ej,Bk as ek,Bl as el,Bm as em,Bn as en,Bo as go,C as e,Ca as ea,Cb as eb,Cc as ec,Cd as ed,Ce as ee,Cf as ef,Cg as fg,Ch as fh,Ci as fi,Cj as fj,Ck as fk,Cl as fl,Cm as fm,Cn as fn,Co as ho,D as f,Da as fa,Db as fb,Dc as fc,Dd as fd,De as fe,Df as ff,Dg as gg,Dh as gh,Di as gi,Dj as gj,Dk as gk,Dl as gl,Dm as gm,Dn as gn,Do as io,E as g,Ea as ga,Eb as gb,Ec as gc,Ed as gd,Ee as ge,Ef as gf,Eg as hg,Eh as hh,Ei as hi,Ej as hj,Ek as hk,El as hl,Em as hm,En as hn,Eo as jo,F as h,Fa as ha,Fb as hb,Fc as hc,Fd as hd,Fe as he,Ff as hf,Fg as ig,Fh as ih,Fi as ii,Fj as ij,Fk as ik,Fl as il,Fm as im,Fn as jn,Fo as ko,G as i,Ga as ia,Gb as ib,Gc as ic,Gd as id,Ge as ie,Gf as jf,Gg as jg,Gh as jh,Gi as ji,Gj as jj,Gk as jk,Gl as jl,Gm as jm,Gn as kn,Go as lo,H as j,Ha as ja,Hb as jb,Hc as jc,Hd as jd,He as je,Hf as kf,Hg as kg,Hh as kh,Hi as ki,Hj as kj,Hk as kk,Hl as kl,Hm as km,Hn as ln,Ho as mo,I as k,Ia as ka,Ib as kb,Ic as kc,Id as kd,Ie as ke,If as lf,Ig as lg,Ih as lh,Ii as li,Ij as lj,Ik as lk,Il as ll,Im as lm,In as mn,Io as no,J as l,Ja as la,Jb as lb,Jc as lc,Jd as ld,Je as le,Jf as mf,Jg as mg,Jh as mh,Ji as mi,Jj as mj,Jk as mk,Jl as ml,Jm as mm,Jn as nn,Jo as oo,K as m,Ka as ma,Kb as mb,Kc as mc,Kd as md,Ke as me,Kf as nf,Kg as ng,Kh as nh,Ki as ni,Kj as nj,Kk as nk,Kl as nl,Km as nm,Kn as on,Ko as po,L as n,La as na,Lb as nb,Lc as nc,Ld as nd,Le as ne,Lf as of,Lg as og,Lh as oh,Li as oi,Lj as oj,Lk as ok,Ll as ol,Lm as om,Ln as pn,Lo as qo,M as o,Ma as oa,Mb as ob,Mc as oc,Md as od,Me as oe,Mf as pf,Mg as pg,Mh as ph,Mi as pi,Mj as pj,Mk as pk,Ml as pl,Mm as pm,Mn as qn,Mo as ro,N as p,Na as pa,Nb as pb,Nc as pc,Nd as pd,Ne as pe,Nf as qf,Ng as qg,Nh as qh,Ni as qi,Nj as qj,Nk as qk,Nl as ql,Nm as qm,Nn as rn,No as so,O as q,Oa as qa,Ob as qb,Oc as qc,Od as qd,Oe as qe,Of as rf,Og as rg,Oh as rh,Oi as ri,Oj as rj,Ok as rk,Ol as rl,Om as rm,On as sn,Oo as to,P as r,Pa as ra,Pb as rb,Pc as rc,Pd as rd,Pe as re,Pf as sf,Pg as sg,Ph as sh,Pi as si,Pj as sj,Pk as sk,Pl as sl,Pm as sm,Pn as tn,Po as uo,Q as s,Qa as sa,Qb as sb,Qc as sc,Qd as sd,Qe as se,Qf as tf,Qg as tg,Qh as th,Qi as ti,Qj as tj,Qk as tk,Ql as tl,Qm as tm,Qn as un,R as t,Ra as ta,Rb as tb,Rc as tc,Rd as td,Re as te,Rf as uf,Rg as ug,Rh as uh,Ri as ui,Rj as uj,Rk as uk,Rl as ul,Rm as um,Rn as vn,S as u,Sa as ua,Sb as ub,Sc as uc,Sd as ud,Se as ue,Sf as vf,Sg as vg,Sh as vh,Si as vi,Sj as vj,Sk as vk,Sl as vl,Sm as vm,Sn as wn,T as v,Ta as va,Tb as vb,Tc as vc,Td as vd,Te as ve,Tf as wf,Tg as wg,Th as wh,Ti as wi,Tj as wj,Tk as wk,Tl as wl,Tm as wm,Tn as xn,U as w,Ua as wa,Ub as wb,Uc as wc,Ud as wd,Ue as we,Uf as xf,Ug as xg,Uh as xh,Ui as xi,Uj as xj,Uk as xk,Ul as xl,Um as xm,Un as yn,V as x,Va as xa,Vb as xb,Vc as xc,Vd as xd,Ve as xe,Vf as yf,Vg as yg,Vh as yh,Vi as yi,Vj as yj,Vk as yk,Vl as yl,Vm as ym,Vn as zn,W as y,Wa as ya,Wb as yb,Wc as yc,Wd as yd,We as ye,Wf as zf,Wg as zg,Wh as zh,Wi as zi,Wj as zj,Wk as zk,Wl as zl,Wm as zm,Wn as An,X as z,Xa as za,Xb as zb,Xc as zc,Xd as zd,Xe as ze,Xf as Af,Xg as Ag,Xh as Ah,Xi as Ai,Xj as Aj,Xk as Ak,Xl as Al,Xm as Am,Xn as Bn,Y as A,Ya as Aa,Yb as Ab,Yc as Ac,Yd as Ad,Ye as Ae,Yf as Bf,Yg as Bg,Yh as Bh,Yi as Bi,Yj as Bj,Yk as Bk,Yl as Bl,Ym as Bm,Yn as Cn,Z as B,Za as Ba,Zb as Bb,Zc as Bc,Zd as Bd,Ze as Be,Zf as Cf,Zg as Cg,Zh as Ch,Zi as Ci,Zj as Cj,Zk as Ck,Zl as Cl,Zm as Cm,Zn as Dn,_ as C,_a as Ca,_b as Cb,_c as Cc,_d as Cd,_e as Ce,_f as Df,_g as Dg,_h as Dh,_i as Di,_j as Dj,_k as Dk,_l as Dl,_m as Dm,_n as En,aa as E,ab as Ea,ac as Eb,ad as Ec,ae as Ed,af as Ee,ag as Ff,ah as Fg,ai as Fh,aj as Fi,ak as Fj,al as Fk,am as Fl,an as Fm,ao as Gn,ba as F,bb as Fa,bc as Fb,bd as Fc,be as Fd,bf as Fe,bg as Gf,bh as Gg,bi as Gh,bj as Gi,bk as Gj,bl as Gk,bm as Gl,bn as Gm,bo as Hn,ca as G,cb as Ga,cc as Gb,cd as Gc,ce as Gd,cf as Ge,cg as Hf,ch as Hg,ci as Hh,cj as Hi,ck as Hj,cl as Hk,cm as Hl,cn as Hm,co as In,da as H,db as Ha,dc as Hb,dd as Hc,de as Hd,df as He,dg as If,dh as Ig,di as Ih,dj as Ii,dk as Ij,dl as Ik,dm as Il,dn as Im,do as Jn,ea as I,eb as Ia,ec as Ib,ed as Ic,ee as Id,ef as Ie,eg as Jf,eh as Jg,ei as Jh,ej as Ji,ek as Jj,el as Jk,em as Jl,en as Jm,eo as Kn,fa as J,fb as Ja,fc as Jb,fd as Jc,fe as Jd,ff as Je,fg as Kf,fh as Kg,fi as Kh,fj as Ki,fk as Kj,fl as Kk,fm as Kl,fn as Km,fo as Ln,ga as K,gb as Ka,gc as Kb,gd as Kc,ge as Kd,gf as Ke,gg as Lf,gh as Lg,gi as Lh,gj as Li,gk as Lj,gl as Lk,gm as Ll,gn as Lm,go as Mn,ha as L,hb as La,hc as Lb,hd as Lc,he as Ld,hf as Le,hg as Mf,hh as Mg,hi as Mh,hj as Mi,hk as Mj,hl as Mk,hm as Ml,hn as Mm,ho as Nn,ia as M,ib as Ma,ic as Mb,id as Mc,ie as Md,if as Me,ig as Nf,ih as Ng,ii as Nh,ij as Ni,ik as Nj,il as Nk,im as Nl,in as Nm,io as On,ja as N,jb as Na,jc as Nb,jd as Nc,je as Nd,jf as Ne,jg as Of,jh as Og,ji as Oh,jj as Oi,jk as Oj,jl as Ok,jm as Ol,jn as Om,jo as Pn,ka as O,kb as Oa,kc as Ob,kd as Oc,ke as Od,kf as Oe,kg as Pf,kh as Pg,ki as Ph,kj as Pi,kk as Pj,kl as Pk,km as Pl,kn as Pm,ko as Qn,la as P,lb as Pa,lc as Pb,ld as Pc,le as Pd,lf as Pe,lg as Qf,lh as Qg,li as Qh,lj as Qi,lk as Qj,ll as Qk,lm as Ql,ln as Qm,lo as Rn,ma as Q,mb as Qa,mc as Qb,md as Qc,me as Qd,mf as Qe,mg as Rf,mh as Rg,mi as Rh,mj as Ri,mk as Rj,ml as Rk,mm as Rl,mn as Rm,mo as Sn,na as R,nb as Ra,nc as Rb,nd as Rc,ne as Rd,nf as Re,ng as Sf,nh as Sg,ni as Sh,nj as Si,nk as Sj,nl as Sk,nm as Sl,nn as Sm,no as Tn,oa as S,ob as Sa,oc as Sb,od as Sc,oe as Sd,of as Se,og as Tf,oh as Tg,oi as Th,oj as Ti,ok as Tj,ol as Tk,om as Tl,on as Tm,oo as Un,pa as T,pb as Ta,pc as Tb,pd as Tc,pe as Td,pf as Te,pg as Uf,ph as Ug,pi as Uh,pj as Ui,pk as Uj,pl as Uk,pm as Ul,pn as Um,po as Vn,qa as U,qb as Ua,qc as Ub,qd as Uc,qe as Ud,qf as Ue,qg as Vf,qh as Vg,qi as Vh,qj as Vi,qk as Vj,ql as Vk,qm as Vl,qn as Vm,qo as Wn,ra as V,rb as Va,rc as Vb,rd as Vc,re as Vd,rf as Ve,rg as Wf,rh as Wg,ri as Wh,rj as Wi,rk as Wj,rl as Wk,rm as Wl,rn as Wm,ro as Xn,sa as W,sb as Wa,sc as Wb,sd as Wc,se as Wd,sf as We,sg as Xf,sh as Xg,si as Xh,sj as Xi,sk as Xj,sl as Xk,sm as Xl,sn as Xm,so as Yn,ta as X,tb as Xa,tc as Xb,td as Xc,te as Xd,tf as Xe,tg as Yf,th as Yg,ti as Yh,tj as Yi,tk as Yj,tl as Yk,tm as Yl,tn as Ym,to as Zn,ua as Y,ub as Ya,uc as Yb,ud as Yc,ue as Yd,uf as Ye,ug as Zf,uh as Zg,ui as Zh,uj as Zi,uk as Zj,ul as Zk,um as Zl,un as Zm,uo as _n,va as Z,vb as Za,vc as Zb,vd as Zc,ve as Zd,vf as Ze,vg as _f,vh as _g,vi as _h,vj as _i,vk as _j,vl as _k,vm as _l,vn as _m,vo as $n,wa as _,wb as _a,wc as _b,wd as _c,we as _d,wf as _e,wg as $f,wh as $g,wi as $h,wj as $i,wk as $j,wl as $k,wm as $l,wn as $m,wo as ao,xa as $,xb as $a,xc as $b,xd as $c,xe as $d,xf as $e,xg as ag,xh as ah,xi as ai,xj as aj,xk as ak,xl as al,xm as am,xn as an,xo as bo,y as a,ya as aa,yb as ab,yc as ac,yd as ad,ye as ae,yf as af,yg as bg,yh as bh,yi as bi,yj as bj,yk as bk,yl as bl,ym as bm,yn as bn,yo as co,z as b,za as ba,zb as bb,zc as bc,zd as bd,ze as be,zf as bf,zg as cg,zh as ch,zi as ci,zj as cj,zk as ck,zl as cl,zm as cm,zn as cn,zo as eo}from"./chunk-AT2QGHZK.js";import"./chunk-LMDE72OE.js";export{Ja as AMOUNT_TO_UI_AMOUNT_DISCRIMINATOR,Sa as APPLY_CONFIDENTIAL_PENDING_BALANCE_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Qa as APPLY_CONFIDENTIAL_PENDING_BALANCE_DISCRIMINATOR,eb as APPROVE_CHECKED_DISCRIMINATOR,nb as APPROVE_CONFIDENTIAL_TRANSFER_ACCOUNT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,lb as APPROVE_CONFIDENTIAL_TRANSFER_ACCOUNT_DISCRIMINATOR,Za as APPROVE_DISCRIMINATOR,ka as ASSOCIATED_TOKEN_ERROR__INVALID_OWNER,ca as ASSOCIATED_TOKEN_PROGRAM_ADDRESS,a as AccountState,da as AssociatedTokenInstruction,e as AuthorityType,Bb as BURN_CHECKED_DISCRIMINATOR,ub as BURN_DISCRIMINATOR,Ib as CLOSE_ACCOUNT_DISCRIMINATOR,Rb as CONFIDENTIAL_DEPOSIT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Pb as CONFIDENTIAL_DEPOSIT_DISCRIMINATOR,_b as CONFIDENTIAL_TRANSFER_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Yb as CONFIDENTIAL_TRANSFER_DISCRIMINATOR,hc as CONFIDENTIAL_TRANSFER_WITH_FEE_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,fc as CONFIDENTIAL_TRANSFER_WITH_FEE_DISCRIMINATOR,qc as CONFIDENTIAL_WITHDRAW_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,oc as CONFIDENTIAL_WITHDRAW_DISCRIMINATOR,zc as CONFIGURE_CONFIDENTIAL_TRANSFER_ACCOUNT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,xc as CONFIGURE_CONFIDENTIAL_TRANSFER_ACCOUNT_DISCRIMINATOR,Hc as CREATE_ASSOCIATED_TOKEN_DISCRIMINATOR,Pc as CREATE_ASSOCIATED_TOKEN_IDEMPOTENT_DISCRIMINATOR,Xc as CREATE_NATIVE_MINT_DISCRIMINATOR,ed as DISABLE_CONFIDENTIAL_CREDITS_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,cd as DISABLE_CONFIDENTIAL_CREDITS_DISCRIMINATOR,nd as DISABLE_CPI_GUARD_CPI_GUARD_DISCRIMINATOR,ld as DISABLE_CPI_GUARD_DISCRIMINATOR,wd as DISABLE_HARVEST_TO_MINT_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,ud as DISABLE_HARVEST_TO_MINT_DISCRIMINATOR,Dd as DISABLE_MEMO_TRANSFERS_DISCRIMINATOR,Fd as DISABLE_MEMO_TRANSFERS_MEMO_TRANSFERS_DISCRIMINATOR,Od as DISABLE_NON_CONFIDENTIAL_CREDITS_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Md as DISABLE_NON_CONFIDENTIAL_CREDITS_DISCRIMINATOR,Vd as EMIT_TOKEN_METADATA_DISCRIMINATOR,ce as EMPTY_CONFIDENTIAL_TRANSFER_ACCOUNT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,ae as EMPTY_CONFIDENTIAL_TRANSFER_ACCOUNT_DISCRIMINATOR,le as ENABLE_CONFIDENTIAL_CREDITS_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,je as ENABLE_CONFIDENTIAL_CREDITS_DISCRIMINATOR,ue as ENABLE_CPI_GUARD_CPI_GUARD_DISCRIMINATOR,se as ENABLE_CPI_GUARD_DISCRIMINATOR,De as ENABLE_HARVEST_TO_MINT_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,Be as ENABLE_HARVEST_TO_MINT_DISCRIMINATOR,Ke as ENABLE_MEMO_TRANSFERS_DISCRIMINATOR,Me as ENABLE_MEMO_TRANSFERS_MEMO_TRANSFERS_DISCRIMINATOR,Ve as ENABLE_NON_CONFIDENTIAL_CREDITS_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Te as ENABLE_NON_CONFIDENTIAL_CREDITS_DISCRIMINATOR,t as ExtensionType,af as FREEZE_ACCOUNT_DISCRIMINATOR,hf as GET_ACCOUNT_DATA_SIZE_DISCRIMINATOR,pf as HARVEST_WITHHELD_TOKENS_TO_MINT_DISCRIMINATOR,Af as HARVEST_WITHHELD_TOKENS_TO_MINT_FOR_CONFIDENTIAL_TRANSFER_FEE_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,yf as HARVEST_WITHHELD_TOKENS_TO_MINT_FOR_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,rf as HARVEST_WITHHELD_TOKENS_TO_MINT_TRANSFER_FEE_DISCRIMINATOR,Of as INITIALIZE_ACCOUNT2_DISCRIMINATOR,Vf as INITIALIZE_ACCOUNT3_DISCRIMINATOR,Hf as INITIALIZE_ACCOUNT_DISCRIMINATOR,cg as INITIALIZE_CONFIDENTIAL_TRANSFER_FEE_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,ag as INITIALIZE_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,lg as INITIALIZE_CONFIDENTIAL_TRANSFER_MINT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,jg as INITIALIZE_CONFIDENTIAL_TRANSFER_MINT_DISCRIMINATOR,ug as INITIALIZE_DEFAULT_ACCOUNT_STATE_DEFAULT_ACCOUNT_STATE_DISCRIMINATOR,sg as INITIALIZE_DEFAULT_ACCOUNT_STATE_DISCRIMINATOR,Bg as INITIALIZE_GROUP_MEMBER_POINTER_DISCRIMINATOR,Dg as INITIALIZE_GROUP_MEMBER_POINTER_GROUP_MEMBER_POINTER_DISCRIMINATOR,Kg as INITIALIZE_GROUP_POINTER_DISCRIMINATOR,Mg as INITIALIZE_GROUP_POINTER_GROUP_POINTER_DISCRIMINATOR,Tg as INITIALIZE_IMMUTABLE_OWNER_DISCRIMINATOR,_g as INITIALIZE_INTEREST_BEARING_MINT_DISCRIMINATOR,ah as INITIALIZE_INTEREST_BEARING_MINT_INTEREST_BEARING_MINT_DISCRIMINATOR,hh as INITIALIZE_METADATA_POINTER_DISCRIMINATOR,jh as INITIALIZE_METADATA_POINTER_METADATA_POINTER_DISCRIMINATOR,xh as INITIALIZE_MINT2_DISCRIMINATOR,Eh as INITIALIZE_MINT_CLOSE_AUTHORITY_DISCRIMINATOR,qh as INITIALIZE_MINT_DISCRIMINATOR,Sh as INITIALIZE_MULTISIG2_DISCRIMINATOR,Lh as INITIALIZE_MULTISIG_DISCRIMINATOR,Zh as INITIALIZE_NON_TRANSFERABLE_MINT_DISCRIMINATOR,ei as INITIALIZE_PAUSABLE_CONFIG_DISCRIMINATOR,gi as INITIALIZE_PAUSABLE_CONFIG_PAUSABLE_DISCRIMINATOR,ni as INITIALIZE_PERMANENT_DELEGATE_DISCRIMINATOR,ui as INITIALIZE_SCALED_UI_AMOUNT_MINT_DISCRIMINATOR,wi as INITIALIZE_SCALED_UI_AMOUNT_MINT_SCALED_UI_AMOUNT_MINT_DISCRIMINATOR,Di as INITIALIZE_TOKEN_GROUP_DISCRIMINATOR,Ki as INITIALIZE_TOKEN_GROUP_MEMBER_DISCRIMINATOR,Ri as INITIALIZE_TOKEN_METADATA_DISCRIMINATOR,Yi as INITIALIZE_TRANSFER_FEE_CONFIG_DISCRIMINATOR,_i as INITIALIZE_TRANSFER_FEE_CONFIG_TRANSFER_FEE_DISCRIMINATOR,fj as INITIALIZE_TRANSFER_HOOK_DISCRIMINATOR,hj as INITIALIZE_TRANSFER_HOOK_TRANSFER_HOOK_DISCRIMINATOR,vj as MINT_TO_CHECKED_DISCRIMINATOR,oj as MINT_TO_DISCRIMINATOR,Cj as PAUSE_DISCRIMINATOR,Ej as PAUSE_PAUSABLE_DISCRIMINATOR,Lj as REALLOCATE_DISCRIMINATOR,Sj as RECOVER_NESTED_ASSOCIATED_TOKEN_DISCRIMINATOR,_j as REMOVE_TOKEN_METADATA_KEY_DISCRIMINATOR,fk as RESUME_DISCRIMINATOR,hk as RESUME_PAUSABLE_DISCRIMINATOR,ok as REVOKE_DISCRIMINATOR,vk as SET_AUTHORITY_DISCRIMINATOR,Ck as SET_TRANSFER_FEE_DISCRIMINATOR,Ek as SET_TRANSFER_FEE_TRANSFER_FEE_DISCRIMINATOR,Lk as SYNC_NATIVE_DISCRIMINATOR,Sk as THAW_ACCOUNT_DISCRIMINATOR,Ea as TOKEN_2022_ERROR__ACCOUNT_FROZEN,ta as TOKEN_2022_ERROR__ALREADY_IN_USE,Ca as TOKEN_2022_ERROR__AUTHORITY_TYPE_NOT_SUPPORTED,sa as TOKEN_2022_ERROR__FIXED_SUPPLY,oa as TOKEN_2022_ERROR__INSUFFICIENT_FUNDS,za as TOKEN_2022_ERROR__INVALID_INSTRUCTION,pa as TOKEN_2022_ERROR__INVALID_MINT,ua as TOKEN_2022_ERROR__INVALID_NUMBER_OF_PROVIDED_SIGNERS,va as TOKEN_2022_ERROR__INVALID_NUMBER_OF_REQUIRED_SIGNERS,Aa as TOKEN_2022_ERROR__INVALID_STATE,Da as TOKEN_2022_ERROR__MINT_CANNOT_FREEZE,Fa as TOKEN_2022_ERROR__MINT_DECIMALS_MISMATCH,qa as TOKEN_2022_ERROR__MINT_MISMATCH,xa as TOKEN_2022_ERROR__NATIVE_NOT_SUPPORTED,ya as TOKEN_2022_ERROR__NON_NATIVE_HAS_BALANCE,Ga as TOKEN_2022_ERROR__NON_NATIVE_NOT_SUPPORTED,na as TOKEN_2022_ERROR__NOT_RENT_EXEMPT,Ba as TOKEN_2022_ERROR__OVERFLOW,ra as TOKEN_2022_ERROR__OWNER_MISMATCH,wa as TOKEN_2022_ERROR__UNINITIALIZED_STATE,fa as TOKEN_2022_PROGRAM_ADDRESS,el as TRANSFER_CHECKED_DISCRIMINATOR,ll as TRANSFER_CHECKED_WITH_FEE_DISCRIMINATOR,nl as TRANSFER_CHECKED_WITH_FEE_TRANSFER_FEE_DISCRIMINATOR,Zk as TRANSFER_DISCRIMINATOR,ga as Token2022Account,ia as Token2022Instruction,ul as UI_AMOUNT_TO_AMOUNT_DISCRIMINATOR,Dl as UPDATE_CONFIDENTIAL_TRANSFER_MINT_CONFIDENTIAL_TRANSFER_DISCRIMINATOR,Bl as UPDATE_CONFIDENTIAL_TRANSFER_MINT_DISCRIMINATOR,Ml as UPDATE_DEFAULT_ACCOUNT_STATE_DEFAULT_ACCOUNT_STATE_DISCRIMINATOR,Kl as UPDATE_DEFAULT_ACCOUNT_STATE_DISCRIMINATOR,Tl as UPDATE_GROUP_MEMBER_POINTER_DISCRIMINATOR,Vl as UPDATE_GROUP_MEMBER_POINTER_GROUP_MEMBER_POINTER_DISCRIMINATOR,am as UPDATE_GROUP_POINTER_DISCRIMINATOR,cm as UPDATE_GROUP_POINTER_GROUP_POINTER_DISCRIMINATOR,jm as UPDATE_METADATA_POINTER_DISCRIMINATOR,lm as UPDATE_METADATA_POINTER_METADATA_POINTER_DISCRIMINATOR,sm as UPDATE_MULTIPLIER_SCALED_UI_MINT_DISCRIMINATOR,um as UPDATE_MULTIPLIER_SCALED_UI_MINT_SCALED_UI_AMOUNT_MINT_DISCRIMINATOR,Bm as UPDATE_RATE_INTEREST_BEARING_MINT_DISCRIMINATOR,Dm as UPDATE_RATE_INTEREST_BEARING_MINT_INTEREST_BEARING_MINT_DISCRIMINATOR,Km as UPDATE_TOKEN_GROUP_MAX_SIZE_DISCRIMINATOR,Rm as UPDATE_TOKEN_GROUP_UPDATE_AUTHORITY_DISCRIMINATOR,Ym as UPDATE_TOKEN_METADATA_FIELD_DISCRIMINATOR,dn as UPDATE_TOKEN_METADATA_UPDATE_AUTHORITY_DISCRIMINATOR,ln as UPDATE_TRANSFER_HOOK_DISCRIMINATOR,nn as UPDATE_TRANSFER_HOOK_TRANSFER_HOOK_DISCRIMINATOR,un as WITHDRAW_EXCESS_LAMPORTS_DISCRIMINATOR,Bn as WITHDRAW_WITHHELD_TOKENS_FROM_ACCOUNTS_DISCRIMINATOR,Mn as WITHDRAW_WITHHELD_TOKENS_FROM_ACCOUNTS_FOR_CONFIDENTIAL_TRANSFER_FEE_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,Kn as WITHDRAW_WITHHELD_TOKENS_FROM_ACCOUNTS_FOR_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,Dn as WITHDRAW_WITHHELD_TOKENS_FROM_ACCOUNTS_TRANSFER_FEE_DISCRIMINATOR,Tn as WITHDRAW_WITHHELD_TOKENS_FROM_MINT_DISCRIMINATOR,co as WITHDRAW_WITHHELD_TOKENS_FROM_MINT_FOR_CONFIDENTIAL_TRANSFER_FEE_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,ao as WITHDRAW_WITHHELD_TOKENS_FROM_MINT_FOR_CONFIDENTIAL_TRANSFER_FEE_DISCRIMINATOR,Vn as WITHDRAW_WITHHELD_TOKENS_FROM_MINT_TRANSFER_FEE_DISCRIMINATOR,ko as amountToUiAmountForInterestBearingMintWithoutSimulation,oo as amountToUiAmountForMintWithoutSimulation,mo as amountToUiAmountForScaledUiAmountMintWithoutSimulation,I as decodeMint,Q as decodeMultisig,Z as decodeToken,r as extension,M as fetchAllMaybeMint,U as fetchAllMaybeMultisig,ba as fetchAllMaybeToken,L as fetchAllMint,T as fetchAllMultisig,aa as fetchAllToken,K as fetchMaybeMint,S as fetchMaybeMultisig,$ as fetchMaybeToken,J as fetchMint,R as fetchMultisig,_ as fetchToken,Gc as findAssociatedTokenPda,d as getAccountStateCodec,c as getAccountStateDecoder,b as getAccountStateEncoder,Ka as getAmountToUiAmountDiscriminatorBytes,Oa as getAmountToUiAmountInstruction,Na as getAmountToUiAmountInstructionDataCodec,Ma as getAmountToUiAmountInstructionDataDecoder,La as getAmountToUiAmountInstructionDataEncoder,Ta as getApplyConfidentialPendingBalanceConfidentialTransferDiscriminatorBytes,Ra as getApplyConfidentialPendingBalanceDiscriminatorBytes,Xa as getApplyConfidentialPendingBalanceInstruction,Wa as getApplyConfidentialPendingBalanceInstructionDataCodec,Va as getApplyConfidentialPendingBalanceInstructionDataDecoder,Ua as getApplyConfidentialPendingBalanceInstructionDataEncoder,fb as getApproveCheckedDiscriminatorBytes,jb as getApproveCheckedInstruction,ib as getApproveCheckedInstructionDataCodec,hb as getApproveCheckedInstructionDataDecoder,gb as getApproveCheckedInstructionDataEncoder,ob as getApproveConfidentialTransferAccountConfidentialTransferDiscriminatorBytes,mb as getApproveConfidentialTransferAccountDiscriminatorBytes,sb as getApproveConfidentialTransferAccountInstruction,rb as getApproveConfidentialTransferAccountInstructionDataCodec,qb as getApproveConfidentialTransferAccountInstructionDataDecoder,pb as getApproveConfidentialTransferAccountInstructionDataEncoder,_a as getApproveDiscriminatorBytes,cb as getApproveInstruction,bb as getApproveInstructionDataCodec,ab as getApproveInstructionDataDecoder,$a as getApproveInstructionDataEncoder,la as getAssociatedTokenErrorMessage,h as getAuthorityTypeCodec,g as getAuthorityTypeDecoder,f as getAuthorityTypeEncoder,Cb as getBurnCheckedDiscriminatorBytes,Gb as getBurnCheckedInstruction,Fb as getBurnCheckedInstructionDataCodec,Eb as getBurnCheckedInstructionDataDecoder,Db as getBurnCheckedInstructionDataEncoder,vb as getBurnDiscriminatorBytes,zb as getBurnInstruction,yb as getBurnInstructionDataCodec,xb as getBurnInstructionDataDecoder,wb as getBurnInstructionDataEncoder,Jb as getCloseAccountDiscriminatorBytes,Nb as getCloseAccountInstruction,Mb as getCloseAccountInstructionDataCodec,Lb as getCloseAccountInstructionDataDecoder,Kb as getCloseAccountInstructionDataEncoder,Sb as getConfidentialDepositConfidentialTransferDiscriminatorBytes,Qb as getConfidentialDepositDiscriminatorBytes,Wb as getConfidentialDepositInstruction,Vb as getConfidentialDepositInstructionDataCodec,Ub as getConfidentialDepositInstructionDataDecoder,Tb as getConfidentialDepositInstructionDataEncoder,$b as getConfidentialTransferConfidentialTransferDiscriminatorBytes,Zb as getConfidentialTransferDiscriminatorBytes,dc as getConfidentialTransferInstruction,cc as getConfidentialTransferInstructionDataCodec,bc as getConfidentialTransferInstructionDataDecoder,ac as getConfidentialTransferInstructionDataEncoder,ic as getConfidentialTransferWithFeeConfidentialTransferDiscriminatorBytes,gc as getConfidentialTransferWithFeeDiscriminatorBytes,mc as getConfidentialTransferWithFeeInstruction,lc as getConfidentialTransferWithFeeInstructionDataCodec,kc as getConfidentialTransferWithFeeInstructionDataDecoder,jc as getConfidentialTransferWithFeeInstructionDataEncoder,rc as getConfidentialWithdrawConfidentialTransferDiscriminatorBytes,pc as getConfidentialWithdrawDiscriminatorBytes,vc as getConfidentialWithdrawInstruction,uc as getConfidentialWithdrawInstructionDataCodec,tc as getConfidentialWithdrawInstructionDataDecoder,sc as getConfidentialWithdrawInstructionDataEncoder,Ac as getConfigureConfidentialTransferAccountConfidentialTransferDiscriminatorBytes,yc as getConfigureConfidentialTransferAccountDiscriminatorBytes,Ec as getConfigureConfidentialTransferAccountInstruction,Dc as getConfigureConfidentialTransferAccountInstructionDataCodec,Cc as getConfigureConfidentialTransferAccountInstructionDataDecoder,Bc as getConfigureConfidentialTransferAccountInstructionDataEncoder,Ic as getCreateAssociatedTokenDiscriminatorBytes,Qc as getCreateAssociatedTokenIdempotentDiscriminatorBytes,Vc as getCreateAssociatedTokenIdempotentInstruction,Uc as getCreateAssociatedTokenIdempotentInstructionAsync,Tc as getCreateAssociatedTokenIdempotentInstructionDataCodec,Sc as getCreateAssociatedTokenIdempotentInstructionDataDecoder,Rc as getCreateAssociatedTokenIdempotentInstructionDataEncoder,Nc as getCreateAssociatedTokenInstruction,Mc as getCreateAssociatedTokenInstructionAsync,Lc as getCreateAssociatedTokenInstructionDataCodec,Kc as getCreateAssociatedTokenInstructionDataDecoder,Jc as getCreateAssociatedTokenInstructionDataEncoder,Yc as getCreateNativeMintDiscriminatorBytes,ad as getCreateNativeMintInstruction,$c as getCreateNativeMintInstructionDataCodec,_c as getCreateNativeMintInstructionDataDecoder,Zc as getCreateNativeMintInstructionDataEncoder,k as getDecryptableBalanceCodec,j as getDecryptableBalanceDecoder,i as getDecryptableBalanceEncoder,fd as getDisableConfidentialCreditsConfidentialTransferDiscriminatorBytes,dd as getDisableConfidentialCreditsDiscriminatorBytes,jd as getDisableConfidentialCreditsInstruction,id as getDisableConfidentialCreditsInstructionDataCodec,hd as getDisableConfidentialCreditsInstructionDataDecoder,gd as getDisableConfidentialCreditsInstructionDataEncoder,od as getDisableCpiGuardCpiGuardDiscriminatorBytes,md as getDisableCpiGuardDiscriminatorBytes,sd as getDisableCpiGuardInstruction,rd as getDisableCpiGuardInstructionDataCodec,qd as getDisableCpiGuardInstructionDataDecoder,pd as getDisableCpiGuardInstructionDataEncoder,xd as getDisableHarvestToMintConfidentialTransferFeeDiscriminatorBytes,vd as getDisableHarvestToMintDiscriminatorBytes,Bd as getDisableHarvestToMintInstruction,Ad as getDisableHarvestToMintInstructionDataCodec,zd as getDisableHarvestToMintInstructionDataDecoder,yd as getDisableHarvestToMintInstructionDataEncoder,Ed as getDisableMemoTransfersDiscriminatorBytes,Kd as getDisableMemoTransfersInstruction,Jd as getDisableMemoTransfersInstructionDataCodec,Id as getDisableMemoTransfersInstructionDataDecoder,Hd as getDisableMemoTransfersInstructionDataEncoder,Gd as getDisableMemoTransfersMemoTransfersDiscriminatorBytes,Pd as getDisableNonConfidentialCreditsConfidentialTransferDiscriminatorBytes,Nd as getDisableNonConfidentialCreditsDiscriminatorBytes,Td as getDisableNonConfidentialCreditsInstruction,Sd as getDisableNonConfidentialCreditsInstructionDataCodec,Rd as getDisableNonConfidentialCreditsInstructionDataDecoder,Qd as getDisableNonConfidentialCreditsInstructionDataEncoder,Wd as getEmitTokenMetadataDiscriminatorBytes,_d as getEmitTokenMetadataInstruction,Zd as getEmitTokenMetadataInstructionDataCodec,Yd as getEmitTokenMetadataInstructionDataDecoder,Xd as getEmitTokenMetadataInstructionDataEncoder,de as getEmptyConfidentialTransferAccountConfidentialTransferDiscriminatorBytes,be as getEmptyConfidentialTransferAccountDiscriminatorBytes,he as getEmptyConfidentialTransferAccountInstruction,ge as getEmptyConfidentialTransferAccountInstructionDataCodec,fe as getEmptyConfidentialTransferAccountInstructionDataDecoder,ee as getEmptyConfidentialTransferAccountInstructionDataEncoder,me as getEnableConfidentialCreditsConfidentialTransferDiscriminatorBytes,ke as getEnableConfidentialCreditsDiscriminatorBytes,qe as getEnableConfidentialCreditsInstruction,pe as getEnableConfidentialCreditsInstructionDataCodec,oe as getEnableConfidentialCreditsInstructionDataDecoder,ne as getEnableConfidentialCreditsInstructionDataEncoder,ve as getEnableCpiGuardCpiGuardDiscriminatorBytes,te as getEnableCpiGuardDiscriminatorBytes,ze as getEnableCpiGuardInstruction,ye as getEnableCpiGuardInstructionDataCodec,xe as getEnableCpiGuardInstructionDataDecoder,we as getEnableCpiGuardInstructionDataEncoder,Ee as getEnableHarvestToMintConfidentialTransferFeeDiscriminatorBytes,Ce as getEnableHarvestToMintDiscriminatorBytes,Ie as getEnableHarvestToMintInstruction,He as getEnableHarvestToMintInstructionDataCodec,Ge as getEnableHarvestToMintInstructionDataDecoder,Fe as getEnableHarvestToMintInstructionDataEncoder,Le as getEnableMemoTransfersDiscriminatorBytes,Re as getEnableMemoTransfersInstruction,Qe as getEnableMemoTransfersInstructionDataCodec,Pe as getEnableMemoTransfersInstructionDataDecoder,Oe as getEnableMemoTransfersInstructionDataEncoder,Ne as getEnableMemoTransfersMemoTransfersDiscriminatorBytes,We as getEnableNonConfidentialCreditsConfidentialTransferDiscriminatorBytes,Ue as getEnableNonConfidentialCreditsDiscriminatorBytes,_e as getEnableNonConfidentialCreditsInstruction,Ze as getEnableNonConfidentialCreditsInstructionDataCodec,Ye as getEnableNonConfidentialCreditsInstructionDataDecoder,Xe as getEnableNonConfidentialCreditsInstructionDataEncoder,n as getEncryptedBalanceCodec,m as getEncryptedBalanceDecoder,l as getEncryptedBalanceEncoder,q as getExtensionCodec,p as getExtensionDecoder,o as getExtensionEncoder,w as getExtensionTypeCodec,v as getExtensionTypeDecoder,u as getExtensionTypeEncoder,bf as getFreezeAccountDiscriminatorBytes,ff as getFreezeAccountInstruction,ef as getFreezeAccountInstructionDataCodec,df as getFreezeAccountInstructionDataDecoder,cf as getFreezeAccountInstructionDataEncoder,jf as getGetAccountDataSizeDiscriminatorBytes,nf as getGetAccountDataSizeInstruction,mf as getGetAccountDataSizeInstructionDataCodec,lf as getGetAccountDataSizeInstructionDataDecoder,kf as getGetAccountDataSizeInstructionDataEncoder,qf as getHarvestWithheldTokensToMintDiscriminatorBytes,Bf as getHarvestWithheldTokensToMintForConfidentialTransferFeeConfidentialTransferFeeDiscriminatorBytes,zf as getHarvestWithheldTokensToMintForConfidentialTransferFeeDiscriminatorBytes,Ff as getHarvestWithheldTokensToMintForConfidentialTransferFeeInstruction,Ef as getHarvestWithheldTokensToMintForConfidentialTransferFeeInstructionDataCodec,Df as getHarvestWithheldTokensToMintForConfidentialTransferFeeInstructionDataDecoder,Cf as getHarvestWithheldTokensToMintForConfidentialTransferFeeInstructionDataEncoder,wf as getHarvestWithheldTokensToMintInstruction,vf as getHarvestWithheldTokensToMintInstructionDataCodec,uf as getHarvestWithheldTokensToMintInstructionDataDecoder,tf as getHarvestWithheldTokensToMintInstructionDataEncoder,sf as getHarvestWithheldTokensToMintTransferFeeDiscriminatorBytes,Pf as getInitializeAccount2DiscriminatorBytes,Tf as getInitializeAccount2Instruction,Sf as getInitializeAccount2InstructionDataCodec,Rf as getInitializeAccount2InstructionDataDecoder,Qf as getInitializeAccount2InstructionDataEncoder,Wf as getInitializeAccount3DiscriminatorBytes,_f as getInitializeAccount3Instruction,Zf as getInitializeAccount3InstructionDataCodec,Yf as getInitializeAccount3InstructionDataDecoder,Xf as getInitializeAccount3InstructionDataEncoder,If as getInitializeAccountDiscriminatorBytes,Mf as getInitializeAccountInstruction,Lf as getInitializeAccountInstructionDataCodec,Kf as getInitializeAccountInstructionDataDecoder,Jf as getInitializeAccountInstructionDataEncoder,dg as getInitializeConfidentialTransferFeeConfidentialTransferFeeDiscriminatorBytes,bg as getInitializeConfidentialTransferFeeDiscriminatorBytes,hg as getInitializeConfidentialTransferFeeInstruction,gg as getInitializeConfidentialTransferFeeInstructionDataCodec,fg as getInitializeConfidentialTransferFeeInstructionDataDecoder,eg as getInitializeConfidentialTransferFeeInstructionDataEncoder,mg as getInitializeConfidentialTransferMintConfidentialTransferDiscriminatorBytes,kg as getInitializeConfidentialTransferMintDiscriminatorBytes,qg as getInitializeConfidentialTransferMintInstruction,pg as getInitializeConfidentialTransferMintInstructionDataCodec,og as getInitializeConfidentialTransferMintInstructionDataDecoder,ng as getInitializeConfidentialTransferMintInstructionDataEncoder,vg as getInitializeDefaultAccountStateDefaultAccountStateDiscriminatorBytes,tg as getInitializeDefaultAccountStateDiscriminatorBytes,zg as getInitializeDefaultAccountStateInstruction,yg as getInitializeDefaultAccountStateInstructionDataCodec,xg as getInitializeDefaultAccountStateInstructionDataDecoder,wg as getInitializeDefaultAccountStateInstructionDataEncoder,Cg as getInitializeGroupMemberPointerDiscriminatorBytes,Eg as getInitializeGroupMemberPointerGroupMemberPointerDiscriminatorBytes,Ig as getInitializeGroupMemberPointerInstruction,Hg as getInitializeGroupMemberPointerInstructionDataCodec,Gg as getInitializeGroupMemberPointerInstructionDataDecoder,Fg as getInitializeGroupMemberPointerInstructionDataEncoder,Lg as getInitializeGroupPointerDiscriminatorBytes,Ng as getInitializeGroupPointerGroupPointerDiscriminatorBytes,Rg as getInitializeGroupPointerInstruction,Qg as getInitializeGroupPointerInstructionDataCodec,Pg as getInitializeGroupPointerInstructionDataDecoder,Og as getInitializeGroupPointerInstructionDataEncoder,Ug as getInitializeImmutableOwnerDiscriminatorBytes,Yg as getInitializeImmutableOwnerInstruction,Xg as getInitializeImmutableOwnerInstructionDataCodec,Wg as getInitializeImmutableOwnerInstructionDataDecoder,Vg as getInitializeImmutableOwnerInstructionDataEncoder,$g as getInitializeInterestBearingMintDiscriminatorBytes,fh as getInitializeInterestBearingMintInstruction,eh as getInitializeInterestBearingMintInstructionDataCodec,dh as getInitializeInterestBearingMintInstructionDataDecoder,ch as getInitializeInterestBearingMintInstructionDataEncoder,bh as getInitializeInterestBearingMintInterestBearingMintDiscriminatorBytes,ih as getInitializeMetadataPointerDiscriminatorBytes,oh as getInitializeMetadataPointerInstruction,nh as getInitializeMetadataPointerInstructionDataCodec,mh as getInitializeMetadataPointerInstructionDataDecoder,lh as getInitializeMetadataPointerInstructionDataEncoder,kh as getInitializeMetadataPointerMetadataPointerDiscriminatorBytes,yh as getInitializeMint2DiscriminatorBytes,Ch as getInitializeMint2Instruction,Bh as getInitializeMint2InstructionDataCodec,Ah as getInitializeMint2InstructionDataDecoder,zh as getInitializeMint2InstructionDataEncoder,Fh as getInitializeMintCloseAuthorityDiscriminatorBytes,Jh as getInitializeMintCloseAuthorityInstruction,Ih as getInitializeMintCloseAuthorityInstructionDataCodec,Hh as getInitializeMintCloseAuthorityInstructionDataDecoder,Gh as getInitializeMintCloseAuthorityInstructionDataEncoder,rh as getInitializeMintDiscriminatorBytes,vh as getInitializeMintInstruction,uh as getInitializeMintInstructionDataCodec,th as getInitializeMintInstructionDataDecoder,sh as getInitializeMintInstructionDataEncoder,Th as getInitializeMultisig2DiscriminatorBytes,Xh as getInitializeMultisig2Instruction,Wh as getInitializeMultisig2InstructionDataCodec,Vh as getInitializeMultisig2InstructionDataDecoder,Uh as getInitializeMultisig2InstructionDataEncoder,Mh as getInitializeMultisigDiscriminatorBytes,Qh as getInitializeMultisigInstruction,Ph as getInitializeMultisigInstructionDataCodec,Oh as getInitializeMultisigInstructionDataDecoder,Nh as getInitializeMultisigInstructionDataEncoder,_h as getInitializeNonTransferableMintDiscriminatorBytes,ci as getInitializeNonTransferableMintInstruction,bi as getInitializeNonTransferableMintInstructionDataCodec,ai as getInitializeNonTransferableMintInstructionDataDecoder,$h as getInitializeNonTransferableMintInstructionDataEncoder,fi as getInitializePausableConfigDiscriminatorBytes,li as getInitializePausableConfigInstruction,ki as getInitializePausableConfigInstructionDataCodec,ji as getInitializePausableConfigInstructionDataDecoder,ii as getInitializePausableConfigInstructionDataEncoder,hi as getInitializePausableConfigPausableDiscriminatorBytes,oi as getInitializePermanentDelegateDiscriminatorBytes,si as getInitializePermanentDelegateInstruction,ri as getInitializePermanentDelegateInstructionDataCodec,qi as getInitializePermanentDelegateInstructionDataDecoder,pi as getInitializePermanentDelegateInstructionDataEncoder,vi as getInitializeScaledUiAmountMintDiscriminatorBytes,Bi as getInitializeScaledUiAmountMintInstruction,Ai as getInitializeScaledUiAmountMintInstructionDataCodec,zi as getInitializeScaledUiAmountMintInstructionDataDecoder,yi as getInitializeScaledUiAmountMintInstructionDataEncoder,xi as getInitializeScaledUiAmountMintScaledUiAmountMintDiscriminatorBytes,Ei as getInitializeTokenGroupDiscriminatorBytes,Ii as getInitializeTokenGroupInstruction,Hi as getInitializeTokenGroupInstructionDataCodec,Gi as getInitializeTokenGroupInstructionDataDecoder,Fi as getInitializeTokenGroupInstructionDataEncoder,Li as getInitializeTokenGroupMemberDiscriminatorBytes,Pi as getInitializeTokenGroupMemberInstruction,Oi as getInitializeTokenGroupMemberInstructionDataCodec,Ni as getInitializeTokenGroupMemberInstructionDataDecoder,Mi as getInitializeTokenGroupMemberInstructionDataEncoder,Si as getInitializeTokenMetadataDiscriminatorBytes,Wi as getInitializeTokenMetadataInstruction,Vi as getInitializeTokenMetadataInstructionDataCodec,Ui as getInitializeTokenMetadataInstructionDataDecoder,Ti as getInitializeTokenMetadataInstructionDataEncoder,Zi as getInitializeTransferFeeConfigDiscriminatorBytes,dj as getInitializeTransferFeeConfigInstruction,cj as getInitializeTransferFeeConfigInstructionDataCodec,bj as getInitializeTransferFeeConfigInstructionDataDecoder,aj as getInitializeTransferFeeConfigInstructionDataEncoder,$i as getInitializeTransferFeeConfigTransferFeeDiscriminatorBytes,gj as getInitializeTransferHookDiscriminatorBytes,mj as getInitializeTransferHookInstruction,lj as getInitializeTransferHookInstructionDataCodec,kj as getInitializeTransferHookInstructionDataDecoder,jj as getInitializeTransferHookInstructionDataEncoder,ij as getInitializeTransferHookTransferHookDiscriminatorBytes,H as getMintCodec,G as getMintDecoder,F as getMintEncoder,uo as getMintSize,wj as getMintToCheckedDiscriminatorBytes,Aj as getMintToCheckedInstruction,zj as getMintToCheckedInstructionDataCodec,yj as getMintToCheckedInstructionDataDecoder,xj as getMintToCheckedInstructionDataEncoder,pj as getMintToDiscriminatorBytes,tj as getMintToInstruction,sj as getMintToInstructionDataCodec,rj as getMintToInstructionDataDecoder,qj as getMintToInstructionDataEncoder,P as getMultisigCodec,O as getMultisigDecoder,N as getMultisigEncoder,V as getMultisigSize,Dj as getPauseDiscriminatorBytes,Jj as getPauseInstruction,Ij as getPauseInstructionDataCodec,Hj as getPauseInstructionDataDecoder,Gj as getPauseInstructionDataEncoder,Fj as getPausePausableDiscriminatorBytes,ro as getPostInitializeInstructionsForMintExtensions,so as getPostInitializeInstructionsForTokenExtensions,qo as getPreInitializeInstructionsForMintExtensions,Mj as getReallocateDiscriminatorBytes,Qj as getReallocateInstruction,Pj as getReallocateInstructionDataCodec,Oj as getReallocateInstructionDataDecoder,Nj as getReallocateInstructionDataEncoder,Tj as getRecoverNestedAssociatedTokenDiscriminatorBytes,Yj as getRecoverNestedAssociatedTokenInstruction,Xj as getRecoverNestedAssociatedTokenInstructionAsync,Wj as getRecoverNestedAssociatedTokenInstructionDataCodec,Vj as getRecoverNestedAssociatedTokenInstructionDataDecoder,Uj as getRecoverNestedAssociatedTokenInstructionDataEncoder,$j as getRemoveTokenMetadataKeyDiscriminatorBytes,dk as getRemoveTokenMetadataKeyInstruction,ck as getRemoveTokenMetadataKeyInstructionDataCodec,bk as getRemoveTokenMetadataKeyInstructionDataDecoder,ak as getRemoveTokenMetadataKeyInstructionDataEncoder,gk as getResumeDiscriminatorBytes,mk as getResumeInstruction,lk as getResumeInstructionDataCodec,kk as getResumeInstructionDataDecoder,jk as getResumeInstructionDataEncoder,ik as getResumePausableDiscriminatorBytes,pk as getRevokeDiscriminatorBytes,tk as getRevokeInstruction,sk as getRevokeInstructionDataCodec,rk as getRevokeInstructionDataDecoder,qk as getRevokeInstructionDataEncoder,wk as getSetAuthorityDiscriminatorBytes,Ak as getSetAuthorityInstruction,zk as getSetAuthorityInstructionDataCodec,yk as getSetAuthorityInstructionDataDecoder,xk as getSetAuthorityInstructionDataEncoder,Dk as getSetTransferFeeDiscriminatorBytes,Jk as getSetTransferFeeInstruction,Ik as getSetTransferFeeInstructionDataCodec,Hk as getSetTransferFeeInstructionDataDecoder,Gk as getSetTransferFeeInstructionDataEncoder,Fk as getSetTransferFeeTransferFeeDiscriminatorBytes,Mk as getSyncNativeDiscriminatorBytes,Qk as getSyncNativeInstruction,Pk as getSyncNativeInstructionDataCodec,Ok as getSyncNativeInstructionDataDecoder,Nk as getSyncNativeInstructionDataEncoder,Tk as getThawAccountDiscriminatorBytes,Xk as getThawAccountInstruction,Wk as getThawAccountInstructionDataCodec,Vk as getThawAccountInstructionDataDecoder,Uk as getThawAccountInstructionDataEncoder,Ha as getToken2022ErrorMessage,Y as getTokenCodec,X as getTokenDecoder,W as getTokenEncoder,z as getTokenMetadataFieldCodec,y as getTokenMetadataFieldDecoder,x as getTokenMetadataFieldEncoder,to as getTokenSize,fl as getTransferCheckedDiscriminatorBytes,jl as getTransferCheckedInstruction,il as getTransferCheckedInstructionDataCodec,hl as getTransferCheckedInstructionDataDecoder,gl as getTransferCheckedInstructionDataEncoder,ml as getTransferCheckedWithFeeDiscriminatorBytes,sl as getTransferCheckedWithFeeInstruction,rl as getTransferCheckedWithFeeInstructionDataCodec,ql as getTransferCheckedWithFeeInstructionDataDecoder,pl as getTransferCheckedWithFeeInstructionDataEncoder,ol as getTransferCheckedWithFeeTransferFeeDiscriminatorBytes,_k as getTransferDiscriminatorBytes,E as getTransferFeeCodec,D as getTransferFeeDecoder,C as getTransferFeeEncoder,cl as getTransferInstruction,bl as getTransferInstructionDataCodec,al as getTransferInstructionDataDecoder,$k as getTransferInstructionDataEncoder,vl as getUiAmountToAmountDiscriminatorBytes,zl as getUiAmountToAmountInstruction,yl as getUiAmountToAmountInstructionDataCodec,xl as getUiAmountToAmountInstructionDataDecoder,wl as getUiAmountToAmountInstructionDataEncoder,El as getUpdateConfidentialTransferMintConfidentialTransferDiscriminatorBytes,Cl as getUpdateConfidentialTransferMintDiscriminatorBytes,Il as getUpdateConfidentialTransferMintInstruction,Hl as getUpdateConfidentialTransferMintInstructionDataCodec,Gl as getUpdateConfidentialTransferMintInstructionDataDecoder,Fl as getUpdateConfidentialTransferMintInstructionDataEncoder,Nl as getUpdateDefaultAccountStateDefaultAccountStateDiscriminatorBytes,Ll as getUpdateDefaultAccountStateDiscriminatorBytes,Rl as getUpdateDefaultAccountStateInstruction,Ql as getUpdateDefaultAccountStateInstructionDataCodec,Pl as getUpdateDefaultAccountStateInstructionDataDecoder,Ol as getUpdateDefaultAccountStateInstructionDataEncoder,Ul as getUpdateGroupMemberPointerDiscriminatorBytes,Wl as getUpdateGroupMemberPointerGroupMemberPointerDiscriminatorBytes,_l as getUpdateGroupMemberPointerInstruction,Zl as getUpdateGroupMemberPointerInstructionDataCodec,Yl as getUpdateGroupMemberPointerInstructionDataDecoder,Xl as getUpdateGroupMemberPointerInstructionDataEncoder,bm as getUpdateGroupPointerDiscriminatorBytes,dm as getUpdateGroupPointerGroupPointerDiscriminatorBytes,hm as getUpdateGroupPointerInstruction,gm as getUpdateGroupPointerInstructionDataCodec,fm as getUpdateGroupPointerInstructionDataDecoder,em as getUpdateGroupPointerInstructionDataEncoder,km as getUpdateMetadataPointerDiscriminatorBytes,qm as getUpdateMetadataPointerInstruction,pm as getUpdateMetadataPointerInstructionDataCodec,om as getUpdateMetadataPointerInstructionDataDecoder,nm as getUpdateMetadataPointerInstructionDataEncoder,mm as getUpdateMetadataPointerMetadataPointerDiscriminatorBytes,tm as getUpdateMultiplierScaledUiMintDiscriminatorBytes,zm as getUpdateMultiplierScaledUiMintInstruction,ym as getUpdateMultiplierScaledUiMintInstructionDataCodec,xm as getUpdateMultiplierScaledUiMintInstructionDataDecoder,wm as getUpdateMultiplierScaledUiMintInstructionDataEncoder,vm as getUpdateMultiplierScaledUiMintScaledUiAmountMintDiscriminatorBytes,Cm as getUpdateRateInterestBearingMintDiscriminatorBytes,Im as getUpdateRateInterestBearingMintInstruction,Hm as getUpdateRateInterestBearingMintInstructionDataCodec,Gm as getUpdateRateInterestBearingMintInstructionDataDecoder,Fm as getUpdateRateInterestBearingMintInstructionDataEncoder,Em as getUpdateRateInterestBearingMintInterestBearingMintDiscriminatorBytes,Lm as getUpdateTokenGroupMaxSizeDiscriminatorBytes,Pm as getUpdateTokenGroupMaxSizeInstruction,Om as getUpdateTokenGroupMaxSizeInstructionDataCodec,Nm as getUpdateTokenGroupMaxSizeInstructionDataDecoder,Mm as getUpdateTokenGroupMaxSizeInstructionDataEncoder,Sm as getUpdateTokenGroupUpdateAuthorityDiscriminatorBytes,Wm as getUpdateTokenGroupUpdateAuthorityInstruction,Vm as getUpdateTokenGroupUpdateAuthorityInstructionDataCodec,Um as getUpdateTokenGroupUpdateAuthorityInstructionDataDecoder,Tm as getUpdateTokenGroupUpdateAuthorityInstructionDataEncoder,Zm as getUpdateTokenMetadataFieldDiscriminatorBytes,bn as getUpdateTokenMetadataFieldInstruction,an as getUpdateTokenMetadataFieldInstructionDataCodec,$m as getUpdateTokenMetadataFieldInstructionDataDecoder,_m as getUpdateTokenMetadataFieldInstructionDataEncoder,en as getUpdateTokenMetadataUpdateAuthorityDiscriminatorBytes,jn as getUpdateTokenMetadataUpdateAuthorityInstruction,hn as getUpdateTokenMetadataUpdateAuthorityInstructionDataCodec,gn as getUpdateTokenMetadataUpdateAuthorityInstructionDataDecoder,fn as getUpdateTokenMetadataUpdateAuthorityInstructionDataEncoder,mn as getUpdateTransferHookDiscriminatorBytes,sn as getUpdateTransferHookInstruction,rn as getUpdateTransferHookInstructionDataCodec,qn as getUpdateTransferHookInstructionDataDecoder,pn as getUpdateTransferHookInstructionDataEncoder,on as getUpdateTransferHookTransferHookDiscriminatorBytes,vn as getWithdrawExcessLamportsDiscriminatorBytes,zn as getWithdrawExcessLamportsInstruction,yn as getWithdrawExcessLamportsInstructionDataCodec,xn as getWithdrawExcessLamportsInstructionDataDecoder,wn as getWithdrawExcessLamportsInstructionDataEncoder,Cn as getWithdrawWithheldTokensFromAccountsDiscriminatorBytes,Nn as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeConfidentialTransferFeeDiscriminatorBytes,Ln as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeDiscriminatorBytes,Rn as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeInstruction,Qn as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeInstructionDataCodec,Pn as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeInstructionDataDecoder,On as getWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeInstructionDataEncoder,In as getWithdrawWithheldTokensFromAccountsInstruction,Hn as getWithdrawWithheldTokensFromAccountsInstructionDataCodec,Gn as getWithdrawWithheldTokensFromAccountsInstructionDataDecoder,Fn as getWithdrawWithheldTokensFromAccountsInstructionDataEncoder,En as getWithdrawWithheldTokensFromAccountsTransferFeeDiscriminatorBytes,Un as getWithdrawWithheldTokensFromMintDiscriminatorBytes,eo as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeConfidentialTransferFeeDiscriminatorBytes,bo as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeDiscriminatorBytes,io as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeInstruction,ho as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeInstructionDataCodec,go as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeInstructionDataDecoder,fo as getWithdrawWithheldTokensFromMintForConfidentialTransferFeeInstructionDataEncoder,_n as getWithdrawWithheldTokensFromMintInstruction,Zn as getWithdrawWithheldTokensFromMintInstructionDataCodec,Yn as getWithdrawWithheldTokensFromMintInstructionDataDecoder,Xn as getWithdrawWithheldTokensFromMintInstructionDataEncoder,Wn as getWithdrawWithheldTokensFromMintTransferFeeDiscriminatorBytes,ea as identifyAssociatedTokenInstruction,ha as identifyToken2022Account,ja as identifyToken2022Instruction,ma as isAssociatedTokenError,s as isExtension,Ia as isToken2022Error,B as isTokenMetadataField,Pa as parseAmountToUiAmountInstruction,Ya as parseApplyConfidentialPendingBalanceInstruction,kb as parseApproveCheckedInstruction,tb as parseApproveConfidentialTransferAccountInstruction,db as parseApproveInstruction,Hb as parseBurnCheckedInstruction,Ab as parseBurnInstruction,Ob as parseCloseAccountInstruction,Xb as parseConfidentialDepositInstruction,ec as parseConfidentialTransferInstruction,nc as parseConfidentialTransferWithFeeInstruction,wc as parseConfidentialWithdrawInstruction,Fc as parseConfigureConfidentialTransferAccountInstruction,Wc as parseCreateAssociatedTokenIdempotentInstruction,Oc as parseCreateAssociatedTokenInstruction,bd as parseCreateNativeMintInstruction,kd as parseDisableConfidentialCreditsInstruction,td as parseDisableCpiGuardInstruction,Cd as parseDisableHarvestToMintInstruction,Ld as parseDisableMemoTransfersInstruction,Ud as parseDisableNonConfidentialCreditsInstruction,$d as parseEmitTokenMetadataInstruction,ie as parseEmptyConfidentialTransferAccountInstruction,re as parseEnableConfidentialCreditsInstruction,Ae as parseEnableCpiGuardInstruction,Je as parseEnableHarvestToMintInstruction,Se as parseEnableMemoTransfersInstruction,$e as parseEnableNonConfidentialCreditsInstruction,gf as parseFreezeAccountInstruction,of as parseGetAccountDataSizeInstruction,Gf as parseHarvestWithheldTokensToMintForConfidentialTransferFeeInstruction,xf as parseHarvestWithheldTokensToMintInstruction,Uf as parseInitializeAccount2Instruction,$f as parseInitializeAccount3Instruction,Nf as parseInitializeAccountInstruction,ig as parseInitializeConfidentialTransferFeeInstruction,rg as parseInitializeConfidentialTransferMintInstruction,Ag as parseInitializeDefaultAccountStateInstruction,Jg as parseInitializeGroupMemberPointerInstruction,Sg as parseInitializeGroupPointerInstruction,Zg as parseInitializeImmutableOwnerInstruction,gh as parseInitializeInterestBearingMintInstruction,ph as parseInitializeMetadataPointerInstruction,Dh as parseInitializeMint2Instruction,Kh as parseInitializeMintCloseAuthorityInstruction,wh as parseInitializeMintInstruction,Yh as parseInitializeMultisig2Instruction,Rh as parseInitializeMultisigInstruction,di as parseInitializeNonTransferableMintInstruction,mi as parseInitializePausableConfigInstruction,ti as parseInitializePermanentDelegateInstruction,Ci as parseInitializeScaledUiAmountMintInstruction,Ji as parseInitializeTokenGroupInstruction,Qi as parseInitializeTokenGroupMemberInstruction,Xi as parseInitializeTokenMetadataInstruction,ej as parseInitializeTransferFeeConfigInstruction,nj as parseInitializeTransferHookInstruction,Bj as parseMintToCheckedInstruction,uj as parseMintToInstruction,Kj as parsePauseInstruction,Rj as parseReallocateInstruction,Zj as parseRecoverNestedAssociatedTokenInstruction,ek as parseRemoveTokenMetadataKeyInstruction,nk as parseResumeInstruction,uk as parseRevokeInstruction,Bk as parseSetAuthorityInstruction,Kk as parseSetTransferFeeInstruction,Rk as parseSyncNativeInstruction,Yk as parseThawAccountInstruction,kl as parseTransferCheckedInstruction,tl as parseTransferCheckedWithFeeInstruction,dl as parseTransferInstruction,Al as parseUiAmountToAmountInstruction,Jl as parseUpdateConfidentialTransferMintInstruction,Sl as parseUpdateDefaultAccountStateInstruction,$l as parseUpdateGroupMemberPointerInstruction,im as parseUpdateGroupPointerInstruction,rm as parseUpdateMetadataPointerInstruction,Am as parseUpdateMultiplierScaledUiMintInstruction,Jm as parseUpdateRateInterestBearingMintInstruction,Qm as parseUpdateTokenGroupMaxSizeInstruction,Xm as parseUpdateTokenGroupUpdateAuthorityInstruction,cn as parseUpdateTokenMetadataFieldInstruction,kn as parseUpdateTokenMetadataUpdateAuthorityInstruction,tn as parseUpdateTransferHookInstruction,An as parseWithdrawExcessLamportsInstruction,Sn as parseWithdrawWithheldTokensFromAccountsForConfidentialTransferFeeInstruction,Jn as parseWithdrawWithheldTokensFromAccountsInstruction,jo as parseWithdrawWithheldTokensFromMintForConfidentialTransferFeeInstruction,$n as parseWithdrawWithheldTokensFromMintInstruction,A as tokenMetadataField,lo as uiAmountToAmountForInterestBearingMintWithoutSimulation,po as uiAmountToAmountForMintWithoutSimulation,no as uiAmountToAmountForScaledUiAmountMintWithoutSimulation};
@@ -0,0 +1,2 @@
1
+ process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
2
+ import{m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h}from"./chunk-5R67DV4J.js";import"./chunk-INE4OXJA.js";import"./chunk-LMDE72OE.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.11.1",
3
+ "version": "0.12.2",
4
4
  "description": "MoonPay CLI — the crypto onramp for AI agents",
5
5
  "homepage": "https://agents.moonpay.com",
6
6
  "publishConfig": {
@@ -27,10 +27,6 @@
27
27
  "@scure/bip32": "^1.4.0",
28
28
  "@scure/bip39": "^1.6.0",
29
29
  "@solana/web3.js": "^1.98.4",
30
- "@x402/axios": "^2.4.0",
31
- "@x402/core": "^2.4.0",
32
- "@x402/evm": "^2.4.0",
33
- "@x402/svm": "^2.4.0",
34
30
  "axios": "^1.13.5",
35
31
  "bitcoinjs-lib": "^7.0.1",
36
32
  "bs58": "^6.0.0",
@@ -43,6 +39,19 @@
43
39
  "zod": "^3.25.76",
44
40
  "zod-to-json-schema": "^3.25.1"
45
41
  },
42
+ "optionalDependencies": {
43
+ "@ledgerhq/device-management-kit": "^1.1.0",
44
+ "@ledgerhq/device-signer-kit-ethereum": "^1.11.1",
45
+ "@ledgerhq/device-signer-kit-solana": "^1.6.2",
46
+ "@ledgerhq/device-transport-kit-node-hid": "^1.0.0",
47
+ "@x402/axios": "^2.4.0",
48
+ "@x402/core": "^2.4.0",
49
+ "@x402/evm": "^2.4.0",
50
+ "@x402/svm": "^2.4.0"
51
+ },
52
+ "engines": {
53
+ "node": ">=18"
54
+ },
46
55
  "devDependencies": {
47
56
  "@types/jest": "^29",
48
57
  "@types/node": "^20",
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: moonpay-hardware-wallet
3
+ description: Connect a hardware wallet (Ledger) to the MoonPay CLI. Sign transactions on the physical device — no private keys stored locally.
4
+ tags: [wallet]
5
+ ---
6
+
7
+ # Hardware wallet support
8
+
9
+ ## Goal
10
+
11
+ Connect a hardware wallet to the MoonPay CLI. Private keys never leave the device — the CLI stores only cached addresses. All existing commands (swap, transfer, bridge, buy, balance) work transparently with hardware wallets.
12
+
13
+ First supported device: **Ledger** (Nano S, Nano X, Nano S Plus, Stax, Flex).
14
+
15
+ ## Prerequisites
16
+
17
+ - Ledger device connected via USB
18
+ - Ledger Live installed (for firmware updates)
19
+ - Ethereum and/or Solana apps installed on the device
20
+
21
+ ## Commands
22
+
23
+ ### Add a hardware wallet
24
+
25
+ ```bash
26
+ # Auto-detect connected device
27
+ mp wallet hardware add --name "my-ledger"
28
+
29
+ # Specify device type explicitly
30
+ mp wallet hardware add --name "my-ledger" --device ledger
31
+ ```
32
+
33
+ This connects to the device, derives addresses for all supported chains (Ethereum, Solana, Tron), and saves the wallet. No secrets are stored — only addresses.
34
+
35
+ ### Refresh addresses
36
+
37
+ ```bash
38
+ mp wallet hardware refresh --wallet "my-ledger"
39
+ ```
40
+
41
+ Re-derives addresses from the connected device. Use this if you changed the account index in Ledger Live or need to update cached addresses.
42
+
43
+ ### List wallets
44
+
45
+ ```bash
46
+ mp wallet list
47
+ ```
48
+
49
+ Hardware wallets appear alongside software wallets with a `[hardware/ledger]` tag.
50
+
51
+ ## Using hardware wallets
52
+
53
+ Once added, use `--wallet` like any other wallet. The CLI automatically connects to the device for signing.
54
+
55
+ ### Check balances (no device needed)
56
+
57
+ ```bash
58
+ mp token balance list --wallet my-ledger --chain ethereum
59
+ mp token balance list --wallet my-ledger --chain solana
60
+ ```
61
+
62
+ ### Swap tokens (signs on device)
63
+
64
+ ```bash
65
+ mp token swap \
66
+ --wallet my-ledger --chain ethereum \
67
+ --from-token 0x0000000000000000000000000000000000000000 \
68
+ --from-amount 0.01 \
69
+ --to-token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
70
+ ```
71
+
72
+ The CLI prompts you to review and confirm the transaction on your Ledger.
73
+
74
+ ### Transfer tokens (signs on device)
75
+
76
+ ```bash
77
+ mp token transfer \
78
+ --wallet my-ledger --chain ethereum \
79
+ --token 0x0000000000000000000000000000000000000000 \
80
+ --amount 0.01 \
81
+ --to 0x1234...
82
+ ```
83
+
84
+ ### Bridge cross-chain (signs on device)
85
+
86
+ ```bash
87
+ mp token bridge \
88
+ --from-wallet my-ledger --from-chain ethereum \
89
+ --from-token 0x0000000000000000000000000000000000000000 \
90
+ --from-amount 0.01 \
91
+ --to-chain polygon \
92
+ --to-token 0x0000000000000000000000000000000000000000
93
+ ```
94
+
95
+ ## How it works
96
+
97
+ 1. `wallet hardware add` connects via USB, switches Ledger apps automatically, and derives addresses
98
+ 2. Addresses are cached in the encrypted vault — read-only commands work without the device
99
+ 3. For signing commands, the CLI connects to the device, opens the correct app, and prompts for on-device approval
100
+ 4. The device signs the transaction — the private key never leaves the hardware
101
+ 5. The CLI broadcasts the signed transaction
102
+
103
+ ## Supported chains
104
+
105
+ - **Ethereum** (+ all EVM: Base, Polygon, Arbitrum, Optimism, BNB, Avalanche)
106
+ - **Solana**
107
+ - **Tron**
108
+ - Bitcoin address derivation and signing are not yet supported
109
+
110
+ ## Tips
111
+
112
+ - The device must be unlocked and on the home screen when connecting
113
+ - App switching is automatic — no need to manually open Ethereum or Solana apps
114
+ - If signing times out, check the Ledger screen for a pending approval prompt
115
+ - `wallet export` is not available for hardware wallets (there are no secrets to export)
116
+
117
+ ## Related skills
118
+
119
+ - **moonpay-auth** — Set up the CLI and manage software wallets
120
+ - **moonpay-swap-tokens** — Swap or bridge tokens
121
+ - **moonpay-check-wallet** — Check wallet balances
@@ -1,3 +0,0 @@
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.11.1",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
- `)),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};