@xoxno/sdk-js 1.0.202 → 1.0.203

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.
@@ -211,3 +211,66 @@ export interface StellarMarketGraphQuery {
211
211
  /** Bin width as a timespan string (e.g. `1h`, `1d`). */
212
212
  bin: string;
213
213
  }
214
+ /**
215
+ * Config and admin state for one deployed contract, event-sourced by the
216
+ * indexer from that contract's own config, pause, ownership and admin events.
217
+ *
218
+ * Every field is optional-by-absence: a contract only populates what its own
219
+ * events carry, so a governance row leaves the controller fields null and vice
220
+ * versa. `paused` is null until a pause or unpause has actually been observed,
221
+ * which is materially different from a confirmed `false`.
222
+ */
223
+ export interface StellarContractConfig {
224
+ contractAddress: string;
225
+ wasmHash: string | null;
226
+ accumulator: string | null;
227
+ swapAggregator: string | null;
228
+ priceAggregator: string | null;
229
+ maxSupplyPositions: number | null;
230
+ maxBorrowPositions: number | null;
231
+ /** Raw 18-decimal WAD. */
232
+ minBorrowCollateralUsdWad: string | null;
233
+ paused: boolean | null;
234
+ /** Governance timelock delay, in ledgers. */
235
+ minDelayLedgers: number | null;
236
+ owner: string | null;
237
+ pendingOwner: string | null;
238
+ admin: string | null;
239
+ pendingAdmin: string | null;
240
+ pendingAdminLiveUntilLedger: number | null;
241
+ ledger: number;
242
+ updatedAt: number;
243
+ }
244
+ /**
245
+ * One access-control grant. Revocation flips `granted` rather than removing the
246
+ * row, so a revoked grant stays queryable.
247
+ */
248
+ export interface StellarContractRole {
249
+ contractAddress: string;
250
+ /** On-chain role symbol, e.g. `ORACLE`, `PROPOSER`. */
251
+ role: string;
252
+ account: string;
253
+ granted: boolean;
254
+ caller: string | null;
255
+ ledger: number;
256
+ updatedAt: number;
257
+ }
258
+ /**
259
+ * One position-authorization grant. A delegate may act on the owner's position,
260
+ * so this is security-relevant state rather than display metadata.
261
+ */
262
+ export interface StellarAccountDelegate {
263
+ accountId: number;
264
+ owner: string;
265
+ delegate: string;
266
+ granted: boolean;
267
+ ledger: number;
268
+ updatedAt: number;
269
+ }
270
+ /** Approval state for one Blend pool, kept after revocation as `approved: false`. */
271
+ export interface StellarBlendPool {
272
+ pool: string;
273
+ approved: boolean;
274
+ ledger: number;
275
+ updatedAt: number;
276
+ }
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import type { StellarAssetListItem, StellarAssetPage, StellarHubListItem, StellarLendingLiveStateDto, StellarReserveListItem, StellarSpokeListItem, StellarUserActivityItem } from '@xoxno/types/stellar-lending';
15
15
  import type { OurRequestInit, XOXNOClient } from '../../utils/api';
16
- import type { StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingContext, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
16
+ import type { StellarAccountDelegate, StellarAccountPositions, StellarAsset, StellarAssetMarket, StellarBlendPool, StellarContractConfig, StellarContractRole, StellarGovernanceProposalsPage, StellarHub, StellarLendingHoldersSide, StellarLendingContext, StellarLendingMarketSide, StellarMarketGraph, StellarMarketGraphQuery, StellarReserve, StellarSpoke, StellarTopHolders } from './lending-read-types';
17
17
  type StellarReservesParams = {
18
18
  hubId?: number;
19
19
  spokeId?: number;
@@ -82,9 +82,34 @@ export declare const getStellarReserveGraph: (client: XOXNOClient, spokeId: numb
82
82
  * sites read `read.reserve(spokeId, hubId, asset)` instead of threading the
83
83
  * client through every call.
84
84
  */
85
+ /**
86
+ * Config and admin state for every watched contract, or for one address.
87
+ *
88
+ * Event-sourced by the indexer rather than read live from the chain, so this is
89
+ * also where `minBorrowCollateralUsdWad`, position limits and the aggregator
90
+ * addresses come from — `liveState` no longer needs an RPC round-trip for them.
91
+ */
92
+ export declare const getStellarProtocolConfig: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarContractConfig[]>;
93
+ /** Config and admin state for a single contract address. */
94
+ export declare const getStellarContractConfig: (client: XOXNOClient, contractAddress: string, init?: OurRequestInit) => Promise<StellarContractConfig>;
95
+ /**
96
+ * Access-control grants, optionally narrowed to one contract. Revoked grants
97
+ * are included with `granted: false` — filter client-side when only current
98
+ * holders matter.
99
+ */
100
+ export declare const getStellarContractRoles: (client: XOXNOClient, contractAddress?: string, init?: OurRequestInit) => Promise<StellarContractRole[]>;
101
+ /** Position-authorization grants for one account, including revoked ones. */
102
+ export declare const getStellarAccountDelegates: (client: XOXNOClient, accountId: number, init?: OurRequestInit) => Promise<StellarAccountDelegate[]>;
103
+ /** Blend pool approval state, including pools whose approval was revoked. */
104
+ export declare const getStellarBlendPools: (client: XOXNOClient, init?: OurRequestInit) => Promise<StellarBlendPool[]>;
85
105
  export declare const stellarLendingRead: (client: XOXNOClient) => {
86
106
  context: (init?: OurRequestInit) => Promise<StellarLendingContext>;
87
107
  liveState: (init?: OurRequestInit) => Promise<StellarLendingLiveStateDto>;
108
+ protocolConfig: (init?: OurRequestInit) => Promise<StellarContractConfig[]>;
109
+ contractConfig: (contractAddress: string, init?: OurRequestInit) => Promise<StellarContractConfig>;
110
+ contractRoles: (contractAddress?: string, init?: OurRequestInit) => Promise<StellarContractRole[]>;
111
+ accountDelegates: (accountId: number, init?: OurRequestInit) => Promise<StellarAccountDelegate[]>;
112
+ blendPools: (init?: OurRequestInit) => Promise<StellarBlendPool[]>;
88
113
  assets: (init?: OurRequestInit) => Promise<StellarAssetListItem[]>;
89
114
  hubs: (init?: OurRequestInit) => Promise<StellarHubListItem[]>;
90
115
  spokes: (init?: OurRequestInit) => Promise<StellarSpokeListItem[]>;
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,r){r.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>St,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>Mr,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Nr,XOXNO_LENDING_STELLAR_TICKER:()=>Cr,buildSameTokenRepaySwapSteps:()=>ro,buildStellarAcceptOwnershipTx:()=>Fe,buildStellarAddRewardsTx:()=>dt,buildStellarApproveBlendPoolTx:()=>Ze,buildStellarApproveTokenTx:()=>Ye,buildStellarBatchSwapTx:()=>Vr,buildStellarBorrowBatchTx:()=>$,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>no,buildStellarClaimRevenueTx:()=>pt,buildStellarCreateLiquidityPoolTx:()=>lt,buildStellarExecuteCancellerResetTx:()=>sr,buildStellarExecuteStrategyTx:()=>jr,buildStellarFlashLoanTx:()=>X,buildStellarGovernanceAddSpokeImmediateTx:()=>Sr,buildStellarGovernanceCreateHubImmediateTx:()=>cr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>rr,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>nr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>ur,buildStellarGovernanceExecuteTransferGovOwnTx:()=>ar,buildStellarGovernanceExecuteTx:()=>tr,buildStellarGovernanceExecuteUpdateDelayTx:()=>or,buildStellarGovernancePauseTx:()=>gr,buildStellarGovernanceRevokeRoleImmediateTx:()=>br,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>dr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>pr,buildStellarGrantRoleTx:()=>We,buildStellarLendingIdentifier:()=>Br,buildStellarLiquidateTx:()=>V,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>Ge,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>De,buildStellarProposeAddAssetToSpokeTx:()=>Et,buildStellarProposeAddSpokeTx:()=>kt,buildStellarProposeApproveBlendPoolTx:()=>Ut,buildStellarProposeApproveTokenTx:()=>Nt,buildStellarProposeCancellerResetTx:()=>lr,buildStellarProposeConfigureAssetOracleTx:()=>Vt,buildStellarProposeConfigureMarketOracleTx:()=>Xt,buildStellarProposeCreateHubTx:()=>Pt,buildStellarProposeCreateLiquidityPoolTx:()=>Dt,buildStellarProposeDeployPoolTx:()=>Wt,buildStellarProposeEditAssetInSpokeTx:()=>It,buildStellarProposeEditOracleToleranceTx:()=>Qt,buildStellarProposeGovernanceUpgradeTx:()=>Kt,buildStellarProposeGrantGovernanceRoleTx:()=>Jt,buildStellarProposeMigrateControllerTx:()=>Ft,buildStellarProposeRemoveAssetFromSpokeTx:()=>Ot,buildStellarProposeRemoveSpokeTx:()=>Rt,buildStellarProposeRevokeBlendPoolTx:()=>Gt,buildStellarProposeRevokeGovernanceRoleTx:()=>Yt,buildStellarProposeRevokeTokenTx:()=>Bt,buildStellarProposeSetAccumulatorTx:()=>qt,buildStellarProposeSetAggregatorTx:()=>At,buildStellarProposeSetMinBorrowCollatTx:()=>Ct,buildStellarProposeSetPositionLimitsTx:()=>_t,buildStellarProposeSetPositionManagerTx:()=>Lt,buildStellarProposeSetPriceAggregatorTx:()=>wt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Mt,buildStellarProposeSetSwapAggregatorTx:()=>xt,buildStellarProposeTransferCtrlOwnershipTx:()=>jt,buildStellarProposeTransferGovOwnTx:()=>er,buildStellarProposeUnpauseTx:()=>yr,buildStellarProposeUpdateDelayTx:()=>Zt,buildStellarProposeUpgradeControllerTx:()=>Ht,buildStellarProposeUpgradePoolParamsTx:()=>$t,buildStellarProposeUpgradePoolTx:()=>zt,buildStellarRenewAccountTx:()=>it,buildStellarRepayBatchTx:()=>F,buildStellarRepayDebtWithCollateralTx:()=>Y,buildStellarRepayTx:()=>j,buildStellarRevokeBlendPoolTx:()=>Je,buildStellarRevokeRoleTx:()=>ze,buildStellarRevokeTokenTx:()=>et,buildStellarSetAccumulatorTx:()=>Qe,buildStellarSetAggregatorTx:()=>Xe,buildStellarSetMarketOracleConfigTx:()=>rt,buildStellarSetOracleSanityBoundsTx:()=>ut,buildStellarSetOracleToleranceTx:()=>ot,buildStellarSetOracleTx:()=>tt,buildStellarSetPositionLimitsTx:()=>Ke,buildStellarSetPriceAggregatorTx:()=>Ve,buildStellarSetSpokeAssetFlagsTx:()=>nt,buildStellarSetSwapAggregatorTx:()=>je,buildStellarSupplyBatchTx:()=>G,buildStellarSupplyTx:()=>D,buildStellarSwapCollateralTx:()=>J,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>He,buildStellarUnpauseTx:()=>$e,buildStellarUpdateAccountThresholdTx:()=>ct,buildStellarUpdateIndexesTx:()=>at,buildStellarUpgradeControllerTx:()=>Ue,buildStellarUpgradeLiquidityPoolParamsTx:()=>st,buildStellarWithdrawBatchTx:()=>z,buildStellarWithdrawTx:()=>H,buildTx:()=>U,decodeStellarLendingEvent:()=>Lr,encodeAssetOracle:()=>Ne,encodeInterestRateModel:()=>qe,encodeMarketOracleConfigInput:()=>Be,encodeMarketParamsRaw:()=>_e,encodePositionLimits:()=>Pe,encodePriceKey:()=>ke,encodeStrategyPayloadToRouteXdr:()=>Fr,extractEventOrder:()=>Ur,getStellarAccountPositions:()=>he,getStellarAggregatorQuote:()=>zr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>de,getStellarAssetGraph:()=>fe,getStellarAssetMarkets:()=>Se,getStellarAssetPage:()=>ce,getStellarAssets:()=>ue,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>Te,getStellarHub:()=>be,getStellarHubGraph:()=>ve,getStellarHubs:()=>ae,getStellarLendingContext:()=>oe,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>ne,getStellarQuoteTokens:()=>Hr,getStellarReserve:()=>se,getStellarReserveGraph:()=>we,getStellarReserveHolders:()=>pe,getStellarReserves:()=>le,getStellarSpoke:()=>ge,getStellarSpokeGraph:()=>xe,getStellarSpokes:()=>ie,getStellarUserActivity:()=>me,getStellarUserPositions:()=>ye,mapQuoteResponseToAggregatorSwap:()=>Kr,mapQuoteResponseToStrategyPayload:()=>Xr,mapQuoteResponseToStrategySwap:()=>Qr,mapSorobanError:()=>ao,mapStellarPositionActivityType:()=>Dr,prepareStellarBuiltTx:()=>eo,prepareStellarTxXdr:()=>Yr,stellarLendingDispatchKey:()=>Tr,stellarLendingRead:()=>Ae,syntheticEventOrder:()=>Gr,tagStellarInvokedContractError:()=>Jr,toBase64Xdr:()=>mr,toStellarPositionMode:()=>to});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},g=1e6,y=e=>new c.Address(e).toScVal(),m=e=>new c.ScInt(e).toI128(),h=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),f=e=>c.xdr.ScVal.scvBool(e),v=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),w=()=>c.xdr.ScVal.scvVoid(),A=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(o)},_=(e,t)=>null==e?w():t(e),P=(e,t)=>E({asset:y(t),hub_id:h(e)}),k=(e,t,r)=>c.xdr.ScVal.scvVec([P(e,t),m(r)]),R=e=>c.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),E=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:x(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)};class I{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>g)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(b[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const u=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(u>g)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const a=u===g;let i=g;n.forEach(((e,o)=>{r[e]=!0;const u=t[e];let l;if(o+1===n.length&&a)l=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(u.splitPpm*g/i);i-=Math.min(u.splitPpm,i),l=128+this.weight(e)}this.emitPath(u,l)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return Buffer.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const O=e=>{const t=new I(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=o,[a,i]=e.preSwapFromA?[n,u]:[u,n];t.emit(b.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(i))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return E({amounts:c.xdr.ScVal.scvVec(t.amountList.map((e=>m(e)))),assets:c.xdr.ScVal.scvVec(t.assetList.map((e=>y(e)))),ops:c.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},M=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)},L=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),C=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},N=e=>{if("string"==typeof e)return M(C(e));if(e instanceof Uint8Array)return 0===e.length?L():M(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?M(C(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?M(C(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?M(C(e.bytes)):0===e.bytes.length?L():M(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");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>g)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==g)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(O(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},B=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function U(e,t,r){const o=e.controllerAddress??s(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function G(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"supply",[y(e.caller),T(r),h(o),R([...t.assets])])}function D(e,t){return G(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function $(e,t){return U(e,"borrow",[y(e.caller),T(t.accountNonce),R([...t.borrows]),_(t.to,y)])}function W(e,t){return $(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function z(e,t){return U(e,"withdraw",[y(e.caller),T(t.accountNonce),R([...t.withdrawals]),_(t.to,y)])}function H(e,t){return z(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"repay",[y(e.caller),T(t.accountNonce),R([...t.payments])])}function j(e,t){return F(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return U(e,"liquidate",[y(e.caller),T(t.accountNonce),R([...t.debtPayments])])}function X(e,t){return U(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),B(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[y(e.caller),T(t.accountId),h(t.spokeId),h(t.hubId),y(t.blendPool),A(t.collateralTokens.map(y)),A(t.supplyTokens.map(y)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,c.xdr.ScVal.scvVec([y(t),m(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"multiply",[y(e.caller),T(r),h(o),P(t.collateral.hubId,t.collateral.asset),m(t.debtToFlashLoan),P(t.debt.hubId,t.debt.asset),h(t.mode),N(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,N)])}function Z(e,t){return U(e,"swap_debt",[y(e.caller),T(t.accountNonce),P(t.existingDebt.hubId,t.existingDebt.asset),m(t.newDebtAmount),P(t.newDebt.hubId,t.newDebt.asset),N(t.steps)])}function J(e,t){return U(e,"swap_collateral",[y(e.caller),T(t.accountNonce),P(t.current.hubId,t.current.asset),m(t.fromAmount),P(t.newCollateral.hubId,t.newCollateral.asset),N(t.steps)])}function Y(e,t){return U(e,"repay_debt_with_collateral",[y(e.caller),T(t.accountNonce),P(t.collateral.hubId,t.collateral.asset),m(t.collateralAmount),P(t.debt.hubId,t.debt.asset),N(t.steps),f(t.closePosition)])}const ee="/stellar-lending",te=25,re=encodeURIComponent,oe=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),ie=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),le=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},se=(e,t,r,o,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}`,n),pe=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/holders`,{...u,params:{side:n}}),de=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}`,r),ce=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/page`,{...o,params:{...r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/markets`,{...o,params:{side:r}}),be=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),ge=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${re(t)}/positions`,r),me=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${ee}/users/${re(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},he=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(t)}/positions`,r),Te=(e,t={},r)=>{const{top:o=te,continuationToken:n}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},fe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),we=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/graph`,{...u,params:{...n}}),Ae=e=>({context:t=>oe(e,t),liveState:t=>ne(e,t),assets:t=>ue(e,t),hubs:t=>ae(e,t),spokes:t=>ie(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?le(e,t,r):le(e,{},t);var o},reserve:(t,r,o,n)=>se(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>pe(e,t,r,o,n,u),asset:(t,r)=>de(e,t,r),assetMarkets:(t,r,o)=>Se(e,t,r,o),hub:(t,r)=>be(e,t,r),spoke:(t,r)=>ge(e,t,r),userPositions:(t,r)=>ye(e,t,r),userActivity:(t,r,o)=>me(e,t,r,o),accountPositions:(t,r)=>he(e,t,r),governanceProposals:(t,r)=>Te(e,t,r),assetGraph:(t,r,o)=>fe(e,t,r,o),hubGraph:(t,r,o)=>ve(e,t,r,o),spokeGraph:(t,r,o)=>xe(e,t,r,o),reserveGraph:(t,r,o,n,u)=>we(e,t,r,o,n,u)}),qe=e=>E({base_borrow_rate:m(e.baseBorrowRateRay),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),_e=e=>E({asset_decimals:h(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:m(e.baseBorrowRateRay),flashloan_fee:h(e.flashloanFeeBps),is_flashloanable:f(e.isFlashloanable),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:h(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Pe=e=>E({max_borrow_positions:h(e.maxBorrowPositions),max_supply_positions:h(e.maxSupplyPositions)}),ke=e=>{if("Token"in e&&e.Token)return A([x("Token"),y(e.Token)]);if("Ref"in e&&e.Ref)return A([x("Ref"),x(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Re=e=>{if("Stellar"in e)return A([x("Stellar"),y(e.Stellar)]);if("Symbol"in e)return A([x("Symbol"),x(e.Symbol)]);if("String"in e)return A([x("String"),v(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ee=e=>{if("Spot"===e)return A([x("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return A([x("Twap"),h(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Ie=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Oe=e=>{if("Market"===e||"Fundamental"===e)return A([x(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Me=e=>{if("Reflector"in e){const t=e.Reflector;return A([x("Reflector"),E({asset:Re(t.asset),contract:y(t.contract),read_mode:Ee(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return A([x("MultiFeed"),E({contract:y(t.contract),feed_id:v(t.feedId),kind:Ie(t.kind),nature:Oe(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},Le=e=>{const t=e;return E({decimals:h(t.decimals),max_stale_seconds:T(t.maxStaleSeconds),provider:Me(t.provider)})},Ce=e=>{if("RequireDisjoint"===e)return A([x("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return A([x("AllowShared"),A(t.map((e=>E({contract:y(e.contract),kind:Ie(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},Ne=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return E({asset_decimals:h(Number(t.assetDecimals)),independence:Ce(t.independence),max_price_stale_seconds:T(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:m(String(t.maxSanityPriceWad)),min_sanity_price_wad:m(String(t.minSanityPriceWad)),sources:A(r.map((e=>(e=>{if("Feed"in e)return A([x("Feed"),Le(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return A([x("Scaled"),E({factor:Le(t.factor),max_factor_wad:m(t.maxFactorWad),min_factor_wad:m(t.minFactorWad),quote:ke(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return A([x("LpShare"),E({key_a:ke(t.keyA),key_b:ke(t.keyB),kind:A([x(t.kind||"ConstantProduct")]),pool:y(t.pool),reserve_a_decimals:h(t.reserveADecimals),reserve_b_decimals:h(t.reserveBDecimals),share_decimals:h(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})})},Be=Ne;function Ue(e,t){return U(e,"upgrade",[q(t.wasmHash)])}function Ge(e,t){return U(e,"migrate",[h(t.newVersion)])}function De(e){return U(e,"pause",[])}function $e(e){return U(e,"unpause",[])}function We(e,t){return U(e,"grant_role",[y(t.account),x(t.role)])}function ze(e,t){return U(e,"revoke_role",[y(t.account),x(t.role)])}function He(e,t){return U(e,"transfer_ownership",[y(t.newOwner),h(t.liveUntilLedger)])}function Fe(e){return U(e,"accept_ownership",[])}function je(e,t){return U(e,"set_swap_aggregator",[y(t.aggregator)])}function Ve(e,t){return U(e,"set_price_aggregator",[y(t.aggregator)])}const Xe=je;function Qe(e,t){return U(e,"set_accumulator",[y(t.accumulator)])}function Ke(e,t){return U(e,"set_position_limits",[Pe(t)])}function Ze(e,t){return U(e,"approve_blend_pool",[y(t.pool)])}function Je(e,t){return U(e,"revoke_blend_pool",[y(t.pool)])}const Ye=Ze,et=Je;function tt(e,t){return U(e,"set_oracle",[ke(t.key),Ne(t.oracle)])}const rt=tt;function ot(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[ke(t.key),E({lower_ratio_bps:h(n),upper_ratio_bps:h(o)})])}function nt(e,t){return U(e,"set_spoke_asset_flags",[h(t.spokeId),P(t.hubId,t.asset),f(t.paused),f(t.frozen)])}function ut(e,t){return U(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function at(e,t){return U(e,"update_indexes",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function it(e,t){return U(e,"renew_account",[y(e.caller),T(t.accountNonce)])}function lt(e,t){return U(e,"create_liquidity_pool",[h(t.hubId),y(t.asset),_e(t.params)])}function st(e,t){return U(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),qe(t.params)])}function pt(e,t){return U(e,"claim_revenue",[y(e.caller),A(t.assets.map((e=>P(e.hubId,e.asset))))])}function dt(e,t){return U(e,"add_rewards",[y(e.caller),R(t.rewards)])}function ct(e,t){return U(e,"update_account_threshold",[y(e.caller),f(t.hasRisks),A(t.accountNonces.map((e=>T(e))))])}const St="00".repeat(32),bt=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)},gt=(e,...t)=>A([x(e),...t]),yt=e=>E({new_owner:y(e.newOwner),live_until_ledger:h(e.liveUntilLedger)}),mt=e=>E({asset:y(e.asset),bonus:h(e.bonus),borrow_cap:m(e.borrowCap),can_borrow:f(e.canBorrow),can_collateral:f(e.canCollateral),frozen:f(e.frozen),hub_id:h(e.hubId),paused:f(e.paused),liquidation_fees:h(e.liquidationFees),ltv:h(e.ltv),oracle_override:A([x("None")]),spoke_id:h(e.spokeId),supply_cap:m(e.supplyCap),threshold:h(e.threshold)}),ht=e=>E({account:y(e.account),role:x(e.role)});function Tt(e,t,r){const o=e.governanceAddress??d(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const ft=(e,t,r)=>Tt(e,"propose",[y(e.caller),t,bt(r)]),vt=(e,t,r)=>Tt(e,"execute_self",[w(),t,bt(r)]);function xt(e,t,r){return ft(e,gt("SetSwapAggregator",y(t.aggregator)),r)}function wt(e,t,r){return ft(e,gt("SetPriceAggregator",y(t.aggregator)),r)}const At=xt;function qt(e,t,r){return ft(e,gt("SetAccumulator",y(t.accumulator)),r)}function _t(e,t,r){return ft(e,gt("SetPositionLimits",Pe(t)),r)}function Pt(e,t){return ft(e,gt("CreateHub"),t)}function kt(e,t){return ft(e,gt("AddSpoke"),t)}function Rt(e,t,r){return ft(e,gt("RemoveSpoke",h(t.spokeId)),r)}function Et(e,t,r){return ft(e,gt("AddAssetToSpoke",mt(t)),r)}function It(e,t,r){return ft(e,gt("EditAssetInSpoke",mt(t)),r)}function Ot(e,t,r){return ft(e,gt("RemoveAssetFromSpoke",E({hub_asset:P((o=t).hubId,o.asset),spoke_id:h(o.spokeId)})),r);var o}function Mt(e,t,r){return ft(e,gt("SetSpokeLiquidationCurve",E({hf_for_max_bonus_wad:m((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:h(o.liquidationBonusFactorBps),spoke_id:h(o.spokeId),target_hf_wad:m(o.targetHfWad)})),r);var o}function Lt(e,t,r){return ft(e,gt("SetPositionManager",y(t.manager),f(t.isActive)),r)}function Ct(e,t,r){return ft(e,gt("SetMinBorrowCollateralUsd",m(t.floorWad)),r)}function Nt(e,t,r){return ft(e,gt("ApproveToken",y(t.token)),r)}function Bt(e,t,r){return ft(e,gt("RevokeToken",y(t.token)),r)}function Ut(e,t,r){return ft(e,gt("ApproveBlendPool",y(t.pool)),r)}function Gt(e,t,r){return ft(e,gt("RevokeBlendPool",y(t.pool)),r)}function Dt(e,t,r){return ft(e,gt("CreateLiquidityPool",E({asset:y((o=t).asset),hub_id:h(o.hubId),params:_e(o.params)})),r);var o}function $t(e,t,r){return ft(e,gt("UpgradeLiquidityPoolParams",E({hub_asset:P((o=t).hubId,o.asset),params:qe(o.params)})),r);var o}function Wt(e,t,r){return ft(e,gt("DeployPool",q(t.wasmHash)),r)}function zt(e,t,r){return ft(e,gt("UpgradePool",q(t.wasmHash)),r)}function Ht(e,t,r){return ft(e,gt("UpgradeController",q(t.wasmHash)),r)}function Ft(e,t,r){return ft(e,gt("MigrateController",h(t.newVersion)),r)}function jt(e,t,r){return ft(e,gt("TransferCtrlOwnership",yt(t)),r)}function Vt(e,t,r){return ft(e,gt("ConfigureAssetOracle",E({key:ke((o=t).key),oracle:Ne(o.oracle)})),r);var o}const Xt=Vt;function Qt(e,t,r){return ft(e,gt("EditOracleTolerance",E({key:ke((o=t).key),tolerance:h(o.tolerance)})),r);var o}function Kt(e,t,r){return ft(e,gt("UpgradeGov",q(t.wasmHash)),r)}function Zt(e,t,r){return ft(e,gt("UpdateGovDelay",h(t.newDelay)),r)}function Jt(e,t,r){return ft(e,gt("GrantGovRole",ht(t)),r)}function Yt(e,t,r){return ft(e,gt("RevokeGovRole",ht(t)),r)}function er(e,t,r){return ft(e,gt("TransferGovOwnership",yt(t)),r)}function tr(e,t){const r=A(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=bt(t.predecessor??St);return Tt(e,"execute",[w(),y(t.target),x(t.functionName),r,o,bt(t.salt)])}function rr(e,t,r){return vt(e,gt("UpgradeGov",q(t.wasmHash)),r)}function or(e,t,r){return vt(e,gt("UpdateGovDelay",h(t.newDelay)),r)}function nr(e,t,r){return vt(e,gt("GrantGovRole",ht(t)),r)}function ur(e,t,r){return vt(e,gt("RevokeGovRole",ht(t)),r)}function ar(e,t,r){return vt(e,gt("TransferGovOwnership",yt(t)),r)}const ir=e=>A(e.map(y));function lr(e,t,r){return Tt(e,"propose_canceller_reset",[ir(t.newCancellers),bt(r)])}function sr(e,t,r){return Tt(e,"execute_canceller_reset",[_(t.executor,y),ir(t.newCancellers),bt(r)])}function pr(e,t){return Tt(e,"set_spoke_asset_flags",[y(e.caller),h(t.spokeId),P(t.hubId,t.asset),f(t.paused),f(t.frozen)])}function dr(e,t){return Tt(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function cr(e){return Tt(e,"create_hub",[y(e.caller)])}function Sr(e){return Tt(e,"add_spoke",[y(e.caller)])}function br(e,t){return Tt(e,"revoke_role_immediate",[y(t.account),x(t.role)])}function gr(e){return Tt(e,"pause",[y(e.caller)])}function yr(e,t){return ft(e,gt("Unpause"),t)}const mr=e=>e.toXDR("base64"),hr=e=>c.xdr.ScVal.fromXDR(e,"base64"),Tr=e=>e.map((e=>String((0,c.scValToNative)(hr(e))))).join(":"),fr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),vr=e=>Number(e),xr=e=>String(e),wr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Ar=["None","Multiply","Long","Short"],qr=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],_r=e=>Array.isArray(e)?e:[],Pr=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],qr[vr(o)]??fr(o)),positionType:t,hubId:vr(e[1]),asset:xr(e[2]),scaledAmountRay:fr(e[3]),indexRay:fr(e[4]),amount:fr(e[5]),liquidationThresholdBps:r?void 0:vr(e[6]),liquidationBonusBps:r?void 0:vr(e[7]),loanToValueBps:r?void 0:vr(e[8]),liquidationFeesBps:r?void 0:vr(e[9])};var o},kr=e=>{return{owner:xr(e[0]),spokeId:vr(e[1]),mode:(t=e[2],Ar[vr(t)]??"None")};var t},Rr=e=>Array.isArray(e)?e[1]:void 0,Er=e=>{const t=(r=e,Array.isArray(r)?xr(r[0]):xr(r));var r;if("Token"===t)return{Token:xr(Rr(e))};if("Ref"===t)return{Ref:xr(Rr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:xr(t.Token)};if(void 0!==t.Ref)return{Ref:xr(t.Ref)}}return{Token:xr(e)}},Ir=e=>{const t=e.tolerance??{};return{assetDecimals:vr(e.asset_decimals),maxPriceStaleSeconds:vr(e.max_price_stale_seconds),sources:_r(e.sources).map((e=>e)),tolerance:{upperRatio:vr(t.upper_ratio_bps),lowerRatio:vr(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:fr(e.min_sanity_price_wad),maxSanityPriceWad:fr(e.max_sanity_price_wad)}},Or={"market:create":e=>({topic:"market:create",data:{hubId:vr(e.hub_id),baseAsset:xr(e.base_asset),maxBorrowRate:fr(e.max_borrow_rate),baseBorrowRate:fr(e.base_borrow_rate),slope1:fr(e.slope1),slope2:fr(e.slope2),slope3:fr(e.slope3),midUtilization:fr(e.mid_utilization),optimalUtilization:fr(e.optimal_utilization),maxUtilization:fr(e.max_utilization),reserveFactor:vr(e.reserve_factor),marketAddress:xr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:xr(e.asset),maxBorrowRateRay:fr(e.max_borrow_rate),baseBorrowRateRay:fr(e.base_borrow_rate),slope1Ray:fr(e.slope1),slope2Ray:fr(e.slope2),slope3Ray:fr(e.slope3),midUtilizationRay:fr(e.mid_utilization),optimalUtilizationRay:fr(e.optimal_utilization),maxUtilizationRay:fr(e.max_utilization),reserveFactorBps:vr(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:_r(e).map((e=>{return t=_r(e),{hubId:vr(t[0]),asset:xr(t[1]),timestamp:vr(t[2]),supplyIndexRay:fr(t[3]),borrowIndexRay:fr(t[4]),cash:fr(t[5]),suppliedRay:fr(t[6]),borrowedRay:fr(t[7]),revenueRay:fr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:_r(e).map((e=>{const t=e;return{hubId:vr(t.hub_id),asset:xr(t.asset),params:(r=t.params,{maxBorrowRateRay:fr(r.max_borrow_rate),baseBorrowRateRay:fr(r.base_borrow_rate),slope1Ray:fr(r.slope1),slope2Ray:fr(r.slope2),slope3Ray:fr(r.slope3),midUtilizationRay:fr(r.mid_utilization),optimalUtilizationRay:fr(r.optimal_utilization),maxUtilizationRay:fr(r.max_utilization),reserveFactorBps:vr(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:vr(r.flashloan_fee),assetId:xr(r.asset_id),assetDecimals:vr(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=_r(e);return{topic:"position:batch_update",data:{accountId:fr(t[0]),accountAttributes:kr(_r(t[1])),updates:[..._r(t[2]).map((e=>Pr(_r(e),"Deposit"))),..._r(t[3]).map((e=>Pr(_r(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:vr(e.hub_id),asset:xr(e.asset),receiver:xr(e.receiver),caller:xr(e.caller),amount:fr(e.amount),fee:fr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Er(e.key),oracle:Ir(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:xr(e.asset),oracle:Ir(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:xr(e.liquidator),accountId:fr(e.account_id),repaidUsdWad:fr(e.repaid_usd_wad),bonusBps:fr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:fr(e.account_id),totalBorrowUsdWad:fr(e.total_borrow_usd_wad),totalCollateralUsdWad:fr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:xr(e.token),amount:fr(e.amount),usdValueWad:fr(e.usd_value_wad),accountId:fr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:vr(e.hub_id),asset:xr(e.asset),amount:fr(e.amount),fee:fr(e.fee),amountSent:fr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:xr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:wr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:xr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:xr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:xr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:xr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:wr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:vr(e.max_supply_positions),maxBorrowPositions:vr(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:fr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:xr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:vr(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:fr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:fr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:vr(t.liquidation_bonus_factor_bps)}}}},Mr=Object.freeze(Object.keys(Or));function Lr(e,t){const r=Tr(e),o=Or[r];return o?o((0,c.scValToNative)(hr(t))):null}const Cr="XLENDXLM-a7c9f3",Nr=1e4;function Br(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${Cr}-${r}`}function Ur(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Gr(e,t=0){return e*Nr+t}function Dr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const $r=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Wr=e=>e.baseUrl??i[e.network];async function zr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=$r(Wr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function Hr(e){const t=$r(Wr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Fr=e=>O(e).toXDR("base64");function jr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=N(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",y(e.caller),m(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Vr(e,t){return jr(e,t)}function Xr(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(Zr),splitPpm:e.splitPpm}))):[{hops:e.hops.map(Zr),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Qr(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Xr(e,t)}const Kr=Xr,Zr=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Jr(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function Yr(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw Jr(r.invokedContractId,e);throw e}}async function eo(e,t,r){return Yr(e,t.xdr,r)}function to(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 ro(e,t){return new Uint8Array(0)}const oo=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 no(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(oo(e.message)),c.xdr.ScVal.scvBytes(oo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const uo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function ao(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=uo[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>m.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>m.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>m.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>m.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>m.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>m.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>m.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>m.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>m.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>m.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>m.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>m.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>m.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>m.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>m.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>m.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>m.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>m.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>m.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>m.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>m.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>m.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>m.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>m.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>m.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>m.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>m.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>m.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>m.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>m.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>m.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>m.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>m.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>m.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>m.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>m.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>m.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>m.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>m.buildStellarMigrateTx,buildStellarMultiplyTx:()=>m.buildStellarMultiplyTx,buildStellarPauseTx:()=>m.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>m.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>m.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>m.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>m.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>m.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>m.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>m.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>m.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>m.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>m.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>m.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>m.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>m.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>m.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>m.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>m.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>m.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>m.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>m.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>m.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>m.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>m.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>m.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>m.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>m.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>m.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>m.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>m.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>m.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>m.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>m.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>m.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>m.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>m.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>m.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>m.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>m.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>m.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>m.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>m.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>m.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>m.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>m.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>m.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>m.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>m.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>m.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>m.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>m.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>m.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>m.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>m.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>m.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>m.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>m.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>m.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>m.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>m.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>m.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>m.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>m.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>m.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>m.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>m.buildStellarWithdrawTx,buildTx:()=>m.buildTx,decodeStellarLendingEvent:()=>m.decodeStellarLendingEvent,encodeAssetOracle:()=>m.encodeAssetOracle,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodePositionLimits:()=>m.encodePositionLimits,encodePriceKey:()=>m.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>m.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>m.extractEventOrder,getStellarAccountPositions:()=>m.getStellarAccountPositions,getStellarAggregatorQuote:()=>m.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>m.getStellarAggregatorRouter,getStellarAsset:()=>m.getStellarAsset,getStellarAssetGraph:()=>m.getStellarAssetGraph,getStellarAssetMarkets:()=>m.getStellarAssetMarkets,getStellarAssetPage:()=>m.getStellarAssetPage,getStellarAssets:()=>m.getStellarAssets,getStellarGovernance:()=>m.getStellarGovernance,getStellarGovernanceProposals:()=>m.getStellarGovernanceProposals,getStellarHub:()=>m.getStellarHub,getStellarHubGraph:()=>m.getStellarHubGraph,getStellarHubs:()=>m.getStellarHubs,getStellarLendingContext:()=>m.getStellarLendingContext,getStellarLendingController:()=>m.getStellarLendingController,getStellarLendingLiveState:()=>m.getStellarLendingLiveState,getStellarQuoteTokens:()=>m.getStellarQuoteTokens,getStellarReserve:()=>m.getStellarReserve,getStellarReserveGraph:()=>m.getStellarReserveGraph,getStellarReserveHolders:()=>m.getStellarReserveHolders,getStellarReserves:()=>m.getStellarReserves,getStellarSpoke:()=>m.getStellarSpoke,getStellarSpokeGraph:()=>m.getStellarSpokeGraph,getStellarSpokes:()=>m.getStellarSpokes,getStellarUserActivity:()=>m.getStellarUserActivity,getStellarUserPositions:()=>m.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>m.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>m.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>m.mapQuoteResponseToStrategySwap,mapSorobanError:()=>m.mapSorobanError,mapStellarPositionActivityType:()=>m.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>m.prepareStellarBuiltTx,prepareStellarTxXdr:()=>m.prepareStellarTxXdr,stellarLendingDispatchKey:()=>m.stellarLendingDispatchKey,stellarLendingRead:()=>m.stellarLendingRead,syntheticEventOrder:()=>m.syntheticEventOrder,tagStellarInvokedContractError:()=>m.tagStellarInvokedContractError,toBase64Xdr:()=>m.toBase64Xdr,toStellarPositionMode:()=>m.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,b="Bearer undefined"===S?void 0:S,g={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},y=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${y.length?`?${y}`:""}`,{revalidate:h,...T}=o??{},{revalidate:f,...v}=i??{},x="GET"!==d||b?void 0:f??h,w="GET"!==d||b||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(g).length?{headers:g}:{},cache:w,next:{...T,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",m,A);const q=await fetch(m,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${m}: ${e.message}`),{cause:e});throw e})),_=await q.text();if(!q.ok){let e;try{e=JSON.parse(_)}catch{e={message:_}}const t=[m,q.status,q.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(_)}catch{return _}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||r},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||r};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),g={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},y=["PATCH","POST","DELETE","PUT"];var m=r(397);const h=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),T=()=>({static:{},params:{},leaves:[]});function f(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!b(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:g,auth:y,method:m,headers:h,cache:T,next:f,debug:v,continuationToken:x,...w}=d,A=y?`Bearer ${y}`:void 0,q={...h,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},_={...f,tags:[...f?.tags??[],u]};return o.fetchWithTimeout(u,{method:m,params:w,body:g,headers:q,cache:T,debug:v,..._?{next:_}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))y.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=T();for(const[t,r]of Object.entries(g)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=h(e.slice(1));n=n.params[t]||=T()}else{const t=h(e);n=n.static[t]||=T()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=f(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[h(r.split("/").pop().replace(/^:/,""))]=f(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();
1
+ "undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,r){r.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>ft,STELLAR_LENDING_CONTROLLER:()=>o,STELLAR_LENDING_TOPICS:()=>Ur,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>Dr,XOXNO_LENDING_STELLAR_TICKER:()=>$r,buildSameTokenRepaySwapSteps:()=>io,buildStellarAcceptOwnershipTx:()=>Ke,buildStellarAddRewardsTx:()=>yt,buildStellarApproveBlendPoolTx:()=>rt,buildStellarApproveTokenTx:()=>nt,buildStellarBatchSwapTx:()=>Jr,buildStellarBorrowBatchTx:()=>D,buildStellarBorrowTx:()=>W,buildStellarCctpForwardTx:()=>so,buildStellarClaimRevenueTx:()=>bt,buildStellarCreateLiquidityPoolTx:()=>St,buildStellarExecuteCancellerResetTx:()=>gr,buildStellarExecuteStrategyTx:()=>Zr,buildStellarFlashLoanTx:()=>X,buildStellarGovernanceAddSpokeImmediateTx:()=>fr,buildStellarGovernanceCreateHubImmediateTx:()=>mr,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>ir,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>sr,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>pr,buildStellarGovernanceExecuteTransferGovOwnTx:()=>dr,buildStellarGovernanceExecuteTx:()=>ar,buildStellarGovernanceExecuteUpdateDelayTx:()=>lr,buildStellarGovernancePauseTx:()=>Tr,buildStellarGovernanceRevokeRoleImmediateTx:()=>hr,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>yr,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>br,buildStellarGrantRoleTx:()=>Ve,buildStellarLendingIdentifier:()=>Wr,buildStellarLiquidateTx:()=>V,buildStellarMigrateFromBlendTx:()=>Q,buildStellarMigrateTx:()=>He,buildStellarMultiplyTx:()=>K,buildStellarPauseTx:()=>Fe,buildStellarProposeAddAssetToSpokeTx:()=>Ct,buildStellarProposeAddSpokeTx:()=>Mt,buildStellarProposeApproveBlendPoolTx:()=>zt,buildStellarProposeApproveTokenTx:()=>Dt,buildStellarProposeCancellerResetTx:()=>Sr,buildStellarProposeConfigureAssetOracleTx:()=>Jt,buildStellarProposeConfigureMarketOracleTx:()=>Yt,buildStellarProposeCreateHubTx:()=>Ot,buildStellarProposeCreateLiquidityPoolTx:()=>Ft,buildStellarProposeDeployPoolTx:()=>Vt,buildStellarProposeEditAssetInSpokeTx:()=>Bt,buildStellarProposeEditOracleToleranceTx:()=>er,buildStellarProposeGovernanceUpgradeTx:()=>tr,buildStellarProposeGrantGovernanceRoleTx:()=>or,buildStellarProposeMigrateControllerTx:()=>Kt,buildStellarProposeRemoveAssetFromSpokeTx:()=>Nt,buildStellarProposeRemoveSpokeTx:()=>Lt,buildStellarProposeRevokeBlendPoolTx:()=>Ht,buildStellarProposeRevokeGovernanceRoleTx:()=>nr,buildStellarProposeRevokeTokenTx:()=>Wt,buildStellarProposeSetAccumulatorTx:()=>Et,buildStellarProposeSetAggregatorTx:()=>Rt,buildStellarProposeSetMinBorrowCollatTx:()=>$t,buildStellarProposeSetPositionLimitsTx:()=>It,buildStellarProposeSetPositionManagerTx:()=>Gt,buildStellarProposeSetPriceAggregatorTx:()=>kt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>Ut,buildStellarProposeSetSwapAggregatorTx:()=>Pt,buildStellarProposeTransferCtrlOwnershipTx:()=>Zt,buildStellarProposeTransferGovOwnTx:()=>ur,buildStellarProposeUnpauseTx:()=>vr,buildStellarProposeUpdateDelayTx:()=>rr,buildStellarProposeUpgradeControllerTx:()=>Qt,buildStellarProposeUpgradePoolParamsTx:()=>jt,buildStellarProposeUpgradePoolTx:()=>Xt,buildStellarRenewAccountTx:()=>ct,buildStellarRepayBatchTx:()=>F,buildStellarRepayDebtWithCollateralTx:()=>Y,buildStellarRepayTx:()=>j,buildStellarRevokeBlendPoolTx:()=>ot,buildStellarRevokeRoleTx:()=>Xe,buildStellarRevokeTokenTx:()=>ut,buildStellarSetAccumulatorTx:()=>et,buildStellarSetAggregatorTx:()=>Ye,buildStellarSetMarketOracleConfigTx:()=>it,buildStellarSetOracleSanityBoundsTx:()=>pt,buildStellarSetOracleToleranceTx:()=>lt,buildStellarSetOracleTx:()=>at,buildStellarSetPositionLimitsTx:()=>tt,buildStellarSetPriceAggregatorTx:()=>Je,buildStellarSetSpokeAssetFlagsTx:()=>st,buildStellarSetSwapAggregatorTx:()=>Ze,buildStellarSupplyBatchTx:()=>G,buildStellarSupplyTx:()=>$,buildStellarSwapCollateralTx:()=>J,buildStellarSwapDebtTx:()=>Z,buildStellarTransferOwnershipTx:()=>Qe,buildStellarUnpauseTx:()=>je,buildStellarUpdateAccountThresholdTx:()=>mt,buildStellarUpdateIndexesTx:()=>dt,buildStellarUpgradeControllerTx:()=>ze,buildStellarUpgradeLiquidityPoolParamsTx:()=>gt,buildStellarWithdrawBatchTx:()=>z,buildStellarWithdrawTx:()=>H,buildTx:()=>U,decodeStellarLendingEvent:()=>Gr,encodeAssetOracle:()=>De,encodeInterestRateModel:()=>Ee,encodeMarketOracleConfigInput:()=>We,encodeMarketParamsRaw:()=>Ie,encodePositionLimits:()=>Oe,encodePriceKey:()=>Me,encodeStrategyPayloadToRouteXdr:()=>Kr,extractEventOrder:()=>zr,getStellarAccountDelegates:()=>Pe,getStellarAccountPositions:()=>fe,getStellarAggregatorQuote:()=>Xr,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>de,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>Se,getStellarAssetPage:()=>ce,getStellarAssets:()=>ue,getStellarBlendPools:()=>ke,getStellarContractConfig:()=>qe,getStellarContractRoles:()=>_e,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>he,getStellarHub:()=>ge,getStellarHubGraph:()=>ve,getStellarHubs:()=>ae,getStellarLendingContext:()=>oe,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>ne,getStellarProtocolConfig:()=>we,getStellarQuoteTokens:()=>Qr,getStellarReserve:()=>se,getStellarReserveGraph:()=>Ae,getStellarReserveHolders:()=>pe,getStellarReserves:()=>le,getStellarSpoke:()=>be,getStellarSpokeGraph:()=>xe,getStellarSpokes:()=>ie,getStellarUserActivity:()=>me,getStellarUserPositions:()=>ye,mapQuoteResponseToAggregatorSwap:()=>to,mapQuoteResponseToStrategyPayload:()=>Yr,mapQuoteResponseToStrategySwap:()=>eo,mapSorobanError:()=>co,mapStellarPositionActivityType:()=>Fr,prepareStellarBuiltTx:()=>uo,prepareStellarTxXdr:()=>no,stellarLendingDispatchKey:()=>wr,stellarLendingRead:()=>Re,syntheticEventOrder:()=>Hr,tagStellarInvokedContractError:()=>oo,toBase64Xdr:()=>xr,toStellarPositionMode:()=>ao});const o={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=o[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],g={Soroswap:0,Aquarius:1,Phoenix:2,Sushi:3,CometDex:4},b=1e6,y=e=>new c.Address(e).toScVal(),m=e=>new c.ScInt(e).toI128(),f=e=>c.xdr.ScVal.scvU32(e),h=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),T=e=>c.xdr.ScVal.scvBool(e),v=e=>c.xdr.ScVal.scvString(e),x=e=>c.xdr.ScVal.scvSymbol(e),A=()=>c.xdr.ScVal.scvVoid(),w=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const r=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(r,"hex");if(o.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${o.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(o)},_=(e,t)=>null==e?A():t(e),P=(e,t)=>E({asset:y(t),hub_id:f(e)}),k=(e,t,r)=>c.xdr.ScVal.scvVec([P(e,t),m(r)]),R=e=>c.xdr.ScVal.scvVec(e.map((e=>k(e.hubId,e.asset,e.amount)))),E=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:x(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)};class I{assets=[];amounts=[];ops=[];weights=[];constructor(e){this.amounts.push(e)}asset(e){const t=this.assets.indexOf(e);if(-1!==t)return t;if(this.assets.length>=256)throw new Error("Stellar builder: strategy references more than 256 distinct addresses");return this.assets.push(e),this.assets.length-1}amount(e){if(this.amounts.length>=126)throw new Error("Stellar builder: strategy references too many distinct amounts");return this.amounts.push(e),this.amounts.length-1}weight(e){if(this.weights.length>=32)throw new Error("Stellar builder: strategy uses more than 32 split weights");if(!Number.isInteger(e)||e<=0||e>b)throw new Error(`Stellar builder: split weight ${e} outside 1..=1000000`);return this.weights.push(e),this.weights.length-1}emit(e,t,r,o,n){this.ops.push([e,t,r,o,n])}emitPath(e,t){e.hops.forEach(((r,o)=>{if(r.tokenIn===r.tokenOut)throw new Error("Stellar builder: hop swaps a token for itself");const n=e.hops[o-1];if(n&&r.tokenIn!==n.tokenOut)throw new Error("Stellar builder: hop does not chain onto its predecessor's output");this.emit(g[r.venue],0===o?t:1,this.asset(r.pool),this.asset(r.tokenIn),this.asset(r.tokenOut))}))}lowerPaths(e){const t=e.filter((e=>e.hops.length>0)),r=Array.from({length:t.length},(()=>!1));for(let e=0;e<t.length;e+=1){if(r[e])continue;const o=t[e].hops[0]?.tokenIn,n=[];for(let r=e;r<t.length;r+=1)t[r].hops[0]?.tokenIn===o&&n.push(r);const u=n.reduce(((e,r)=>e+t[r].splitPpm),0);if(u>b)throw new Error(`Stellar builder: split weights for one token sum to ${u}, above 1000000`);const a=u===b;let i=b;n.forEach(((e,o)=>{r[e]=!0;const u=t[e];let l;if(o+1===n.length&&a)l=0;else{if(0===i)throw new Error("Stellar builder: split weights exhaust the group before its last path");const e=Math.floor(u.splitPpm*b/i);i-=Math.min(u.splitPpm,i),l=128+this.weight(e)}this.emitPath(u,l)}))}}toBytes(e,t,r){if(0===this.ops.length)throw new Error("Stellar builder: strategy lowered to zero instructions");if(this.ops.length>48)throw new Error(`Stellar builder: strategy has ${this.ops.length} instructions, the router accepts 48`);const o=[1,e,t,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,this.ops.length,this.weights.length];for(const e of this.ops)o.push(...e);for(const e of this.weights)o.push(e>>>16&255,e>>>8&255,255&e);return Buffer.from(o)}get assetList(){return this.assets}get amountList(){return this.amounts}}const O=e=>{const t=new I(e.totalMinOut),r=t.asset(e.tokenIn),o=t.asset(e.tokenOut);if(r===o)throw new Error("Stellar builder: `tokenIn` and `tokenOut` are the same asset");if(e.burnPool){const o=t.asset(e.burnPool),n=t.amountList.length;for(const r of e.burnMinAmounts??[])t.amount(r);t.emit(5,0,o,r,n)}if(t.lowerPaths(e.paths),e.mintPool){const r=e.preSwapAmount;if(r&&BigInt(r)>0n){const o=e.mintPoolTokens;if(!o||2!==o.length)throw new Error("Stellar builder: `preSwapAmount` needs `mintPoolTokens` to name the pool’s two constituents");const[n,u]=o,[a,i]=e.preSwapFromA?[n,u]:[u,n];t.emit(g.Aquarius,2+t.amount(r),t.asset(e.mintPool),t.asset(a),t.asset(i))}t.emit(6,0,t.asset(e.mintPool),o,t.amount(e.mintMinShares??"1"))}const n=Number(e.referralId??0);if(!Number.isInteger(n)||n<0||n>4294967295)throw new Error(`Stellar builder: referral id ${e.referralId} does not fit the wire’s u32`);return E({amounts:c.xdr.ScVal.scvVec(t.amountList.map((e=>m(e)))),assets:c.xdr.ScVal.scvVec(t.assetList.map((e=>y(e)))),ops:c.xdr.ScVal.scvBytes(t.toBytes(r,o,n))})},M=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)},L=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),C=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((r=e).length>0&&r.length%2==0&&/^[0-9a-fA-F]+$/.test(r)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var r;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const o=Buffer.from(t,"base64");if(0===o.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return o},B=e=>{if("string"==typeof e)return M(C(e));if(e instanceof Uint8Array)return 0===e.length?L():M(e);if(e&&"object"==typeof e)return"routeXdr"in(r=e)&&"string"==typeof r.routeXdr?M(C(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?M(C(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?M(C(e.bytes)):0===e.bytes.length?L():M(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");const r=new Map;for(const[e,o]of t.paths.entries()){if(!o||"number"!=typeof o.splitPpm||o.splitPpm<=0||!Array.isArray(o.hops)||0===o.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);for(const[t,r]of o.hops.entries())if(!r||"string"!=typeof r.pool||"string"!=typeof r.tokenIn||"string"!=typeof r.tokenOut||!S.includes(r.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have pool, tokenIn, tokenOut, and a valid Soroban venue`);const t=o.hops[0];r.set(t.tokenIn,(r.get(t.tokenIn)??0)+o.splitPpm)}for(const[e,o]of r){if(o>b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} sums to ${o}, above 1000000`);if(!t.mintPool&&o!==b)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` for ${e} must sum to 1000000, got ${o}`)}return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(O(t).toXDR("base64"),"base64")));var t,r;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},N=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(r)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function U(e,t,r){const o=e.controllerAddress??s(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function G(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"supply",[y(e.caller),h(r),f(o),R([...t.assets])])}function $(e,t){return G(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function D(e,t){return U(e,"borrow",[y(e.caller),h(t.accountNonce),R([...t.borrows]),_(t.to,y)])}function W(e,t){return D(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function z(e,t){return U(e,"withdraw",[y(e.caller),h(t.accountNonce),R([...t.withdrawals]),_(t.to,y)])}function H(e,t){return z(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function F(e,t){return U(e,"repay",[y(e.caller),h(t.accountNonce),R([...t.payments])])}function j(e,t){return F(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function V(e,t){return U(e,"liquidate",[y(e.caller),h(t.accountNonce),R([...t.debtPayments])])}function X(e,t){return U(e,"flash_loan",[y(e.caller),P(t.hubId,t.asset),m(t.amount),y(t.receiver),N(t.data)])}function Q(e,t){return U(e,"migrate_from_blend",[y(e.caller),h(t.accountId),f(t.spokeId),f(t.hubId),y(t.blendPool),w(t.collateralTokens.map(y)),w(t.supplyTokens.map(y)),(r=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(r.map((e=>{return t=e.token,r=e.amount,c.xdr.ScVal.scvVec([y(t),m(r)]);var t,r}))))]);var r}function K(e,t){const r=t.accountNonce??0,o=t.spokeId??0;return U(e,"multiply",[y(e.caller),h(r),f(o),P(t.collateral.hubId,t.collateral.asset),m(t.debtToFlashLoan),P(t.debt.hubId,t.debt.asset),f(t.mode),B(t.steps),_(t.initialPayment,(e=>k(e.hubId,e.asset,e.amount))),_(t.convertSwap,B)])}function Z(e,t){return U(e,"swap_debt",[y(e.caller),h(t.accountNonce),P(t.existingDebt.hubId,t.existingDebt.asset),m(t.newDebtAmount),P(t.newDebt.hubId,t.newDebt.asset),B(t.steps)])}function J(e,t){return U(e,"swap_collateral",[y(e.caller),h(t.accountNonce),P(t.current.hubId,t.current.asset),m(t.fromAmount),P(t.newCollateral.hubId,t.newCollateral.asset),B(t.steps)])}function Y(e,t){return U(e,"repay_debt_with_collateral",[y(e.caller),h(t.accountNonce),P(t.collateral.hubId,t.collateral.asset),m(t.collateralAmount),P(t.debt.hubId,t.debt.asset),B(t.steps),T(t.closePosition)])}const ee="/stellar-lending",te=25,re=encodeURIComponent,oe=(e,t)=>e.fetchWithTimeout(`${ee}/context`,t),ne=(e,t)=>e.fetchWithTimeout(`${ee}/live-state`,t),ue=(e,t)=>e.fetchWithTimeout(`${ee}/assets`,t),ae=(e,t)=>e.fetchWithTimeout(`${ee}/hubs`,t),ie=(e,t)=>e.fetchWithTimeout(`${ee}/spokes`,t),le=(e,t={},r)=>{const{hubId:o,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${ee}/reserves`,{...r,params:{...void 0!==o?{hubId:o}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},se=(e,t,r,o,n)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}`,n),pe=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/holders`,{...u,params:{side:n}}),de=(e,t,r)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}`,r),ce=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/page`,{...o,params:{...r}}),Se=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/markets`,{...o,params:{side:r}}),ge=(e,t,r)=>e.fetchWithTimeout(`${ee}/hubs/${t}`,r),be=(e,t,r)=>e.fetchWithTimeout(`${ee}/spokes/${t}`,r),ye=(e,t,r)=>e.fetchWithTimeout(`${ee}/users/${re(t)}/positions`,r),me=(e,t,r={},o)=>{const{skip:n,top:u}=r;return e.fetchWithTimeout(`${ee}/users/${re(t)}/activity`,{...o,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},fe=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(t)}/positions`,r),he=(e,t={},r)=>{const{top:o=te,continuationToken:n}=t;return e.fetchWithTimeout(`${ee}/governance/proposals`,{...r,params:{top:o,...n?{continuationToken:n}:{}}})},Te=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/assets/${re(t)}/graph`,{...o,params:{...r}}),ve=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/hubs/${t}/graph`,{...o,params:{...r}}),xe=(e,t,r,o)=>e.fetchWithTimeout(`${ee}/spokes/${t}/graph`,{...o,params:{...r}}),Ae=(e,t,r,o,n,u)=>e.fetchWithTimeout(`${ee}/reserves/${t}/${r}/${re(o)}/graph`,{...u,params:{...n}}),we=(e,t)=>e.fetchWithTimeout(`${ee}/protocol-config`,t),qe=(e,t,r)=>e.fetchWithTimeout(`${ee}/protocol-config/${re(t)}`,r),_e=(e,t,r)=>e.fetchWithTimeout(t?`${ee}/roles?contractAddress=${re(t)}`:`${ee}/roles`,r),Pe=(e,t,r)=>e.fetchWithTimeout(`${ee}/accounts/${re(String(t))}/delegates`,r),ke=(e,t)=>e.fetchWithTimeout(`${ee}/blend-pools`,t),Re=e=>({context:t=>oe(e,t),liveState:t=>ne(e,t),protocolConfig:t=>we(e,t),contractConfig:(t,r)=>qe(e,t,r),contractRoles:(t,r)=>_e(e,t,r),accountDelegates:(t,r)=>Pe(e,t,r),blendPools:t=>ke(e,t),assets:t=>ue(e,t),hubs:t=>ae(e,t),spokes:t=>ie(e,t),reserves:(t,r)=>{return void 0===(o=t)||"hubId"in o||"spokeId"in o||"asset"in o?le(e,t,r):le(e,{},t);var o},reserve:(t,r,o,n)=>se(e,t,r,o,n),reserveHolders:(t,r,o,n,u)=>pe(e,t,r,o,n,u),asset:(t,r)=>de(e,t,r),assetMarkets:(t,r,o)=>Se(e,t,r,o),hub:(t,r)=>ge(e,t,r),spoke:(t,r)=>be(e,t,r),userPositions:(t,r)=>ye(e,t,r),userActivity:(t,r,o)=>me(e,t,r,o),accountPositions:(t,r)=>fe(e,t,r),governanceProposals:(t,r)=>he(e,t,r),assetGraph:(t,r,o)=>Te(e,t,r,o),hubGraph:(t,r,o)=>ve(e,t,r,o),spokeGraph:(t,r,o)=>xe(e,t,r,o),reserveGraph:(t,r,o,n,u)=>Ae(e,t,r,o,n,u)}),Ee=e=>E({base_borrow_rate:m(e.baseBorrowRateRay),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Ie=e=>E({asset_decimals:f(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:m(e.baseBorrowRateRay),flashloan_fee:f(e.flashloanFeeBps),is_flashloanable:T(e.isFlashloanable),max_borrow_rate:m(e.maxBorrowRateRay),max_utilization:m(e.maxUtilizationRay),mid_utilization:m(e.midUtilizationRay),optimal_utilization:m(e.optimalUtilizationRay),reserve_factor:f(e.reserveFactorBps),slope1:m(e.slope1Ray),slope2:m(e.slope2Ray),slope3:m(e.slope3Ray)}),Oe=e=>E({max_borrow_positions:f(e.maxBorrowPositions),max_supply_positions:f(e.maxSupplyPositions)}),Me=e=>{if("Token"in e&&e.Token)return w([x("Token"),y(e.Token)]);if("Ref"in e&&e.Ref)return w([x("Ref"),x(e.Ref)]);throw new Error(`Stellar builder: PriceKey must be { Token } or { Ref }, got ${JSON.stringify(e)}`)},Le=e=>{if("Stellar"in e)return w([x("Stellar"),y(e.Stellar)]);if("Symbol"in e)return w([x("Symbol"),x(e.Symbol)]);if("String"in e)return w([x("String"),v(e.String)]);throw new Error(`Stellar builder: unknown OracleAssetRef ${JSON.stringify(e)}`)},Ce=e=>{if("Spot"===e)return w([x("Spot")]);if(e&&"object"==typeof e&&"Twap"in e)return w([x("Twap"),f(Number(e.Twap))]);throw new Error(`Stellar builder: unknown OracleReadMode ${JSON.stringify(e)}`)},Be=e=>{if("Reflector"===e||"RedStone"===e||"Xoxno"===e)return w([x(e)]);throw new Error(`Stellar builder: unknown ProviderKind "${e}"`)},Ne=e=>{if("Market"===e||"Fundamental"===e)return w([x(e)]);throw new Error(`Stellar builder: unknown FeedNature "${e}"`)},Ue=e=>{if("Reflector"in e){const t=e.Reflector;return w([x("Reflector"),E({asset:Le(t.asset),contract:y(t.contract),read_mode:Ce(t.readMode)})])}if("MultiFeed"in e){const t=e.MultiFeed;return w([x("MultiFeed"),E({contract:y(t.contract),feed_id:v(t.feedId),kind:Be(t.kind),nature:Ne(t.nature)})])}throw new Error(`Stellar builder: unknown ProviderRef ${JSON.stringify(e)}`)},Ge=e=>{const t=e;return E({decimals:f(t.decimals),max_stale_seconds:h(t.maxStaleSeconds),provider:Ue(t.provider)})},$e=e=>{if("RequireDisjoint"===e)return w([x("RequireDisjoint")]);if(e&&"object"==typeof e&&"AllowShared"in e){const t=e.AllowShared;return w([x("AllowShared"),w(t.map((e=>E({contract:y(e.contract),kind:Be(e.kind)}))))])}throw new Error(`Stellar builder: unknown IndependencePolicy ${JSON.stringify(e)}`)},De=e=>{const t=e,r=t.sources??[];let o,n;if("number"==typeof t.toleranceBps)o=1e4+t.toleranceBps,n=Math.max(1,Math.floor(1e8/o));else{const e=t.tolerance??{};o=Number(e.upperRatioBps),n=Number(e.lowerRatioBps)}return E({asset_decimals:f(Number(t.assetDecimals)),independence:$e(t.independence),max_price_stale_seconds:h(Number(t.maxPriceStaleSeconds)),max_sanity_price_wad:m(String(t.maxSanityPriceWad)),min_sanity_price_wad:m(String(t.minSanityPriceWad)),sources:w(r.map((e=>(e=>{if("Feed"in e)return w([x("Feed"),Ge(e.Feed)]);if("Scaled"in e){const t=e.Scaled;return w([x("Scaled"),E({factor:Ge(t.factor),max_factor_wad:m(t.maxFactorWad),min_factor_wad:m(t.minFactorWad),quote:Me(t.quote)})])}if("LpShare"in e){const t=e.LpShare;return w([x("LpShare"),E({key_a:Me(t.keyA),key_b:Me(t.keyB),kind:w([x(t.kind||"ConstantProduct")]),pool:y(t.pool),reserve_a_decimals:f(t.reserveADecimals),reserve_b_decimals:f(t.reserveBDecimals),share_decimals:f(t.shareDecimals)})])}throw new Error(`Stellar builder: unknown PriceSource ${JSON.stringify(e)}`)})(e)))),tolerance:E({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})})},We=De;function ze(e,t){return U(e,"upgrade",[q(t.wasmHash)])}function He(e,t){return U(e,"migrate",[f(t.newVersion)])}function Fe(e){return U(e,"pause",[])}function je(e){return U(e,"unpause",[])}function Ve(e,t){return U(e,"grant_role",[y(t.account),x(t.role)])}function Xe(e,t){return U(e,"revoke_role",[y(t.account),x(t.role)])}function Qe(e,t){return U(e,"transfer_ownership",[y(t.newOwner),f(t.liveUntilLedger)])}function Ke(e){return U(e,"accept_ownership",[])}function Ze(e,t){return U(e,"set_swap_aggregator",[y(t.aggregator)])}function Je(e,t){return U(e,"set_price_aggregator",[y(t.aggregator)])}const Ye=Ze;function et(e,t){return U(e,"set_accumulator",[y(t.accumulator)])}function tt(e,t){return U(e,"set_position_limits",[Oe(t)])}function rt(e,t){return U(e,"approve_blend_pool",[y(t.pool)])}function ot(e,t){return U(e,"revoke_blend_pool",[y(t.pool)])}const nt=rt,ut=ot;function at(e,t){return U(e,"set_oracle",[Me(t.key),De(t.oracle)])}const it=at;function lt(e,t){const r=t.toleranceBps,o=t.upperRatioBps??1e4+r,n=t.lowerRatioBps??Math.max(1,Math.floor(1e8/o));return U(e,"set_tolerance",[Me(t.key),E({lower_ratio_bps:f(n),upper_ratio_bps:f(o)})])}function st(e,t){return U(e,"set_spoke_asset_flags",[f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen)])}function pt(e,t){return U(e,"set_oracle_sanity_bounds",[y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function dt(e,t){return U(e,"update_indexes",[y(e.caller),w(t.assets.map((e=>P(e.hubId,e.asset))))])}function ct(e,t){return U(e,"renew_account",[y(e.caller),h(t.accountNonce)])}function St(e,t){return U(e,"create_liquidity_pool",[f(t.hubId),y(t.asset),Ie(t.params)])}function gt(e,t){return U(e,"upgrade_liquidity_pool_params",[P(t.hubId,t.asset),Ee(t.params)])}function bt(e,t){return U(e,"claim_revenue",[y(e.caller),w(t.assets.map((e=>P(e.hubId,e.asset))))])}function yt(e,t){return U(e,"add_rewards",[y(e.caller),R(t.rewards)])}function mt(e,t){return U(e,"update_account_threshold",[y(e.caller),T(t.hasRisks),w(t.accountNonces.map((e=>h(e))))])}const ft="00".repeat(32),ht=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)=>w([x(e),...t]),vt=e=>E({new_owner:y(e.newOwner),live_until_ledger:f(e.liveUntilLedger)}),xt=e=>E({asset:y(e.asset),bonus:f(e.bonus),borrow_cap:m(e.borrowCap),can_borrow:T(e.canBorrow),can_collateral:T(e.canCollateral),frozen:T(e.frozen),hub_id:f(e.hubId),paused:T(e.paused),liquidation_fees:f(e.liquidationFees),ltv:f(e.ltv),oracle_override:w([x("None")]),spoke_id:f(e.spokeId),supply_cap:m(e.supplyCap),threshold:f(e.threshold)}),At=e=>E({account:y(e.account),role:x(e.role)});function wt(e,t,r){const o=e.governanceAddress??d(e.network),n=new c.Contract(o),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...r)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const qt=(e,t,r)=>wt(e,"propose",[y(e.caller),t,ht(r)]),_t=(e,t,r)=>wt(e,"execute_self",[A(),t,ht(r)]);function Pt(e,t,r){return qt(e,Tt("SetSwapAggregator",y(t.aggregator)),r)}function kt(e,t,r){return qt(e,Tt("SetPriceAggregator",y(t.aggregator)),r)}const Rt=Pt;function Et(e,t,r){return qt(e,Tt("SetAccumulator",y(t.accumulator)),r)}function It(e,t,r){return qt(e,Tt("SetPositionLimits",Oe(t)),r)}function Ot(e,t){return qt(e,Tt("CreateHub"),t)}function Mt(e,t){return qt(e,Tt("AddSpoke"),t)}function Lt(e,t,r){return qt(e,Tt("RemoveSpoke",f(t.spokeId)),r)}function Ct(e,t,r){return qt(e,Tt("AddAssetToSpoke",xt(t)),r)}function Bt(e,t,r){return qt(e,Tt("EditAssetInSpoke",xt(t)),r)}function Nt(e,t,r){return qt(e,Tt("RemoveAssetFromSpoke",E({hub_asset:P((o=t).hubId,o.asset),spoke_id:f(o.spokeId)})),r);var o}function Ut(e,t,r){return qt(e,Tt("SetSpokeLiquidationCurve",E({hf_for_max_bonus_wad:m((o=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:f(o.liquidationBonusFactorBps),spoke_id:f(o.spokeId),target_hf_wad:m(o.targetHfWad)})),r);var o}function Gt(e,t,r){return qt(e,Tt("SetPositionManager",y(t.manager),T(t.isActive)),r)}function $t(e,t,r){return qt(e,Tt("SetMinBorrowCollateralUsd",m(t.floorWad)),r)}function Dt(e,t,r){return qt(e,Tt("ApproveToken",y(t.token)),r)}function Wt(e,t,r){return qt(e,Tt("RevokeToken",y(t.token)),r)}function zt(e,t,r){return qt(e,Tt("ApproveBlendPool",y(t.pool)),r)}function Ht(e,t,r){return qt(e,Tt("RevokeBlendPool",y(t.pool)),r)}function Ft(e,t,r){return qt(e,Tt("CreateLiquidityPool",E({asset:y((o=t).asset),hub_id:f(o.hubId),params:Ie(o.params)})),r);var o}function jt(e,t,r){return qt(e,Tt("UpgradeLiquidityPoolParams",E({hub_asset:P((o=t).hubId,o.asset),params:Ee(o.params)})),r);var o}function Vt(e,t,r){return qt(e,Tt("DeployPool",q(t.wasmHash)),r)}function Xt(e,t,r){return qt(e,Tt("UpgradePool",q(t.wasmHash)),r)}function Qt(e,t,r){return qt(e,Tt("UpgradeController",q(t.wasmHash)),r)}function Kt(e,t,r){return qt(e,Tt("MigrateController",f(t.newVersion)),r)}function Zt(e,t,r){return qt(e,Tt("TransferCtrlOwnership",vt(t)),r)}function Jt(e,t,r){return qt(e,Tt("ConfigureAssetOracle",E({key:Me((o=t).key),oracle:De(o.oracle)})),r);var o}const Yt=Jt;function er(e,t,r){return qt(e,Tt("EditOracleTolerance",E({key:Me((o=t).key),tolerance:f(o.tolerance)})),r);var o}function tr(e,t,r){return qt(e,Tt("UpgradeGov",q(t.wasmHash)),r)}function rr(e,t,r){return qt(e,Tt("UpdateGovDelay",f(t.newDelay)),r)}function or(e,t,r){return qt(e,Tt("GrantGovRole",At(t)),r)}function nr(e,t,r){return qt(e,Tt("RevokeGovRole",At(t)),r)}function ur(e,t,r){return qt(e,Tt("TransferGovOwnership",vt(t)),r)}function ar(e,t){const r=w(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),o=ht(t.predecessor??ft);return wt(e,"execute",[A(),y(t.target),x(t.functionName),r,o,ht(t.salt)])}function ir(e,t,r){return _t(e,Tt("UpgradeGov",q(t.wasmHash)),r)}function lr(e,t,r){return _t(e,Tt("UpdateGovDelay",f(t.newDelay)),r)}function sr(e,t,r){return _t(e,Tt("GrantGovRole",At(t)),r)}function pr(e,t,r){return _t(e,Tt("RevokeGovRole",At(t)),r)}function dr(e,t,r){return _t(e,Tt("TransferGovOwnership",vt(t)),r)}const cr=e=>w(e.map(y));function Sr(e,t,r){return wt(e,"propose_canceller_reset",[cr(t.newCancellers),ht(r)])}function gr(e,t,r){return wt(e,"execute_canceller_reset",[_(t.executor,y),cr(t.newCancellers),ht(r)])}function br(e,t){return wt(e,"set_spoke_asset_flags",[y(e.caller),f(t.spokeId),P(t.hubId,t.asset),T(t.paused),T(t.frozen)])}function yr(e,t){return wt(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),m(t.minPriceWad),m(t.maxPriceWad)])}function mr(e){return wt(e,"create_hub",[y(e.caller)])}function fr(e){return wt(e,"add_spoke",[y(e.caller)])}function hr(e,t){return wt(e,"revoke_role_immediate",[y(t.account),x(t.role)])}function Tr(e){return wt(e,"pause",[y(e.caller)])}function vr(e,t){return qt(e,Tt("Unpause"),t)}const xr=e=>e.toXDR("base64"),Ar=e=>c.xdr.ScVal.fromXDR(e,"base64"),wr=e=>e.map((e=>String((0,c.scValToNative)(Ar(e))))).join(":"),qr=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),_r=e=>Number(e),Pr=e=>String(e),kr=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),Rr=["None","Multiply","Long","Short"],Er=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd","migrate","rp_col_net"],Ir=e=>Array.isArray(e)?e:[],Or=(e,t)=>{const r="Borrow"===t;return{action:(o=e[0],Er[_r(o)]??qr(o)),positionType:t,hubId:_r(e[1]),asset:Pr(e[2]),scaledAmountRay:qr(e[3]),indexRay:qr(e[4]),amount:qr(e[5]),liquidationThresholdBps:r?void 0:_r(e[6]),liquidationBonusBps:r?void 0:_r(e[7]),loanToValueBps:r?void 0:_r(e[8]),liquidationFeesBps:r?void 0:_r(e[9])};var o},Mr=e=>{return{owner:Pr(e[0]),spokeId:_r(e[1]),mode:(t=e[2],Rr[_r(t)]??"None")};var t},Lr=e=>Array.isArray(e)?e[1]:void 0,Cr=e=>{const t=(r=e,Array.isArray(r)?Pr(r[0]):Pr(r));var r;if("Token"===t)return{Token:Pr(Lr(e))};if("Ref"===t)return{Ref:Pr(Lr(e))};if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if(void 0!==t.Token)return{Token:Pr(t.Token)};if(void 0!==t.Ref)return{Ref:Pr(t.Ref)}}return{Token:Pr(e)}},Br=e=>{const t=e.tolerance??{};return{assetDecimals:_r(e.asset_decimals),maxPriceStaleSeconds:_r(e.max_price_stale_seconds),sources:Ir(e.sources).map((e=>e)),tolerance:{upperRatio:_r(t.upper_ratio_bps),lowerRatio:_r(t.lower_ratio_bps)},independence:e.independence,minSanityPriceWad:qr(e.min_sanity_price_wad),maxSanityPriceWad:qr(e.max_sanity_price_wad)}},Nr={"market:create":e=>({topic:"market:create",data:{hubId:_r(e.hub_id),baseAsset:Pr(e.base_asset),maxBorrowRate:qr(e.max_borrow_rate),baseBorrowRate:qr(e.base_borrow_rate),slope1:qr(e.slope1),slope2:qr(e.slope2),slope3:qr(e.slope3),midUtilization:qr(e.mid_utilization),optimalUtilization:qr(e.optimal_utilization),maxUtilization:qr(e.max_utilization),reserveFactor:_r(e.reserve_factor),marketAddress:Pr(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:Pr(e.asset),maxBorrowRateRay:qr(e.max_borrow_rate),baseBorrowRateRay:qr(e.base_borrow_rate),slope1Ray:qr(e.slope1),slope2Ray:qr(e.slope2),slope3Ray:qr(e.slope3),midUtilizationRay:qr(e.mid_utilization),optimalUtilizationRay:qr(e.optimal_utilization),maxUtilizationRay:qr(e.max_utilization),reserveFactorBps:_r(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:Ir(e).map((e=>{return t=Ir(e),{hubId:_r(t[0]),asset:Pr(t[1]),timestamp:_r(t[2]),supplyIndexRay:qr(t[3]),borrowIndexRay:qr(t[4]),cash:qr(t[5]),suppliedRay:qr(t[6]),borrowedRay:qr(t[7]),revenueRay:qr(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:Ir(e).map((e=>{const t=e;return{hubId:_r(t.hub_id),asset:Pr(t.asset),params:(r=t.params,{maxBorrowRateRay:qr(r.max_borrow_rate),baseBorrowRateRay:qr(r.base_borrow_rate),slope1Ray:qr(r.slope1),slope2Ray:qr(r.slope2),slope3Ray:qr(r.slope3),midUtilizationRay:qr(r.mid_utilization),optimalUtilizationRay:qr(r.optimal_utilization),maxUtilizationRay:qr(r.max_utilization),reserveFactorBps:_r(r.reserve_factor),isFlashloanable:Boolean(r.is_flashloanable),flashloanFeeBps:_r(r.flashloan_fee),assetId:Pr(r.asset_id),assetDecimals:_r(r.asset_decimals)})};var r}))}}),"position:batch_update":e=>{const t=Ir(e);return{topic:"position:batch_update",data:{accountId:qr(t[0]),accountAttributes:Mr(Ir(t[1])),updates:[...Ir(t[2]).map((e=>Or(Ir(e),"Deposit"))),...Ir(t[3]).map((e=>Or(Ir(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:_r(e.hub_id),asset:Pr(e.asset),receiver:Pr(e.receiver),caller:Pr(e.caller),amount:qr(e.amount),fee:qr(e.fee)}}),"config:asset_oracle":e=>({topic:"config:asset_oracle",data:{key:Cr(e.key),oracle:Br(e.oracle)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:Pr(e.asset),oracle:Br(e.config??e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:Pr(e.liquidator),accountId:qr(e.account_id),repaidUsdWad:qr(e.repaid_usd_wad),bonusBps:qr(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:qr(e.account_id),totalBorrowUsdWad:qr(e.total_borrow_usd_wad),totalCollateralUsdWad:qr(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:Pr(e.token),amount:qr(e.amount),usdValueWad:qr(e.usd_value_wad),accountId:qr(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:_r(e.hub_id),asset:Pr(e.asset),amount:qr(e.amount),fee:qr(e.fee),amountSent:qr(e.amount_sent)}}),"config:approve_blend_pool":e=>({topic:"config:approve_blend_pool",data:{pool:Pr(e.pool??e.blend_pool??e.token),approved:Boolean(e.approved??e.is_approved??!0)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:kr(e.wasm_hash??e.pool),approved:Boolean(e.approved)}}),"config:swap_aggregator":e=>({topic:"config:swap_aggregator",data:{aggregator:Pr(e.aggregator??e.swap_aggregator)}}),"config:price_aggregator":e=>({topic:"config:price_aggregator",data:{aggregator:Pr(e.aggregator??e.price_aggregator)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:Pr(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:Pr(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:kr(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:_r(e.max_supply_positions),maxBorrowPositions:_r(e.max_borrow_positions)}}),"config:min_borrow_collateral":e=>({topic:"config:min_borrow_collateral",data:{minBorrowCollateralUsdWad:qr(e.min_borrow_collateral_usd_wad??e.floor_wad??e.value)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:Pr(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:_r(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:qr(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:qr(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:_r(t.liquidation_bonus_factor_bps)}}}},Ur=Object.freeze(Object.keys(Nr));function Gr(e,t){const r=wr(e),o=Nr[r];return o?o((0,c.scValToNative)(Ar(t))):null}const $r="XLENDXLM-a7c9f3",Dr=1e4;function Wr(e){const t=BigInt(e).toString(16),r=t.length%2==0?t:`0${t}`;return`${$r}-${r}`}function zr(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Hr(e,t=0){return e*Dr+t}function Fr(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const jr=(e,t,r)=>{const o=new URL(t,e.endsWith("/")?e:`${e}/`);if(r)for(const[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,String(t));return o.toString()},Vr=e=>e.baseUrl??i[e.network];async function Xr(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const r=jr(Vr(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),o=await fetch(r,t.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${r} — ${e}`)}return await o.json()}async function Qr(e){const t=jr(Vr(e),"api/v1/tokens"),r=await fetch(t,e.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${t} — ${e}`)}return await r.json()}const Kr=e=>O(e).toXDR("base64");function Zr(e,t){const r=e.routerAddress??p(e.network),o=new c.Contract(r),n=new c.Account(e.caller,e.sourceSequence),u=B(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(o.call("execute_strategy",y(e.caller),m(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Jr(e,t){return Zr(e,t)}function Yr(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 eo(e,t={}){const r=e;return"string"==typeof r.routeXdr&&r.routeXdr.length>0?{routeXdr:r.routeXdr}:Yr(e,t)}const to=Yr,ro=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function oo(e,t){const r=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${r}`)}async function no(e,t,r){const o=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(o)).toXDR()}catch(e){if(r?.invokedContractId)throw oo(r.invokedContractId,e);throw e}}async function uo(e,t,r){return no(e,t.xdr,r)}function ao(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 io(e,t){return new Uint8Array(0)}const lo=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 so(e){const t=new c.Account(e.caller,e.sourceSequence),r=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(lo(e.message)),c.xdr.ScVal.scvBytes(lo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(r).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const po={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidWasmHash",message:"The WASM hash is empty or invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function co(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const r=Number(t[1]),o=po[r];return o?{code:r,...o}:null}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>m.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>m.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>m.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>m.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>m.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>m.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>m.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>m.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>m.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>m.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>m.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>m.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>m.buildStellarAddRewardsTx,buildStellarApproveBlendPoolTx:()=>m.buildStellarApproveBlendPoolTx,buildStellarApproveTokenTx:()=>m.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>m.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>m.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>m.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>m.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>m.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>m.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>m.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>m.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>m.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>m.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>m.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>m.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>m.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>m.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>m.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>m.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>m.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>m.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>m.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>m.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>m.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>m.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>m.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>m.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>m.buildStellarMigrateTx,buildStellarMultiplyTx:()=>m.buildStellarMultiplyTx,buildStellarPauseTx:()=>m.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>m.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>m.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>m.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>m.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>m.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureAssetOracleTx:()=>m.buildStellarProposeConfigureAssetOracleTx,buildStellarProposeConfigureMarketOracleTx:()=>m.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>m.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>m.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>m.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>m.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>m.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>m.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>m.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>m.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>m.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>m.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>m.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>m.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>m.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>m.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>m.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>m.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPositionLimitsTx:()=>m.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>m.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetPriceAggregatorTx:()=>m.buildStellarProposeSetPriceAggregatorTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>m.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeSetSwapAggregatorTx:()=>m.buildStellarProposeSetSwapAggregatorTx,buildStellarProposeTransferCtrlOwnershipTx:()=>m.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>m.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>m.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>m.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>m.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>m.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>m.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>m.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>m.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>m.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>m.buildStellarRepayTx,buildStellarRevokeBlendPoolTx:()=>m.buildStellarRevokeBlendPoolTx,buildStellarRevokeRoleTx:()=>m.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>m.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>m.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>m.buildStellarSetAggregatorTx,buildStellarSetMarketOracleConfigTx:()=>m.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>m.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>m.buildStellarSetOracleToleranceTx,buildStellarSetOracleTx:()=>m.buildStellarSetOracleTx,buildStellarSetPositionLimitsTx:()=>m.buildStellarSetPositionLimitsTx,buildStellarSetPriceAggregatorTx:()=>m.buildStellarSetPriceAggregatorTx,buildStellarSetSpokeAssetFlagsTx:()=>m.buildStellarSetSpokeAssetFlagsTx,buildStellarSetSwapAggregatorTx:()=>m.buildStellarSetSwapAggregatorTx,buildStellarSupplyBatchTx:()=>m.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>m.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>m.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>m.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>m.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>m.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>m.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>m.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>m.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>m.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>m.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>m.buildStellarWithdrawTx,buildTx:()=>m.buildTx,decodeStellarLendingEvent:()=>m.decodeStellarLendingEvent,encodeAssetOracle:()=>m.encodeAssetOracle,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodePositionLimits:()=>m.encodePositionLimits,encodePriceKey:()=>m.encodePriceKey,encodeStrategyPayloadToRouteXdr:()=>m.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>m.extractEventOrder,getStellarAccountDelegates:()=>m.getStellarAccountDelegates,getStellarAccountPositions:()=>m.getStellarAccountPositions,getStellarAggregatorQuote:()=>m.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>m.getStellarAggregatorRouter,getStellarAsset:()=>m.getStellarAsset,getStellarAssetGraph:()=>m.getStellarAssetGraph,getStellarAssetMarkets:()=>m.getStellarAssetMarkets,getStellarAssetPage:()=>m.getStellarAssetPage,getStellarAssets:()=>m.getStellarAssets,getStellarBlendPools:()=>m.getStellarBlendPools,getStellarContractConfig:()=>m.getStellarContractConfig,getStellarContractRoles:()=>m.getStellarContractRoles,getStellarGovernance:()=>m.getStellarGovernance,getStellarGovernanceProposals:()=>m.getStellarGovernanceProposals,getStellarHub:()=>m.getStellarHub,getStellarHubGraph:()=>m.getStellarHubGraph,getStellarHubs:()=>m.getStellarHubs,getStellarLendingContext:()=>m.getStellarLendingContext,getStellarLendingController:()=>m.getStellarLendingController,getStellarLendingLiveState:()=>m.getStellarLendingLiveState,getStellarProtocolConfig:()=>m.getStellarProtocolConfig,getStellarQuoteTokens:()=>m.getStellarQuoteTokens,getStellarReserve:()=>m.getStellarReserve,getStellarReserveGraph:()=>m.getStellarReserveGraph,getStellarReserveHolders:()=>m.getStellarReserveHolders,getStellarReserves:()=>m.getStellarReserves,getStellarSpoke:()=>m.getStellarSpoke,getStellarSpokeGraph:()=>m.getStellarSpokeGraph,getStellarSpokes:()=>m.getStellarSpokes,getStellarUserActivity:()=>m.getStellarUserActivity,getStellarUserPositions:()=>m.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>m.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>m.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>m.mapQuoteResponseToStrategySwap,mapSorobanError:()=>m.mapSorobanError,mapStellarPositionActivityType:()=>m.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>m.prepareStellarBuiltTx,prepareStellarTxXdr:()=>m.prepareStellarTxXdr,stellarLendingDispatchKey:()=>m.stellarLendingDispatchKey,stellarLendingRead:()=>m.stellarLendingRead,syntheticEventOrder:()=>m.syntheticEventOrder,tagStellarInvokedContractError:()=>m.tagStellarInvokedContractError,toBase64Xdr:()=>m.toBase64Xdr,toStellarPositionMode:()=>m.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...r}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=r,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...r}={})=>{const{next:o,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=r,S=p?.Authorization,g="Bearer undefined"===S?void 0:S,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...g?{Authorization:g}:{}},y=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${y.length?`?${y}`:""}`,{revalidate:f,...h}=o??{},{revalidate:T,...v}=i??{},x="GET"!==d||g?void 0:T??f,A="GET"!==d||g||x?void 0:l??n,w={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:A,next:{...h,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",m,w);const q=await fetch(m,w).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${m}: ${e.message}`),{cause:e});throw e})),_=await q.text();if(!q.ok){let e;try{e=JSON.parse(_)}catch{e={message:_}}const t=[m,q.status,q.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(_)}catch{return _}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),r=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||r},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),r=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||r};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const g=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:{}},"/integrations/lending/stellar":{input:{},output:{}},"/integrations/lending/stellar/history":{input:{},output:{}},"/integrations/lending/stellar/revenue":{input:{},output:{}},"/integrations/lending/stellar/active-users":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/markets/detailed":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},y=["PATCH","POST","DELETE","PUT"];var m=r(397);const f=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),h=()=>({static:{},params:{},leaves:[]});function T(e,t,r,o){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...r,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!g(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:y,method:m,headers:f,cache:h,next:T,debug:v,continuationToken:x,...A}=d,w=y?`Bearer ${y}`:void 0,q={...f,...w?{Authorization:w}:{},...x?{"X-Continuation-Token":String(x)}:{}},_={...T,tags:[...T?.tags??[],u]};return o.fetchWithTimeout(u,{method:m,params:A,body:b,headers:q,cache:h,debug:v,..._?{next:_}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))y.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=h();for(const[t,r]of Object.entries(b)){const o=t.split("/").filter(Boolean);let n=e;for(const e of o)if(e.startsWith(":")){const t=f(e.slice(1));n=n.params[t]||=h()}else{const t=f(e);n=n.static[t]||=h()}n.leaves.push({rawPath:t,def:r})}return e}(),r=(t,o)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:r,def:n}=t.leaves[0];i=T(r,n,o,e)}else{i={};for(const{rawPath:r,def:n}of t.leaves)i[f(r.split("/").pop().replace(/^:/,""))]=T(r,n,o,e)}for(const[e,n]of Object.entries(t.static)){const t=r(n,o);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const r=t[e],o=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===r.length||(Object.assign(r,o),u=r)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=r(n,{...o,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],r=(...e)=>t(...e);return Object.assign(r,t)}return u};if(i[e]){const r=i[e];i[e]=e=>({...r(e),...t(e)})}else i[e]=t}return i};return r(t,{})}module.exports=o})();