@xoxno/sdk-js 1.0.180 → 1.0.182

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.
@@ -48,6 +48,10 @@ export interface SpokeAssetArgs {
48
48
  asset: string;
49
49
  canCollateral: boolean;
50
50
  canBorrow: boolean;
51
+ /** ADR 0011 per-listing incident flag: blocks supply/borrow/withdraw/repay. */
52
+ paused: boolean;
53
+ /** ADR 0011 per-listing incident flag: blocks new supply/borrow, exits stay live. */
54
+ frozen: boolean;
51
55
  ltv: number;
52
56
  threshold: number;
53
57
  bonus: number;
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:()=>Je,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>po,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>a,STELLAR_SOROBAN_RPC_URL:()=>i,SYNTHETIC_EVENT_ORDER_STRIDE:()=>So,XOXNO_LENDING_STELLAR_TICKER:()=>yo,buildSameTokenRepaySwapSteps:()=>Lo,buildStellarAcceptOwnershipTx:()=>Ce,buildStellarAddRewardsTx:()=>Ze,buildStellarApproveTokenTx:()=>$e,buildStellarBatchSwapTx:()=>_o,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>N,buildStellarCctpForwardTx:()=>Uo,buildStellarClaimRevenueTx:()=>Qe,buildStellarCreateLiquidityPoolTx:()=>Xe,buildStellarDisableTokenOracleTx:()=>He,buildStellarExecuteStrategyTx:()=>Ao,buildStellarFlashLoanTx:()=>H,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Bt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Dt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Wt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>zt,buildStellarGovernanceExecuteTx:()=>Nt,buildStellarGovernanceExecuteUpdateDelayTx:()=>$t,buildStellarGrantRoleTx:()=>Ie,buildStellarLendingIdentifier:()=>bo,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>V,buildStellarMigrateTx:()=>ke,buildStellarMultiplyTx:()=>j,buildStellarPauseTx:()=>Ee,buildStellarProposeAddAssetToSpokeTx:()=>St,buildStellarProposeAddSpokeTx:()=>ct,buildStellarProposeApproveBlendPoolTx:()=>vt,buildStellarProposeApproveTokenTx:()=>mt,buildStellarProposeConfigureMarketOracleTx:()=>Ot,buildStellarProposeCreateHubTx:()=>dt,buildStellarProposeCreateLiquidityPoolTx:()=>qt,buildStellarProposeDeployPoolTx:()=>_t,buildStellarProposeDisableTokenOracleTx:()=>Pt,buildStellarProposeEditAssetInSpokeTx:()=>bt,buildStellarProposeEditOracleToleranceTx:()=>It,buildStellarProposeGovernanceUpgradeTx:()=>Mt,buildStellarProposeGrantGovernanceRoleTx:()=>Ct,buildStellarProposeMigrateControllerTx:()=>kt,buildStellarProposeRemoveAssetFromSpokeTx:()=>gt,buildStellarProposeRemoveSpokeTx:()=>yt,buildStellarProposeRevokeBlendPoolTx:()=>xt,buildStellarProposeRevokeGovernanceRoleTx:()=>Ut,buildStellarProposeRevokeTokenTx:()=>ht,buildStellarProposeSetAccumulatorTx:()=>lt,buildStellarProposeSetAggregatorTx:()=>at,buildStellarProposeSetMinBorrowCollatTx:()=>ft,buildStellarProposeSetPoolTemplateTx:()=>st,buildStellarProposeSetPositionLimitsTx:()=>pt,buildStellarProposeSetPositionManagerTx:()=>Tt,buildStellarProposeTransferCtrlOwnershipTx:()=>Et,buildStellarProposeTransferGovOwnTx:()=>Gt,buildStellarProposeUpdateDelayTx:()=>Lt,buildStellarProposeUpgradeControllerTx:()=>Rt,buildStellarProposeUpgradePoolParamsTx:()=>At,buildStellarProposeUpgradePoolTx:()=>wt,buildStellarRenewAccountTx:()=>je,buildStellarRepayBatchTx:()=>D,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>W,buildStellarRevokeRoleTx:()=>Me,buildStellarRevokeTokenTx:()=>De,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ne,buildStellarSetMarketOracleConfigTx:()=>We,buildStellarSetOracleToleranceTx:()=>ze,buildStellarSetPositionLimitsTx:()=>Be,buildStellarSupplyBatchTx:()=>C,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>F,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Le,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Ke,buildStellarUpdateIndexesTx:()=>Ve,buildStellarUpgradeControllerTx:()=>Re,buildStellarUpgradeLiquidityPoolParamsTx:()=>Fe,buildStellarWithdrawBatchTx:()=>B,buildStellarWithdrawTx:()=>$,buildTx:()=>L,decodeStellarLendingEvent:()=>co,encodeInterestRateModel:()=>ve,encodeMarketOracleConfigInput:()=>Pe,encodeMarketParamsRaw:()=>xe,encodeOracleSourceConfigInput:()=>we,encodePositionLimits:()=>qe,encodeStrategyPayloadToRouteXdr:()=>qo,extractEventOrder:()=>go,getStellarAccountPositions:()=>ye,getStellarAggregatorQuote:()=>vo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ie,getStellarAssetGraph:()=>be,getStellarAssetMarkets:()=>le,getStellarAssetPage:()=>ae,getStellarAssets:()=>ee,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>Se,getStellarHub:()=>se,getStellarHubGraph:()=>ge,getStellarHubs:()=>te,getStellarLendingContext:()=>Y,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>xo,getStellarReserve:()=>ue,getStellarReserveGraph:()=>fe,getStellarReserveHolders:()=>ne,getStellarReserves:()=>re,getStellarSpoke:()=>pe,getStellarSpokeGraph:()=>Te,getStellarSpokes:()=>oe,getStellarUserActivity:()=>ce,getStellarUserPositions:()=>de,mapQuoteResponseToAggregatorSwap:()=>Ro,mapQuoteResponseToStrategyPayload:()=>wo,mapQuoteResponseToStrategySwap:()=>Po,mapStellarPositionActivityType:()=>fo,prepareStellarBuiltTx:()=>Io,prepareStellarTxXdr:()=>Oo,stellarLendingDispatchKey:()=>jt,stellarLendingRead:()=>me,syntheticEventOrder:()=>To,tagStellarInvokedContractError:()=>Eo,toBase64Xdr:()=>Ht,toStellarPositionMode:()=>Mo});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??""},i={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},a={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"],S=e=>new c.Address(e).toScVal(),b=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),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),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>R({asset:S(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([_(e,t),b(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),R=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)},k=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return R({amount_out:b(e.amountOut),pool:S(e.pool),token_in:S(e.tokenIn),token_out:S(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return R({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return R({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in:S(e.tokenIn),token_out:S(e.tokenOut),total_min_out:b(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},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},I=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!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(k(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},M=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 L(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 C(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"supply",[S(e.caller),T(o),g(r),P([...t.assets])])}function U(e,t){return C(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return L(e,"borrow",[S(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,S)])}function N(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function B(e,t){return L(e,"withdraw",[S(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,S)])}function $(e,t){return B(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return L(e,"repay",[S(e.caller),T(t.accountNonce),P([...t.payments])])}function W(e,t){return D(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return L(e,"liquidate",[S(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function H(e,t){return L(e,"flash_loan",[S(e.caller),_(t.hubId,t.asset),b(t.amount),S(t.receiver),M(t.data)])}function V(e,t){return L(e,"migrate_from_blend",[S(e.caller),T(t.accountId),g(t.spokeId),g(t.hubId),S(t.blendPool),x(t.collateralTokens.map(S)),x(t.supplyTokens.map(S)),(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([S(t),b(o)]);var t,o}))))]);var o}function j(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"multiply",[S(e.caller),T(o),g(r),_(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),_(t.debt.hubId,t.debt.asset),g(t.mode),I(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,I)])}function X(e,t){return L(e,"swap_debt",[S(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),I(t.steps)])}function F(e,t){return L(e,"swap_collateral",[S(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),I(t.steps)])}function Q(e,t){return L(e,"repay_debt_with_collateral",[S(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),I(t.steps),f(t.closePosition)])}const Z="/stellar-lending",K=25,J=encodeURIComponent,Y=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),ee=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),re=(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}:{}}})},ue=(e,t,o,r,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}`,u),ne=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/holders`,{...n,params:{side:u}}),ie=(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}}),le=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...r,params:{side:o}}),se=(e,t,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,o),pe=(e,t,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,o),de=(e,t,o)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,o),ce=(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}:{}}})},ye=(e,t,o)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,o),Se=(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}}),ge=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...r,params:{...o}}),Te=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/graph`,{...n,params:{...u}}),me=e=>({context:t=>Y(e,t),assets:t=>ee(e,t),hubs:t=>te(e,t),spokes:t=>oe(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?re(e,t,o):re(e,{},t);var r},reserve:(t,o,r,u)=>ue(e,t,o,r,u),reserveHolders:(t,o,r,u,n)=>ne(e,t,o,r,u,n),asset:(t,o)=>ie(e,t,o),assetMarkets:(t,o,r)=>le(e,t,o,r),hub:(t,o)=>se(e,t,o),spoke:(t,o)=>pe(e,t,o),userPositions:(t,o)=>de(e,t,o),userActivity:(t,o,r)=>ce(e,t,o,r),accountPositions:(t,o)=>ye(e,t,o),governanceProposals:(t,o)=>Se(e,t,o),assetGraph:(t,o,r)=>be(e,t,o,r),hubGraph:(t,o,r)=>ge(e,t,o,r),spokeGraph:(t,o,r)=>Te(e,t,o,r),reserveGraph:(t,o,r,u,n)=>fe(e,t,o,r,u,n)}),he={Single:0,PrimaryWithAnchor:1},ve=e=>R({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),xe=e=>R({asset_decimals:g(e.assetDecimals),asset_id:S(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:f(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),qe=e=>R({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ae=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),S(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}"`)}},_e=(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"),R({asset:Ae(e.asset),contract:S(e.contract),read_mode:_e(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"),R({contract:S(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=he[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return R({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),we(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:we(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Re(e,t){return L(e,"upgrade",[q(t.wasmHash)])}function ke(e,t){return L(e,"migrate",[g(t.newVersion)])}function Ee(e){return L(e,"pause",[])}function Oe(e){return L(e,"unpause",[])}function Ie(e,t){return L(e,"grant_role",[S(t.account),h(t.role)])}function Me(e,t){return L(e,"revoke_role",[S(t.account),h(t.role)])}function Le(e,t){return L(e,"transfer_ownership",[S(t.newOwner),g(t.liveUntilLedger)])}function Ce(e){return L(e,"accept_ownership",[])}function Ue(e,t){return L(e,"set_aggregator",[S(t.aggregator)])}function Ge(e,t){return L(e,"set_accumulator",[S(t.accumulator)])}function Ne(e,t){return L(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function Be(e,t){return L(e,"set_position_limits",[qe(t)])}function $e(e,t){return L(e,"approve_token",[S(t.token)])}function De(e,t){return L(e,"revoke_token",[S(t.token)])}function We(e,t){return L(e,"set_market_oracle_config",[_(t.hubId,t.asset),Pe(t.config)])}function ze(e,t){return L(e,"set_oracle_tolerance",[S(t.asset),R({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function He(e,t){return L(e,"disable_token_oracle",[S(t.asset)])}function Ve(e,t){return L(e,"update_indexes",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function je(e,t){return L(e,"renew_account",[S(e.caller),T(t.accountNonce)])}function Xe(e,t){return L(e,"create_liquidity_pool",[g(t.hubId),S(t.asset),xe(t.params)])}function Fe(e,t){return L(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),ve(t.params)])}function Qe(e,t){return L(e,"claim_revenue",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return L(e,"add_rewards",[S(e.caller),P(t.rewards)])}function Ke(e,t){return L(e,"update_account_threshold",[S(e.caller),f(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const Je="00".repeat(32),Ye=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},et=(e,...t)=>x([h(e),...t]),tt=e=>R({new_owner:S(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ot=e=>R({asset:S(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:f(e.canBorrow),can_collateral:f(e.canCollateral),hub_id:g(e.hubId),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),rt=e=>R({account:S(e.account),role:h(e.role)});function ut(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 nt=(e,t,o)=>ut(e,"propose",[S(e.caller),t,Ye(o)]),it=(e,t,o)=>ut(e,"execute_self",[v(),t,Ye(o)]);function at(e,t,o){return nt(e,et("SetAggregator",S(t.aggregator)),o)}function lt(e,t,o){return nt(e,et("SetAccumulator",S(t.accumulator)),o)}function st(e,t,o){return nt(e,et("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function pt(e,t,o){return nt(e,et("SetPositionLimits",qe(t)),o)}function dt(e,t){return nt(e,et("CreateHub"),t)}function ct(e,t){return nt(e,et("AddSpoke"),t)}function yt(e,t,o){return nt(e,et("RemoveSpoke",g(t.spokeId)),o)}function St(e,t,o){return nt(e,et("AddAssetToSpoke",ot(t)),o)}function bt(e,t,o){return nt(e,et("EditAssetInSpoke",ot(t)),o)}function gt(e,t,o){return nt(e,et("RemoveAssetFromSpoke",R({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function Tt(e,t,o){return nt(e,et("SetPositionManager",S(t.manager),f(t.isActive)),o)}function ft(e,t,o){return nt(e,et("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function mt(e,t,o){return nt(e,et("ApproveToken",S(t.token)),o)}function ht(e,t,o){return nt(e,et("RevokeToken",S(t.token)),o)}function vt(e,t,o){return nt(e,et("ApproveBlendPool",S(t.pool)),o)}function xt(e,t,o){return nt(e,et("RevokeBlendPool",S(t.pool)),o)}function qt(e,t,o){return nt(e,et("CreateLiquidityPool",R({asset:S((r=t).asset),hub_id:g(r.hubId),params:xe(r.params)})),o);var r}function At(e,t,o){return nt(e,et("UpgradeLiquidityPoolParams",R({hub_asset:_((r=t).hubId,r.asset),params:ve(r.params)})),o);var r}function _t(e,t){return nt(e,et("DeployPool"),t)}function wt(e,t,o){return nt(e,et("UpgradePool",q(t.wasmHash)),o)}function Pt(e,t,o){return nt(e,et("DisableTokenOracle",S(t.asset)),o)}function Rt(e,t,o){return nt(e,et("UpgradeController",q(t.wasmHash)),o)}function kt(e,t,o){return nt(e,et("MigrateController",g(t.newVersion)),o)}function Et(e,t,o){return nt(e,et("TransferCtrlOwnership",tt(t)),o)}function Ot(e,t,o){return nt(e,et("ConfigureMarketOracle",R({cfg:Pe((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function It(e,t,o){return nt(e,et("EditOracleTolerance",R({asset:S((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Mt(e,t,o){return nt(e,et("UpgradeGov",q(t.wasmHash)),o)}function Lt(e,t,o){return nt(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Ct(e,t,o){return nt(e,et("GrantGovRole",rt(t)),o)}function Ut(e,t,o){return nt(e,et("RevokeGovRole",rt(t)),o)}function Gt(e,t,o){return nt(e,et("TransferGovOwnership",tt(t)),o)}function Nt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=Ye(t.predecessor??Je);return ut(e,"execute",[v(),S(t.target),h(t.functionName),o,r,Ye(t.salt)])}function Bt(e,t,o){return it(e,et("UpgradeGov",q(t.wasmHash)),o)}function $t(e,t,o){return it(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Dt(e,t,o){return it(e,et("GrantGovRole",rt(t)),o)}function Wt(e,t,o){return it(e,et("RevokeGovRole",rt(t)),o)}function zt(e,t,o){return it(e,et("TransferGovOwnership",tt(t)),o)}const Ht=e=>e.toXDR("base64"),Vt=e=>c.xdr.ScVal.fromXDR(e,"base64"),jt=e=>e.map((e=>String((0,c.scValToNative)(Vt(e))))).join(":"),Xt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Ft=e=>Number(e),Qt=e=>String(e),Zt=e=>null==e?void 0:Xt(e),Kt=e=>null==e?void 0:Qt(e),Jt=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Yt=["None","Multiply","Long","Short"],eo=["Single","PrimaryWithAnchor"],to=["ReflectorSep40","RedStonePriceFeed"],oo=["Spot","Twap"],ro=["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"],uo=e=>Array.isArray(e)?e:[],no=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],ro[Ft(r)]??Xt(r)),positionType:t,hubId:Ft(e[1]),asset:Qt(e[2]),scaledAmountRay:Xt(e[3]),indexRay:Xt(e[4]),amount:Xt(e[5]),liquidationThresholdBps:o?void 0:Ft(e[6]),liquidationBonusBps:o?void 0:Ft(e[7]),loanToValueBps:o?void 0:Ft(e[8]),liquidationFeesBps:o?void 0:Ft(e[9])};var r},io=e=>{return{owner:Qt(e[0]),spokeId:Ft(e[1]),mode:(t=e[2],Yt[Ft(t)]??"None")};var t},ao=(e,t)=>{const o=oo[Ft(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],u=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:Qt(r)}:null!=u?{kind:"Symbol",value:Qt(u)}:void 0;return{provider:to[Ft(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Qt(e[`${t}_contract`]),asset:n,feedId:Kt(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Ft(e[`${t}_twap_records`]):void 0,decimals:Ft(e[`${t}_decimals`]),resolutionSeconds:Ft(e[`${t}_resolution_seconds`]),maxStaleSeconds:Ft(e[`${t}_max_stale_seconds`])}},lo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Qt(e.base_token_id),quoteTokenId:Qt(e.quote_token_id),tolerance:{upperRatio:Ft(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Ft(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Ft(e.asset_decimals),maxPriceStaleSeconds:Ft(e.max_price_stale_seconds),strategy:eo[Ft(e.strategy)]??"Single",primary:ao(e,"primary"),anchor:t?ao(e,"anchor"):void 0,primaryQuoteToken:Kt(e.primary_quote_token),anchorQuoteToken:Kt(e.anchor_quote_token),minSanityPriceWad:Zt(e.min_sanity_price_wad),maxSanityPriceWad:Zt(e.max_sanity_price_wad)}},so={"market:create":e=>({topic:"market:create",data:{hubId:Ft(e.hub_id),baseAsset:Qt(e.base_asset),maxBorrowRate:Xt(e.max_borrow_rate),baseBorrowRate:Xt(e.base_borrow_rate),slope1:Xt(e.slope1),slope2:Xt(e.slope2),slope3:Xt(e.slope3),midUtilization:Xt(e.mid_utilization),optimalUtilization:Xt(e.optimal_utilization),maxUtilization:Xt(e.max_utilization),reserveFactor:Ft(e.reserve_factor),marketAddress:Qt(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Qt(e.asset),maxBorrowRateRay:Xt(e.max_borrow_rate),baseBorrowRateRay:Xt(e.base_borrow_rate),slope1Ray:Xt(e.slope1),slope2Ray:Xt(e.slope2),slope3Ray:Xt(e.slope3),midUtilizationRay:Xt(e.mid_utilization),optimalUtilizationRay:Xt(e.optimal_utilization),maxUtilizationRay:Xt(e.max_utilization),reserveFactorBps:Ft(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:uo(e).map((e=>{return t=uo(e),{hubId:Ft(t[0]),asset:Qt(t[1]),timestamp:Ft(t[2]),supplyIndexRay:Xt(t[3]),borrowIndexRay:Xt(t[4]),cash:Xt(t[5]),suppliedRay:Xt(t[6]),borrowedRay:Xt(t[7]),revenueRay:Xt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:uo(e).map((e=>{const t=e;return{hubId:Ft(t.hub_id),asset:Qt(t.asset),params:(o=t.params,{maxBorrowRateRay:Xt(o.max_borrow_rate),baseBorrowRateRay:Xt(o.base_borrow_rate),slope1Ray:Xt(o.slope1),slope2Ray:Xt(o.slope2),slope3Ray:Xt(o.slope3),midUtilizationRay:Xt(o.mid_utilization),optimalUtilizationRay:Xt(o.optimal_utilization),maxUtilizationRay:Xt(o.max_utilization),reserveFactorBps:Ft(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Ft(o.flashloan_fee),assetId:Qt(o.asset_id),assetDecimals:Ft(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=uo(e);return{topic:"position:batch_update",data:{accountId:Xt(t[0]),accountAttributes:io(uo(t[1])),updates:[...uo(t[2]).map((e=>no(uo(e),"Deposit"))),...uo(t[3]).map((e=>no(uo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Ft(e.hub_id),asset:Qt(e.asset),receiver:Qt(e.receiver),caller:Qt(e.caller),amount:Xt(e.amount),fee:Xt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Qt(e.asset),oracle:lo(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Qt(e.liquidator),accountId:Xt(e.account_id),repaidUsdWad:Xt(e.repaid_usd_wad),bonusBps:Xt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Xt(e.account_id),totalBorrowUsdWad:Xt(e.total_borrow_usd_wad),totalCollateralUsdWad:Xt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Qt(e.token),amount:Xt(e.amount),usdValueWad:Xt(e.usd_value_wad),accountId:Xt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Ft(e.hub_id),asset:Qt(e.asset),amount:Xt(e.amount),fee:Xt(e.fee),amountSent:Xt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:Jt(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Qt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Qt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Jt(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Ft(e.max_supply_positions),maxBorrowPositions:Ft(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Qt(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Ft(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Xt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Xt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Ft(t.liquidation_bonus_factor_bps)}}}},po=Object.freeze(Object.keys(so));function co(e,t){const o=jt(e),r=so[o];return r?r((0,c.scValToNative)(Vt(t))):null}const yo="XLENDXLM-a7c9f3",So=1e4;function bo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${yo}-${o}`}function go(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function To(e,t=0){return e*So+t}function fo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const mo=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},ho=e=>e.baseUrl??a[e.network];async function vo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=mo(ho(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 xo(e){const t=mo(ho(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 qo=e=>k(e).toXDR("base64");function Ao(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence),n=I(((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",S(e.caller),b(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function _o(e,t){return Ao(e,t)}function wo(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(ko),splitPpm:e.splitPpm}))):[{hops:e.hops.map(ko),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Po(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:wo(e,t)}const Ro=wo,ko=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Eo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Oo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Eo(o.invokedContractId,e);throw e}}async function Io(e,t,o){return Oo(e,t.xdr,o)}function Mo(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 Lo(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 Co=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 Uo(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(Co(e.message)),c.xdr.ScVal.scvBytes(Co(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,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarDisableTokenOracleTx:()=>T.buildStellarDisableTokenOracleTx,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,buildStellarProposeAddAssetToSpokeTx:()=>T.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>T.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>T.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeDisableTokenOracleTx:()=>T.buildStellarProposeDisableTokenOracleTx,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>T.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>T.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>T.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>T.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>T.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,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,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>T.encodeOracleSourceConfigInput,encodePositionLimits:()=>T.encodePositionLimits,encodeStrategyPayloadToRouteXdr:()=>T.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>T.extractEventOrder,getStellarAccountPositions:()=>T.getStellarAccountPositions,getStellarAggregatorQuote:()=>T.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>T.getStellarAggregatorRouter,getStellarAsset:()=>T.getStellarAsset,getStellarAssetGraph:()=>T.getStellarAssetGraph,getStellarAssetMarkets:()=>T.getStellarAssetMarkets,getStellarAssetPage:()=>T.getStellarAssetPage,getStellarAssets:()=>T.getStellarAssets,getStellarGovernance:()=>T.getStellarGovernance,getStellarGovernanceProposals:()=>T.getStellarGovernanceProposals,getStellarHub:()=>T.getStellarHub,getStellarHubGraph:()=>T.getStellarHubGraph,getStellarHubs:()=>T.getStellarHubs,getStellarLendingContext:()=>T.getStellarLendingContext,getStellarLendingController:()=>T.getStellarLendingController,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",i="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",a="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:i,KG_SC:a,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:i,KG_SC:a,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:u,debug:n,...i}=this.init,{next:a,cache:l,debug:s,headers:p,method:d="GET",...c}=o,y=p?.Authorization,S="Bearer undefined"===y?void 0:y,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...S?{Authorization:S}:{}},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}=a??{},x="GET"!==d||S?void 0:h??f,q="GET"!==d||S||x?void 0:l??u,A={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...m,...v,revalidate:x}};(s??n)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class y extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const S=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),b={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/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,...i}=t,a=async(t={})=>{const u={...o,...t},n=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),i=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),a=Object.fromEntries(Object.entries(u).filter((([e])=>!i.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in a,s=/:collection[^A-Z]/.test(e)||"collection"in a;if(l){const e=u.address;if(!S(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(a).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:T,headers:f,cache:m,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...f,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],n]};return r.fetchWithTimeout(n,{method:T,params:q,body:b,headers:_,cache:m,debug:v,...w?{next:w}:{}})},l=(e={})=>a(e);for(const e of Object.keys(i))g.includes(e)&&(l[e]=t=>a({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=m();for(const[t,o]of Object.entries(b)){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,i=Object.keys(t.params).length;let a;if(1===u&&n+i>0){const{rawPath:o,def:u}=t.leaves[0];a=h(o,u,r,e)}else{a={};for(const{rawPath:o,def:u}of t.leaves)a[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===a[e]?a[e]=n:"function"==typeof a[e]?Object.assign(a[e],n):"function"==typeof n?(Object.assign(n,a[e]),a[e]=n):Object.assign(a[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(a[e]){const o=a[e];a[e]=e=>({...o(e),...t(e)})}else a[e]=t}return a};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:()=>Je,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>po,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>a,STELLAR_SOROBAN_RPC_URL:()=>i,SYNTHETIC_EVENT_ORDER_STRIDE:()=>So,XOXNO_LENDING_STELLAR_TICKER:()=>yo,buildSameTokenRepaySwapSteps:()=>Lo,buildStellarAcceptOwnershipTx:()=>Ce,buildStellarAddRewardsTx:()=>Ze,buildStellarApproveTokenTx:()=>$e,buildStellarBatchSwapTx:()=>_o,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>N,buildStellarCctpForwardTx:()=>Uo,buildStellarClaimRevenueTx:()=>Qe,buildStellarCreateLiquidityPoolTx:()=>Xe,buildStellarDisableTokenOracleTx:()=>He,buildStellarExecuteStrategyTx:()=>Ao,buildStellarFlashLoanTx:()=>H,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Bt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Dt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Wt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>zt,buildStellarGovernanceExecuteTx:()=>Nt,buildStellarGovernanceExecuteUpdateDelayTx:()=>$t,buildStellarGrantRoleTx:()=>Ie,buildStellarLendingIdentifier:()=>bo,buildStellarLiquidateTx:()=>z,buildStellarMigrateFromBlendTx:()=>V,buildStellarMigrateTx:()=>ke,buildStellarMultiplyTx:()=>j,buildStellarPauseTx:()=>Ee,buildStellarProposeAddAssetToSpokeTx:()=>St,buildStellarProposeAddSpokeTx:()=>ct,buildStellarProposeApproveBlendPoolTx:()=>vt,buildStellarProposeApproveTokenTx:()=>mt,buildStellarProposeConfigureMarketOracleTx:()=>Ot,buildStellarProposeCreateHubTx:()=>dt,buildStellarProposeCreateLiquidityPoolTx:()=>qt,buildStellarProposeDeployPoolTx:()=>_t,buildStellarProposeDisableTokenOracleTx:()=>Pt,buildStellarProposeEditAssetInSpokeTx:()=>bt,buildStellarProposeEditOracleToleranceTx:()=>It,buildStellarProposeGovernanceUpgradeTx:()=>Mt,buildStellarProposeGrantGovernanceRoleTx:()=>Ct,buildStellarProposeMigrateControllerTx:()=>kt,buildStellarProposeRemoveAssetFromSpokeTx:()=>gt,buildStellarProposeRemoveSpokeTx:()=>yt,buildStellarProposeRevokeBlendPoolTx:()=>xt,buildStellarProposeRevokeGovernanceRoleTx:()=>Ut,buildStellarProposeRevokeTokenTx:()=>ht,buildStellarProposeSetAccumulatorTx:()=>lt,buildStellarProposeSetAggregatorTx:()=>at,buildStellarProposeSetMinBorrowCollatTx:()=>ft,buildStellarProposeSetPoolTemplateTx:()=>st,buildStellarProposeSetPositionLimitsTx:()=>pt,buildStellarProposeSetPositionManagerTx:()=>Tt,buildStellarProposeTransferCtrlOwnershipTx:()=>Et,buildStellarProposeTransferGovOwnTx:()=>Gt,buildStellarProposeUpdateDelayTx:()=>Lt,buildStellarProposeUpgradeControllerTx:()=>Rt,buildStellarProposeUpgradePoolParamsTx:()=>At,buildStellarProposeUpgradePoolTx:()=>wt,buildStellarRenewAccountTx:()=>je,buildStellarRepayBatchTx:()=>D,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>W,buildStellarRevokeRoleTx:()=>Me,buildStellarRevokeTokenTx:()=>De,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ne,buildStellarSetMarketOracleConfigTx:()=>We,buildStellarSetOracleToleranceTx:()=>ze,buildStellarSetPositionLimitsTx:()=>Be,buildStellarSupplyBatchTx:()=>C,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>F,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Le,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Ke,buildStellarUpdateIndexesTx:()=>Ve,buildStellarUpgradeControllerTx:()=>Re,buildStellarUpgradeLiquidityPoolParamsTx:()=>Fe,buildStellarWithdrawBatchTx:()=>B,buildStellarWithdrawTx:()=>$,buildTx:()=>L,decodeStellarLendingEvent:()=>co,encodeInterestRateModel:()=>ve,encodeMarketOracleConfigInput:()=>Pe,encodeMarketParamsRaw:()=>xe,encodeOracleSourceConfigInput:()=>we,encodePositionLimits:()=>qe,encodeStrategyPayloadToRouteXdr:()=>qo,extractEventOrder:()=>go,getStellarAccountPositions:()=>ye,getStellarAggregatorQuote:()=>vo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ie,getStellarAssetGraph:()=>be,getStellarAssetMarkets:()=>le,getStellarAssetPage:()=>ae,getStellarAssets:()=>ee,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>Se,getStellarHub:()=>se,getStellarHubGraph:()=>ge,getStellarHubs:()=>te,getStellarLendingContext:()=>Y,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>xo,getStellarReserve:()=>ue,getStellarReserveGraph:()=>fe,getStellarReserveHolders:()=>ne,getStellarReserves:()=>re,getStellarSpoke:()=>pe,getStellarSpokeGraph:()=>Te,getStellarSpokes:()=>oe,getStellarUserActivity:()=>ce,getStellarUserPositions:()=>de,mapQuoteResponseToAggregatorSwap:()=>Ro,mapQuoteResponseToStrategyPayload:()=>wo,mapQuoteResponseToStrategySwap:()=>Po,mapStellarPositionActivityType:()=>fo,prepareStellarBuiltTx:()=>Io,prepareStellarTxXdr:()=>Oo,stellarLendingDispatchKey:()=>jt,stellarLendingRead:()=>me,syntheticEventOrder:()=>To,tagStellarInvokedContractError:()=>Eo,toBase64Xdr:()=>Ht,toStellarPositionMode:()=>Mo});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??""},i={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},a={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"],S=e=>new c.Address(e).toScVal(),b=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),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),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>R({asset:S(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([_(e,t),b(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),R=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)},k=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return R({amount_out:b(e.amountOut),pool:S(e.pool),token_in:S(e.tokenIn),token_out:S(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return R({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return R({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in:S(e.tokenIn),token_out:S(e.tokenOut),total_min_out:b(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},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},I=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!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(k(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},M=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 L(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 C(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"supply",[S(e.caller),T(o),g(r),P([...t.assets])])}function U(e,t){return C(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return L(e,"borrow",[S(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,S)])}function N(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function B(e,t){return L(e,"withdraw",[S(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,S)])}function $(e,t){return B(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return L(e,"repay",[S(e.caller),T(t.accountNonce),P([...t.payments])])}function W(e,t){return D(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function z(e,t){return L(e,"liquidate",[S(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function H(e,t){return L(e,"flash_loan",[S(e.caller),_(t.hubId,t.asset),b(t.amount),S(t.receiver),M(t.data)])}function V(e,t){return L(e,"migrate_from_blend",[S(e.caller),T(t.accountId),g(t.spokeId),g(t.hubId),S(t.blendPool),x(t.collateralTokens.map(S)),x(t.supplyTokens.map(S)),(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([S(t),b(o)]);var t,o}))))]);var o}function j(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return L(e,"multiply",[S(e.caller),T(o),g(r),_(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),_(t.debt.hubId,t.debt.asset),g(t.mode),I(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,I)])}function X(e,t){return L(e,"swap_debt",[S(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),I(t.steps)])}function F(e,t){return L(e,"swap_collateral",[S(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),I(t.steps)])}function Q(e,t){return L(e,"repay_debt_with_collateral",[S(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),I(t.steps),f(t.closePosition)])}const Z="/stellar-lending",K=25,J=encodeURIComponent,Y=(e,t)=>e.fetchWithTimeout(`${Z}/context`,t),ee=(e,t)=>e.fetchWithTimeout(`${Z}/assets`,t),te=(e,t)=>e.fetchWithTimeout(`${Z}/hubs`,t),oe=(e,t)=>e.fetchWithTimeout(`${Z}/spokes`,t),re=(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}:{}}})},ue=(e,t,o,r,u)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}`,u),ne=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/holders`,{...n,params:{side:u}}),ie=(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}}),le=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/assets/${J(t)}/markets`,{...r,params:{side:o}}),se=(e,t,o)=>e.fetchWithTimeout(`${Z}/hubs/${t}`,o),pe=(e,t,o)=>e.fetchWithTimeout(`${Z}/spokes/${t}`,o),de=(e,t,o)=>e.fetchWithTimeout(`${Z}/users/${J(t)}/positions`,o),ce=(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}:{}}})},ye=(e,t,o)=>e.fetchWithTimeout(`${Z}/accounts/${J(t)}/positions`,o),Se=(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}}),ge=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/hubs/${t}/graph`,{...r,params:{...o}}),Te=(e,t,o,r)=>e.fetchWithTimeout(`${Z}/spokes/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r,u,n)=>e.fetchWithTimeout(`${Z}/reserves/${t}/${o}/${J(r)}/graph`,{...n,params:{...u}}),me=e=>({context:t=>Y(e,t),assets:t=>ee(e,t),hubs:t=>te(e,t),spokes:t=>oe(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?re(e,t,o):re(e,{},t);var r},reserve:(t,o,r,u)=>ue(e,t,o,r,u),reserveHolders:(t,o,r,u,n)=>ne(e,t,o,r,u,n),asset:(t,o)=>ie(e,t,o),assetMarkets:(t,o,r)=>le(e,t,o,r),hub:(t,o)=>se(e,t,o),spoke:(t,o)=>pe(e,t,o),userPositions:(t,o)=>de(e,t,o),userActivity:(t,o,r)=>ce(e,t,o,r),accountPositions:(t,o)=>ye(e,t,o),governanceProposals:(t,o)=>Se(e,t,o),assetGraph:(t,o,r)=>be(e,t,o,r),hubGraph:(t,o,r)=>ge(e,t,o,r),spokeGraph:(t,o,r)=>Te(e,t,o,r),reserveGraph:(t,o,r,u,n)=>fe(e,t,o,r,u,n)}),he={Single:0,PrimaryWithAnchor:1},ve=e=>R({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),xe=e=>R({asset_decimals:g(e.assetDecimals),asset_id:S(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:f(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),qe=e=>R({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ae=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),S(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}"`)}},_e=(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"),R({asset:Ae(e.asset),contract:S(e.contract),read_mode:_e(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"),R({contract:S(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=he[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return R({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),we(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:we(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Re(e,t){return L(e,"upgrade",[q(t.wasmHash)])}function ke(e,t){return L(e,"migrate",[g(t.newVersion)])}function Ee(e){return L(e,"pause",[])}function Oe(e){return L(e,"unpause",[])}function Ie(e,t){return L(e,"grant_role",[S(t.account),h(t.role)])}function Me(e,t){return L(e,"revoke_role",[S(t.account),h(t.role)])}function Le(e,t){return L(e,"transfer_ownership",[S(t.newOwner),g(t.liveUntilLedger)])}function Ce(e){return L(e,"accept_ownership",[])}function Ue(e,t){return L(e,"set_aggregator",[S(t.aggregator)])}function Ge(e,t){return L(e,"set_accumulator",[S(t.accumulator)])}function Ne(e,t){return L(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function Be(e,t){return L(e,"set_position_limits",[qe(t)])}function $e(e,t){return L(e,"approve_token",[S(t.token)])}function De(e,t){return L(e,"revoke_token",[S(t.token)])}function We(e,t){return L(e,"set_market_oracle_config",[_(t.hubId,t.asset),Pe(t.config)])}function ze(e,t){return L(e,"set_oracle_tolerance",[S(t.asset),R({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function He(e,t){return L(e,"disable_token_oracle",[S(t.asset)])}function Ve(e,t){return L(e,"update_indexes",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function je(e,t){return L(e,"renew_account",[S(e.caller),T(t.accountNonce)])}function Xe(e,t){return L(e,"create_liquidity_pool",[g(t.hubId),S(t.asset),xe(t.params)])}function Fe(e,t){return L(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),ve(t.params)])}function Qe(e,t){return L(e,"claim_revenue",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return L(e,"add_rewards",[S(e.caller),P(t.rewards)])}function Ke(e,t){return L(e,"update_account_threshold",[S(e.caller),f(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const Je="00".repeat(32),Ye=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},et=(e,...t)=>x([h(e),...t]),tt=e=>R({new_owner:S(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ot=e=>R({asset:S(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:f(e.canBorrow),can_collateral:f(e.canCollateral),frozen:f(e.frozen),hub_id:g(e.hubId),paused:f(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),rt=e=>R({account:S(e.account),role:h(e.role)});function ut(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 nt=(e,t,o)=>ut(e,"propose",[S(e.caller),t,Ye(o)]),it=(e,t,o)=>ut(e,"execute_self",[v(),t,Ye(o)]);function at(e,t,o){return nt(e,et("SetAggregator",S(t.aggregator)),o)}function lt(e,t,o){return nt(e,et("SetAccumulator",S(t.accumulator)),o)}function st(e,t,o){return nt(e,et("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function pt(e,t,o){return nt(e,et("SetPositionLimits",qe(t)),o)}function dt(e,t){return nt(e,et("CreateHub"),t)}function ct(e,t){return nt(e,et("AddSpoke"),t)}function yt(e,t,o){return nt(e,et("RemoveSpoke",g(t.spokeId)),o)}function St(e,t,o){return nt(e,et("AddAssetToSpoke",ot(t)),o)}function bt(e,t,o){return nt(e,et("EditAssetInSpoke",ot(t)),o)}function gt(e,t,o){return nt(e,et("RemoveAssetFromSpoke",R({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function Tt(e,t,o){return nt(e,et("SetPositionManager",S(t.manager),f(t.isActive)),o)}function ft(e,t,o){return nt(e,et("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function mt(e,t,o){return nt(e,et("ApproveToken",S(t.token)),o)}function ht(e,t,o){return nt(e,et("RevokeToken",S(t.token)),o)}function vt(e,t,o){return nt(e,et("ApproveBlendPool",S(t.pool)),o)}function xt(e,t,o){return nt(e,et("RevokeBlendPool",S(t.pool)),o)}function qt(e,t,o){return nt(e,et("CreateLiquidityPool",R({asset:S((r=t).asset),hub_id:g(r.hubId),params:xe(r.params)})),o);var r}function At(e,t,o){return nt(e,et("UpgradeLiquidityPoolParams",R({hub_asset:_((r=t).hubId,r.asset),params:ve(r.params)})),o);var r}function _t(e,t){return nt(e,et("DeployPool"),t)}function wt(e,t,o){return nt(e,et("UpgradePool",q(t.wasmHash)),o)}function Pt(e,t,o){return nt(e,et("DisableTokenOracle",S(t.asset)),o)}function Rt(e,t,o){return nt(e,et("UpgradeController",q(t.wasmHash)),o)}function kt(e,t,o){return nt(e,et("MigrateController",g(t.newVersion)),o)}function Et(e,t,o){return nt(e,et("TransferCtrlOwnership",tt(t)),o)}function Ot(e,t,o){return nt(e,et("ConfigureMarketOracle",R({cfg:Pe((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function It(e,t,o){return nt(e,et("EditOracleTolerance",R({asset:S((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Mt(e,t,o){return nt(e,et("UpgradeGov",q(t.wasmHash)),o)}function Lt(e,t,o){return nt(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Ct(e,t,o){return nt(e,et("GrantGovRole",rt(t)),o)}function Ut(e,t,o){return nt(e,et("RevokeGovRole",rt(t)),o)}function Gt(e,t,o){return nt(e,et("TransferGovOwnership",tt(t)),o)}function Nt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=Ye(t.predecessor??Je);return ut(e,"execute",[v(),S(t.target),h(t.functionName),o,r,Ye(t.salt)])}function Bt(e,t,o){return it(e,et("UpgradeGov",q(t.wasmHash)),o)}function $t(e,t,o){return it(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Dt(e,t,o){return it(e,et("GrantGovRole",rt(t)),o)}function Wt(e,t,o){return it(e,et("RevokeGovRole",rt(t)),o)}function zt(e,t,o){return it(e,et("TransferGovOwnership",tt(t)),o)}const Ht=e=>e.toXDR("base64"),Vt=e=>c.xdr.ScVal.fromXDR(e,"base64"),jt=e=>e.map((e=>String((0,c.scValToNative)(Vt(e))))).join(":"),Xt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Ft=e=>Number(e),Qt=e=>String(e),Zt=e=>null==e?void 0:Xt(e),Kt=e=>null==e?void 0:Qt(e),Jt=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Yt=["None","Multiply","Long","Short"],eo=["Single","PrimaryWithAnchor"],to=["ReflectorSep40","RedStonePriceFeed"],oo=["Spot","Twap"],ro=["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"],uo=e=>Array.isArray(e)?e:[],no=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],ro[Ft(r)]??Xt(r)),positionType:t,hubId:Ft(e[1]),asset:Qt(e[2]),scaledAmountRay:Xt(e[3]),indexRay:Xt(e[4]),amount:Xt(e[5]),liquidationThresholdBps:o?void 0:Ft(e[6]),liquidationBonusBps:o?void 0:Ft(e[7]),loanToValueBps:o?void 0:Ft(e[8]),liquidationFeesBps:o?void 0:Ft(e[9])};var r},io=e=>{return{owner:Qt(e[0]),spokeId:Ft(e[1]),mode:(t=e[2],Yt[Ft(t)]??"None")};var t},ao=(e,t)=>{const o=oo[Ft(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],u=e[`${t}_symbol`],n=null!=r?{kind:"Stellar",value:Qt(r)}:null!=u?{kind:"Symbol",value:Qt(u)}:void 0;return{provider:to[Ft(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Qt(e[`${t}_contract`]),asset:n,feedId:Kt(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Ft(e[`${t}_twap_records`]):void 0,decimals:Ft(e[`${t}_decimals`]),resolutionSeconds:Ft(e[`${t}_resolution_seconds`]),maxStaleSeconds:Ft(e[`${t}_max_stale_seconds`])}},lo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Qt(e.base_token_id),quoteTokenId:Qt(e.quote_token_id),tolerance:{upperRatio:Ft(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Ft(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Ft(e.asset_decimals),maxPriceStaleSeconds:Ft(e.max_price_stale_seconds),strategy:eo[Ft(e.strategy)]??"Single",primary:ao(e,"primary"),anchor:t?ao(e,"anchor"):void 0,primaryQuoteToken:Kt(e.primary_quote_token),anchorQuoteToken:Kt(e.anchor_quote_token),minSanityPriceWad:Zt(e.min_sanity_price_wad),maxSanityPriceWad:Zt(e.max_sanity_price_wad)}},so={"market:create":e=>({topic:"market:create",data:{hubId:Ft(e.hub_id),baseAsset:Qt(e.base_asset),maxBorrowRate:Xt(e.max_borrow_rate),baseBorrowRate:Xt(e.base_borrow_rate),slope1:Xt(e.slope1),slope2:Xt(e.slope2),slope3:Xt(e.slope3),midUtilization:Xt(e.mid_utilization),optimalUtilization:Xt(e.optimal_utilization),maxUtilization:Xt(e.max_utilization),reserveFactor:Ft(e.reserve_factor),marketAddress:Qt(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Qt(e.asset),maxBorrowRateRay:Xt(e.max_borrow_rate),baseBorrowRateRay:Xt(e.base_borrow_rate),slope1Ray:Xt(e.slope1),slope2Ray:Xt(e.slope2),slope3Ray:Xt(e.slope3),midUtilizationRay:Xt(e.mid_utilization),optimalUtilizationRay:Xt(e.optimal_utilization),maxUtilizationRay:Xt(e.max_utilization),reserveFactorBps:Ft(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:uo(e).map((e=>{return t=uo(e),{hubId:Ft(t[0]),asset:Qt(t[1]),timestamp:Ft(t[2]),supplyIndexRay:Xt(t[3]),borrowIndexRay:Xt(t[4]),cash:Xt(t[5]),suppliedRay:Xt(t[6]),borrowedRay:Xt(t[7]),revenueRay:Xt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:uo(e).map((e=>{const t=e;return{hubId:Ft(t.hub_id),asset:Qt(t.asset),params:(o=t.params,{maxBorrowRateRay:Xt(o.max_borrow_rate),baseBorrowRateRay:Xt(o.base_borrow_rate),slope1Ray:Xt(o.slope1),slope2Ray:Xt(o.slope2),slope3Ray:Xt(o.slope3),midUtilizationRay:Xt(o.mid_utilization),optimalUtilizationRay:Xt(o.optimal_utilization),maxUtilizationRay:Xt(o.max_utilization),reserveFactorBps:Ft(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Ft(o.flashloan_fee),assetId:Qt(o.asset_id),assetDecimals:Ft(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=uo(e);return{topic:"position:batch_update",data:{accountId:Xt(t[0]),accountAttributes:io(uo(t[1])),updates:[...uo(t[2]).map((e=>no(uo(e),"Deposit"))),...uo(t[3]).map((e=>no(uo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Ft(e.hub_id),asset:Qt(e.asset),receiver:Qt(e.receiver),caller:Qt(e.caller),amount:Xt(e.amount),fee:Xt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Qt(e.asset),oracle:lo(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Qt(e.liquidator),accountId:Xt(e.account_id),repaidUsdWad:Xt(e.repaid_usd_wad),bonusBps:Xt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Xt(e.account_id),totalBorrowUsdWad:Xt(e.total_borrow_usd_wad),totalCollateralUsdWad:Xt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Qt(e.token),amount:Xt(e.amount),usdValueWad:Xt(e.usd_value_wad),accountId:Xt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Ft(e.hub_id),asset:Qt(e.asset),amount:Xt(e.amount),fee:Xt(e.fee),amountSent:Xt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:Jt(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Qt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Qt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:Jt(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Ft(e.max_supply_positions),maxBorrowPositions:Ft(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Qt(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Ft(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Xt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Xt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Ft(t.liquidation_bonus_factor_bps)}}}},po=Object.freeze(Object.keys(so));function co(e,t){const o=jt(e),r=so[o];return r?r((0,c.scValToNative)(Vt(t))):null}const yo="XLENDXLM-a7c9f3",So=1e4;function bo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${yo}-${o}`}function go(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function To(e,t=0){return e*So+t}function fo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const mo=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},ho=e=>e.baseUrl??a[e.network];async function vo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=mo(ho(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 xo(e){const t=mo(ho(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 qo=e=>k(e).toXDR("base64");function Ao(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence),n=I(((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",S(e.caller),b(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function _o(e,t){return Ao(e,t)}function wo(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(ko),splitPpm:e.splitPpm}))):[{hops:e.hops.map(ko),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Po(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:wo(e,t)}const Ro=wo,ko=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Eo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Oo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Eo(o.invokedContractId,e);throw e}}async function Io(e,t,o){return Oo(e,t.xdr,o)}function Mo(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 Lo(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 Co=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 Uo(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(Co(e.message)),c.xdr.ScVal.scvBytes(Co(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,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarDisableTokenOracleTx:()=>T.buildStellarDisableTokenOracleTx,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,buildStellarProposeAddAssetToSpokeTx:()=>T.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>T.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>T.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeDisableTokenOracleTx:()=>T.buildStellarProposeDisableTokenOracleTx,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>T.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>T.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>T.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>T.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>T.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,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,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>T.encodeOracleSourceConfigInput,encodePositionLimits:()=>T.encodePositionLimits,encodeStrategyPayloadToRouteXdr:()=>T.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>T.extractEventOrder,getStellarAccountPositions:()=>T.getStellarAccountPositions,getStellarAggregatorQuote:()=>T.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>T.getStellarAggregatorRouter,getStellarAsset:()=>T.getStellarAsset,getStellarAssetGraph:()=>T.getStellarAssetGraph,getStellarAssetMarkets:()=>T.getStellarAssetMarkets,getStellarAssetPage:()=>T.getStellarAssetPage,getStellarAssets:()=>T.getStellarAssets,getStellarGovernance:()=>T.getStellarGovernance,getStellarGovernanceProposals:()=>T.getStellarGovernanceProposals,getStellarHub:()=>T.getStellarHub,getStellarHubGraph:()=>T.getStellarHubGraph,getStellarHubs:()=>T.getStellarHubs,getStellarLendingContext:()=>T.getStellarLendingContext,getStellarLendingController:()=>T.getStellarLendingController,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",i="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",a="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:i,KG_SC:a,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:i,KG_SC:a,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:u,debug:n,...i}=this.init,{next:a,cache:l,debug:s,headers:p,method:d="GET",...c}=o,y=p?.Authorization,S="Bearer undefined"===y?void 0:y,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...S?{Authorization:S}:{}},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}=a??{},x="GET"!==d||S?void 0:h??f,q="GET"!==d||S||x?void 0:l??u,A={...i,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...m,...v,revalidate:x}};(s??n)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class y extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const S=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),b={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/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,...i}=t,a=async(t={})=>{const u={...o,...t},n=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${u[t]}`)),i=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),a=Object.fromEntries(Object.entries(u).filter((([e])=>!i.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in a,s=/:collection[^A-Z]/.test(e)||"collection"in a;if(l){const e=u.address;if(!S(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(a).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:T,headers:f,cache:m,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...f,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],n]};return r.fetchWithTimeout(n,{method:T,params:q,body:b,headers:_,cache:m,debug:v,...w?{next:w}:{}})},l=(e={})=>a(e);for(const e of Object.keys(i))g.includes(e)&&(l[e]=t=>a({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=m();for(const[t,o]of Object.entries(b)){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,i=Object.keys(t.params).length;let a;if(1===u&&n+i>0){const{rawPath:o,def:u}=t.leaves[0];a=h(o,u,r,e)}else{a={};for(const{rawPath:o,def:u}of t.leaves)a[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===a[e]?a[e]=n:"function"==typeof a[e]?Object.assign(a[e],n):"function"==typeof n?(Object.assign(n,a[e]),a[e]=n):Object.assign(a[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(a[e]){const o=a[e];a[e]=e=>({...o(e),...t(e)})}else a[e]=t}return a};return o(t,{})}module.exports=r})();
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as s}from"@stellar/stellar-sdk";var a={388(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>ue,DU:()=>c,fA:()=>ho,A$:()=>m,J9:()=>f,hS:()=>b,gR:()=>vo,Cg:()=>xo,VZ:()=>Go,N0:()=>zt,B_:()=>re,eX:()=>Xt,z:()=>Oo,xD:()=>W,jR:()=>j,P2:()=>Vo,W6:()=>oe,se:()=>te,ln:()=>Zt,yr:()=>Ro,sp:()=>Z,$9:()=>He,zw:()=>Fe,h_:()=>Qe,e_:()=>Ke,Tk:()=>je,BA:()=>Xe,SX:()=>Dt,UF:()=>qo,Y5:()=>K,mE:()=>J,xG:()=>$t,s9:()=>Y,OL:()=>Nt,k6:()=>ve,dj:()=>Se,kD:()=>Pe,Yf:()=>Ae,c5:()=>Ce,N8:()=>he,qU:()=>Ie,RZ:()=>Oe,PD:()=>Ue,ni:()=>qe,hF:()=>De,Qk:()=>Be,Gw:()=>ze,$K:()=>$e,uj:()=>Te,Od:()=>xe,X7:()=>Ee,Ub:()=>Ve,Dx:()=>ke,OA:()=>fe,$U:()=>be,ob:()=>we,cY:()=>me,$l:()=>ge,K:()=>_e,VS:()=>Ne,HP:()=>We,YQ:()=>Ge,QY:()=>Le,os:()=>Re,Ko:()=>Me,IJ:()=>Yt,nw:()=>F,Pr:()=>ot,ZE:()=>Q,ev:()=>Bt,P8:()=>Ft,aV:()=>Wt,p2:()=>Vt,Ww:()=>jt,sV:()=>Qt,Js:()=>Kt,Dy:()=>Ht,Ni:()=>z,v_:()=>V,qD:()=>et,qR:()=>tt,QJ:()=>Gt,bm:()=>Ct,n_:()=>ne,v8:()=>Jt,qM:()=>Lt,gH:()=>ee,O3:()=>H,Gz:()=>X,pr:()=>G,Fm:()=>So,MB:()=>Pt,Dn:()=>Ut,pq:()=>Et,ml:()=>Mt,Q3:()=>It,wf:()=>Io,Um:()=>To,xO:()=>xt,Lw:()=>Po,KM:()=>h,mM:()=>yt,iE:()=>qt,zp:()=>ft,N3:()=>bt,bN:()=>st,QV:()=>S,T_:()=>vt,XI:()=>mt,Lt:()=>Tt,KK:()=>at,yl:()=>it,vc:()=>g,CH:()=>Eo,FI:()=>ct,KG:()=>wt,nW:()=>dt,jF:()=>lt,S2:()=>gt,uS:()=>_t,u_:()=>pt,O5:()=>St,Av:()=>ht,LA:()=>Lo,E6:()=>Mo,Ds:()=>Uo,CU:()=>wo,Vx:()=>Do,DL:()=>Co,ON:()=>Ye,Hh:()=>At,oV:()=>_o,g5:()=>No,L:()=>Ze,Vu:()=>Bo});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},b={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},f={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function g(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function h(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v=t=>new e(t).toScVal(),q=t=>new n(t).toI128(),T=t=>s.ScVal.scvU32(t),_=t=>new n("string"==typeof t?t:t.toString()).toU64(),w=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),k=t=>s.ScVal.scvSymbol(t),P=()=>s.ScVal.scvVoid(),E=t=>s.ScVal.scvVec(t),I=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return s.ScVal.scvBytes(r)},R=(t,e)=>null==t?P():e(t),O=(t,e)=>L({asset:v(e),hub_id:T(t)}),M=(t,e,o)=>s.ScVal.scvVec([O(t,e),q(o)]),U=t=>s.ScVal.scvVec(t.map((t=>M(t.hubId,t.asset,t.amount)))),L=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:k(e),val:t[e]})));return s.ScVal.scvMap(e)},$=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return L({amount_out:q(t.amountOut),pool:v(t.pool),token_in:v(t.tokenIn),token_out:v(t.tokenOut),venue:(e=t.venue,s.ScVal.scvVec([k(e)]))});var e}));return L({hops:s.ScVal.scvVec(e),split_ppm:T(t.splitPpm)})}));return L({paths:s.ScVal.scvVec(e),referral_id:_(t.referralId??0),token_in:v(t.tokenIn),token_out:v(t.tokenOut),total_min_out:q(t.totalMinOut)})},N=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},C=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},D=t=>{if("string"==typeof t)return N(C(t));if(t instanceof Uint8Array)return N(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?N(C(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?N(C(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?N(C(t.bytes)):N(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),s.ScVal.scvBytes(Buffer.from($(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},B=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return s.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function G(e,n,i){const s=e.controllerAddress??g(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function z(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return G(t,"supply",[v(t.caller),_(o),T(r),U([...e.assets])])}function V(t,e){return z(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function W(t,e){return G(t,"borrow",[v(t.caller),_(e.accountNonce),U([...e.borrows]),R(e.to,v)])}function j(t,e){return W(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function H(t,e){return G(t,"withdraw",[v(t.caller),_(e.accountNonce),U([...e.withdrawals]),R(e.to,v)])}function X(t,e){return H(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function F(t,e){return G(t,"repay",[v(t.caller),_(e.accountNonce),U([...e.payments])])}function Q(t,e){return F(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function K(t,e){return G(t,"liquidate",[v(t.caller),_(e.accountNonce),U([...e.debtPayments])])}function Z(t,e){return G(t,"flash_loan",[v(t.caller),O(e.hubId,e.asset),q(e.amount),v(e.receiver),B(e.data)])}function J(t,e){return G(t,"migrate_from_blend",[v(t.caller),_(e.accountId),T(e.spokeId),T(e.hubId),v(e.blendPool),E(e.collateralTokens.map(v)),E(e.supplyTokens.map(v)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,s.ScVal.scvVec([v(e),q(o)]);var e,o}))))]);var o}function Y(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return G(t,"multiply",[v(t.caller),_(o),T(r),O(e.collateral.hubId,e.collateral.asset),q(e.debtToFlashLoan),O(e.debt.hubId,e.debt.asset),T(e.mode),D(e.steps),R(e.initialPayment,(t=>M(t.hubId,t.asset,t.amount))),R(e.convertSwap,D)])}function tt(t,e){return G(t,"swap_debt",[v(t.caller),_(e.accountNonce),O(e.existingDebt.hubId,e.existingDebt.asset),q(e.newDebtAmount),O(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function et(t,e){return G(t,"swap_collateral",[v(t.caller),_(e.accountNonce),O(e.current.hubId,e.current.asset),q(e.fromAmount),O(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function ot(t,e){return G(t,"repay_debt_with_collateral",[v(t.caller),_(e.accountNonce),O(e.collateral.hubId,e.collateral.asset),q(e.collateralAmount),O(e.debt.hubId,e.debt.asset),D(e.steps),w(e.closePosition)])}const rt="/stellar-lending",nt=25,ut=encodeURIComponent,it=(t,e)=>t.fetchWithTimeout(`${rt}/context`,e),st=(t,e)=>t.fetchWithTimeout(`${rt}/assets`,e),at=(t,e)=>t.fetchWithTimeout(`${rt}/hubs`,e),pt=(t,e)=>t.fetchWithTimeout(`${rt}/spokes`,e),lt=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${rt}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ct=(t,e,o,r,n)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}`,n),dt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}/holders`,{...u,params:{side:n}}),yt=(t,e,o)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}`,o),bt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/page`,{...r,params:{...o}}),ft=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/markets`,{...r,params:{side:o}}),mt=(t,e,o)=>t.fetchWithTimeout(`${rt}/hubs/${e}`,o),gt=(t,e,o)=>t.fetchWithTimeout(`${rt}/spokes/${e}`,o),ht=(t,e,o)=>t.fetchWithTimeout(`${rt}/users/${ut(e)}/positions`,o),St=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${rt}/users/${ut(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},xt=(t,e,o)=>t.fetchWithTimeout(`${rt}/accounts/${ut(e)}/positions`,o),vt=(t,e={},o)=>{const{top:r=nt,continuationToken:n}=e;return t.fetchWithTimeout(`${rt}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},qt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/graph`,{...r,params:{...o}}),Tt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/hubs/${e}/graph`,{...r,params:{...o}}),_t=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/spokes/${e}/graph`,{...r,params:{...o}}),wt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}/graph`,{...u,params:{...n}}),At=t=>({context:e=>it(t,e),assets:e=>st(t,e),hubs:e=>at(t,e),spokes:e=>pt(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?lt(t,e,o):lt(t,{},e);var r},reserve:(e,o,r,n)=>ct(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>dt(t,e,o,r,n,u),asset:(e,o)=>yt(t,e,o),assetMarkets:(e,o,r)=>ft(t,e,o,r),hub:(e,o)=>mt(t,e,o),spoke:(e,o)=>gt(t,e,o),userPositions:(e,o)=>ht(t,e,o),userActivity:(e,o,r)=>St(t,e,o,r),accountPositions:(e,o)=>xt(t,e,o),governanceProposals:(e,o)=>vt(t,e,o),assetGraph:(e,o,r)=>qt(t,e,o,r),hubGraph:(e,o,r)=>Tt(t,e,o,r),spokeGraph:(e,o,r)=>_t(t,e,o,r),reserveGraph:(e,o,r,n,u)=>wt(t,e,o,r,n,u)}),kt={Single:0,PrimaryWithAnchor:1},Pt=t=>L({base_borrow_rate:q(t.baseBorrowRateRay),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),Et=t=>L({asset_decimals:T(t.assetDecimals),asset_id:v(t.assetId),base_borrow_rate:q(t.baseBorrowRateRay),flashloan_fee:T(t.flashloanFeeBps),is_flashloanable:w(t.isFlashloanable),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),It=t=>L({max_borrow_positions:T(t.maxBorrowPositions),max_supply_positions:T(t.maxSupplyPositions)}),Rt=t=>{const e=t.kind;switch(e){case"Stellar":return E([k("Stellar"),v(t.value)]);case"Symbol":return E([k("Symbol"),k(t.value)]);case"String":return E([k("String"),A(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},Ot=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return E([k("Twap"),T(e)])}return E([k("Spot")])},Mt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return E([k("Reflector"),L({asset:Rt(t.asset),contract:v(t.contract),read_mode:Ot(t.readMode,t.twapRecords)})])}if("RedStonePriceFeed"===e){if("string"!=typeof t.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof t.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return E([k("RedStone"),L({contract:v(t.contract),feed_id:A(t.feedId),max_stale_seconds:_(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},Ut=t=>{const e=kt[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return L({anchor:(o=t.anchor,E(null==o?[k("None")]:[k("Some"),Mt(o)])),max_price_stale_seconds:_(t.maxPriceStaleSeconds),max_sanity_price_wad:q(t.maxSanityPriceWad),min_sanity_price_wad:q(t.minSanityPriceWad),primary:Mt(t.primary),strategy:T(e),tolerance_bps:T(t.toleranceBps)});var o};function Lt(t,e){return G(t,"upgrade",[I(e.wasmHash)])}function $t(t,e){return G(t,"migrate",[T(e.newVersion)])}function Nt(t){return G(t,"pause",[])}function Ct(t){return G(t,"unpause",[])}function Dt(t,e){return G(t,"grant_role",[v(e.account),k(e.role)])}function Bt(t,e){return G(t,"revoke_role",[v(e.account),k(e.role)])}function Gt(t,e){return G(t,"transfer_ownership",[v(e.newOwner),T(e.liveUntilLedger)])}function zt(t){return G(t,"accept_ownership",[])}function Vt(t,e){return G(t,"set_aggregator",[v(e.aggregator)])}function Wt(t,e){return G(t,"set_accumulator",[v(e.accumulator)])}function jt(t,e){return G(t,"set_liquidity_pool_template",[I(e.wasmHash)])}function Ht(t,e){return G(t,"set_position_limits",[It(e)])}function Xt(t,e){return G(t,"approve_token",[v(e.token)])}function Ft(t,e){return G(t,"revoke_token",[v(e.token)])}function Qt(t,e){return G(t,"set_market_oracle_config",[O(e.hubId,e.asset),Ut(e.config)])}function Kt(t,e){return G(t,"set_oracle_tolerance",[v(e.asset),L({lower_ratio_bps:T(e.lowerRatioBps),upper_ratio_bps:T(e.upperRatioBps)})])}function Zt(t,e){return G(t,"disable_token_oracle",[v(e.asset)])}function Jt(t,e){return G(t,"update_indexes",[v(t.caller),E(e.assets.map((t=>O(t.hubId,t.asset))))])}function Yt(t,e){return G(t,"renew_account",[v(t.caller),_(e.accountNonce)])}function te(t,e){return G(t,"create_liquidity_pool",[T(e.hubId),v(e.asset),Et(e.params)])}function ee(t,e){return G(t,"upgrade_liquidity_pool_params",[O(e.hubId,e.asset),Pt(e.params)])}function oe(t,e){return G(t,"claim_revenue",[v(t.caller),E(e.assets.map((t=>O(t.hubId,t.asset))))])}function re(t,e){return G(t,"add_rewards",[v(t.caller),U(e.rewards)])}function ne(t,e){return G(t,"update_account_threshold",[v(t.caller),w(e.hasRisks),E(e.accountNonces.map((t=>_(t))))])}const ue="00".repeat(32),ie=t=>{if("string"==typeof t)return I(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},se=(t,...e)=>E([k(t),...e]),ae=t=>L({new_owner:v(t.newOwner),live_until_ledger:T(t.liveUntilLedger)}),pe=t=>L({asset:v(t.asset),bonus:T(t.bonus),borrow_cap:q(t.borrowCap),can_borrow:w(t.canBorrow),can_collateral:w(t.canCollateral),hub_id:T(t.hubId),liquidation_fees:T(t.liquidationFees),ltv:T(t.ltv),oracle_override:E([k("None")]),spoke_id:T(t.spokeId),supply_cap:q(t.supplyCap),threshold:T(t.threshold)}),le=t=>L({account:v(t.account),role:k(t.role)});function ce(e,n,i){const s=e.governanceAddress??S(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const de=(t,e,o)=>ce(t,"propose",[v(t.caller),e,ie(o)]),ye=(t,e,o)=>ce(t,"execute_self",[P(),e,ie(o)]);function be(t,e,o){return de(t,se("SetAggregator",v(e.aggregator)),o)}function fe(t,e,o){return de(t,se("SetAccumulator",v(e.accumulator)),o)}function me(t,e,o){return de(t,se("SetLiquidityPoolTemplate",I(e.wasmHash)),o)}function ge(t,e,o){return de(t,se("SetPositionLimits",It(e)),o)}function he(t,e){return de(t,se("CreateHub"),e)}function Se(t,e){return de(t,se("AddSpoke"),e)}function xe(t,e,o){return de(t,se("RemoveSpoke",T(e.spokeId)),o)}function ve(t,e,o){return de(t,se("AddAssetToSpoke",pe(e)),o)}function qe(t,e,o){return de(t,se("EditAssetInSpoke",pe(e)),o)}function Te(t,e,o){return de(t,se("RemoveAssetFromSpoke",L({hub_asset:O((r=e).hubId,r.asset),spoke_id:T(r.spokeId)})),o);var r}function _e(t,e,o){return de(t,se("SetPositionManager",v(e.manager),w(e.isActive)),o)}function we(t,e,o){return de(t,se("SetMinBorrowCollateralUsd",q(e.floorWad)),o)}function Ae(t,e,o){return de(t,se("ApproveToken",v(e.token)),o)}function ke(t,e,o){return de(t,se("RevokeToken",v(e.token)),o)}function Pe(t,e,o){return de(t,se("ApproveBlendPool",v(e.pool)),o)}function Ee(t,e,o){return de(t,se("RevokeBlendPool",v(e.pool)),o)}function Ie(t,e,o){return de(t,se("CreateLiquidityPool",L({asset:v((r=e).asset),hub_id:T(r.hubId),params:Et(r.params)})),o);var r}function Re(t,e,o){return de(t,se("UpgradeLiquidityPoolParams",L({hub_asset:O((r=e).hubId,r.asset),params:Pt(r.params)})),o);var r}function Oe(t,e){return de(t,se("DeployPool"),e)}function Me(t,e,o){return de(t,se("UpgradePool",I(e.wasmHash)),o)}function Ue(t,e,o){return de(t,se("DisableTokenOracle",v(e.asset)),o)}function Le(t,e,o){return de(t,se("UpgradeController",I(e.wasmHash)),o)}function $e(t,e,o){return de(t,se("MigrateController",T(e.newVersion)),o)}function Ne(t,e,o){return de(t,se("TransferCtrlOwnership",ae(e)),o)}function Ce(t,e,o){return de(t,se("ConfigureMarketOracle",L({cfg:Ut((r=e).config),hub_asset:O(r.hubId,r.asset)})),o);var r}function De(t,e,o){return de(t,se("EditOracleTolerance",L({asset:v((r=e).asset),tolerance:T(r.tolerance)})),o);var r}function Be(t,e,o){return de(t,se("UpgradeGov",I(e.wasmHash)),o)}function Ge(t,e,o){return de(t,se("UpdateGovDelay",T(e.newDelay)),o)}function ze(t,e,o){return de(t,se("GrantGovRole",le(e)),o)}function Ve(t,e,o){return de(t,se("RevokeGovRole",le(e)),o)}function We(t,e,o){return de(t,se("TransferGovOwnership",ae(e)),o)}function je(t,e){const o=E(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),r=ie(e.predecessor??ue);return ce(t,"execute",[P(),v(e.target),k(e.functionName),o,r,ie(e.salt)])}function He(t,e,o){return ye(t,se("UpgradeGov",I(e.wasmHash)),o)}function Xe(t,e,o){return ye(t,se("UpdateGovDelay",T(e.newDelay)),o)}function Fe(t,e,o){return ye(t,se("GrantGovRole",le(e)),o)}function Qe(t,e,o){return ye(t,se("RevokeGovRole",le(e)),o)}function Ke(t,e,o){return ye(t,se("TransferGovOwnership",ae(e)),o)}const Ze=t=>t.toXDR("base64"),Je=t=>s.ScVal.fromXDR(t,"base64"),Ye=t=>t.map((t=>String(i(Je(t))))).join(":"),to=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),eo=t=>Number(t),oo=t=>String(t),ro=t=>null==t?void 0:to(t),no=t=>null==t?void 0:oo(t),uo=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),io=["None","Multiply","Long","Short"],so=["Single","PrimaryWithAnchor"],ao=["ReflectorSep40","RedStonePriceFeed"],po=["Spot","Twap"],lo=["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"],co=t=>Array.isArray(t)?t:[],yo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],lo[eo(r)]??to(r)),positionType:e,hubId:eo(t[1]),asset:oo(t[2]),scaledAmountRay:to(t[3]),indexRay:to(t[4]),amount:to(t[5]),liquidationThresholdBps:o?void 0:eo(t[6]),liquidationBonusBps:o?void 0:eo(t[7]),loanToValueBps:o?void 0:eo(t[8]),liquidationFeesBps:o?void 0:eo(t[9])};var r},bo=t=>{return{owner:oo(t[0]),spokeId:eo(t[1]),mode:(e=t[2],io[eo(e)]??"None")};var e},fo=(t,e)=>{const o=po[eo(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:oo(r)}:null!=n?{kind:"Symbol",value:oo(n)}:void 0;return{provider:ao[eo(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:oo(t[`${e}_contract`]),asset:u,feedId:no(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?eo(t[`${e}_twap_records`]):void 0,decimals:eo(t[`${e}_decimals`]),resolutionSeconds:eo(t[`${e}_resolution_seconds`]),maxStaleSeconds:eo(t[`${e}_max_stale_seconds`])}},mo=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:oo(t.base_token_id),quoteTokenId:oo(t.quote_token_id),tolerance:{upperRatio:eo(t.upper_ratio_bps??t.tolerance?.upper_ratio_bps),lowerRatio:eo(t.lower_ratio_bps??t.tolerance?.lower_ratio_bps)},assetDecimals:eo(t.asset_decimals),maxPriceStaleSeconds:eo(t.max_price_stale_seconds),strategy:so[eo(t.strategy)]??"Single",primary:fo(t,"primary"),anchor:e?fo(t,"anchor"):void 0,primaryQuoteToken:no(t.primary_quote_token),anchorQuoteToken:no(t.anchor_quote_token),minSanityPriceWad:ro(t.min_sanity_price_wad),maxSanityPriceWad:ro(t.max_sanity_price_wad)}},go={"market:create":t=>({topic:"market:create",data:{hubId:eo(t.hub_id),baseAsset:oo(t.base_asset),maxBorrowRate:to(t.max_borrow_rate),baseBorrowRate:to(t.base_borrow_rate),slope1:to(t.slope1),slope2:to(t.slope2),slope3:to(t.slope3),midUtilization:to(t.mid_utilization),optimalUtilization:to(t.optimal_utilization),maxUtilization:to(t.max_utilization),reserveFactor:eo(t.reserve_factor),marketAddress:oo(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:oo(t.asset),maxBorrowRateRay:to(t.max_borrow_rate),baseBorrowRateRay:to(t.base_borrow_rate),slope1Ray:to(t.slope1),slope2Ray:to(t.slope2),slope3Ray:to(t.slope3),midUtilizationRay:to(t.mid_utilization),optimalUtilizationRay:to(t.optimal_utilization),maxUtilizationRay:to(t.max_utilization),reserveFactorBps:eo(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:co(t).map((t=>{return e=co(t),{hubId:eo(e[0]),asset:oo(e[1]),timestamp:eo(e[2]),supplyIndexRay:to(e[3]),borrowIndexRay:to(e[4]),cash:to(e[5]),suppliedRay:to(e[6]),borrowedRay:to(e[7]),revenueRay:to(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:co(t).map((t=>{const e=t;return{hubId:eo(e.hub_id),asset:oo(e.asset),params:(o=e.params,{maxBorrowRateRay:to(o.max_borrow_rate),baseBorrowRateRay:to(o.base_borrow_rate),slope1Ray:to(o.slope1),slope2Ray:to(o.slope2),slope3Ray:to(o.slope3),midUtilizationRay:to(o.mid_utilization),optimalUtilizationRay:to(o.optimal_utilization),maxUtilizationRay:to(o.max_utilization),reserveFactorBps:eo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:eo(o.flashloan_fee),assetId:oo(o.asset_id),assetDecimals:eo(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=co(t);return{topic:"position:batch_update",data:{accountId:to(e[0]),accountAttributes:bo(co(e[1])),updates:[...co(e[2]).map((t=>yo(co(t),"Deposit"))),...co(e[3]).map((t=>yo(co(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:eo(t.hub_id),asset:oo(t.asset),receiver:oo(t.receiver),caller:oo(t.caller),amount:to(t.amount),fee:to(t.fee)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:oo(t.asset),oracle:mo(t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:oo(t.liquidator),accountId:to(t.account_id),repaidUsdWad:to(t.repaid_usd_wad),bonusBps:to(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:to(t.account_id),totalBorrowUsdWad:to(t.total_borrow_usd_wad),totalCollateralUsdWad:to(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:oo(t.token),amount:to(t.amount),usdValueWad:to(t.usd_value_wad),accountId:to(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:eo(t.hub_id),asset:oo(t.asset),amount:to(t.amount),fee:to(t.fee),amountSent:to(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:uo(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:oo(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:oo(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:uo(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:eo(t.max_supply_positions),maxBorrowPositions:eo(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:oo(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:eo(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:to(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:to(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:eo(e.liquidation_bonus_factor_bps)}}}},ho=Object.freeze(Object.keys(go));function So(t,e){const o=Ye(t),r=go[o];return r?r(i(Je(e))):null}const xo="XLENDXLM-a7c9f3",vo=1e4;function qo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${xo}-${o}`}function To(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function _o(t,e=0){return t*vo+e}function wo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Ao=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},ko=t=>t.baseUrl??f[t.network];async function Po(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Ao(ko(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function Eo(t){const e=Ao(ko(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Io=t=>$(t).toXDR("base64");function Ro(e,n){const i=e.routerAddress??h(e.network),s=new r(i),a=new t(e.caller,e.sourceSequence),p=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(s.call("execute_strategy",v(e.caller),q(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Oo(t,e){return Ro(t,e)}function Mo(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map($o),splitPpm:t.splitPpm}))):[{hops:t.hops.map($o),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Uo(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Mo(t,e)}const Lo=Mo,$o=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function No(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Co(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw No(o.invokedContractId,t);throw t}}async function Do(t,e,o){return Co(t,e.xdr,o)}function Bo(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Go(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const zo=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function Vo(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(zo(e.message)),s.ScVal.scvBytes(zo(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",b="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var f;!function(t){t.MAINNET="1",t.DEVNET="D"}(f||(f={}));class m{apiUrl;chain;init;config;constructor({chain:t=f.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[f.MAINNET]:c,[f.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==f.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:b,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:b,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,b="Bearer undefined"===y?void 0:y,f={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:h,...S}=r??{},{revalidate:x,...v}=s??{},q="GET"!==c||b?void 0:x??h,T="GET"!==c||b||q?void 0:a??n,_={...i,...d,method:c,...Object.keys(f).length?{headers:f}:{},cache:T,next:{...S,...v,revalidate:q}};(p??u)&&console.debug("SDK fetch: ",g,_);const w=await fetch(g,_).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),A=await w.text();if(!w.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[g,w.status,w.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const g=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},h=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^G[A-Z2-7]{55}$/.test(t)),q={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},T=["PATCH","POST","DELETE","PUT"];var _=l(388);const w=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...i}=e,s=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!g(t))):!g(t))throw new S(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:b,cache:f,next:m,debug:h,continuationToken:q,...T}=l,_=d?`Bearer ${d}`:void 0,w={...b,..._?{Authorization:_}:{},...q?{"X-Continuation-Token":String(q)}:{}},A={...m,tags:[...m?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:T,body:c,headers:w,cache:f,debug:h,...A?{next:A}:{}})},a=(t={})=>s(t);for(const t of Object.keys(i))T.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(q)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=w(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=w(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let s;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];s=A(o,n,r,t)}else{s={};for(const{rawPath:o,def:n}of e.leaves)s[w(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===s[t]?s[t]=u:"function"==typeof s[t]?Object.assign(s[t],u):"function"==typeof u?(Object.assign(u,s[t]),s[t]=u):Object.assign(s[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(s[t]){const o=s[t];s[t]=t=>({...o(t),...e(t)})}else s[t]=e}return s};return o(e,{})}export{f as Chain,m as XOXNOClient,k as buildSdk,g as isValidCollectionTicker,h as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=_.ME;export const STELLAR_GOVERNANCE=_.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=_.G_;export const STELLAR_LENDING_CONTROLLER=_.DU;export const STELLAR_LENDING_TOPICS=_.fA;export const STELLAR_NETWORK_PASSPHRASE=_.A$;export const STELLAR_QUOTE_URL=_.J9;export const STELLAR_SOROBAN_RPC_URL=_.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=_.gR;export const XOXNO_LENDING_STELLAR_TICKER=_.Cg;export const buildSameTokenRepaySwapSteps=_.VZ;export const buildStellarAcceptOwnershipTx=_.N0;export const buildStellarAddRewardsTx=_.B_;export const buildStellarApproveTokenTx=_.eX;export const buildStellarBatchSwapTx=_.z;export const buildStellarBorrowBatchTx=_.xD;export const buildStellarBorrowTx=_.jR;export const buildStellarCctpForwardTx=_.P2;export const buildStellarClaimRevenueTx=_.W6;export const buildStellarCreateLiquidityPoolTx=_.se;export const buildStellarDisableTokenOracleTx=_.ln;export const buildStellarExecuteStrategyTx=_.yr;export const buildStellarFlashLoanTx=_.sp;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=_.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=_.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=_.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=_.e_;export const buildStellarGovernanceExecuteTx=_.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=_.BA;export const buildStellarGrantRoleTx=_.SX;export const buildStellarLendingIdentifier=_.UF;export const buildStellarLiquidateTx=_.Y5;export const buildStellarMigrateFromBlendTx=_.mE;export const buildStellarMigrateTx=_.xG;export const buildStellarMultiplyTx=_.s9;export const buildStellarPauseTx=_.OL;export const buildStellarProposeAddAssetToSpokeTx=_.k6;export const buildStellarProposeAddSpokeTx=_.dj;export const buildStellarProposeApproveBlendPoolTx=_.kD;export const buildStellarProposeApproveTokenTx=_.Yf;export const buildStellarProposeConfigureMarketOracleTx=_.c5;export const buildStellarProposeCreateHubTx=_.N8;export const buildStellarProposeCreateLiquidityPoolTx=_.qU;export const buildStellarProposeDeployPoolTx=_.RZ;export const buildStellarProposeDisableTokenOracleTx=_.PD;export const buildStellarProposeEditAssetInSpokeTx=_.ni;export const buildStellarProposeEditOracleToleranceTx=_.hF;export const buildStellarProposeGovernanceUpgradeTx=_.Qk;export const buildStellarProposeGrantGovernanceRoleTx=_.Gw;export const buildStellarProposeMigrateControllerTx=_.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=_.uj;export const buildStellarProposeRemoveSpokeTx=_.Od;export const buildStellarProposeRevokeBlendPoolTx=_.X7;export const buildStellarProposeRevokeGovernanceRoleTx=_.Ub;export const buildStellarProposeRevokeTokenTx=_.Dx;export const buildStellarProposeSetAccumulatorTx=_.OA;export const buildStellarProposeSetAggregatorTx=_.$U;export const buildStellarProposeSetMinBorrowCollatTx=_.ob;export const buildStellarProposeSetPoolTemplateTx=_.cY;export const buildStellarProposeSetPositionLimitsTx=_.$l;export const buildStellarProposeSetPositionManagerTx=_.K;export const buildStellarProposeTransferCtrlOwnershipTx=_.VS;export const buildStellarProposeTransferGovOwnTx=_.HP;export const buildStellarProposeUpdateDelayTx=_.YQ;export const buildStellarProposeUpgradeControllerTx=_.QY;export const buildStellarProposeUpgradePoolParamsTx=_.os;export const buildStellarProposeUpgradePoolTx=_.Ko;export const buildStellarRenewAccountTx=_.IJ;export const buildStellarRepayBatchTx=_.nw;export const buildStellarRepayDebtWithCollateralTx=_.Pr;export const buildStellarRepayTx=_.ZE;export const buildStellarRevokeRoleTx=_.ev;export const buildStellarRevokeTokenTx=_.P8;export const buildStellarSetAccumulatorTx=_.aV;export const buildStellarSetAggregatorTx=_.p2;export const buildStellarSetLiquidityPoolTemplateTx=_.Ww;export const buildStellarSetMarketOracleConfigTx=_.sV;export const buildStellarSetOracleToleranceTx=_.Js;export const buildStellarSetPositionLimitsTx=_.Dy;export const buildStellarSupplyBatchTx=_.Ni;export const buildStellarSupplyTx=_.v_;export const buildStellarSwapCollateralTx=_.qD;export const buildStellarSwapDebtTx=_.qR;export const buildStellarTransferOwnershipTx=_.QJ;export const buildStellarUnpauseTx=_.bm;export const buildStellarUpdateAccountThresholdTx=_.n_;export const buildStellarUpdateIndexesTx=_.v8;export const buildStellarUpgradeControllerTx=_.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=_.gH;export const buildStellarWithdrawBatchTx=_.O3;export const buildStellarWithdrawTx=_.Gz;export const buildTx=_.pr;export const decodeStellarLendingEvent=_.Fm;export const encodeInterestRateModel=_.MB;export const encodeMarketOracleConfigInput=_.Dn;export const encodeMarketParamsRaw=_.pq;export const encodeOracleSourceConfigInput=_.ml;export const encodePositionLimits=_.Q3;export const encodeStrategyPayloadToRouteXdr=_.wf;export const extractEventOrder=_.Um;export const getStellarAccountPositions=_.xO;export const getStellarAggregatorQuote=_.Lw;export const getStellarAggregatorRouter=_.KM;export const getStellarAsset=_.mM;export const getStellarAssetGraph=_.iE;export const getStellarAssetMarkets=_.zp;export const getStellarAssetPage=_.N3;export const getStellarAssets=_.bN;export const getStellarGovernance=_.QV;export const getStellarGovernanceProposals=_.T_;export const getStellarHub=_.XI;export const getStellarHubGraph=_.Lt;export const getStellarHubs=_.KK;export const getStellarLendingContext=_.yl;export const getStellarLendingController=_.vc;export const getStellarQuoteTokens=_.CH;export const getStellarReserve=_.FI;export const getStellarReserveGraph=_.KG;export const getStellarReserveHolders=_.nW;export const getStellarReserves=_.jF;export const getStellarSpoke=_.S2;export const getStellarSpokeGraph=_.uS;export const getStellarSpokes=_.u_;export const getStellarUserActivity=_.O5;export const getStellarUserPositions=_.Av;export const mapQuoteResponseToAggregatorSwap=_.LA;export const mapQuoteResponseToStrategyPayload=_.E6;export const mapQuoteResponseToStrategySwap=_.Ds;export const mapStellarPositionActivityType=_.CU;export const prepareStellarBuiltTx=_.Vx;export const prepareStellarTxXdr=_.DL;export const stellarLendingDispatchKey=_.ON;export const stellarLendingRead=_.Hh;export const syntheticEventOrder=_.oV;export const tagStellarInvokedContractError=_.g5;export const toBase64Xdr=_.L;export const toStellarPositionMode=_.Vu;
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as t,Address as e,BASE_FEE as o,Contract as r,ScInt as n,TransactionBuilder as u,scValToNative as i,xdr as s}from"@stellar/stellar-sdk";var a={388(a,p,l){l.d(p,{ME:()=>d,nO:()=>y,G_:()=>ue,DU:()=>c,fA:()=>ho,A$:()=>m,J9:()=>f,hS:()=>b,gR:()=>vo,Cg:()=>xo,VZ:()=>Go,N0:()=>zt,B_:()=>re,eX:()=>Xt,z:()=>Oo,xD:()=>W,jR:()=>j,P2:()=>Vo,W6:()=>oe,se:()=>te,ln:()=>Zt,yr:()=>Ro,sp:()=>Z,$9:()=>He,zw:()=>Fe,h_:()=>Qe,e_:()=>Ke,Tk:()=>je,BA:()=>Xe,SX:()=>Dt,UF:()=>qo,Y5:()=>K,mE:()=>J,xG:()=>$t,s9:()=>Y,OL:()=>Nt,k6:()=>ve,dj:()=>Se,kD:()=>Pe,Yf:()=>Ae,c5:()=>Ce,N8:()=>he,qU:()=>Ie,RZ:()=>Oe,PD:()=>Ue,ni:()=>qe,hF:()=>De,Qk:()=>Be,Gw:()=>ze,$K:()=>$e,uj:()=>Te,Od:()=>xe,X7:()=>Ee,Ub:()=>Ve,Dx:()=>ke,OA:()=>fe,$U:()=>be,ob:()=>we,cY:()=>me,$l:()=>ge,K:()=>_e,VS:()=>Ne,HP:()=>We,YQ:()=>Ge,QY:()=>Le,os:()=>Re,Ko:()=>Me,IJ:()=>Yt,nw:()=>F,Pr:()=>ot,ZE:()=>Q,ev:()=>Bt,P8:()=>Ft,aV:()=>Wt,p2:()=>Vt,Ww:()=>jt,sV:()=>Qt,Js:()=>Kt,Dy:()=>Ht,Ni:()=>z,v_:()=>V,qD:()=>et,qR:()=>tt,QJ:()=>Gt,bm:()=>Ct,n_:()=>ne,v8:()=>Jt,qM:()=>Lt,gH:()=>ee,O3:()=>H,Gz:()=>X,pr:()=>G,Fm:()=>So,MB:()=>Pt,Dn:()=>Ut,pq:()=>Et,ml:()=>Mt,Q3:()=>It,wf:()=>Io,Um:()=>To,xO:()=>xt,Lw:()=>Po,KM:()=>h,mM:()=>yt,iE:()=>qt,zp:()=>ft,N3:()=>bt,bN:()=>st,QV:()=>S,T_:()=>vt,XI:()=>mt,Lt:()=>Tt,KK:()=>at,yl:()=>it,vc:()=>g,CH:()=>Eo,FI:()=>ct,KG:()=>wt,nW:()=>dt,jF:()=>lt,S2:()=>gt,uS:()=>_t,u_:()=>pt,O5:()=>St,Av:()=>ht,LA:()=>Lo,E6:()=>Mo,Ds:()=>Uo,CU:()=>wo,Vx:()=>Do,DL:()=>Co,ON:()=>Ye,Hh:()=>At,oV:()=>_o,g5:()=>No,L:()=>Ze,Vu:()=>Bo});const c={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},d={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},y={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},b={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},f={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},m={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function g(t){const e=c[t];if(!e)throw new Error(`Stellar lending controller address not configured for network "${t}". Set STELLAR_LENDING_CONTROLLER_${t.toUpperCase()} env var.`);return e}function h(t){const e=d[t];if(!e)throw new Error(`Stellar aggregator router address not configured for network "${t}". Set STELLAR_AGGREGATOR_ROUTER_${t.toUpperCase()} env var.`);return e}function S(t){const e=y[t];if(!e)throw new Error(`Stellar governance address not configured for network "${t}". Set STELLAR_GOVERNANCE_${t.toUpperCase()} env var.`);return e}const x=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],v=t=>new e(t).toScVal(),q=t=>new n(t).toI128(),T=t=>s.ScVal.scvU32(t),_=t=>new n("string"==typeof t?t:t.toString()).toU64(),w=t=>s.ScVal.scvBool(t),A=t=>s.ScVal.scvString(t),k=t=>s.ScVal.scvSymbol(t),P=()=>s.ScVal.scvVoid(),E=t=>s.ScVal.scvVec(t),I=(t,e=32)=>{const o=t.startsWith("0x")?t.slice(2):t,r=Buffer.from(o,"hex");if(r.length!==e)throw new Error(`Stellar builder: expected a ${e}-byte BytesN (got ${r.length} bytes from "${t}")`);return s.ScVal.scvBytes(r)},R=(t,e)=>null==t?P():e(t),O=(t,e)=>L({asset:v(e),hub_id:T(t)}),M=(t,e,o)=>s.ScVal.scvVec([O(t,e),q(o)]),U=t=>s.ScVal.scvVec(t.map((t=>M(t.hubId,t.asset,t.amount)))),L=t=>{const e=Object.keys(t).sort().map((e=>new s.ScMapEntry({key:k(e),val:t[e]})));return s.ScVal.scvMap(e)},$=t=>{const e=t.paths.map((t=>{const e=t.hops.map((t=>{return L({amount_out:q(t.amountOut),pool:v(t.pool),token_in:v(t.tokenIn),token_out:v(t.tokenOut),venue:(e=t.venue,s.ScVal.scvVec([k(e)]))});var e}));return L({hops:s.ScVal.scvVec(e),split_ppm:T(t.splitPpm)})}));return L({paths:s.ScVal.scvVec(e),referral_id:_(t.referralId??0),token_in:v(t.tokenIn),token_out:v(t.tokenOut),total_min_out:q(t.totalMinOut)})},N=t=>{const e=Buffer.from(t);if(0===e.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return s.ScVal.scvBytes(e)},C=t=>{const e=t.trim();if(e.startsWith("0x")){const t=e.slice(2);if(!((o=t).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(t,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(e))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(e,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},D=t=>{if("string"==typeof t)return N(C(t));if(t instanceof Uint8Array)return N(t);if(t&&"object"==typeof t)return"routeXdr"in(o=t)&&"string"==typeof o.routeXdr?N(C(t.routeXdr)):(t=>"swapXdr"in t&&"string"==typeof t.swapXdr)(t)?N(C(t.swapXdr)):(t=>"bytes"in t&&("string"==typeof t.bytes||t.bytes instanceof Uint8Array))(t)?"string"==typeof t.bytes?N(C(t.bytes)):N(t.bytes):(e=(t=>{if(!t||"object"!=typeof t)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const e=t;if(!Array.isArray(e.paths)||0===e.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof e.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof e.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof e.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[t,r]of e.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${t}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[e,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!x.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${t}].hops[${e}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return e})(t),s.ScVal.scvBytes(Buffer.from($(e).toXDR("base64"),"base64")));var e,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},B=t=>{if("string"==typeof t)return(t=>{const e=t.startsWith("0x")?t.slice(2):t,o=Buffer.from(e,"hex");return s.ScVal.scvBytes(o)})(t);if(t instanceof Uint8Array)return s.ScVal.scvBytes(Buffer.from(t));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function G(e,n,i){const s=e.controllerAddress??g(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function z(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return G(t,"supply",[v(t.caller),_(o),T(r),U([...e.assets])])}function V(t,e){return z(t,{accountNonce:e.accountNonce,spokeId:e.spokeId,assets:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function W(t,e){return G(t,"borrow",[v(t.caller),_(e.accountNonce),U([...e.borrows]),R(e.to,v)])}function j(t,e){return W(t,{accountNonce:e.accountNonce,borrows:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function H(t,e){return G(t,"withdraw",[v(t.caller),_(e.accountNonce),U([...e.withdrawals]),R(e.to,v)])}function X(t,e){return H(t,{accountNonce:e.accountNonce,withdrawals:[{hubId:e.hubId,asset:e.asset,amount:e.amount}],to:e.to})}function F(t,e){return G(t,"repay",[v(t.caller),_(e.accountNonce),U([...e.payments])])}function Q(t,e){return F(t,{accountNonce:e.accountNonce,payments:[{hubId:e.hubId,asset:e.asset,amount:e.amount}]})}function K(t,e){return G(t,"liquidate",[v(t.caller),_(e.accountNonce),U([...e.debtPayments])])}function Z(t,e){return G(t,"flash_loan",[v(t.caller),O(e.hubId,e.asset),q(e.amount),v(e.receiver),B(e.data)])}function J(t,e){return G(t,"migrate_from_blend",[v(t.caller),_(e.accountId),T(e.spokeId),T(e.hubId),v(e.blendPool),E(e.collateralTokens.map(v)),E(e.supplyTokens.map(v)),(o=e.debtCaps.map((t=>({token:t.token,amount:t.cap}))),s.ScVal.scvVec(o.map((t=>{return e=t.token,o=t.amount,s.ScVal.scvVec([v(e),q(o)]);var e,o}))))]);var o}function Y(t,e){const o=e.accountNonce??0,r=e.spokeId??0;return G(t,"multiply",[v(t.caller),_(o),T(r),O(e.collateral.hubId,e.collateral.asset),q(e.debtToFlashLoan),O(e.debt.hubId,e.debt.asset),T(e.mode),D(e.steps),R(e.initialPayment,(t=>M(t.hubId,t.asset,t.amount))),R(e.convertSwap,D)])}function tt(t,e){return G(t,"swap_debt",[v(t.caller),_(e.accountNonce),O(e.existingDebt.hubId,e.existingDebt.asset),q(e.newDebtAmount),O(e.newDebt.hubId,e.newDebt.asset),D(e.steps)])}function et(t,e){return G(t,"swap_collateral",[v(t.caller),_(e.accountNonce),O(e.current.hubId,e.current.asset),q(e.fromAmount),O(e.newCollateral.hubId,e.newCollateral.asset),D(e.steps)])}function ot(t,e){return G(t,"repay_debt_with_collateral",[v(t.caller),_(e.accountNonce),O(e.collateral.hubId,e.collateral.asset),q(e.collateralAmount),O(e.debt.hubId,e.debt.asset),D(e.steps),w(e.closePosition)])}const rt="/stellar-lending",nt=25,ut=encodeURIComponent,it=(t,e)=>t.fetchWithTimeout(`${rt}/context`,e),st=(t,e)=>t.fetchWithTimeout(`${rt}/assets`,e),at=(t,e)=>t.fetchWithTimeout(`${rt}/hubs`,e),pt=(t,e)=>t.fetchWithTimeout(`${rt}/spokes`,e),lt=(t,e={},o)=>{const{hubId:r,spokeId:n,asset:u}=e;return t.fetchWithTimeout(`${rt}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ct=(t,e,o,r,n)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}`,n),dt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}/holders`,{...u,params:{side:n}}),yt=(t,e,o)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}`,o),bt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/page`,{...r,params:{...o}}),ft=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/markets`,{...r,params:{side:o}}),mt=(t,e,o)=>t.fetchWithTimeout(`${rt}/hubs/${e}`,o),gt=(t,e,o)=>t.fetchWithTimeout(`${rt}/spokes/${e}`,o),ht=(t,e,o)=>t.fetchWithTimeout(`${rt}/users/${ut(e)}/positions`,o),St=(t,e,o={},r)=>{const{skip:n,top:u}=o;return t.fetchWithTimeout(`${rt}/users/${ut(e)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},xt=(t,e,o)=>t.fetchWithTimeout(`${rt}/accounts/${ut(e)}/positions`,o),vt=(t,e={},o)=>{const{top:r=nt,continuationToken:n}=e;return t.fetchWithTimeout(`${rt}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},qt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/assets/${ut(e)}/graph`,{...r,params:{...o}}),Tt=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/hubs/${e}/graph`,{...r,params:{...o}}),_t=(t,e,o,r)=>t.fetchWithTimeout(`${rt}/spokes/${e}/graph`,{...r,params:{...o}}),wt=(t,e,o,r,n,u)=>t.fetchWithTimeout(`${rt}/reserves/${e}/${o}/${ut(r)}/graph`,{...u,params:{...n}}),At=t=>({context:e=>it(t,e),assets:e=>st(t,e),hubs:e=>at(t,e),spokes:e=>pt(t,e),reserves:(e,o)=>{return void 0===(r=e)||"hubId"in r||"spokeId"in r||"asset"in r?lt(t,e,o):lt(t,{},e);var r},reserve:(e,o,r,n)=>ct(t,e,o,r,n),reserveHolders:(e,o,r,n,u)=>dt(t,e,o,r,n,u),asset:(e,o)=>yt(t,e,o),assetMarkets:(e,o,r)=>ft(t,e,o,r),hub:(e,o)=>mt(t,e,o),spoke:(e,o)=>gt(t,e,o),userPositions:(e,o)=>ht(t,e,o),userActivity:(e,o,r)=>St(t,e,o,r),accountPositions:(e,o)=>xt(t,e,o),governanceProposals:(e,o)=>vt(t,e,o),assetGraph:(e,o,r)=>qt(t,e,o,r),hubGraph:(e,o,r)=>Tt(t,e,o,r),spokeGraph:(e,o,r)=>_t(t,e,o,r),reserveGraph:(e,o,r,n,u)=>wt(t,e,o,r,n,u)}),kt={Single:0,PrimaryWithAnchor:1},Pt=t=>L({base_borrow_rate:q(t.baseBorrowRateRay),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),Et=t=>L({asset_decimals:T(t.assetDecimals),asset_id:v(t.assetId),base_borrow_rate:q(t.baseBorrowRateRay),flashloan_fee:T(t.flashloanFeeBps),is_flashloanable:w(t.isFlashloanable),max_borrow_rate:q(t.maxBorrowRateRay),max_utilization:q(t.maxUtilizationRay),mid_utilization:q(t.midUtilizationRay),optimal_utilization:q(t.optimalUtilizationRay),reserve_factor:T(t.reserveFactorBps),slope1:q(t.slope1Ray),slope2:q(t.slope2Ray),slope3:q(t.slope3Ray)}),It=t=>L({max_borrow_positions:T(t.maxBorrowPositions),max_supply_positions:T(t.maxSupplyPositions)}),Rt=t=>{const e=t.kind;switch(e){case"Stellar":return E([k("Stellar"),v(t.value)]);case"Symbol":return E([k("Symbol"),k(t.value)]);case"String":return E([k("String"),A(t.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${e}"`)}},Ot=(t,e)=>{if("Twap"===t){if("number"!=typeof e)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return E([k("Twap"),T(e)])}return E([k("Spot")])},Mt=t=>{const e=t.provider;if("ReflectorSep40"===e){if(!t.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return E([k("Reflector"),L({asset:Rt(t.asset),contract:v(t.contract),read_mode:Ot(t.readMode,t.twapRecords)})])}if("RedStonePriceFeed"===e){if("string"!=typeof t.feedId)throw new Error("Stellar builder: RedStone oracle source requires `feedId`");if("number"!=typeof t.maxStaleSeconds)throw new Error("Stellar builder: RedStone oracle source requires `maxStaleSeconds`");return E([k("RedStone"),L({contract:v(t.contract),feed_id:A(t.feedId),max_stale_seconds:_(t.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${e}"`)},Ut=t=>{const e=kt[t.strategy];if(void 0===e)throw new Error(`Stellar builder: unknown oracle strategy "${t.strategy}"`);return L({anchor:(o=t.anchor,E(null==o?[k("None")]:[k("Some"),Mt(o)])),max_price_stale_seconds:_(t.maxPriceStaleSeconds),max_sanity_price_wad:q(t.maxSanityPriceWad),min_sanity_price_wad:q(t.minSanityPriceWad),primary:Mt(t.primary),strategy:T(e),tolerance_bps:T(t.toleranceBps)});var o};function Lt(t,e){return G(t,"upgrade",[I(e.wasmHash)])}function $t(t,e){return G(t,"migrate",[T(e.newVersion)])}function Nt(t){return G(t,"pause",[])}function Ct(t){return G(t,"unpause",[])}function Dt(t,e){return G(t,"grant_role",[v(e.account),k(e.role)])}function Bt(t,e){return G(t,"revoke_role",[v(e.account),k(e.role)])}function Gt(t,e){return G(t,"transfer_ownership",[v(e.newOwner),T(e.liveUntilLedger)])}function zt(t){return G(t,"accept_ownership",[])}function Vt(t,e){return G(t,"set_aggregator",[v(e.aggregator)])}function Wt(t,e){return G(t,"set_accumulator",[v(e.accumulator)])}function jt(t,e){return G(t,"set_liquidity_pool_template",[I(e.wasmHash)])}function Ht(t,e){return G(t,"set_position_limits",[It(e)])}function Xt(t,e){return G(t,"approve_token",[v(e.token)])}function Ft(t,e){return G(t,"revoke_token",[v(e.token)])}function Qt(t,e){return G(t,"set_market_oracle_config",[O(e.hubId,e.asset),Ut(e.config)])}function Kt(t,e){return G(t,"set_oracle_tolerance",[v(e.asset),L({lower_ratio_bps:T(e.lowerRatioBps),upper_ratio_bps:T(e.upperRatioBps)})])}function Zt(t,e){return G(t,"disable_token_oracle",[v(e.asset)])}function Jt(t,e){return G(t,"update_indexes",[v(t.caller),E(e.assets.map((t=>O(t.hubId,t.asset))))])}function Yt(t,e){return G(t,"renew_account",[v(t.caller),_(e.accountNonce)])}function te(t,e){return G(t,"create_liquidity_pool",[T(e.hubId),v(e.asset),Et(e.params)])}function ee(t,e){return G(t,"upgrade_liquidity_pool_params",[O(e.hubId,e.asset),Pt(e.params)])}function oe(t,e){return G(t,"claim_revenue",[v(t.caller),E(e.assets.map((t=>O(t.hubId,t.asset))))])}function re(t,e){return G(t,"add_rewards",[v(t.caller),U(e.rewards)])}function ne(t,e){return G(t,"update_account_threshold",[v(t.caller),w(e.hasRisks),E(e.accountNonces.map((t=>_(t))))])}const ue="00".repeat(32),ie=t=>{if("string"==typeof t)return I(t);const e=Buffer.from(t);if(32!==e.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${e.length} bytes)`);return s.ScVal.scvBytes(e)},se=(t,...e)=>E([k(t),...e]),ae=t=>L({new_owner:v(t.newOwner),live_until_ledger:T(t.liveUntilLedger)}),pe=t=>L({asset:v(t.asset),bonus:T(t.bonus),borrow_cap:q(t.borrowCap),can_borrow:w(t.canBorrow),can_collateral:w(t.canCollateral),frozen:w(t.frozen),hub_id:T(t.hubId),paused:w(t.paused),liquidation_fees:T(t.liquidationFees),ltv:T(t.ltv),oracle_override:E([k("None")]),spoke_id:T(t.spokeId),supply_cap:q(t.supplyCap),threshold:T(t.threshold)}),le=t=>L({account:v(t.account),role:k(t.role)});function ce(e,n,i){const s=e.governanceAddress??S(e.network),a=new r(s),p=new t(e.caller,e.sourceSequence);return{xdr:new u(p,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(a.call(n,...i)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const de=(t,e,o)=>ce(t,"propose",[v(t.caller),e,ie(o)]),ye=(t,e,o)=>ce(t,"execute_self",[P(),e,ie(o)]);function be(t,e,o){return de(t,se("SetAggregator",v(e.aggregator)),o)}function fe(t,e,o){return de(t,se("SetAccumulator",v(e.accumulator)),o)}function me(t,e,o){return de(t,se("SetLiquidityPoolTemplate",I(e.wasmHash)),o)}function ge(t,e,o){return de(t,se("SetPositionLimits",It(e)),o)}function he(t,e){return de(t,se("CreateHub"),e)}function Se(t,e){return de(t,se("AddSpoke"),e)}function xe(t,e,o){return de(t,se("RemoveSpoke",T(e.spokeId)),o)}function ve(t,e,o){return de(t,se("AddAssetToSpoke",pe(e)),o)}function qe(t,e,o){return de(t,se("EditAssetInSpoke",pe(e)),o)}function Te(t,e,o){return de(t,se("RemoveAssetFromSpoke",L({hub_asset:O((r=e).hubId,r.asset),spoke_id:T(r.spokeId)})),o);var r}function _e(t,e,o){return de(t,se("SetPositionManager",v(e.manager),w(e.isActive)),o)}function we(t,e,o){return de(t,se("SetMinBorrowCollateralUsd",q(e.floorWad)),o)}function Ae(t,e,o){return de(t,se("ApproveToken",v(e.token)),o)}function ke(t,e,o){return de(t,se("RevokeToken",v(e.token)),o)}function Pe(t,e,o){return de(t,se("ApproveBlendPool",v(e.pool)),o)}function Ee(t,e,o){return de(t,se("RevokeBlendPool",v(e.pool)),o)}function Ie(t,e,o){return de(t,se("CreateLiquidityPool",L({asset:v((r=e).asset),hub_id:T(r.hubId),params:Et(r.params)})),o);var r}function Re(t,e,o){return de(t,se("UpgradeLiquidityPoolParams",L({hub_asset:O((r=e).hubId,r.asset),params:Pt(r.params)})),o);var r}function Oe(t,e){return de(t,se("DeployPool"),e)}function Me(t,e,o){return de(t,se("UpgradePool",I(e.wasmHash)),o)}function Ue(t,e,o){return de(t,se("DisableTokenOracle",v(e.asset)),o)}function Le(t,e,o){return de(t,se("UpgradeController",I(e.wasmHash)),o)}function $e(t,e,o){return de(t,se("MigrateController",T(e.newVersion)),o)}function Ne(t,e,o){return de(t,se("TransferCtrlOwnership",ae(e)),o)}function Ce(t,e,o){return de(t,se("ConfigureMarketOracle",L({cfg:Ut((r=e).config),hub_asset:O(r.hubId,r.asset)})),o);var r}function De(t,e,o){return de(t,se("EditOracleTolerance",L({asset:v((r=e).asset),tolerance:T(r.tolerance)})),o);var r}function Be(t,e,o){return de(t,se("UpgradeGov",I(e.wasmHash)),o)}function Ge(t,e,o){return de(t,se("UpdateGovDelay",T(e.newDelay)),o)}function ze(t,e,o){return de(t,se("GrantGovRole",le(e)),o)}function Ve(t,e,o){return de(t,se("RevokeGovRole",le(e)),o)}function We(t,e,o){return de(t,se("TransferGovOwnership",ae(e)),o)}function je(t,e){const o=E(e.argsXdr.map((t=>s.ScVal.fromXDR(t,"base64")))),r=ie(e.predecessor??ue);return ce(t,"execute",[P(),v(e.target),k(e.functionName),o,r,ie(e.salt)])}function He(t,e,o){return ye(t,se("UpgradeGov",I(e.wasmHash)),o)}function Xe(t,e,o){return ye(t,se("UpdateGovDelay",T(e.newDelay)),o)}function Fe(t,e,o){return ye(t,se("GrantGovRole",le(e)),o)}function Qe(t,e,o){return ye(t,se("RevokeGovRole",le(e)),o)}function Ke(t,e,o){return ye(t,se("TransferGovOwnership",ae(e)),o)}const Ze=t=>t.toXDR("base64"),Je=t=>s.ScVal.fromXDR(t,"base64"),Ye=t=>t.map((t=>String(i(Je(t))))).join(":"),to=t=>"bigint"==typeof t||"number"==typeof t?t.toString():String(t),eo=t=>Number(t),oo=t=>String(t),ro=t=>null==t?void 0:to(t),no=t=>null==t?void 0:oo(t),uo=t=>t instanceof Uint8Array?Buffer.from(t).toString("hex"):Buffer.isBuffer(t)?t.toString("hex"):String(t),io=["None","Multiply","Long","Short"],so=["Single","PrimaryWithAnchor"],ao=["ReflectorSep40","RedStonePriceFeed"],po=["Spot","Twap"],lo=["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"],co=t=>Array.isArray(t)?t:[],yo=(t,e)=>{const o="Borrow"===e;return{action:(r=t[0],lo[eo(r)]??to(r)),positionType:e,hubId:eo(t[1]),asset:oo(t[2]),scaledAmountRay:to(t[3]),indexRay:to(t[4]),amount:to(t[5]),liquidationThresholdBps:o?void 0:eo(t[6]),liquidationBonusBps:o?void 0:eo(t[7]),loanToValueBps:o?void 0:eo(t[8]),liquidationFeesBps:o?void 0:eo(t[9])};var r},bo=t=>{return{owner:oo(t[0]),spokeId:eo(t[1]),mode:(e=t[2],io[eo(e)]??"None")};var e},fo=(t,e)=>{const o=po[eo(t[`${e}_read_mode`])]??"Spot",r=t[`${e}_asset`],n=t[`${e}_symbol`],u=null!=r?{kind:"Stellar",value:oo(r)}:null!=n?{kind:"Symbol",value:oo(n)}:void 0;return{provider:ao[eo(t[`${e}_provider`])]??"ReflectorSep40",contractAddress:oo(t[`${e}_contract`]),asset:u,feedId:no(t[`${e}_feed_id`]),readMode:o,twapRecords:"Twap"===o?eo(t[`${e}_twap_records`]):void 0,decimals:eo(t[`${e}_decimals`]),resolutionSeconds:eo(t[`${e}_resolution_seconds`]),maxStaleSeconds:eo(t[`${e}_max_stale_seconds`])}},mo=t=>{const e=null!==t.anchor_provider&&void 0!==t.anchor_provider;return{baseTokenId:oo(t.base_token_id),quoteTokenId:oo(t.quote_token_id),tolerance:{upperRatio:eo(t.upper_ratio_bps??t.tolerance?.upper_ratio_bps),lowerRatio:eo(t.lower_ratio_bps??t.tolerance?.lower_ratio_bps)},assetDecimals:eo(t.asset_decimals),maxPriceStaleSeconds:eo(t.max_price_stale_seconds),strategy:so[eo(t.strategy)]??"Single",primary:fo(t,"primary"),anchor:e?fo(t,"anchor"):void 0,primaryQuoteToken:no(t.primary_quote_token),anchorQuoteToken:no(t.anchor_quote_token),minSanityPriceWad:ro(t.min_sanity_price_wad),maxSanityPriceWad:ro(t.max_sanity_price_wad)}},go={"market:create":t=>({topic:"market:create",data:{hubId:eo(t.hub_id),baseAsset:oo(t.base_asset),maxBorrowRate:to(t.max_borrow_rate),baseBorrowRate:to(t.base_borrow_rate),slope1:to(t.slope1),slope2:to(t.slope2),slope3:to(t.slope3),midUtilization:to(t.mid_utilization),optimalUtilization:to(t.optimal_utilization),maxUtilization:to(t.max_utilization),reserveFactor:eo(t.reserve_factor),marketAddress:oo(t.market_address)}}),"market:params_update":t=>({topic:"market:params_update",data:{asset:oo(t.asset),maxBorrowRateRay:to(t.max_borrow_rate),baseBorrowRateRay:to(t.base_borrow_rate),slope1Ray:to(t.slope1),slope2Ray:to(t.slope2),slope3Ray:to(t.slope3),midUtilizationRay:to(t.mid_utilization),optimalUtilizationRay:to(t.optimal_utilization),maxUtilizationRay:to(t.max_utilization),reserveFactorBps:eo(t.reserve_factor)}}),"market:batch_state_update":t=>({topic:"market:batch_state_update",data:{updates:co(t).map((t=>{return e=co(t),{hubId:eo(e[0]),asset:oo(e[1]),timestamp:eo(e[2]),supplyIndexRay:to(e[3]),borrowIndexRay:to(e[4]),cash:to(e[5]),suppliedRay:to(e[6]),borrowedRay:to(e[7]),revenueRay:to(e[8])};var e}))}}),"market:batch_params_update":t=>({topic:"market:batch_params_update",data:{updates:co(t).map((t=>{const e=t;return{hubId:eo(e.hub_id),asset:oo(e.asset),params:(o=e.params,{maxBorrowRateRay:to(o.max_borrow_rate),baseBorrowRateRay:to(o.base_borrow_rate),slope1Ray:to(o.slope1),slope2Ray:to(o.slope2),slope3Ray:to(o.slope3),midUtilizationRay:to(o.mid_utilization),optimalUtilizationRay:to(o.optimal_utilization),maxUtilizationRay:to(o.max_utilization),reserveFactorBps:eo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:eo(o.flashloan_fee),assetId:oo(o.asset_id),assetDecimals:eo(o.asset_decimals)})};var o}))}}),"position:batch_update":t=>{const e=co(t);return{topic:"position:batch_update",data:{accountId:to(e[0]),accountAttributes:bo(co(e[1])),updates:[...co(e[2]).map((t=>yo(co(t),"Deposit"))),...co(e[3]).map((t=>yo(co(t),"Borrow")))]}}},"position:flash_loan":t=>({topic:"position:flash_loan",data:{hubId:eo(t.hub_id),asset:oo(t.asset),receiver:oo(t.receiver),caller:oo(t.caller),amount:to(t.amount),fee:to(t.fee)}}),"config:oracle":t=>({topic:"config:oracle",data:{asset:oo(t.asset),oracle:mo(t.oracle)}}),"position:liquidation":t=>({topic:"position:liquidation",data:{liquidator:oo(t.liquidator),accountId:to(t.account_id),repaidUsdWad:to(t.repaid_usd_wad),bonusBps:to(t.bonus_bps)}}),"debt:bad_debt":t=>({topic:"debt:bad_debt",data:{accountId:to(t.account_id),totalBorrowUsdWad:to(t.total_borrow_usd_wad),totalCollateralUsdWad:to(t.total_collateral_usd_wad)}}),"strategy:initial_payment":t=>({topic:"strategy:initial_payment",data:{token:oo(t.token),amount:to(t.amount),usdValueWad:to(t.usd_value_wad),accountId:to(t.account_id)}}),"strategy:fee":t=>({topic:"strategy:fee",data:{hubId:eo(t.hub_id),asset:oo(t.asset),amount:to(t.amount),fee:to(t.fee),amountSent:to(t.amount_sent)}}),"config:approve_token":t=>({topic:"config:approve_token",data:{wasmHash:uo(t.wasm_hash),approved:Boolean(t.approved)}}),"config:aggregator":t=>({topic:"config:aggregator",data:{aggregator:oo(t.aggregator)}}),"config:accumulator":t=>({topic:"config:accumulator",data:{accumulator:oo(t.accumulator)}}),"config:pool_template":t=>({topic:"config:pool_template",data:{wasmHash:uo(t.wasm_hash)}}),"config:position_limits":t=>({topic:"config:position_limits",data:{maxSupplyPositions:eo(t.max_supply_positions),maxBorrowPositions:eo(t.max_borrow_positions)}}),"config:oracle_disabled":t=>({topic:"config:oracle_disabled",data:{asset:oo(t.asset)}}),"config:spoke":t=>{const e=t.spoke;return{topic:"config:spoke",data:{spokeId:eo(e.spoke_id),isDeprecated:Boolean(e.is_deprecated),liquidationTargetHfWad:to(e.liquidation_target_hf_wad),healthFactorForMaxBonusWad:to(e.hf_for_max_bonus_wad),liquidationBonusFactorBps:eo(e.liquidation_bonus_factor_bps)}}}},ho=Object.freeze(Object.keys(go));function So(t,e){const o=Ye(t),r=go[o];return r?r(i(Je(e))):null}const xo="XLENDXLM-a7c9f3",vo=1e4;function qo(t){const e=BigInt(t).toString(16),o=e.length%2==0?e:`0${e}`;return`${xo}-${o}`}function To(t){const e=t.split("-");return e.length>=2&&parseInt(e[1],10)||0}function _o(t,e=0){return t*vo+e}function wo(t){switch(t){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Ao=(t,e,o)=>{const r=new URL(e,t.endsWith("/")?t:`${t}/`);if(o)for(const[t,e]of Object.entries(o))void 0!==e&&r.searchParams.set(t,String(e));return r.toString()},ko=t=>t.baseUrl??f[t.network];async function Po(t,e){if(null==t.amountIn==(null==t.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Ao(ko(e),"api/v1/quote",{from:t.from,to:t.to,amountIn:t.amountIn,amountOut:t.amountOut,maxHops:t.maxHops,maxSplits:t.maxSplits,slippage:t.slippage,includePaths:t.includePaths,sender:t.sender,router:t.router,platform:t.platform,fresh:t.fresh}),r=await fetch(o,e.fetchOptions);if(!r.ok){const t=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${t}`)}return await r.json()}async function Eo(t){const e=Ao(ko(t),"api/v1/tokens"),o=await fetch(e,t.fetchOptions);if(!o.ok){const t=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${e} — ${t}`)}return await o.json()}const Io=t=>$(t).toXDR("base64");function Ro(e,n){const i=e.routerAddress??h(e.network),s=new r(i),a=new t(e.caller,e.sourceSequence),p=D(((t,e)=>(t=>Boolean(t&&"object"==typeof t&&!(t instanceof Uint8Array)&&"paths"in t))(t)&&void 0===t.referralId?{...t,referralId:e??0}:t)(n,e.referralId));return{xdr:new u(a,{fee:e.fee??o,networkPassphrase:m[e.network]}).addOperation(s.call("execute_strategy",v(e.caller),q(e.totalIn),p)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Oo(t,e){return Ro(t,e)}function Mo(t,e={}){if("string"!=typeof t.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:t.paths?t.paths.map((t=>({hops:t.swaps.map($o),splitPpm:t.splitPpm}))):[{hops:t.hops.map($o),splitPpm:1e6}],referralId:e.referralId??0,tokenIn:t.from,tokenOut:t.to,totalMinOut:t.amountOutMin}}function Uo(t,e={}){const o=t;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Mo(t,e)}const Lo=Mo,$o=t=>({amountOut:t.amountOut,pool:t.address,tokenIn:t.from,tokenOut:t.to,venue:t.dex});function No(t,e){const o=e instanceof Error?e.message:String(e);return new Error(`[xoxno-invoked:${t}] ${o}`)}async function Co(t,e,o){const r=u.fromXDR(e,"base64");try{return(await t.prepareTransaction(r)).toXDR()}catch(t){if(o?.invokedContractId)throw No(o.invokedContractId,t);throw t}}async function Do(t,e,o){return Co(t,e.xdr,o)}function Bo(t){if(t<=0||t>4)throw new Error(`Invalid PositionMode ${t} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return t-1}function Go(t,e){return{paths:[{hops:[{amountOut:"0",pool:t,tokenIn:t,tokenOut:t,venue:"Soroswap"}],splitPpm:1e6}],referralId:0,tokenIn:t,tokenOut:t,totalMinOut:e}}const zo=t=>{const e=t.startsWith("0x")?t.slice(2):t;if(e.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(e,"hex")};function Vo(e){const o=new t(e.caller,e.sourceSequence),n=new r(e.forwarderAddress).call("mint_and_forward",s.ScVal.scvBytes(zo(e.message)),s.ScVal.scvBytes(zo(e.attestation)));return{xdr:new u(o,{fee:e.fee??"10000000",networkPassphrase:m[e.network]}).addOperation(n).setTimeout(e.timeoutSeconds??120).build().toXDR()}}}},p={};function l(t){var e=p[t];if(void 0!==e)return e.exports;var o=p[t]={exports:{}};return a[t](o,o.exports,l),o.exports}l.d=(t,e)=>{for(var o in e)l.o(e,o)&&!l.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},l.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const c="https://api.xoxno.com",d="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",y="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",b="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var f;!function(t){t.MAINNET="1",t.DEVNET="D"}(f||(f={}));class m{apiUrl;chain;init;config;constructor({chain:t=f.MAINNET,apiUrl:e=c,...o}={}){this.apiUrl=e??{[f.MAINNET]:c,[f.DEVNET]:"https://devnet-api.xoxno.com"}[t],this.chain=t,this.init=o,this.config=t==f.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:d,DR_SC:y,KG_SC:b,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:d,DR_SC:y,KG_SC:b,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(t,{params:e,...o}={})=>{const{next:r,cache:n,debug:u,...i}=this.init,{next:s,cache:a,debug:p,headers:l,method:c="GET",...d}=o,y=l?.Authorization,b="Bearer undefined"===y?void 0:y,f={...l,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===c?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},m=Object.entries(e??{}).flatMap((([t,e])=>Array.isArray(e)?e.map((e=>`${t}=${encodeURIComponent(e)}`)):`${t}=${encodeURIComponent(e)}`)).join("&"),g=`${this.apiUrl}${t}${m.length?`?${m}`:""}`,{revalidate:h,...S}=r??{},{revalidate:x,...v}=s??{},q="GET"!==c||b?void 0:x??h,T="GET"!==c||b||q?void 0:a??n,_={...i,...d,method:c,...Object.keys(f).length?{headers:f}:{},cache:T,next:{...S,...v,revalidate:q}};(p??u)&&console.debug("SDK fetch: ",g,_);const w=await fetch(g,_).catch((t=>{if(t instanceof Error&&!t.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${g}: ${t.message}`),{cause:t});throw t})),A=await w.text();if(!w.ok){let t;try{t=JSON.parse(A)}catch{t={message:A}}const e=[g,w.status,w.statusText,t.message].filter(Boolean).join(";;");throw new Error(e)}try{return JSON.parse(A)}catch{return A}}}const g=t=>{const e=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(t)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);return e||o},h=t=>{const e=/^0x[a-fA-F0-9]{1,64}$/.test(t),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);return e||o};class S extends Error{constructor(t){super(`Invalid collection ticker: ${t}`)}}class x extends Error{constructor(t){super(`Invalid address: ${t}`)}}Error,Error;const v=t=>!!t&&(t.startsWith("erd1")&&62===t.length||/^0x[a-fA-F0-9]{40,64}$/.test(t)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(t)||/^G[A-Z2-7]{55}$/.test(t)),q={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},T=["PATCH","POST","DELETE","PUT"];var _=l(388);const w=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()));function A(t,e,o,r){const{input:n,output:u,...i}=e,s=async(e={})=>{const n={...o,...e},u=t.replace(/:([a-zA-Z_]+)/g,((t,e)=>`${n[e]}`)),i=[...t.matchAll(/:([a-zA-Z_]+)/g)].map((t=>t[1])),s=Object.fromEntries(Object.entries(n).filter((([t])=>!i.includes(t)))),a=/:address[^A-Z]/.test(t)||"address"in s,p=/:collection[^A-Z]/.test(t)||"collection"in s;if(a){const t=n.address;if(!v(t))throw new x(t)}if(p){const t=n.collection;if(Array.isArray(t)?t.some((t=>!g(t))):!g(t))throw new S(t)}const l=Object.fromEntries(Object.entries(s).map((([t,e])=>[t,e instanceof FormData?e:"filter"===t||"body"===t?JSON.stringify(e):Array.isArray(e)?e.join(","):e]))),{body:c,auth:d,method:y,headers:b,cache:f,next:m,debug:h,continuationToken:q,...T}=l,_=d?`Bearer ${d}`:void 0,w={...b,..._?{Authorization:_}:{},...q?{"X-Continuation-Token":String(q)}:{}},A={...m,tags:[...m?.tags??[],u]};return r.fetchWithTimeout(u,{method:y,params:T,body:c,headers:w,cache:f,debug:h,...A?{next:A}:{}})},a=(t={})=>s(t);for(const t of Object.keys(i))T.includes(t)&&(a[t]=e=>s({...e,method:e.method??t.toUpperCase()}));return a}function k(t){const e=function(){const t={static:{},params:{},leaves:[]};for(const[e,o]of Object.entries(q)){const r=e.split("/").filter(Boolean);let n=t;for(const t of r)if(t.startsWith(":")){const e=w(t.slice(1));n=n.params[e]||={static:{},params:{},leaves:[]}}else{const e=w(t);n=n.static[e]||={static:{},params:{},leaves:[]}}n.leaves.push({rawPath:e,def:o})}return t}(),o=(e,r)=>{const n=e.leaves.length,u=Object.keys(e.static).length,i=Object.keys(e.params).length;let s;if(1===n&&u+i>0){const{rawPath:o,def:n}=e.leaves[0];s=A(o,n,r,t)}else{s={};for(const{rawPath:o,def:n}of e.leaves)s[w(o.split("/").pop().replace(/^:/,""))]=A(o,n,r,t)}for(const[t,n]of Object.entries(e.static)){const e=o(n,r);let u=e;if(e&&"object"==typeof e&&t in e&&"function"==typeof e[t]){const o=e[t],r=Object.fromEntries(Object.entries(e).filter((([e])=>e!==t)));1===o.length||(Object.assign(o,r),u=o)}void 0===s[t]?s[t]=u:"function"==typeof s[t]?Object.assign(s[t],u):"function"==typeof u?(Object.assign(u,s[t]),s[t]=u):Object.assign(s[t],u)}for(const[t,n]of Object.entries(e.params)){const e=e=>{const u=o(n,{...r,[t]:e});if(u&&"object"==typeof u&&1===Object.keys(u).length&&t in u&&"function"==typeof u[t]){const e=u[t],o=(...t)=>e(...t);return Object.assign(o,e)}return u};if(s[t]){const o=s[t];s[t]=t=>({...o(t),...e(t)})}else s[t]=e}return s};return o(e,{})}export{f as Chain,m as XOXNOClient,k as buildSdk,g as isValidCollectionTicker,h as isValidNftIdentifier};export const STELLAR_AGGREGATOR_ROUTER=_.ME;export const STELLAR_GOVERNANCE=_.nO;export const STELLAR_GOVERNANCE_ZERO_PREDECESSOR=_.G_;export const STELLAR_LENDING_CONTROLLER=_.DU;export const STELLAR_LENDING_TOPICS=_.fA;export const STELLAR_NETWORK_PASSPHRASE=_.A$;export const STELLAR_QUOTE_URL=_.J9;export const STELLAR_SOROBAN_RPC_URL=_.hS;export const SYNTHETIC_EVENT_ORDER_STRIDE=_.gR;export const XOXNO_LENDING_STELLAR_TICKER=_.Cg;export const buildSameTokenRepaySwapSteps=_.VZ;export const buildStellarAcceptOwnershipTx=_.N0;export const buildStellarAddRewardsTx=_.B_;export const buildStellarApproveTokenTx=_.eX;export const buildStellarBatchSwapTx=_.z;export const buildStellarBorrowBatchTx=_.xD;export const buildStellarBorrowTx=_.jR;export const buildStellarCctpForwardTx=_.P2;export const buildStellarClaimRevenueTx=_.W6;export const buildStellarCreateLiquidityPoolTx=_.se;export const buildStellarDisableTokenOracleTx=_.ln;export const buildStellarExecuteStrategyTx=_.yr;export const buildStellarFlashLoanTx=_.sp;export const buildStellarGovernanceExecuteGovernanceUpgradeTx=_.$9;export const buildStellarGovernanceExecuteGrantGovernanceRoleTx=_.zw;export const buildStellarGovernanceExecuteRevokeGovernanceRoleTx=_.h_;export const buildStellarGovernanceExecuteTransferGovOwnTx=_.e_;export const buildStellarGovernanceExecuteTx=_.Tk;export const buildStellarGovernanceExecuteUpdateDelayTx=_.BA;export const buildStellarGrantRoleTx=_.SX;export const buildStellarLendingIdentifier=_.UF;export const buildStellarLiquidateTx=_.Y5;export const buildStellarMigrateFromBlendTx=_.mE;export const buildStellarMigrateTx=_.xG;export const buildStellarMultiplyTx=_.s9;export const buildStellarPauseTx=_.OL;export const buildStellarProposeAddAssetToSpokeTx=_.k6;export const buildStellarProposeAddSpokeTx=_.dj;export const buildStellarProposeApproveBlendPoolTx=_.kD;export const buildStellarProposeApproveTokenTx=_.Yf;export const buildStellarProposeConfigureMarketOracleTx=_.c5;export const buildStellarProposeCreateHubTx=_.N8;export const buildStellarProposeCreateLiquidityPoolTx=_.qU;export const buildStellarProposeDeployPoolTx=_.RZ;export const buildStellarProposeDisableTokenOracleTx=_.PD;export const buildStellarProposeEditAssetInSpokeTx=_.ni;export const buildStellarProposeEditOracleToleranceTx=_.hF;export const buildStellarProposeGovernanceUpgradeTx=_.Qk;export const buildStellarProposeGrantGovernanceRoleTx=_.Gw;export const buildStellarProposeMigrateControllerTx=_.$K;export const buildStellarProposeRemoveAssetFromSpokeTx=_.uj;export const buildStellarProposeRemoveSpokeTx=_.Od;export const buildStellarProposeRevokeBlendPoolTx=_.X7;export const buildStellarProposeRevokeGovernanceRoleTx=_.Ub;export const buildStellarProposeRevokeTokenTx=_.Dx;export const buildStellarProposeSetAccumulatorTx=_.OA;export const buildStellarProposeSetAggregatorTx=_.$U;export const buildStellarProposeSetMinBorrowCollatTx=_.ob;export const buildStellarProposeSetPoolTemplateTx=_.cY;export const buildStellarProposeSetPositionLimitsTx=_.$l;export const buildStellarProposeSetPositionManagerTx=_.K;export const buildStellarProposeTransferCtrlOwnershipTx=_.VS;export const buildStellarProposeTransferGovOwnTx=_.HP;export const buildStellarProposeUpdateDelayTx=_.YQ;export const buildStellarProposeUpgradeControllerTx=_.QY;export const buildStellarProposeUpgradePoolParamsTx=_.os;export const buildStellarProposeUpgradePoolTx=_.Ko;export const buildStellarRenewAccountTx=_.IJ;export const buildStellarRepayBatchTx=_.nw;export const buildStellarRepayDebtWithCollateralTx=_.Pr;export const buildStellarRepayTx=_.ZE;export const buildStellarRevokeRoleTx=_.ev;export const buildStellarRevokeTokenTx=_.P8;export const buildStellarSetAccumulatorTx=_.aV;export const buildStellarSetAggregatorTx=_.p2;export const buildStellarSetLiquidityPoolTemplateTx=_.Ww;export const buildStellarSetMarketOracleConfigTx=_.sV;export const buildStellarSetOracleToleranceTx=_.Js;export const buildStellarSetPositionLimitsTx=_.Dy;export const buildStellarSupplyBatchTx=_.Ni;export const buildStellarSupplyTx=_.v_;export const buildStellarSwapCollateralTx=_.qD;export const buildStellarSwapDebtTx=_.qR;export const buildStellarTransferOwnershipTx=_.QJ;export const buildStellarUnpauseTx=_.bm;export const buildStellarUpdateAccountThresholdTx=_.n_;export const buildStellarUpdateIndexesTx=_.v8;export const buildStellarUpgradeControllerTx=_.qM;export const buildStellarUpgradeLiquidityPoolParamsTx=_.gH;export const buildStellarWithdrawBatchTx=_.O3;export const buildStellarWithdrawTx=_.Gz;export const buildTx=_.pr;export const decodeStellarLendingEvent=_.Fm;export const encodeInterestRateModel=_.MB;export const encodeMarketOracleConfigInput=_.Dn;export const encodeMarketParamsRaw=_.pq;export const encodeOracleSourceConfigInput=_.ml;export const encodePositionLimits=_.Q3;export const encodeStrategyPayloadToRouteXdr=_.wf;export const extractEventOrder=_.Um;export const getStellarAccountPositions=_.xO;export const getStellarAggregatorQuote=_.Lw;export const getStellarAggregatorRouter=_.KM;export const getStellarAsset=_.mM;export const getStellarAssetGraph=_.iE;export const getStellarAssetMarkets=_.zp;export const getStellarAssetPage=_.N3;export const getStellarAssets=_.bN;export const getStellarGovernance=_.QV;export const getStellarGovernanceProposals=_.T_;export const getStellarHub=_.XI;export const getStellarHubGraph=_.Lt;export const getStellarHubs=_.KK;export const getStellarLendingContext=_.yl;export const getStellarLendingController=_.vc;export const getStellarQuoteTokens=_.CH;export const getStellarReserve=_.FI;export const getStellarReserveGraph=_.KG;export const getStellarReserveHolders=_.nW;export const getStellarReserves=_.jF;export const getStellarSpoke=_.S2;export const getStellarSpokeGraph=_.uS;export const getStellarSpokes=_.u_;export const getStellarUserActivity=_.O5;export const getStellarUserPositions=_.Av;export const mapQuoteResponseToAggregatorSwap=_.LA;export const mapQuoteResponseToStrategyPayload=_.E6;export const mapQuoteResponseToStrategySwap=_.Ds;export const mapStellarPositionActivityType=_.CU;export const prepareStellarBuiltTx=_.Vx;export const prepareStellarTxXdr=_.DL;export const stellarLendingDispatchKey=_.ON;export const stellarLendingRead=_.Hh;export const syntheticEventOrder=_.oV;export const tagStellarInvokedContractError=_.g5;export const toBase64Xdr=_.L;export const toStellarPositionMode=_.Vu;
@@ -48,6 +48,10 @@ export interface SpokeAssetArgs {
48
48
  asset: string;
49
49
  canCollateral: boolean;
50
50
  canBorrow: boolean;
51
+ /** ADR 0011 per-listing incident flag: blocks supply/borrow/withdraw/repay. */
52
+ paused: boolean;
53
+ /** ADR 0011 per-listing incident flag: blocks new supply/borrow, exits stay live. */
54
+ frozen: boolean;
51
55
  ltv: number;
52
56
  threshold: number;
53
57
  bonus: number;
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>o,STELLAR_GOVERNANCE:()=>a,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ye,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>Sr,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>s,STELLAR_SOROBAN_RPC_URL:()=>n,SYNTHETIC_EVENT_ORDER_STRIDE:()=>_r,XOXNO_LENDING_STELLAR_TICKER:()=>hr,buildSameTokenRepaySwapSteps:()=>qr,buildStellarAcceptOwnershipTx:()=>Ne,buildStellarAddRewardsTx:()=>Ke,buildStellarApproveTokenTx:()=>De,buildStellarBatchSwapTx:()=>Ir,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>C,buildStellarCctpForwardTx:()=>Vr,buildStellarClaimRevenueTx:()=>Qe,buildStellarCreateLiquidityPoolTx:()=>He,buildStellarDisableTokenOracleTx:()=>ze,buildStellarExecuteStrategyTx:()=>Ar,buildStellarFlashLoanTx:()=>z,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Ft,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ht,buildStellarGovernanceExecuteTransferGovOwnTx:()=>jt,buildStellarGovernanceExecuteTx:()=>Mt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Xt,buildStellarGrantRoleTx:()=>Be,buildStellarLendingIdentifier:()=>wr,buildStellarLiquidateTx:()=>M,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>Ae,buildStellarMultiplyTx:()=>F,buildStellarPauseTx:()=>Ie,buildStellarProposeAddAssetToSpokeTx:()=>wt,buildStellarProposeAddSpokeTx:()=>ht,buildStellarProposeApproveBlendPoolTx:()=>kt,buildStellarProposeApproveTokenTx:()=>vt,buildStellarProposeConfigureMarketOracleTx:()=>Ut,buildStellarProposeCreateHubTx:()=>bt,buildStellarProposeCreateLiquidityPoolTx:()=>Pt,buildStellarProposeDeployPoolTx:()=>It,buildStellarProposeDisableTokenOracleTx:()=>Bt,buildStellarProposeEditAssetInSpokeTx:()=>gt,buildStellarProposeEditOracleToleranceTx:()=>Gt,buildStellarProposeGovernanceUpgradeTx:()=>Ct,buildStellarProposeGrantGovernanceRoleTx:()=>Dt,buildStellarProposeMigrateControllerTx:()=>$t,buildStellarProposeRemoveAssetFromSpokeTx:()=>yt,buildStellarProposeRemoveSpokeTx:()=>_t,buildStellarProposeRevokeBlendPoolTx:()=>Et,buildStellarProposeRevokeGovernanceRoleTx:()=>Vt,buildStellarProposeRevokeTokenTx:()=>Rt,buildStellarProposeSetAccumulatorTx:()=>mt,buildStellarProposeSetAggregatorTx:()=>pt,buildStellarProposeSetMinBorrowCollatTx:()=>xt,buildStellarProposeSetPoolTemplateTx:()=>ft,buildStellarProposeSetPositionLimitsTx:()=>St,buildStellarProposeSetPositionManagerTx:()=>Tt,buildStellarProposeTransferCtrlOwnershipTx:()=>Nt,buildStellarProposeTransferGovOwnTx:()=>Wt,buildStellarProposeUpdateDelayTx:()=>qt,buildStellarProposeUpgradeControllerTx:()=>Lt,buildStellarProposeUpgradePoolParamsTx:()=>At,buildStellarProposeUpgradePoolTx:()=>Ot,buildStellarRenewAccountTx:()=>Fe,buildStellarRepayBatchTx:()=>V,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>W,buildStellarRevokeRoleTx:()=>Le,buildStellarRevokeTokenTx:()=>Ve,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ce,buildStellarSetMarketOracleConfigTx:()=>We,buildStellarSetOracleToleranceTx:()=>Me,buildStellarSetPositionLimitsTx:()=>qe,buildStellarSupplyBatchTx:()=>N,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>j,buildStellarSwapDebtTx:()=>H,buildStellarTransferOwnershipTx:()=>$e,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Ze,buildStellarUpdateIndexesTx:()=>Xe,buildStellarUpgradeControllerTx:()=>Pe,buildStellarUpgradeLiquidityPoolParamsTx:()=>je,buildStellarWithdrawBatchTx:()=>q,buildStellarWithdrawTx:()=>D,buildTx:()=>$,decodeStellarLendingEvent:()=>br,encodeInterestRateModel:()=>ye,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>Te,encodeOracleSourceConfigInput:()=>ke,encodePositionLimits:()=>xe,encodeStrategyPayloadToRouteXdr:()=>Pr,extractEventOrder:()=>gr,getStellarAccountPositions:()=>me,getStellarAggregatorQuote:()=>Rr,getStellarAggregatorRouter:()=>u,getStellarAsset:()=>se,getStellarAssetGraph:()=>Se,getStellarAssetMarkets:()=>ie,getStellarAssetPage:()=>le,getStellarAssets:()=>ee,getStellarGovernance:()=>c,getStellarGovernanceProposals:()=>fe,getStellarHub:()=>ue,getStellarHubGraph:()=>be,getStellarHubs:()=>te,getStellarLendingContext:()=>J,getStellarLendingController:()=>i,getStellarQuoteTokens:()=>kr,getStellarReserve:()=>ae,getStellarReserveGraph:()=>_e,getStellarReserveHolders:()=>ne,getStellarReserves:()=>oe,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>he,getStellarSpokes:()=>re,getStellarUserActivity:()=>pe,getStellarUserPositions:()=>de,mapQuoteResponseToAggregatorSwap:()=>Lr,mapQuoteResponseToStrategyPayload:()=>Or,mapQuoteResponseToStrategySwap:()=>Br,mapStellarPositionActivityType:()=>Tr,prepareStellarBuiltTx:()=>Gr,prepareStellarTxXdr:()=>Ur,stellarLendingDispatchKey:()=>Zt,stellarLendingRead:()=>we,syntheticEventOrder:()=>yr,tagStellarInvokedContractError:()=>Nr,toBase64Xdr:()=>Qt,toStellarPositionMode:()=>Cr});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},o={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},a={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},n={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},s={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 i(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 u(e){const t=o[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 c(e){const t=a[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const d=require("@stellar/stellar-sdk"),p=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m=e=>new d.Address(e).toScVal(),f=e=>new d.ScInt(e).toI128(),S=e=>d.xdr.ScVal.scvU32(e),b=e=>new d.ScInt("string"==typeof e?e:e.toString()).toU64(),h=e=>d.xdr.ScVal.scvBool(e),_=e=>d.xdr.ScVal.scvString(e),w=e=>d.xdr.ScVal.scvSymbol(e),g=()=>d.xdr.ScVal.scvVoid(),y=e=>d.xdr.ScVal.scvVec(e),T=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return d.xdr.ScVal.scvBytes(o)},x=(e,t)=>null==e?g():t(e),v=e=>d.xdr.ScVal.scvVec(e.map((e=>{return t=e.token,r=e.amount,d.xdr.ScVal.scvVec([m(t),f(r)]);var t,r}))),R=(e,t)=>P({asset:m(t),hub_id:S(e)}),k=(e,t,r)=>d.xdr.ScVal.scvVec([R(e,t),f(r)]),E=e=>d.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),P=e=>{const t=Object.keys(e).sort().map((t=>new d.xdr.ScMapEntry({key:w(t),val:e[t]})));return d.xdr.ScVal.scvMap(t)},A=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return P({amount_out:f(e.amountOut),pool:m(e.pool),token_in:m(e.tokenIn),token_out:m(e.tokenOut),venue:(t=e.venue,d.xdr.ScVal.scvVec([w(t)]))});var t}));return P({hops:d.xdr.ScVal.scvVec(t),split_ppm:S(e.splitPpm)})}));return P({paths:d.xdr.ScVal.scvVec(t),referral_id:b(e.referralId??0),token_in:m(e.tokenIn),token_out:m(e.tokenOut),total_min_out:f(e.totalMinOut)})},I=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 d.xdr.ScVal.scvBytes(t)},O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},B=e=>{if("string"==typeof e)return I(O(e));if(e instanceof Uint8Array)return I(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?I(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?I(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?I(O(e.bytes)):I(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!p.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),d.xdr.ScVal.scvBytes(Buffer.from(A(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return d.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return d.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function $(e,t,r){const o=e.controllerAddress??i(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function N(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"supply",[m(e.caller),b(r),S(o),E([...t.assets])])}function U(e,t){return N(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return $(e,"borrow",[m(e.caller),b(t.accountNonce),E([...t.borrows]),x(t.to,m)])}function C(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function q(e,t){return $(e,"withdraw",[m(e.caller),b(t.accountNonce),E([...t.withdrawals]),x(t.to,m)])}function D(e,t){return q(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function V(e,t){return $(e,"repay",[m(e.caller),b(t.accountNonce),E([...t.payments])])}function W(e,t){return V(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function M(e,t){return $(e,"liquidate",[m(e.caller),b(t.accountNonce),E([...t.debtPayments])])}function z(e,t){return $(e,"flash_loan",[m(e.caller),R(t.hubId,t.asset),f(t.amount),m(t.receiver),L(t.data)])}function X(e,t){return $(e,"migrate_from_blend",[m(e.caller),b(t.accountId),S(t.spokeId),S(t.hubId),m(t.blendPool),y(t.collateralTokens.map(m)),y(t.supplyTokens.map(m)),v(t.debtCaps.map((e=>({token:e.token,amount:e.cap}))))])}function F(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"multiply",[m(e.caller),b(r),S(o),R(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),R(t.debt.hubId,t.debt.asset),S(t.mode),B(t.steps),x(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),x(t.convertSwap,B)])}function H(e,t){return $(e,"swap_debt",[m(e.caller),b(t.accountNonce),R(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),R(t.newDebt.hubId,t.newDebt.asset),B(t.steps)])}function j(e,t){return $(e,"swap_collateral",[m(e.caller),b(t.accountNonce),R(t.current.hubId,t.current.asset),f(t.fromAmount),R(t.newCollateral.hubId,t.newCollateral.asset),B(t.steps)])}function Q(e,t){return $(e,"repay_debt_with_collateral",[m(e.caller),b(t.accountNonce),R(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),R(t.debt.hubId,t.debt.asset),B(t.steps),h(t.closePosition)])}const K="/stellar-lending",Z=25,Y=encodeURIComponent,J=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),ee=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),oe=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${K}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ae=(e,t,r,o,a)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}`,a),ne=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}/holders`,{...n,params:{side:a}}),se=(e,t,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,r),le=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...o,params:{...r}}),ie=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...o,params:{side:r}}),ue=(e,t,r)=>e.fetchWithTimeout(`${K}/hubs/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${K}/spokes/${t}`,r),de=(e,t,r)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,r),pe=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},me=(e,t,r)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,r),fe=(e,t={},r)=>{const{top:o=Z,continuationToken:a}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},Se=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...o,params:{...r}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...o,params:{...r}}),he=(e,t,r,o)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...o,params:{...r}}),_e=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}/graph`,{...n,params:{...a}}),we=e=>({context:t=>J(e,t),assets:t=>ee(e,t),hubs:t=>te(e,t),spokes:t=>re(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?oe(e,t,r):oe(e,{},t);var o},reserve:(t,r,o,a)=>ae(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>ne(e,t,r,o,a,n),asset:(t,r)=>se(e,t,r),assetMarkets:(t,r,o)=>ie(e,t,r,o),hub:(t,r)=>ue(e,t,r),spoke:(t,r)=>ce(e,t,r),userPositions:(t,r)=>de(e,t,r),userActivity:(t,r,o)=>pe(e,t,r,o),accountPositions:(t,r)=>me(e,t,r),governanceProposals:(t,r)=>fe(e,t,r),assetGraph:(t,r,o)=>Se(e,t,r,o),hubGraph:(t,r,o)=>be(e,t,r,o),spokeGraph:(t,r,o)=>he(e,t,r,o),reserveGraph:(t,r,o,a,n)=>_e(e,t,r,o,a,n)}),ge={Single:0,PrimaryWithAnchor:1},ye=e=>P({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:S(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Te=e=>P({asset_decimals:S(e.assetDecimals),asset_id:m(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:S(e.flashloanFeeBps),is_flashloanable:h(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:S(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),xe=e=>P({max_borrow_positions:S(e.maxBorrowPositions),max_supply_positions:S(e.maxSupplyPositions)}),ve=e=>{const t=e.kind;switch(t){case"Stellar":return y([w("Stellar"),m(e.value)]);case"Symbol":return y([w("Symbol"),w(e.value)]);case"String":return y([w("String"),_(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Re=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return y([w("Twap"),S(t)])}return y([w("Spot")])},ke=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return y([w("Reflector"),P({asset:ve(e.asset),contract:m(e.contract),read_mode:Re(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 y([w("RedStone"),P({contract:m(e.contract),feed_id:_(e.feedId),max_stale_seconds:b(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=ge[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return P({anchor:(r=e.anchor,y(null==r?[w("None")]:[w("Some"),ke(r)])),max_price_stale_seconds:b(e.maxPriceStaleSeconds),max_sanity_price_wad:f(e.maxSanityPriceWad),min_sanity_price_wad:f(e.minSanityPriceWad),primary:ke(e.primary),strategy:S(t),tolerance_bps:S(e.toleranceBps)});var r};function Pe(e,t){return $(e,"upgrade",[T(t.wasmHash)])}function Ae(e,t){return $(e,"migrate",[S(t.newVersion)])}function Ie(e){return $(e,"pause",[])}function Oe(e){return $(e,"unpause",[])}function Be(e,t){return $(e,"grant_role",[m(t.account),w(t.role)])}function Le(e,t){return $(e,"revoke_role",[m(t.account),w(t.role)])}function $e(e,t){return $(e,"transfer_ownership",[m(t.newOwner),S(t.liveUntilLedger)])}function Ne(e){return $(e,"accept_ownership",[])}function Ue(e,t){return $(e,"set_aggregator",[m(t.aggregator)])}function Ge(e,t){return $(e,"set_accumulator",[m(t.accumulator)])}function Ce(e,t){return $(e,"set_liquidity_pool_template",[T(t.wasmHash)])}function qe(e,t){return $(e,"set_position_limits",[xe(t)])}function De(e,t){return $(e,"approve_token",[m(t.token)])}function Ve(e,t){return $(e,"revoke_token",[m(t.token)])}function We(e,t){return $(e,"set_market_oracle_config",[R(t.hubId,t.asset),Ee(t.config)])}function Me(e,t){return $(e,"set_oracle_tolerance",[m(t.asset),P({lower_ratio_bps:S(t.lowerRatioBps),upper_ratio_bps:S(t.upperRatioBps)})])}function ze(e,t){return $(e,"disable_token_oracle",[m(t.asset)])}function Xe(e,t){return $(e,"update_indexes",[m(e.caller),y(t.assets.map((e=>R(e.hubId,e.asset))))])}function Fe(e,t){return $(e,"renew_account",[m(e.caller),b(t.accountNonce)])}function He(e,t){return $(e,"create_liquidity_pool",[S(t.hubId),m(t.asset),Te(t.params)])}function je(e,t){return $(e,"upgrade_liquidity_pool_params",[R(t.hubId,t.asset),ye(t.params)])}function Qe(e,t){return $(e,"claim_revenue",[m(e.caller),y(t.assets.map((e=>R(e.hubId,e.asset))))])}function Ke(e,t){return $(e,"add_rewards",[m(e.caller),E(t.rewards)])}function Ze(e,t){return $(e,"update_account_threshold",[m(e.caller),h(t.hasRisks),y(t.accountNonces.map((e=>b(e))))])}const Ye="00".repeat(32),Je=e=>{if("string"==typeof e)return T(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 d.xdr.ScVal.scvBytes(t)},et=(e,...t)=>y([w(e),...t]),tt=e=>P({asset:m(e.asset),hub_id:S(e.hubId),params:Te(e.params)}),rt=e=>P({hub_asset:R(e.hubId,e.asset),params:ye(e.params)}),ot=e=>P({new_owner:m(e.newOwner),live_until_ledger:S(e.liveUntilLedger)}),at=e=>P({cfg:Ee(e.config),hub_asset:R(e.hubId,e.asset)}),nt=e=>P({asset:m(e.asset),bonus:S(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:h(e.canBorrow),can_collateral:h(e.canCollateral),hub_id:S(e.hubId),liquidation_fees:S(e.liquidationFees),ltv:S(e.ltv),oracle_override:y([w("None")]),spoke_id:S(e.spokeId),supply_cap:f(e.supplyCap),threshold:S(e.threshold)}),st=e=>P({hub_asset:R(e.hubId,e.asset),spoke_id:S(e.spokeId)}),lt=e=>P({asset:m(e.asset),tolerance:S(e.tolerance)}),it=e=>P({account:m(e.account),role:w(e.role)});function ut(e,t,r){const o=e.governanceAddress??c(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ct=(e,t,r)=>ut(e,"propose",[m(e.caller),t,Je(r)]),dt=(e,t,r)=>ut(e,"execute_self",[g(),t,Je(r)]);function pt(e,t,r){return ct(e,et("SetAggregator",m(t.aggregator)),r)}function mt(e,t,r){return ct(e,et("SetAccumulator",m(t.accumulator)),r)}function ft(e,t,r){return ct(e,et("SetLiquidityPoolTemplate",T(t.wasmHash)),r)}function St(e,t,r){return ct(e,et("SetPositionLimits",xe(t)),r)}function bt(e,t){return ct(e,et("CreateHub"),t)}function ht(e,t){return ct(e,et("AddSpoke"),t)}function _t(e,t,r){return ct(e,et("RemoveSpoke",S(t.spokeId)),r)}function wt(e,t,r){return ct(e,et("AddAssetToSpoke",nt(t)),r)}function gt(e,t,r){return ct(e,et("EditAssetInSpoke",nt(t)),r)}function yt(e,t,r){return ct(e,et("RemoveAssetFromSpoke",st(t)),r)}function Tt(e,t,r){return ct(e,et("SetPositionManager",m(t.manager),h(t.isActive)),r)}function xt(e,t,r){return ct(e,et("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function vt(e,t,r){return ct(e,et("ApproveToken",m(t.token)),r)}function Rt(e,t,r){return ct(e,et("RevokeToken",m(t.token)),r)}function kt(e,t,r){return ct(e,et("ApproveBlendPool",m(t.pool)),r)}function Et(e,t,r){return ct(e,et("RevokeBlendPool",m(t.pool)),r)}function Pt(e,t,r){return ct(e,et("CreateLiquidityPool",tt(t)),r)}function At(e,t,r){return ct(e,et("UpgradeLiquidityPoolParams",rt(t)),r)}function It(e,t){return ct(e,et("DeployPool"),t)}function Ot(e,t,r){return ct(e,et("UpgradePool",T(t.wasmHash)),r)}function Bt(e,t,r){return ct(e,et("DisableTokenOracle",m(t.asset)),r)}function Lt(e,t,r){return ct(e,et("UpgradeController",T(t.wasmHash)),r)}function $t(e,t,r){return ct(e,et("MigrateController",S(t.newVersion)),r)}function Nt(e,t,r){return ct(e,et("TransferCtrlOwnership",ot(t)),r)}function Ut(e,t,r){return ct(e,et("ConfigureMarketOracle",at(t)),r)}function Gt(e,t,r){return ct(e,et("EditOracleTolerance",lt(t)),r)}function Ct(e,t,r){return ct(e,et("UpgradeGov",T(t.wasmHash)),r)}function qt(e,t,r){return ct(e,et("UpdateGovDelay",S(t.newDelay)),r)}function Dt(e,t,r){return ct(e,et("GrantGovRole",it(t)),r)}function Vt(e,t,r){return ct(e,et("RevokeGovRole",it(t)),r)}function Wt(e,t,r){return ct(e,et("TransferGovOwnership",ot(t)),r)}function Mt(e,t){const r=y(t.argsXdr.map((e=>d.xdr.ScVal.fromXDR(e,"base64")))),o=Je(t.predecessor??Ye);return ut(e,"execute",[g(),m(t.target),w(t.functionName),r,o,Je(t.salt)])}function zt(e,t,r){return dt(e,et("UpgradeGov",T(t.wasmHash)),r)}function Xt(e,t,r){return dt(e,et("UpdateGovDelay",S(t.newDelay)),r)}function Ft(e,t,r){return dt(e,et("GrantGovRole",it(t)),r)}function Ht(e,t,r){return dt(e,et("RevokeGovRole",it(t)),r)}function jt(e,t,r){return dt(e,et("TransferGovOwnership",ot(t)),r)}const Qt=e=>e.toXDR("base64"),Kt=e=>d.xdr.ScVal.fromXDR(e,"base64"),Zt=e=>e.map((e=>String((0,d.scValToNative)(Kt(e))))).join(":"),Yt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Jt=e=>Number(e),er=e=>String(e),tr=e=>null==e?void 0:Yt(e),rr=e=>null==e?void 0:er(e),or=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),ar=["None","Multiply","Long","Short"],nr=["Single","PrimaryWithAnchor"],sr=["ReflectorSep40","RedStonePriceFeed"],lr=["Spot","Twap"],ir=["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"],ur=e=>Array.isArray(e)?e:[],cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],ir[Jt(o)]??Yt(o)),positionType:t,hubId:Jt(e[1]),asset:er(e[2]),scaledAmountRay:Yt(e[3]),indexRay:Yt(e[4]),amount:Yt(e[5]),liquidationThresholdBps:r?void 0:Jt(e[6]),liquidationBonusBps:r?void 0:Jt(e[7]),loanToValueBps:r?void 0:Jt(e[8]),liquidationFeesBps:r?void 0:Jt(e[9])};var o},dr=e=>{return{owner:er(e[0]),spokeId:Jt(e[1]),mode:(t=e[2],ar[Jt(t)]??"None")};var t},pr=(e,t)=>{const r=lr[Jt(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:er(o)}:null!=a?{kind:"Symbol",value:er(a)}:void 0;return{provider:sr[Jt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:er(e[`${t}_contract`]),asset:n,feedId:rr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?Jt(e[`${t}_twap_records`]):void 0,decimals:Jt(e[`${t}_decimals`]),resolutionSeconds:Jt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Jt(e[`${t}_max_stale_seconds`])}},mr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:er(e.base_token_id),quoteTokenId:er(e.quote_token_id),tolerance:{upperRatio:Jt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Jt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Jt(e.asset_decimals),maxPriceStaleSeconds:Jt(e.max_price_stale_seconds),strategy:nr[Jt(e.strategy)]??"Single",primary:pr(e,"primary"),anchor:t?pr(e,"anchor"):void 0,primaryQuoteToken:rr(e.primary_quote_token),anchorQuoteToken:rr(e.anchor_quote_token),minSanityPriceWad:tr(e.min_sanity_price_wad),maxSanityPriceWad:tr(e.max_sanity_price_wad)}},fr={"market:create":e=>({topic:"market:create",data:{hubId:Jt(e.hub_id),baseAsset:er(e.base_asset),maxBorrowRate:Yt(e.max_borrow_rate),baseBorrowRate:Yt(e.base_borrow_rate),slope1:Yt(e.slope1),slope2:Yt(e.slope2),slope3:Yt(e.slope3),midUtilization:Yt(e.mid_utilization),optimalUtilization:Yt(e.optimal_utilization),maxUtilization:Yt(e.max_utilization),reserveFactor:Jt(e.reserve_factor),marketAddress:er(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:er(e.asset),maxBorrowRateRay:Yt(e.max_borrow_rate),baseBorrowRateRay:Yt(e.base_borrow_rate),slope1Ray:Yt(e.slope1),slope2Ray:Yt(e.slope2),slope3Ray:Yt(e.slope3),midUtilizationRay:Yt(e.mid_utilization),optimalUtilizationRay:Yt(e.optimal_utilization),maxUtilizationRay:Yt(e.max_utilization),reserveFactorBps:Jt(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:ur(e).map((e=>{return t=ur(e),{hubId:Jt(t[0]),asset:er(t[1]),timestamp:Jt(t[2]),supplyIndexRay:Yt(t[3]),borrowIndexRay:Yt(t[4]),cash:Yt(t[5]),suppliedRay:Yt(t[6]),borrowedRay:Yt(t[7]),revenueRay:Yt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:ur(e).map((e=>{const t=e;return{hubId:Jt(t.hub_id),asset:er(t.asset),params:(r=t.params,{maxBorrowRateRay:Yt(r.max_borrow_rate),baseBorrowRateRay:Yt(r.base_borrow_rate),slope1Ray:Yt(r.slope1),slope2Ray:Yt(r.slope2),slope3Ray:Yt(r.slope3),midUtilizationRay:Yt(r.mid_utilization),optimalUtilizationRay:Yt(r.optimal_utilization),maxUtilizationRay:Yt(r.max_utilization),reserveFactorBps:Jt(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Jt(r.flashloan_fee),assetId:er(r.asset_id),assetDecimals:Jt(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=ur(e);return{topic:"position:batch_update",data:{accountId:Yt(t[0]),accountAttributes:dr(ur(t[1])),updates:[...ur(t[2]).map((e=>cr(ur(e),"Deposit"))),...ur(t[3]).map((e=>cr(ur(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Jt(e.hub_id),asset:er(e.asset),receiver:er(e.receiver),caller:er(e.caller),amount:Yt(e.amount),fee:Yt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:er(e.asset),oracle:mr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:er(e.liquidator),accountId:Yt(e.account_id),repaidUsdWad:Yt(e.repaid_usd_wad),bonusBps:Yt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Yt(e.account_id),totalBorrowUsdWad:Yt(e.total_borrow_usd_wad),totalCollateralUsdWad:Yt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:er(e.token),amount:Yt(e.amount),usdValueWad:Yt(e.usd_value_wad),accountId:Yt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Jt(e.hub_id),asset:er(e.asset),amount:Yt(e.amount),fee:Yt(e.fee),amountSent:Yt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:or(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:er(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:er(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:or(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Jt(e.max_supply_positions),maxBorrowPositions:Jt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:er(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Jt(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Yt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Yt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Jt(t.liquidation_bonus_factor_bps)}}}},Sr=Object.freeze(Object.keys(fr));function br(e,t){const r=Zt(e),o=fr[r];return o?o((0,d.scValToNative)(Kt(t))):null}const hr="XLENDXLM-a7c9f3",_r=1e4;function wr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${hr}-${r}`}function gr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function yr(e,t=0){return e*_r+t}function Tr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const xr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},vr=e=>e.baseUrl??s[e.network];async function Rr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=xr(vr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function kr(e){const t=xr(vr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Er=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Pr=e=>A(e).toXDR("base64");function Ar(e,t){const r=e.routerAddress??u(e.network),o=new d.Contract(r),a=new d.Account(e.caller,e.sourceSequence),n=B(Er(t,e.referralId));return{xdr:new d.TransactionBuilder(a,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",m(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ir(e,t){return Ar(e,t)}function Or(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($r),splitPpm:e.splitPpm}))):[{hops:e.hops.map($r),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Br(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Or(e,t)}const Lr=Or,$r=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Nr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ur(e,t,r){const o=d.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Nr(r.invokedContractId,e);throw e}}async function Gr(e,t,r){return Ur(e,t.xdr,r)}function Cr(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 qr(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 Dr=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 Vr(e){const t=new d.Account(e.caller,e.sourceSequence),r=new d.Contract(e.forwarderAddress).call("mint_and_forward",d.xdr.ScVal.scvBytes(Dr(e.message)),d.xdr.ScVal.scvBytes(Dr(e.attestation)));return{xdr:new d.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}module.exports=t})();
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>o,STELLAR_GOVERNANCE:()=>a,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ye,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>Sr,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>s,STELLAR_SOROBAN_RPC_URL:()=>n,SYNTHETIC_EVENT_ORDER_STRIDE:()=>_r,XOXNO_LENDING_STELLAR_TICKER:()=>hr,buildSameTokenRepaySwapSteps:()=>qr,buildStellarAcceptOwnershipTx:()=>Ne,buildStellarAddRewardsTx:()=>Ke,buildStellarApproveTokenTx:()=>De,buildStellarBatchSwapTx:()=>Ir,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>C,buildStellarCctpForwardTx:()=>Vr,buildStellarClaimRevenueTx:()=>Qe,buildStellarCreateLiquidityPoolTx:()=>He,buildStellarDisableTokenOracleTx:()=>ze,buildStellarExecuteStrategyTx:()=>Ar,buildStellarFlashLoanTx:()=>z,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Ft,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ht,buildStellarGovernanceExecuteTransferGovOwnTx:()=>jt,buildStellarGovernanceExecuteTx:()=>Mt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Xt,buildStellarGrantRoleTx:()=>Be,buildStellarLendingIdentifier:()=>wr,buildStellarLiquidateTx:()=>M,buildStellarMigrateFromBlendTx:()=>X,buildStellarMigrateTx:()=>Ae,buildStellarMultiplyTx:()=>F,buildStellarPauseTx:()=>Ie,buildStellarProposeAddAssetToSpokeTx:()=>wt,buildStellarProposeAddSpokeTx:()=>ht,buildStellarProposeApproveBlendPoolTx:()=>kt,buildStellarProposeApproveTokenTx:()=>vt,buildStellarProposeConfigureMarketOracleTx:()=>Ut,buildStellarProposeCreateHubTx:()=>bt,buildStellarProposeCreateLiquidityPoolTx:()=>Pt,buildStellarProposeDeployPoolTx:()=>It,buildStellarProposeDisableTokenOracleTx:()=>Bt,buildStellarProposeEditAssetInSpokeTx:()=>gt,buildStellarProposeEditOracleToleranceTx:()=>Gt,buildStellarProposeGovernanceUpgradeTx:()=>Ct,buildStellarProposeGrantGovernanceRoleTx:()=>Dt,buildStellarProposeMigrateControllerTx:()=>$t,buildStellarProposeRemoveAssetFromSpokeTx:()=>yt,buildStellarProposeRemoveSpokeTx:()=>_t,buildStellarProposeRevokeBlendPoolTx:()=>Et,buildStellarProposeRevokeGovernanceRoleTx:()=>Vt,buildStellarProposeRevokeTokenTx:()=>Rt,buildStellarProposeSetAccumulatorTx:()=>mt,buildStellarProposeSetAggregatorTx:()=>pt,buildStellarProposeSetMinBorrowCollatTx:()=>xt,buildStellarProposeSetPoolTemplateTx:()=>ft,buildStellarProposeSetPositionLimitsTx:()=>St,buildStellarProposeSetPositionManagerTx:()=>Tt,buildStellarProposeTransferCtrlOwnershipTx:()=>Nt,buildStellarProposeTransferGovOwnTx:()=>Wt,buildStellarProposeUpdateDelayTx:()=>qt,buildStellarProposeUpgradeControllerTx:()=>Lt,buildStellarProposeUpgradePoolParamsTx:()=>At,buildStellarProposeUpgradePoolTx:()=>Ot,buildStellarRenewAccountTx:()=>Fe,buildStellarRepayBatchTx:()=>V,buildStellarRepayDebtWithCollateralTx:()=>Q,buildStellarRepayTx:()=>W,buildStellarRevokeRoleTx:()=>Le,buildStellarRevokeTokenTx:()=>Ve,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ue,buildStellarSetLiquidityPoolTemplateTx:()=>Ce,buildStellarSetMarketOracleConfigTx:()=>We,buildStellarSetOracleToleranceTx:()=>Me,buildStellarSetPositionLimitsTx:()=>qe,buildStellarSupplyBatchTx:()=>N,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>j,buildStellarSwapDebtTx:()=>H,buildStellarTransferOwnershipTx:()=>$e,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Ze,buildStellarUpdateIndexesTx:()=>Xe,buildStellarUpgradeControllerTx:()=>Pe,buildStellarUpgradeLiquidityPoolParamsTx:()=>je,buildStellarWithdrawBatchTx:()=>q,buildStellarWithdrawTx:()=>D,buildTx:()=>$,decodeStellarLendingEvent:()=>br,encodeInterestRateModel:()=>ye,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>Te,encodeOracleSourceConfigInput:()=>ke,encodePositionLimits:()=>xe,encodeStrategyPayloadToRouteXdr:()=>Pr,extractEventOrder:()=>gr,getStellarAccountPositions:()=>me,getStellarAggregatorQuote:()=>Rr,getStellarAggregatorRouter:()=>u,getStellarAsset:()=>se,getStellarAssetGraph:()=>Se,getStellarAssetMarkets:()=>ie,getStellarAssetPage:()=>le,getStellarAssets:()=>ee,getStellarGovernance:()=>c,getStellarGovernanceProposals:()=>fe,getStellarHub:()=>ue,getStellarHubGraph:()=>be,getStellarHubs:()=>te,getStellarLendingContext:()=>J,getStellarLendingController:()=>i,getStellarQuoteTokens:()=>kr,getStellarReserve:()=>ae,getStellarReserveGraph:()=>_e,getStellarReserveHolders:()=>ne,getStellarReserves:()=>oe,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>he,getStellarSpokes:()=>re,getStellarUserActivity:()=>pe,getStellarUserPositions:()=>de,mapQuoteResponseToAggregatorSwap:()=>Lr,mapQuoteResponseToStrategyPayload:()=>Or,mapQuoteResponseToStrategySwap:()=>Br,mapStellarPositionActivityType:()=>Tr,prepareStellarBuiltTx:()=>Gr,prepareStellarTxXdr:()=>Ur,stellarLendingDispatchKey:()=>Zt,stellarLendingRead:()=>we,syntheticEventOrder:()=>yr,tagStellarInvokedContractError:()=>Nr,toBase64Xdr:()=>Qt,toStellarPositionMode:()=>Cr});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},o={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},a={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},n={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},s={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 i(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 u(e){const t=o[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 c(e){const t=a[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const d=require("@stellar/stellar-sdk"),p=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],m=e=>new d.Address(e).toScVal(),f=e=>new d.ScInt(e).toI128(),S=e=>d.xdr.ScVal.scvU32(e),b=e=>new d.ScInt("string"==typeof e?e:e.toString()).toU64(),h=e=>d.xdr.ScVal.scvBool(e),_=e=>d.xdr.ScVal.scvString(e),w=e=>d.xdr.ScVal.scvSymbol(e),g=()=>d.xdr.ScVal.scvVoid(),y=e=>d.xdr.ScVal.scvVec(e),T=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return d.xdr.ScVal.scvBytes(o)},x=(e,t)=>null==e?g():t(e),v=e=>d.xdr.ScVal.scvVec(e.map((e=>{return t=e.token,r=e.amount,d.xdr.ScVal.scvVec([m(t),f(r)]);var t,r}))),R=(e,t)=>P({asset:m(t),hub_id:S(e)}),k=(e,t,r)=>d.xdr.ScVal.scvVec([R(e,t),f(r)]),E=e=>d.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),P=e=>{const t=Object.keys(e).sort().map((t=>new d.xdr.ScMapEntry({key:w(t),val:e[t]})));return d.xdr.ScVal.scvMap(t)},A=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return P({amount_out:f(e.amountOut),pool:m(e.pool),token_in:m(e.tokenIn),token_out:m(e.tokenOut),venue:(t=e.venue,d.xdr.ScVal.scvVec([w(t)]))});var t}));return P({hops:d.xdr.ScVal.scvVec(t),split_ppm:S(e.splitPpm)})}));return P({paths:d.xdr.ScVal.scvVec(t),referral_id:b(e.referralId??0),token_in:m(e.tokenIn),token_out:m(e.tokenOut),total_min_out:f(e.totalMinOut)})},I=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 d.xdr.ScVal.scvBytes(t)},O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},B=e=>{if("string"==typeof e)return I(O(e));if(e instanceof Uint8Array)return I(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?I(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?I(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?I(O(e.bytes)):I(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!p.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),d.xdr.ScVal.scvBytes(Buffer.from(A(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return d.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return d.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function $(e,t,r){const o=e.controllerAddress??i(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function N(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"supply",[m(e.caller),b(r),S(o),E([...t.assets])])}function U(e,t){return N(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return $(e,"borrow",[m(e.caller),b(t.accountNonce),E([...t.borrows]),x(t.to,m)])}function C(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function q(e,t){return $(e,"withdraw",[m(e.caller),b(t.accountNonce),E([...t.withdrawals]),x(t.to,m)])}function D(e,t){return q(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function V(e,t){return $(e,"repay",[m(e.caller),b(t.accountNonce),E([...t.payments])])}function W(e,t){return V(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function M(e,t){return $(e,"liquidate",[m(e.caller),b(t.accountNonce),E([...t.debtPayments])])}function z(e,t){return $(e,"flash_loan",[m(e.caller),R(t.hubId,t.asset),f(t.amount),m(t.receiver),L(t.data)])}function X(e,t){return $(e,"migrate_from_blend",[m(e.caller),b(t.accountId),S(t.spokeId),S(t.hubId),m(t.blendPool),y(t.collateralTokens.map(m)),y(t.supplyTokens.map(m)),v(t.debtCaps.map((e=>({token:e.token,amount:e.cap}))))])}function F(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return $(e,"multiply",[m(e.caller),b(r),S(o),R(t.collateral.hubId,t.collateral.asset),f(t.debtToFlashLoan),R(t.debt.hubId,t.debt.asset),S(t.mode),B(t.steps),x(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),x(t.convertSwap,B)])}function H(e,t){return $(e,"swap_debt",[m(e.caller),b(t.accountNonce),R(t.existingDebt.hubId,t.existingDebt.asset),f(t.newDebtAmount),R(t.newDebt.hubId,t.newDebt.asset),B(t.steps)])}function j(e,t){return $(e,"swap_collateral",[m(e.caller),b(t.accountNonce),R(t.current.hubId,t.current.asset),f(t.fromAmount),R(t.newCollateral.hubId,t.newCollateral.asset),B(t.steps)])}function Q(e,t){return $(e,"repay_debt_with_collateral",[m(e.caller),b(t.accountNonce),R(t.collateral.hubId,t.collateral.asset),f(t.collateralAmount),R(t.debt.hubId,t.debt.asset),B(t.steps),h(t.closePosition)])}const K="/stellar-lending",Z=25,Y=encodeURIComponent,J=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),ee=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),oe=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${K}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ae=(e,t,r,o,a)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}`,a),ne=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}/holders`,{...n,params:{side:a}}),se=(e,t,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,r),le=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...o,params:{...r}}),ie=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...o,params:{side:r}}),ue=(e,t,r)=>e.fetchWithTimeout(`${K}/hubs/${t}`,r),ce=(e,t,r)=>e.fetchWithTimeout(`${K}/spokes/${t}`,r),de=(e,t,r)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,r),pe=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},me=(e,t,r)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,r),fe=(e,t={},r)=>{const{top:o=Z,continuationToken:a}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},Se=(e,t,r,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...o,params:{...r}}),be=(e,t,r,o)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...o,params:{...r}}),he=(e,t,r,o)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...o,params:{...r}}),_e=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${r}/${Y(o)}/graph`,{...n,params:{...a}}),we=e=>({context:t=>J(e,t),assets:t=>ee(e,t),hubs:t=>te(e,t),spokes:t=>re(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?oe(e,t,r):oe(e,{},t);var o},reserve:(t,r,o,a)=>ae(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>ne(e,t,r,o,a,n),asset:(t,r)=>se(e,t,r),assetMarkets:(t,r,o)=>ie(e,t,r,o),hub:(t,r)=>ue(e,t,r),spoke:(t,r)=>ce(e,t,r),userPositions:(t,r)=>de(e,t,r),userActivity:(t,r,o)=>pe(e,t,r,o),accountPositions:(t,r)=>me(e,t,r),governanceProposals:(t,r)=>fe(e,t,r),assetGraph:(t,r,o)=>Se(e,t,r,o),hubGraph:(t,r,o)=>be(e,t,r,o),spokeGraph:(t,r,o)=>he(e,t,r,o),reserveGraph:(t,r,o,a,n)=>_e(e,t,r,o,a,n)}),ge={Single:0,PrimaryWithAnchor:1},ye=e=>P({base_borrow_rate:f(e.baseBorrowRateRay),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:S(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),Te=e=>P({asset_decimals:S(e.assetDecimals),asset_id:m(e.assetId),base_borrow_rate:f(e.baseBorrowRateRay),flashloan_fee:S(e.flashloanFeeBps),is_flashloanable:h(e.isFlashloanable),max_borrow_rate:f(e.maxBorrowRateRay),max_utilization:f(e.maxUtilizationRay),mid_utilization:f(e.midUtilizationRay),optimal_utilization:f(e.optimalUtilizationRay),reserve_factor:S(e.reserveFactorBps),slope1:f(e.slope1Ray),slope2:f(e.slope2Ray),slope3:f(e.slope3Ray)}),xe=e=>P({max_borrow_positions:S(e.maxBorrowPositions),max_supply_positions:S(e.maxSupplyPositions)}),ve=e=>{const t=e.kind;switch(t){case"Stellar":return y([w("Stellar"),m(e.value)]);case"Symbol":return y([w("Symbol"),w(e.value)]);case"String":return y([w("String"),_(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},Re=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return y([w("Twap"),S(t)])}return y([w("Spot")])},ke=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return y([w("Reflector"),P({asset:ve(e.asset),contract:m(e.contract),read_mode:Re(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 y([w("RedStone"),P({contract:m(e.contract),feed_id:_(e.feedId),max_stale_seconds:b(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=ge[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return P({anchor:(r=e.anchor,y(null==r?[w("None")]:[w("Some"),ke(r)])),max_price_stale_seconds:b(e.maxPriceStaleSeconds),max_sanity_price_wad:f(e.maxSanityPriceWad),min_sanity_price_wad:f(e.minSanityPriceWad),primary:ke(e.primary),strategy:S(t),tolerance_bps:S(e.toleranceBps)});var r};function Pe(e,t){return $(e,"upgrade",[T(t.wasmHash)])}function Ae(e,t){return $(e,"migrate",[S(t.newVersion)])}function Ie(e){return $(e,"pause",[])}function Oe(e){return $(e,"unpause",[])}function Be(e,t){return $(e,"grant_role",[m(t.account),w(t.role)])}function Le(e,t){return $(e,"revoke_role",[m(t.account),w(t.role)])}function $e(e,t){return $(e,"transfer_ownership",[m(t.newOwner),S(t.liveUntilLedger)])}function Ne(e){return $(e,"accept_ownership",[])}function Ue(e,t){return $(e,"set_aggregator",[m(t.aggregator)])}function Ge(e,t){return $(e,"set_accumulator",[m(t.accumulator)])}function Ce(e,t){return $(e,"set_liquidity_pool_template",[T(t.wasmHash)])}function qe(e,t){return $(e,"set_position_limits",[xe(t)])}function De(e,t){return $(e,"approve_token",[m(t.token)])}function Ve(e,t){return $(e,"revoke_token",[m(t.token)])}function We(e,t){return $(e,"set_market_oracle_config",[R(t.hubId,t.asset),Ee(t.config)])}function Me(e,t){return $(e,"set_oracle_tolerance",[m(t.asset),P({lower_ratio_bps:S(t.lowerRatioBps),upper_ratio_bps:S(t.upperRatioBps)})])}function ze(e,t){return $(e,"disable_token_oracle",[m(t.asset)])}function Xe(e,t){return $(e,"update_indexes",[m(e.caller),y(t.assets.map((e=>R(e.hubId,e.asset))))])}function Fe(e,t){return $(e,"renew_account",[m(e.caller),b(t.accountNonce)])}function He(e,t){return $(e,"create_liquidity_pool",[S(t.hubId),m(t.asset),Te(t.params)])}function je(e,t){return $(e,"upgrade_liquidity_pool_params",[R(t.hubId,t.asset),ye(t.params)])}function Qe(e,t){return $(e,"claim_revenue",[m(e.caller),y(t.assets.map((e=>R(e.hubId,e.asset))))])}function Ke(e,t){return $(e,"add_rewards",[m(e.caller),E(t.rewards)])}function Ze(e,t){return $(e,"update_account_threshold",[m(e.caller),h(t.hasRisks),y(t.accountNonces.map((e=>b(e))))])}const Ye="00".repeat(32),Je=e=>{if("string"==typeof e)return T(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 d.xdr.ScVal.scvBytes(t)},et=(e,...t)=>y([w(e),...t]),tt=e=>P({asset:m(e.asset),hub_id:S(e.hubId),params:Te(e.params)}),rt=e=>P({hub_asset:R(e.hubId,e.asset),params:ye(e.params)}),ot=e=>P({new_owner:m(e.newOwner),live_until_ledger:S(e.liveUntilLedger)}),at=e=>P({cfg:Ee(e.config),hub_asset:R(e.hubId,e.asset)}),nt=e=>P({asset:m(e.asset),bonus:S(e.bonus),borrow_cap:f(e.borrowCap),can_borrow:h(e.canBorrow),can_collateral:h(e.canCollateral),frozen:h(e.frozen),hub_id:S(e.hubId),paused:h(e.paused),liquidation_fees:S(e.liquidationFees),ltv:S(e.ltv),oracle_override:y([w("None")]),spoke_id:S(e.spokeId),supply_cap:f(e.supplyCap),threshold:S(e.threshold)}),st=e=>P({hub_asset:R(e.hubId,e.asset),spoke_id:S(e.spokeId)}),lt=e=>P({asset:m(e.asset),tolerance:S(e.tolerance)}),it=e=>P({account:m(e.account),role:w(e.role)});function ut(e,t,r){const o=e.governanceAddress??c(e.network),a=new d.Contract(o),n=new d.Account(e.caller,e.sourceSequence);return{xdr:new d.TransactionBuilder(n,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(a.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ct=(e,t,r)=>ut(e,"propose",[m(e.caller),t,Je(r)]),dt=(e,t,r)=>ut(e,"execute_self",[g(),t,Je(r)]);function pt(e,t,r){return ct(e,et("SetAggregator",m(t.aggregator)),r)}function mt(e,t,r){return ct(e,et("SetAccumulator",m(t.accumulator)),r)}function ft(e,t,r){return ct(e,et("SetLiquidityPoolTemplate",T(t.wasmHash)),r)}function St(e,t,r){return ct(e,et("SetPositionLimits",xe(t)),r)}function bt(e,t){return ct(e,et("CreateHub"),t)}function ht(e,t){return ct(e,et("AddSpoke"),t)}function _t(e,t,r){return ct(e,et("RemoveSpoke",S(t.spokeId)),r)}function wt(e,t,r){return ct(e,et("AddAssetToSpoke",nt(t)),r)}function gt(e,t,r){return ct(e,et("EditAssetInSpoke",nt(t)),r)}function yt(e,t,r){return ct(e,et("RemoveAssetFromSpoke",st(t)),r)}function Tt(e,t,r){return ct(e,et("SetPositionManager",m(t.manager),h(t.isActive)),r)}function xt(e,t,r){return ct(e,et("SetMinBorrowCollateralUsd",f(t.floorWad)),r)}function vt(e,t,r){return ct(e,et("ApproveToken",m(t.token)),r)}function Rt(e,t,r){return ct(e,et("RevokeToken",m(t.token)),r)}function kt(e,t,r){return ct(e,et("ApproveBlendPool",m(t.pool)),r)}function Et(e,t,r){return ct(e,et("RevokeBlendPool",m(t.pool)),r)}function Pt(e,t,r){return ct(e,et("CreateLiquidityPool",tt(t)),r)}function At(e,t,r){return ct(e,et("UpgradeLiquidityPoolParams",rt(t)),r)}function It(e,t){return ct(e,et("DeployPool"),t)}function Ot(e,t,r){return ct(e,et("UpgradePool",T(t.wasmHash)),r)}function Bt(e,t,r){return ct(e,et("DisableTokenOracle",m(t.asset)),r)}function Lt(e,t,r){return ct(e,et("UpgradeController",T(t.wasmHash)),r)}function $t(e,t,r){return ct(e,et("MigrateController",S(t.newVersion)),r)}function Nt(e,t,r){return ct(e,et("TransferCtrlOwnership",ot(t)),r)}function Ut(e,t,r){return ct(e,et("ConfigureMarketOracle",at(t)),r)}function Gt(e,t,r){return ct(e,et("EditOracleTolerance",lt(t)),r)}function Ct(e,t,r){return ct(e,et("UpgradeGov",T(t.wasmHash)),r)}function qt(e,t,r){return ct(e,et("UpdateGovDelay",S(t.newDelay)),r)}function Dt(e,t,r){return ct(e,et("GrantGovRole",it(t)),r)}function Vt(e,t,r){return ct(e,et("RevokeGovRole",it(t)),r)}function Wt(e,t,r){return ct(e,et("TransferGovOwnership",ot(t)),r)}function Mt(e,t){const r=y(t.argsXdr.map((e=>d.xdr.ScVal.fromXDR(e,"base64")))),o=Je(t.predecessor??Ye);return ut(e,"execute",[g(),m(t.target),w(t.functionName),r,o,Je(t.salt)])}function zt(e,t,r){return dt(e,et("UpgradeGov",T(t.wasmHash)),r)}function Xt(e,t,r){return dt(e,et("UpdateGovDelay",S(t.newDelay)),r)}function Ft(e,t,r){return dt(e,et("GrantGovRole",it(t)),r)}function Ht(e,t,r){return dt(e,et("RevokeGovRole",it(t)),r)}function jt(e,t,r){return dt(e,et("TransferGovOwnership",ot(t)),r)}const Qt=e=>e.toXDR("base64"),Kt=e=>d.xdr.ScVal.fromXDR(e,"base64"),Zt=e=>e.map((e=>String((0,d.scValToNative)(Kt(e))))).join(":"),Yt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Jt=e=>Number(e),er=e=>String(e),tr=e=>null==e?void 0:Yt(e),rr=e=>null==e?void 0:er(e),or=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),ar=["None","Multiply","Long","Short"],nr=["Single","PrimaryWithAnchor"],sr=["ReflectorSep40","RedStonePriceFeed"],lr=["Spot","Twap"],ir=["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"],ur=e=>Array.isArray(e)?e:[],cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],ir[Jt(o)]??Yt(o)),positionType:t,hubId:Jt(e[1]),asset:er(e[2]),scaledAmountRay:Yt(e[3]),indexRay:Yt(e[4]),amount:Yt(e[5]),liquidationThresholdBps:r?void 0:Jt(e[6]),liquidationBonusBps:r?void 0:Jt(e[7]),loanToValueBps:r?void 0:Jt(e[8]),liquidationFeesBps:r?void 0:Jt(e[9])};var o},dr=e=>{return{owner:er(e[0]),spokeId:Jt(e[1]),mode:(t=e[2],ar[Jt(t)]??"None")};var t},pr=(e,t)=>{const r=lr[Jt(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:er(o)}:null!=a?{kind:"Symbol",value:er(a)}:void 0;return{provider:sr[Jt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:er(e[`${t}_contract`]),asset:n,feedId:rr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?Jt(e[`${t}_twap_records`]):void 0,decimals:Jt(e[`${t}_decimals`]),resolutionSeconds:Jt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Jt(e[`${t}_max_stale_seconds`])}},mr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:er(e.base_token_id),quoteTokenId:er(e.quote_token_id),tolerance:{upperRatio:Jt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Jt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Jt(e.asset_decimals),maxPriceStaleSeconds:Jt(e.max_price_stale_seconds),strategy:nr[Jt(e.strategy)]??"Single",primary:pr(e,"primary"),anchor:t?pr(e,"anchor"):void 0,primaryQuoteToken:rr(e.primary_quote_token),anchorQuoteToken:rr(e.anchor_quote_token),minSanityPriceWad:tr(e.min_sanity_price_wad),maxSanityPriceWad:tr(e.max_sanity_price_wad)}},fr={"market:create":e=>({topic:"market:create",data:{hubId:Jt(e.hub_id),baseAsset:er(e.base_asset),maxBorrowRate:Yt(e.max_borrow_rate),baseBorrowRate:Yt(e.base_borrow_rate),slope1:Yt(e.slope1),slope2:Yt(e.slope2),slope3:Yt(e.slope3),midUtilization:Yt(e.mid_utilization),optimalUtilization:Yt(e.optimal_utilization),maxUtilization:Yt(e.max_utilization),reserveFactor:Jt(e.reserve_factor),marketAddress:er(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:er(e.asset),maxBorrowRateRay:Yt(e.max_borrow_rate),baseBorrowRateRay:Yt(e.base_borrow_rate),slope1Ray:Yt(e.slope1),slope2Ray:Yt(e.slope2),slope3Ray:Yt(e.slope3),midUtilizationRay:Yt(e.mid_utilization),optimalUtilizationRay:Yt(e.optimal_utilization),maxUtilizationRay:Yt(e.max_utilization),reserveFactorBps:Jt(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:ur(e).map((e=>{return t=ur(e),{hubId:Jt(t[0]),asset:er(t[1]),timestamp:Jt(t[2]),supplyIndexRay:Yt(t[3]),borrowIndexRay:Yt(t[4]),cash:Yt(t[5]),suppliedRay:Yt(t[6]),borrowedRay:Yt(t[7]),revenueRay:Yt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:ur(e).map((e=>{const t=e;return{hubId:Jt(t.hub_id),asset:er(t.asset),params:(r=t.params,{maxBorrowRateRay:Yt(r.max_borrow_rate),baseBorrowRateRay:Yt(r.base_borrow_rate),slope1Ray:Yt(r.slope1),slope2Ray:Yt(r.slope2),slope3Ray:Yt(r.slope3),midUtilizationRay:Yt(r.mid_utilization),optimalUtilizationRay:Yt(r.optimal_utilization),maxUtilizationRay:Yt(r.max_utilization),reserveFactorBps:Jt(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Jt(r.flashloan_fee),assetId:er(r.asset_id),assetDecimals:Jt(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=ur(e);return{topic:"position:batch_update",data:{accountId:Yt(t[0]),accountAttributes:dr(ur(t[1])),updates:[...ur(t[2]).map((e=>cr(ur(e),"Deposit"))),...ur(t[3]).map((e=>cr(ur(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Jt(e.hub_id),asset:er(e.asset),receiver:er(e.receiver),caller:er(e.caller),amount:Yt(e.amount),fee:Yt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:er(e.asset),oracle:mr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:er(e.liquidator),accountId:Yt(e.account_id),repaidUsdWad:Yt(e.repaid_usd_wad),bonusBps:Yt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Yt(e.account_id),totalBorrowUsdWad:Yt(e.total_borrow_usd_wad),totalCollateralUsdWad:Yt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:er(e.token),amount:Yt(e.amount),usdValueWad:Yt(e.usd_value_wad),accountId:Yt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Jt(e.hub_id),asset:er(e.asset),amount:Yt(e.amount),fee:Yt(e.fee),amountSent:Yt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:or(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:er(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:er(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:or(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Jt(e.max_supply_positions),maxBorrowPositions:Jt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:er(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Jt(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Yt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Yt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Jt(t.liquidation_bonus_factor_bps)}}}},Sr=Object.freeze(Object.keys(fr));function br(e,t){const r=Zt(e),o=fr[r];return o?o((0,d.scValToNative)(Kt(t))):null}const hr="XLENDXLM-a7c9f3",_r=1e4;function wr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${hr}-${r}`}function gr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function yr(e,t=0){return e*_r+t}function Tr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const xr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},vr=e=>e.baseUrl??s[e.network];async function Rr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=xr(vr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function kr(e){const t=xr(vr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Er=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Pr=e=>A(e).toXDR("base64");function Ar(e,t){const r=e.routerAddress??u(e.network),o=new d.Contract(r),a=new d.Account(e.caller,e.sourceSequence),n=B(Er(t,e.referralId));return{xdr:new d.TransactionBuilder(a,{fee:e.fee??d.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",m(e.caller),f(e.totalIn),n)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Ir(e,t){return Ar(e,t)}function Or(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($r),splitPpm:e.splitPpm}))):[{hops:e.hops.map($r),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Br(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Or(e,t)}const Lr=Or,$r=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Nr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ur(e,t,r){const o=d.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Nr(r.invokedContractId,e);throw e}}async function Gr(e,t,r){return Ur(e,t.xdr,r)}function Cr(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 qr(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 Dr=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 Vr(e){const t=new d.Account(e.caller,e.sourceSequence),r=new d.Contract(e.forwarderAddress).call("mint_and_forward",d.xdr.ScVal.scvBytes(Dr(e.message)),d.xdr.ScVal.scvBytes(Dr(e.attestation)));return{xdr:new d.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}module.exports=t})();
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as e,Address as t,BASE_FEE as r,Contract as o,ScInt as a,TransactionBuilder as n,scValToNative as s,xdr as i}from"@stellar/stellar-sdk";const u={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},c={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},l={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},p={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},d={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},f={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function m(e){const t=u[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 h(e){const t=c[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 _(e){const t=l[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const w=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new t(e).toScVal(),y=e=>new a(e).toI128(),g=e=>i.ScVal.scvU32(e),S=e=>new a("string"==typeof e?e:e.toString()).toU64(),v=e=>i.ScVal.scvBool(e),k=e=>i.ScVal.scvString(e),R=e=>i.ScVal.scvSymbol(e),x=()=>i.ScVal.scvVoid(),I=e=>i.ScVal.scvVec(e),T=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return i.ScVal.scvBytes(o)},E=(e,t)=>null==e?x():t(e),$=(e,t)=>O({asset:b(t),hub_id:g(e)}),A=(e,t,r)=>i.ScVal.scvVec([$(e,t),y(r)]),B=e=>i.ScVal.scvVec(e.map((e=>A(e.hubId,e.asset,e.amount)))),O=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:R(t),val:e[t]})));return i.ScVal.scvMap(t)},N=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return O({amount_out:y(e.amountOut),pool:b(e.pool),token_in:b(e.tokenIn),token_out:b(e.tokenOut),venue:(t=e.venue,i.ScVal.scvVec([R(t)]))});var t}));return O({hops:i.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return O({paths:i.ScVal.scvVec(t),referral_id:S(e.referralId??0),token_in:b(e.tokenIn),token_out:b(e.tokenOut),total_min_out:y(e.totalMinOut)})},P=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 i.ScVal.scvBytes(t)},U=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},q=e=>{if("string"==typeof e)return P(U(e));if(e instanceof Uint8Array)return P(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?P(U(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(U(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(U(e.bytes)):P(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!w.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),i.ScVal.scvBytes(Buffer.from(N(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return i.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return i.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function V(t,a,s){const i=t.controllerAddress??m(t.network),u=new o(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function W(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return V(e,"supply",[b(e.caller),S(r),g(o),B([...t.assets])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function D(e,t){return V(e,"borrow",[b(e.caller),S(t.accountNonce),B([...t.borrows]),E(t.to,b)])}function G(e,t){return D(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function C(e,t){return V(e,"withdraw",[b(e.caller),S(t.accountNonce),B([...t.withdrawals]),E(t.to,b)])}function X(e,t){return C(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function M(e,t){return V(e,"repay",[b(e.caller),S(t.accountNonce),B([...t.payments])])}function F(e,t){return M(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return V(e,"liquidate",[b(e.caller),S(t.accountNonce),B([...t.debtPayments])])}function j(e,t){return V(e,"flash_loan",[b(e.caller),$(t.hubId,t.asset),y(t.amount),b(t.receiver),L(t.data)])}function Q(e,t){return V(e,"migrate_from_blend",[b(e.caller),S(t.accountId),g(t.spokeId),g(t.hubId),b(t.blendPool),I(t.collateralTokens.map(b)),I(t.supplyTokens.map(b)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),i.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,i.ScVal.scvVec([b(t),y(r)]);var t,r}))))]);var r}function Z(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return V(e,"multiply",[b(e.caller),S(r),g(o),$(t.collateral.hubId,t.collateral.asset),y(t.debtToFlashLoan),$(t.debt.hubId,t.debt.asset),g(t.mode),q(t.steps),E(t.initialPayment,(e=>A(e.hubId,e.asset,e.amount))),E(t.convertSwap,q)])}function J(e,t){return V(e,"swap_debt",[b(e.caller),S(t.accountNonce),$(t.existingDebt.hubId,t.existingDebt.asset),y(t.newDebtAmount),$(t.newDebt.hubId,t.newDebt.asset),q(t.steps)])}function K(e,t){return V(e,"swap_collateral",[b(e.caller),S(t.accountNonce),$(t.current.hubId,t.current.asset),y(t.fromAmount),$(t.newCollateral.hubId,t.newCollateral.asset),q(t.steps)])}function Y(e,t){return V(e,"repay_debt_with_collateral",[b(e.caller),S(t.accountNonce),$(t.collateral.hubId,t.collateral.asset),y(t.collateralAmount),$(t.debt.hubId,t.debt.asset),q(t.steps),v(t.closePosition)])}const ee="/stellar-lending",te=25,re=encodeURIComponent,oe=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),se=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),ie=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ue=(e,t,r,o,a)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}`,a),ce=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/holders`,{...n,params:{side:a}}),le=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}`,r),pe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/page`,{...o,params:{...r}}),de=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/markets`,{...o,params:{side:r}}),fe=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),he=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${re(t)}/positions`,r),_e=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${ee}/users/${re(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},we=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(t)}/positions`,r),be=(e,t={},r)=>{const{top:o=te,continuationToken:a}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},ye=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/graph`,{...o,params:{...r}}),ge=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),ve=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/graph`,{...n,params:{...a}}),ke=e=>({context:t=>oe(e,t),assets:t=>ae(e,t),hubs:t=>ne(e,t),spokes:t=>se(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ie(e,t,r):ie(e,{},t);var o},reserve:(t,r,o,a)=>ue(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>ce(e,t,r,o,a,n),asset:(t,r)=>le(e,t,r),assetMarkets:(t,r,o)=>de(e,t,r,o),hub:(t,r)=>fe(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>he(e,t,r),userActivity:(t,r,o)=>_e(e,t,r,o),accountPositions:(t,r)=>we(e,t,r),governanceProposals:(t,r)=>be(e,t,r),assetGraph:(t,r,o)=>ye(e,t,r,o),hubGraph:(t,r,o)=>ge(e,t,r,o),spokeGraph:(t,r,o)=>Se(e,t,r,o),reserveGraph:(t,r,o,a,n)=>ve(e,t,r,o,a,n)}),Re={Single:0,PrimaryWithAnchor:1},xe=e=>O({base_borrow_rate:y(e.baseBorrowRateRay),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),Ie=e=>O({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate:y(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:v(e.isFlashloanable),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),Te=e=>O({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ee=e=>{const t=e.kind;switch(t){case"Stellar":return I([R("Stellar"),b(e.value)]);case"Symbol":return I([R("Symbol"),R(e.value)]);case"String":return I([R("String"),k(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},$e=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return I([R("Twap"),g(t)])}return I([R("Spot")])},Ae=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return I([R("Reflector"),O({asset:Ee(e.asset),contract:b(e.contract),read_mode:$e(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 I([R("RedStone"),O({contract:b(e.contract),feed_id:k(e.feedId),max_stale_seconds:S(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Be=e=>{const t=Re[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return O({anchor:(r=e.anchor,I(null==r?[R("None")]:[R("Some"),Ae(r)])),max_price_stale_seconds:S(e.maxPriceStaleSeconds),max_sanity_price_wad:y(e.maxSanityPriceWad),min_sanity_price_wad:y(e.minSanityPriceWad),primary:Ae(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var r};function Oe(e,t){return V(e,"upgrade",[T(t.wasmHash)])}function Ne(e,t){return V(e,"migrate",[g(t.newVersion)])}function Pe(e){return V(e,"pause",[])}function Ue(e){return V(e,"unpause",[])}function qe(e,t){return V(e,"grant_role",[b(t.account),R(t.role)])}function Le(e,t){return V(e,"revoke_role",[b(t.account),R(t.role)])}function Ve(e,t){return V(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function We(e){return V(e,"accept_ownership",[])}function ze(e,t){return V(e,"set_aggregator",[b(t.aggregator)])}function De(e,t){return V(e,"set_accumulator",[b(t.accumulator)])}function Ge(e,t){return V(e,"set_liquidity_pool_template",[T(t.wasmHash)])}function Ce(e,t){return V(e,"set_position_limits",[Te(t)])}function Xe(e,t){return V(e,"approve_token",[b(t.token)])}function Me(e,t){return V(e,"revoke_token",[b(t.token)])}function Fe(e,t){return V(e,"set_market_oracle_config",[$(t.hubId,t.asset),Be(t.config)])}function He(e,t){return V(e,"set_oracle_tolerance",[b(t.asset),O({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function je(e,t){return V(e,"disable_token_oracle",[b(t.asset)])}function Qe(e,t){return V(e,"update_indexes",[b(e.caller),I(t.assets.map((e=>$(e.hubId,e.asset))))])}function Ze(e,t){return V(e,"renew_account",[b(e.caller),S(t.accountNonce)])}function Je(e,t){return V(e,"create_liquidity_pool",[g(t.hubId),b(t.asset),Ie(t.params)])}function Ke(e,t){return V(e,"upgrade_liquidity_pool_params",[$(t.hubId,t.asset),xe(t.params)])}function Ye(e,t){return V(e,"claim_revenue",[b(e.caller),I(t.assets.map((e=>$(e.hubId,e.asset))))])}function et(e,t){return V(e,"add_rewards",[b(e.caller),B(t.rewards)])}function tt(e,t){return V(e,"update_account_threshold",[b(e.caller),v(t.hasRisks),I(t.accountNonces.map((e=>S(e))))])}const rt="00".repeat(32),ot=e=>{if("string"==typeof e)return T(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 i.ScVal.scvBytes(t)},at=(e,...t)=>I([R(e),...t]),nt=e=>O({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),st=e=>O({asset:b(e.asset),bonus:g(e.bonus),borrow_cap:y(e.borrowCap),can_borrow:v(e.canBorrow),can_collateral:v(e.canCollateral),hub_id:g(e.hubId),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:I([R("None")]),spoke_id:g(e.spokeId),supply_cap:y(e.supplyCap),threshold:g(e.threshold)}),it=e=>O({account:b(e.account),role:R(e.role)});function ut(t,a,s){const i=t.governanceAddress??_(t.network),u=new o(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const ct=(e,t,r)=>ut(e,"propose",[b(e.caller),t,ot(r)]),lt=(e,t,r)=>ut(e,"execute_self",[x(),t,ot(r)]);function pt(e,t,r){return ct(e,at("SetAggregator",b(t.aggregator)),r)}function dt(e,t,r){return ct(e,at("SetAccumulator",b(t.accumulator)),r)}function ft(e,t,r){return ct(e,at("SetLiquidityPoolTemplate",T(t.wasmHash)),r)}function mt(e,t,r){return ct(e,at("SetPositionLimits",Te(t)),r)}function ht(e,t){return ct(e,at("CreateHub"),t)}function _t(e,t){return ct(e,at("AddSpoke"),t)}function wt(e,t,r){return ct(e,at("RemoveSpoke",g(t.spokeId)),r)}function bt(e,t,r){return ct(e,at("AddAssetToSpoke",st(t)),r)}function yt(e,t,r){return ct(e,at("EditAssetInSpoke",st(t)),r)}function gt(e,t,r){return ct(e,at("RemoveAssetFromSpoke",O({hub_asset:$((o=t).hubId,o.asset),spoke_id:g(o.spokeId)})),r);var o}function St(e,t,r){return ct(e,at("SetPositionManager",b(t.manager),v(t.isActive)),r)}function vt(e,t,r){return ct(e,at("SetMinBorrowCollateralUsd",y(t.floorWad)),r)}function kt(e,t,r){return ct(e,at("ApproveToken",b(t.token)),r)}function Rt(e,t,r){return ct(e,at("RevokeToken",b(t.token)),r)}function xt(e,t,r){return ct(e,at("ApproveBlendPool",b(t.pool)),r)}function It(e,t,r){return ct(e,at("RevokeBlendPool",b(t.pool)),r)}function Tt(e,t,r){return ct(e,at("CreateLiquidityPool",O({asset:b((o=t).asset),hub_id:g(o.hubId),params:Ie(o.params)})),r);var o}function Et(e,t,r){return ct(e,at("UpgradeLiquidityPoolParams",O({hub_asset:$((o=t).hubId,o.asset),params:xe(o.params)})),r);var o}function $t(e,t){return ct(e,at("DeployPool"),t)}function At(e,t,r){return ct(e,at("UpgradePool",T(t.wasmHash)),r)}function Bt(e,t,r){return ct(e,at("DisableTokenOracle",b(t.asset)),r)}function Ot(e,t,r){return ct(e,at("UpgradeController",T(t.wasmHash)),r)}function Nt(e,t,r){return ct(e,at("MigrateController",g(t.newVersion)),r)}function Pt(e,t,r){return ct(e,at("TransferCtrlOwnership",nt(t)),r)}function Ut(e,t,r){return ct(e,at("ConfigureMarketOracle",O({cfg:Be((o=t).config),hub_asset:$(o.hubId,o.asset)})),r);var o}function qt(e,t,r){return ct(e,at("EditOracleTolerance",O({asset:b((o=t).asset),tolerance:g(o.tolerance)})),r);var o}function Lt(e,t,r){return ct(e,at("UpgradeGov",T(t.wasmHash)),r)}function Vt(e,t,r){return ct(e,at("UpdateGovDelay",g(t.newDelay)),r)}function Wt(e,t,r){return ct(e,at("GrantGovRole",it(t)),r)}function zt(e,t,r){return ct(e,at("RevokeGovRole",it(t)),r)}function Dt(e,t,r){return ct(e,at("TransferGovOwnership",nt(t)),r)}function Gt(e,t){const r=I(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),o=ot(t.predecessor??rt);return ut(e,"execute",[x(),b(t.target),R(t.functionName),r,o,ot(t.salt)])}function Ct(e,t,r){return lt(e,at("UpgradeGov",T(t.wasmHash)),r)}function Xt(e,t,r){return lt(e,at("UpdateGovDelay",g(t.newDelay)),r)}function Mt(e,t,r){return lt(e,at("GrantGovRole",it(t)),r)}function Ft(e,t,r){return lt(e,at("RevokeGovRole",it(t)),r)}function Ht(e,t,r){return lt(e,at("TransferGovOwnership",nt(t)),r)}const jt=e=>e.toXDR("base64"),Qt=e=>i.ScVal.fromXDR(e,"base64"),Zt=e=>e.map((e=>String(s(Qt(e))))).join(":"),Jt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Kt=e=>Number(e),Yt=e=>String(e),er=e=>null==e?void 0:Jt(e),tr=e=>null==e?void 0:Yt(e),rr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),or=["None","Multiply","Long","Short"],ar=["Single","PrimaryWithAnchor"],nr=["ReflectorSep40","RedStonePriceFeed"],sr=["Spot","Twap"],ir=["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"],ur=e=>Array.isArray(e)?e:[],cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],ir[Kt(o)]??Jt(o)),positionType:t,hubId:Kt(e[1]),asset:Yt(e[2]),scaledAmountRay:Jt(e[3]),indexRay:Jt(e[4]),amount:Jt(e[5]),liquidationThresholdBps:r?void 0:Kt(e[6]),liquidationBonusBps:r?void 0:Kt(e[7]),loanToValueBps:r?void 0:Kt(e[8]),liquidationFeesBps:r?void 0:Kt(e[9])};var o},lr=e=>{return{owner:Yt(e[0]),spokeId:Kt(e[1]),mode:(t=e[2],or[Kt(t)]??"None")};var t},pr=(e,t)=>{const r=sr[Kt(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:Yt(o)}:null!=a?{kind:"Symbol",value:Yt(a)}:void 0;return{provider:nr[Kt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Yt(e[`${t}_contract`]),asset:n,feedId:tr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?Kt(e[`${t}_twap_records`]):void 0,decimals:Kt(e[`${t}_decimals`]),resolutionSeconds:Kt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Kt(e[`${t}_max_stale_seconds`])}},dr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Yt(e.base_token_id),quoteTokenId:Yt(e.quote_token_id),tolerance:{upperRatio:Kt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Kt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Kt(e.asset_decimals),maxPriceStaleSeconds:Kt(e.max_price_stale_seconds),strategy:ar[Kt(e.strategy)]??"Single",primary:pr(e,"primary"),anchor:t?pr(e,"anchor"):void 0,primaryQuoteToken:tr(e.primary_quote_token),anchorQuoteToken:tr(e.anchor_quote_token),minSanityPriceWad:er(e.min_sanity_price_wad),maxSanityPriceWad:er(e.max_sanity_price_wad)}},fr={"market:create":e=>({topic:"market:create",data:{hubId:Kt(e.hub_id),baseAsset:Yt(e.base_asset),maxBorrowRate:Jt(e.max_borrow_rate),baseBorrowRate:Jt(e.base_borrow_rate),slope1:Jt(e.slope1),slope2:Jt(e.slope2),slope3:Jt(e.slope3),midUtilization:Jt(e.mid_utilization),optimalUtilization:Jt(e.optimal_utilization),maxUtilization:Jt(e.max_utilization),reserveFactor:Kt(e.reserve_factor),marketAddress:Yt(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Yt(e.asset),maxBorrowRateRay:Jt(e.max_borrow_rate),baseBorrowRateRay:Jt(e.base_borrow_rate),slope1Ray:Jt(e.slope1),slope2Ray:Jt(e.slope2),slope3Ray:Jt(e.slope3),midUtilizationRay:Jt(e.mid_utilization),optimalUtilizationRay:Jt(e.optimal_utilization),maxUtilizationRay:Jt(e.max_utilization),reserveFactorBps:Kt(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:ur(e).map((e=>{return t=ur(e),{hubId:Kt(t[0]),asset:Yt(t[1]),timestamp:Kt(t[2]),supplyIndexRay:Jt(t[3]),borrowIndexRay:Jt(t[4]),cash:Jt(t[5]),suppliedRay:Jt(t[6]),borrowedRay:Jt(t[7]),revenueRay:Jt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:ur(e).map((e=>{const t=e;return{hubId:Kt(t.hub_id),asset:Yt(t.asset),params:(r=t.params,{maxBorrowRateRay:Jt(r.max_borrow_rate),baseBorrowRateRay:Jt(r.base_borrow_rate),slope1Ray:Jt(r.slope1),slope2Ray:Jt(r.slope2),slope3Ray:Jt(r.slope3),midUtilizationRay:Jt(r.mid_utilization),optimalUtilizationRay:Jt(r.optimal_utilization),maxUtilizationRay:Jt(r.max_utilization),reserveFactorBps:Kt(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Kt(r.flashloan_fee),assetId:Yt(r.asset_id),assetDecimals:Kt(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=ur(e);return{topic:"position:batch_update",data:{accountId:Jt(t[0]),accountAttributes:lr(ur(t[1])),updates:[...ur(t[2]).map((e=>cr(ur(e),"Deposit"))),...ur(t[3]).map((e=>cr(ur(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Kt(e.hub_id),asset:Yt(e.asset),receiver:Yt(e.receiver),caller:Yt(e.caller),amount:Jt(e.amount),fee:Jt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Yt(e.asset),oracle:dr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Yt(e.liquidator),accountId:Jt(e.account_id),repaidUsdWad:Jt(e.repaid_usd_wad),bonusBps:Jt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Jt(e.account_id),totalBorrowUsdWad:Jt(e.total_borrow_usd_wad),totalCollateralUsdWad:Jt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Yt(e.token),amount:Jt(e.amount),usdValueWad:Jt(e.usd_value_wad),accountId:Jt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Kt(e.hub_id),asset:Yt(e.asset),amount:Jt(e.amount),fee:Jt(e.fee),amountSent:Jt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:rr(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Yt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Yt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:rr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Kt(e.max_supply_positions),maxBorrowPositions:Kt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Yt(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Kt(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Jt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Jt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Kt(t.liquidation_bonus_factor_bps)}}}},mr=Object.freeze(Object.keys(fr));function hr(e,t){const r=Zt(e),o=fr[r];return o?o(s(Qt(t))):null}const _r="XLENDXLM-a7c9f3",wr=1e4;function br(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${_r}-${r}`}function yr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function gr(e,t=0){return 1e4*e+t}function Sr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const vr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},kr=e=>e.baseUrl??d[e.network];async function Rr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=vr(kr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function xr(e){const t=vr(kr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Ir=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Tr=e=>N(e).toXDR("base64");function Er(t,a){const s=t.routerAddress??h(t.network),i=new o(s),u=new e(t.caller,t.sourceSequence),c=q(Ir(a,t.referralId));return{xdr:new n(u,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(i.call("execute_strategy",b(t.caller),y(t.totalIn),c)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function $r(e,t){return Er(e,t)}function Ar(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(Nr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Nr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Br(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Ar(e,t)}const Or=Ar,Nr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Pr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ur(e,t,r){const o=n.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Pr(r.invokedContractId,e);throw e}}async function qr(e,t,r){return Ur(e,t.xdr,r)}function Lr(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 Vr(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 Wr=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 zr(t){const r=new e(t.caller,t.sourceSequence),a=new o(t.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(Wr(t.message)),i.ScVal.scvBytes(Wr(t.attestation)));return{xdr:new n(r,{fee:t.fee??"10000000",networkPassphrase:f[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}export{c as STELLAR_AGGREGATOR_ROUTER,l as STELLAR_GOVERNANCE,rt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,u as STELLAR_LENDING_CONTROLLER,mr as STELLAR_LENDING_TOPICS,f as STELLAR_NETWORK_PASSPHRASE,d as STELLAR_QUOTE_URL,p as STELLAR_SOROBAN_RPC_URL,wr as SYNTHETIC_EVENT_ORDER_STRIDE,_r as XOXNO_LENDING_STELLAR_TICKER,Vr as buildSameTokenRepaySwapSteps,We as buildStellarAcceptOwnershipTx,et as buildStellarAddRewardsTx,Xe as buildStellarApproveTokenTx,$r as buildStellarBatchSwapTx,D as buildStellarBorrowBatchTx,G as buildStellarBorrowTx,zr as buildStellarCctpForwardTx,Ye as buildStellarClaimRevenueTx,Je as buildStellarCreateLiquidityPoolTx,je as buildStellarDisableTokenOracleTx,Er as buildStellarExecuteStrategyTx,j as buildStellarFlashLoanTx,Ct as buildStellarGovernanceExecuteGovernanceUpgradeTx,Mt as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Ft as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,Ht as buildStellarGovernanceExecuteTransferGovOwnTx,Gt as buildStellarGovernanceExecuteTx,Xt as buildStellarGovernanceExecuteUpdateDelayTx,qe as buildStellarGrantRoleTx,br as buildStellarLendingIdentifier,H as buildStellarLiquidateTx,Q as buildStellarMigrateFromBlendTx,Ne as buildStellarMigrateTx,Z as buildStellarMultiplyTx,Pe as buildStellarPauseTx,bt as buildStellarProposeAddAssetToSpokeTx,_t as buildStellarProposeAddSpokeTx,xt as buildStellarProposeApproveBlendPoolTx,kt as buildStellarProposeApproveTokenTx,Ut as buildStellarProposeConfigureMarketOracleTx,ht as buildStellarProposeCreateHubTx,Tt as buildStellarProposeCreateLiquidityPoolTx,$t as buildStellarProposeDeployPoolTx,Bt as buildStellarProposeDisableTokenOracleTx,yt as buildStellarProposeEditAssetInSpokeTx,qt as buildStellarProposeEditOracleToleranceTx,Lt as buildStellarProposeGovernanceUpgradeTx,Wt as buildStellarProposeGrantGovernanceRoleTx,Nt as buildStellarProposeMigrateControllerTx,gt as buildStellarProposeRemoveAssetFromSpokeTx,wt as buildStellarProposeRemoveSpokeTx,It as buildStellarProposeRevokeBlendPoolTx,zt as buildStellarProposeRevokeGovernanceRoleTx,Rt as buildStellarProposeRevokeTokenTx,dt as buildStellarProposeSetAccumulatorTx,pt as buildStellarProposeSetAggregatorTx,vt as buildStellarProposeSetMinBorrowCollatTx,ft as buildStellarProposeSetPoolTemplateTx,mt as buildStellarProposeSetPositionLimitsTx,St as buildStellarProposeSetPositionManagerTx,Pt as buildStellarProposeTransferCtrlOwnershipTx,Dt as buildStellarProposeTransferGovOwnTx,Vt as buildStellarProposeUpdateDelayTx,Ot as buildStellarProposeUpgradeControllerTx,Et as buildStellarProposeUpgradePoolParamsTx,At as buildStellarProposeUpgradePoolTx,Ze as buildStellarRenewAccountTx,M as buildStellarRepayBatchTx,Y as buildStellarRepayDebtWithCollateralTx,F as buildStellarRepayTx,Le as buildStellarRevokeRoleTx,Me as buildStellarRevokeTokenTx,De as buildStellarSetAccumulatorTx,ze as buildStellarSetAggregatorTx,Ge as buildStellarSetLiquidityPoolTemplateTx,Fe as buildStellarSetMarketOracleConfigTx,He as buildStellarSetOracleToleranceTx,Ce as buildStellarSetPositionLimitsTx,W as buildStellarSupplyBatchTx,z as buildStellarSupplyTx,K as buildStellarSwapCollateralTx,J as buildStellarSwapDebtTx,Ve as buildStellarTransferOwnershipTx,Ue as buildStellarUnpauseTx,tt as buildStellarUpdateAccountThresholdTx,Qe as buildStellarUpdateIndexesTx,Oe as buildStellarUpgradeControllerTx,Ke as buildStellarUpgradeLiquidityPoolParamsTx,C as buildStellarWithdrawBatchTx,X as buildStellarWithdrawTx,V as buildTx,hr as decodeStellarLendingEvent,xe as encodeInterestRateModel,Be as encodeMarketOracleConfigInput,Ie as encodeMarketParamsRaw,Ae as encodeOracleSourceConfigInput,Te as encodePositionLimits,Tr as encodeStrategyPayloadToRouteXdr,yr as extractEventOrder,we as getStellarAccountPositions,Rr as getStellarAggregatorQuote,h as getStellarAggregatorRouter,le as getStellarAsset,ye as getStellarAssetGraph,de as getStellarAssetMarkets,pe as getStellarAssetPage,ae as getStellarAssets,_ as getStellarGovernance,be as getStellarGovernanceProposals,fe as getStellarHub,ge as getStellarHubGraph,ne as getStellarHubs,oe as getStellarLendingContext,m as getStellarLendingController,xr as getStellarQuoteTokens,ue as getStellarReserve,ve as getStellarReserveGraph,ce as getStellarReserveHolders,ie as getStellarReserves,me as getStellarSpoke,Se as getStellarSpokeGraph,se as getStellarSpokes,_e as getStellarUserActivity,he as getStellarUserPositions,Or as mapQuoteResponseToAggregatorSwap,Ar as mapQuoteResponseToStrategyPayload,Br as mapQuoteResponseToStrategySwap,Sr as mapStellarPositionActivityType,qr as prepareStellarBuiltTx,Ur as prepareStellarTxXdr,Zt as stellarLendingDispatchKey,ke as stellarLendingRead,gr as syntheticEventOrder,Pr as tagStellarInvokedContractError,jt as toBase64Xdr,Lr as toStellarPositionMode};
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis);import{Account as e,Address as t,BASE_FEE as r,Contract as o,ScInt as a,TransactionBuilder as n,scValToNative as s,xdr as i}from"@stellar/stellar-sdk";const u={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},c={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},l={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},p={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},d={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},f={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function m(e){const t=u[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 h(e){const t=c[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 _(e){const t=l[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const w=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new t(e).toScVal(),y=e=>new a(e).toI128(),g=e=>i.ScVal.scvU32(e),S=e=>new a("string"==typeof e?e:e.toString()).toU64(),v=e=>i.ScVal.scvBool(e),k=e=>i.ScVal.scvString(e),R=e=>i.ScVal.scvSymbol(e),x=()=>i.ScVal.scvVoid(),I=e=>i.ScVal.scvVec(e),T=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return i.ScVal.scvBytes(o)},E=(e,t)=>null==e?x():t(e),$=(e,t)=>O({asset:b(t),hub_id:g(e)}),A=(e,t,r)=>i.ScVal.scvVec([$(e,t),y(r)]),B=e=>i.ScVal.scvVec(e.map((e=>A(e.hubId,e.asset,e.amount)))),O=e=>{const t=Object.keys(e).sort().map((t=>new i.ScMapEntry({key:R(t),val:e[t]})));return i.ScVal.scvMap(t)},N=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return O({amount_out:y(e.amountOut),pool:b(e.pool),token_in:b(e.tokenIn),token_out:b(e.tokenOut),venue:(t=e.venue,i.ScVal.scvVec([R(t)]))});var t}));return O({hops:i.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return O({paths:i.ScVal.scvVec(t),referral_id:S(e.referralId??0),token_in:b(e.tokenIn),token_out:b(e.tokenOut),total_min_out:y(e.totalMinOut)})},P=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 i.ScVal.scvBytes(t)},U=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},q=e=>{if("string"==typeof e)return P(U(e));if(e instanceof Uint8Array)return P(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?P(U(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?P(U(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?P(U(e.bytes)):P(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let r=0;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);r+=o.splitPpm;for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.amountOut||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!w.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==r)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${r}`);return t})(e),i.ScVal.scvBytes(Buffer.from(N(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return i.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return i.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function V(t,a,s){const i=t.controllerAddress??m(t.network),u=new o(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function W(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return V(e,"supply",[b(e.caller),S(r),g(o),B([...t.assets])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function D(e,t){return V(e,"borrow",[b(e.caller),S(t.accountNonce),B([...t.borrows]),E(t.to,b)])}function G(e,t){return D(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function C(e,t){return V(e,"withdraw",[b(e.caller),S(t.accountNonce),B([...t.withdrawals]),E(t.to,b)])}function X(e,t){return C(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function M(e,t){return V(e,"repay",[b(e.caller),S(t.accountNonce),B([...t.payments])])}function F(e,t){return M(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return V(e,"liquidate",[b(e.caller),S(t.accountNonce),B([...t.debtPayments])])}function j(e,t){return V(e,"flash_loan",[b(e.caller),$(t.hubId,t.asset),y(t.amount),b(t.receiver),L(t.data)])}function Q(e,t){return V(e,"migrate_from_blend",[b(e.caller),S(t.accountId),g(t.spokeId),g(t.hubId),b(t.blendPool),I(t.collateralTokens.map(b)),I(t.supplyTokens.map(b)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),i.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,i.ScVal.scvVec([b(t),y(r)]);var t,r}))))]);var r}function Z(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return V(e,"multiply",[b(e.caller),S(r),g(o),$(t.collateral.hubId,t.collateral.asset),y(t.debtToFlashLoan),$(t.debt.hubId,t.debt.asset),g(t.mode),q(t.steps),E(t.initialPayment,(e=>A(e.hubId,e.asset,e.amount))),E(t.convertSwap,q)])}function J(e,t){return V(e,"swap_debt",[b(e.caller),S(t.accountNonce),$(t.existingDebt.hubId,t.existingDebt.asset),y(t.newDebtAmount),$(t.newDebt.hubId,t.newDebt.asset),q(t.steps)])}function K(e,t){return V(e,"swap_collateral",[b(e.caller),S(t.accountNonce),$(t.current.hubId,t.current.asset),y(t.fromAmount),$(t.newCollateral.hubId,t.newCollateral.asset),q(t.steps)])}function Y(e,t){return V(e,"repay_debt_with_collateral",[b(e.caller),S(t.accountNonce),$(t.collateral.hubId,t.collateral.asset),y(t.collateralAmount),$(t.debt.hubId,t.debt.asset),q(t.steps),v(t.closePosition)])}const ee="/stellar-lending",te=25,re=encodeURIComponent,oe=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),se=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),ie=(e,t={},r)=>{const{hubId:o,spokeId:a,asset:n}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==a?{spokeId:a}:{},...n?{asset:n}:{}}})},ue=(e,t,r,o,a)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}`,a),ce=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/holders`,{...n,params:{side:a}}),le=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}`,r),pe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/page`,{...o,params:{...r}}),de=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/markets`,{...o,params:{side:r}}),fe=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),me=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),he=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${re(t)}/positions`,r),_e=(e,t,r={},o)=>{const{skip:a,top:n}=r;return e.fetchWithTimeout(`${ee}/users/${re(t)}/activity`,{...o,params:{...void 0!==a?{skip:a}:{},...void 0!==n?{top:n}:{}}})},we=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(t)}/positions`,r),be=(e,t={},r)=>{const{top:o=te,continuationToken:a}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{top:o,...a?{continuationToken:a}:{}}})},ye=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/graph`,{...o,params:{...r}}),ge=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),ve=(e,t,r,o,a,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/graph`,{...n,params:{...a}}),ke=e=>({context:t=>oe(e,t),assets:t=>ae(e,t),hubs:t=>ne(e,t),spokes:t=>se(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?ie(e,t,r):ie(e,{},t);var o},reserve:(t,r,o,a)=>ue(e,t,r,o,a),reserveHolders:(t,r,o,a,n)=>ce(e,t,r,o,a,n),asset:(t,r)=>le(e,t,r),assetMarkets:(t,r,o)=>de(e,t,r,o),hub:(t,r)=>fe(e,t,r),spoke:(t,r)=>me(e,t,r),userPositions:(t,r)=>he(e,t,r),userActivity:(t,r,o)=>_e(e,t,r,o),accountPositions:(t,r)=>we(e,t,r),governanceProposals:(t,r)=>be(e,t,r),assetGraph:(t,r,o)=>ye(e,t,r,o),hubGraph:(t,r,o)=>ge(e,t,r,o),spokeGraph:(t,r,o)=>Se(e,t,r,o),reserveGraph:(t,r,o,a,n)=>ve(e,t,r,o,a,n)}),Re={Single:0,PrimaryWithAnchor:1},xe=e=>O({base_borrow_rate:y(e.baseBorrowRateRay),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),Ie=e=>O({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate:y(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:v(e.isFlashloanable),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),Te=e=>O({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Ee=e=>{const t=e.kind;switch(t){case"Stellar":return I([R("Stellar"),b(e.value)]);case"Symbol":return I([R("Symbol"),R(e.value)]);case"String":return I([R("String"),k(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},$e=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return I([R("Twap"),g(t)])}return I([R("Spot")])},Ae=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return I([R("Reflector"),O({asset:Ee(e.asset),contract:b(e.contract),read_mode:$e(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 I([R("RedStone"),O({contract:b(e.contract),feed_id:k(e.feedId),max_stale_seconds:S(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Be=e=>{const t=Re[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return O({anchor:(r=e.anchor,I(null==r?[R("None")]:[R("Some"),Ae(r)])),max_price_stale_seconds:S(e.maxPriceStaleSeconds),max_sanity_price_wad:y(e.maxSanityPriceWad),min_sanity_price_wad:y(e.minSanityPriceWad),primary:Ae(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var r};function Oe(e,t){return V(e,"upgrade",[T(t.wasmHash)])}function Ne(e,t){return V(e,"migrate",[g(t.newVersion)])}function Pe(e){return V(e,"pause",[])}function Ue(e){return V(e,"unpause",[])}function qe(e,t){return V(e,"grant_role",[b(t.account),R(t.role)])}function Le(e,t){return V(e,"revoke_role",[b(t.account),R(t.role)])}function Ve(e,t){return V(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function We(e){return V(e,"accept_ownership",[])}function ze(e,t){return V(e,"set_aggregator",[b(t.aggregator)])}function De(e,t){return V(e,"set_accumulator",[b(t.accumulator)])}function Ge(e,t){return V(e,"set_liquidity_pool_template",[T(t.wasmHash)])}function Ce(e,t){return V(e,"set_position_limits",[Te(t)])}function Xe(e,t){return V(e,"approve_token",[b(t.token)])}function Me(e,t){return V(e,"revoke_token",[b(t.token)])}function Fe(e,t){return V(e,"set_market_oracle_config",[$(t.hubId,t.asset),Be(t.config)])}function He(e,t){return V(e,"set_oracle_tolerance",[b(t.asset),O({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function je(e,t){return V(e,"disable_token_oracle",[b(t.asset)])}function Qe(e,t){return V(e,"update_indexes",[b(e.caller),I(t.assets.map((e=>$(e.hubId,e.asset))))])}function Ze(e,t){return V(e,"renew_account",[b(e.caller),S(t.accountNonce)])}function Je(e,t){return V(e,"create_liquidity_pool",[g(t.hubId),b(t.asset),Ie(t.params)])}function Ke(e,t){return V(e,"upgrade_liquidity_pool_params",[$(t.hubId,t.asset),xe(t.params)])}function Ye(e,t){return V(e,"claim_revenue",[b(e.caller),I(t.assets.map((e=>$(e.hubId,e.asset))))])}function et(e,t){return V(e,"add_rewards",[b(e.caller),B(t.rewards)])}function tt(e,t){return V(e,"update_account_threshold",[b(e.caller),v(t.hasRisks),I(t.accountNonces.map((e=>S(e))))])}const rt="00".repeat(32),ot=e=>{if("string"==typeof e)return T(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 i.ScVal.scvBytes(t)},at=(e,...t)=>I([R(e),...t]),nt=e=>O({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),st=e=>O({asset:b(e.asset),bonus:g(e.bonus),borrow_cap:y(e.borrowCap),can_borrow:v(e.canBorrow),can_collateral:v(e.canCollateral),frozen:v(e.frozen),hub_id:g(e.hubId),paused:v(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:I([R("None")]),spoke_id:g(e.spokeId),supply_cap:y(e.supplyCap),threshold:g(e.threshold)}),it=e=>O({account:b(e.account),role:R(e.role)});function ut(t,a,s){const i=t.governanceAddress??_(t.network),u=new o(i),c=new e(t.caller,t.sourceSequence);return{xdr:new n(c,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(u.call(a,...s)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}const ct=(e,t,r)=>ut(e,"propose",[b(e.caller),t,ot(r)]),lt=(e,t,r)=>ut(e,"execute_self",[x(),t,ot(r)]);function pt(e,t,r){return ct(e,at("SetAggregator",b(t.aggregator)),r)}function dt(e,t,r){return ct(e,at("SetAccumulator",b(t.accumulator)),r)}function ft(e,t,r){return ct(e,at("SetLiquidityPoolTemplate",T(t.wasmHash)),r)}function mt(e,t,r){return ct(e,at("SetPositionLimits",Te(t)),r)}function ht(e,t){return ct(e,at("CreateHub"),t)}function _t(e,t){return ct(e,at("AddSpoke"),t)}function wt(e,t,r){return ct(e,at("RemoveSpoke",g(t.spokeId)),r)}function bt(e,t,r){return ct(e,at("AddAssetToSpoke",st(t)),r)}function yt(e,t,r){return ct(e,at("EditAssetInSpoke",st(t)),r)}function gt(e,t,r){return ct(e,at("RemoveAssetFromSpoke",O({hub_asset:$((o=t).hubId,o.asset),spoke_id:g(o.spokeId)})),r);var o}function St(e,t,r){return ct(e,at("SetPositionManager",b(t.manager),v(t.isActive)),r)}function vt(e,t,r){return ct(e,at("SetMinBorrowCollateralUsd",y(t.floorWad)),r)}function kt(e,t,r){return ct(e,at("ApproveToken",b(t.token)),r)}function Rt(e,t,r){return ct(e,at("RevokeToken",b(t.token)),r)}function xt(e,t,r){return ct(e,at("ApproveBlendPool",b(t.pool)),r)}function It(e,t,r){return ct(e,at("RevokeBlendPool",b(t.pool)),r)}function Tt(e,t,r){return ct(e,at("CreateLiquidityPool",O({asset:b((o=t).asset),hub_id:g(o.hubId),params:Ie(o.params)})),r);var o}function Et(e,t,r){return ct(e,at("UpgradeLiquidityPoolParams",O({hub_asset:$((o=t).hubId,o.asset),params:xe(o.params)})),r);var o}function $t(e,t){return ct(e,at("DeployPool"),t)}function At(e,t,r){return ct(e,at("UpgradePool",T(t.wasmHash)),r)}function Bt(e,t,r){return ct(e,at("DisableTokenOracle",b(t.asset)),r)}function Ot(e,t,r){return ct(e,at("UpgradeController",T(t.wasmHash)),r)}function Nt(e,t,r){return ct(e,at("MigrateController",g(t.newVersion)),r)}function Pt(e,t,r){return ct(e,at("TransferCtrlOwnership",nt(t)),r)}function Ut(e,t,r){return ct(e,at("ConfigureMarketOracle",O({cfg:Be((o=t).config),hub_asset:$(o.hubId,o.asset)})),r);var o}function qt(e,t,r){return ct(e,at("EditOracleTolerance",O({asset:b((o=t).asset),tolerance:g(o.tolerance)})),r);var o}function Lt(e,t,r){return ct(e,at("UpgradeGov",T(t.wasmHash)),r)}function Vt(e,t,r){return ct(e,at("UpdateGovDelay",g(t.newDelay)),r)}function Wt(e,t,r){return ct(e,at("GrantGovRole",it(t)),r)}function zt(e,t,r){return ct(e,at("RevokeGovRole",it(t)),r)}function Dt(e,t,r){return ct(e,at("TransferGovOwnership",nt(t)),r)}function Gt(e,t){const r=I(t.argsXdr.map((e=>i.ScVal.fromXDR(e,"base64")))),o=ot(t.predecessor??rt);return ut(e,"execute",[x(),b(t.target),R(t.functionName),r,o,ot(t.salt)])}function Ct(e,t,r){return lt(e,at("UpgradeGov",T(t.wasmHash)),r)}function Xt(e,t,r){return lt(e,at("UpdateGovDelay",g(t.newDelay)),r)}function Mt(e,t,r){return lt(e,at("GrantGovRole",it(t)),r)}function Ft(e,t,r){return lt(e,at("RevokeGovRole",it(t)),r)}function Ht(e,t,r){return lt(e,at("TransferGovOwnership",nt(t)),r)}const jt=e=>e.toXDR("base64"),Qt=e=>i.ScVal.fromXDR(e,"base64"),Zt=e=>e.map((e=>String(s(Qt(e))))).join(":"),Jt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Kt=e=>Number(e),Yt=e=>String(e),er=e=>null==e?void 0:Jt(e),tr=e=>null==e?void 0:Yt(e),rr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),or=["None","Multiply","Long","Short"],ar=["Single","PrimaryWithAnchor"],nr=["ReflectorSep40","RedStonePriceFeed"],sr=["Spot","Twap"],ir=["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"],ur=e=>Array.isArray(e)?e:[],cr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],ir[Kt(o)]??Jt(o)),positionType:t,hubId:Kt(e[1]),asset:Yt(e[2]),scaledAmountRay:Jt(e[3]),indexRay:Jt(e[4]),amount:Jt(e[5]),liquidationThresholdBps:r?void 0:Kt(e[6]),liquidationBonusBps:r?void 0:Kt(e[7]),loanToValueBps:r?void 0:Kt(e[8]),liquidationFeesBps:r?void 0:Kt(e[9])};var o},lr=e=>{return{owner:Yt(e[0]),spokeId:Kt(e[1]),mode:(t=e[2],or[Kt(t)]??"None")};var t},pr=(e,t)=>{const r=sr[Kt(e[`${t}_read_mode`])]??"Spot",o=e[`${t}_asset`],a=e[`${t}_symbol`],n=null!=o?{kind:"Stellar",value:Yt(o)}:null!=a?{kind:"Symbol",value:Yt(a)}:void 0;return{provider:nr[Kt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Yt(e[`${t}_contract`]),asset:n,feedId:tr(e[`${t}_feed_id`]),readMode:r,twapRecords:"Twap"===r?Kt(e[`${t}_twap_records`]):void 0,decimals:Kt(e[`${t}_decimals`]),resolutionSeconds:Kt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Kt(e[`${t}_max_stale_seconds`])}},dr=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Yt(e.base_token_id),quoteTokenId:Yt(e.quote_token_id),tolerance:{upperRatio:Kt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Kt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Kt(e.asset_decimals),maxPriceStaleSeconds:Kt(e.max_price_stale_seconds),strategy:ar[Kt(e.strategy)]??"Single",primary:pr(e,"primary"),anchor:t?pr(e,"anchor"):void 0,primaryQuoteToken:tr(e.primary_quote_token),anchorQuoteToken:tr(e.anchor_quote_token),minSanityPriceWad:er(e.min_sanity_price_wad),maxSanityPriceWad:er(e.max_sanity_price_wad)}},fr={"market:create":e=>({topic:"market:create",data:{hubId:Kt(e.hub_id),baseAsset:Yt(e.base_asset),maxBorrowRate:Jt(e.max_borrow_rate),baseBorrowRate:Jt(e.base_borrow_rate),slope1:Jt(e.slope1),slope2:Jt(e.slope2),slope3:Jt(e.slope3),midUtilization:Jt(e.mid_utilization),optimalUtilization:Jt(e.optimal_utilization),maxUtilization:Jt(e.max_utilization),reserveFactor:Kt(e.reserve_factor),marketAddress:Yt(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Yt(e.asset),maxBorrowRateRay:Jt(e.max_borrow_rate),baseBorrowRateRay:Jt(e.base_borrow_rate),slope1Ray:Jt(e.slope1),slope2Ray:Jt(e.slope2),slope3Ray:Jt(e.slope3),midUtilizationRay:Jt(e.mid_utilization),optimalUtilizationRay:Jt(e.optimal_utilization),maxUtilizationRay:Jt(e.max_utilization),reserveFactorBps:Kt(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:ur(e).map((e=>{return t=ur(e),{hubId:Kt(t[0]),asset:Yt(t[1]),timestamp:Kt(t[2]),supplyIndexRay:Jt(t[3]),borrowIndexRay:Jt(t[4]),cash:Jt(t[5]),suppliedRay:Jt(t[6]),borrowedRay:Jt(t[7]),revenueRay:Jt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:ur(e).map((e=>{const t=e;return{hubId:Kt(t.hub_id),asset:Yt(t.asset),params:(r=t.params,{maxBorrowRateRay:Jt(r.max_borrow_rate),baseBorrowRateRay:Jt(r.base_borrow_rate),slope1Ray:Jt(r.slope1),slope2Ray:Jt(r.slope2),slope3Ray:Jt(r.slope3),midUtilizationRay:Jt(r.mid_utilization),optimalUtilizationRay:Jt(r.optimal_utilization),maxUtilizationRay:Jt(r.max_utilization),reserveFactorBps:Kt(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:Kt(r.flashloan_fee),assetId:Yt(r.asset_id),assetDecimals:Kt(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=ur(e);return{topic:"position:batch_update",data:{accountId:Jt(t[0]),accountAttributes:lr(ur(t[1])),updates:[...ur(t[2]).map((e=>cr(ur(e),"Deposit"))),...ur(t[3]).map((e=>cr(ur(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Kt(e.hub_id),asset:Yt(e.asset),receiver:Yt(e.receiver),caller:Yt(e.caller),amount:Jt(e.amount),fee:Jt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Yt(e.asset),oracle:dr(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Yt(e.liquidator),accountId:Jt(e.account_id),repaidUsdWad:Jt(e.repaid_usd_wad),bonusBps:Jt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Jt(e.account_id),totalBorrowUsdWad:Jt(e.total_borrow_usd_wad),totalCollateralUsdWad:Jt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Yt(e.token),amount:Jt(e.amount),usdValueWad:Jt(e.usd_value_wad),accountId:Jt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Kt(e.hub_id),asset:Yt(e.asset),amount:Jt(e.amount),fee:Jt(e.fee),amountSent:Jt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:rr(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Yt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Yt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:rr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Kt(e.max_supply_positions),maxBorrowPositions:Kt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Yt(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Kt(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Jt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Jt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Kt(t.liquidation_bonus_factor_bps)}}}},mr=Object.freeze(Object.keys(fr));function hr(e,t){const r=Zt(e),o=fr[r];return o?o(s(Qt(t))):null}const _r="XLENDXLM-a7c9f3",wr=1e4;function br(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${_r}-${r}`}function yr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function gr(e,t=0){return 1e4*e+t}function Sr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const vr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},kr=e=>e.baseUrl??d[e.network];async function Rr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=vr(kr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function xr(e){const t=vr(kr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Ir=(e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e,Tr=e=>N(e).toXDR("base64");function Er(t,a){const s=t.routerAddress??h(t.network),i=new o(s),u=new e(t.caller,t.sourceSequence),c=q(Ir(a,t.referralId));return{xdr:new n(u,{fee:t.fee??r,networkPassphrase:f[t.network]}).addOperation(i.call("execute_strategy",b(t.caller),y(t.totalIn),c)).setTimeout(t.timeoutSeconds??300).build().toXDR()}}function $r(e,t){return Er(e,t)}function Ar(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(Nr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Nr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Br(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Ar(e,t)}const Or=Ar,Nr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Pr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Ur(e,t,r){const o=n.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Pr(r.invokedContractId,e);throw e}}async function qr(e,t,r){return Ur(e,t.xdr,r)}function Lr(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 Vr(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 Wr=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 zr(t){const r=new e(t.caller,t.sourceSequence),a=new o(t.forwarderAddress).call("mint_and_forward",i.ScVal.scvBytes(Wr(t.message)),i.ScVal.scvBytes(Wr(t.attestation)));return{xdr:new n(r,{fee:t.fee??"10000000",networkPassphrase:f[t.network]}).addOperation(a).setTimeout(t.timeoutSeconds??120).build().toXDR()}}export{c as STELLAR_AGGREGATOR_ROUTER,l as STELLAR_GOVERNANCE,rt as STELLAR_GOVERNANCE_ZERO_PREDECESSOR,u as STELLAR_LENDING_CONTROLLER,mr as STELLAR_LENDING_TOPICS,f as STELLAR_NETWORK_PASSPHRASE,d as STELLAR_QUOTE_URL,p as STELLAR_SOROBAN_RPC_URL,wr as SYNTHETIC_EVENT_ORDER_STRIDE,_r as XOXNO_LENDING_STELLAR_TICKER,Vr as buildSameTokenRepaySwapSteps,We as buildStellarAcceptOwnershipTx,et as buildStellarAddRewardsTx,Xe as buildStellarApproveTokenTx,$r as buildStellarBatchSwapTx,D as buildStellarBorrowBatchTx,G as buildStellarBorrowTx,zr as buildStellarCctpForwardTx,Ye as buildStellarClaimRevenueTx,Je as buildStellarCreateLiquidityPoolTx,je as buildStellarDisableTokenOracleTx,Er as buildStellarExecuteStrategyTx,j as buildStellarFlashLoanTx,Ct as buildStellarGovernanceExecuteGovernanceUpgradeTx,Mt as buildStellarGovernanceExecuteGrantGovernanceRoleTx,Ft as buildStellarGovernanceExecuteRevokeGovernanceRoleTx,Ht as buildStellarGovernanceExecuteTransferGovOwnTx,Gt as buildStellarGovernanceExecuteTx,Xt as buildStellarGovernanceExecuteUpdateDelayTx,qe as buildStellarGrantRoleTx,br as buildStellarLendingIdentifier,H as buildStellarLiquidateTx,Q as buildStellarMigrateFromBlendTx,Ne as buildStellarMigrateTx,Z as buildStellarMultiplyTx,Pe as buildStellarPauseTx,bt as buildStellarProposeAddAssetToSpokeTx,_t as buildStellarProposeAddSpokeTx,xt as buildStellarProposeApproveBlendPoolTx,kt as buildStellarProposeApproveTokenTx,Ut as buildStellarProposeConfigureMarketOracleTx,ht as buildStellarProposeCreateHubTx,Tt as buildStellarProposeCreateLiquidityPoolTx,$t as buildStellarProposeDeployPoolTx,Bt as buildStellarProposeDisableTokenOracleTx,yt as buildStellarProposeEditAssetInSpokeTx,qt as buildStellarProposeEditOracleToleranceTx,Lt as buildStellarProposeGovernanceUpgradeTx,Wt as buildStellarProposeGrantGovernanceRoleTx,Nt as buildStellarProposeMigrateControllerTx,gt as buildStellarProposeRemoveAssetFromSpokeTx,wt as buildStellarProposeRemoveSpokeTx,It as buildStellarProposeRevokeBlendPoolTx,zt as buildStellarProposeRevokeGovernanceRoleTx,Rt as buildStellarProposeRevokeTokenTx,dt as buildStellarProposeSetAccumulatorTx,pt as buildStellarProposeSetAggregatorTx,vt as buildStellarProposeSetMinBorrowCollatTx,ft as buildStellarProposeSetPoolTemplateTx,mt as buildStellarProposeSetPositionLimitsTx,St as buildStellarProposeSetPositionManagerTx,Pt as buildStellarProposeTransferCtrlOwnershipTx,Dt as buildStellarProposeTransferGovOwnTx,Vt as buildStellarProposeUpdateDelayTx,Ot as buildStellarProposeUpgradeControllerTx,Et as buildStellarProposeUpgradePoolParamsTx,At as buildStellarProposeUpgradePoolTx,Ze as buildStellarRenewAccountTx,M as buildStellarRepayBatchTx,Y as buildStellarRepayDebtWithCollateralTx,F as buildStellarRepayTx,Le as buildStellarRevokeRoleTx,Me as buildStellarRevokeTokenTx,De as buildStellarSetAccumulatorTx,ze as buildStellarSetAggregatorTx,Ge as buildStellarSetLiquidityPoolTemplateTx,Fe as buildStellarSetMarketOracleConfigTx,He as buildStellarSetOracleToleranceTx,Ce as buildStellarSetPositionLimitsTx,W as buildStellarSupplyBatchTx,z as buildStellarSupplyTx,K as buildStellarSwapCollateralTx,J as buildStellarSwapDebtTx,Ve as buildStellarTransferOwnershipTx,Ue as buildStellarUnpauseTx,tt as buildStellarUpdateAccountThresholdTx,Qe as buildStellarUpdateIndexesTx,Oe as buildStellarUpgradeControllerTx,Ke as buildStellarUpgradeLiquidityPoolParamsTx,C as buildStellarWithdrawBatchTx,X as buildStellarWithdrawTx,V as buildTx,hr as decodeStellarLendingEvent,xe as encodeInterestRateModel,Be as encodeMarketOracleConfigInput,Ie as encodeMarketParamsRaw,Ae as encodeOracleSourceConfigInput,Te as encodePositionLimits,Tr as encodeStrategyPayloadToRouteXdr,yr as extractEventOrder,we as getStellarAccountPositions,Rr as getStellarAggregatorQuote,h as getStellarAggregatorRouter,le as getStellarAsset,ye as getStellarAssetGraph,de as getStellarAssetMarkets,pe as getStellarAssetPage,ae as getStellarAssets,_ as getStellarGovernance,be as getStellarGovernanceProposals,fe as getStellarHub,ge as getStellarHubGraph,ne as getStellarHubs,oe as getStellarLendingContext,m as getStellarLendingController,xr as getStellarQuoteTokens,ue as getStellarReserve,ve as getStellarReserveGraph,ce as getStellarReserveHolders,ie as getStellarReserves,me as getStellarSpoke,Se as getStellarSpokeGraph,se as getStellarSpokes,_e as getStellarUserActivity,he as getStellarUserPositions,Or as mapQuoteResponseToAggregatorSwap,Ar as mapQuoteResponseToStrategyPayload,Br as mapQuoteResponseToStrategySwap,Sr as mapStellarPositionActivityType,qr as prepareStellarBuiltTx,Ur as prepareStellarTxXdr,Zt as stellarLendingDispatchKey,ke as stellarLendingRead,gr as syntheticEventOrder,Pr as tagStellarInvokedContractError,jt as toBase64Xdr,Lr as toStellarPositionMode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "1.0.180",
3
+ "version": "1.0.182",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
5
  "type": "module",
6
6
  "exports": {