@xoxno/sdk-js 1.0.193 → 1.0.197

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.cjs CHANGED
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>ot,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>_o,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>ko,XOXNO_LENDING_STELLAR_TICKER:()=>Po,buildSameTokenRepaySwapSteps:()=>Xo,buildStellarAcceptOwnershipTx:()=>Ne,buildStellarAddRewardsTx:()=>et,buildStellarApproveTokenTx:()=>ze,buildStellarBatchSwapTx:()=>Bo,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>Zo,buildStellarClaimRevenueTx:()=>Ye,buildStellarCreateLiquidityPoolTx:()=>Ke,buildStellarExecuteCancellerResetTx:()=>Zt,buildStellarExecuteStrategyTx:()=>No,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceAddSpokeImmediateTx:()=>eo,buildStellarGovernanceCreateHubImmediateTx:()=>Yt,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Vt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ft,buildStellarGovernanceExecuteTransferGovOwnTx:()=>jt,buildStellarGovernanceExecuteTx:()=>Wt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ht,buildStellarGovernancePauseTx:()=>oo,buildStellarGovernanceRevokeRoleImmediateTx:()=>to,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Jt,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Kt,buildStellarGrantRoleTx:()=>Ce,buildStellarLendingIdentifier:()=>Ro,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>F,buildStellarMigrateTx:()=>Oe,buildStellarMultiplyTx:()=>j,buildStellarPauseTx:()=>Me,buildStellarProposeAddAssetToSpokeTx:()=>mt,buildStellarProposeAddSpokeTx:()=>gt,buildStellarProposeApproveBlendPoolTx:()=>wt,buildStellarProposeApproveTokenTx:()=>At,buildStellarProposeCancellerResetTx:()=>Qt,buildStellarProposeConfigureMarketOracleTx:()=>Ct,buildStellarProposeCreateHubTx:()=>bt,buildStellarProposeCreateLiquidityPoolTx:()=>kt,buildStellarProposeDeployPoolTx:()=>Et,buildStellarProposeEditAssetInSpokeTx:()=>ft,buildStellarProposeEditOracleToleranceTx:()=>Ut,buildStellarProposeGovernanceUpgradeTx:()=>Gt,buildStellarProposeGrantGovernanceRoleTx:()=>Bt,buildStellarProposeMigrateControllerTx:()=>Mt,buildStellarProposeRemoveAssetFromSpokeTx:()=>ht,buildStellarProposeRemoveSpokeTx:()=>Tt,buildStellarProposeRevokeBlendPoolTx:()=>Pt,buildStellarProposeRevokeGovernanceRoleTx:()=>Dt,buildStellarProposeRevokeTokenTx:()=>_t,buildStellarProposeSetAccumulatorTx:()=>ct,buildStellarProposeSetAggregatorTx:()=>dt,buildStellarProposeSetMinBorrowCollatTx:()=>qt,buildStellarProposeSetPoolTemplateTx:()=>St,buildStellarProposeSetPositionLimitsTx:()=>yt,buildStellarProposeSetPositionManagerTx:()=>xt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>vt,buildStellarProposeTransferCtrlOwnershipTx:()=>Lt,buildStellarProposeTransferGovOwnTx:()=>$t,buildStellarProposeUnpauseTx:()=>ro,buildStellarProposeUpdateDelayTx:()=>Nt,buildStellarProposeUpgradeControllerTx:()=>Ot,buildStellarProposeUpgradePoolParamsTx:()=>Rt,buildStellarProposeUpgradePoolTx:()=>It,buildStellarRenewAccountTx:()=>Ze,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>Z,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ue,buildStellarRevokeTokenTx:()=>He,buildStellarSetAccumulatorTx:()=>De,buildStellarSetAggregatorTx:()=>Be,buildStellarSetLiquidityPoolTemplateTx:()=>$e,buildStellarSetMarketOracleConfigTx:()=>Ve,buildStellarSetOracleSanityBoundsTx:()=>Xe,buildStellarSetOracleToleranceTx:()=>Fe,buildStellarSetPositionLimitsTx:()=>We,buildStellarSetSpokeAssetFlagsTx:()=>je,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ge,buildStellarUnpauseTx:()=>Le,buildStellarUpdateAccountThresholdTx:()=>tt,buildStellarUpdateIndexesTx:()=>Qe,buildStellarUpgradeControllerTx:()=>Ie,buildStellarUpgradeLiquidityPoolParamsTx:()=>Je,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>wo,encodeInterestRateModel:()=>Ae,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>_e,encodeOracleSourceConfigInput:()=>Re,encodePositionLimits:()=>we,encodeStrategyPayloadToRouteXdr:()=>Go,extractEventOrder:()=>Eo,getStellarAccountPositions:()=>be,getStellarAggregatorQuote:()=>Co,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>pe,getStellarAssetPage:()=>se,getStellarAssets:()=>oe,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ge,getStellarHub:()=>de,getStellarHubGraph:()=>me,getStellarHubs:()=>re,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>Uo,getStellarReserve:()=>ae,getStellarReserveGraph:()=>he,getStellarReserveHolders:()=>ie,getStellarReserves:()=>ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>fe,getStellarSpokes:()=>ne,getStellarUserActivity:()=>ye,getStellarUserPositions:()=>Se,mapQuoteResponseToAggregatorSwap:()=>Wo,mapQuoteResponseToStrategyPayload:()=>Do,mapQuoteResponseToStrategySwap:()=>$o,mapSorobanError:()=>Jo,mapStellarPositionActivityType:()=>Oo,prepareStellarBuiltTx:()=>Fo,prepareStellarTxXdr:()=>Vo,stellarLendingDispatchKey:()=>ao,stellarLendingRead:()=>ve,syntheticEventOrder:()=>Io,tagStellarInvokedContractError:()=>Ho,toBase64Xdr:()=>no,toStellarPositionMode:()=>jo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={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"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],y=e=>new c.Address(e).toScVal(),b=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),m=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>k({asset:y(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([_(e,t),b(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:b(e.amountOut),pool:y(e.pool),token_in:y(e.tokenIn),token_out:y(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in:y(e.tokenIn),token_out:y(e.tokenOut),total_min_out:b(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},I=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).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(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"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},M=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return 0===e.length?I():E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):0===e.bytes.length?I():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.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[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!S.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` 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 t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,o){const r=e.controllerAddress??s(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[y(e.caller),T(o),g(r),P([...t.assets])])}function G(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return C(e,"borrow",[y(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,y)])}function B(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return C(e,"withdraw",[y(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,y)])}function $(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[y(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[y(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[y(e.caller),_(t.hubId,t.asset),b(t.amount),y(t.receiver),L(t.data)])}function F(e,t){return C(e,"migrate_from_blend",[y(e.caller),T(t.accountId),g(t.spokeId),g(t.hubId),y(t.blendPool),x(t.collateralTokens.map(y)),x(t.supplyTokens.map(y)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,c.xdr.ScVal.scvVec([y(t),b(o)]);var t,o}))))]);var o}function j(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"multiply",[y(e.caller),T(o),g(r),_(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),_(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[y(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[y(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Z(e,t){return C(e,"repay_debt_with_collateral",[y(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const K="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/live-state`,t),oe=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),ue=(e,t={},o)=>{const{hubId:r,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${K}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ae=(e,t,o,r,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}`,n),ie=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/holders`,{...u,params:{side:n}}),le=(e,t,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,o),se=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...r,params:{...o}}),pe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...r,params:{side:o}}),de=(e,t,o)=>e.fetchWithTimeout(`${K}/hubs/${t}`,o),ce=(e,t,o)=>e.fetchWithTimeout(`${K}/spokes/${t}`,o),Se=(e,t,o)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,o),ye=(e,t,o={},r)=>{const{skip:n,top:u}=o;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},be=(e,t,o)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,o),ge=(e,t={},o)=>{const{top:r=J,continuationToken:n}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},Te=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...r,params:{...o}}),me=(e,t,o,r)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...r,params:{...o}}),he=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/graph`,{...u,params:{...n}}),ve=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>oe(e,t),hubs:t=>re(e,t),spokes:t=>ne(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ue(e,t,o):ue(e,{},t);var r},reserve:(t,o,r,n)=>ae(e,t,o,r,n),reserveHolders:(t,o,r,n,u)=>ie(e,t,o,r,n,u),asset:(t,o)=>le(e,t,o),assetMarkets:(t,o,r)=>pe(e,t,o,r),hub:(t,o)=>de(e,t,o),spoke:(t,o)=>ce(e,t,o),userPositions:(t,o)=>Se(e,t,o),userActivity:(t,o,r)=>ye(e,t,o,r),accountPositions:(t,o)=>be(e,t,o),governanceProposals:(t,o)=>ge(e,t,o),assetGraph:(t,o,r)=>Te(e,t,o,r),hubGraph:(t,o,r)=>me(e,t,o,r),spokeGraph:(t,o,r)=>fe(e,t,o,r),reserveGraph:(t,o,r,n,u)=>he(e,t,o,r,n,u)}),xe={Single:0,PrimaryWithAnchor:1},qe="RedStonePriceFeed",Ae=e=>k({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),_e=e=>k({asset_decimals:g(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),we=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Pe=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),y(e.value)]);case"Symbol":return x([h("Symbol"),h(e.value)]);case"String":return x([h("String"),f(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},ke=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return x([h("Twap"),g(t)])}return x([h("Spot")])},Re=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([h("Reflector"),k({asset:Pe(e.asset),contract:y(e.contract),read_mode:ke(e.readMode,e.twapRecords)})])}if(t===qe||"XoxnoPriceFeed"===t){const o=t===qe?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${o} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${o} oracle source requires \`maxStaleSeconds\``);return x([h(o),k({contract:y(e.contract),feed_id:f(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=xe[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return k({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),Re(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Re(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ie(e,t){return C(e,"upgrade",[q(t.wasmHash)])}function Oe(e,t){return C(e,"migrate",[g(t.newVersion)])}function Me(e){return C(e,"pause",[])}function Le(e){return C(e,"unpause",[])}function Ce(e,t){return C(e,"grant_role",[y(t.account),h(t.role)])}function Ue(e,t){return C(e,"revoke_role",[y(t.account),h(t.role)])}function Ge(e,t){return C(e,"transfer_ownership",[y(t.newOwner),g(t.liveUntilLedger)])}function Ne(e){return C(e,"accept_ownership",[])}function Be(e,t){return C(e,"set_aggregator",[y(t.aggregator)])}function De(e,t){return C(e,"set_accumulator",[y(t.accumulator)])}function $e(e,t){return C(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function We(e,t){return C(e,"set_position_limits",[we(t)])}function ze(e,t){return C(e,"approve_token",[y(t.token)])}function He(e,t){return C(e,"revoke_token",[y(t.token)])}function Ve(e,t){return C(e,"set_market_oracle_config",[_(t.hubId,t.asset),Ee(t.config)])}function Fe(e,t){return C(e,"set_oracle_tolerance",[y(t.asset),k({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function je(e,t){return C(e,"set_spoke_asset_flags",[g(t.spokeId),_(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function Xe(e,t){return C(e,"set_oracle_sanity_bounds",[y(t.asset),b(t.minPriceWad),b(t.maxPriceWad)])}function Qe(e,t){return C(e,"update_indexes",[y(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return C(e,"renew_account",[y(e.caller),T(t.accountNonce)])}function Ke(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),y(t.asset),_e(t.params)])}function Je(e,t){return C(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),Ae(t.params)])}function Ye(e,t){return C(e,"claim_revenue",[y(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function et(e,t){return C(e,"add_rewards",[y(e.caller),P(t.rewards)])}function tt(e,t){return C(e,"update_account_threshold",[y(e.caller),m(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const ot="00".repeat(32),rt=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},nt=(e,...t)=>x([h(e),...t]),ut=e=>k({new_owner:y(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),at=e=>k({asset:y(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:g(e.hubId),paused:m(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),it=e=>k({account:y(e.account),role:h(e.role)});function lt(e,t,o){const r=e.governanceAddress??d(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const st=(e,t,o)=>lt(e,"propose",[y(e.caller),t,rt(o)]),pt=(e,t,o)=>lt(e,"execute_self",[v(),t,rt(o)]);function dt(e,t,o){return st(e,nt("SetAggregator",y(t.aggregator)),o)}function ct(e,t,o){return st(e,nt("SetAccumulator",y(t.accumulator)),o)}function St(e,t,o){return st(e,nt("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function yt(e,t,o){return st(e,nt("SetPositionLimits",we(t)),o)}function bt(e,t){return st(e,nt("CreateHub"),t)}function gt(e,t){return st(e,nt("AddSpoke"),t)}function Tt(e,t,o){return st(e,nt("RemoveSpoke",g(t.spokeId)),o)}function mt(e,t,o){return st(e,nt("AddAssetToSpoke",at(t)),o)}function ft(e,t,o){return st(e,nt("EditAssetInSpoke",at(t)),o)}function ht(e,t,o){return st(e,nt("RemoveAssetFromSpoke",k({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function vt(e,t,o){return st(e,nt("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:b((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(r.liquidationBonusFactorBps),spoke_id:g(r.spokeId),target_hf_wad:b(r.targetHfWad)})),o);var r}function xt(e,t,o){return st(e,nt("SetPositionManager",y(t.manager),m(t.isActive)),o)}function qt(e,t,o){return st(e,nt("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function At(e,t,o){return st(e,nt("ApproveToken",y(t.token)),o)}function _t(e,t,o){return st(e,nt("RevokeToken",y(t.token)),o)}function wt(e,t,o){return st(e,nt("ApproveBlendPool",y(t.pool)),o)}function Pt(e,t,o){return st(e,nt("RevokeBlendPool",y(t.pool)),o)}function kt(e,t,o){return st(e,nt("CreateLiquidityPool",k({asset:y((r=t).asset),hub_id:g(r.hubId),params:_e(r.params)})),o);var r}function Rt(e,t,o){return st(e,nt("UpgradeLiquidityPoolParams",k({hub_asset:_((r=t).hubId,r.asset),params:Ae(r.params)})),o);var r}function Et(e,t){return st(e,nt("DeployPool"),t)}function It(e,t,o){return st(e,nt("UpgradePool",q(t.wasmHash)),o)}function Ot(e,t,o){return st(e,nt("UpgradeController",q(t.wasmHash)),o)}function Mt(e,t,o){return st(e,nt("MigrateController",g(t.newVersion)),o)}function Lt(e,t,o){return st(e,nt("TransferCtrlOwnership",ut(t)),o)}function Ct(e,t,o){return st(e,nt("ConfigureMarketOracle",k({cfg:Ee((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function Ut(e,t,o){return st(e,nt("EditOracleTolerance",k({asset:y((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Gt(e,t,o){return st(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Nt(e,t,o){return st(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Bt(e,t,o){return st(e,nt("GrantGovRole",it(t)),o)}function Dt(e,t,o){return st(e,nt("RevokeGovRole",it(t)),o)}function $t(e,t,o){return st(e,nt("TransferGovOwnership",ut(t)),o)}function Wt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=rt(t.predecessor??ot);return lt(e,"execute",[v(),y(t.target),h(t.functionName),o,r,rt(t.salt)])}function zt(e,t,o){return pt(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Ht(e,t,o){return pt(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Vt(e,t,o){return pt(e,nt("GrantGovRole",it(t)),o)}function Ft(e,t,o){return pt(e,nt("RevokeGovRole",it(t)),o)}function jt(e,t,o){return pt(e,nt("TransferGovOwnership",ut(t)),o)}const Xt=e=>x(e.map(y));function Qt(e,t,o){return lt(e,"propose_canceller_reset",[Xt(t.newCancellers),rt(o)])}function Zt(e,t,o){return lt(e,"execute_canceller_reset",[A(t.executor,y),Xt(t.newCancellers),rt(o)])}function Kt(e,t){return lt(e,"set_spoke_asset_flags",[y(e.caller),g(t.spokeId),_(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function Jt(e,t){return lt(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),b(t.minPriceWad),b(t.maxPriceWad)])}function Yt(e){return lt(e,"create_hub",[y(e.caller)])}function eo(e){return lt(e,"add_spoke",[y(e.caller)])}function to(e,t){return lt(e,"revoke_role_immediate",[y(t.account),h(t.role)])}function oo(e){return lt(e,"pause",[y(e.caller)])}function ro(e,t){return st(e,nt("Unpause"),t)}const no=e=>e.toXDR("base64"),uo=e=>c.xdr.ScVal.fromXDR(e,"base64"),ao=e=>e.map((e=>String((0,c.scValToNative)(uo(e))))).join(":"),io=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),lo=e=>Number(e),so=e=>String(e),po=e=>null==e?void 0:io(e),co=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),So=["None","Multiply","Long","Short"],yo=["Single","PrimaryWithAnchor"],bo=["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"],go=e=>Array.isArray(e)?e:[],To=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],bo[lo(r)]??io(r)),positionType:t,hubId:lo(e[1]),asset:so(e[2]),scaledAmountRay:io(e[3]),indexRay:io(e[4]),amount:io(e[5]),liquidationThresholdBps:o?void 0:lo(e[6]),liquidationBonusBps:o?void 0:lo(e[7]),loanToValueBps:o?void 0:lo(e[8]),liquidationFeesBps:o?void 0:lo(e[9])};var r},mo=e=>{return{owner:so(e[0]),spokeId:lo(e[1]),mode:(t=e[2],So[lo(t)]??"None")};var t},fo=e=>Array.isArray(e)?so(e[0]):so(e),ho=e=>Array.isArray(e)?e[1]:void 0,vo={Reflector:"ReflectorSep40",RedStone:"RedStonePriceFeed",Xoxno:"XoxnoPriceFeed"},xo=(e,t)=>{const o=fo(e),r=ho(e)??{};if("Reflector"!==o)return{source:{provider:vo[o]??"RedStonePriceFeed",contractAddress:so(r.contract),asset:void 0,feedId:so(r.feed_id),readMode:"Spot",twapRecords:void 0,decimals:lo(r.decimals),resolutionSeconds:0,maxStaleSeconds:lo(r.max_stale_seconds)},quoteToken:void 0};const n=fo(r.read_mode),u=fo(r.asset);return{source:{provider:"ReflectorSep40",contractAddress:so(r.contract),asset:"Stellar"===u||"Symbol"===u?{kind:u,value:so(ho(r.asset))}:void 0,feedId:"String"===u?so(ho(r.asset)):void 0,readMode:n,twapRecords:"Twap"===n?lo(ho(r.read_mode)):void 0,decimals:lo(r.decimals),resolutionSeconds:lo(r.resolution_seconds),maxStaleSeconds:t},quoteToken:"Quoted"===fo(r.base)?so(ho(r.base)):void 0}},qo=(e,t)=>{const o=t.tolerance??{},r=lo(t.max_price_stale_seconds),n=xo(t.primary,r),u="Some"===fo(t.anchor)?ho(t.anchor):void 0,a=u?xo(u,r):void 0;return{baseTokenId:e,quoteTokenId:"USD",tolerance:{upperRatio:lo(o.upper_ratio_bps),lowerRatio:lo(o.lower_ratio_bps)},assetDecimals:lo(t.asset_decimals),maxPriceStaleSeconds:r,strategy:yo[lo(t.strategy)]??"Single",primary:n.source,anchor:a?.source,primaryQuoteToken:n.quoteToken,anchorQuoteToken:a?.quoteToken,minSanityPriceWad:po(t.min_sanity_price_wad),maxSanityPriceWad:po(t.max_sanity_price_wad)}},Ao={"market:create":e=>({topic:"market:create",data:{hubId:lo(e.hub_id),baseAsset:so(e.base_asset),maxBorrowRate:io(e.max_borrow_rate),baseBorrowRate:io(e.base_borrow_rate),slope1:io(e.slope1),slope2:io(e.slope2),slope3:io(e.slope3),midUtilization:io(e.mid_utilization),optimalUtilization:io(e.optimal_utilization),maxUtilization:io(e.max_utilization),reserveFactor:lo(e.reserve_factor),marketAddress:so(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:so(e.asset),maxBorrowRateRay:io(e.max_borrow_rate),baseBorrowRateRay:io(e.base_borrow_rate),slope1Ray:io(e.slope1),slope2Ray:io(e.slope2),slope3Ray:io(e.slope3),midUtilizationRay:io(e.mid_utilization),optimalUtilizationRay:io(e.optimal_utilization),maxUtilizationRay:io(e.max_utilization),reserveFactorBps:lo(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:go(e).map((e=>{return t=go(e),{hubId:lo(t[0]),asset:so(t[1]),timestamp:lo(t[2]),supplyIndexRay:io(t[3]),borrowIndexRay:io(t[4]),cash:io(t[5]),suppliedRay:io(t[6]),borrowedRay:io(t[7]),revenueRay:io(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:go(e).map((e=>{const t=e;return{hubId:lo(t.hub_id),asset:so(t.asset),params:(o=t.params,{maxBorrowRateRay:io(o.max_borrow_rate),baseBorrowRateRay:io(o.base_borrow_rate),slope1Ray:io(o.slope1),slope2Ray:io(o.slope2),slope3Ray:io(o.slope3),midUtilizationRay:io(o.mid_utilization),optimalUtilizationRay:io(o.optimal_utilization),maxUtilizationRay:io(o.max_utilization),reserveFactorBps:lo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:lo(o.flashloan_fee),assetId:so(o.asset_id),assetDecimals:lo(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=go(e);return{topic:"position:batch_update",data:{accountId:io(t[0]),accountAttributes:mo(go(t[1])),updates:[...go(t[2]).map((e=>To(go(e),"Deposit"))),...go(t[3]).map((e=>To(go(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:lo(e.hub_id),asset:so(e.asset),receiver:so(e.receiver),caller:so(e.caller),amount:io(e.amount),fee:io(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:so(e.asset),oracle:qo(so(e.asset),e.config)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:so(e.liquidator),accountId:io(e.account_id),repaidUsdWad:io(e.repaid_usd_wad),bonusBps:io(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:io(e.account_id),totalBorrowUsdWad:io(e.total_borrow_usd_wad),totalCollateralUsdWad:io(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:so(e.token),amount:io(e.amount),usdValueWad:io(e.usd_value_wad),accountId:io(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:lo(e.hub_id),asset:so(e.asset),amount:io(e.amount),fee:io(e.fee),amountSent:io(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:co(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:so(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:so(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:co(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:lo(e.max_supply_positions),maxBorrowPositions:lo(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:so(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:lo(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:io(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:io(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:lo(t.liquidation_bonus_factor_bps)}}}},_o=Object.freeze(Object.keys(Ao));function wo(e,t){const o=ao(e),r=Ao[o];return r?r((0,c.scValToNative)(uo(t))):null}const Po="XLENDXLM-a7c9f3",ko=1e4;function Ro(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${Po}-${o}`}function Eo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Io(e,t=0){return e*ko+t}function Oo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Mo=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},Lo=e=>e.baseUrl??i[e.network];async function Co(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Mo(Lo(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),r=await fetch(o,t.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${e}`)}return await r.json()}async function Uo(e){const t=Mo(Lo(e),"api/v1/tokens"),o=await fetch(t,e.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${t} — ${e}`)}return await o.json()}const Go=e=>R(e).toXDR("base64");function No(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",y(e.caller),b(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Bo(e,t){return No(e,t)}function Do(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(zo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(zo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function $o(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Do(e,t)}const Wo=Do,zo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Ho(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Vo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Ho(o.invokedContractId,e);throw e}}async function Fo(e,t,o){return Vo(e,t.xdr,o)}function jo(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Xo(e,t){return new Uint8Array(0)}const Qo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function Zo(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(Qo(e.message)),c.xdr.ScVal.scvBytes(Qo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ko={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:"InvalidPoolTemplate",message:"The liquidity pool template hash is 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 Jo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Ko[o];return r?{code:o,...r}:null}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>T.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>T.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>T.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>T.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>T.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>T.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>T.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>T.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>T.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>T.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>T.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>T.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>T.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>T.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>T.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>T.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>T.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>T.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>T.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>T.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>T.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>T.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>T.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>T.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>T.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>T.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>T.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>T.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>T.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>T.buildStellarMigrateTx,buildStellarMultiplyTx:()=>T.buildStellarMultiplyTx,buildStellarPauseTx:()=>T.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>T.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>T.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>T.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>T.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>T.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>T.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>T.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>T.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>T.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>T.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>T.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSetSpokeAssetFlagsTx:()=>T.buildStellarSetSpokeAssetFlagsTx,buildStellarSupplyBatchTx:()=>T.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>T.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>T.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>T.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>T.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>T.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>T.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>T.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>T.encodeOracleSourceConfigInput,encodePositionLimits:()=>T.encodePositionLimits,encodeStrategyPayloadToRouteXdr:()=>T.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>T.extractEventOrder,getStellarAccountPositions:()=>T.getStellarAccountPositions,getStellarAggregatorQuote:()=>T.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>T.getStellarAggregatorRouter,getStellarAsset:()=>T.getStellarAsset,getStellarAssetGraph:()=>T.getStellarAssetGraph,getStellarAssetMarkets:()=>T.getStellarAssetMarkets,getStellarAssetPage:()=>T.getStellarAssetPage,getStellarAssets:()=>T.getStellarAssets,getStellarGovernance:()=>T.getStellarGovernance,getStellarGovernanceProposals:()=>T.getStellarGovernanceProposals,getStellarHub:()=>T.getStellarHub,getStellarHubGraph:()=>T.getStellarHubGraph,getStellarHubs:()=>T.getStellarHubs,getStellarLendingContext:()=>T.getStellarLendingContext,getStellarLendingController:()=>T.getStellarLendingController,getStellarLendingLiveState:()=>T.getStellarLendingLiveState,getStellarQuoteTokens:()=>T.getStellarQuoteTokens,getStellarReserve:()=>T.getStellarReserve,getStellarReserveGraph:()=>T.getStellarReserveGraph,getStellarReserveHolders:()=>T.getStellarReserveHolders,getStellarReserves:()=>T.getStellarReserves,getStellarSpoke:()=>T.getStellarSpoke,getStellarSpokeGraph:()=>T.getStellarSpokeGraph,getStellarSpokes:()=>T.getStellarSpokes,getStellarUserActivity:()=>T.getStellarUserActivity,getStellarUserPositions:()=>T.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>T.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>T.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>T.mapQuoteResponseToStrategySwap,mapSorobanError:()=>T.mapSorobanError,mapStellarPositionActivityType:()=>T.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>T.prepareStellarBuiltTx,prepareStellarTxXdr:()=>T.prepareStellarTxXdr,stellarLendingDispatchKey:()=>T.stellarLendingDispatchKey,stellarLendingRead:()=>T.stellarLendingRead,syntheticEventOrder:()=>T.syntheticEventOrder,tagStellarInvokedContractError:()=>T.tagStellarInvokedContractError,toBase64Xdr:()=>T.toBase64Xdr,toStellarPositionMode:()=>T.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...o}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,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:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,S=p?.Authorization,y="Bearer undefined"===S?void 0:S,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...y?{Authorization:y}:{}},g=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),T=`${this.apiUrl}${e}${g.length?`?${g}`:""}`,{revalidate:m,...f}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||y?void 0:h??m,q="GET"!==d||y||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const y=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),b={"/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:{}},"/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/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:{}}}},g=["PATCH","POST","DELETE","PUT"];var T=o(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...o,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!y(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...m,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:T,params:q,body:b,headers:_,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,o]of Object.entries(b)){const r=t.split("/").filter(Boolean);let n=e;for(const e of r)if(e.startsWith(":")){const t=m(e.slice(1));n=n.params[t]||=f()}else{const t=m(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:o,def:n}=t.leaves[0];i=h(o,n,r,e)}else{i={};for(const{rawPath:o,def:n}of t.leaves)i[m(o.split("/").pop().replace(/^:/,""))]=h(o,n,r,e)}for(const[e,n]of Object.entries(t.static)){const t=o(n,r);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=o(n,{...r,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],o=(...e)=>t(...e);return Object.assign(o,t)}return u};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,r){r.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>pt,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>Er,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Mr,XOXNO_LENDING_STELLAR_TICKER:()=>Ir,buildSameTokenRepaySwapSteps:()=>Yr,buildStellarAcceptOwnershipTx:()=>We,buildStellarAddRewardsTx:()=>lt,buildStellarApproveBlendPoolTx:()=>Xe,buildStellarApproveTokenTx:()=>Ke,buildStellarBatchSwapTx:()=>Hr,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>to,buildStellarClaimRevenueTx:()=>it,buildStellarCreateLiquidityPoolTx:()=>ut,buildStellarExecuteCancellerResetTx:()=>ar,buildStellarExecuteStrategyTx:()=>zr,buildStellarFlashLoanTx:()=>F,buildStellarGovernanceAddSpokeImmediateTx:()=>pr,buildStellarGovernanceCreateHubImmediateTx:()=>sr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Yt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>tr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>rr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>or,buildStellarGovernanceExecuteTx:()=>Jt,buildStellarGovernanceExecuteUpdateDelayTx:()=>er,buildStellarGovernancePauseTx:()=>cr,buildStellarGovernanceRevokeRoleImmediateTx:()=>dr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>lr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>ir,buildStellarGrantRoleTx:()=>Be,buildStellarLendingIdentifier:()=>Lr,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Ue,buildStellarMultiplyTx:()=>V,buildStellarPauseTx:()=>Ge,buildStellarProposeAddAssetToSpokeTx:()=>Pt,buildStellarProposeAddSpokeTx:()=>qt,buildStellarProposeApproveBlendPoolTx:()=>Ct,buildStellarProposeApproveTokenTx:()=>Mt,buildStellarProposeCancellerResetTx:()=>ur,buildStellarProposeConfigureAssetOracleTx:()=>Ht,buildStellarProposeConfigureMarketOracleTx:()=>Ft,buildStellarProposeCreateHubTx:()=>_t,buildStellarProposeCreateLiquidityPoolTx:()=>Gt,buildStellarProposeDeployPoolTx:()=>Bt,buildStellarProposeEditAssetInSpokeTx:()=>kt,buildStellarProposeEditOracleToleranceTx:()=>jt,buildStellarProposeGovernanceUpgradeTx:()=>Vt,buildStellarProposeGrantGovernanceRoleTx:()=>Qt,buildStellarProposeMigrateControllerTx:()=>Wt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Rt,buildStellarProposeRemoveSpokeTx:()=>wt,buildStellarProposeRevokeBlendPoolTx:()=>Ut,buildStellarProposeRevokeGovernanceRoleTx:()=>Kt,buildStellarProposeRevokeTokenTx:()=>Lt,buildStellarProposeSetAccumulatorTx:()=>xt,buildStellarProposeSetAggregatorTx:()=>vt,buildStellarProposeSetMinBorrowCollatTx:()=>It,buildStellarProposeSetPositionLimitsTx:()=>At,buildStellarProposeSetPositionManagerTx:()=>Ot,buildStellarProposeSetPriceAggregatorTx:()=>ht,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Et,buildStellarProposeSetSwapAggregatorTx:()=>ft,buildStellarProposeTransferCtrlOwnershipTx:()=>zt,buildStellarProposeTransferGovOwnTx:()=>Zt,buildStellarProposeUnpauseTx:()=>Sr,buildStellarProposeUpdateDelayTx:()=>Xt,buildStellarProposeUpgradeControllerTx:()=>$t,buildStellarProposeUpgradePoolParamsTx:()=>Nt,buildStellarProposeUpgradePoolTx:()=>Dt,buildStellarRenewAccountTx:()=>nt,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>K,buildStellarRepayTx:()=>z,buildStellarRevokeBlendPoolTx:()=>Qe,buildStellarRevokeRoleTx:()=>De,buildStellarRevokeTokenTx:()=>Ze,buildStellarSetAccumulatorTx:()=>je,buildStellarSetAggregatorTx:()=>Fe,buildStellarSetMarketOracleConfigTx:()=>Ye,buildStellarSetOracleSanityBoundsTx:()=>rt,buildStellarSetOracleToleranceTx:()=>et,buildStellarSetOracleTx:()=>Je,buildStellarSetPositionLimitsTx:()=>Ve,buildStellarSetPriceAggregatorTx:()=>He,buildStellarSetSpokeAssetFlagsTx:()=>tt,buildStellarSetSwapAggregatorTx:()=>ze,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>$e,buildStellarUnpauseTx:()=>Ne,buildStellarUpdateAccountThresholdTx:()=>st,buildStellarUpdateIndexesTx:()=>ot,buildStellarUpgradeControllerTx:()=>Ce,buildStellarUpgradeLiquidityPoolParamsTx:()=>at,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>Or,encodeAssetOracle:()=>Me,encodeInterestRateModel:()=>xe,encodeMarketOracleConfigInput:()=>Le,encodeMarketParamsRaw:()=>Ae,encodePositionLimits:()=>_e,encodePriceKey:()=>qe,encodeStrategyPayloadToRouteXdr:()=>Wr,extractEventOrder:()=>Cr,getStellarAccountPositions:()=>ye,getStellarAggregatorQuote:()=>Dr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>pe,getStellarAssetPage:()=>se,getStellarAssets:()=>re,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ge,getStellarHub:()=>de,getStellarHubGraph:()=>me,getStellarHubs:()=>oe,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>$r,getStellarReserve:()=>ae,getStellarReserveGraph:()=>he,getStellarReserveHolders:()=>ie,getStellarReserves:()=>ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>fe,getStellarSpokes:()=>ne,getStellarUserActivity:()=>be,getStellarUserPositions:()=>Se,mapQuoteResponseToAggregatorSwap:()=>Vr,mapQuoteResponseToStrategyPayload:()=>Fr,mapQuoteResponseToStrategySwap:()=>jr,mapSorobanError:()=>oo,mapStellarPositionActivityType:()=>Gr,prepareStellarBuiltTx:()=>Zr,prepareStellarTxXdr:()=>Kr,stellarLendingDispatchKey:()=>gr,stellarLendingRead:()=>ve,syntheticEventOrder:()=>Ur,tagStellarInvokedContractError:()=>Qr,toBase64Xdr:()=>br,toStellarPositionMode:()=>Jr});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={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"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new c.Address(e).toScVal(),y=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),m=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),A=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(o)},_=(e,t)=>null==e?v():t(e),q=(e,t)=>k({asset:b(t),hub_id:g(e)}),w=(e,t,r)=>c.xdr.ScVal.scvVec([q(e,t),y(r)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:y(e.amountOut),pool:b(e.pool),token_in:b(e.tokenIn),token_out:b(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in:b(e.tokenIn),token_out:b(e.tokenOut),total_min_out:y(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},O=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),I=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},M=e=>{if("string"==typeof e)return E(I(e));if(e instanceof Uint8Array)return 0===e.length?O():E(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?E(I(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(I(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(I(e.bytes)):0===e.bytes.length?O():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,r){const o=e.controllerAddress??s(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return C(e,"supply",[b(e.caller),T(r),g(o),P([...t.assets])])}function G(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return C(e,"borrow",[b(e.caller),T(t.accountNonce),P([...t.borrows]),_(t.to,b)])}function B(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return C(e,"withdraw",[b(e.caller),T(t.accountNonce),P([...t.withdrawals]),_(t.to,b)])}function $(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[b(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[b(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function F(e,t){return C(e,"flash_loan",[b(e.caller),q(t.hubId,t.asset),y(t.amount),b(t.receiver),L(t.data)])}function j(e,t){return C(e,"migrate_from_blend",[b(e.caller),T(t.accountId),g(t.spokeId),g(t.hubId),b(t.blendPool),x(t.collateralTokens.map(b)),x(t.supplyTokens.map(b)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,c.xdr.ScVal.scvVec([b(t),y(r)]);var t,r}))))]);var r}function V(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return C(e,"multiply",[b(e.caller),T(r),g(o),q(t.collateral.hubId,t.collateral.asset),y(t.debtToFlashLoan),q(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),_(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),_(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[b(e.caller),T(t.accountNonce),q(t.existingDebt.hubId,t.existingDebt.asset),y(t.newDebtAmount),q(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[b(e.caller),T(t.accountNonce),q(t.current.hubId,t.current.asset),y(t.fromAmount),q(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function K(e,t){return C(e,"repay_debt_with_collateral",[b(e.caller),T(t.accountNonce),q(t.collateral.hubId,t.collateral.asset),y(t.collateralAmount),q(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const Z="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/live-state`,t),re=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),ue=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ae=(e,t,r,o,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}`,n),ie=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}/holders`,{...u,params:{side:n}}),le=(e,t,r)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}`,r),se=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/page`,{...o,params:{...r}}),pe=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/markets`,{...o,params:{side:r}}),de=(e,t,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,r),Se=(e,t,r)=>e.fetchWithTimeout(`${Z}/users/${Y(t)}/positions`,r),be=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${Z}/users/${Y(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},ye=(e,t,r)=>e.fetchWithTimeout(`${Z}/accounts/${Y(t)}/positions`,r),ge=(e,t={},r)=>{const{top:o=J,continuationToken:n}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},Te=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/assets/${Y(t)}/graph`,{...o,params:{...r}}),me=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...o,params:{...r}}),fe=(e,t,r,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...o,params:{...r}}),he=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${r}/${Y(o)}/graph`,{...u,params:{...n}}),ve=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>re(e,t),hubs:t=>oe(e,t),spokes:t=>ne(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ue(e,t,r):ue(e,{},t);var o},reserve:(t,r,o,n)=>ae(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>ie(e,t,r,o,n,u),asset:(t,r)=>le(e,t,r),assetMarkets:(t,r,o)=>pe(e,t,r,o),hub:(t,r)=>de(e,t,r),spoke:(t,r)=>ce(e,t,r),userPositions:(t,r)=>Se(e,t,r),userActivity:(t,r,o)=>be(e,t,r,o),accountPositions:(t,r)=>ye(e,t,r),governanceProposals:(t,r)=>ge(e,t,r),assetGraph:(t,r,o)=>Te(e,t,r,o),hubGraph:(t,r,o)=>me(e,t,r,o),spokeGraph:(t,r,o)=>fe(e,t,r,o),reserveGraph:(t,r,o,n,u)=>he(e,t,r,o,n,u)}),xe=e=>k({base_borrow_rate:y(e.baseBorrowRateRay),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),Ae=e=>k({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate:y(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),_e=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),qe=e=>{if("Token"in e&&e.Token)return x([h("Token"),b(e.Token)]);if("Ref"in e&&e.Ref)return x([h("Ref"),h(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},we=e=>{if("Stellar"in e)return x([h("Stellar"),b(e.Stellar)]);if("Symbol"in e)return x([h("Symbol"),h(e.Symbol)]);if("String"in e)return x([h("String"),f(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Pe=e=>{if("Spot"===e)return x([h("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return x([h("Twap"),g(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},ke=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return x([h(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Re=e=>{if("Market"===e||"Fundamental"===e)return x([h(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Ee=e=>{if("Reflector"in e){const t=e.Reflector;return x([h("Reflector"),k({asset:we(t.asset),contract:b(t.contract),read_mode:Pe(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return x([h("MultiFeed"),k({contract:b(t.contract),feed_id:f(t.feedId),kind:ke(t.kind),nature:Re(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},Oe=e=>{const t=e;return k({decimals:g(t.decimals),max_stale_seconds:T(t.maxStaleSeconds),provider:Ee(t.provider)})},Ie=e=>{if("RequireDisjoint"===e)return x([h("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return x([h("AllowShared"),x(t.map((e=>k({contract:b(e.contract),kind:ke(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},Me=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return k({asset_decimals:g(Number(t.assetDecimals)),independence:Ie(t.independence),max_price_stale_seconds:T(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:y(String(t.maxSanityPriceWad)),min_sanity_price_wad:y(String(t.minSanityPriceWad)),sources:x(r.map((e=>(e=>{if("Feed"in e)return x([h("Feed"),Oe(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return x([h("Scaled"),k({factor:Oe(t.factor),max_factor_wad:y(t.maxFactorWad),min_factor_wad:y(t.minFactorWad),quote:qe(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return x([h("LpShare"),k({key_a:qe(t.keyA),key_b:qe(t.keyB),kind:x([h(t.kind||"ConstantProduct")]),pool:b(t.pool),reserve_a_decimals:g(t.reserveADecimals),reserve_b_decimals:g(t.reserveBDecimals),share_decimals:g(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:k({lower_ratio_bps:g(n),upper_ratio_bps:g(o)})})},Le=Me;function Ce(e,t){return C(e,"upgrade",[A(t.wasmHash)])}function Ue(e,t){return C(e,"migrate",[g(t.newVersion)])}function Ge(e){return C(e,"pause",[])}function Ne(e){return C(e,"unpause",[])}function Be(e,t){return C(e,"grant_role",[b(t.account),h(t.role)])}function De(e,t){return C(e,"revoke_role",[b(t.account),h(t.role)])}function $e(e,t){return C(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function We(e){return C(e,"accept_ownership",[])}function ze(e,t){return C(e,"set_swap_aggregator",[b(t.aggregator)])}function He(e,t){return C(e,"set_price_aggregator",[b(t.aggregator)])}const Fe=ze;function je(e,t){return C(e,"set_accumulator",[b(t.accumulator)])}function Ve(e,t){return C(e,"set_position_limits",[_e(t)])}function Xe(e,t){return C(e,"approve_blend_pool",[b(t.pool)])}function Qe(e,t){return C(e,"revoke_blend_pool",[b(t.pool)])}const Ke=Xe,Ze=Qe;function Je(e,t){return C(e,"set_oracle",[qe(t.key),Me(t.oracle)])}const Ye=Je;function et(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return C(e,"set_tolerance",[qe(t.key),k({lower_ratio_bps:g(n),upper_ratio_bps:g(o)})])}function tt(e,t){return C(e,"set_spoke_asset_flags",[g(t.spokeId),q(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function rt(e,t){return C(e,"set_oracle_sanity_bounds",[b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function ot(e,t){return C(e,"update_indexes",[b(e.caller),x(t.assets.map((e=>q(e.hubId,e.asset))))])}function nt(e,t){return C(e,"renew_account",[b(e.caller),T(t.accountNonce)])}function ut(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),b(t.asset),Ae(t.params)])}function at(e,t){return C(e,"upgrade_liquidity_pool_params",[q(t.hubId,t.asset),xe(t.params)])}function it(e,t){return C(e,"claim_revenue",[b(e.caller),x(t.assets.map((e=>q(e.hubId,e.asset))))])}function lt(e,t){return C(e,"add_rewards",[b(e.caller),P(t.rewards)])}function st(e,t){return C(e,"update_account_threshold",[b(e.caller),m(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const pt="00".repeat(32),dt=e=>{if("string"==typeof e)return A(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},ct=(e,...t)=>x([h(e),...t]),St=e=>k({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),bt=e=>k({asset:b(e.asset),bonus:g(e.bonus),borrow_cap:y(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:g(e.hubId),paused:m(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:y(e.supplyCap),threshold:g(e.threshold)}),yt=e=>k({account:b(e.account),role:h(e.role)});function gt(e,t,r){const o=e.governanceAddress??d(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const Tt=(e,t,r)=>gt(e,"propose",[b(e.caller),t,dt(r)]),mt=(e,t,r)=>gt(e,"execute_self",[v(),t,dt(r)]);function ft(e,t,r){return Tt(e,ct("SetSwapAggregator",b(t.aggregator)),r)}function ht(e,t,r){return Tt(e,ct("SetPriceAggregator",b(t.aggregator)),r)}const vt=ft;function xt(e,t,r){return Tt(e,ct("SetAccumulator",b(t.accumulator)),r)}function At(e,t,r){return Tt(e,ct("SetPositionLimits",_e(t)),r)}function _t(e,t){return Tt(e,ct("CreateHub"),t)}function qt(e,t){return Tt(e,ct("AddSpoke"),t)}function wt(e,t,r){return Tt(e,ct("RemoveSpoke",g(t.spokeId)),r)}function Pt(e,t,r){return Tt(e,ct("AddAssetToSpoke",bt(t)),r)}function kt(e,t,r){return Tt(e,ct("EditAssetInSpoke",bt(t)),r)}function Rt(e,t,r){return Tt(e,ct("RemoveAssetFromSpoke",k({hub_asset:q((o=t).hubId,o.asset),spoke_id:g(o.spokeId)})),r);var o}function Et(e,t,r){return Tt(e,ct("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:y((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(o.liquidationBonusFactorBps),spoke_id:g(o.spokeId),target_hf_wad:y(o.targetHfWad)})),r);var o}function Ot(e,t,r){return Tt(e,ct("SetPositionManager",b(t.manager),m(t.isActive)),r)}function It(e,t,r){return Tt(e,ct("SetMinBorrowCollateralUsd",y(t.floorWad)),r)}function Mt(e,t,r){return Tt(e,ct("ApproveToken",b(t.token)),r)}function Lt(e,t,r){return Tt(e,ct("RevokeToken",b(t.token)),r)}function Ct(e,t,r){return Tt(e,ct("ApproveBlendPool",b(t.pool)),r)}function Ut(e,t,r){return Tt(e,ct("RevokeBlendPool",b(t.pool)),r)}function Gt(e,t,r){return Tt(e,ct("CreateLiquidityPool",k({asset:b((o=t).asset),hub_id:g(o.hubId),params:Ae(o.params)})),r);var o}function Nt(e,t,r){return Tt(e,ct("UpgradeLiquidityPoolParams",k({hub_asset:q((o=t).hubId,o.asset),params:xe(o.params)})),r);var o}function Bt(e,t,r){return Tt(e,ct("DeployPool",A(t.wasmHash)),r)}function Dt(e,t,r){return Tt(e,ct("UpgradePool",A(t.wasmHash)),r)}function $t(e,t,r){return Tt(e,ct("UpgradeController",A(t.wasmHash)),r)}function Wt(e,t,r){return Tt(e,ct("MigrateController",g(t.newVersion)),r)}function zt(e,t,r){return Tt(e,ct("TransferCtrlOwnership",St(t)),r)}function Ht(e,t,r){return Tt(e,ct("ConfigureAssetOracle",k({key:qe((o=t).key),oracle:Me(o.oracle)})),r);var o}const Ft=Ht;function jt(e,t,r){return Tt(e,ct("EditOracleTolerance",k({key:qe((o=t).key),tolerance:g(o.tolerance)})),r);var o}function Vt(e,t,r){return Tt(e,ct("UpgradeGov",A(t.wasmHash)),r)}function Xt(e,t,r){return Tt(e,ct("UpdateGovDelay",g(t.newDelay)),r)}function Qt(e,t,r){return Tt(e,ct("GrantGovRole",yt(t)),r)}function Kt(e,t,r){return Tt(e,ct("RevokeGovRole",yt(t)),r)}function Zt(e,t,r){return Tt(e,ct("TransferGovOwnership",St(t)),r)}function Jt(e,t){const r=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=dt(t.predecessor??pt);return gt(e,"execute",[v(),b(t.target),h(t.functionName),r,o,dt(t.salt)])}function Yt(e,t,r){return mt(e,ct("UpgradeGov",A(t.wasmHash)),r)}function er(e,t,r){return mt(e,ct("UpdateGovDelay",g(t.newDelay)),r)}function tr(e,t,r){return mt(e,ct("GrantGovRole",yt(t)),r)}function rr(e,t,r){return mt(e,ct("RevokeGovRole",yt(t)),r)}function or(e,t,r){return mt(e,ct("TransferGovOwnership",St(t)),r)}const nr=e=>x(e.map(b));function ur(e,t,r){return gt(e,"propose_canceller_reset",[nr(t.newCancellers),dt(r)])}function ar(e,t,r){return gt(e,"execute_canceller_reset",[_(t.executor,b),nr(t.newCancellers),dt(r)])}function ir(e,t){return gt(e,"set_spoke_asset_flags",[b(e.caller),g(t.spokeId),q(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function lr(e,t){return gt(e,"set_oracle_sanity_bounds",[b(e.caller),b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function sr(e){return gt(e,"create_hub",[b(e.caller)])}function pr(e){return gt(e,"add_spoke",[b(e.caller)])}function dr(e,t){return gt(e,"revoke_role_immediate",[b(t.account),h(t.role)])}function cr(e){return gt(e,"pause",[b(e.caller)])}function Sr(e,t){return Tt(e,ct("Unpause"),t)}const br=e=>e.toXDR("base64"),yr=e=>c.xdr.ScVal.fromXDR(e,"base64"),gr=e=>e.map((e=>String((0,c.scValToNative)(yr(e))))).join(":"),Tr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),mr=e=>Number(e),fr=e=>String(e),hr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),vr=["None","Multiply","Long","Short"],xr=["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"],Ar=e=>Array.isArray(e)?e:[],_r=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],xr[mr(o)]??Tr(o)),positionType:t,hubId:mr(e[1]),asset:fr(e[2]),scaledAmountRay:Tr(e[3]),indexRay:Tr(e[4]),amount:Tr(e[5]),liquidationThresholdBps:r?void 0:mr(e[6]),liquidationBonusBps:r?void 0:mr(e[7]),loanToValueBps:r?void 0:mr(e[8]),liquidationFeesBps:r?void 0:mr(e[9])};var o},qr=e=>{return{owner:fr(e[0]),spokeId:mr(e[1]),mode:(t=e[2],vr[mr(t)]??"None")};var t},wr=e=>Array.isArray(e)?e[1]:void 0,Pr=e=>{const t=(r=e,Array.isArray(r)?fr(r[0]):fr(r));var r;if("Token"===t)return{Token:fr(wr(e))};if("Ref"===t)return{Ref:fr(wr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:fr(t.Token)};if(void 0!==t.Ref)return{Ref:fr(t.Ref)}}return{Token:fr(e)}},kr=e=>{const t=e.tolerance??{};return{assetDecimals:mr(e.asset_decimals),maxPriceStaleSeconds:mr(e.max_price_stale_seconds),sources:Ar(e.sources).map((e=>e)),tolerance:{upperRatio:mr(t.upper_ratio_bps),lowerRatio:mr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:Tr(e.min_sanity_price_wad),maxSanityPriceWad:Tr(e.max_sanity_price_wad)}},Rr={"market:create":e=>({topic:"market:create",data:{hubId:mr(e.hub_id),baseAsset:fr(e.base_asset),maxBorrowRate:Tr(e.max_borrow_rate),baseBorrowRate:Tr(e.base_borrow_rate),slope1:Tr(e.slope1),slope2:Tr(e.slope2),slope3:Tr(e.slope3),midUtilization:Tr(e.mid_utilization),optimalUtilization:Tr(e.optimal_utilization),maxUtilization:Tr(e.max_utilization),reserveFactor:mr(e.reserve_factor),marketAddress:fr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:fr(e.asset),maxBorrowRateRay:Tr(e.max_borrow_rate),baseBorrowRateRay:Tr(e.base_borrow_rate),slope1Ray:Tr(e.slope1),slope2Ray:Tr(e.slope2),slope3Ray:Tr(e.slope3),midUtilizationRay:Tr(e.mid_utilization),optimalUtilizationRay:Tr(e.optimal_utilization),maxUtilizationRay:Tr(e.max_utilization),reserveFactorBps:mr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Ar(e).map((e=>{return t=Ar(e),{hubId:mr(t[0]),asset:fr(t[1]),timestamp:mr(t[2]),supplyIndexRay:Tr(t[3]),borrowIndexRay:Tr(t[4]),cash:Tr(t[5]),suppliedRay:Tr(t[6]),borrowedRay:Tr(t[7]),revenueRay:Tr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Ar(e).map((e=>{const t=e;return{hubId:mr(t.hub_id),asset:fr(t.asset),params:(r=t.params,{maxBorrowRateRay:Tr(r.max_borrow_rate),baseBorrowRateRay:Tr(r.base_borrow_rate),slope1Ray:Tr(r.slope1),slope2Ray:Tr(r.slope2),slope3Ray:Tr(r.slope3),midUtilizationRay:Tr(r.mid_utilization),optimalUtilizationRay:Tr(r.optimal_utilization),maxUtilizationRay:Tr(r.max_utilization),reserveFactorBps:mr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:mr(r.flashloan_fee),assetId:fr(r.asset_id),assetDecimals:mr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Ar(e);return{topic:"position:batch_update",data:{accountId:Tr(t[0]),accountAttributes:qr(Ar(t[1])),updates:[...Ar(t[2]).map((e=>_r(Ar(e),"Deposit"))),...Ar(t[3]).map((e=>_r(Ar(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:mr(e.hub_id),asset:fr(e.asset),receiver:fr(e.receiver),caller:fr(e.caller),amount:Tr(e.amount),fee:Tr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Pr(e.key),oracle:kr(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:fr(e.asset),oracle:kr(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:fr(e.liquidator),accountId:Tr(e.account_id),repaidUsdWad:Tr(e.repaid_usd_wad),bonusBps:Tr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Tr(e.account_id),totalBorrowUsdWad:Tr(e.total_borrow_usd_wad),totalCollateralUsdWad:Tr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:fr(e.token),amount:Tr(e.amount),usdValueWad:Tr(e.usd_value_wad),accountId:Tr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:mr(e.hub_id),asset:fr(e.asset),amount:Tr(e.amount),fee:Tr(e.fee),amountSent:Tr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:fr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:hr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:fr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:fr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:fr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:fr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:hr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:mr(e.max_supply_positions),maxBorrowPositions:mr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:Tr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:fr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:mr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Tr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Tr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:mr(t.liquidation_bonus_factor_bps)}}}},Er=Object.freeze(Object.keys(Rr));function Or(e,t){const r=gr(e),o=Rr[r];return o?o((0,c.scValToNative)(yr(t))):null}const Ir="XLENDXLM-a7c9f3",Mr=1e4;function Lr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Ir}-${r}`}function Cr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Ur(e,t=0){return e*Mr+t}function Gr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Nr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Br=e=>e.baseUrl??i[e.network];async function Dr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=Nr(Br(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function $r(e){const t=Nr(Br(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Wr=e=>R(e).toXDR("base64");function zr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",b(e.caller),y(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Hr(e,t){return zr(e,t)}function Fr(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(Xr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Xr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function jr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Fr(e,t)}const Vr=Fr,Xr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Qr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Kr(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Qr(r.invokedContractId,e);throw e}}async function Zr(e,t,r){return Kr(e,t.xdr,r)}function Jr(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Yr(e,t){return new Uint8Array(0)}const eo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function to(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(eo(e.message)),c.xdr.ScVal.scvBytes(eo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const ro={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 oo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=ro[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>T.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>T.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>T.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>T.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>T.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>T.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>T.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>T.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>T.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>T.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>T.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>T.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>T.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>T.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>T.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>T.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>T.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>T.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>T.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>T.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>T.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>T.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>T.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>T.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>T.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>T.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>T.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>T.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>T.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>T.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>T.buildStellarMigrateTx,buildStellarMultiplyTx:()=>T.buildStellarMultiplyTx,buildStellarPauseTx:()=>T.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>T.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>T.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>T.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>T.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>T.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>T.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>T.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>T.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>T.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>T.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>T.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>T.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>T.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>T.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>T.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>T.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>T.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>T.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>T.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>T.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>T.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>T.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>T.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>T.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>T.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>T.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeAssetOracle:()=>T.encodeAssetOracle,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodePositionLimits:()=>T.encodePositionLimits,encodePriceKey:()=>T.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>T.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>T.extractEventOrder,getStellarAccountPositions:()=>T.getStellarAccountPositions,getStellarAggregatorQuote:()=>T.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>T.getStellarAggregatorRouter,getStellarAsset:()=>T.getStellarAsset,getStellarAssetGraph:()=>T.getStellarAssetGraph,getStellarAssetMarkets:()=>T.getStellarAssetMarkets,getStellarAssetPage:()=>T.getStellarAssetPage,getStellarAssets:()=>T.getStellarAssets,getStellarGovernance:()=>T.getStellarGovernance,getStellarGovernanceProposals:()=>T.getStellarGovernanceProposals,getStellarHub:()=>T.getStellarHub,getStellarHubGraph:()=>T.getStellarHubGraph,getStellarHubs:()=>T.getStellarHubs,getStellarLendingContext:()=>T.getStellarLendingContext,getStellarLendingController:()=>T.getStellarLendingController,getStellarLendingLiveState:()=>T.getStellarLendingLiveState,getStellarQuoteTokens:()=>T.getStellarQuoteTokens,getStellarReserve:()=>T.getStellarReserve,getStellarReserveGraph:()=>T.getStellarReserveGraph,getStellarReserveHolders:()=>T.getStellarReserveHolders,getStellarReserves:()=>T.getStellarReserves,getStellarSpoke:()=>T.getStellarSpoke,getStellarSpokeGraph:()=>T.getStellarSpokeGraph,getStellarSpokes:()=>T.getStellarSpokes,getStellarUserActivity:()=>T.getStellarUserActivity,getStellarUserPositions:()=>T.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>T.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>T.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>T.mapQuoteResponseToStrategySwap,mapSorobanError:()=>T.mapSorobanError,mapStellarPositionActivityType:()=>T.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>T.prepareStellarBuiltTx,prepareStellarTxXdr:()=>T.prepareStellarTxXdr,stellarLendingDispatchKey:()=>T.stellarLendingDispatchKey,stellarLendingRead:()=>T.stellarLendingRead,syntheticEventOrder:()=>T.syntheticEventOrder,tagStellarInvokedContractError:()=>T.tagStellarInvokedContractError,toBase64Xdr:()=>T.toBase64Xdr,toStellarPositionMode:()=>T.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,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:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,b="Bearer undefined"===S?void 0:S,y={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},g=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),T=`${this.apiUrl}${e}${g.length?`?${g}`:""}`,{revalidate:m,...f}=o??{},{revalidate:h,...v}=i??{},x="GET"!==d||b?void 0:h??m,A="GET"!==d||b||x?void 0:l??n,_={...a,...c,method:d,...Object.keys(y).length?{headers:y}:{},cache:A,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,_);const q=await fetch(T,_).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await q.text();if(!q.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,q.status,q.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||r},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||r};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),y={"/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:{}}}},g=["PATCH","POST","DELETE","PUT"];var T=r(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!b(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:y,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...A}=d,_=g?`Bearer ${g}`:void 0,q={...m,..._?{Authorization:_}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return o.fetchWithTimeout(u,{method:T,params:A,body:y,headers:q,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,r]of Object.entries(y)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=m(e.slice(1));n=n.params[t]||=f()}else{const t=m(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=h(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[m(r.split("/").pop().replace(/^:/,""))]=h(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();