@xoxno/sdk-js 1.0.201 → 1.0.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as s}from"@stellar/stellar-sdk";var a={385(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>be,DU:()=>c,fA:()=>Bo,A$:()=>f,J9:()=>m,hS:()=>g,gR:()=>Go,Cg:()=>Do,VZ:()=>sr,N0:()=>Zt,B_:()=>me,qL:()=>ee,eX:()=>re,z:()=>Jo,xD:()=>j,jR:()=>F,P2:()=>pr,W6:()=>ge,se:()=>de,ZP:()=>go,yr:()=>Qo,sp:()=>J,Iu:()=>ho,yu:()=>bo,$9:()=>io,zw:()=>ao,h_:()=>po,e_:()=>lo,Tk:()=>uo,BA:()=>so,u9:()=>xo,bi:()=>So,gc:()=>fo,ay:()=>mo,SX:()=>Ft,UF:()=>zo,Y5:()=>Q,mE:()=>Y,xG:()=>Wt,s9:()=>tt,OL:()=>Vt,k6:()=>Ue,dj:()=>Oe,kD:()=>ze,Yf:()=>De,AI:()=>yo,O2:()=>Qe,c5:()=>Je,N8:()=>Re,qU:()=>Ve,RZ:()=>Fe,ni:()=>Ne,hF:()=>Ye,Qk:()=>to,Gw:()=>oo,$K:()=>Ze,uj:()=>Le,Od:()=>Me,X7:()=>We,Ub:()=>ro,Dx:()=>Ge,OA:()=>Ie,$U:()=>Pe,ob:()=>$e,$l:()=>Ee,K:()=>Be,Wb:()=>ke,kw:()=>Ce,qA:()=>Ae,VS:()=>Ke,HP:()=>no,xQ:()=>vo,YQ:()=>eo,QY:()=>Xe,os:()=>je,Ko:()=>He,IJ:()=>ce,nw:()=>Z,Pr:()=>rt,ZE:()=>K,X0:()=>oe,ev:()=>Ht,P8:()=>ne,aV:()=>Yt,p2:()=>Jt,sV:()=>ie,XD:()=>pe,Js:()=>se,W5:()=>ue,Dy:()=>te,_i:()=>Qt,FZ:()=>ae,wG:()=>Kt,Ni:()=>W,v_:()=>V,qD:()=>ot,qR:()=>et,QJ:()=>Xt,bm:()=>jt,n_:()=>fe,v8:()=>le,qM:()=>zt,gH:()=>ye,O3:()=>H,Gz:()=>X,pr:()=>z,Fm:()=>$o,Ft:()=>Dt,MB:()=>It,Dn:()=>Gt,pq:()=>Et,Q3:()=>Rt,Jh:()=>Ot,wf:()=>Ko,Um:()=>Wo,xO:()=>qt,Lw:()=>Xo,KM:()=>h,mM:()=>mt,iE:()=>_t,zp:()=>bt,N3:()=>ft,bN:()=>pt,QV:()=>S,T_:()=>Tt,XI:()=>ht,Lt:()=>wt,KK:()=>lt,yl:()=>st,vc:()=>b,kq:()=>at,CH:()=>Zo,FI:()=>yt,KG:()=>kt,nW:()=>gt,jF:()=>dt,S2:()=>St,uS:()=>At,u_:()=>ct,O5:()=>vt,Av:()=>xt,LA:()=>er,E6:()=>Yo,Ds:()=>tr,XV:()=>cr,CU:()=>jo,Vx:()=>ur,DL:()=>nr,ON:()=>_o,Hh:()=>Pt,oV:()=>Vo,g5:()=>rr,L:()=>qo,Vu:()=>ir});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},g={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},m={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},f={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function b(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function h(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v=t=>new e(t).toScVal(),q=t=>new n(t).toI128(),T=t=>s.ScVal.scvU32(t),_=t=>new n("string"==typeof t?t:t.toString()).toU64(),w=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),k=t=>s.ScVal.scvSymbol(t),P=()=>s.ScVal.scvVoid(),I=t=>s.ScVal.scvVec(t),E=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return s.ScVal.scvBytes(r)},R=(t,e)=>null==t?P():e(t),O=(t,e)=>N({asset:v(e),hub_id:T(t)}),M=(t,e,o)=>s.ScVal.scvVec([O(t,e),q(o)]),U=t=>s.ScVal.scvVec(t.map((t=>M(t.hubId,t.asset,t.amount)))),N=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:k(e),val:t[e]})));return s.ScVal.scvMap(e)},L=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return N({amount_out:q(t.amountOut),pool:v(t.pool),token_in:v(t.tokenIn),token_out:v(t.tokenOut),venue:(e=t.venue,s.ScVal.scvVec([k(e)]))});var e}));return N({hops:s.ScVal.scvVec(e),split_ppm:T(t.splitPpm)})}));return N({paths:s.ScVal.scvVec(e),referral_id:_(t.referralId??0),token_in:v(t.tokenIn),token_out:v(t.tokenOut),total_min_out:q(t.totalMinOut)})},C=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},B=()=>s.ScVal.scvBytes(Buffer.alloc(0)),$=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},D=t=>{if("string"==typeof t)return C($(t));if(t instanceof Uint8Array)return 0===t.length?B():C(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?C($(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?C($(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?C($(t.bytes)):0===t.bytes.length?B():C(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),s.ScVal.scvBytes(Buffer.from(L(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},G=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return s.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function z(e,n,i){const s=e.controllerAddress??b(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:f[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function W(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return z(t,"supply",[v(t.caller),_(o),T(r),U([...e.assets])])}function V(t,e){return W(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function j(t,e){return z(t,"borrow",[v(t.caller),_(e.accountNonce),U([...e.borrows]),R(e.to,v)])}function F(t,e){return j(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function H(t,e){return z(t,"withdraw",[v(t.caller),_(e.accountNonce),U([...e.withdrawals]),R(e.to,v)])}function X(t,e){return H(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function Z(t,e){return z(t,"repay",[v(t.caller),_(e.accountNonce),U([...e.payments])])}function K(t,e){return Z(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function Q(t,e){return z(t,"liquidate",[v(t.caller),_(e.accountNonce),U([...e.debtPayments])])}function J(t,e){return z(t,"flash_loan",[v(t.caller),O(e.hubId,e.asset),q(e.amount),v(e.receiver),G(e.data)])}function Y(t,e){return z(t,"migrate_from_blend",[v(t.caller),_(e.accountId),T(e.spokeId),T(e.hubId),v(e.blendPool),I(e.collateralTokens.map(v)),I(e.supplyTokens.map(v)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,s.ScVal.scvVec([v(e),q(o)]);var e,o}))))]);var o}function tt(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return z(t,"multiply",[v(t.caller),_(o),T(r),O(e.collateral.hubId,e.collateral.asset),q(e.debtToFlashLoan),O(e.debt.hubId,e.debt.asset),T(e.mode),D(e.steps),R(e.initialPayment,(t=>M(t.hubId,t.asset,t.amount))),R(e.convertSwap,D)])}function et(t,e){return z(t,"swap_debt",[v(t.caller),_(e.accountNonce),O(e.existingDebt.hubId,e.existingDebt.asset),q(e.newDebtAmount),O(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function ot(t,e){return z(t,"swap_collateral",[v(t.caller),_(e.accountNonce),O(e.current.hubId,e.current.asset),q(e.fromAmount),O(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function rt(t,e){return z(t,"repay_debt_with_collateral",[v(t.caller),_(e.accountNonce),O(e.collateral.hubId,e.collateral.asset),q(e.collateralAmount),O(e.debt.hubId,e.debt.asset),D(e.steps),w(e.closePosition)])}const nt="/stellar-lending",ut=25,it=encodeURIComponent,st=(t,e)=>t.fetchWithTimeout(`${nt}/context`,e),at=(t,e)=>t.fetchWithTimeout(`${nt}/live-state`,e),pt=(t,e)=>t.fetchWithTimeout(`${nt}/assets`,e),lt=(t,e)=>t.fetchWithTimeout(`${nt}/hubs`,e),ct=(t,e)=>t.fetchWithTimeout(`${nt}/spokes`,e),dt=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${nt}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},yt=(t,e,o,r,n)=>t.fetchWithTimeout(`${nt}/reserves/${e}/${o}/${it(r)}`,n),gt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${nt}/reserves/${e}/${o}/${it(r)}/holders`,{...u,params:{side:n}}),mt=(t,e,o)=>t.fetchWithTimeout(`${nt}/assets/${it(e)}`,o),ft=(t,e,o,r)=>t.fetchWithTimeout(`${nt}/assets/${it(e)}/page`,{...r,params:{...o}}),bt=(t,e,o,r)=>t.fetchWithTimeout(`${nt}/assets/${it(e)}/markets`,{...r,params:{side:o}}),ht=(t,e,o)=>t.fetchWithTimeout(`${nt}/hubs/${e}`,o),St=(t,e,o)=>t.fetchWithTimeout(`${nt}/spokes/${e}`,o),xt=(t,e,o)=>t.fetchWithTimeout(`${nt}/users/${it(e)}/positions`,o),vt=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${nt}/users/${it(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},qt=(t,e,o)=>t.fetchWithTimeout(`${nt}/accounts/${it(e)}/positions`,o),Tt=(t,e={},o)=>{const{top:r=ut,continuationToken:n}=e;return t.fetchWithTimeout(`${nt}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},_t=(t,e,o,r)=>t.fetchWithTimeout(`${nt}/assets/${it(e)}/graph`,{...r,params:{...o}}),wt=(t,e,o,r)=>t.fetchWithTimeout(`${nt}/hubs/${e}/graph`,{...r,params:{...o}}),At=(t,e,o,r)=>t.fetchWithTimeout(`${nt}/spokes/${e}/graph`,{...r,params:{...o}}),kt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${nt}/reserves/${e}/${o}/${it(r)}/graph`,{...u,params:{...n}}),Pt=t=>({context:e=>st(t,e),liveState:e=>at(t,e),assets:e=>pt(t,e),hubs:e=>lt(t,e),spokes:e=>ct(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?dt(t,e,o):dt(t,{},e);var r},reserve:(e,o,r,n)=>yt(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>gt(t,e,o,r,n,u),asset:(e,o)=>mt(t,e,o),assetMarkets:(e,o,r)=>bt(t,e,o,r),hub:(e,o)=>ht(t,e,o),spoke:(e,o)=>St(t,e,o),userPositions:(e,o)=>xt(t,e,o),userActivity:(e,o,r)=>vt(t,e,o,r),accountPositions:(e,o)=>qt(t,e,o),governanceProposals:(e,o)=>Tt(t,e,o),assetGraph:(e,o,r)=>_t(t,e,o,r),hubGraph:(e,o,r)=>wt(t,e,o,r),spokeGraph:(e,o,r)=>At(t,e,o,r),reserveGraph:(e,o,r,n,u)=>kt(t,e,o,r,n,u)}),It=t=>N({base_borrow_rate:q(t.baseBorrowRateRay),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),Et=t=>N({asset_decimals:T(t.assetDecimals),asset_id:v(t.assetId),base_borrow_rate:q(t.baseBorrowRateRay),flashloan_fee:T(t.flashloanFeeBps),is_flashloanable:w(t.isFlashloanable),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),Rt=t=>N({max_borrow_positions:T(t.maxBorrowPositions),max_supply_positions:T(t.maxSupplyPositions)}),Ot=t=>{if("Token"in t&&t.Token)return I([k("Token"),v(t.Token)]);if("Ref"in t&&t.Ref)return I([k("Ref"),k(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},Mt=t=>{if("Stellar"in t)return I([k("Stellar"),v(t.Stellar)]);if("Symbol"in t)return I([k("Symbol"),k(t.Symbol)]);if("String"in t)return I([k("String"),A(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},Ut=t=>{if("Spot"===t)return I([k("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return I([k("Twap"),T(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},Nt=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return I([k(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},Lt=t=>{if("Market"===t||"Fundamental"===t)return I([k(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},Ct=t=>{if("Reflector"in t){const e=t.Reflector;return I([k("Reflector"),N({asset:Mt(e.asset),contract:v(e.contract),read_mode:Ut(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return I([k("MultiFeed"),N({contract:v(e.contract),feed_id:A(e.feedId),kind:Nt(e.kind),nature:Lt(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},Bt=t=>{const e=t;return N({decimals:T(e.decimals),max_stale_seconds:_(e.maxStaleSeconds),provider:Ct(e.provider)})},$t=t=>{if("RequireDisjoint"===t)return I([k("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return I([k("AllowShared"),I(e.map((t=>N({contract:v(t.contract),kind:Nt(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},Dt=t=>{const e=t,o=e.sources??[];let r,n;if("number"==typeof e.toleranceBps)r=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/r));else{const t=e.tolerance??{};r=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return N({asset_decimals:T(Number(e.assetDecimals)),independence:$t(e.independence),max_price_stale_seconds:_(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:q(String(e.maxSanityPriceWad)),min_sanity_price_wad:q(String(e.minSanityPriceWad)),sources:I(o.map((t=>(t=>{if("Feed"in t)return I([k("Feed"),Bt(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return I([k("Scaled"),N({factor:Bt(e.factor),max_factor_wad:q(e.maxFactorWad),min_factor_wad:q(e.minFactorWad),quote:Ot(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return I([k("LpShare"),N({key_a:Ot(e.keyA),key_b:Ot(e.keyB),kind:I([k(e.kind||"ConstantProduct")]),pool:v(e.pool),reserve_a_decimals:T(e.reserveADecimals),reserve_b_decimals:T(e.reserveBDecimals),share_decimals:T(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:N({lower_ratio_bps:T(n),upper_ratio_bps:T(r)})})},Gt=Dt;function zt(t,e){return z(t,"upgrade",[E(e.wasmHash)])}function Wt(t,e){return z(t,"migrate",[T(e.newVersion)])}function Vt(t){return z(t,"pause",[])}function jt(t){return z(t,"unpause",[])}function Ft(t,e){return z(t,"grant_role",[v(e.account),k(e.role)])}function Ht(t,e){return z(t,"revoke_role",[v(e.account),k(e.role)])}function Xt(t,e){return z(t,"transfer_ownership",[v(e.newOwner),T(e.liveUntilLedger)])}function Zt(t){return z(t,"accept_ownership",[])}function Kt(t,e){return z(t,"set_swap_aggregator",[v(e.aggregator)])}function Qt(t,e){return z(t,"set_price_aggregator",[v(e.aggregator)])}const Jt=Kt;function Yt(t,e){return z(t,"set_accumulator",[v(e.accumulator)])}function te(t,e){return z(t,"set_position_limits",[Rt(e)])}function ee(t,e){return z(t,"approve_blend_pool",[v(e.pool)])}function oe(t,e){return z(t,"revoke_blend_pool",[v(e.pool)])}const re=ee,ne=oe;function ue(t,e){return z(t,"set_oracle",[Ot(e.key),Dt(e.oracle)])}const ie=ue;function se(t,e){const o=e.toleranceBps,r=e.upperRatioBps??1e4+o,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/r));return z(t,"set_tolerance",[Ot(e.key),N({lower_ratio_bps:T(n),upper_ratio_bps:T(r)})])}function ae(t,e){return z(t,"set_spoke_asset_flags",[T(e.spokeId),O(e.hubId,e.asset),w(e.paused),w(e.frozen)])}function pe(t,e){return z(t,"set_oracle_sanity_bounds",[v(e.asset),q(e.minPriceWad),q(e.maxPriceWad)])}function le(t,e){return z(t,"update_indexes",[v(t.caller),I(e.assets.map((t=>O(t.hubId,t.asset))))])}function ce(t,e){return z(t,"renew_account",[v(t.caller),_(e.accountNonce)])}function de(t,e){return z(t,"create_liquidity_pool",[T(e.hubId),v(e.asset),Et(e.params)])}function ye(t,e){return z(t,"upgrade_liquidity_pool_params",[O(e.hubId,e.asset),It(e.params)])}function ge(t,e){return z(t,"claim_revenue",[v(t.caller),I(e.assets.map((t=>O(t.hubId,t.asset))))])}function me(t,e){return z(t,"add_rewards",[v(t.caller),U(e.rewards)])}function fe(t,e){return z(t,"update_account_threshold",[v(t.caller),w(e.hasRisks),I(e.accountNonces.map((t=>_(t))))])}const be="00".repeat(32),he=t=>{if("string"==typeof t)return E(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},Se=(t,...e)=>I([k(t),...e]),xe=t=>N({new_owner:v(t.newOwner),live_until_ledger:T(t.liveUntilLedger)}),ve=t=>N({asset:v(t.asset),bonus:T(t.bonus),borrow_cap:q(t.borrowCap),can_borrow:w(t.canBorrow),can_collateral:w(t.canCollateral),frozen:w(t.frozen),hub_id:T(t.hubId),paused:w(t.paused),liquidation_fees:T(t.liquidationFees),ltv:T(t.ltv),oracle_override:I([k("None")]),spoke_id:T(t.spokeId),supply_cap:q(t.supplyCap),threshold:T(t.threshold)}),qe=t=>N({account:v(t.account),role:k(t.role)});function Te(e,n,i){const s=e.governanceAddress??S(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:f[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const _e=(t,e,o)=>Te(t,"propose",[v(t.caller),e,he(o)]),we=(t,e,o)=>Te(t,"execute_self",[P(),e,he(o)]);function Ae(t,e,o){return _e(t,Se("SetSwapAggregator",v(e.aggregator)),o)}function ke(t,e,o){return _e(t,Se("SetPriceAggregator",v(e.aggregator)),o)}const Pe=Ae;function Ie(t,e,o){return _e(t,Se("SetAccumulator",v(e.accumulator)),o)}function Ee(t,e,o){return _e(t,Se("SetPositionLimits",Rt(e)),o)}function Re(t,e){return _e(t,Se("CreateHub"),e)}function Oe(t,e){return _e(t,Se("AddSpoke"),e)}function Me(t,e,o){return _e(t,Se("RemoveSpoke",T(e.spokeId)),o)}function Ue(t,e,o){return _e(t,Se("AddAssetToSpoke",ve(e)),o)}function Ne(t,e,o){return _e(t,Se("EditAssetInSpoke",ve(e)),o)}function Le(t,e,o){return _e(t,Se("RemoveAssetFromSpoke",N({hub_asset:O((r=e).hubId,r.asset),spoke_id:T(r.spokeId)})),o);var r}function Ce(t,e,o){return _e(t,Se("SetSpokeLiquidationCurve",N({hf_for_max_bonus_wad:q((r=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:T(r.liquidationBonusFactorBps),spoke_id:T(r.spokeId),target_hf_wad:q(r.targetHfWad)})),o);var r}function Be(t,e,o){return _e(t,Se("SetPositionManager",v(e.manager),w(e.isActive)),o)}function $e(t,e,o){return _e(t,Se("SetMinBorrowCollateralUsd",q(e.floorWad)),o)}function De(t,e,o){return _e(t,Se("ApproveToken",v(e.token)),o)}function Ge(t,e,o){return _e(t,Se("RevokeToken",v(e.token)),o)}function ze(t,e,o){return _e(t,Se("ApproveBlendPool",v(e.pool)),o)}function We(t,e,o){return _e(t,Se("RevokeBlendPool",v(e.pool)),o)}function Ve(t,e,o){return _e(t,Se("CreateLiquidityPool",N({asset:v((r=e).asset),hub_id:T(r.hubId),params:Et(r.params)})),o);var r}function je(t,e,o){return _e(t,Se("UpgradeLiquidityPoolParams",N({hub_asset:O((r=e).hubId,r.asset),params:It(r.params)})),o);var r}function Fe(t,e,o){return _e(t,Se("DeployPool",E(e.wasmHash)),o)}function He(t,e,o){return _e(t,Se("UpgradePool",E(e.wasmHash)),o)}function Xe(t,e,o){return _e(t,Se("UpgradeController",E(e.wasmHash)),o)}function Ze(t,e,o){return _e(t,Se("MigrateController",T(e.newVersion)),o)}function Ke(t,e,o){return _e(t,Se("TransferCtrlOwnership",xe(e)),o)}function Qe(t,e,o){return _e(t,Se("ConfigureAssetOracle",N({key:Ot((r=e).key),oracle:Dt(r.oracle)})),o);var r}const Je=Qe;function Ye(t,e,o){return _e(t,Se("EditOracleTolerance",N({key:Ot((r=e).key),tolerance:T(r.tolerance)})),o);var r}function to(t,e,o){return _e(t,Se("UpgradeGov",E(e.wasmHash)),o)}function eo(t,e,o){return _e(t,Se("UpdateGovDelay",T(e.newDelay)),o)}function oo(t,e,o){return _e(t,Se("GrantGovRole",qe(e)),o)}function ro(t,e,o){return _e(t,Se("RevokeGovRole",qe(e)),o)}function no(t,e,o){return _e(t,Se("TransferGovOwnership",xe(e)),o)}function uo(t,e){const o=I(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),r=he(e.predecessor??be);return Te(t,"execute",[P(),v(e.target),k(e.functionName),o,r,he(e.salt)])}function io(t,e,o){return we(t,Se("UpgradeGov",E(e.wasmHash)),o)}function so(t,e,o){return we(t,Se("UpdateGovDelay",T(e.newDelay)),o)}function ao(t,e,o){return we(t,Se("GrantGovRole",qe(e)),o)}function po(t,e,o){return we(t,Se("RevokeGovRole",qe(e)),o)}function lo(t,e,o){return we(t,Se("TransferGovOwnership",xe(e)),o)}const co=t=>I(t.map(v));function yo(t,e,o){return Te(t,"propose_canceller_reset",[co(e.newCancellers),he(o)])}function go(t,e,o){return Te(t,"execute_canceller_reset",[R(e.executor,v),co(e.newCancellers),he(o)])}function mo(t,e){return Te(t,"set_spoke_asset_flags",[v(t.caller),T(e.spokeId),O(e.hubId,e.asset),w(e.paused),w(e.frozen)])}function fo(t,e){return Te(t,"set_oracle_sanity_bounds",[v(t.caller),v(e.asset),q(e.minPriceWad),q(e.maxPriceWad)])}function bo(t){return Te(t,"create_hub",[v(t.caller)])}function ho(t){return Te(t,"add_spoke",[v(t.caller)])}function So(t,e){return Te(t,"revoke_role_immediate",[v(e.account),k(e.role)])}function xo(t){return Te(t,"pause",[v(t.caller)])}function vo(t,e){return _e(t,Se("Unpause"),e)}const qo=t=>t.toXDR("base64"),To=t=>s.ScVal.fromXDR(t,"base64"),_o=t=>t.map((t=>String(i(To(t))))).join(":"),wo=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Ao=t=>Number(t),ko=t=>String(t),Po=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Io=["None","Multiply","Long","Short"],Eo=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],Ro=t=>Array.isArray(t)?t:[],Oo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Eo[Ao(r)]??wo(r)),positionType:e,hubId:Ao(t[1]),asset:ko(t[2]),scaledAmountRay:wo(t[3]),indexRay:wo(t[4]),amount:wo(t[5]),liquidationThresholdBps:o?void 0:Ao(t[6]),liquidationBonusBps:o?void 0:Ao(t[7]),loanToValueBps:o?void 0:Ao(t[8]),liquidationFeesBps:o?void 0:Ao(t[9])};var r},Mo=t=>{return{owner:ko(t[0]),spokeId:Ao(t[1]),mode:(e=t[2],Io[Ao(e)]??"None")};var e},Uo=t=>Array.isArray(t)?t[1]:void 0,No=t=>{const e=(o=t,Array.isArray(o)?ko(o[0]):ko(o));var o;if("Token"===e)return{Token:ko(Uo(t))};if("Ref"===e)return{Ref:ko(Uo(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:ko(e.Token)};if(void 0!==e.Ref)return{Ref:ko(e.Ref)}}return{Token:ko(t)}},Lo=t=>{const e=t.tolerance??{};return{assetDecimals:Ao(t.asset_decimals),maxPriceStaleSeconds:Ao(t.max_price_stale_seconds),sources:Ro(t.sources).map((t=>t)),tolerance:{upperRatio:Ao(e.upper_ratio_bps),lowerRatio:Ao(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:wo(t.min_sanity_price_wad),maxSanityPriceWad:wo(t.max_sanity_price_wad)}},Co={"market:create":t=>({topic:"market:create",data:{hubId:Ao(t.hub_id),baseAsset:ko(t.base_asset),maxBorrowRate:wo(t.max_borrow_rate),baseBorrowRate:wo(t.base_borrow_rate),slope1:wo(t.slope1),slope2:wo(t.slope2),slope3:wo(t.slope3),midUtilization:wo(t.mid_utilization),optimalUtilization:wo(t.optimal_utilization),maxUtilization:wo(t.max_utilization),reserveFactor:Ao(t.reserve_factor),marketAddress:ko(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:ko(t.asset),maxBorrowRateRay:wo(t.max_borrow_rate),baseBorrowRateRay:wo(t.base_borrow_rate),slope1Ray:wo(t.slope1),slope2Ray:wo(t.slope2),slope3Ray:wo(t.slope3),midUtilizationRay:wo(t.mid_utilization),optimalUtilizationRay:wo(t.optimal_utilization),maxUtilizationRay:wo(t.max_utilization),reserveFactorBps:Ao(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Ro(t).map((t=>{return e=Ro(t),{hubId:Ao(e[0]),asset:ko(e[1]),timestamp:Ao(e[2]),supplyIndexRay:wo(e[3]),borrowIndexRay:wo(e[4]),cash:wo(e[5]),suppliedRay:wo(e[6]),borrowedRay:wo(e[7]),revenueRay:wo(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Ro(t).map((t=>{const e=t;return{hubId:Ao(e.hub_id),asset:ko(e.asset),params:(o=e.params,{maxBorrowRateRay:wo(o.max_borrow_rate),baseBorrowRateRay:wo(o.base_borrow_rate),slope1Ray:wo(o.slope1),slope2Ray:wo(o.slope2),slope3Ray:wo(o.slope3),midUtilizationRay:wo(o.mid_utilization),optimalUtilizationRay:wo(o.optimal_utilization),maxUtilizationRay:wo(o.max_utilization),reserveFactorBps:Ao(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Ao(o.flashloan_fee),assetId:ko(o.asset_id),assetDecimals:Ao(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=Ro(t);return{topic:"position:batch_update",data:{accountId:wo(e[0]),accountAttributes:Mo(Ro(e[1])),updates:[...Ro(e[2]).map((t=>Oo(Ro(t),"Deposit"))),...Ro(e[3]).map((t=>Oo(Ro(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Ao(t.hub_id),asset:ko(t.asset),receiver:ko(t.receiver),caller:ko(t.caller),amount:wo(t.amount),fee:wo(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:No(t.key),oracle:Lo(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:ko(t.asset),oracle:Lo(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:ko(t.liquidator),accountId:wo(t.account_id),repaidUsdWad:wo(t.repaid_usd_wad),bonusBps:wo(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:wo(t.account_id),totalBorrowUsdWad:wo(t.total_borrow_usd_wad),totalCollateralUsdWad:wo(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:ko(t.token),amount:wo(t.amount),usdValueWad:wo(t.usd_value_wad),accountId:wo(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Ao(t.hub_id),asset:ko(t.asset),amount:wo(t.amount),fee:wo(t.fee),amountSent:wo(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:ko(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Po(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:ko(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:ko(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:ko(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:ko(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Po(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Ao(t.max_supply_positions),maxBorrowPositions:Ao(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:wo(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:ko(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Ao(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:wo(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:wo(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Ao(e.liquidation_bonus_factor_bps)}}}},Bo=Object.freeze(Object.keys(Co));function $o(t,e){const o=_o(t),r=Co[o];return r?r(i(To(e))):null}const Do="XLENDXLM-a7c9f3",Go=1e4;function zo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${Do}-${o}`}function Wo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function Vo(t,e=0){return t*Go+e}function jo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Fo=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},Ho=t=>t.baseUrl??m[t.network];async function Xo(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Fo(Ho(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function Zo(t){const e=Fo(Ho(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Ko=t=>L(t).toXDR("base64");function Qo(e,n){const i=e.routerAddress??h(e.network),s=new r(i),a=new t(e.caller,e.sourceSequence),p=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:f[e.network]}).addOperation(s.call("execute_strategy",v(e.caller),q(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Jo(t,e){return Qo(t,e)}function Yo(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(or),splitPpm:t.splitPpm}))):[{hops:t.hops.map(or),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function tr(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Yo(t,e)}const er=Yo,or=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function rr(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function nr(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw rr(o.invokedContractId,t);throw t}}async function ur(t,e,o){return nr(t,e.xdr,o)}function ir(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function sr(t,e){return new Uint8Array(0)}const ar=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function pr(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(ar(e.message)),s.ScVal.scvBytes(ar(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:f[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const lr={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function cr(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const o=Number(e[1]),r=lr[o];return r?{code:o,...r}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",g="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var m;!function(t){t.MAINNET="1",t.DEVNET="D"}(m||(m={}));class f{apiUrl;chain;init;config;constructor({chain:t=m.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[m.MAINNET]:c,[m.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==m.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,g="Bearer undefined"===y?void 0:y,m={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},f=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),b=`${this.apiUrl}${t}${f.length?`?${f}`:""}`,{revalidate:h,...S}=r??{},{revalidate:x,...v}=s??{},q="GET"!==c||g?void 0:x??h,T="GET"!==c||g||q?void 0:a??n,_={...i,...d,method:c,...Object.keys(m).length?{headers:m}:{},cache:T,next:{...S,...v,revalidate:q}};(p??u)&&console.debug("SDK fetch: ",b,_);const w=await fetch(b,_).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${b}: ${t.message}`),{cause:t});throw t})),A=await w.text();if(!w.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[b,w.status,w.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const b=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},h=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^G[A-Z2-7]{55}$/.test(t)),q={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},T=["PATCH","POST","DELETE","PUT"];var _=l(385);const w=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...i}=e,s=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!b(t))):!b(t))throw new S(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:g,cache:m,next:f,debug:h,continuationToken:q,...T}=l,_=d?`Bearer ${d}`:void 0,w={...g,..._?{Authorization:_}:{},...q?{"X-Continuation-Token":String(q)}:{}},A={...f,tags:[...f?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:T,body:c,headers:w,cache:m,debug:h,...A?{next:A}:{}})},a=(t={})=>s(t);for(const t of Object.keys(i))T.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(q)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=w(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=w(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let s;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];s=A(o,n,r,t)}else{s={};for(const{rawPath:o,def:n}of e.leaves)s[w(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===s[t]?s[t]=u:"function"==typeof s[t]?Object.assign(s[t],u):"function"==typeof u?(Object.assign(u,s[t]),s[t]=u):Object.assign(s[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(s[t]){const o=s[t];s[t]=t=>({...o(t),...e(t)})}else s[t]=e}return s};return o(e,{})}export{m as Chain,f as XOXNOClient,k as buildSdk,b as isValidCollectionTicker,h as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=_.ME;export const STELLAR_GOVERNANCE=_.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=_.G_;export const STELLAR_LENDING_CONTROLLER=_.DU;export const STELLAR_LENDING_TOPICS=_.fA;export const STELLAR_NETWORK_PASSPHRASE=_.A$;export const STELLAR_QUOTE_URL=_.J9;export const STELLAR_SOROBAN_RPC_URL=_.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=_.gR;export const XOXNO_LENDING_STELLAR_TICKER=_.Cg;export const buildSameTokenRepaySwapSteps=_.VZ;export const buildStellarAcceptOwnershipTx=_.N0;export const buildStellarAddRewardsTx=_.B_;export const buildStellarApproveBlendPoolTx=_.qL;export const buildStellarApproveTokenTx=_.eX;export const buildStellarBatchSwapTx=_.z;export const buildStellarBorrowBatchTx=_.xD;export const buildStellarBorrowTx=_.jR;export const buildStellarCctpForwardTx=_.P2;export const buildStellarClaimRevenueTx=_.W6;export const buildStellarCreateLiquidityPoolTx=_.se;export const buildStellarExecuteCancellerResetTx=_.ZP;export const buildStellarExecuteStrategyTx=_.yr;export const buildStellarFlashLoanTx=_.sp;export const buildStellarGovernanceAddSpokeImmediateTx=_.Iu;export const buildStellarGovernanceCreateHubImmediateTx=_.yu;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=_.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=_.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=_.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=_.e_;export const buildStellarGovernanceExecuteTx=_.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=_.BA;export const buildStellarGovernancePauseTx=_.u9;export const buildStellarGovernanceRevokeRoleImmediateTx=_.bi;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=_.gc;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=_.ay;export const buildStellarGrantRoleTx=_.SX;export const buildStellarLendingIdentifier=_.UF;export const buildStellarLiquidateTx=_.Y5;export const buildStellarMigrateFromBlendTx=_.mE;export const buildStellarMigrateTx=_.xG;export const buildStellarMultiplyTx=_.s9;export const buildStellarPauseTx=_.OL;export const buildStellarProposeAddAssetToSpokeTx=_.k6;export const buildStellarProposeAddSpokeTx=_.dj;export const buildStellarProposeApproveBlendPoolTx=_.kD;export const buildStellarProposeApproveTokenTx=_.Yf;export const buildStellarProposeCancellerResetTx=_.AI;export const buildStellarProposeConfigureAssetOracleTx=_.O2;export const buildStellarProposeConfigureMarketOracleTx=_.c5;export const buildStellarProposeCreateHubTx=_.N8;export const buildStellarProposeCreateLiquidityPoolTx=_.qU;export const buildStellarProposeDeployPoolTx=_.RZ;export const buildStellarProposeEditAssetInSpokeTx=_.ni;export const buildStellarProposeEditOracleToleranceTx=_.hF;export const buildStellarProposeGovernanceUpgradeTx=_.Qk;export const buildStellarProposeGrantGovernanceRoleTx=_.Gw;export const buildStellarProposeMigrateControllerTx=_.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=_.uj;export const buildStellarProposeRemoveSpokeTx=_.Od;export const buildStellarProposeRevokeBlendPoolTx=_.X7;export const buildStellarProposeRevokeGovernanceRoleTx=_.Ub;export const buildStellarProposeRevokeTokenTx=_.Dx;export const buildStellarProposeSetAccumulatorTx=_.OA;export const buildStellarProposeSetAggregatorTx=_.$U;export const buildStellarProposeSetMinBorrowCollatTx=_.ob;export const buildStellarProposeSetPositionLimitsTx=_.$l;export const buildStellarProposeSetPositionManagerTx=_.K;export const buildStellarProposeSetPriceAggregatorTx=_.Wb;export const buildStellarProposeSetSpokeLiquidationCurveTx=_.kw;export const buildStellarProposeSetSwapAggregatorTx=_.qA;export const buildStellarProposeTransferCtrlOwnershipTx=_.VS;export const buildStellarProposeTransferGovOwnTx=_.HP;export const buildStellarProposeUnpauseTx=_.xQ;export const buildStellarProposeUpdateDelayTx=_.YQ;export const buildStellarProposeUpgradeControllerTx=_.QY;export const buildStellarProposeUpgradePoolParamsTx=_.os;export const buildStellarProposeUpgradePoolTx=_.Ko;export const buildStellarRenewAccountTx=_.IJ;export const buildStellarRepayBatchTx=_.nw;export const buildStellarRepayDebtWithCollateralTx=_.Pr;export const buildStellarRepayTx=_.ZE;export const buildStellarRevokeBlendPoolTx=_.X0;export const buildStellarRevokeRoleTx=_.ev;export const buildStellarRevokeTokenTx=_.P8;export const buildStellarSetAccumulatorTx=_.aV;export const buildStellarSetAggregatorTx=_.p2;export const buildStellarSetMarketOracleConfigTx=_.sV;export const buildStellarSetOracleSanityBoundsTx=_.XD;export const buildStellarSetOracleToleranceTx=_.Js;export const buildStellarSetOracleTx=_.W5;export const buildStellarSetPositionLimitsTx=_.Dy;export const buildStellarSetPriceAggregatorTx=_._i;export const buildStellarSetSpokeAssetFlagsTx=_.FZ;export const buildStellarSetSwapAggregatorTx=_.wG;export const buildStellarSupplyBatchTx=_.Ni;export const buildStellarSupplyTx=_.v_;export const buildStellarSwapCollateralTx=_.qD;export const buildStellarSwapDebtTx=_.qR;export const buildStellarTransferOwnershipTx=_.QJ;export const buildStellarUnpauseTx=_.bm;export const buildStellarUpdateAccountThresholdTx=_.n_;export const buildStellarUpdateIndexesTx=_.v8;export const buildStellarUpgradeControllerTx=_.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=_.gH;export const buildStellarWithdrawBatchTx=_.O3;export const buildStellarWithdrawTx=_.Gz;export const buildTx=_.pr;export const decodeStellarLendingEvent=_.Fm;export const encodeAssetOracle=_.Ft;export const encodeInterestRateModel=_.MB;export const encodeMarketOracleConfigInput=_.Dn;export const encodeMarketParamsRaw=_.pq;export const encodePositionLimits=_.Q3;export const encodePriceKey=_.Jh;export const encodeStrategyPayloadToRouteXdr=_.wf;export const extractEventOrder=_.Um;export const getStellarAccountPositions=_.xO;export const getStellarAggregatorQuote=_.Lw;export const getStellarAggregatorRouter=_.KM;export const getStellarAsset=_.mM;export const getStellarAssetGraph=_.iE;export const getStellarAssetMarkets=_.zp;export const getStellarAssetPage=_.N3;export const getStellarAssets=_.bN;export const getStellarGovernance=_.QV;export const getStellarGovernanceProposals=_.T_;export const getStellarHub=_.XI;export const getStellarHubGraph=_.Lt;export const getStellarHubs=_.KK;export const getStellarLendingContext=_.yl;export const getStellarLendingController=_.vc;export const getStellarLendingLiveState=_.kq;export const getStellarQuoteTokens=_.CH;export const getStellarReserve=_.FI;export const getStellarReserveGraph=_.KG;export const getStellarReserveHolders=_.nW;export const getStellarReserves=_.jF;export const getStellarSpoke=_.S2;export const getStellarSpokeGraph=_.uS;export const getStellarSpokes=_.u_;export const getStellarUserActivity=_.O5;export const getStellarUserPositions=_.Av;export const mapQuoteResponseToAggregatorSwap=_.LA;export const mapQuoteResponseToStrategyPayload=_.E6;export const mapQuoteResponseToStrategySwap=_.Ds;export const mapSorobanError=_.XV;export const mapStellarPositionActivityType=_.CU;export const prepareStellarBuiltTx=_.Vx;export const prepareStellarTxXdr=_.DL;export const stellarLendingDispatchKey=_.ON;export const stellarLendingRead=_.Hh;export const syntheticEventOrder=_.oV;export const tagStellarInvokedContractError=_.g5;export const toBase64Xdr=_.L;export const toStellarPositionMode=_.Vu;
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as s,xdr as i}from"@stellar/stellar-sdk";var a={385(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>xe,DU:()=>c,fA:()=>Go,A$:()=>m,J9:()=>f,hS:()=>g,gR:()=>Vo,Cg:()=>Wo,VZ:()=>lr,N0:()=>Jt,B_:()=>be,qL:()=>ne,eX:()=>se,z:()=>er,xD:()=>X,jR:()=>Z,P2:()=>dr,W6:()=>he,se:()=>fe,ZP:()=>ho,yr:()=>tr,sp:()=>et,Iu:()=>vo,yu:()=>xo,$9:()=>po,zw:()=>co,h_:()=>yo,e_:()=>go,Tk:()=>ao,BA:()=>lo,u9:()=>qo,bi:()=>wo,gc:()=>So,ay:()=>bo,SX:()=>Zt,UF:()=>jo,Y5:()=>tt,mE:()=>ot,xG:()=>Ft,s9:()=>rt,OL:()=>Ht,k6:()=>Ce,dj:()=>Ne,kD:()=>je,Yf:()=>We,AI:()=>mo,O2:()=>to,c5:()=>eo,N8:()=>Le,qU:()=>He,RZ:()=>Ze,ni:()=>$e,hF:()=>oo,Qk:()=>ro,Gw:()=>uo,$K:()=>Je,uj:()=>Be,Od:()=>Ue,X7:()=>Fe,Ub:()=>so,Dx:()=>Ve,OA:()=>Oe,$U:()=>Re,ob:()=>ze,$l:()=>Me,K:()=>Ge,Wb:()=>Ee,kw:()=>De,qA:()=>Ie,VS:()=>Ye,HP:()=>io,xQ:()=>To,YQ:()=>no,QY:()=>Qe,os:()=>Xe,Ko:()=>Ke,IJ:()=>ge,nw:()=>J,Pr:()=>st,ZE:()=>Y,X0:()=>ue,ev:()=>Kt,P8:()=>ie,aV:()=>oe,p2:()=>ee,sV:()=>pe,XD:()=>de,Js:()=>le,W5:()=>ae,Dy:()=>re,_i:()=>te,FZ:()=>ce,wG:()=>Yt,Ni:()=>F,v_:()=>H,qD:()=>ut,qR:()=>nt,QJ:()=>Qt,bm:()=>Xt,n_:()=>Se,v8:()=>ye,qM:()=>jt,gH:()=>me,O3:()=>K,Gz:()=>Q,pr:()=>j,Fm:()=>zo,Ft:()=>Wt,MB:()=>Ot,Dn:()=>Vt,pq:()=>Mt,Q3:()=>Lt,Jh:()=>Nt,wf:()=>Yo,Um:()=>Fo,xO:()=>_t,Lw:()=>Qo,KM:()=>b,mM:()=>bt,iE:()=>kt,zp:()=>xt,N3:()=>St,bN:()=>dt,QV:()=>S,T_:()=>At,XI:()=>vt,Lt:()=>Pt,KK:()=>yt,yl:()=>lt,vc:()=>h,kq:()=>ct,CH:()=>Jo,FI:()=>mt,KG:()=>Et,nW:()=>ht,jF:()=>ft,S2:()=>wt,uS:()=>It,u_:()=>gt,O5:()=>Tt,Av:()=>qt,LA:()=>nr,E6:()=>or,Ds:()=>rr,XV:()=>gr,CU:()=>Xo,Vx:()=>ar,DL:()=>ir,ON:()=>ko,Hh:()=>Rt,oV:()=>Ho,g5:()=>sr,L:()=>_o,Vu:()=>pr});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},g={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},f={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function h(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function b(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},w=1e6,q=t=>new e(t).toScVal(),T=t=>new n(t).toI128(),_=t=>i.ScVal.scvU32(t),A=t=>new n("string"==typeof t?t:t.toString()).toU64(),k=t=>i.ScVal.scvBool(t),P=t=>i.ScVal.scvString(t),I=t=>i.ScVal.scvSymbol(t),E=()=>i.ScVal.scvVoid(),R=t=>i.ScVal.scvVec(t),O=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return i.ScVal.scvBytes(r)},M=(t,e)=>null==t?E():e(t),L=(t,e)=>C({asset:q(e),hub_id:_(t)}),N=(t,e,o)=>i.ScVal.scvVec([L(t,e),T(o)]),U=t=>i.ScVal.scvVec(t.map((t=>N(t.hubId,t.asset,t.amount)))),C=t=>{const e=Object.keys(t).sort().map((e=>new i.ScMapEntry({key:I(e),val:t[e]})));return i.ScVal.scvMap(e)};class ${assets=[];amounts=[];ops=[];weights=[];constructor(t){this.amounts.push(t)}asset(t){const e=this.assets.indexOf(t);if(-1!==e)return e;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(t),this.assets.length-1}amount(t){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(t),this.amounts.length-1}weight(t){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(t)||t<=0||t>w)throw new Error(`Stellar builder: split weight ${t} outside 1..=1000000`);return this.weights.push(t),this.weights.length-1}emit(t,e,o,r,n){this.ops.push([t,e,o,r,n])}emitPath(t,e){t.hops.forEach(((o,r)=>{if(o.tokenIn===o.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=t.hops[r-1];if(n&&o.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(v[o.venue],0===r?e:1,this.asset(o.pool),this.asset(o.tokenIn),this.asset(o.tokenOut))}))}lowerPaths(t){const e=t.filter((t=>t.hops.length>0)),o=Array.from({length:e.length},(()=>!1));for(let t=0;t<e.length;t+=1){if(o[t])continue;const r=e[t].hops[0]?.tokenIn,n=[];for(let o=t;o<e.length;o+=1)e[o].hops[0]?.tokenIn===r&&n.push(o);const u=n.reduce(((t,o)=>t+e[o].splitPpm),0);if(u>w)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const s=u===w;let i=w;n.forEach(((t,r)=>{o[t]=!0;const u=e[t];let a;if(r+1===n.length&&s)a=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const t=Math.floor(u.splitPpm*w/i);i-=Math.min(u.splitPpm,i),a=128+this.weight(t)}this.emitPath(u,a)}))}}toBytes(t,e,o){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const r=[1,t,e,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,this.ops.length,this.weights.length];for(const t of this.ops)r.push(...t);for(const t of this.weights)r.push(t>>>16&255,t>>>8&255,255&t);return Buffer.from(r)}get assetList(){return this.assets}get amountList(){return this.amounts}}const B=t=>{const e=new $(t.totalMinOut),o=e.asset(t.tokenIn),r=e.asset(t.tokenOut);if(o===r)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(t.burnPool){const r=e.asset(t.burnPool),n=e.amountList.length;for(const o of t.burnMinAmounts??[])e.amount(o);e.emit(5,0,r,o,n)}if(e.lowerPaths(t.paths),t.mintPool){const o=t.preSwapAmount;if(o&&BigInt(o)>0n){const r=t.mintPoolTokens;if(!r||2!==r.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=r,[s,i]=t.preSwapFromA?[n,u]:[u,n];e.emit(v.Aquarius,2+e.amount(o),e.asset(t.mintPool),e.asset(s),e.asset(i))}e.emit(6,0,e.asset(t.mintPool),r,e.amount(t.mintMinShares??"1"))}const n=Number(t.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${t.referralId} does not fit the wire’s u32`);return C({amounts:i.ScVal.scvVec(e.amountList.map((t=>T(t)))),assets:i.ScVal.scvVec(e.assetList.map((t=>q(t)))),ops:i.ScVal.scvBytes(e.toBytes(o,r,n))})},D=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return i.ScVal.scvBytes(e)},G=()=>i.ScVal.scvBytes(Buffer.alloc(0)),z=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},W=t=>{if("string"==typeof t)return D(z(t));if(t instanceof Uint8Array)return 0===t.length?G():D(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?D(z(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?D(z(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?D(z(t.bytes)):0===t.bytes.length?G():D(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");const o=new Map;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const e=r.hops[0];o.set(e.tokenIn,(o.get(e.tokenIn)??0)+r.splitPpm)}for(const[t,r]of o){if(r>w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} sums to ${r}, above 1000000`);if(!e.mintPool&&r!==w)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${t} must sum to 1000000, got ${r}`)}return e})(t),i.ScVal.scvBytes(Buffer.from(B(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},V=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return i.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return i.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function j(e,n,s){const i=e.controllerAddress??h(e.network),a=new r(i),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...s)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function F(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return j(t,"supply",[q(t.caller),A(o),_(r),U([...e.assets])])}function H(t,e){return F(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function X(t,e){return j(t,"borrow",[q(t.caller),A(e.accountNonce),U([...e.borrows]),M(e.to,q)])}function Z(t,e){return X(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function K(t,e){return j(t,"withdraw",[q(t.caller),A(e.accountNonce),U([...e.withdrawals]),M(e.to,q)])}function Q(t,e){return K(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function J(t,e){return j(t,"repay",[q(t.caller),A(e.accountNonce),U([...e.payments])])}function Y(t,e){return J(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function tt(t,e){return j(t,"liquidate",[q(t.caller),A(e.accountNonce),U([...e.debtPayments])])}function et(t,e){return j(t,"flash_loan",[q(t.caller),L(e.hubId,e.asset),T(e.amount),q(e.receiver),V(e.data)])}function ot(t,e){return j(t,"migrate_from_blend",[q(t.caller),A(e.accountId),_(e.spokeId),_(e.hubId),q(e.blendPool),R(e.collateralTokens.map(q)),R(e.supplyTokens.map(q)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),i.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,i.ScVal.scvVec([q(e),T(o)]);var e,o}))))]);var o}function rt(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return j(t,"multiply",[q(t.caller),A(o),_(r),L(e.collateral.hubId,e.collateral.asset),T(e.debtToFlashLoan),L(e.debt.hubId,e.debt.asset),_(e.mode),W(e.steps),M(e.initialPayment,(t=>N(t.hubId,t.asset,t.amount))),M(e.convertSwap,W)])}function nt(t,e){return j(t,"swap_debt",[q(t.caller),A(e.accountNonce),L(e.existingDebt.hubId,e.existingDebt.asset),T(e.newDebtAmount),L(e.newDebt.hubId,e.newDebt.asset),W(e.steps)])}function ut(t,e){return j(t,"swap_collateral",[q(t.caller),A(e.accountNonce),L(e.current.hubId,e.current.asset),T(e.fromAmount),L(e.newCollateral.hubId,e.newCollateral.asset),W(e.steps)])}function st(t,e){return j(t,"repay_debt_with_collateral",[q(t.caller),A(e.accountNonce),L(e.collateral.hubId,e.collateral.asset),T(e.collateralAmount),L(e.debt.hubId,e.debt.asset),W(e.steps),k(e.closePosition)])}const it="/stellar-lending",at=25,pt=encodeURIComponent,lt=(t,e)=>t.fetchWithTimeout(`${it}/context`,e),ct=(t,e)=>t.fetchWithTimeout(`${it}/live-state`,e),dt=(t,e)=>t.fetchWithTimeout(`${it}/assets`,e),yt=(t,e)=>t.fetchWithTimeout(`${it}/hubs`,e),gt=(t,e)=>t.fetchWithTimeout(`${it}/spokes`,e),ft=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${it}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},mt=(t,e,o,r,n)=>t.fetchWithTimeout(`${it}/reserves/${e}/${o}/${pt(r)}`,n),ht=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${it}/reserves/${e}/${o}/${pt(r)}/holders`,{...u,params:{side:n}}),bt=(t,e,o)=>t.fetchWithTimeout(`${it}/assets/${pt(e)}`,o),St=(t,e,o,r)=>t.fetchWithTimeout(`${it}/assets/${pt(e)}/page`,{...r,params:{...o}}),xt=(t,e,o,r)=>t.fetchWithTimeout(`${it}/assets/${pt(e)}/markets`,{...r,params:{side:o}}),vt=(t,e,o)=>t.fetchWithTimeout(`${it}/hubs/${e}`,o),wt=(t,e,o)=>t.fetchWithTimeout(`${it}/spokes/${e}`,o),qt=(t,e,o)=>t.fetchWithTimeout(`${it}/users/${pt(e)}/positions`,o),Tt=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${it}/users/${pt(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},_t=(t,e,o)=>t.fetchWithTimeout(`${it}/accounts/${pt(e)}/positions`,o),At=(t,e={},o)=>{const{top:r=at,continuationToken:n}=e;return t.fetchWithTimeout(`${it}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},kt=(t,e,o,r)=>t.fetchWithTimeout(`${it}/assets/${pt(e)}/graph`,{...r,params:{...o}}),Pt=(t,e,o,r)=>t.fetchWithTimeout(`${it}/hubs/${e}/graph`,{...r,params:{...o}}),It=(t,e,o,r)=>t.fetchWithTimeout(`${it}/spokes/${e}/graph`,{...r,params:{...o}}),Et=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${it}/reserves/${e}/${o}/${pt(r)}/graph`,{...u,params:{...n}}),Rt=t=>({context:e=>lt(t,e),liveState:e=>ct(t,e),assets:e=>dt(t,e),hubs:e=>yt(t,e),spokes:e=>gt(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?ft(t,e,o):ft(t,{},e);var r},reserve:(e,o,r,n)=>mt(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>ht(t,e,o,r,n,u),asset:(e,o)=>bt(t,e,o),assetMarkets:(e,o,r)=>xt(t,e,o,r),hub:(e,o)=>vt(t,e,o),spoke:(e,o)=>wt(t,e,o),userPositions:(e,o)=>qt(t,e,o),userActivity:(e,o,r)=>Tt(t,e,o,r),accountPositions:(e,o)=>_t(t,e,o),governanceProposals:(e,o)=>At(t,e,o),assetGraph:(e,o,r)=>kt(t,e,o,r),hubGraph:(e,o,r)=>Pt(t,e,o,r),spokeGraph:(e,o,r)=>It(t,e,o,r),reserveGraph:(e,o,r,n,u)=>Et(t,e,o,r,n,u)}),Ot=t=>C({base_borrow_rate:T(t.baseBorrowRateRay),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Mt=t=>C({asset_decimals:_(t.assetDecimals),asset_id:q(t.assetId),base_borrow_rate:T(t.baseBorrowRateRay),flashloan_fee:_(t.flashloanFeeBps),is_flashloanable:k(t.isFlashloanable),max_borrow_rate:T(t.maxBorrowRateRay),max_utilization:T(t.maxUtilizationRay),mid_utilization:T(t.midUtilizationRay),optimal_utilization:T(t.optimalUtilizationRay),reserve_factor:_(t.reserveFactorBps),slope1:T(t.slope1Ray),slope2:T(t.slope2Ray),slope3:T(t.slope3Ray)}),Lt=t=>C({max_borrow_positions:_(t.maxBorrowPositions),max_supply_positions:_(t.maxSupplyPositions)}),Nt=t=>{if("Token"in t&&t.Token)return R([I("Token"),q(t.Token)]);if("Ref"in t&&t.Ref)return R([I("Ref"),I(t.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(t)}`)},Ut=t=>{if("Stellar"in t)return R([I("Stellar"),q(t.Stellar)]);if("Symbol"in t)return R([I("Symbol"),I(t.Symbol)]);if("String"in t)return R([I("String"),P(t.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(t)}`)},Ct=t=>{if("Spot"===t)return R([I("Spot")]);if(t&&"object"==typeof t&&"Twap"in t)return R([I("Twap"),_(Number(t.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(t)}`)},$t=t=>{if("Reflector"===t||"RedStone"===t||"Xoxno"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown ProviderKind "${t}"`)},Bt=t=>{if("Market"===t||"Fundamental"===t)return R([I(t)]);throw new Error(`Stellar builder: unknown FeedNature "${t}"`)},Dt=t=>{if("Reflector"in t){const e=t.Reflector;return R([I("Reflector"),C({asset:Ut(e.asset),contract:q(e.contract),read_mode:Ct(e.readMode)})])}if("MultiFeed"in t){const e=t.MultiFeed;return R([I("MultiFeed"),C({contract:q(e.contract),feed_id:P(e.feedId),kind:$t(e.kind),nature:Bt(e.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(t)}`)},Gt=t=>{const e=t;return C({decimals:_(e.decimals),max_stale_seconds:A(e.maxStaleSeconds),provider:Dt(e.provider)})},zt=t=>{if("RequireDisjoint"===t)return R([I("RequireDisjoint")]);if(t&&"object"==typeof t&&"AllowShared"in t){const e=t.AllowShared;return R([I("AllowShared"),R(e.map((t=>C({contract:q(t.contract),kind:$t(t.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(t)}`)},Wt=t=>{const e=t,o=e.sources??[];let r,n;if("number"==typeof e.toleranceBps)r=1e4+e.toleranceBps,n=Math.max(1,Math.floor(1e8/r));else{const t=e.tolerance??{};r=Number(t.upperRatioBps),n=Number(t.lowerRatioBps)}return C({asset_decimals:_(Number(e.assetDecimals)),independence:zt(e.independence),max_price_stale_seconds:A(Number(e.maxPriceStaleSeconds)),max_sanity_price_wad:T(String(e.maxSanityPriceWad)),min_sanity_price_wad:T(String(e.minSanityPriceWad)),sources:R(o.map((t=>(t=>{if("Feed"in t)return R([I("Feed"),Gt(t.Feed)]);if("Scaled"in t){const e=t.Scaled;return R([I("Scaled"),C({factor:Gt(e.factor),max_factor_wad:T(e.maxFactorWad),min_factor_wad:T(e.minFactorWad),quote:Nt(e.quote)})])}if("LpShare"in t){const e=t.LpShare;return R([I("LpShare"),C({key_a:Nt(e.keyA),key_b:Nt(e.keyB),kind:R([I(e.kind||"ConstantProduct")]),pool:q(e.pool),reserve_a_decimals:_(e.reserveADecimals),reserve_b_decimals:_(e.reserveBDecimals),share_decimals:_(e.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(t)}`)})(t)))),tolerance:C({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})})},Vt=Wt;function jt(t,e){return j(t,"upgrade",[O(e.wasmHash)])}function Ft(t,e){return j(t,"migrate",[_(e.newVersion)])}function Ht(t){return j(t,"pause",[])}function Xt(t){return j(t,"unpause",[])}function Zt(t,e){return j(t,"grant_role",[q(e.account),I(e.role)])}function Kt(t,e){return j(t,"revoke_role",[q(e.account),I(e.role)])}function Qt(t,e){return j(t,"transfer_ownership",[q(e.newOwner),_(e.liveUntilLedger)])}function Jt(t){return j(t,"accept_ownership",[])}function Yt(t,e){return j(t,"set_swap_aggregator",[q(e.aggregator)])}function te(t,e){return j(t,"set_price_aggregator",[q(e.aggregator)])}const ee=Yt;function oe(t,e){return j(t,"set_accumulator",[q(e.accumulator)])}function re(t,e){return j(t,"set_position_limits",[Lt(e)])}function ne(t,e){return j(t,"approve_blend_pool",[q(e.pool)])}function ue(t,e){return j(t,"revoke_blend_pool",[q(e.pool)])}const se=ne,ie=ue;function ae(t,e){return j(t,"set_oracle",[Nt(e.key),Wt(e.oracle)])}const pe=ae;function le(t,e){const o=e.toleranceBps,r=e.upperRatioBps??1e4+o,n=e.lowerRatioBps??Math.max(1,Math.floor(1e8/r));return j(t,"set_tolerance",[Nt(e.key),C({lower_ratio_bps:_(n),upper_ratio_bps:_(r)})])}function ce(t,e){return j(t,"set_spoke_asset_flags",[_(e.spokeId),L(e.hubId,e.asset),k(e.paused),k(e.frozen)])}function de(t,e){return j(t,"set_oracle_sanity_bounds",[q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function ye(t,e){return j(t,"update_indexes",[q(t.caller),R(e.assets.map((t=>L(t.hubId,t.asset))))])}function ge(t,e){return j(t,"renew_account",[q(t.caller),A(e.accountNonce)])}function fe(t,e){return j(t,"create_liquidity_pool",[_(e.hubId),q(e.asset),Mt(e.params)])}function me(t,e){return j(t,"upgrade_liquidity_pool_params",[L(e.hubId,e.asset),Ot(e.params)])}function he(t,e){return j(t,"claim_revenue",[q(t.caller),R(e.assets.map((t=>L(t.hubId,t.asset))))])}function be(t,e){return j(t,"add_rewards",[q(t.caller),U(e.rewards)])}function Se(t,e){return j(t,"update_account_threshold",[q(t.caller),k(e.hasRisks),R(e.accountNonces.map((t=>A(t))))])}const xe="00".repeat(32),ve=t=>{if("string"==typeof t)return O(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return i.ScVal.scvBytes(e)},we=(t,...e)=>R([I(t),...e]),qe=t=>C({new_owner:q(t.newOwner),live_until_ledger:_(t.liveUntilLedger)}),Te=t=>C({asset:q(t.asset),bonus:_(t.bonus),borrow_cap:T(t.borrowCap),can_borrow:k(t.canBorrow),can_collateral:k(t.canCollateral),frozen:k(t.frozen),hub_id:_(t.hubId),paused:k(t.paused),liquidation_fees:_(t.liquidationFees),ltv:_(t.ltv),oracle_override:R([I("None")]),spoke_id:_(t.spokeId),supply_cap:T(t.supplyCap),threshold:_(t.threshold)}),_e=t=>C({account:q(t.account),role:I(t.role)});function Ae(e,n,s){const i=e.governanceAddress??S(e.network),a=new r(i),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...s)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ke=(t,e,o)=>Ae(t,"propose",[q(t.caller),e,ve(o)]),Pe=(t,e,o)=>Ae(t,"execute_self",[E(),e,ve(o)]);function Ie(t,e,o){return ke(t,we("SetSwapAggregator",q(e.aggregator)),o)}function Ee(t,e,o){return ke(t,we("SetPriceAggregator",q(e.aggregator)),o)}const Re=Ie;function Oe(t,e,o){return ke(t,we("SetAccumulator",q(e.accumulator)),o)}function Me(t,e,o){return ke(t,we("SetPositionLimits",Lt(e)),o)}function Le(t,e){return ke(t,we("CreateHub"),e)}function Ne(t,e){return ke(t,we("AddSpoke"),e)}function Ue(t,e,o){return ke(t,we("RemoveSpoke",_(e.spokeId)),o)}function Ce(t,e,o){return ke(t,we("AddAssetToSpoke",Te(e)),o)}function $e(t,e,o){return ke(t,we("EditAssetInSpoke",Te(e)),o)}function Be(t,e,o){return ke(t,we("RemoveAssetFromSpoke",C({hub_asset:L((r=e).hubId,r.asset),spoke_id:_(r.spokeId)})),o);var r}function De(t,e,o){return ke(t,we("SetSpokeLiquidationCurve",C({hf_for_max_bonus_wad:T((r=e).hfForMaxBonusWad),liquidation_bonus_factor_bps:_(r.liquidationBonusFactorBps),spoke_id:_(r.spokeId),target_hf_wad:T(r.targetHfWad)})),o);var r}function Ge(t,e,o){return ke(t,we("SetPositionManager",q(e.manager),k(e.isActive)),o)}function ze(t,e,o){return ke(t,we("SetMinBorrowCollateralUsd",T(e.floorWad)),o)}function We(t,e,o){return ke(t,we("ApproveToken",q(e.token)),o)}function Ve(t,e,o){return ke(t,we("RevokeToken",q(e.token)),o)}function je(t,e,o){return ke(t,we("ApproveBlendPool",q(e.pool)),o)}function Fe(t,e,o){return ke(t,we("RevokeBlendPool",q(e.pool)),o)}function He(t,e,o){return ke(t,we("CreateLiquidityPool",C({asset:q((r=e).asset),hub_id:_(r.hubId),params:Mt(r.params)})),o);var r}function Xe(t,e,o){return ke(t,we("UpgradeLiquidityPoolParams",C({hub_asset:L((r=e).hubId,r.asset),params:Ot(r.params)})),o);var r}function Ze(t,e,o){return ke(t,we("DeployPool",O(e.wasmHash)),o)}function Ke(t,e,o){return ke(t,we("UpgradePool",O(e.wasmHash)),o)}function Qe(t,e,o){return ke(t,we("UpgradeController",O(e.wasmHash)),o)}function Je(t,e,o){return ke(t,we("MigrateController",_(e.newVersion)),o)}function Ye(t,e,o){return ke(t,we("TransferCtrlOwnership",qe(e)),o)}function to(t,e,o){return ke(t,we("ConfigureAssetOracle",C({key:Nt((r=e).key),oracle:Wt(r.oracle)})),o);var r}const eo=to;function oo(t,e,o){return ke(t,we("EditOracleTolerance",C({key:Nt((r=e).key),tolerance:_(r.tolerance)})),o);var r}function ro(t,e,o){return ke(t,we("UpgradeGov",O(e.wasmHash)),o)}function no(t,e,o){return ke(t,we("UpdateGovDelay",_(e.newDelay)),o)}function uo(t,e,o){return ke(t,we("GrantGovRole",_e(e)),o)}function so(t,e,o){return ke(t,we("RevokeGovRole",_e(e)),o)}function io(t,e,o){return ke(t,we("TransferGovOwnership",qe(e)),o)}function ao(t,e){const o=R(e.argsXdr.map((t=>i.ScVal.fromXDR(t,"base64")))),r=ve(e.predecessor??xe);return Ae(t,"execute",[E(),q(e.target),I(e.functionName),o,r,ve(e.salt)])}function po(t,e,o){return Pe(t,we("UpgradeGov",O(e.wasmHash)),o)}function lo(t,e,o){return Pe(t,we("UpdateGovDelay",_(e.newDelay)),o)}function co(t,e,o){return Pe(t,we("GrantGovRole",_e(e)),o)}function yo(t,e,o){return Pe(t,we("RevokeGovRole",_e(e)),o)}function go(t,e,o){return Pe(t,we("TransferGovOwnership",qe(e)),o)}const fo=t=>R(t.map(q));function mo(t,e,o){return Ae(t,"propose_canceller_reset",[fo(e.newCancellers),ve(o)])}function ho(t,e,o){return Ae(t,"execute_canceller_reset",[M(e.executor,q),fo(e.newCancellers),ve(o)])}function bo(t,e){return Ae(t,"set_spoke_asset_flags",[q(t.caller),_(e.spokeId),L(e.hubId,e.asset),k(e.paused),k(e.frozen)])}function So(t,e){return Ae(t,"set_oracle_sanity_bounds",[q(t.caller),q(e.asset),T(e.minPriceWad),T(e.maxPriceWad)])}function xo(t){return Ae(t,"create_hub",[q(t.caller)])}function vo(t){return Ae(t,"add_spoke",[q(t.caller)])}function wo(t,e){return Ae(t,"revoke_role_immediate",[q(e.account),I(e.role)])}function qo(t){return Ae(t,"pause",[q(t.caller)])}function To(t,e){return ke(t,we("Unpause"),e)}const _o=t=>t.toXDR("base64"),Ao=t=>i.ScVal.fromXDR(t,"base64"),ko=t=>t.map((t=>String(s(Ao(t))))).join(":"),Po=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),Io=t=>Number(t),Eo=t=>String(t),Ro=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),Oo=["None","Multiply","Long","Short"],Mo=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],Lo=t=>Array.isArray(t)?t:[],No=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],Mo[Io(r)]??Po(r)),positionType:e,hubId:Io(t[1]),asset:Eo(t[2]),scaledAmountRay:Po(t[3]),indexRay:Po(t[4]),amount:Po(t[5]),liquidationThresholdBps:o?void 0:Io(t[6]),liquidationBonusBps:o?void 0:Io(t[7]),loanToValueBps:o?void 0:Io(t[8]),liquidationFeesBps:o?void 0:Io(t[9])};var r},Uo=t=>{return{owner:Eo(t[0]),spokeId:Io(t[1]),mode:(e=t[2],Oo[Io(e)]??"None")};var e},Co=t=>Array.isArray(t)?t[1]:void 0,$o=t=>{const e=(o=t,Array.isArray(o)?Eo(o[0]):Eo(o));var o;if("Token"===e)return{Token:Eo(Co(t))};if("Ref"===e)return{Ref:Eo(Co(t))};if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;if(void 0!==e.Token)return{Token:Eo(e.Token)};if(void 0!==e.Ref)return{Ref:Eo(e.Ref)}}return{Token:Eo(t)}},Bo=t=>{const e=t.tolerance??{};return{assetDecimals:Io(t.asset_decimals),maxPriceStaleSeconds:Io(t.max_price_stale_seconds),sources:Lo(t.sources).map((t=>t)),tolerance:{upperRatio:Io(e.upper_ratio_bps),lowerRatio:Io(e.lower_ratio_bps)},independence:t.independence,minSanityPriceWad:Po(t.min_sanity_price_wad),maxSanityPriceWad:Po(t.max_sanity_price_wad)}},Do={"market:create":t=>({topic:"market:create",data:{hubId:Io(t.hub_id),baseAsset:Eo(t.base_asset),maxBorrowRate:Po(t.max_borrow_rate),baseBorrowRate:Po(t.base_borrow_rate),slope1:Po(t.slope1),slope2:Po(t.slope2),slope3:Po(t.slope3),midUtilization:Po(t.mid_utilization),optimalUtilization:Po(t.optimal_utilization),maxUtilization:Po(t.max_utilization),reserveFactor:Io(t.reserve_factor),marketAddress:Eo(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:Eo(t.asset),maxBorrowRateRay:Po(t.max_borrow_rate),baseBorrowRateRay:Po(t.base_borrow_rate),slope1Ray:Po(t.slope1),slope2Ray:Po(t.slope2),slope3Ray:Po(t.slope3),midUtilizationRay:Po(t.mid_utilization),optimalUtilizationRay:Po(t.optimal_utilization),maxUtilizationRay:Po(t.max_utilization),reserveFactorBps:Io(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:Lo(t).map((t=>{return e=Lo(t),{hubId:Io(e[0]),asset:Eo(e[1]),timestamp:Io(e[2]),supplyIndexRay:Po(e[3]),borrowIndexRay:Po(e[4]),cash:Po(e[5]),suppliedRay:Po(e[6]),borrowedRay:Po(e[7]),revenueRay:Po(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:Lo(t).map((t=>{const e=t;return{hubId:Io(e.hub_id),asset:Eo(e.asset),params:(o=e.params,{maxBorrowRateRay:Po(o.max_borrow_rate),baseBorrowRateRay:Po(o.base_borrow_rate),slope1Ray:Po(o.slope1),slope2Ray:Po(o.slope2),slope3Ray:Po(o.slope3),midUtilizationRay:Po(o.mid_utilization),optimalUtilizationRay:Po(o.optimal_utilization),maxUtilizationRay:Po(o.max_utilization),reserveFactorBps:Io(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Io(o.flashloan_fee),assetId:Eo(o.asset_id),assetDecimals:Io(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=Lo(t);return{topic:"position:batch_update",data:{accountId:Po(e[0]),accountAttributes:Uo(Lo(e[1])),updates:[...Lo(e[2]).map((t=>No(Lo(t),"Deposit"))),...Lo(e[3]).map((t=>No(Lo(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:Io(t.hub_id),asset:Eo(t.asset),receiver:Eo(t.receiver),caller:Eo(t.caller),amount:Po(t.amount),fee:Po(t.fee)}}),"config:asset_oracle":t=>({topic:"config:asset_oracle",data:{key:$o(t.key),oracle:Bo(t.oracle)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:Eo(t.asset),oracle:Bo(t.config??t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:Eo(t.liquidator),accountId:Po(t.account_id),repaidUsdWad:Po(t.repaid_usd_wad),bonusBps:Po(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:Po(t.account_id),totalBorrowUsdWad:Po(t.total_borrow_usd_wad),totalCollateralUsdWad:Po(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:Eo(t.token),amount:Po(t.amount),usdValueWad:Po(t.usd_value_wad),accountId:Po(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:Io(t.hub_id),asset:Eo(t.asset),amount:Po(t.amount),fee:Po(t.fee),amountSent:Po(t.amount_sent)}}),"config:approve_blend_pool":t=>({topic:"config:approve_blend_pool",data:{pool:Eo(t.pool??t.blend_pool??t.token),approved:Boolean(t.approved??t.is_approved??!0)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:Ro(t.wasm_hash??t.pool),approved:Boolean(t.approved)}}),"config:swap_aggregator":t=>({topic:"config:swap_aggregator",data:{aggregator:Eo(t.aggregator??t.swap_aggregator)}}),"config:price_aggregator":t=>({topic:"config:price_aggregator",data:{aggregator:Eo(t.aggregator??t.price_aggregator)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:Eo(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:Eo(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:Ro(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:Io(t.max_supply_positions),maxBorrowPositions:Io(t.max_borrow_positions)}}),"config:min_borrow_collateral":t=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Po(t.min_borrow_collateral_usd_wad??t.floor_wad??t.value)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:Eo(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:Io(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:Po(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Po(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:Io(e.liquidation_bonus_factor_bps)}}}},Go=Object.freeze(Object.keys(Do));function zo(t,e){const o=ko(t),r=Do[o];return r?r(s(Ao(e))):null}const Wo="XLENDXLM-a7c9f3",Vo=1e4;function jo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${Wo}-${o}`}function Fo(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function Ho(t,e=0){return t*Vo+e}function Xo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Zo=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},Ko=t=>t.baseUrl??f[t.network];async function Qo(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Zo(Ko(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function Jo(t){const e=Zo(Ko(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Yo=t=>B(t).toXDR("base64");function tr(e,n){const s=e.routerAddress??b(e.network),i=new r(s),a=new t(e.caller,e.sourceSequence),p=W(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(i.call("execute_strategy",q(e.caller),T(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function er(t,e){return tr(t,e)}function or(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map(ur),splitPpm:t.splitPpm}))):[{hops:t.hops.map(ur),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function rr(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:or(t,e)}const nr=or,ur=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function sr(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function ir(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw sr(o.invokedContractId,t);throw t}}async function ar(t,e,o){return ir(t,e.xdr,o)}function pr(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function lr(t,e){return new Uint8Array(0)}const cr=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function dr(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(cr(e.message)),i.ScVal.scvBytes(cr(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const yr={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function gr(t){const e=t.match(/Error\(Contract,\s*#(\d+)\)/);if(!e)return null;const o=Number(e[1]),r=yr[o];return r?{code:o,...r}:null}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",g="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var f;!function(t){t.MAINNET="1",t.DEVNET="D"}(f||(f={}));class m{apiUrl;chain;init;config;constructor({chain:t=f.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[f.MAINNET]:c,[f.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==f.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:g,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...s}=this.init,{next:i,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,g="Bearer undefined"===y?void 0:y,f={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),h=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:b,...S}=r??{},{revalidate:x,...v}=i??{},w="GET"!==c||g?void 0:x??b,q="GET"!==c||g||w?void 0:a??n,T={...s,...d,method:c,...Object.keys(f).length?{headers:f}:{},cache:q,next:{...S,...v,revalidate:w}};(p??u)&&console.debug("SDK fetch: ",h,T);const _=await fetch(h,T).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${h}: ${t.message}`),{cause:t});throw t})),A=await _.text();if(!_.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[h,_.status,_.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const h=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},b=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^G[A-Z2-7]{55}$/.test(t)),w={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},q=["PATCH","POST","DELETE","PUT"];var T=l(385);const _=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...s}=e,i=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),s=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),i=Object.fromEntries(Object.entries(n).filter((([t])=>!s.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in i,p=/:collection[^A-Z]/.test(t)||"collection"in i;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!h(t))):!h(t))throw new S(t)}const l=Object.fromEntries(Object.entries(i).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:g,cache:f,next:m,debug:b,continuationToken:w,...q}=l,T=d?`Bearer ${d}`:void 0,_={...g,...T?{Authorization:T}:{},...w?{"X-Continuation-Token":String(w)}:{}},A={...m,tags:[...m?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:q,body:c,headers:_,cache:f,debug:b,...A?{next:A}:{}})},a=(t={})=>i(t);for(const t of Object.keys(s))q.includes(t)&&(a[t]=e=>i({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(w)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=_(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=_(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,s=Object.keys(e.params).length;let i;if(1===n&&u+s>0){const{rawPath:o,def:n}=e.leaves[0];i=A(o,n,r,t)}else{i={};for(const{rawPath:o,def:n}of e.leaves)i[_(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[t]?i[t]=u:"function"==typeof i[t]?Object.assign(i[t],u):"function"==typeof u?(Object.assign(u,i[t]),i[t]=u):Object.assign(i[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(i[t]){const o=i[t];i[t]=t=>({...o(t),...e(t)})}else i[t]=e}return i};return o(e,{})}export{f as Chain,m as XOXNOClient,k as buildSdk,h as isValidCollectionTicker,b as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=T.ME;export const STELLAR_GOVERNANCE=T.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=T.G_;export const STELLAR_LENDING_CONTROLLER=T.DU;export const STELLAR_LENDING_TOPICS=T.fA;export const STELLAR_NETWORK_PASSPHRASE=T.A$;export const STELLAR_QUOTE_URL=T.J9;export const STELLAR_SOROBAN_RPC_URL=T.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=T.gR;export const XOXNO_LENDING_STELLAR_TICKER=T.Cg;export const buildSameTokenRepaySwapSteps=T.VZ;export const buildStellarAcceptOwnershipTx=T.N0;export const buildStellarAddRewardsTx=T.B_;export const buildStellarApproveBlendPoolTx=T.qL;export const buildStellarApproveTokenTx=T.eX;export const buildStellarBatchSwapTx=T.z;export const buildStellarBorrowBatchTx=T.xD;export const buildStellarBorrowTx=T.jR;export const buildStellarCctpForwardTx=T.P2;export const buildStellarClaimRevenueTx=T.W6;export const buildStellarCreateLiquidityPoolTx=T.se;export const buildStellarExecuteCancellerResetTx=T.ZP;export const buildStellarExecuteStrategyTx=T.yr;export const buildStellarFlashLoanTx=T.sp;export const buildStellarGovernanceAddSpokeImmediateTx=T.Iu;export const buildStellarGovernanceCreateHubImmediateTx=T.yu;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=T.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=T.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=T.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=T.e_;export const buildStellarGovernanceExecuteTx=T.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=T.BA;export const buildStellarGovernancePauseTx=T.u9;export const buildStellarGovernanceRevokeRoleImmediateTx=T.bi;export const buildStellarGovernanceSetOracleSanityBoundsImmediateTx=T.gc;export const buildStellarGovernanceSetSpokeAssetFlagsImmediateTx=T.ay;export const buildStellarGrantRoleTx=T.SX;export const buildStellarLendingIdentifier=T.UF;export const buildStellarLiquidateTx=T.Y5;export const buildStellarMigrateFromBlendTx=T.mE;export const buildStellarMigrateTx=T.xG;export const buildStellarMultiplyTx=T.s9;export const buildStellarPauseTx=T.OL;export const buildStellarProposeAddAssetToSpokeTx=T.k6;export const buildStellarProposeAddSpokeTx=T.dj;export const buildStellarProposeApproveBlendPoolTx=T.kD;export const buildStellarProposeApproveTokenTx=T.Yf;export const buildStellarProposeCancellerResetTx=T.AI;export const buildStellarProposeConfigureAssetOracleTx=T.O2;export const buildStellarProposeConfigureMarketOracleTx=T.c5;export const buildStellarProposeCreateHubTx=T.N8;export const buildStellarProposeCreateLiquidityPoolTx=T.qU;export const buildStellarProposeDeployPoolTx=T.RZ;export const buildStellarProposeEditAssetInSpokeTx=T.ni;export const buildStellarProposeEditOracleToleranceTx=T.hF;export const buildStellarProposeGovernanceUpgradeTx=T.Qk;export const buildStellarProposeGrantGovernanceRoleTx=T.Gw;export const buildStellarProposeMigrateControllerTx=T.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=T.uj;export const buildStellarProposeRemoveSpokeTx=T.Od;export const buildStellarProposeRevokeBlendPoolTx=T.X7;export const buildStellarProposeRevokeGovernanceRoleTx=T.Ub;export const buildStellarProposeRevokeTokenTx=T.Dx;export const buildStellarProposeSetAccumulatorTx=T.OA;export const buildStellarProposeSetAggregatorTx=T.$U;export const buildStellarProposeSetMinBorrowCollatTx=T.ob;export const buildStellarProposeSetPositionLimitsTx=T.$l;export const buildStellarProposeSetPositionManagerTx=T.K;export const buildStellarProposeSetPriceAggregatorTx=T.Wb;export const buildStellarProposeSetSpokeLiquidationCurveTx=T.kw;export const buildStellarProposeSetSwapAggregatorTx=T.qA;export const buildStellarProposeTransferCtrlOwnershipTx=T.VS;export const buildStellarProposeTransferGovOwnTx=T.HP;export const buildStellarProposeUnpauseTx=T.xQ;export const buildStellarProposeUpdateDelayTx=T.YQ;export const buildStellarProposeUpgradeControllerTx=T.QY;export const buildStellarProposeUpgradePoolParamsTx=T.os;export const buildStellarProposeUpgradePoolTx=T.Ko;export const buildStellarRenewAccountTx=T.IJ;export const buildStellarRepayBatchTx=T.nw;export const buildStellarRepayDebtWithCollateralTx=T.Pr;export const buildStellarRepayTx=T.ZE;export const buildStellarRevokeBlendPoolTx=T.X0;export const buildStellarRevokeRoleTx=T.ev;export const buildStellarRevokeTokenTx=T.P8;export const buildStellarSetAccumulatorTx=T.aV;export const buildStellarSetAggregatorTx=T.p2;export const buildStellarSetMarketOracleConfigTx=T.sV;export const buildStellarSetOracleSanityBoundsTx=T.XD;export const buildStellarSetOracleToleranceTx=T.Js;export const buildStellarSetOracleTx=T.W5;export const buildStellarSetPositionLimitsTx=T.Dy;export const buildStellarSetPriceAggregatorTx=T._i;export const buildStellarSetSpokeAssetFlagsTx=T.FZ;export const buildStellarSetSwapAggregatorTx=T.wG;export const buildStellarSupplyBatchTx=T.Ni;export const buildStellarSupplyTx=T.v_;export const buildStellarSwapCollateralTx=T.qD;export const buildStellarSwapDebtTx=T.qR;export const buildStellarTransferOwnershipTx=T.QJ;export const buildStellarUnpauseTx=T.bm;export const buildStellarUpdateAccountThresholdTx=T.n_;export const buildStellarUpdateIndexesTx=T.v8;export const buildStellarUpgradeControllerTx=T.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=T.gH;export const buildStellarWithdrawBatchTx=T.O3;export const buildStellarWithdrawTx=T.Gz;export const buildTx=T.pr;export const decodeStellarLendingEvent=T.Fm;export const encodeAssetOracle=T.Ft;export const encodeInterestRateModel=T.MB;export const encodeMarketOracleConfigInput=T.Dn;export const encodeMarketParamsRaw=T.pq;export const encodePositionLimits=T.Q3;export const encodePriceKey=T.Jh;export const encodeStrategyPayloadToRouteXdr=T.wf;export const extractEventOrder=T.Um;export const getStellarAccountPositions=T.xO;export const getStellarAggregatorQuote=T.Lw;export const getStellarAggregatorRouter=T.KM;export const getStellarAsset=T.mM;export const getStellarAssetGraph=T.iE;export const getStellarAssetMarkets=T.zp;export const getStellarAssetPage=T.N3;export const getStellarAssets=T.bN;export const getStellarGovernance=T.QV;export const getStellarGovernanceProposals=T.T_;export const getStellarHub=T.XI;export const getStellarHubGraph=T.Lt;export const getStellarHubs=T.KK;export const getStellarLendingContext=T.yl;export const getStellarLendingController=T.vc;export const getStellarLendingLiveState=T.kq;export const getStellarQuoteTokens=T.CH;export const getStellarReserve=T.FI;export const getStellarReserveGraph=T.KG;export const getStellarReserveHolders=T.nW;export const getStellarReserves=T.jF;export const getStellarSpoke=T.S2;export const getStellarSpokeGraph=T.uS;export const getStellarSpokes=T.u_;export const getStellarUserActivity=T.O5;export const getStellarUserPositions=T.Av;export const mapQuoteResponseToAggregatorSwap=T.LA;export const mapQuoteResponseToStrategyPayload=T.E6;export const mapQuoteResponseToStrategySwap=T.Ds;export const mapSorobanError=T.XV;export const mapStellarPositionActivityType=T.CU;export const prepareStellarBuiltTx=T.Vx;export const prepareStellarTxXdr=T.DL;export const stellarLendingDispatchKey=T.ON;export const stellarLendingRead=T.Hh;export const syntheticEventOrder=T.oV;export const tagStellarInvokedContractError=T.g5;export const toBase64Xdr=T.L;export const toStellarPositionMode=T.Vu;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Cross-language wire-format check for the aggregator's packed strategy program.
3
+ *
4
+ * The same fixtures are asserted byte-for-byte in
5
+ * `contracts/swap-aggregator/tests/unit/payload_wire_format.rs` and
6
+ * `arb-algo/stellar-indexer/src/transaction/abi.rs`. If this file and those
7
+ * diverge, routes built by this SDK will be rejected on-chain.
8
+ */
9
+ export {};