@xoxno/sdk-js 1.0.185 → 1.0.186

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.
@@ -105,10 +105,6 @@ export declare function buildStellarRevokeTokenTx(opts: StellarBuilderOptions, a
105
105
  export declare function buildStellarSetMarketOracleConfigTx(opts: StellarBuilderOptions, args: ConfigureMarketOracleArgs): BuiltStellarTx;
106
106
  /** set_oracle_tolerance(asset, tolerance: OraclePriceFluctuation) — #[only_owner] */
107
107
  export declare function buildStellarSetOracleToleranceTx(opts: StellarBuilderOptions, args: EditOracleToleranceArgs): BuiltStellarTx;
108
- /** disable_token_oracle(asset) — #[only_owner] */
109
- export declare function buildStellarDisableTokenOracleTx(opts: StellarBuilderOptions, args: {
110
- asset: string;
111
- }): BuiltStellarTx;
112
108
  /** update_indexes(caller, assets: Vec<HubAssetKey>) */
113
109
  export declare function buildStellarUpdateIndexesTx(opts: StellarBuilderOptions, args: {
114
110
  assets: Array<{
@@ -156,10 +156,6 @@ export declare function buildStellarProposeDeployPoolTx(opts: StellarBuilderOpti
156
156
  export declare function buildStellarProposeUpgradePoolTx(opts: StellarBuilderOptions, args: {
157
157
  wasmHash: string;
158
158
  }, salt: StellarGovernanceSalt): BuiltStellarTx;
159
- /** propose(DisableTokenOracle(asset)) */
160
- export declare function buildStellarProposeDisableTokenOracleTx(opts: StellarBuilderOptions, args: {
161
- asset: string;
162
- }, salt: StellarGovernanceSalt): BuiltStellarTx;
163
159
  /** propose(UpgradeController(hash)) */
164
160
  export declare function buildStellarProposeUpgradeControllerTx(opts: StellarBuilderOptions, args: UpgradeArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
165
161
  /** propose(MigrateController(new_version)) */
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Ye,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>yo,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>go,XOXNO_LENDING_STELLAR_TICKER:()=>bo,buildSameTokenRepaySwapSteps:()=>Uo,buildStellarAcceptOwnershipTx:()=>Ue,buildStellarAddRewardsTx:()=>Ke,buildStellarApproveTokenTx:()=>$e,buildStellarBatchSwapTx:()=>Po,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>Go,buildStellarClaimRevenueTx:()=>Ze,buildStellarCreateLiquidityPoolTx:()=>Fe,buildStellarDisableTokenOracleTx:()=>Ve,buildStellarExecuteStrategyTx:()=>wo,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>$t,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>zt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Ht,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Vt,buildStellarGovernanceExecuteTx:()=>Dt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Wt,buildStellarGrantRoleTx:()=>Me,buildStellarLendingIdentifier:()=>To,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Ee,buildStellarMultiplyTx:()=>X,buildStellarPauseTx:()=>Ie,buildStellarProposeAddAssetToSpokeTx:()=>bt,buildStellarProposeAddSpokeTx:()=>yt,buildStellarProposeApproveBlendPoolTx:()=>qt,buildStellarProposeApproveTokenTx:()=>vt,buildStellarProposeConfigureMarketOracleTx:()=>Mt,buildStellarProposeCreateHubTx:()=>ct,buildStellarProposeCreateLiquidityPoolTx:()=>_t,buildStellarProposeDeployPoolTx:()=>Pt,buildStellarProposeDisableTokenOracleTx:()=>Rt,buildStellarProposeEditAssetInSpokeTx:()=>gt,buildStellarProposeEditOracleToleranceTx:()=>Lt,buildStellarProposeGovernanceUpgradeTx:()=>Ct,buildStellarProposeGrantGovernanceRoleTx:()=>Nt,buildStellarProposeMigrateControllerTx:()=>It,buildStellarProposeRemoveAssetFromSpokeTx:()=>Tt,buildStellarProposeRemoveSpokeTx:()=>St,buildStellarProposeRevokeBlendPoolTx:()=>At,buildStellarProposeRevokeGovernanceRoleTx:()=>Gt,buildStellarProposeRevokeTokenTx:()=>xt,buildStellarProposeSetAccumulatorTx:()=>st,buildStellarProposeSetAggregatorTx:()=>lt,buildStellarProposeSetMinBorrowCollatTx:()=>ht,buildStellarProposeSetPoolTemplateTx:()=>pt,buildStellarProposeSetPositionLimitsTx:()=>dt,buildStellarProposeSetPositionManagerTx:()=>ft,buildStellarProposeSetSpokeLiquidationCurveTx:()=>mt,buildStellarProposeTransferCtrlOwnershipTx:()=>Ot,buildStellarProposeTransferGovOwnTx:()=>Bt,buildStellarProposeUpdateDelayTx:()=>Ut,buildStellarProposeUpgradeControllerTx:()=>Et,buildStellarProposeUpgradePoolParamsTx:()=>wt,buildStellarProposeUpgradePoolTx:()=>kt,buildStellarRenewAccountTx:()=>Xe,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>Z,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Le,buildStellarRevokeTokenTx:()=>We,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ne,buildStellarSetLiquidityPoolTemplateTx:()=>Be,buildStellarSetMarketOracleConfigTx:()=>ze,buildStellarSetOracleToleranceTx:()=>He,buildStellarSetPositionLimitsTx:()=>De,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>N,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>F,buildStellarTransferOwnershipTx:()=>Ce,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Je,buildStellarUpdateIndexesTx:()=>je,buildStellarUpgradeControllerTx:()=>Re,buildStellarUpgradeLiquidityPoolParamsTx:()=>Qe,buildStellarWithdrawBatchTx:()=>D,buildStellarWithdrawTx:()=>$,buildTx:()=>C,decodeStellarLendingEvent:()=>So,encodeInterestRateModel:()=>xe,encodeMarketOracleConfigInput:()=>ke,encodeMarketParamsRaw:()=>qe,encodeOracleSourceConfigInput:()=>Pe,encodePositionLimits:()=>Ae,encodeStrategyPayloadToRouteXdr:()=>_o,extractEventOrder:()=>mo,getStellarAccountPositions:()=>Se,getStellarAggregatorQuote:()=>qo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ie,getStellarAssetGraph:()=>ge,getStellarAssetMarkets:()=>se,getStellarAssetPage:()=>le,getStellarAssets:()=>te,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>be,getStellarHub:()=>pe,getStellarHubGraph:()=>Te,getStellarHubs:()=>oe,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>Ao,getStellarReserve:()=>ue,getStellarReserveGraph:()=>fe,getStellarReserveHolders:()=>ae,getStellarReserves:()=>ne,getStellarSpoke:()=>de,getStellarSpokeGraph:()=>me,getStellarSpokes:()=>re,getStellarUserActivity:()=>ye,getStellarUserPositions:()=>ce,mapQuoteResponseToAggregatorSwap:()=>Eo,mapQuoteResponseToStrategyPayload:()=>ko,mapQuoteResponseToStrategySwap:()=>Ro,mapSorobanError:()=>Do,mapStellarPositionActivityType:()=>ho,prepareStellarBuiltTx:()=>Lo,prepareStellarTxXdr:()=>Mo,stellarLendingDispatchKey:()=>Ft,stellarLendingRead:()=>he,syntheticEventOrder:()=>fo,tagStellarInvokedContractError:()=>Oo,toBase64Xdr:()=>jt,toStellarPositionMode:()=>Co});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),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(),m=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>k({asset: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)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:b(e.amountOut),pool: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 k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in: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)},I=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},M=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return 0===e.length?I():E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):0===e.bytes.length?I():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!y.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,o){const r=e.controllerAddress??s(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[S(e.caller),T(o),g(r),P([...t.assets])])}function N(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return C(e,"borrow",[S(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,S)])}function B(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function D(e,t){return C(e,"withdraw",[S(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,S)])}function $(e,t){return D(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[S(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[S(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[S(e.caller),_(t.hubId,t.asset),b(t.amount),S(t.receiver),L(t.data)])}function j(e,t){return C(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 X(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(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),M(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,M)])}function F(e,t){return C(e,"swap_debt",[S(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[S(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Z(e,t){return C(e,"repay_debt_with_collateral",[S(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const K="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),oe=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),ne=(e,t={},o)=>{const{hubId:r,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${K}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ue=(e,t,o,r,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}`,n),ae=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/holders`,{...u,params:{side:n}}),ie=(e,t,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,o),le=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...r,params:{...o}}),se=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...r,params:{side:o}}),pe=(e,t,o)=>e.fetchWithTimeout(`${K}/hubs/${t}`,o),de=(e,t,o)=>e.fetchWithTimeout(`${K}/spokes/${t}`,o),ce=(e,t,o)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,o),ye=(e,t,o={},r)=>{const{skip:n,top:u}=o;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},Se=(e,t,o)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,o),be=(e,t={},o)=>{const{top:r=J,continuationToken:n}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},ge=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...r,params:{...o}}),Te=(e,t,o,r)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...r,params:{...o}}),me=(e,t,o,r)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/graph`,{...u,params:{...n}}),he=e=>({context:t=>ee(e,t),assets:t=>te(e,t),hubs:t=>oe(e,t),spokes:t=>re(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ne(e,t,o):ne(e,{},t);var r},reserve:(t,o,r,n)=>ue(e,t,o,r,n),reserveHolders:(t,o,r,n,u)=>ae(e,t,o,r,n,u),asset:(t,o)=>ie(e,t,o),assetMarkets:(t,o,r)=>se(e,t,o,r),hub:(t,o)=>pe(e,t,o),spoke:(t,o)=>de(e,t,o),userPositions:(t,o)=>ce(e,t,o),userActivity:(t,o,r)=>ye(e,t,o,r),accountPositions:(t,o)=>Se(e,t,o),governanceProposals:(t,o)=>be(e,t,o),assetGraph:(t,o,r)=>ge(e,t,o,r),hubGraph:(t,o,r)=>Te(e,t,o,r),spokeGraph:(t,o,r)=>me(e,t,o,r),reserveGraph:(t,o,r,n,u)=>fe(e,t,o,r,n,u)}),ve={Single:0,PrimaryWithAnchor:1},xe=e=>k({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),qe=e=>k({asset_decimals:g(e.assetDecimals),asset_id:S(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),Ae=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),_e=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"),f(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},we=(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")])},Pe=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([h("Reflector"),k({asset:_e(e.asset),contract:S(e.contract),read_mode:we(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"),k({contract:S(e.contract),feed_id:f(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},ke=e=>{const t=ve[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return k({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),Pe(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Pe(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Re(e,t){return C(e,"upgrade",[q(t.wasmHash)])}function Ee(e,t){return C(e,"migrate",[g(t.newVersion)])}function Ie(e){return C(e,"pause",[])}function Oe(e){return C(e,"unpause",[])}function Me(e,t){return C(e,"grant_role",[S(t.account),h(t.role)])}function Le(e,t){return C(e,"revoke_role",[S(t.account),h(t.role)])}function Ce(e,t){return C(e,"transfer_ownership",[S(t.newOwner),g(t.liveUntilLedger)])}function Ue(e){return C(e,"accept_ownership",[])}function Ne(e,t){return C(e,"set_aggregator",[S(t.aggregator)])}function Ge(e,t){return C(e,"set_accumulator",[S(t.accumulator)])}function Be(e,t){return C(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function De(e,t){return C(e,"set_position_limits",[Ae(t)])}function $e(e,t){return C(e,"approve_token",[S(t.token)])}function We(e,t){return C(e,"revoke_token",[S(t.token)])}function ze(e,t){return C(e,"set_market_oracle_config",[_(t.hubId,t.asset),ke(t.config)])}function He(e,t){return C(e,"set_oracle_tolerance",[S(t.asset),k({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function Ve(e,t){return C(e,"disable_token_oracle",[S(t.asset)])}function je(e,t){return C(e,"update_indexes",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Xe(e,t){return C(e,"renew_account",[S(e.caller),T(t.accountNonce)])}function Fe(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),S(t.asset),qe(t.params)])}function Qe(e,t){return C(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),xe(t.params)])}function Ze(e,t){return C(e,"claim_revenue",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ke(e,t){return C(e,"add_rewards",[S(e.caller),P(t.rewards)])}function Je(e,t){return C(e,"update_account_threshold",[S(e.caller),m(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const Ye="00".repeat(32),et=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)},tt=(e,...t)=>x([h(e),...t]),ot=e=>k({new_owner:S(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),rt=e=>k({asset:S(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:g(e.hubId),paused:m(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),nt=e=>k({account:S(e.account),role:h(e.role)});function ut(e,t,o){const r=e.governanceAddress??d(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const at=(e,t,o)=>ut(e,"propose",[S(e.caller),t,et(o)]),it=(e,t,o)=>ut(e,"execute_self",[v(),t,et(o)]);function lt(e,t,o){return at(e,tt("SetAggregator",S(t.aggregator)),o)}function st(e,t,o){return at(e,tt("SetAccumulator",S(t.accumulator)),o)}function pt(e,t,o){return at(e,tt("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function dt(e,t,o){return at(e,tt("SetPositionLimits",Ae(t)),o)}function ct(e,t){return at(e,tt("CreateHub"),t)}function yt(e,t){return at(e,tt("AddSpoke"),t)}function St(e,t,o){return at(e,tt("RemoveSpoke",g(t.spokeId)),o)}function bt(e,t,o){return at(e,tt("AddAssetToSpoke",rt(t)),o)}function gt(e,t,o){return at(e,tt("EditAssetInSpoke",rt(t)),o)}function Tt(e,t,o){return at(e,tt("RemoveAssetFromSpoke",k({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function mt(e,t,o){return at(e,tt("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:b((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(r.liquidationBonusFactorBps),spoke_id:g(r.spokeId),target_hf_wad:b(r.targetHfWad)})),o);var r}function ft(e,t,o){return at(e,tt("SetPositionManager",S(t.manager),m(t.isActive)),o)}function ht(e,t,o){return at(e,tt("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function vt(e,t,o){return at(e,tt("ApproveToken",S(t.token)),o)}function xt(e,t,o){return at(e,tt("RevokeToken",S(t.token)),o)}function qt(e,t,o){return at(e,tt("ApproveBlendPool",S(t.pool)),o)}function At(e,t,o){return at(e,tt("RevokeBlendPool",S(t.pool)),o)}function _t(e,t,o){return at(e,tt("CreateLiquidityPool",k({asset:S((r=t).asset),hub_id:g(r.hubId),params:qe(r.params)})),o);var r}function wt(e,t,o){return at(e,tt("UpgradeLiquidityPoolParams",k({hub_asset:_((r=t).hubId,r.asset),params:xe(r.params)})),o);var r}function Pt(e,t){return at(e,tt("DeployPool"),t)}function kt(e,t,o){return at(e,tt("UpgradePool",q(t.wasmHash)),o)}function Rt(e,t,o){return at(e,tt("DisableTokenOracle",S(t.asset)),o)}function Et(e,t,o){return at(e,tt("UpgradeController",q(t.wasmHash)),o)}function It(e,t,o){return at(e,tt("MigrateController",g(t.newVersion)),o)}function Ot(e,t,o){return at(e,tt("TransferCtrlOwnership",ot(t)),o)}function Mt(e,t,o){return at(e,tt("ConfigureMarketOracle",k({cfg:ke((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function Lt(e,t,o){return at(e,tt("EditOracleTolerance",k({asset:S((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Ct(e,t,o){return at(e,tt("UpgradeGov",q(t.wasmHash)),o)}function Ut(e,t,o){return at(e,tt("UpdateGovDelay",g(t.newDelay)),o)}function Nt(e,t,o){return at(e,tt("GrantGovRole",nt(t)),o)}function Gt(e,t,o){return at(e,tt("RevokeGovRole",nt(t)),o)}function Bt(e,t,o){return at(e,tt("TransferGovOwnership",ot(t)),o)}function Dt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=et(t.predecessor??Ye);return ut(e,"execute",[v(),S(t.target),h(t.functionName),o,r,et(t.salt)])}function $t(e,t,o){return it(e,tt("UpgradeGov",q(t.wasmHash)),o)}function Wt(e,t,o){return it(e,tt("UpdateGovDelay",g(t.newDelay)),o)}function zt(e,t,o){return it(e,tt("GrantGovRole",nt(t)),o)}function Ht(e,t,o){return it(e,tt("RevokeGovRole",nt(t)),o)}function Vt(e,t,o){return it(e,tt("TransferGovOwnership",ot(t)),o)}const jt=e=>e.toXDR("base64"),Xt=e=>c.xdr.ScVal.fromXDR(e,"base64"),Ft=e=>e.map((e=>String((0,c.scValToNative)(Xt(e))))).join(":"),Qt=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),Zt=e=>Number(e),Kt=e=>String(e),Jt=e=>null==e?void 0:Qt(e),Yt=e=>null==e?void 0:Kt(e),eo=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),to=["None","Multiply","Long","Short"],oo=["Single","PrimaryWithAnchor"],ro=["ReflectorSep40","RedStonePriceFeed"],no=["Spot","Twap"],uo=["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"],ao=e=>Array.isArray(e)?e:[],io=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],uo[Zt(r)]??Qt(r)),positionType:t,hubId:Zt(e[1]),asset:Kt(e[2]),scaledAmountRay:Qt(e[3]),indexRay:Qt(e[4]),amount:Qt(e[5]),liquidationThresholdBps:o?void 0:Zt(e[6]),liquidationBonusBps:o?void 0:Zt(e[7]),loanToValueBps:o?void 0:Zt(e[8]),liquidationFeesBps:o?void 0:Zt(e[9])};var r},lo=e=>{return{owner:Kt(e[0]),spokeId:Zt(e[1]),mode:(t=e[2],to[Zt(t)]??"None")};var t},so=(e,t)=>{const o=no[Zt(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],n=e[`${t}_symbol`],u=null!=r?{kind:"Stellar",value:Kt(r)}:null!=n?{kind:"Symbol",value:Kt(n)}:void 0;return{provider:ro[Zt(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Kt(e[`${t}_contract`]),asset:u,feedId:Yt(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?Zt(e[`${t}_twap_records`]):void 0,decimals:Zt(e[`${t}_decimals`]),resolutionSeconds:Zt(e[`${t}_resolution_seconds`]),maxStaleSeconds:Zt(e[`${t}_max_stale_seconds`])}},po=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:Kt(e.base_token_id),quoteTokenId:Kt(e.quote_token_id),tolerance:{upperRatio:Zt(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:Zt(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:Zt(e.asset_decimals),maxPriceStaleSeconds:Zt(e.max_price_stale_seconds),strategy:oo[Zt(e.strategy)]??"Single",primary:so(e,"primary"),anchor:t?so(e,"anchor"):void 0,primaryQuoteToken:Yt(e.primary_quote_token),anchorQuoteToken:Yt(e.anchor_quote_token),minSanityPriceWad:Jt(e.min_sanity_price_wad),maxSanityPriceWad:Jt(e.max_sanity_price_wad)}},co={"market:create":e=>({topic:"market:create",data:{hubId:Zt(e.hub_id),baseAsset:Kt(e.base_asset),maxBorrowRate:Qt(e.max_borrow_rate),baseBorrowRate:Qt(e.base_borrow_rate),slope1:Qt(e.slope1),slope2:Qt(e.slope2),slope3:Qt(e.slope3),midUtilization:Qt(e.mid_utilization),optimalUtilization:Qt(e.optimal_utilization),maxUtilization:Qt(e.max_utilization),reserveFactor:Zt(e.reserve_factor),marketAddress:Kt(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Kt(e.asset),maxBorrowRateRay:Qt(e.max_borrow_rate),baseBorrowRateRay:Qt(e.base_borrow_rate),slope1Ray:Qt(e.slope1),slope2Ray:Qt(e.slope2),slope3Ray:Qt(e.slope3),midUtilizationRay:Qt(e.mid_utilization),optimalUtilizationRay:Qt(e.optimal_utilization),maxUtilizationRay:Qt(e.max_utilization),reserveFactorBps:Zt(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:ao(e).map((e=>{return t=ao(e),{hubId:Zt(t[0]),asset:Kt(t[1]),timestamp:Zt(t[2]),supplyIndexRay:Qt(t[3]),borrowIndexRay:Qt(t[4]),cash:Qt(t[5]),suppliedRay:Qt(t[6]),borrowedRay:Qt(t[7]),revenueRay:Qt(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:ao(e).map((e=>{const t=e;return{hubId:Zt(t.hub_id),asset:Kt(t.asset),params:(o=t.params,{maxBorrowRateRay:Qt(o.max_borrow_rate),baseBorrowRateRay:Qt(o.base_borrow_rate),slope1Ray:Qt(o.slope1),slope2Ray:Qt(o.slope2),slope3Ray:Qt(o.slope3),midUtilizationRay:Qt(o.mid_utilization),optimalUtilizationRay:Qt(o.optimal_utilization),maxUtilizationRay:Qt(o.max_utilization),reserveFactorBps:Zt(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:Zt(o.flashloan_fee),assetId:Kt(o.asset_id),assetDecimals:Zt(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=ao(e);return{topic:"position:batch_update",data:{accountId:Qt(t[0]),accountAttributes:lo(ao(t[1])),updates:[...ao(t[2]).map((e=>io(ao(e),"Deposit"))),...ao(t[3]).map((e=>io(ao(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:Zt(e.hub_id),asset:Kt(e.asset),receiver:Kt(e.receiver),caller:Kt(e.caller),amount:Qt(e.amount),fee:Qt(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Kt(e.asset),oracle:po(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Kt(e.liquidator),accountId:Qt(e.account_id),repaidUsdWad:Qt(e.repaid_usd_wad),bonusBps:Qt(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:Qt(e.account_id),totalBorrowUsdWad:Qt(e.total_borrow_usd_wad),totalCollateralUsdWad:Qt(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Kt(e.token),amount:Qt(e.amount),usdValueWad:Qt(e.usd_value_wad),accountId:Qt(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:Zt(e.hub_id),asset:Kt(e.asset),amount:Qt(e.amount),fee:Qt(e.fee),amountSent:Qt(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:eo(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Kt(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Kt(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:eo(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:Zt(e.max_supply_positions),maxBorrowPositions:Zt(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Kt(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:Zt(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:Qt(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:Qt(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:Zt(t.liquidation_bonus_factor_bps)}}}},yo=Object.freeze(Object.keys(co));function So(e,t){const o=Ft(e),r=co[o];return r?r((0,c.scValToNative)(Xt(t))):null}const bo="XLENDXLM-a7c9f3",go=1e4;function To(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${bo}-${o}`}function mo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function fo(e,t=0){return e*go+t}function ho(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const vo=(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()},xo=e=>e.baseUrl??i[e.network];async function qo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=vo(xo(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 Ao(e){const t=vo(xo(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 _o=e=>R(e).toXDR("base64");function wo(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",S(e.caller),b(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Po(e,t){return wo(e,t)}function ko(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(Io),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Io),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Ro(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:ko(e,t)}const Eo=ko,Io=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Oo(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Mo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Oo(o.invokedContractId,e);throw e}}async function Lo(e,t,o){return Mo(e,t.xdr,o)}function Co(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 Uo(e,t){return new Uint8Array(0)}const No=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 Go(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(No(e.message)),c.xdr.ScVal.scvBytes(No(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Bo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetsLimitReached",message:"This spoke has reached its asset limit."},314:{name:"SpokeCapBelowUsage",message:"The new cap is below current usage on this spoke asset."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Do(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Bo[o];return r?{code:o,...r}:null}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>T.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>T.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>T.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>T.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>T.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>T.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>T.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>T.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>T.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>T.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>T.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>T.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,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,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,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,mapSorobanError:()=>T.mapSorobanError,mapStellarPositionActivityType:()=>T.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>T.prepareStellarBuiltTx,prepareStellarTxXdr:()=>T.prepareStellarTxXdr,stellarLendingDispatchKey:()=>T.stellarLendingDispatchKey,stellarLendingRead:()=>T.stellarLendingRead,syntheticEventOrder:()=>T.syntheticEventOrder,tagStellarInvokedContractError:()=>T.tagStellarInvokedContractError,toBase64Xdr:()=>T.toBase64Xdr,toStellarPositionMode:()=>T.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...o}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,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:m,...f}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||S?void 0:h??m,q="GET"!==d||S||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class 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(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...o,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!S(e))throw new y(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...m,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:T,params:q,body:b,headers:_,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,o]of Object.entries(b)){const r=t.split("/").filter(Boolean);let n=e;for(const e of r)if(e.startsWith(":")){const t=m(e.slice(1));n=n.params[t]||=f()}else{const t=m(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:o,def:n}=t.leaves[0];i=h(o,n,r,e)}else{i={};for(const{rawPath:o,def:n}of t.leaves)i[m(o.split("/").pop().replace(/^:/,""))]=h(o,n,r,e)}for(const[e,n]of Object.entries(t.static)){const t=o(n,r);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=o(n,{...r,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],o=(...e)=>t(...e);return Object.assign(o,t)}return u};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>Je,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>po,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>So,XOXNO_LENDING_STELLAR_TICKER:()=>yo,buildSameTokenRepaySwapSteps:()=>Lo,buildStellarAcceptOwnershipTx:()=>Ue,buildStellarAddRewardsTx:()=>Ze,buildStellarApproveTokenTx:()=>De,buildStellarBatchSwapTx:()=>_o,buildStellarBorrowBatchTx:()=>G,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>Uo,buildStellarClaimRevenueTx:()=>Qe,buildStellarCreateLiquidityPoolTx:()=>Xe,buildStellarExecuteStrategyTx:()=>Ao,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>Bt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Dt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>Wt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>zt,buildStellarGovernanceExecuteTx:()=>Gt,buildStellarGovernanceExecuteUpdateDelayTx:()=>$t,buildStellarGrantRoleTx:()=>Me,buildStellarLendingIdentifier:()=>bo,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Ee,buildStellarMultiplyTx:()=>X,buildStellarPauseTx:()=>Ie,buildStellarProposeAddAssetToSpokeTx:()=>St,buildStellarProposeAddSpokeTx:()=>ct,buildStellarProposeApproveBlendPoolTx:()=>xt,buildStellarProposeApproveTokenTx:()=>ht,buildStellarProposeConfigureMarketOracleTx:()=>It,buildStellarProposeCreateHubTx:()=>dt,buildStellarProposeCreateLiquidityPoolTx:()=>At,buildStellarProposeDeployPoolTx:()=>wt,buildStellarProposeEditAssetInSpokeTx:()=>bt,buildStellarProposeEditOracleToleranceTx:()=>Ot,buildStellarProposeGovernanceUpgradeTx:()=>Mt,buildStellarProposeGrantGovernanceRoleTx:()=>Ct,buildStellarProposeMigrateControllerTx:()=>Rt,buildStellarProposeRemoveAssetFromSpokeTx:()=>gt,buildStellarProposeRemoveSpokeTx:()=>yt,buildStellarProposeRevokeBlendPoolTx:()=>qt,buildStellarProposeRevokeGovernanceRoleTx:()=>Ut,buildStellarProposeRevokeTokenTx:()=>vt,buildStellarProposeSetAccumulatorTx:()=>lt,buildStellarProposeSetAggregatorTx:()=>it,buildStellarProposeSetMinBorrowCollatTx:()=>ft,buildStellarProposeSetPoolTemplateTx:()=>st,buildStellarProposeSetPositionLimitsTx:()=>pt,buildStellarProposeSetPositionManagerTx:()=>mt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Tt,buildStellarProposeTransferCtrlOwnershipTx:()=>Et,buildStellarProposeTransferGovOwnTx:()=>Nt,buildStellarProposeUpdateDelayTx:()=>Lt,buildStellarProposeUpgradeControllerTx:()=>kt,buildStellarProposeUpgradePoolParamsTx:()=>_t,buildStellarProposeUpgradePoolTx:()=>Pt,buildStellarRenewAccountTx:()=>je,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>Z,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Le,buildStellarRevokeTokenTx:()=>We,buildStellarSetAccumulatorTx:()=>Ge,buildStellarSetAggregatorTx:()=>Ne,buildStellarSetLiquidityPoolTemplateTx:()=>Be,buildStellarSetMarketOracleConfigTx:()=>ze,buildStellarSetOracleToleranceTx:()=>He,buildStellarSetPositionLimitsTx:()=>$e,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>N,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>F,buildStellarTransferOwnershipTx:()=>Ce,buildStellarUnpauseTx:()=>Oe,buildStellarUpdateAccountThresholdTx:()=>Ke,buildStellarUpdateIndexesTx:()=>Ve,buildStellarUpgradeControllerTx:()=>Re,buildStellarUpgradeLiquidityPoolParamsTx:()=>Fe,buildStellarWithdrawBatchTx:()=>$,buildStellarWithdrawTx:()=>D,buildTx:()=>C,decodeStellarLendingEvent:()=>co,encodeInterestRateModel:()=>xe,encodeMarketOracleConfigInput:()=>ke,encodeMarketParamsRaw:()=>qe,encodeOracleSourceConfigInput:()=>Pe,encodePositionLimits:()=>Ae,encodeStrategyPayloadToRouteXdr:()=>qo,extractEventOrder:()=>go,getStellarAccountPositions:()=>Se,getStellarAggregatorQuote:()=>vo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>ie,getStellarAssetGraph:()=>ge,getStellarAssetMarkets:()=>se,getStellarAssetPage:()=>le,getStellarAssets:()=>te,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>be,getStellarHub:()=>pe,getStellarHubGraph:()=>Te,getStellarHubs:()=>oe,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarQuoteTokens:()=>xo,getStellarReserve:()=>ue,getStellarReserveGraph:()=>fe,getStellarReserveHolders:()=>ae,getStellarReserves:()=>ne,getStellarSpoke:()=>de,getStellarSpokeGraph:()=>me,getStellarSpokes:()=>re,getStellarUserActivity:()=>ye,getStellarUserPositions:()=>ce,mapQuoteResponseToAggregatorSwap:()=>ko,mapQuoteResponseToStrategyPayload:()=>wo,mapQuoteResponseToStrategySwap:()=>Po,mapSorobanError:()=>Go,mapStellarPositionActivityType:()=>mo,prepareStellarBuiltTx:()=>Oo,prepareStellarTxXdr:()=>Io,stellarLendingDispatchKey:()=>jt,stellarLendingRead:()=>he,syntheticEventOrder:()=>To,tagStellarInvokedContractError:()=>Eo,toBase64Xdr:()=>Ht,toStellarPositionMode:()=>Mo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),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(),m=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>k({asset: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)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:b(e.amountOut),pool: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 k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in: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)},I=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},M=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return 0===e.length?I():E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):0===e.bytes.length?I():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!y.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,o){const r=e.controllerAddress??s(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[S(e.caller),T(o),g(r),P([...t.assets])])}function N(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function G(e,t){return C(e,"borrow",[S(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,S)])}function B(e,t){return G(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function $(e,t){return C(e,"withdraw",[S(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,S)])}function D(e,t){return $(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[S(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[S(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[S(e.caller),_(t.hubId,t.asset),b(t.amount),S(t.receiver),L(t.data)])}function j(e,t){return C(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 X(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(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),M(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,M)])}function F(e,t){return C(e,"swap_debt",[S(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[S(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Z(e,t){return C(e,"repay_debt_with_collateral",[S(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const K="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),oe=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),ne=(e,t={},o)=>{const{hubId:r,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${K}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ue=(e,t,o,r,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}`,n),ae=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/holders`,{...u,params:{side:n}}),ie=(e,t,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,o),le=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...r,params:{...o}}),se=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...r,params:{side:o}}),pe=(e,t,o)=>e.fetchWithTimeout(`${K}/hubs/${t}`,o),de=(e,t,o)=>e.fetchWithTimeout(`${K}/spokes/${t}`,o),ce=(e,t,o)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,o),ye=(e,t,o={},r)=>{const{skip:n,top:u}=o;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},Se=(e,t,o)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,o),be=(e,t={},o)=>{const{top:r=J,continuationToken:n}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},ge=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...r,params:{...o}}),Te=(e,t,o,r)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...r,params:{...o}}),me=(e,t,o,r)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/graph`,{...u,params:{...n}}),he=e=>({context:t=>ee(e,t),assets:t=>te(e,t),hubs:t=>oe(e,t),spokes:t=>re(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ne(e,t,o):ne(e,{},t);var r},reserve:(t,o,r,n)=>ue(e,t,o,r,n),reserveHolders:(t,o,r,n,u)=>ae(e,t,o,r,n,u),asset:(t,o)=>ie(e,t,o),assetMarkets:(t,o,r)=>se(e,t,o,r),hub:(t,o)=>pe(e,t,o),spoke:(t,o)=>de(e,t,o),userPositions:(t,o)=>ce(e,t,o),userActivity:(t,o,r)=>ye(e,t,o,r),accountPositions:(t,o)=>Se(e,t,o),governanceProposals:(t,o)=>be(e,t,o),assetGraph:(t,o,r)=>ge(e,t,o,r),hubGraph:(t,o,r)=>Te(e,t,o,r),spokeGraph:(t,o,r)=>me(e,t,o,r),reserveGraph:(t,o,r,n,u)=>fe(e,t,o,r,n,u)}),ve={Single:0,PrimaryWithAnchor:1},xe=e=>k({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),qe=e=>k({asset_decimals:g(e.assetDecimals),asset_id:S(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),Ae=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),_e=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"),f(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},we=(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")])},Pe=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([h("Reflector"),k({asset:_e(e.asset),contract:S(e.contract),read_mode:we(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"),k({contract:S(e.contract),feed_id:f(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},ke=e=>{const t=ve[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return k({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),Pe(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Pe(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Re(e,t){return C(e,"upgrade",[q(t.wasmHash)])}function Ee(e,t){return C(e,"migrate",[g(t.newVersion)])}function Ie(e){return C(e,"pause",[])}function Oe(e){return C(e,"unpause",[])}function Me(e,t){return C(e,"grant_role",[S(t.account),h(t.role)])}function Le(e,t){return C(e,"revoke_role",[S(t.account),h(t.role)])}function Ce(e,t){return C(e,"transfer_ownership",[S(t.newOwner),g(t.liveUntilLedger)])}function Ue(e){return C(e,"accept_ownership",[])}function Ne(e,t){return C(e,"set_aggregator",[S(t.aggregator)])}function Ge(e,t){return C(e,"set_accumulator",[S(t.accumulator)])}function Be(e,t){return C(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function $e(e,t){return C(e,"set_position_limits",[Ae(t)])}function De(e,t){return C(e,"approve_token",[S(t.token)])}function We(e,t){return C(e,"revoke_token",[S(t.token)])}function ze(e,t){return C(e,"set_market_oracle_config",[_(t.hubId,t.asset),ke(t.config)])}function He(e,t){return C(e,"set_oracle_tolerance",[S(t.asset),k({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function Ve(e,t){return C(e,"update_indexes",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function je(e,t){return C(e,"renew_account",[S(e.caller),T(t.accountNonce)])}function Xe(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),S(t.asset),qe(t.params)])}function Fe(e,t){return C(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),xe(t.params)])}function Qe(e,t){return C(e,"claim_revenue",[S(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return C(e,"add_rewards",[S(e.caller),P(t.rewards)])}function Ke(e,t){return C(e,"update_account_threshold",[S(e.caller),m(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=>k({new_owner:S(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),ot=e=>k({asset:S(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:g(e.hubId),paused:m(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),rt=e=>k({account:S(e.account),role:h(e.role)});function nt(e,t,o){const r=e.governanceAddress??d(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ut=(e,t,o)=>nt(e,"propose",[S(e.caller),t,Ye(o)]),at=(e,t,o)=>nt(e,"execute_self",[v(),t,Ye(o)]);function it(e,t,o){return ut(e,et("SetAggregator",S(t.aggregator)),o)}function lt(e,t,o){return ut(e,et("SetAccumulator",S(t.accumulator)),o)}function st(e,t,o){return ut(e,et("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function pt(e,t,o){return ut(e,et("SetPositionLimits",Ae(t)),o)}function dt(e,t){return ut(e,et("CreateHub"),t)}function ct(e,t){return ut(e,et("AddSpoke"),t)}function yt(e,t,o){return ut(e,et("RemoveSpoke",g(t.spokeId)),o)}function St(e,t,o){return ut(e,et("AddAssetToSpoke",ot(t)),o)}function bt(e,t,o){return ut(e,et("EditAssetInSpoke",ot(t)),o)}function gt(e,t,o){return ut(e,et("RemoveAssetFromSpoke",k({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function Tt(e,t,o){return ut(e,et("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:b((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(r.liquidationBonusFactorBps),spoke_id:g(r.spokeId),target_hf_wad:b(r.targetHfWad)})),o);var r}function mt(e,t,o){return ut(e,et("SetPositionManager",S(t.manager),m(t.isActive)),o)}function ft(e,t,o){return ut(e,et("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function ht(e,t,o){return ut(e,et("ApproveToken",S(t.token)),o)}function vt(e,t,o){return ut(e,et("RevokeToken",S(t.token)),o)}function xt(e,t,o){return ut(e,et("ApproveBlendPool",S(t.pool)),o)}function qt(e,t,o){return ut(e,et("RevokeBlendPool",S(t.pool)),o)}function At(e,t,o){return ut(e,et("CreateLiquidityPool",k({asset:S((r=t).asset),hub_id:g(r.hubId),params:qe(r.params)})),o);var r}function _t(e,t,o){return ut(e,et("UpgradeLiquidityPoolParams",k({hub_asset:_((r=t).hubId,r.asset),params:xe(r.params)})),o);var r}function wt(e,t){return ut(e,et("DeployPool"),t)}function Pt(e,t,o){return ut(e,et("UpgradePool",q(t.wasmHash)),o)}function kt(e,t,o){return ut(e,et("UpgradeController",q(t.wasmHash)),o)}function Rt(e,t,o){return ut(e,et("MigrateController",g(t.newVersion)),o)}function Et(e,t,o){return ut(e,et("TransferCtrlOwnership",tt(t)),o)}function It(e,t,o){return ut(e,et("ConfigureMarketOracle",k({cfg:ke((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function Ot(e,t,o){return ut(e,et("EditOracleTolerance",k({asset:S((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Mt(e,t,o){return ut(e,et("UpgradeGov",q(t.wasmHash)),o)}function Lt(e,t,o){return ut(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Ct(e,t,o){return ut(e,et("GrantGovRole",rt(t)),o)}function Ut(e,t,o){return ut(e,et("RevokeGovRole",rt(t)),o)}function Nt(e,t,o){return ut(e,et("TransferGovOwnership",tt(t)),o)}function Gt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=Ye(t.predecessor??Je);return nt(e,"execute",[v(),S(t.target),h(t.functionName),o,r,Ye(t.salt)])}function Bt(e,t,o){return at(e,et("UpgradeGov",q(t.wasmHash)),o)}function $t(e,t,o){return at(e,et("UpdateGovDelay",g(t.newDelay)),o)}function Dt(e,t,o){return at(e,et("GrantGovRole",rt(t)),o)}function Wt(e,t,o){return at(e,et("RevokeGovRole",rt(t)),o)}function zt(e,t,o){return at(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"],no=e=>Array.isArray(e)?e:[],uo=(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},ao=e=>{return{owner:Qt(e[0]),spokeId:Ft(e[1]),mode:(t=e[2],Yt[Ft(t)]??"None")};var t},io=(e,t)=>{const o=oo[Ft(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],n=e[`${t}_symbol`],u=null!=r?{kind:"Stellar",value:Qt(r)}:null!=n?{kind:"Symbol",value:Qt(n)}:void 0;return{provider:to[Ft(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:Qt(e[`${t}_contract`]),asset:u,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:io(e,"primary"),anchor:t?io(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:no(e).map((e=>{return t=no(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:no(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=no(e);return{topic:"position:batch_update",data:{accountId:Xt(t[0]),accountAttributes:ao(no(t[1])),updates:[...no(t[2]).map((e=>uo(no(e),"Deposit"))),...no(t[3]).map((e=>uo(no(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 mo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const fo=(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??i[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=fo(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=fo(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=>R(e).toXDR("base64");function Ao(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",S(e.caller),b(e.totalIn),u)).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(Ro),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Ro),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 ko=wo,Ro=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 Io(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 Oo(e,t,o){return Io(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 new Uint8Array(0)}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()}}const No={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetsLimitReached",message:"This spoke has reached its asset limit."},314:{name:"SpokeCapBelowUsage",message:"The new cap is below current usage on this spoke asset."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Go(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=No[o];return r?{code:o,...r}:null}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>T.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>T.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>T.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>T.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>T.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>T.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>T.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>T.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>T.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>T.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>T.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>T.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,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,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,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,mapSorobanError:()=>T.mapSorobanError,mapStellarPositionActivityType:()=>T.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>T.prepareStellarBuiltTx,prepareStellarTxXdr:()=>T.prepareStellarTxXdr,stellarLendingDispatchKey:()=>T.stellarLendingDispatchKey,stellarLendingRead:()=>T.stellarLendingRead,syntheticEventOrder:()=>T.syntheticEventOrder,tagStellarInvokedContractError:()=>T.tagStellarInvokedContractError,toBase64Xdr:()=>T.toBase64Xdr,toStellarPositionMode:()=>T.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...o}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,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:m,...f}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||S?void 0:h??m,q="GET"!==d||S||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class 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(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...o,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!S(e))throw new y(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...m,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:T,params:q,body:b,headers:_,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,o]of Object.entries(b)){const r=t.split("/").filter(Boolean);let n=e;for(const e of r)if(e.startsWith(":")){const t=m(e.slice(1));n=n.params[t]||=f()}else{const t=m(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:o,def:n}=t.leaves[0];i=h(o,n,r,e)}else{i={};for(const{rawPath:o,def:n}of t.leaves)i[m(o.split("/").pop().replace(/^:/,""))]=h(o,n,r,e)}for(const[e,n]of Object.entries(t.static)){const t=o(n,r);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=o(n,{...r,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],o=(...e)=>t(...e);return Object.assign(o,t)}return u};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();