@xoxno/sdk-js 1.0.169 → 1.0.170

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={454(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>u,STELLAR_GOVERNANCE:()=>n,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>it,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>vo,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>qo,XOXNO_LENDING_STELLAR_TICKER:()=>_o,buildSameTokenRepaySwapSteps:()=>Vo,buildStellarAcceptOwnershipTx:()=>Le,buildStellarAddAssetToEModeCategoryTx:()=>Ve,buildStellarAddEModeCategoryTx:()=>De,buildStellarAddRewardsTx:()=>nt,buildStellarApproveTokenTx:()=>Fe,buildStellarBatchSwapTx:()=>Lo,buildStellarBorrowBatchTx:()=>B,buildStellarBorrowTx:()=>G,buildStellarCctpForwardTx:()=>Ho,buildStellarClaimRevenueTx:()=>ut,buildStellarConfigureMarketOracleTx:()=>Ze,buildStellarCreateLiquidityPoolTx:()=>tt,buildStellarDisableTokenOracleTx:()=>Je,buildStellarEditAssetConfigTx:()=>Ne,buildStellarEditAssetInEModeCategoryTx:()=>je,buildStellarEditOracleToleranceTx:()=>Ke,buildStellarExecuteStrategyTx:()=>Co,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Ft,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Zt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Kt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Jt,buildStellarGovernanceExecuteTx:()=>Xt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Qt,buildStellarGrantRoleTx:()=>Me,buildStellarLendingIdentifier:()=>Ao,buildStellarLiquidateTx:()=>W,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Re,buildStellarMultiplyTx:()=>H,buildStellarPauseTx:()=>ke,buildStellarProposeAddAssetToEModeTx:()=>qt,buildStellarProposeAddEModeCategoryTx:()=>xt,buildStellarProposeApproveBlendPoolTx:()=>kt,buildStellarProposeApproveTokenTx:()=>Et,buildStellarProposeConfigureMarketOracleTx:()=>$t,buildStellarProposeCreateLiquidityPoolTx:()=>Mt,buildStellarProposeDeployPoolTx:()=>Ct,buildStellarProposeDisableTokenOracleTx:()=>Ut,buildStellarProposeEditAssetConfigTx:()=>mt,buildStellarProposeEditAssetInEModeTx:()=>At,buildStellarProposeEditOracleToleranceTx:()=>Dt,buildStellarProposeGovernanceUpgradeTx:()=>zt,buildStellarProposeGrantGovernanceRoleTx:()=>Vt,buildStellarProposeMigrateControllerTx:()=>Gt,buildStellarProposeRemoveAssetFromEModeTx:()=>Pt,buildStellarProposeRemoveEModeCategoryTx:()=>_t,buildStellarProposeRevokeBlendPoolTx:()=>Ot,buildStellarProposeRevokeGovernanceRoleTx:()=>jt,buildStellarProposeRevokeTokenTx:()=>Rt,buildStellarProposeSetAccumulatorTx:()=>Tt,buildStellarProposeSetAggregatorTx:()=>gt,buildStellarProposeSetMinBorrowCollatTx:()=>vt,buildStellarProposeSetPoolTemplateTx:()=>ft,buildStellarProposeSetPositionLimitsTx:()=>ht,buildStellarProposeTransferCtrlOwnershipTx:()=>Nt,buildStellarProposeTransferGovOwnTx:()=>Ht,buildStellarProposeUpdateDelayTx:()=>Wt,buildStellarProposeUpdatePoolCapsTx:()=>wt,buildStellarProposeUpgradeControllerTx:()=>Bt,buildStellarProposeUpgradePoolParamsTx:()=>It,buildStellarProposeUpgradePoolTx:()=>Lt,buildStellarRemoveAssetFromEModeTx:()=>Xe,buildStellarRemoveEModeCategoryTx:()=>ze,buildStellarRenewAccountTx:()=>et,buildStellarRepayBatchTx:()=>D,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ie,buildStellarRevokeTokenTx:()=>Qe,buildStellarSetAccumulatorTx:()=>Be,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ge,buildStellarSetPositionLimitsTx:()=>$e,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>F,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ce,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>at,buildStellarUpdateIndexesTx:()=>Ye,buildStellarUpdatePoolCapsTx:()=>He,buildStellarUpgradeControllerTx:()=>Ee,buildStellarUpgradeLiquidityPoolParamsTx:()=>ot,buildStellarUpgradeLiquidityPoolTx:()=>rt,buildStellarWithdrawBatchTx:()=>N,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>xo,encodeAssetConfigRaw:()=>xe,encodeInterestRateModel:()=>he,encodeMarketOracleConfigInput:()=>Pe,encodeMarketParamsRaw:()=>ve,encodeOracleSourceConfigInput:()=>we,encodePositionLimits:()=>_e,encodeStrategyPayloadToRouteXdr:()=>Io,extractEventOrder:()=>wo,getStellarAccountPositions:()=>ce,getStellarAggregatorQuote:()=>Oo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ne,getStellarAssetGraph:()=>be,getStellarAssetMarkets:()=>ie,getStellarAssetPage:()=>ae,getStellarAssets:()=>Y,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ye,getStellarHub:()=>le,getStellarHubGraph:()=>Se,getStellarHubs:()=>ee,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>Mo,getStellarReserve:()=>re,getStellarReserveGraph:()=>Te,getStellarReserveHolders:()=>ue,getStellarReserves:()=>oe,getStellarSpoke:()=>se,getStellarSpokeGraph:()=>ge,getStellarSpokes:()=>te,getStellarUserActivity:()=>de,getStellarUserPositions:()=>pe,mapQuoteResponseToAggregatorSwap:()=>Go,mapQuoteResponseToStrategyPayload:()=>Uo,mapQuoteResponseToStrategySwap:()=>Bo,mapStellarPositionActivityType:()=>Eo,prepareStellarBuiltTx:()=>zo,prepareStellarTxXdr:()=>Do,stellarLendingDispatchKey:()=>to,stellarLendingRead:()=>fe,syntheticEventOrder:()=>Po,tagStellarInvokedContractError:()=>$o,toBase64Xdr:()=>Yt,toStellarPositionMode:()=>Wo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},u={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},n={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=u[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=n[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"),y=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new c.Address(e).toScVal(),S=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(),f=e=>c.xdr.ScVal.scvBool(e),m=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),_=(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)},q=(e,t)=>null==e?v():t(e),A=(e,t)=>E({asset:b(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([A(e,t),S(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),E=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 E({amount_out:S(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 E({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return E({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:S(e.totalMinOut)})},k=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=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 k(O(e));if(e instanceof Uint8Array)return k(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?k(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?k(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?k(O(e.bytes)):k(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||!y.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)")},I=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),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function L(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[b(e.caller),T(o),g(r),P([...t.assets])])}function U(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function B(e,t){return C(e,"borrow",[b(e.caller),T(t.accountNonce),P([...t.borrows]),q(t.to,b)])}function G(e,t){return B(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function N(e,t){return C(e,"withdraw",[b(e.caller),T(t.accountNonce),P([...t.withdrawals]),q(t.to,b)])}function $(e,t){return N(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return C(e,"repay",[b(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return D(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function W(e,t){return C(e,"liquidate",[b(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[b(e.caller),A(t.hubId,t.asset),S(t.amount),b(t.receiver),I(t.data)])}function j(e,t){return C(e,"migrate_from_blend",[b(e.caller),T(t.accountId),g(t.spokeId),b(t.blendPool),x(t.collateralTokens.map(b)),x(t.supplyTokens.map(b)),(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([b(t),S(o)]);var t,o}))))]);var o}function H(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"multiply",[b(e.caller),T(o),g(r),A(t.collateral.hubId,t.collateral.asset),S(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),q(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),q(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[b(e.caller),T(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),S(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function F(e,t){return C(e,"swap_collateral",[b(e.caller),T(t.accountNonce),A(t.current.hubId,t.current.asset),S(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Q(e,t){return C(e,"repay_debt_with_collateral",[b(e.caller),T(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),S(t.collateralAmount),A(t.debt.hubId,t.debt.asset),M(t.steps),f(t.closePosition)])}const Z="/stellar-lending",K=25,J=encodeURIComponent,Y=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),ee=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),oe=(e,t={},o)=>{const{hubId:r,spokeId:u,asset:n}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==u?{spokeId:u}:{},...n?{asset:n}:{}}})},re=(e,t,o,r,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}`,u),ue=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/holders`,{...n,params:{side:u}}),ne=(e,t,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}`,o),ae=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/page`,{...r,params:{...o}}),ie=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...r,params:{side:o}}),le=(e,t,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,o),se=(e,t,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,o),pe=(e,t,o)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,o),de=(e,t,o={},r)=>{const{skip:u,top:n}=o;return e.fetchWithTimeout(`${Z}/users/${J(t)}/activity`,{...r,params:{...void 0!==u?{skip:u}:{},...void 0!==n?{top:n}:{}}})},ce=(e,t,o)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,o),ye=(e,t={},o)=>{const{top:r=K,continuationToken:u}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...o,params:{top:r,...u?{continuationToken:u}:{}}})},be=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/graph`,{...r,params:{...o}}),Se=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...r,params:{...o}}),ge=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...r,params:{...o}}),Te=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/graph`,{...n,params:{...u}}),fe=e=>({assets:t=>Y(e,t),hubs:t=>ee(e,t),spokes:t=>te(e,t),reserves:(t,o)=>oe(e,t,o),reserve:(t,o,r,u)=>re(e,t,o,r,u),reserveHolders:(t,o,r,u,n)=>ue(e,t,o,r,u,n),asset:(t,o)=>ne(e,t,o),assetMarkets:(t,o,r)=>ie(e,t,o,r),hub:(t,o)=>le(e,t,o),spoke:(t,o)=>se(e,t,o),userPositions:(t,o)=>pe(e,t,o),userActivity:(t,o,r)=>de(e,t,o,r),accountPositions:(t,o)=>ce(e,t,o),governanceProposals:(t,o)=>ye(e,t,o),assetGraph:(t,o,r)=>be(e,t,o,r),hubGraph:(t,o,r)=>Se(e,t,o,r),spokeGraph:(t,o,r)=>ge(e,t,o,r),reserveGraph:(t,o,r,u,n)=>Te(e,t,o,r,u,n)}),me={Single:0,PrimaryWithAnchor:1},he=e=>E({base_borrow_rate_ray:S(e.baseBorrowRateRay),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray)}),ve=e=>E({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate_ray:S(e.baseBorrowRateRay),borrow_cap:S(e.borrowCap),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray),supply_cap:S(e.supplyCap)}),xe=e=>E({asset_decimals:g(0),e_mode_categories:x(e.eModeCategories.map((e=>g(e)))),flashloan_fee_bps:g(e.flashloanFeeBps),is_borrowable:f(e.isBorrowable),is_collateralizable:f(e.isCollateralizable),is_flashloanable:f(e.isFlashloanable),liquidation_bonus_bps:g(e.liquidationBonusBps),liquidation_fees_bps:g(e.liquidationFeesBps),liquidation_threshold_bps:g(e.liquidationThresholdBps),loan_to_value_bps:g(e.loanToValueBps)}),_e=e=>E({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),qe=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),b(e.value)]);case"Symbol":return x([h("Symbol"),h(e.value)]);case"String":return x([h("String"),m(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Ae=(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")])},we=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"),E({asset:qe(e.asset),contract:b(e.contract),read_mode:Ae(e.readMode,e.twapRecords)})])}if("RedStonePriceFeed"===t){if("string"!=typeof e.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof e.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return x([h("RedStone"),E({contract:b(e.contract),feed_id:m(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Pe=e=>{const t=me[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return E({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),we(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:S(e.maxSanityPriceWad),min_sanity_price_wad:S(e.minSanityPriceWad),primary:we(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ee(e,t){return C(e,"upgrade",[_(t.wasmHash)])}function Re(e,t){return C(e,"migrate",[g(t.newVersion)])}function ke(e){return C(e,"pause",[])}function Oe(e){return C(e,"unpause",[])}function Me(e,t){return C(e,"grant_role",[b(t.account),h(t.role)])}function Ie(e,t){return C(e,"revoke_role",[b(t.account),h(t.role)])}function Ce(e,t){return C(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function Le(e){return C(e,"accept_ownership",[])}function Ue(e,t){return C(e,"set_aggregator",[b(t.aggregator)])}function Be(e,t){return C(e,"set_accumulator",[b(t.accumulator)])}function Ge(e,t){return C(e,"set_liquidity_pool_template",[_(t.wasmHash)])}function Ne(e,t){return C(e,"edit_asset_config",[b(t.asset),xe(t.config)])}function $e(e,t){return C(e,"set_position_limits",[_e(t)])}function De(e){return C(e,"add_e_mode_category",[])}function ze(e,t){return C(e,"remove_e_mode_category",[g(t.id)])}const We=e=>E({asset:b(e.asset),category_id:g(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)});function Ve(e,t){return C(e,"add_asset_to_e_mode_category",[We(t)])}function je(e,t){return C(e,"edit_asset_in_e_mode_category",[We(t)])}function He(e,t){return C(e,"update_pool_caps",[b(t.asset),S(t.supplyCap),S(t.borrowCap)])}function Xe(e,t){return C(e,"remove_asset_from_e_mode",[b(t.asset),g(t.categoryId)])}function Fe(e,t){return C(e,"approve_token",[b(t.token)])}function Qe(e,t){return C(e,"revoke_token",[b(t.token)])}function Ze(e,t){return C(e,"configure_market_oracle",[b(e.caller),b(t.asset),Pe(t.config)])}function Ke(e,t){return C(e,"edit_oracle_tolerance",[b(e.caller),b(t.asset),g(t.tolerance)])}function Je(e,t){return C(e,"disable_token_oracle",[b(e.caller),b(t.asset)])}function Ye(e,t){return C(e,"update_indexes",[b(e.caller),x(t.assets.map((e=>b(e))))])}function et(e,t){return C(e,"renew_account",[b(e.caller),T(t.accountNonce)])}function tt(e,t){return C(e,"create_liquidity_pool",[b(t.asset),ve(t.params),xe(t.config)])}function ot(e,t){return C(e,"upgrade_liquidity_pool_params",[b(t.asset),he(t.params)])}function rt(e,t){return C(e,"upgrade_liquidity_pool",[b(t.asset),_(t.wasmHash)])}function ut(e,t){return C(e,"claim_revenue",[b(e.caller),x(t.assets.map((e=>b(e))))])}function nt(e,t){return C(e,"add_rewards",[b(e.caller),x(t.rewards.map((e=>x([b(e.token),S(e.amount)]))))])}function at(e,t){return C(e,"update_account_threshold",[b(e.caller),b(t.asset),f(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const it="00".repeat(32),lt=e=>{if("string"==typeof e)return _(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)},st=(e,...t)=>x([h(e),...t]),pt=e=>E({asset:b(e.asset),category_id:g(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)}),dt=e=>E({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ct=e=>E({account:b(e.account),role:h(e.role)});function yt(e,t,o){const r=e.governanceAddress??d(e.network),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const bt=(e,t,o)=>yt(e,"propose",[b(e.caller),t,lt(o)]),St=(e,t,o)=>yt(e,"execute_self",[v(),t,lt(o)]);function gt(e,t,o){return bt(e,st("SetAggregator",b(t.aggregator)),o)}function Tt(e,t,o){return bt(e,st("SetAccumulator",b(t.accumulator)),o)}function ft(e,t,o){return bt(e,st("SetLiquidityPoolTemplate",_(t.wasmHash)),o)}function mt(e,t,o){return bt(e,st("EditAssetConfig",b(t.asset),xe(t.config)),o)}function ht(e,t,o){return bt(e,st("SetPositionLimits",_e(t)),o)}function vt(e,t,o){return bt(e,st("SetMinBorrowCollateralUsd",S(t.floorWad)),o)}function xt(e,t){return bt(e,st("AddEModeCategory"),t)}function _t(e,t,o){return bt(e,st("RemoveEModeCategory",g(t.id)),o)}function qt(e,t,o){return bt(e,st("AddAssetToEModeCategory",pt(t)),o)}function At(e,t,o){return bt(e,st("EditAssetInEModeCategory",pt(t)),o)}function wt(e,t,o){return bt(e,st("UpdatePoolCaps",E({asset:b((r=t).asset),supply_cap:S(r.supplyCap),borrow_cap:S(r.borrowCap)})),o);var r}function Pt(e,t,o){return bt(e,st("RemoveAssetFromEMode",E({asset:b((r=t).asset),category_id:g(r.categoryId)})),o);var r}function Et(e,t,o){return bt(e,st("ApproveToken",b(t.token)),o)}function Rt(e,t,o){return bt(e,st("RevokeToken",b(t.token)),o)}function kt(e,t,o){return bt(e,st("ApproveBlendPool",b(t.pool)),o)}function Ot(e,t,o){return bt(e,st("RevokeBlendPool",b(t.pool)),o)}function Mt(e,t,o){return bt(e,st("CreateLiquidityPool",E({asset:b((r=t).asset),params:ve(r.params),config:xe(r.config)})),o);var r}function It(e,t,o){return bt(e,st("UpgradeLiquidityPoolParams",E({asset:b((r=t).asset),params:he(r.params)})),o);var r}function Ct(e,t){return bt(e,st("DeployPool"),t)}function Lt(e,t,o){return bt(e,st("UpgradePool",_(t.wasmHash)),o)}function Ut(e,t,o){return bt(e,st("DisableTokenOracle",b(t.asset)),o)}function Bt(e,t,o){return bt(e,st("UpgradeController",_(t.wasmHash)),o)}function Gt(e,t,o){return bt(e,st("MigrateController",g(t.newVersion)),o)}function Nt(e,t,o){return bt(e,st("TransferCtrlOwnership",dt(t)),o)}function $t(e,t,o){return bt(e,st("ConfigureMarketOracle",E({asset:b((r=t).asset),cfg:Pe(r.config)})),o);var r}function Dt(e,t,o){return bt(e,st("EditOracleTolerance",E({asset:b((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function zt(e,t,o){return bt(e,st("UpgradeGov",_(t.wasmHash)),o)}function Wt(e,t,o){return bt(e,st("UpdateGovDelay",g(t.newDelay)),o)}function Vt(e,t,o){return bt(e,st("GrantGovRole",ct(t)),o)}function jt(e,t,o){return bt(e,st("RevokeGovRole",ct(t)),o)}function Ht(e,t,o){return bt(e,st("TransferGovOwnership",dt(t)),o)}function Xt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=lt(t.predecessor??it);return yt(e,"execute",[v(),b(t.target),h(t.functionName),o,r,lt(t.salt)])}function Ft(e,t,o){return St(e,st("UpgradeGov",_(t.wasmHash)),o)}function Qt(e,t,o){return St(e,st("UpdateGovDelay",g(t.newDelay)),o)}function Zt(e,t,o){return St(e,st("GrantGovRole",ct(t)),o)}function Kt(e,t,o){return St(e,st("RevokeGovRole",ct(t)),o)}function Jt(e,t,o){return St(e,st("TransferGovOwnership",dt(t)),o)}const Yt=e=>e.toXDR("base64"),eo=e=>c.xdr.ScVal.fromXDR(e,"base64"),to=e=>e.map((e=>String((0,c.scValToNative)(eo(e))))).join(":"),oo=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),ro=e=>Number(e),uo=e=>String(e),no=e=>null==e?void 0:oo(e),ao=e=>null==e?void 0:uo(e),io=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),lo=["None","Multiply","Long","Short"],so=["Single","PrimaryWithAnchor"],po=["ReflectorSep40","RedStonePriceFeed"],co=["Spot","Twap"],yo=["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"],bo=e=>Array.isArray(e)?e:[],So=e=>({loanToValueBps:ro(e.loan_to_value_bps),liquidationThresholdBps:ro(e.liquidation_threshold_bps),liquidationBonusBps:ro(e.liquidation_bonus_bps),liquidationFeesBps:ro(e.liquidation_fees_bps),isCollateralizable:Boolean(e.is_collateralizable),isBorrowable:Boolean(e.is_borrowable),isFlashloanable:Boolean(e.is_flashloanable),flashloanFeeBps:ro(e.flashloan_fee_bps),eModeCategories:(e.e_mode_categories??[]).map(ro)}),go=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],yo[ro(r)]??oo(r)),positionType:t,asset:uo(e[1]),scaledAmountRay:oo(e[2]),indexRay:oo(e[3]),amount:oo(e[4]),liquidationThresholdBps:o?void 0:ro(e[5]),liquidationBonusBps:o?void 0:ro(e[6]),loanToValueBps:o?void 0:ro(e[7])};var r},To=e=>{return{owner:uo(e[0]),eModeCategoryId:ro(e[1]),mode:(t=e[2],lo[ro(t)]??"None")};var t},fo=(e,t)=>{const o=co[ro(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],u=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:uo(r)}:null!=u?{kind:"Symbol",value:uo(u)}:void 0;return{provider:po[ro(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:uo(e[`${t}_contract`]),asset:n,feedId:ao(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?ro(e[`${t}_twap_records`]):void 0,decimals:ro(e[`${t}_decimals`]),resolutionSeconds:ro(e[`${t}_resolution_seconds`]),maxStaleSeconds:ro(e[`${t}_max_stale_seconds`])}},mo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:uo(e.base_token_id),quoteTokenId:uo(e.quote_token_id),tolerance:{upperRatio:ro(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:ro(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:ro(e.asset_decimals),maxPriceStaleSeconds:ro(e.max_price_stale_seconds),strategy:so[ro(e.strategy)]??"Single",primary:fo(e,"primary"),anchor:t?fo(e,"anchor"):void 0,primaryQuoteToken:ao(e.primary_quote_token),anchorQuoteToken:ao(e.anchor_quote_token),minSanityPriceWad:no(e.min_sanity_price_wad),maxSanityPriceWad:no(e.max_sanity_price_wad)}},ho={"market:create":e=>({topic:"market:create",data:{baseAsset:uo(e.base_asset),maxBorrowRate:oo(e.max_borrow_rate),baseBorrowRate:oo(e.base_borrow_rate),slope1:oo(e.slope1),slope2:oo(e.slope2),slope3:oo(e.slope3),midUtilization:oo(e.mid_utilization),optimalUtilization:oo(e.optimal_utilization),maxUtilization:no(e.max_utilization),reserveFactor:ro(e.reserve_factor),marketAddress:uo(e.market_address),config:So(e.config)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:uo(e.asset),maxBorrowRateRay:oo(e.max_borrow_rate_ray),baseBorrowRateRay:oo(e.base_borrow_rate_ray),slope1Ray:oo(e.slope1_ray),slope2Ray:oo(e.slope2_ray),slope3Ray:oo(e.slope3_ray),midUtilizationRay:oo(e.mid_utilization_ray),optimalUtilizationRay:oo(e.optimal_utilization_ray),maxUtilizationRay:no(e.max_utilization_ray),reserveFactorBps:ro(e.reserve_factor_bps)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:bo(e).map((e=>{return t=bo(e),{asset:uo(t[0]),timestamp:ro(t[1]),supplyIndexRay:oo(t[2]),borrowIndexRay:oo(t[3]),reservesRay:oo(t[4]),suppliedRay:oo(t[5]),borrowedRay:oo(t[6]),revenueRay:oo(t[7]),assetPriceWad:no(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:bo(e).map((e=>{const t=e;return{asset:uo(t.asset),params:(o=t.params,{maxBorrowRateRay:oo(o.max_borrow_rate_ray),baseBorrowRateRay:oo(o.base_borrow_rate_ray),slope1Ray:oo(o.slope1_ray),slope2Ray:oo(o.slope2_ray),slope3Ray:oo(o.slope3_ray),midUtilizationRay:oo(o.mid_utilization_ray),optimalUtilizationRay:oo(o.optimal_utilization_ray),maxUtilizationRay:no(o.max_utilization_ray),reserveFactorBps:ro(o.reserve_factor_bps),supplyCap:oo(o.supply_cap),borrowCap:oo(o.borrow_cap),assetId:ao(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:ro(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=bo(e);return{topic:"position:batch_update",data:{accountId:oo(t[0]),accountAttributes:To(bo(t[1])),updates:[...bo(t[2]).map((e=>go(bo(e),"Deposit"))),...bo(t[3]).map((e=>go(bo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{asset:uo(e.asset),receiver:uo(e.receiver),caller:uo(e.caller),amount:oo(e.amount),fee:oo(e.fee)}}),"config:asset":e=>({topic:"config:asset",data:{asset:uo(e.asset),config:So(e.config)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:uo(e.asset),oracle:mo(e.oracle)}}),"config:emode_category":e=>({topic:"config:emode_category",data:{category:{categoryId:ro(e.category.category_id),isDeprecated:Boolean(e.category.is_deprecated)}}}),"config:emode_asset":e=>({topic:"config:emode_asset",data:{asset:uo(e.asset),config:{isCollateralizable:Boolean(e.config.is_collateralizable),isBorrowable:Boolean(e.config.is_borrowable),loanToValueBps:ro(e.config.loan_to_value_bps),liquidationThresholdBps:ro(e.config.liquidation_threshold_bps),liquidationBonusBps:ro(e.config.liquidation_bonus_bps),supplyCap:oo(e.config.supply_cap),borrowCap:oo(e.config.borrow_cap)},categoryId:ro(e.category_id)}}),"config:remove_emode_asset":e=>({topic:"config:remove_emode_asset",data:{asset:uo(e.asset),categoryId:ro(e.category_id)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:oo(e.account_id),totalBorrowUsdWad:oo(e.total_borrow_usd_wad),totalCollateralUsdWad:oo(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:uo(e.token),amount:oo(e.amount),usdValueWad:oo(e.usd_value_wad),accountId:oo(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{asset:uo(e.asset),amount:oo(e.amount),fee:oo(e.fee),amountSent:oo(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:io(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:uo(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:uo(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:io(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:ro(e.max_supply_positions),maxBorrowPositions:ro(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:uo(e.asset)}})},vo=Object.freeze(Object.keys(ho));function xo(e,t){const o=to(e),r=ho[o];return r?r((0,c.scValToNative)(eo(t))):null}const _o="XLENDXLM-a7c9f3",qo=1e4;function Ao(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${_o}-${o}`}function wo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Po(e,t=0){return e*qo+t}function Eo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Ro=(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()},ko=e=>e.baseUrl??i[e.network];async function Oo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Ro(ko(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 Mo(e){const t=Ro(ko(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 Io=e=>R(e).toXDR("base64");function Co(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence),n=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(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",b(e.caller),S(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Lo(e,t){return Co(e,t)}function Uo(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(No),splitPpm:e.splitPpm}))):[{hops:e.hops.map(No),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Bo(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Uo(e,t)}const Go=Uo,No=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function $o(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Do(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw $o(o.invokedContractId,e);throw e}}async function zo(e,t,o){return Do(e,t.xdr,o)}function Wo(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 Vo(e,t){return{paths:[{hops:[{amountOut:"0",pool:e,tokenIn:e,tokenOut:e,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:e,tokenOut:e,totalMinOut:t}}const jo=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 Ho(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(jo(e.message)),c.xdr.ScVal.scvBytes(jo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}}},t={};function o(r){var u=t[r];if(void 0!==u)return u.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.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,buildStellarAddAssetToEModeCategoryTx:()=>T.buildStellarAddAssetToEModeCategoryTx,buildStellarAddEModeCategoryTx:()=>T.buildStellarAddEModeCategoryTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarConfigureMarketOracleTx:()=>T.buildStellarConfigureMarketOracleTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarDisableTokenOracleTx:()=>T.buildStellarDisableTokenOracleTx,buildStellarEditAssetConfigTx:()=>T.buildStellarEditAssetConfigTx,buildStellarEditAssetInEModeCategoryTx:()=>T.buildStellarEditAssetInEModeCategoryTx,buildStellarEditOracleToleranceTx:()=>T.buildStellarEditOracleToleranceTx,buildStellarExecuteStrategyTx:()=>T.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>T.buildStellarFlashLoanTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>T.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>T.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>T.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>T.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGrantRoleTx:()=>T.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>T.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>T.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>T.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>T.buildStellarMigrateTx,buildStellarMultiplyTx:()=>T.buildStellarMultiplyTx,buildStellarPauseTx:()=>T.buildStellarPauseTx,buildStellarProposeAddAssetToEModeTx:()=>T.buildStellarProposeAddAssetToEModeTx,buildStellarProposeAddEModeCategoryTx:()=>T.buildStellarProposeAddEModeCategoryTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeDisableTokenOracleTx:()=>T.buildStellarProposeDisableTokenOracleTx,buildStellarProposeEditAssetConfigTx:()=>T.buildStellarProposeEditAssetConfigTx,buildStellarProposeEditAssetInEModeTx:()=>T.buildStellarProposeEditAssetInEModeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromEModeTx:()=>T.buildStellarProposeRemoveAssetFromEModeTx,buildStellarProposeRemoveEModeCategoryTx:()=>T.buildStellarProposeRemoveEModeCategoryTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpdatePoolCapsTx:()=>T.buildStellarProposeUpdatePoolCapsTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRemoveAssetFromEModeTx:()=>T.buildStellarRemoveAssetFromEModeTx,buildStellarRemoveEModeCategoryTx:()=>T.buildStellarRemoveEModeCategoryTx,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,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSupplyBatchTx:()=>T.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>T.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>T.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>T.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>T.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>T.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>T.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>T.buildStellarUpdateIndexesTx,buildStellarUpdatePoolCapsTx:()=>T.buildStellarUpdatePoolCapsTx,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarUpgradeLiquidityPoolTx:()=>T.buildStellarUpgradeLiquidityPoolTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeAssetConfigRaw:()=>T.encodeAssetConfigRaw,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,getStellarLendingController:()=>T.getStellarLendingController,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,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 u="https://api.xoxno.com",n="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=u,...o}={}){this.apiUrl=t??{[l.MAINNET]:u,[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:n,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:n,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:u,debug:n,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,y=p?.Authorization,b="Bearer undefined"===y?void 0:y,S={...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:f,...m}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||b?void 0:h??f,_="GET"!==d||b||x?void 0:l??u,q={...a,...c,method:d,...Object.keys(S).length?{headers:S}:{},cache:_,next:{...m,...v,revalidate:x}};(s??n)&&console.debug("SDK fetch: ",T,q);const A=await fetch(T,q).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 A.text();if(!A.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,A.status,A.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 y 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)),S={"/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/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"}},"/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:{}}},"/stellar-lending/assets":{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/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:{}}},g=["PATCH","POST","DELETE","PUT"];var T=o(454);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:u,output:n,...a}=t,i=async(t={})=>{const u={...o,...t},n=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(u).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=u.address;if(!b(e))throw new y(e)}if(s){const e=u.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:S,auth:g,method:T,headers:f,cache:m,next:h,debug:v,continuationToken:x,..._}=d,q=g?`Bearer ${g}`:void 0,A={...f,...q?{Authorization:q}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],n]};return r.fetchWithTimeout(n,{method:T,params:_,body:S,headers:A,cache:m,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=m();for(const[t,o]of Object.entries(S)){const r=t.split("/").filter(Boolean);let u=e;for(const e of r)if(e.startsWith(":")){const t=f(e.slice(1));u=u.params[t]||=m()}else{const t=f(e);u=u.static[t]||=m()}u.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const u=t.leaves.length,n=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===u&&n+a>0){const{rawPath:o,def:u}=t.leaves[0];i=h(o,u,r,e)}else{i={};for(const{rawPath:o,def:u}of t.leaves)i[f(o.split("/").pop().replace(/^:/,""))]=h(o,u,r,e)}for(const[e,u]of Object.entries(t.static)){const t=o(u,r);let n=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),n=o)}void 0===i[e]?i[e]=n:"function"==typeof i[e]?Object.assign(i[e],n):"function"==typeof n?(Object.assign(n,i[e]),i[e]=n):Object.assign(i[e],n)}for(const[e,u]of Object.entries(t.params)){const t=t=>{const n=o(u,{...r,[e]:t});if(n&&"object"==typeof n&&1===Object.keys(n).length&&e in n&&"function"==typeof n[e]){const t=n[e],o=(...e)=>t(...e);return Object.assign(o,t)}return n};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={454(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>u,STELLAR_GOVERNANCE:()=>n,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>it,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>vo,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>qo,XOXNO_LENDING_STELLAR_TICKER:()=>_o,buildSameTokenRepaySwapSteps:()=>Vo,buildStellarAcceptOwnershipTx:()=>Le,buildStellarAddAssetToEModeCategoryTx:()=>Ve,buildStellarAddEModeCategoryTx:()=>De,buildStellarAddRewardsTx:()=>nt,buildStellarApproveTokenTx:()=>Fe,buildStellarBatchSwapTx:()=>Lo,buildStellarBorrowBatchTx:()=>B,buildStellarBorrowTx:()=>G,buildStellarCctpForwardTx:()=>Ho,buildStellarClaimRevenueTx:()=>ut,buildStellarConfigureMarketOracleTx:()=>Ze,buildStellarCreateLiquidityPoolTx:()=>tt,buildStellarDisableTokenOracleTx:()=>Je,buildStellarEditAssetConfigTx:()=>Ne,buildStellarEditAssetInEModeCategoryTx:()=>je,buildStellarEditOracleToleranceTx:()=>Ke,buildStellarExecuteStrategyTx:()=>Co,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Ft,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Zt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Kt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Jt,buildStellarGovernanceExecuteTx:()=>Xt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Qt,buildStellarGrantRoleTx:()=>Me,buildStellarLendingIdentifier:()=>Ao,buildStellarLiquidateTx:()=>W,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Re,buildStellarMultiplyTx:()=>H,buildStellarPauseTx:()=>ke,buildStellarProposeAddAssetToEModeTx:()=>qt,buildStellarProposeAddEModeCategoryTx:()=>xt,buildStellarProposeApproveBlendPoolTx:()=>kt,buildStellarProposeApproveTokenTx:()=>Et,buildStellarProposeConfigureMarketOracleTx:()=>$t,buildStellarProposeCreateLiquidityPoolTx:()=>Mt,buildStellarProposeDeployPoolTx:()=>Ct,buildStellarProposeDisableTokenOracleTx:()=>Ut,buildStellarProposeEditAssetConfigTx:()=>mt,buildStellarProposeEditAssetInEModeTx:()=>At,buildStellarProposeEditOracleToleranceTx:()=>Dt,buildStellarProposeGovernanceUpgradeTx:()=>zt,buildStellarProposeGrantGovernanceRoleTx:()=>Vt,buildStellarProposeMigrateControllerTx:()=>Gt,buildStellarProposeRemoveAssetFromEModeTx:()=>Pt,buildStellarProposeRemoveEModeCategoryTx:()=>_t,buildStellarProposeRevokeBlendPoolTx:()=>Ot,buildStellarProposeRevokeGovernanceRoleTx:()=>jt,buildStellarProposeRevokeTokenTx:()=>Rt,buildStellarProposeSetAccumulatorTx:()=>Tt,buildStellarProposeSetAggregatorTx:()=>gt,buildStellarProposeSetMinBorrowCollatTx:()=>vt,buildStellarProposeSetPoolTemplateTx:()=>ft,buildStellarProposeSetPositionLimitsTx:()=>ht,buildStellarProposeTransferCtrlOwnershipTx:()=>Nt,buildStellarProposeTransferGovOwnTx:()=>Ht,buildStellarProposeUpdateDelayTx:()=>Wt,buildStellarProposeUpdatePoolCapsTx:()=>wt,buildStellarProposeUpgradeControllerTx:()=>Bt,buildStellarProposeUpgradePoolParamsTx:()=>It,buildStellarProposeUpgradePoolTx:()=>Lt,buildStellarRemoveAssetFromEModeTx:()=>Xe,buildStellarRemoveEModeCategoryTx:()=>ze,buildStellarRenewAccountTx:()=>et,buildStellarRepayBatchTx:()=>D,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ie,buildStellarRevokeTokenTx:()=>Qe,buildStellarSetAccumulatorTx:()=>Be,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ge,buildStellarSetPositionLimitsTx:()=>$e,buildStellarSupplyBatchTx:()=>L,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>F,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ce,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>at,buildStellarUpdateIndexesTx:()=>Ye,buildStellarUpdatePoolCapsTx:()=>He,buildStellarUpgradeControllerTx:()=>Ee,buildStellarUpgradeLiquidityPoolParamsTx:()=>ot,buildStellarUpgradeLiquidityPoolTx:()=>rt,buildStellarWithdrawBatchTx:()=>N,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>xo,encodeAssetConfigRaw:()=>xe,encodeInterestRateModel:()=>he,encodeMarketOracleConfigInput:()=>Pe,encodeMarketParamsRaw:()=>ve,encodeOracleSourceConfigInput:()=>we,encodePositionLimits:()=>_e,encodeStrategyPayloadToRouteXdr:()=>Io,extractEventOrder:()=>wo,getStellarAccountPositions:()=>ce,getStellarAggregatorQuote:()=>Oo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ne,getStellarAssetGraph:()=>be,getStellarAssetMarkets:()=>ie,getStellarAssetPage:()=>ae,getStellarAssets:()=>Y,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ye,getStellarHub:()=>le,getStellarHubGraph:()=>Se,getStellarHubs:()=>ee,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>Mo,getStellarReserve:()=>re,getStellarReserveGraph:()=>Te,getStellarReserveHolders:()=>ue,getStellarReserves:()=>oe,getStellarSpoke:()=>se,getStellarSpokeGraph:()=>ge,getStellarSpokes:()=>te,getStellarUserActivity:()=>de,getStellarUserPositions:()=>pe,mapQuoteResponseToAggregatorSwap:()=>Go,mapQuoteResponseToStrategyPayload:()=>Uo,mapQuoteResponseToStrategySwap:()=>Bo,mapStellarPositionActivityType:()=>Eo,prepareStellarBuiltTx:()=>zo,prepareStellarTxXdr:()=>Do,stellarLendingDispatchKey:()=>to,stellarLendingRead:()=>fe,syntheticEventOrder:()=>Po,tagStellarInvokedContractError:()=>$o,toBase64Xdr:()=>Yt,toStellarPositionMode:()=>Wo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},u={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},n={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=u[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=n[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"),y=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new c.Address(e).toScVal(),S=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(),f=e=>c.xdr.ScVal.scvBool(e),m=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),_=(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)},q=(e,t)=>null==e?v():t(e),A=(e,t)=>E({asset:b(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([A(e,t),S(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),E=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 E({amount_out:S(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 E({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return E({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:S(e.totalMinOut)})},k=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=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 k(O(e));if(e instanceof Uint8Array)return k(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?k(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?k(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?k(O(e.bytes)):k(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||!y.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)")},I=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),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function L(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[b(e.caller),T(o),g(r),P([...t.assets])])}function U(e,t){return L(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function B(e,t){return C(e,"borrow",[b(e.caller),T(t.accountNonce),P([...t.borrows]),q(t.to,b)])}function G(e,t){return B(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function N(e,t){return C(e,"withdraw",[b(e.caller),T(t.accountNonce),P([...t.withdrawals]),q(t.to,b)])}function $(e,t){return N(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return C(e,"repay",[b(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return D(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function W(e,t){return C(e,"liquidate",[b(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[b(e.caller),A(t.hubId,t.asset),S(t.amount),b(t.receiver),I(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)),(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([b(t),S(o)]);var t,o}))))]);var o}function H(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"multiply",[b(e.caller),T(o),g(r),A(t.collateral.hubId,t.collateral.asset),S(t.debtToFlashLoan),A(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),q(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),q(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[b(e.caller),T(t.accountNonce),A(t.existingDebt.hubId,t.existingDebt.asset),S(t.newDebtAmount),A(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function F(e,t){return C(e,"swap_collateral",[b(e.caller),T(t.accountNonce),A(t.current.hubId,t.current.asset),S(t.fromAmount),A(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Q(e,t){return C(e,"repay_debt_with_collateral",[b(e.caller),T(t.accountNonce),A(t.collateral.hubId,t.collateral.asset),S(t.collateralAmount),A(t.debt.hubId,t.debt.asset),M(t.steps),f(t.closePosition)])}const Z="/stellar-lending",K=25,J=encodeURIComponent,Y=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),ee=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),oe=(e,t={},o)=>{const{hubId:r,spokeId:u,asset:n}=t;return e.fetchWithTimeout(`${Z}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==u?{spokeId:u}:{},...n?{asset:n}:{}}})},re=(e,t,o,r,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}`,u),ue=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/holders`,{...n,params:{side:u}}),ne=(e,t,o)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}`,o),ae=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/page`,{...r,params:{...o}}),ie=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...r,params:{side:o}}),le=(e,t,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,o),se=(e,t,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,o),pe=(e,t,o)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,o),de=(e,t,o={},r)=>{const{skip:u,top:n}=o;return e.fetchWithTimeout(`${Z}/users/${J(t)}/activity`,{...r,params:{...void 0!==u?{skip:u}:{},...void 0!==n?{top:n}:{}}})},ce=(e,t,o)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,o),ye=(e,t={},o)=>{const{top:r=K,continuationToken:u}=t;return e.fetchWithTimeout(`${Z}/governance/proposals`,{...o,params:{top:r,...u?{continuationToken:u}:{}}})},be=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/graph`,{...r,params:{...o}}),Se=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...r,params:{...o}}),ge=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...r,params:{...o}}),Te=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/graph`,{...n,params:{...u}}),fe=e=>({assets:t=>Y(e,t),hubs:t=>ee(e,t),spokes:t=>te(e,t),reserves:(t,o)=>oe(e,t,o),reserve:(t,o,r,u)=>re(e,t,o,r,u),reserveHolders:(t,o,r,u,n)=>ue(e,t,o,r,u,n),asset:(t,o)=>ne(e,t,o),assetMarkets:(t,o,r)=>ie(e,t,o,r),hub:(t,o)=>le(e,t,o),spoke:(t,o)=>se(e,t,o),userPositions:(t,o)=>pe(e,t,o),userActivity:(t,o,r)=>de(e,t,o,r),accountPositions:(t,o)=>ce(e,t,o),governanceProposals:(t,o)=>ye(e,t,o),assetGraph:(t,o,r)=>be(e,t,o,r),hubGraph:(t,o,r)=>Se(e,t,o,r),spokeGraph:(t,o,r)=>ge(e,t,o,r),reserveGraph:(t,o,r,u,n)=>Te(e,t,o,r,u,n)}),me={Single:0,PrimaryWithAnchor:1},he=e=>E({base_borrow_rate_ray:S(e.baseBorrowRateRay),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray)}),ve=e=>E({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate_ray:S(e.baseBorrowRateRay),borrow_cap:S(e.borrowCap),max_borrow_rate_ray:S(e.maxBorrowRateRay),max_utilization_ray:S(e.maxUtilizationRay),mid_utilization_ray:S(e.midUtilizationRay),optimal_utilization_ray:S(e.optimalUtilizationRay),reserve_factor_bps:g(e.reserveFactorBps),slope1_ray:S(e.slope1Ray),slope2_ray:S(e.slope2Ray),slope3_ray:S(e.slope3Ray),supply_cap:S(e.supplyCap)}),xe=e=>E({asset_decimals:g(0),e_mode_categories:x(e.eModeCategories.map((e=>g(e)))),flashloan_fee_bps:g(e.flashloanFeeBps),is_borrowable:f(e.isBorrowable),is_collateralizable:f(e.isCollateralizable),is_flashloanable:f(e.isFlashloanable),liquidation_bonus_bps:g(e.liquidationBonusBps),liquidation_fees_bps:g(e.liquidationFeesBps),liquidation_threshold_bps:g(e.liquidationThresholdBps),loan_to_value_bps:g(e.loanToValueBps)}),_e=e=>E({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),qe=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),b(e.value)]);case"Symbol":return x([h("Symbol"),h(e.value)]);case"String":return x([h("String"),m(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Ae=(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")])},we=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"),E({asset:qe(e.asset),contract:b(e.contract),read_mode:Ae(e.readMode,e.twapRecords)})])}if("RedStonePriceFeed"===t){if("string"!=typeof e.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof e.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return x([h("RedStone"),E({contract:b(e.contract),feed_id:m(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Pe=e=>{const t=me[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return E({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),we(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:S(e.maxSanityPriceWad),min_sanity_price_wad:S(e.minSanityPriceWad),primary:we(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ee(e,t){return C(e,"upgrade",[_(t.wasmHash)])}function Re(e,t){return C(e,"migrate",[g(t.newVersion)])}function ke(e){return C(e,"pause",[])}function Oe(e){return C(e,"unpause",[])}function Me(e,t){return C(e,"grant_role",[b(t.account),h(t.role)])}function Ie(e,t){return C(e,"revoke_role",[b(t.account),h(t.role)])}function Ce(e,t){return C(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function Le(e){return C(e,"accept_ownership",[])}function Ue(e,t){return C(e,"set_aggregator",[b(t.aggregator)])}function Be(e,t){return C(e,"set_accumulator",[b(t.accumulator)])}function Ge(e,t){return C(e,"set_liquidity_pool_template",[_(t.wasmHash)])}function Ne(e,t){return C(e,"edit_asset_config",[b(t.asset),xe(t.config)])}function $e(e,t){return C(e,"set_position_limits",[_e(t)])}function De(e){return C(e,"add_e_mode_category",[])}function ze(e,t){return C(e,"remove_e_mode_category",[g(t.id)])}const We=e=>E({asset:b(e.asset),category_id:g(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)});function Ve(e,t){return C(e,"add_asset_to_e_mode_category",[We(t)])}function je(e,t){return C(e,"edit_asset_in_e_mode_category",[We(t)])}function He(e,t){return C(e,"update_pool_caps",[b(t.asset),S(t.supplyCap),S(t.borrowCap)])}function Xe(e,t){return C(e,"remove_asset_from_e_mode",[b(t.asset),g(t.categoryId)])}function Fe(e,t){return C(e,"approve_token",[b(t.token)])}function Qe(e,t){return C(e,"revoke_token",[b(t.token)])}function Ze(e,t){return C(e,"configure_market_oracle",[b(e.caller),b(t.asset),Pe(t.config)])}function Ke(e,t){return C(e,"edit_oracle_tolerance",[b(e.caller),b(t.asset),g(t.tolerance)])}function Je(e,t){return C(e,"disable_token_oracle",[b(e.caller),b(t.asset)])}function Ye(e,t){return C(e,"update_indexes",[b(e.caller),x(t.assets.map((e=>b(e))))])}function et(e,t){return C(e,"renew_account",[b(e.caller),T(t.accountNonce)])}function tt(e,t){return C(e,"create_liquidity_pool",[b(t.asset),ve(t.params),xe(t.config)])}function ot(e,t){return C(e,"upgrade_liquidity_pool_params",[b(t.asset),he(t.params)])}function rt(e,t){return C(e,"upgrade_liquidity_pool",[b(t.asset),_(t.wasmHash)])}function ut(e,t){return C(e,"claim_revenue",[b(e.caller),x(t.assets.map((e=>b(e))))])}function nt(e,t){return C(e,"add_rewards",[b(e.caller),x(t.rewards.map((e=>x([b(e.token),S(e.amount)]))))])}function at(e,t){return C(e,"update_account_threshold",[b(e.caller),b(t.asset),f(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const it="00".repeat(32),lt=e=>{if("string"==typeof e)return _(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)},st=(e,...t)=>x([h(e),...t]),pt=e=>E({asset:b(e.asset),category_id:g(e.categoryId),can_collateral:f(e.canCollateral),can_borrow:f(e.canBorrow),ltv:g(e.ltv),threshold:g(e.threshold),bonus:g(e.bonus),supply_cap:S(e.supplyCap),borrow_cap:S(e.borrowCap)}),dt=e=>E({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ct=e=>E({account:b(e.account),role:h(e.role)});function yt(e,t,o){const r=e.governanceAddress??d(e.network),u=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(u.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const bt=(e,t,o)=>yt(e,"propose",[b(e.caller),t,lt(o)]),St=(e,t,o)=>yt(e,"execute_self",[v(),t,lt(o)]);function gt(e,t,o){return bt(e,st("SetAggregator",b(t.aggregator)),o)}function Tt(e,t,o){return bt(e,st("SetAccumulator",b(t.accumulator)),o)}function ft(e,t,o){return bt(e,st("SetLiquidityPoolTemplate",_(t.wasmHash)),o)}function mt(e,t,o){return bt(e,st("EditAssetConfig",b(t.asset),xe(t.config)),o)}function ht(e,t,o){return bt(e,st("SetPositionLimits",_e(t)),o)}function vt(e,t,o){return bt(e,st("SetMinBorrowCollateralUsd",S(t.floorWad)),o)}function xt(e,t){return bt(e,st("AddEModeCategory"),t)}function _t(e,t,o){return bt(e,st("RemoveEModeCategory",g(t.id)),o)}function qt(e,t,o){return bt(e,st("AddAssetToEModeCategory",pt(t)),o)}function At(e,t,o){return bt(e,st("EditAssetInEModeCategory",pt(t)),o)}function wt(e,t,o){return bt(e,st("UpdatePoolCaps",E({asset:b((r=t).asset),supply_cap:S(r.supplyCap),borrow_cap:S(r.borrowCap)})),o);var r}function Pt(e,t,o){return bt(e,st("RemoveAssetFromEMode",E({asset:b((r=t).asset),category_id:g(r.categoryId)})),o);var r}function Et(e,t,o){return bt(e,st("ApproveToken",b(t.token)),o)}function Rt(e,t,o){return bt(e,st("RevokeToken",b(t.token)),o)}function kt(e,t,o){return bt(e,st("ApproveBlendPool",b(t.pool)),o)}function Ot(e,t,o){return bt(e,st("RevokeBlendPool",b(t.pool)),o)}function Mt(e,t,o){return bt(e,st("CreateLiquidityPool",E({asset:b((r=t).asset),params:ve(r.params),config:xe(r.config)})),o);var r}function It(e,t,o){return bt(e,st("UpgradeLiquidityPoolParams",E({asset:b((r=t).asset),params:he(r.params)})),o);var r}function Ct(e,t){return bt(e,st("DeployPool"),t)}function Lt(e,t,o){return bt(e,st("UpgradePool",_(t.wasmHash)),o)}function Ut(e,t,o){return bt(e,st("DisableTokenOracle",b(t.asset)),o)}function Bt(e,t,o){return bt(e,st("UpgradeController",_(t.wasmHash)),o)}function Gt(e,t,o){return bt(e,st("MigrateController",g(t.newVersion)),o)}function Nt(e,t,o){return bt(e,st("TransferCtrlOwnership",dt(t)),o)}function $t(e,t,o){return bt(e,st("ConfigureMarketOracle",E({asset:b((r=t).asset),cfg:Pe(r.config)})),o);var r}function Dt(e,t,o){return bt(e,st("EditOracleTolerance",E({asset:b((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function zt(e,t,o){return bt(e,st("UpgradeGov",_(t.wasmHash)),o)}function Wt(e,t,o){return bt(e,st("UpdateGovDelay",g(t.newDelay)),o)}function Vt(e,t,o){return bt(e,st("GrantGovRole",ct(t)),o)}function jt(e,t,o){return bt(e,st("RevokeGovRole",ct(t)),o)}function Ht(e,t,o){return bt(e,st("TransferGovOwnership",dt(t)),o)}function Xt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=lt(t.predecessor??it);return yt(e,"execute",[v(),b(t.target),h(t.functionName),o,r,lt(t.salt)])}function Ft(e,t,o){return St(e,st("UpgradeGov",_(t.wasmHash)),o)}function Qt(e,t,o){return St(e,st("UpdateGovDelay",g(t.newDelay)),o)}function Zt(e,t,o){return St(e,st("GrantGovRole",ct(t)),o)}function Kt(e,t,o){return St(e,st("RevokeGovRole",ct(t)),o)}function Jt(e,t,o){return St(e,st("TransferGovOwnership",dt(t)),o)}const Yt=e=>e.toXDR("base64"),eo=e=>c.xdr.ScVal.fromXDR(e,"base64"),to=e=>e.map((e=>String((0,c.scValToNative)(eo(e))))).join(":"),oo=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),ro=e=>Number(e),uo=e=>String(e),no=e=>null==e?void 0:oo(e),ao=e=>null==e?void 0:uo(e),io=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),lo=["None","Multiply","Long","Short"],so=["Single","PrimaryWithAnchor"],po=["ReflectorSep40","RedStonePriceFeed"],co=["Spot","Twap"],yo=["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"],bo=e=>Array.isArray(e)?e:[],So=e=>({loanToValueBps:ro(e.loan_to_value_bps),liquidationThresholdBps:ro(e.liquidation_threshold_bps),liquidationBonusBps:ro(e.liquidation_bonus_bps),liquidationFeesBps:ro(e.liquidation_fees_bps),isCollateralizable:Boolean(e.is_collateralizable),isBorrowable:Boolean(e.is_borrowable),isFlashloanable:Boolean(e.is_flashloanable),flashloanFeeBps:ro(e.flashloan_fee_bps),eModeCategories:(e.e_mode_categories??[]).map(ro)}),go=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],yo[ro(r)]??oo(r)),positionType:t,asset:uo(e[1]),scaledAmountRay:oo(e[2]),indexRay:oo(e[3]),amount:oo(e[4]),liquidationThresholdBps:o?void 0:ro(e[5]),liquidationBonusBps:o?void 0:ro(e[6]),loanToValueBps:o?void 0:ro(e[7])};var r},To=e=>{return{owner:uo(e[0]),eModeCategoryId:ro(e[1]),mode:(t=e[2],lo[ro(t)]??"None")};var t},fo=(e,t)=>{const o=co[ro(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],u=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:uo(r)}:null!=u?{kind:"Symbol",value:uo(u)}:void 0;return{provider:po[ro(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:uo(e[`${t}_contract`]),asset:n,feedId:ao(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?ro(e[`${t}_twap_records`]):void 0,decimals:ro(e[`${t}_decimals`]),resolutionSeconds:ro(e[`${t}_resolution_seconds`]),maxStaleSeconds:ro(e[`${t}_max_stale_seconds`])}},mo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:uo(e.base_token_id),quoteTokenId:uo(e.quote_token_id),tolerance:{upperRatio:ro(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:ro(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:ro(e.asset_decimals),maxPriceStaleSeconds:ro(e.max_price_stale_seconds),strategy:so[ro(e.strategy)]??"Single",primary:fo(e,"primary"),anchor:t?fo(e,"anchor"):void 0,primaryQuoteToken:ao(e.primary_quote_token),anchorQuoteToken:ao(e.anchor_quote_token),minSanityPriceWad:no(e.min_sanity_price_wad),maxSanityPriceWad:no(e.max_sanity_price_wad)}},ho={"market:create":e=>({topic:"market:create",data:{baseAsset:uo(e.base_asset),maxBorrowRate:oo(e.max_borrow_rate),baseBorrowRate:oo(e.base_borrow_rate),slope1:oo(e.slope1),slope2:oo(e.slope2),slope3:oo(e.slope3),midUtilization:oo(e.mid_utilization),optimalUtilization:oo(e.optimal_utilization),maxUtilization:no(e.max_utilization),reserveFactor:ro(e.reserve_factor),marketAddress:uo(e.market_address),config:So(e.config)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:uo(e.asset),maxBorrowRateRay:oo(e.max_borrow_rate_ray),baseBorrowRateRay:oo(e.base_borrow_rate_ray),slope1Ray:oo(e.slope1_ray),slope2Ray:oo(e.slope2_ray),slope3Ray:oo(e.slope3_ray),midUtilizationRay:oo(e.mid_utilization_ray),optimalUtilizationRay:oo(e.optimal_utilization_ray),maxUtilizationRay:no(e.max_utilization_ray),reserveFactorBps:ro(e.reserve_factor_bps)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:bo(e).map((e=>{return t=bo(e),{asset:uo(t[0]),timestamp:ro(t[1]),supplyIndexRay:oo(t[2]),borrowIndexRay:oo(t[3]),reservesRay:oo(t[4]),suppliedRay:oo(t[5]),borrowedRay:oo(t[6]),revenueRay:oo(t[7]),assetPriceWad:no(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:bo(e).map((e=>{const t=e;return{asset:uo(t.asset),params:(o=t.params,{maxBorrowRateRay:oo(o.max_borrow_rate_ray),baseBorrowRateRay:oo(o.base_borrow_rate_ray),slope1Ray:oo(o.slope1_ray),slope2Ray:oo(o.slope2_ray),slope3Ray:oo(o.slope3_ray),midUtilizationRay:oo(o.mid_utilization_ray),optimalUtilizationRay:oo(o.optimal_utilization_ray),maxUtilizationRay:no(o.max_utilization_ray),reserveFactorBps:ro(o.reserve_factor_bps),supplyCap:oo(o.supply_cap),borrowCap:oo(o.borrow_cap),assetId:ao(o.asset_id),assetDecimals:void 0===o.asset_decimals?void 0:ro(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=bo(e);return{topic:"position:batch_update",data:{accountId:oo(t[0]),accountAttributes:To(bo(t[1])),updates:[...bo(t[2]).map((e=>go(bo(e),"Deposit"))),...bo(t[3]).map((e=>go(bo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{asset:uo(e.asset),receiver:uo(e.receiver),caller:uo(e.caller),amount:oo(e.amount),fee:oo(e.fee)}}),"config:asset":e=>({topic:"config:asset",data:{asset:uo(e.asset),config:So(e.config)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:uo(e.asset),oracle:mo(e.oracle)}}),"config:emode_category":e=>({topic:"config:emode_category",data:{category:{categoryId:ro(e.category.category_id),isDeprecated:Boolean(e.category.is_deprecated)}}}),"config:emode_asset":e=>({topic:"config:emode_asset",data:{asset:uo(e.asset),config:{isCollateralizable:Boolean(e.config.is_collateralizable),isBorrowable:Boolean(e.config.is_borrowable),loanToValueBps:ro(e.config.loan_to_value_bps),liquidationThresholdBps:ro(e.config.liquidation_threshold_bps),liquidationBonusBps:ro(e.config.liquidation_bonus_bps),supplyCap:oo(e.config.supply_cap),borrowCap:oo(e.config.borrow_cap)},categoryId:ro(e.category_id)}}),"config:remove_emode_asset":e=>({topic:"config:remove_emode_asset",data:{asset:uo(e.asset),categoryId:ro(e.category_id)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:oo(e.account_id),totalBorrowUsdWad:oo(e.total_borrow_usd_wad),totalCollateralUsdWad:oo(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:uo(e.token),amount:oo(e.amount),usdValueWad:oo(e.usd_value_wad),accountId:oo(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{asset:uo(e.asset),amount:oo(e.amount),fee:oo(e.fee),amountSent:oo(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:io(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:uo(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:uo(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:io(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:ro(e.max_supply_positions),maxBorrowPositions:ro(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:uo(e.asset)}})},vo=Object.freeze(Object.keys(ho));function xo(e,t){const o=to(e),r=ho[o];return r?r((0,c.scValToNative)(eo(t))):null}const _o="XLENDXLM-a7c9f3",qo=1e4;function Ao(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${_o}-${o}`}function wo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Po(e,t=0){return e*qo+t}function Eo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Ro=(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()},ko=e=>e.baseUrl??i[e.network];async function Oo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Ro(ko(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 Mo(e){const t=Ro(ko(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 Io=e=>R(e).toXDR("base64");function Co(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence),n=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(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",b(e.caller),S(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Lo(e,t){return Co(e,t)}function Uo(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(No),splitPpm:e.splitPpm}))):[{hops:e.hops.map(No),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Bo(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Uo(e,t)}const Go=Uo,No=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function $o(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Do(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw $o(o.invokedContractId,e);throw e}}async function zo(e,t,o){return Do(e,t.xdr,o)}function Wo(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 Vo(e,t){return{paths:[{hops:[{amountOut:"0",pool:e,tokenIn:e,tokenOut:e,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:e,tokenOut:e,totalMinOut:t}}const jo=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 Ho(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(jo(e.message)),c.xdr.ScVal.scvBytes(jo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}}},t={};function o(r){var u=t[r];if(void 0!==u)return u.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.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,buildStellarAddAssetToEModeCategoryTx:()=>T.buildStellarAddAssetToEModeCategoryTx,buildStellarAddEModeCategoryTx:()=>T.buildStellarAddEModeCategoryTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarConfigureMarketOracleTx:()=>T.buildStellarConfigureMarketOracleTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarDisableTokenOracleTx:()=>T.buildStellarDisableTokenOracleTx,buildStellarEditAssetConfigTx:()=>T.buildStellarEditAssetConfigTx,buildStellarEditAssetInEModeCategoryTx:()=>T.buildStellarEditAssetInEModeCategoryTx,buildStellarEditOracleToleranceTx:()=>T.buildStellarEditOracleToleranceTx,buildStellarExecuteStrategyTx:()=>T.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>T.buildStellarFlashLoanTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>T.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>T.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>T.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>T.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGrantRoleTx:()=>T.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>T.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>T.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>T.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>T.buildStellarMigrateTx,buildStellarMultiplyTx:()=>T.buildStellarMultiplyTx,buildStellarPauseTx:()=>T.buildStellarPauseTx,buildStellarProposeAddAssetToEModeTx:()=>T.buildStellarProposeAddAssetToEModeTx,buildStellarProposeAddEModeCategoryTx:()=>T.buildStellarProposeAddEModeCategoryTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeDisableTokenOracleTx:()=>T.buildStellarProposeDisableTokenOracleTx,buildStellarProposeEditAssetConfigTx:()=>T.buildStellarProposeEditAssetConfigTx,buildStellarProposeEditAssetInEModeTx:()=>T.buildStellarProposeEditAssetInEModeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromEModeTx:()=>T.buildStellarProposeRemoveAssetFromEModeTx,buildStellarProposeRemoveEModeCategoryTx:()=>T.buildStellarProposeRemoveEModeCategoryTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpdatePoolCapsTx:()=>T.buildStellarProposeUpdatePoolCapsTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRemoveAssetFromEModeTx:()=>T.buildStellarRemoveAssetFromEModeTx,buildStellarRemoveEModeCategoryTx:()=>T.buildStellarRemoveEModeCategoryTx,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,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSupplyBatchTx:()=>T.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>T.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>T.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>T.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>T.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>T.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>T.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>T.buildStellarUpdateIndexesTx,buildStellarUpdatePoolCapsTx:()=>T.buildStellarUpdatePoolCapsTx,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarUpgradeLiquidityPoolTx:()=>T.buildStellarUpgradeLiquidityPoolTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeAssetConfigRaw:()=>T.encodeAssetConfigRaw,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,getStellarLendingController:()=>T.getStellarLendingController,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,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 u="https://api.xoxno.com",n="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=u,...o}={}){this.apiUrl=t??{[l.MAINNET]:u,[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:n,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:n,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:u,debug:n,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,y=p?.Authorization,b="Bearer undefined"===y?void 0:y,S={...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:f,...m}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||b?void 0:h??f,_="GET"!==d||b||x?void 0:l??u,q={...a,...c,method:d,...Object.keys(S).length?{headers:S}:{},cache:_,next:{...m,...v,revalidate:x}};(s??n)&&console.debug("SDK fetch: ",T,q);const A=await fetch(T,q).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 A.text();if(!A.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,A.status,A.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 y 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)),S={"/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/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/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(454);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),m=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:u,output:n,...a}=t,i=async(t={})=>{const u={...o,...t},n=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(u).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=u.address;if(!b(e))throw new y(e)}if(s){const e=u.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:S,auth:g,method:T,headers:f,cache:m,next:h,debug:v,continuationToken:x,..._}=d,q=g?`Bearer ${g}`:void 0,A={...f,...q?{Authorization:q}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],n]};return r.fetchWithTimeout(n,{method:T,params:_,body:S,headers:A,cache:m,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=m();for(const[t,o]of Object.entries(S)){const r=t.split("/").filter(Boolean);let u=e;for(const e of r)if(e.startsWith(":")){const t=f(e.slice(1));u=u.params[t]||=m()}else{const t=f(e);u=u.static[t]||=m()}u.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const u=t.leaves.length,n=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===u&&n+a>0){const{rawPath:o,def:u}=t.leaves[0];i=h(o,u,r,e)}else{i={};for(const{rawPath:o,def:u}of t.leaves)i[f(o.split("/").pop().replace(/^:/,""))]=h(o,u,r,e)}for(const[e,u]of Object.entries(t.static)){const t=o(u,r);let n=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),n=o)}void 0===i[e]?i[e]=n:"function"==typeof i[e]?Object.assign(i[e],n):"function"==typeof n?(Object.assign(n,i[e]),i[e]=n):Object.assign(i[e],n)}for(const[e,u]of Object.entries(t.params)){const t=t=>{const n=o(u,{...r,[e]:t});if(n&&"object"==typeof n&&1===Object.keys(n).length&&e in n&&"function"==typeof n[e]){const t=n[e],o=(...e)=>t(...e);return Object.assign(o,t)}return n};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})();