@xoxno/sdk-js 1.0.190 → 1.0.192
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.
|
@@ -222,6 +222,30 @@ export declare function buildStellarGovernanceExecuteGrantGovernanceRoleTx(opts:
|
|
|
222
222
|
export declare function buildStellarGovernanceExecuteRevokeGovernanceRoleTx(opts: StellarBuilderOptions, args: RoleGrantArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
223
223
|
/** execute_self(executor=None, TransferGovOwnership(TransferOwnershipArgs), salt) */
|
|
224
224
|
export declare function buildStellarGovernanceExecuteTransferGovOwnTx(opts: StellarBuilderOptions, args: TransferOwnershipArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
225
|
+
export interface CancellerResetArgs {
|
|
226
|
+
/** New canceller council membership — replaces the existing set wholesale. */
|
|
227
|
+
newCancellers: string[];
|
|
228
|
+
}
|
|
229
|
+
export interface ExecuteCancellerResetArgs extends CancellerResetArgs {
|
|
230
|
+
/** Omitted leaves execution open (Soroban `Option::None`) to any account. */
|
|
231
|
+
executor?: string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* propose_canceller_reset(new_cancellers, salt) — owner-only, non-vetoable
|
|
235
|
+
* council reset scheduled at the Recovery delay; direct entrypoint, not
|
|
236
|
+
* `AdminOperation`. `#[only_owner]` takes no `caller` param — the tx source
|
|
237
|
+
* (`opts.caller`) must be the governance owner and sign. Returns the
|
|
238
|
+
* operation id.
|
|
239
|
+
*/
|
|
240
|
+
export declare function buildStellarProposeCancellerResetTx(opts: StellarBuilderOptions, args: CancellerResetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
241
|
+
/**
|
|
242
|
+
* execute_canceller_reset(executor, new_cancellers, salt) — executes a
|
|
243
|
+
* matured council reset; direct entrypoint, not `execute_self` /
|
|
244
|
+
* `AdminOperation`. `executor` omitted leaves execution open to any account;
|
|
245
|
+
* `newCancellers` and `salt` MUST match the values passed to
|
|
246
|
+
* `buildStellarProposeCancellerResetTx`.
|
|
247
|
+
*/
|
|
248
|
+
export declare function buildStellarExecuteCancellerResetTx(opts: StellarBuilderOptions, args: ExecuteCancellerResetArgs, salt: StellarGovernanceSalt): BuiltStellarTx;
|
|
225
249
|
export interface SpokeAssetFlagsArgs {
|
|
226
250
|
spokeId: number;
|
|
227
251
|
hubId: number;
|
|
@@ -274,17 +298,18 @@ export declare function buildStellarGovernanceAddSpokeImmediateTx(opts: StellarB
|
|
|
274
298
|
*/
|
|
275
299
|
export declare function buildStellarGovernanceRevokeRoleImmediateTx(opts: StellarBuilderOptions, args: RoleGrantArgs): BuiltStellarTx;
|
|
276
300
|
/**
|
|
277
|
-
* pause() —
|
|
278
|
-
* controller's `pause`, halting supply/borrow/strategy entrypoints across
|
|
279
|
-
* every market (exits and liquidation stay open).
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
301
|
+
* pause(caller) — GUARDIAN-gated, immediate protocol-wide brake. Forwards to
|
|
302
|
+
* the controller's `pause`, halting supply/borrow/strategy entrypoints across
|
|
303
|
+
* every market (exits and liquidation stay open). Halting is fail-safe, so the
|
|
304
|
+
* fast incident key acts without the owner online. `caller = opts.caller` must
|
|
305
|
+
* hold GUARDIAN and sign. Distinct from the controller-targeted
|
|
306
|
+
* `buildStellarPauseTx`, which an EOA cannot call because the controller's
|
|
307
|
+
* owner is the governance contract.
|
|
283
308
|
*/
|
|
284
309
|
export declare function buildStellarGovernancePauseTx(opts: StellarBuilderOptions): BuiltStellarTx;
|
|
285
310
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* must
|
|
311
|
+
* propose(Unpause) — resuming the controller is risk-loosening, so unlike the
|
|
312
|
+
* GUARDIAN-immediate `pause` it rides the timelock as a Standard-delay
|
|
313
|
+
* governance proposal. `proposer = opts.caller` must hold PROPOSER and sign.
|
|
289
314
|
*/
|
|
290
|
-
export declare function
|
|
315
|
+
export declare function buildStellarProposeUnpauseTx(opts: StellarBuilderOptions, salt: StellarGovernanceSalt): BuiltStellarTx;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>ot,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>xo,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>_o,XOXNO_LENDING_STELLAR_TICKER:()=>Ao,buildSameTokenRepaySwapSteps:()=>Vo,buildStellarAcceptOwnershipTx:()=>Ne,buildStellarAddRewardsTx:()=>et,buildStellarApproveTokenTx:()=>ze,buildStellarBatchSwapTx:()=>Go,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>Fo,buildStellarClaimRevenueTx:()=>Ye,buildStellarCreateLiquidityPoolTx:()=>Ke,buildStellarExecuteStrategyTx:()=>Co,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceAddSpokeImmediateTx:()=>Kt,buildStellarGovernanceCreateHubImmediateTx:()=>Zt,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Vt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>jt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Ft,buildStellarGovernanceExecuteTx:()=>Wt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ht,buildStellarGovernancePauseTx:()=>Yt,buildStellarGovernanceRevokeRoleImmediateTx:()=>Jt,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Qt,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Xt,buildStellarGovernanceUnpauseTx:()=>eo,buildStellarGrantRoleTx:()=>Ce,buildStellarLendingIdentifier:()=>wo,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Oe,buildStellarMultiplyTx:()=>F,buildStellarPauseTx:()=>Me,buildStellarProposeAddAssetToSpokeTx:()=>Tt,buildStellarProposeAddSpokeTx:()=>gt,buildStellarProposeApproveBlendPoolTx:()=>wt,buildStellarProposeApproveTokenTx:()=>At,buildStellarProposeConfigureMarketOracleTx:()=>Ct,buildStellarProposeCreateHubTx:()=>bt,buildStellarProposeCreateLiquidityPoolTx:()=>kt,buildStellarProposeDeployPoolTx:()=>Et,buildStellarProposeEditAssetInSpokeTx:()=>ft,buildStellarProposeEditOracleToleranceTx:()=>Gt,buildStellarProposeGovernanceUpgradeTx:()=>Ut,buildStellarProposeGrantGovernanceRoleTx:()=>Bt,buildStellarProposeMigrateControllerTx:()=>Mt,buildStellarProposeRemoveAssetFromSpokeTx:()=>ht,buildStellarProposeRemoveSpokeTx:()=>mt,buildStellarProposeRevokeBlendPoolTx:()=>Pt,buildStellarProposeRevokeGovernanceRoleTx:()=>$t,buildStellarProposeRevokeTokenTx:()=>_t,buildStellarProposeSetAccumulatorTx:()=>ct,buildStellarProposeSetAggregatorTx:()=>dt,buildStellarProposeSetMinBorrowCollatTx:()=>qt,buildStellarProposeSetPoolTemplateTx:()=>St,buildStellarProposeSetPositionLimitsTx:()=>yt,buildStellarProposeSetPositionManagerTx:()=>xt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>vt,buildStellarProposeTransferCtrlOwnershipTx:()=>Lt,buildStellarProposeTransferGovOwnTx:()=>Dt,buildStellarProposeUpdateDelayTx:()=>Nt,buildStellarProposeUpgradeControllerTx:()=>Ot,buildStellarProposeUpgradePoolParamsTx:()=>Rt,buildStellarProposeUpgradePoolTx:()=>It,buildStellarRenewAccountTx:()=>Ze,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>Z,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ge,buildStellarRevokeTokenTx:()=>He,buildStellarSetAccumulatorTx:()=>$e,buildStellarSetAggregatorTx:()=>Be,buildStellarSetLiquidityPoolTemplateTx:()=>De,buildStellarSetMarketOracleConfigTx:()=>Ve,buildStellarSetOracleSanityBoundsTx:()=>Xe,buildStellarSetOracleToleranceTx:()=>je,buildStellarSetPositionLimitsTx:()=>We,buildStellarSetSpokeAssetFlagsTx:()=>Fe,buildStellarSupplyBatchTx:()=>G,buildStellarSupplyTx:()=>U,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ue,buildStellarUnpauseTx:()=>Le,buildStellarUpdateAccountThresholdTx:()=>tt,buildStellarUpdateIndexesTx:()=>Qe,buildStellarUpgradeControllerTx:()=>Ie,buildStellarUpgradeLiquidityPoolParamsTx:()=>Je,buildStellarWithdrawBatchTx:()=>$,buildStellarWithdrawTx:()=>D,buildTx:()=>C,decodeStellarLendingEvent:()=>qo,encodeInterestRateModel:()=>Ae,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>_e,encodeOracleSourceConfigInput:()=>Re,encodePositionLimits:()=>we,encodeStrategyPayloadToRouteXdr:()=>Lo,extractEventOrder:()=>Po,getStellarAccountPositions:()=>be,getStellarAggregatorQuote:()=>Oo,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>le,getStellarAssetGraph:()=>me,getStellarAssetMarkets:()=>pe,getStellarAssetPage:()=>se,getStellarAssets:()=>oe,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ge,getStellarHub:()=>de,getStellarHubGraph:()=>Te,getStellarHubs:()=>re,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>Mo,getStellarReserve:()=>ae,getStellarReserveGraph:()=>he,getStellarReserveHolders:()=>ie,getStellarReserves:()=>ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>fe,getStellarSpokes:()=>ne,getStellarUserActivity:()=>ye,getStellarUserPositions:()=>Se,mapQuoteResponseToAggregatorSwap:()=>Bo,mapQuoteResponseToStrategyPayload:()=>Uo,mapQuoteResponseToStrategySwap:()=>No,mapSorobanError:()=>Qo,mapStellarPositionActivityType:()=>Ro,prepareStellarBuiltTx:()=>zo,prepareStellarTxXdr:()=>Wo,stellarLendingDispatchKey:()=>ro,stellarLendingRead:()=>ve,syntheticEventOrder:()=>ko,tagStellarInvokedContractError:()=>Do,toBase64Xdr:()=>to,toStellarPositionMode:()=>Ho});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],y=e=>new c.Address(e).toScVal(),b=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),m=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),T=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>k({asset:y(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([_(e,t),b(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:b(e.amountOut),pool:y(e.pool),token_in:y(e.tokenIn),token_out:y(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:m(e.referralId??0),token_in:y(e.tokenIn),token_out:y(e.tokenOut),total_min_out:b(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},I=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},M=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return 0===e.length?I():E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):0===e.bytes.length?I():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!S.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,o){const r=e.controllerAddress??s(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function G(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[y(e.caller),m(o),g(r),P([...t.assets])])}function U(e,t){return G(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return C(e,"borrow",[y(e.caller),m(t.accountNonce),P([...t.borrows]),A(t.to,y)])}function B(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function $(e,t){return C(e,"withdraw",[y(e.caller),m(t.accountNonce),P([...t.withdrawals]),A(t.to,y)])}function D(e,t){return $(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[y(e.caller),m(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[y(e.caller),m(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[y(e.caller),_(t.hubId,t.asset),b(t.amount),y(t.receiver),L(t.data)])}function j(e,t){return C(e,"migrate_from_blend",[y(e.caller),m(t.accountId),g(t.spokeId),g(t.hubId),y(t.blendPool),x(t.collateralTokens.map(y)),x(t.supplyTokens.map(y)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,c.xdr.ScVal.scvVec([y(t),b(o)]);var t,o}))))]);var o}function F(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"multiply",[y(e.caller),m(o),g(r),_(t.collateral.hubId,t.collateral.asset),b(t.debtToFlashLoan),_(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[y(e.caller),m(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),b(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[y(e.caller),m(t.accountNonce),_(t.current.hubId,t.current.asset),b(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Z(e,t){return C(e,"repay_debt_with_collateral",[y(e.caller),m(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),b(t.collateralAmount),_(t.debt.hubId,t.debt.asset),M(t.steps),T(t.closePosition)])}const K="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/live-state`,t),oe=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),ue=(e,t={},o)=>{const{hubId:r,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${K}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ae=(e,t,o,r,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}`,n),ie=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/holders`,{...u,params:{side:n}}),le=(e,t,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,o),se=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...r,params:{...o}}),pe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...r,params:{side:o}}),de=(e,t,o)=>e.fetchWithTimeout(`${K}/hubs/${t}`,o),ce=(e,t,o)=>e.fetchWithTimeout(`${K}/spokes/${t}`,o),Se=(e,t,o)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,o),ye=(e,t,o={},r)=>{const{skip:n,top:u}=o;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},be=(e,t,o)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,o),ge=(e,t={},o)=>{const{top:r=J,continuationToken:n}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},me=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...r,params:{...o}}),Te=(e,t,o,r)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...r,params:{...o}}),he=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/graph`,{...u,params:{...n}}),ve=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>oe(e,t),hubs:t=>re(e,t),spokes:t=>ne(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ue(e,t,o):ue(e,{},t);var r},reserve:(t,o,r,n)=>ae(e,t,o,r,n),reserveHolders:(t,o,r,n,u)=>ie(e,t,o,r,n,u),asset:(t,o)=>le(e,t,o),assetMarkets:(t,o,r)=>pe(e,t,o,r),hub:(t,o)=>de(e,t,o),spoke:(t,o)=>ce(e,t,o),userPositions:(t,o)=>Se(e,t,o),userActivity:(t,o,r)=>ye(e,t,o,r),accountPositions:(t,o)=>be(e,t,o),governanceProposals:(t,o)=>ge(e,t,o),assetGraph:(t,o,r)=>me(e,t,o,r),hubGraph:(t,o,r)=>Te(e,t,o,r),spokeGraph:(t,o,r)=>fe(e,t,o,r),reserveGraph:(t,o,r,n,u)=>he(e,t,o,r,n,u)}),xe={Single:0,PrimaryWithAnchor:1},qe="RedStonePriceFeed",Ae=e=>k({base_borrow_rate:b(e.baseBorrowRateRay),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),_e=e=>k({asset_decimals:g(e.assetDecimals),asset_id:y(e.assetId),base_borrow_rate:b(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:T(e.isFlashloanable),max_borrow_rate:b(e.maxBorrowRateRay),max_utilization:b(e.maxUtilizationRay),mid_utilization:b(e.midUtilizationRay),optimal_utilization:b(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:b(e.slope1Ray),slope2:b(e.slope2Ray),slope3:b(e.slope3Ray)}),we=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Pe=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),y(e.value)]);case"Symbol":return x([h("Symbol"),h(e.value)]);case"String":return x([h("String"),f(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},ke=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return x([h("Twap"),g(t)])}return x([h("Spot")])},Re=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([h("Reflector"),k({asset:Pe(e.asset),contract:y(e.contract),read_mode:ke(e.readMode,e.twapRecords)})])}if(t===qe||"XoxnoPriceFeed"===t){const o=t===qe?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${o} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${o} oracle source requires \`maxStaleSeconds\``);return x([h(o),k({contract:y(e.contract),feed_id:f(e.feedId),max_stale_seconds:m(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=xe[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return k({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),Re(o)])),max_price_stale_seconds:m(e.maxPriceStaleSeconds),max_sanity_price_wad:b(e.maxSanityPriceWad),min_sanity_price_wad:b(e.minSanityPriceWad),primary:Re(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ie(e,t){return C(e,"upgrade",[q(t.wasmHash)])}function Oe(e,t){return C(e,"migrate",[g(t.newVersion)])}function Me(e){return C(e,"pause",[])}function Le(e){return C(e,"unpause",[])}function Ce(e,t){return C(e,"grant_role",[y(t.account),h(t.role)])}function Ge(e,t){return C(e,"revoke_role",[y(t.account),h(t.role)])}function Ue(e,t){return C(e,"transfer_ownership",[y(t.newOwner),g(t.liveUntilLedger)])}function Ne(e){return C(e,"accept_ownership",[])}function Be(e,t){return C(e,"set_aggregator",[y(t.aggregator)])}function $e(e,t){return C(e,"set_accumulator",[y(t.accumulator)])}function De(e,t){return C(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function We(e,t){return C(e,"set_position_limits",[we(t)])}function ze(e,t){return C(e,"approve_token",[y(t.token)])}function He(e,t){return C(e,"revoke_token",[y(t.token)])}function Ve(e,t){return C(e,"set_market_oracle_config",[_(t.hubId,t.asset),Ee(t.config)])}function je(e,t){return C(e,"set_oracle_tolerance",[y(t.asset),k({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function Fe(e,t){return C(e,"set_spoke_asset_flags",[g(t.spokeId),_(t.hubId,t.asset),T(t.paused),T(t.frozen)])}function Xe(e,t){return C(e,"set_oracle_sanity_bounds",[y(t.asset),b(t.minPriceWad),b(t.maxPriceWad)])}function Qe(e,t){return C(e,"update_indexes",[y(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return C(e,"renew_account",[y(e.caller),m(t.accountNonce)])}function Ke(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),y(t.asset),_e(t.params)])}function Je(e,t){return C(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),Ae(t.params)])}function Ye(e,t){return C(e,"claim_revenue",[y(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function et(e,t){return C(e,"add_rewards",[y(e.caller),P(t.rewards)])}function tt(e,t){return C(e,"update_account_threshold",[y(e.caller),T(t.hasRisks),x(t.accountNonces.map((e=>m(e))))])}const ot="00".repeat(32),rt=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},nt=(e,...t)=>x([h(e),...t]),ut=e=>k({new_owner:y(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),at=e=>k({asset:y(e.asset),bonus:g(e.bonus),borrow_cap:b(e.borrowCap),can_borrow:T(e.canBorrow),can_collateral:T(e.canCollateral),frozen:T(e.frozen),hub_id:g(e.hubId),paused:T(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:b(e.supplyCap),threshold:g(e.threshold)}),it=e=>k({account:y(e.account),role:h(e.role)});function lt(e,t,o){const r=e.governanceAddress??d(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const st=(e,t,o)=>lt(e,"propose",[y(e.caller),t,rt(o)]),pt=(e,t,o)=>lt(e,"execute_self",[v(),t,rt(o)]);function dt(e,t,o){return st(e,nt("SetAggregator",y(t.aggregator)),o)}function ct(e,t,o){return st(e,nt("SetAccumulator",y(t.accumulator)),o)}function St(e,t,o){return st(e,nt("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function yt(e,t,o){return st(e,nt("SetPositionLimits",we(t)),o)}function bt(e,t){return st(e,nt("CreateHub"),t)}function gt(e,t){return st(e,nt("AddSpoke"),t)}function mt(e,t,o){return st(e,nt("RemoveSpoke",g(t.spokeId)),o)}function Tt(e,t,o){return st(e,nt("AddAssetToSpoke",at(t)),o)}function ft(e,t,o){return st(e,nt("EditAssetInSpoke",at(t)),o)}function ht(e,t,o){return st(e,nt("RemoveAssetFromSpoke",k({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function vt(e,t,o){return st(e,nt("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:b((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(r.liquidationBonusFactorBps),spoke_id:g(r.spokeId),target_hf_wad:b(r.targetHfWad)})),o);var r}function xt(e,t,o){return st(e,nt("SetPositionManager",y(t.manager),T(t.isActive)),o)}function qt(e,t,o){return st(e,nt("SetMinBorrowCollateralUsd",b(t.floorWad)),o)}function At(e,t,o){return st(e,nt("ApproveToken",y(t.token)),o)}function _t(e,t,o){return st(e,nt("RevokeToken",y(t.token)),o)}function wt(e,t,o){return st(e,nt("ApproveBlendPool",y(t.pool)),o)}function Pt(e,t,o){return st(e,nt("RevokeBlendPool",y(t.pool)),o)}function kt(e,t,o){return st(e,nt("CreateLiquidityPool",k({asset:y((r=t).asset),hub_id:g(r.hubId),params:_e(r.params)})),o);var r}function Rt(e,t,o){return st(e,nt("UpgradeLiquidityPoolParams",k({hub_asset:_((r=t).hubId,r.asset),params:Ae(r.params)})),o);var r}function Et(e,t){return st(e,nt("DeployPool"),t)}function It(e,t,o){return st(e,nt("UpgradePool",q(t.wasmHash)),o)}function Ot(e,t,o){return st(e,nt("UpgradeController",q(t.wasmHash)),o)}function Mt(e,t,o){return st(e,nt("MigrateController",g(t.newVersion)),o)}function Lt(e,t,o){return st(e,nt("TransferCtrlOwnership",ut(t)),o)}function Ct(e,t,o){return st(e,nt("ConfigureMarketOracle",k({cfg:Ee((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function Gt(e,t,o){return st(e,nt("EditOracleTolerance",k({asset:y((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Ut(e,t,o){return st(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Nt(e,t,o){return st(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Bt(e,t,o){return st(e,nt("GrantGovRole",it(t)),o)}function $t(e,t,o){return st(e,nt("RevokeGovRole",it(t)),o)}function Dt(e,t,o){return st(e,nt("TransferGovOwnership",ut(t)),o)}function Wt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=rt(t.predecessor??ot);return lt(e,"execute",[v(),y(t.target),h(t.functionName),o,r,rt(t.salt)])}function zt(e,t,o){return pt(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Ht(e,t,o){return pt(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Vt(e,t,o){return pt(e,nt("GrantGovRole",it(t)),o)}function jt(e,t,o){return pt(e,nt("RevokeGovRole",it(t)),o)}function Ft(e,t,o){return pt(e,nt("TransferGovOwnership",ut(t)),o)}function Xt(e,t){return lt(e,"set_spoke_asset_flags",[y(e.caller),g(t.spokeId),_(t.hubId,t.asset),T(t.paused),T(t.frozen)])}function Qt(e,t){return lt(e,"set_oracle_sanity_bounds",[y(e.caller),y(t.asset),b(t.minPriceWad),b(t.maxPriceWad)])}function Zt(e){return lt(e,"create_hub",[y(e.caller)])}function Kt(e){return lt(e,"add_spoke",[y(e.caller)])}function Jt(e,t){return lt(e,"revoke_role_immediate",[y(t.account),h(t.role)])}function Yt(e){return lt(e,"pause",[])}function eo(e){return lt(e,"unpause",[])}const to=e=>e.toXDR("base64"),oo=e=>c.xdr.ScVal.fromXDR(e,"base64"),ro=e=>e.map((e=>String((0,c.scValToNative)(oo(e))))).join(":"),no=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),uo=e=>Number(e),ao=e=>String(e),io=e=>null==e?void 0:no(e),lo=e=>null==e?void 0:ao(e),so=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),po=["None","Multiply","Long","Short"],co=["Single","PrimaryWithAnchor"],So=["ReflectorSep40","RedStonePriceFeed"],yo=["Spot","Twap"],bo=["supply","borrow","withdraw","repay","liq_repay","liq_seize","multiply","param_upd","sw_debt_r","sw_col_wd","rp_col_wd","rp_col_r","close_wd"],go=e=>Array.isArray(e)?e:[],mo=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],bo[uo(r)]??no(r)),positionType:t,hubId:uo(e[1]),asset:ao(e[2]),scaledAmountRay:no(e[3]),indexRay:no(e[4]),amount:no(e[5]),liquidationThresholdBps:o?void 0:uo(e[6]),liquidationBonusBps:o?void 0:uo(e[7]),loanToValueBps:o?void 0:uo(e[8]),liquidationFeesBps:o?void 0:uo(e[9])};var r},To=e=>{return{owner:ao(e[0]),spokeId:uo(e[1]),mode:(t=e[2],po[uo(t)]??"None")};var t},fo=(e,t)=>{const o=yo[uo(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],n=e[`${t}_symbol`],u=null!=r?{kind:"Stellar",value:ao(r)}:null!=n?{kind:"Symbol",value:ao(n)}:void 0;return{provider:So[uo(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:ao(e[`${t}_contract`]),asset:u,feedId:lo(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?uo(e[`${t}_twap_records`]):void 0,decimals:uo(e[`${t}_decimals`]),resolutionSeconds:uo(e[`${t}_resolution_seconds`]),maxStaleSeconds:uo(e[`${t}_max_stale_seconds`])}},ho=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:ao(e.base_token_id),quoteTokenId:ao(e.quote_token_id),tolerance:{upperRatio:uo(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:uo(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:uo(e.asset_decimals),maxPriceStaleSeconds:uo(e.max_price_stale_seconds),strategy:co[uo(e.strategy)]??"Single",primary:fo(e,"primary"),anchor:t?fo(e,"anchor"):void 0,primaryQuoteToken:lo(e.primary_quote_token),anchorQuoteToken:lo(e.anchor_quote_token),minSanityPriceWad:io(e.min_sanity_price_wad),maxSanityPriceWad:io(e.max_sanity_price_wad)}},vo={"market:create":e=>({topic:"market:create",data:{hubId:uo(e.hub_id),baseAsset:ao(e.base_asset),maxBorrowRate:no(e.max_borrow_rate),baseBorrowRate:no(e.base_borrow_rate),slope1:no(e.slope1),slope2:no(e.slope2),slope3:no(e.slope3),midUtilization:no(e.mid_utilization),optimalUtilization:no(e.optimal_utilization),maxUtilization:no(e.max_utilization),reserveFactor:uo(e.reserve_factor),marketAddress:ao(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:ao(e.asset),maxBorrowRateRay:no(e.max_borrow_rate),baseBorrowRateRay:no(e.base_borrow_rate),slope1Ray:no(e.slope1),slope2Ray:no(e.slope2),slope3Ray:no(e.slope3),midUtilizationRay:no(e.mid_utilization),optimalUtilizationRay:no(e.optimal_utilization),maxUtilizationRay:no(e.max_utilization),reserveFactorBps:uo(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:go(e).map((e=>{return t=go(e),{hubId:uo(t[0]),asset:ao(t[1]),timestamp:uo(t[2]),supplyIndexRay:no(t[3]),borrowIndexRay:no(t[4]),cash:no(t[5]),suppliedRay:no(t[6]),borrowedRay:no(t[7]),revenueRay:no(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:go(e).map((e=>{const t=e;return{hubId:uo(t.hub_id),asset:ao(t.asset),params:(o=t.params,{maxBorrowRateRay:no(o.max_borrow_rate),baseBorrowRateRay:no(o.base_borrow_rate),slope1Ray:no(o.slope1),slope2Ray:no(o.slope2),slope3Ray:no(o.slope3),midUtilizationRay:no(o.mid_utilization),optimalUtilizationRay:no(o.optimal_utilization),maxUtilizationRay:no(o.max_utilization),reserveFactorBps:uo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:uo(o.flashloan_fee),assetId:ao(o.asset_id),assetDecimals:uo(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=go(e);return{topic:"position:batch_update",data:{accountId:no(t[0]),accountAttributes:To(go(t[1])),updates:[...go(t[2]).map((e=>mo(go(e),"Deposit"))),...go(t[3]).map((e=>mo(go(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:uo(e.hub_id),asset:ao(e.asset),receiver:ao(e.receiver),caller:ao(e.caller),amount:no(e.amount),fee:no(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:ao(e.asset),oracle:ho(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:ao(e.liquidator),accountId:no(e.account_id),repaidUsdWad:no(e.repaid_usd_wad),bonusBps:no(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:no(e.account_id),totalBorrowUsdWad:no(e.total_borrow_usd_wad),totalCollateralUsdWad:no(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:ao(e.token),amount:no(e.amount),usdValueWad:no(e.usd_value_wad),accountId:no(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:uo(e.hub_id),asset:ao(e.asset),amount:no(e.amount),fee:no(e.fee),amountSent:no(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:so(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:ao(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:ao(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:so(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:uo(e.max_supply_positions),maxBorrowPositions:uo(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:ao(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:uo(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:no(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:no(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:uo(t.liquidation_bonus_factor_bps)}}}},xo=Object.freeze(Object.keys(vo));function qo(e,t){const o=ro(e),r=vo[o];return r?r((0,c.scValToNative)(oo(t))):null}const Ao="XLENDXLM-a7c9f3",_o=1e4;function wo(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${Ao}-${o}`}function Po(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function ko(e,t=0){return e*_o+t}function Ro(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Eo=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},Io=e=>e.baseUrl??i[e.network];async function Oo(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Eo(Io(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),r=await fetch(o,t.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${e}`)}return await r.json()}async function Mo(e){const t=Eo(Io(e),"api/v1/tokens"),o=await fetch(t,e.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${t} — ${e}`)}return await o.json()}const Lo=e=>R(e).toXDR("base64");function Co(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",y(e.caller),b(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Go(e,t){return Co(e,t)}function Uo(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map($o),splitPpm:e.splitPpm}))):[{hops:e.hops.map($o),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function No(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:Uo(e,t)}const Bo=Uo,$o=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Do(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Wo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Do(o.invokedContractId,e);throw e}}async function zo(e,t,o){return Wo(e,t.xdr,o)}function Ho(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Vo(e,t){return new Uint8Array(0)}const jo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function Fo(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(jo(e.message)),c.xdr.ScVal.scvBytes(jo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Xo={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},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 Qo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Xo[o];return r?{code:o,...r}:null}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>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,buildStellarApproveTokenTx:()=>m.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>m.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>m.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>m.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>m.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>m.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>m.buildStellarCreateLiquidityPoolTx,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,buildStellarGovernanceUnpauseTx:()=>m.buildStellarGovernanceUnpauseTx,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,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,buildStellarProposeSetPoolTemplateTx:()=>m.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>m.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>m.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>m.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeTransferCtrlOwnershipTx:()=>m.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>m.buildStellarProposeTransferGovOwnTx,buildStellarProposeUpdateDelayTx:()=>m.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>m.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>m.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>m.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>m.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>m.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>m.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>m.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>m.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>m.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>m.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>m.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>m.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetMarketOracleConfigTx:()=>m.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>m.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>m.buildStellarSetOracleToleranceTx,buildStellarSetPositionLimitsTx:()=>m.buildStellarSetPositionLimitsTx,buildStellarSetSpokeAssetFlagsTx:()=>m.buildStellarSetSpokeAssetFlagsTx,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,encodeInterestRateModel:()=>m.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>m.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>m.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>m.encodeOracleSourceConfigInput,encodePositionLimits:()=>m.encodePositionLimits,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,...o}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,S=p?.Authorization,y="Bearer undefined"===S?void 0:S,b={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...y?{Authorization:y}:{}},g=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),m=`${this.apiUrl}${e}${g.length?`?${g}`:""}`,{revalidate:T,...f}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||y?void 0:h??T,q="GET"!==d||y||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(b).length?{headers:b}:{},cache:q,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",m,A);const _=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})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[m,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const y=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),b={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},g=["PATCH","POST","DELETE","PUT"];var m=o(397);const T=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...o,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!y(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:b,auth:g,method:m,headers:T,cache:f,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...T,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:m,params:q,body:b,headers:_,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,o]of Object.entries(b)){const r=t.split("/").filter(Boolean);let n=e;for(const e of r)if(e.startsWith(":")){const t=T(e.slice(1));n=n.params[t]||=f()}else{const t=T(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:o,def:n}=t.leaves[0];i=h(o,n,r,e)}else{i={};for(const{rawPath:o,def:n}of t.leaves)i[T(o.split("/").pop().replace(/^:/,""))]=h(o,n,r,e)}for(const[e,n]of Object.entries(t.static)){const t=o(n,r);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=o(n,{...r,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],o=(...e)=>t(...e);return Object.assign(o,t)}return u};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();
|
|
1
|
+
"undefined"!=typeof globalThis&&void 0===globalThis.self&&(globalThis.self=globalThis),(()=>{"use strict";var e={397(e,t,o){o.d(t,{STELLAR_AGGREGATOR_ROUTER:()=>n,STELLAR_GOVERNANCE:()=>u,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>ot,STELLAR_LENDING_CONTROLLER:()=>r,STELLAR_LENDING_TOPICS:()=>_o,STELLAR_NETWORK_PASSPHRASE:()=>l,STELLAR_QUOTE_URL:()=>i,STELLAR_SOROBAN_RPC_URL:()=>a,SYNTHETIC_EVENT_ORDER_STRIDE:()=>ko,XOXNO_LENDING_STELLAR_TICKER:()=>Po,buildSameTokenRepaySwapSteps:()=>Xo,buildStellarAcceptOwnershipTx:()=>Ne,buildStellarAddRewardsTx:()=>et,buildStellarApproveTokenTx:()=>ze,buildStellarBatchSwapTx:()=>Bo,buildStellarBorrowBatchTx:()=>N,buildStellarBorrowTx:()=>B,buildStellarCctpForwardTx:()=>Zo,buildStellarClaimRevenueTx:()=>Ye,buildStellarCreateLiquidityPoolTx:()=>Ke,buildStellarExecuteCancellerResetTx:()=>Zt,buildStellarExecuteStrategyTx:()=>No,buildStellarFlashLoanTx:()=>V,buildStellarGovernanceAddSpokeImmediateTx:()=>eo,buildStellarGovernanceCreateHubImmediateTx:()=>Yt,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>zt,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>Vt,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>jt,buildStellarGovernanceExecuteTransferGovOwnTx:()=>Ft,buildStellarGovernanceExecuteTx:()=>Wt,buildStellarGovernanceExecuteUpdateDelayTx:()=>Ht,buildStellarGovernancePauseTx:()=>oo,buildStellarGovernanceRevokeRoleImmediateTx:()=>to,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>Jt,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>Kt,buildStellarGrantRoleTx:()=>Ce,buildStellarLendingIdentifier:()=>Ro,buildStellarLiquidateTx:()=>H,buildStellarMigrateFromBlendTx:()=>j,buildStellarMigrateTx:()=>Oe,buildStellarMultiplyTx:()=>F,buildStellarPauseTx:()=>Me,buildStellarProposeAddAssetToSpokeTx:()=>mt,buildStellarProposeAddSpokeTx:()=>gt,buildStellarProposeApproveBlendPoolTx:()=>wt,buildStellarProposeApproveTokenTx:()=>At,buildStellarProposeCancellerResetTx:()=>Qt,buildStellarProposeConfigureMarketOracleTx:()=>Ct,buildStellarProposeCreateHubTx:()=>yt,buildStellarProposeCreateLiquidityPoolTx:()=>kt,buildStellarProposeDeployPoolTx:()=>Et,buildStellarProposeEditAssetInSpokeTx:()=>ft,buildStellarProposeEditOracleToleranceTx:()=>Ut,buildStellarProposeGovernanceUpgradeTx:()=>Gt,buildStellarProposeGrantGovernanceRoleTx:()=>Bt,buildStellarProposeMigrateControllerTx:()=>Mt,buildStellarProposeRemoveAssetFromSpokeTx:()=>ht,buildStellarProposeRemoveSpokeTx:()=>Tt,buildStellarProposeRevokeBlendPoolTx:()=>Pt,buildStellarProposeRevokeGovernanceRoleTx:()=>$t,buildStellarProposeRevokeTokenTx:()=>_t,buildStellarProposeSetAccumulatorTx:()=>ct,buildStellarProposeSetAggregatorTx:()=>dt,buildStellarProposeSetMinBorrowCollatTx:()=>qt,buildStellarProposeSetPoolTemplateTx:()=>St,buildStellarProposeSetPositionLimitsTx:()=>bt,buildStellarProposeSetPositionManagerTx:()=>xt,buildStellarProposeSetSpokeLiquidationCurveTx:()=>vt,buildStellarProposeTransferCtrlOwnershipTx:()=>Lt,buildStellarProposeTransferGovOwnTx:()=>Dt,buildStellarProposeUnpauseTx:()=>ro,buildStellarProposeUpdateDelayTx:()=>Nt,buildStellarProposeUpgradeControllerTx:()=>Ot,buildStellarProposeUpgradePoolParamsTx:()=>Rt,buildStellarProposeUpgradePoolTx:()=>It,buildStellarRenewAccountTx:()=>Ze,buildStellarRepayBatchTx:()=>W,buildStellarRepayDebtWithCollateralTx:()=>Z,buildStellarRepayTx:()=>z,buildStellarRevokeRoleTx:()=>Ue,buildStellarRevokeTokenTx:()=>He,buildStellarSetAccumulatorTx:()=>$e,buildStellarSetAggregatorTx:()=>Be,buildStellarSetLiquidityPoolTemplateTx:()=>De,buildStellarSetMarketOracleConfigTx:()=>Ve,buildStellarSetOracleSanityBoundsTx:()=>Xe,buildStellarSetOracleToleranceTx:()=>je,buildStellarSetPositionLimitsTx:()=>We,buildStellarSetSpokeAssetFlagsTx:()=>Fe,buildStellarSupplyBatchTx:()=>U,buildStellarSupplyTx:()=>G,buildStellarSwapCollateralTx:()=>Q,buildStellarSwapDebtTx:()=>X,buildStellarTransferOwnershipTx:()=>Ge,buildStellarUnpauseTx:()=>Le,buildStellarUpdateAccountThresholdTx:()=>tt,buildStellarUpdateIndexesTx:()=>Qe,buildStellarUpgradeControllerTx:()=>Ie,buildStellarUpgradeLiquidityPoolParamsTx:()=>Je,buildStellarWithdrawBatchTx:()=>$,buildStellarWithdrawTx:()=>D,buildTx:()=>C,decodeStellarLendingEvent:()=>wo,encodeInterestRateModel:()=>Ae,encodeMarketOracleConfigInput:()=>Ee,encodeMarketParamsRaw:()=>_e,encodeOracleSourceConfigInput:()=>Re,encodePositionLimits:()=>we,encodeStrategyPayloadToRouteXdr:()=>Go,extractEventOrder:()=>Eo,getStellarAccountPositions:()=>ye,getStellarAggregatorQuote:()=>Co,getStellarAggregatorRouter:()=>p,getStellarAsset:()=>le,getStellarAssetGraph:()=>Te,getStellarAssetMarkets:()=>pe,getStellarAssetPage:()=>se,getStellarAssets:()=>oe,getStellarGovernance:()=>d,getStellarGovernanceProposals:()=>ge,getStellarHub:()=>de,getStellarHubGraph:()=>me,getStellarHubs:()=>re,getStellarLendingContext:()=>ee,getStellarLendingController:()=>s,getStellarLendingLiveState:()=>te,getStellarQuoteTokens:()=>Uo,getStellarReserve:()=>ae,getStellarReserveGraph:()=>he,getStellarReserveHolders:()=>ie,getStellarReserves:()=>ue,getStellarSpoke:()=>ce,getStellarSpokeGraph:()=>fe,getStellarSpokes:()=>ne,getStellarUserActivity:()=>be,getStellarUserPositions:()=>Se,mapQuoteResponseToAggregatorSwap:()=>Wo,mapQuoteResponseToStrategyPayload:()=>$o,mapQuoteResponseToStrategySwap:()=>Do,mapSorobanError:()=>Jo,mapStellarPositionActivityType:()=>Oo,prepareStellarBuiltTx:()=>jo,prepareStellarTxXdr:()=>Vo,stellarLendingDispatchKey:()=>ao,stellarLendingRead:()=>ve,syntheticEventOrder:()=>Io,tagStellarInvokedContractError:()=>Ho,toBase64Xdr:()=>no,toStellarPositionMode:()=>Fo});const r={mainnet:process.env.STELLAR_LENDING_CONTROLLER_MAINNET??"",testnet:process.env.STELLAR_LENDING_CONTROLLER_TESTNET??""},n={mainnet:process.env.STELLAR_AGGREGATOR_ROUTER_MAINNET??"",testnet:process.env.STELLAR_AGGREGATOR_ROUTER_TESTNET??""},u={mainnet:process.env.STELLAR_GOVERNANCE_MAINNET??"",testnet:process.env.STELLAR_GOVERNANCE_TESTNET??""},a={mainnet:"https://soroban-rpc.stellar.org",testnet:"https://soroban-testnet.stellar.org"},i={mainnet:process.env.STELLAR_QUOTE_URL_MAINNET??"https://stellar-swap.xoxno.com",testnet:process.env.STELLAR_QUOTE_URL_TESTNET??"https://testnet-stellar-swap.xoxno.com"},l={mainnet:"Public Global Stellar Network ; September 2015",testnet:"Test SDF Network ; September 2015"};function s(e){const t=r[e];if(!t)throw new Error(`Stellar lending controller address not configured for network "${e}". Set STELLAR_LENDING_CONTROLLER_${e.toUpperCase()} env var.`);return t}function p(e){const t=n[e];if(!t)throw new Error(`Stellar aggregator router address not configured for network "${e}". Set STELLAR_AGGREGATOR_ROUTER_${e.toUpperCase()} env var.`);return t}function d(e){const t=u[e];if(!t)throw new Error(`Stellar governance address not configured for network "${e}". Set STELLAR_GOVERNANCE_${e.toUpperCase()} env var.`);return t}const c=require("@stellar/stellar-sdk"),S=["Soroswap","Aquarius","Phoenix","Sushi","CometDex"],b=e=>new c.Address(e).toScVal(),y=e=>new c.ScInt(e).toI128(),g=e=>c.xdr.ScVal.scvU32(e),T=e=>new c.ScInt("string"==typeof e?e:e.toString()).toU64(),m=e=>c.xdr.ScVal.scvBool(e),f=e=>c.xdr.ScVal.scvString(e),h=e=>c.xdr.ScVal.scvSymbol(e),v=()=>c.xdr.ScVal.scvVoid(),x=e=>c.xdr.ScVal.scvVec(e),q=(e,t=32)=>{const o=e.startsWith("0x")?e.slice(2):e,r=Buffer.from(o,"hex");if(r.length!==t)throw new Error(`Stellar builder: expected a ${t}-byte BytesN (got ${r.length} bytes from "${e}")`);return c.xdr.ScVal.scvBytes(r)},A=(e,t)=>null==e?v():t(e),_=(e,t)=>k({asset:b(t),hub_id:g(e)}),w=(e,t,o)=>c.xdr.ScVal.scvVec([_(e,t),y(o)]),P=e=>c.xdr.ScVal.scvVec(e.map((e=>w(e.hubId,e.asset,e.amount)))),k=e=>{const t=Object.keys(e).sort().map((t=>new c.xdr.ScMapEntry({key:h(t),val:e[t]})));return c.xdr.ScVal.scvMap(t)},R=e=>{const t=e.paths.map((e=>{const t=e.hops.map((e=>{return k({amount_out:y(e.amountOut),pool:b(e.pool),token_in:b(e.tokenIn),token_out:b(e.tokenOut),venue:(t=e.venue,c.xdr.ScVal.scvVec([h(t)]))});var t}));return k({hops:c.xdr.ScVal.scvVec(t),split_ppm:g(e.splitPpm)})}));return k({paths:c.xdr.ScVal.scvVec(t),referral_id:T(e.referralId??0),token_in:b(e.tokenIn),token_out:b(e.tokenOut),total_min_out:y(e.totalMinOut)})},E=e=>{const t=Buffer.from(e);if(0===t.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return c.xdr.ScVal.scvBytes(t)},I=()=>c.xdr.ScVal.scvBytes(Buffer.alloc(0)),O=e=>{const t=e.trim();if(t.startsWith("0x")){const e=t.slice(2);if(!((o=e).length>0&&o.length%2==0&&/^[0-9a-fA-F]+$/.test(o)))throw new Error("Stellar builder: strategy swap bytes hex string must be 0x-prefixed and even-length");return Buffer.from(e,"hex")}var o;if(!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Stellar builder: strategy swap bytes must be base64 routeXdr or 0x-prefixed hex");const r=Buffer.from(t,"base64");if(0===r.length)throw new Error("Stellar builder: strategy swap bytes must be non-empty base64 routeXdr, 0x hex string, or Uint8Array");return r},M=e=>{if("string"==typeof e)return E(O(e));if(e instanceof Uint8Array)return 0===e.length?I():E(e);if(e&&"object"==typeof e)return"routeXdr"in(o=e)&&"string"==typeof o.routeXdr?E(O(e.routeXdr)):(e=>"swapXdr"in e&&"string"==typeof e.swapXdr)(e)?E(O(e.swapXdr)):(e=>"bytes"in e&&("string"==typeof e.bytes||e.bytes instanceof Uint8Array))(e)?"string"==typeof e.bytes?E(O(e.bytes)):0===e.bytes.length?I():E(e.bytes):(t=(e=>{if(!e||"object"!=typeof e)throw new Error("Stellar builder: decoded strategy `steps` must be a StrategyPayload ({ paths, tokenIn, tokenOut, totalMinOut })");const t=e;if(!Array.isArray(t.paths)||0===t.paths.length)throw new Error("Stellar builder: `steps.paths` must be a non-empty array of strategy paths");if("string"!=typeof t.tokenIn)throw new Error("Stellar builder: `steps.tokenIn` must be a contract address");if("string"!=typeof t.tokenOut)throw new Error("Stellar builder: `steps.tokenOut` must be a contract address");if("string"!=typeof t.totalMinOut)throw new Error("Stellar builder: `steps.totalMinOut` must be an i128 decimal string");let o=0;for(const[e,r]of t.paths.entries()){if(!r||"number"!=typeof r.splitPpm||r.splitPpm<=0||!Array.isArray(r.hops)||0===r.hops.length)throw new Error(`Stellar builder: \`steps.paths[${e}]\` must have splitPpm > 0 and a non-empty hops array`);o+=r.splitPpm;for(const[t,o]of r.hops.entries())if(!o||"string"!=typeof o.amountOut||"string"!=typeof o.pool||"string"!=typeof o.tokenIn||"string"!=typeof o.tokenOut||!S.includes(o.venue))throw new Error(`Stellar builder: \`steps.paths[${e}].hops[${t}]\` must have amountOut, pool, tokenIn, tokenOut, and a valid Soroban venue`)}if(1e6!==o)throw new Error(`Stellar builder: \`steps.paths[].splitPpm\` must sum to 1_000_000, got ${o}`);return t})(e),c.xdr.ScVal.scvBytes(Buffer.from(R(t).toXDR("base64"),"base64")));var t,o;throw new Error("Stellar builder: `steps` must be opaque strategy bytes (`routeXdr`, base64/hex string, or Uint8Array)")},L=e=>{if("string"==typeof e)return(e=>{const t=e.startsWith("0x")?e.slice(2):e,o=Buffer.from(t,"hex");return c.xdr.ScVal.scvBytes(o)})(e);if(e instanceof Uint8Array)return c.xdr.ScVal.scvBytes(Buffer.from(e));throw new Error("Stellar builder: `data` must be a hex string or Uint8Array (Soroban Bytes payload)")};function C(e,t,o){const r=e.controllerAddress??s(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function U(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"supply",[b(e.caller),T(o),g(r),P([...t.assets])])}function G(e,t){return U(e,{accountNonce:t.accountNonce,spokeId:t.spokeId,assets:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function N(e,t){return C(e,"borrow",[b(e.caller),T(t.accountNonce),P([...t.borrows]),A(t.to,b)])}function B(e,t){return N(e,{accountNonce:t.accountNonce,borrows:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function $(e,t){return C(e,"withdraw",[b(e.caller),T(t.accountNonce),P([...t.withdrawals]),A(t.to,b)])}function D(e,t){return $(e,{accountNonce:t.accountNonce,withdrawals:[{hubId:t.hubId,asset:t.asset,amount:t.amount}],to:t.to})}function W(e,t){return C(e,"repay",[b(e.caller),T(t.accountNonce),P([...t.payments])])}function z(e,t){return W(e,{accountNonce:t.accountNonce,payments:[{hubId:t.hubId,asset:t.asset,amount:t.amount}]})}function H(e,t){return C(e,"liquidate",[b(e.caller),T(t.accountNonce),P([...t.debtPayments])])}function V(e,t){return C(e,"flash_loan",[b(e.caller),_(t.hubId,t.asset),y(t.amount),b(t.receiver),L(t.data)])}function j(e,t){return C(e,"migrate_from_blend",[b(e.caller),T(t.accountId),g(t.spokeId),g(t.hubId),b(t.blendPool),x(t.collateralTokens.map(b)),x(t.supplyTokens.map(b)),(o=t.debtCaps.map((e=>({token:e.token,amount:e.cap}))),c.xdr.ScVal.scvVec(o.map((e=>{return t=e.token,o=e.amount,c.xdr.ScVal.scvVec([b(t),y(o)]);var t,o}))))]);var o}function F(e,t){const o=t.accountNonce??0,r=t.spokeId??0;return C(e,"multiply",[b(e.caller),T(o),g(r),_(t.collateral.hubId,t.collateral.asset),y(t.debtToFlashLoan),_(t.debt.hubId,t.debt.asset),g(t.mode),M(t.steps),A(t.initialPayment,(e=>w(e.hubId,e.asset,e.amount))),A(t.convertSwap,M)])}function X(e,t){return C(e,"swap_debt",[b(e.caller),T(t.accountNonce),_(t.existingDebt.hubId,t.existingDebt.asset),y(t.newDebtAmount),_(t.newDebt.hubId,t.newDebt.asset),M(t.steps)])}function Q(e,t){return C(e,"swap_collateral",[b(e.caller),T(t.accountNonce),_(t.current.hubId,t.current.asset),y(t.fromAmount),_(t.newCollateral.hubId,t.newCollateral.asset),M(t.steps)])}function Z(e,t){return C(e,"repay_debt_with_collateral",[b(e.caller),T(t.accountNonce),_(t.collateral.hubId,t.collateral.asset),y(t.collateralAmount),_(t.debt.hubId,t.debt.asset),M(t.steps),m(t.closePosition)])}const K="/stellar-lending",J=25,Y=encodeURIComponent,ee=(e,t)=>e.fetchWithTimeout(`${K}/context`,t),te=(e,t)=>e.fetchWithTimeout(`${K}/live-state`,t),oe=(e,t)=>e.fetchWithTimeout(`${K}/assets`,t),re=(e,t)=>e.fetchWithTimeout(`${K}/hubs`,t),ne=(e,t)=>e.fetchWithTimeout(`${K}/spokes`,t),ue=(e,t={},o)=>{const{hubId:r,spokeId:n,asset:u}=t;return e.fetchWithTimeout(`${K}/reserves`,{...o,params:{...void 0!==r?{hubId:r}:{},...void 0!==n?{spokeId:n}:{},...u?{asset:u}:{}}})},ae=(e,t,o,r,n)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}`,n),ie=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/holders`,{...u,params:{side:n}}),le=(e,t,o)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}`,o),se=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/page`,{...r,params:{...o}}),pe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/markets`,{...r,params:{side:o}}),de=(e,t,o)=>e.fetchWithTimeout(`${K}/hubs/${t}`,o),ce=(e,t,o)=>e.fetchWithTimeout(`${K}/spokes/${t}`,o),Se=(e,t,o)=>e.fetchWithTimeout(`${K}/users/${Y(t)}/positions`,o),be=(e,t,o={},r)=>{const{skip:n,top:u}=o;return e.fetchWithTimeout(`${K}/users/${Y(t)}/activity`,{...r,params:{...void 0!==n?{skip:n}:{},...void 0!==u?{top:u}:{}}})},ye=(e,t,o)=>e.fetchWithTimeout(`${K}/accounts/${Y(t)}/positions`,o),ge=(e,t={},o)=>{const{top:r=J,continuationToken:n}=t;return e.fetchWithTimeout(`${K}/governance/proposals`,{...o,params:{top:r,...n?{continuationToken:n}:{}}})},Te=(e,t,o,r)=>e.fetchWithTimeout(`${K}/assets/${Y(t)}/graph`,{...r,params:{...o}}),me=(e,t,o,r)=>e.fetchWithTimeout(`${K}/hubs/${t}/graph`,{...r,params:{...o}}),fe=(e,t,o,r)=>e.fetchWithTimeout(`${K}/spokes/${t}/graph`,{...r,params:{...o}}),he=(e,t,o,r,n,u)=>e.fetchWithTimeout(`${K}/reserves/${t}/${o}/${Y(r)}/graph`,{...u,params:{...n}}),ve=e=>({context:t=>ee(e,t),liveState:t=>te(e,t),assets:t=>oe(e,t),hubs:t=>re(e,t),spokes:t=>ne(e,t),reserves:(t,o)=>{return void 0===(r=t)||"hubId"in r||"spokeId"in r||"asset"in r?ue(e,t,o):ue(e,{},t);var r},reserve:(t,o,r,n)=>ae(e,t,o,r,n),reserveHolders:(t,o,r,n,u)=>ie(e,t,o,r,n,u),asset:(t,o)=>le(e,t,o),assetMarkets:(t,o,r)=>pe(e,t,o,r),hub:(t,o)=>de(e,t,o),spoke:(t,o)=>ce(e,t,o),userPositions:(t,o)=>Se(e,t,o),userActivity:(t,o,r)=>be(e,t,o,r),accountPositions:(t,o)=>ye(e,t,o),governanceProposals:(t,o)=>ge(e,t,o),assetGraph:(t,o,r)=>Te(e,t,o,r),hubGraph:(t,o,r)=>me(e,t,o,r),spokeGraph:(t,o,r)=>fe(e,t,o,r),reserveGraph:(t,o,r,n,u)=>he(e,t,o,r,n,u)}),xe={Single:0,PrimaryWithAnchor:1},qe="RedStonePriceFeed",Ae=e=>k({base_borrow_rate:y(e.baseBorrowRateRay),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),_e=e=>k({asset_decimals:g(e.assetDecimals),asset_id:b(e.assetId),base_borrow_rate:y(e.baseBorrowRateRay),flashloan_fee:g(e.flashloanFeeBps),is_flashloanable:m(e.isFlashloanable),max_borrow_rate:y(e.maxBorrowRateRay),max_utilization:y(e.maxUtilizationRay),mid_utilization:y(e.midUtilizationRay),optimal_utilization:y(e.optimalUtilizationRay),reserve_factor:g(e.reserveFactorBps),slope1:y(e.slope1Ray),slope2:y(e.slope2Ray),slope3:y(e.slope3Ray)}),we=e=>k({max_borrow_positions:g(e.maxBorrowPositions),max_supply_positions:g(e.maxSupplyPositions)}),Pe=e=>{const t=e.kind;switch(t){case"Stellar":return x([h("Stellar"),b(e.value)]);case"Symbol":return x([h("Symbol"),h(e.value)]);case"String":return x([h("String"),f(e.value)]);default:throw new Error(`Stellar builder: unknown oracle asset ref kind "${t}"`)}},ke=(e,t)=>{if("Twap"===e){if("number"!=typeof t)throw new Error("Stellar builder: oracle source with Twap read mode requires `twapRecords`");return x([h("Twap"),g(t)])}return x([h("Spot")])},Re=e=>{const t=e.provider;if("ReflectorSep40"===t){if(!e.asset)throw new Error("Stellar builder: Reflector oracle source requires `asset`");return x([h("Reflector"),k({asset:Pe(e.asset),contract:b(e.contract),read_mode:ke(e.readMode,e.twapRecords)})])}if(t===qe||"XoxnoPriceFeed"===t){const o=t===qe?"RedStone":"Xoxno";if("string"!=typeof e.feedId)throw new Error(`Stellar builder: ${o} oracle source requires \`feedId\``);if("number"!=typeof e.maxStaleSeconds)throw new Error(`Stellar builder: ${o} oracle source requires \`maxStaleSeconds\``);return x([h(o),k({contract:b(e.contract),feed_id:f(e.feedId),max_stale_seconds:T(e.maxStaleSeconds)})])}throw new Error(`Stellar builder: unknown oracle provider "${t}"`)},Ee=e=>{const t=xe[e.strategy];if(void 0===t)throw new Error(`Stellar builder: unknown oracle strategy "${e.strategy}"`);return k({anchor:(o=e.anchor,x(null==o?[h("None")]:[h("Some"),Re(o)])),max_price_stale_seconds:T(e.maxPriceStaleSeconds),max_sanity_price_wad:y(e.maxSanityPriceWad),min_sanity_price_wad:y(e.minSanityPriceWad),primary:Re(e.primary),strategy:g(t),tolerance_bps:g(e.toleranceBps)});var o};function Ie(e,t){return C(e,"upgrade",[q(t.wasmHash)])}function Oe(e,t){return C(e,"migrate",[g(t.newVersion)])}function Me(e){return C(e,"pause",[])}function Le(e){return C(e,"unpause",[])}function Ce(e,t){return C(e,"grant_role",[b(t.account),h(t.role)])}function Ue(e,t){return C(e,"revoke_role",[b(t.account),h(t.role)])}function Ge(e,t){return C(e,"transfer_ownership",[b(t.newOwner),g(t.liveUntilLedger)])}function Ne(e){return C(e,"accept_ownership",[])}function Be(e,t){return C(e,"set_aggregator",[b(t.aggregator)])}function $e(e,t){return C(e,"set_accumulator",[b(t.accumulator)])}function De(e,t){return C(e,"set_liquidity_pool_template",[q(t.wasmHash)])}function We(e,t){return C(e,"set_position_limits",[we(t)])}function ze(e,t){return C(e,"approve_token",[b(t.token)])}function He(e,t){return C(e,"revoke_token",[b(t.token)])}function Ve(e,t){return C(e,"set_market_oracle_config",[_(t.hubId,t.asset),Ee(t.config)])}function je(e,t){return C(e,"set_oracle_tolerance",[b(t.asset),k({lower_ratio_bps:g(t.lowerRatioBps),upper_ratio_bps:g(t.upperRatioBps)})])}function Fe(e,t){return C(e,"set_spoke_asset_flags",[g(t.spokeId),_(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function Xe(e,t){return C(e,"set_oracle_sanity_bounds",[b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function Qe(e,t){return C(e,"update_indexes",[b(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function Ze(e,t){return C(e,"renew_account",[b(e.caller),T(t.accountNonce)])}function Ke(e,t){return C(e,"create_liquidity_pool",[g(t.hubId),b(t.asset),_e(t.params)])}function Je(e,t){return C(e,"upgrade_liquidity_pool_params",[_(t.hubId,t.asset),Ae(t.params)])}function Ye(e,t){return C(e,"claim_revenue",[b(e.caller),x(t.assets.map((e=>_(e.hubId,e.asset))))])}function et(e,t){return C(e,"add_rewards",[b(e.caller),P(t.rewards)])}function tt(e,t){return C(e,"update_account_threshold",[b(e.caller),m(t.hasRisks),x(t.accountNonces.map((e=>T(e))))])}const ot="00".repeat(32),rt=e=>{if("string"==typeof e)return q(e);const t=Buffer.from(e);if(32!==t.length)throw new Error(`Stellar governance builder: expected a 32-byte salt (got ${t.length} bytes)`);return c.xdr.ScVal.scvBytes(t)},nt=(e,...t)=>x([h(e),...t]),ut=e=>k({new_owner:b(e.newOwner),live_until_ledger:g(e.liveUntilLedger)}),at=e=>k({asset:b(e.asset),bonus:g(e.bonus),borrow_cap:y(e.borrowCap),can_borrow:m(e.canBorrow),can_collateral:m(e.canCollateral),frozen:m(e.frozen),hub_id:g(e.hubId),paused:m(e.paused),liquidation_fees:g(e.liquidationFees),ltv:g(e.ltv),oracle_override:x([h("None")]),spoke_id:g(e.spokeId),supply_cap:y(e.supplyCap),threshold:g(e.threshold)}),it=e=>k({account:b(e.account),role:h(e.role)});function lt(e,t,o){const r=e.governanceAddress??d(e.network),n=new c.Contract(r),u=new c.Account(e.caller,e.sourceSequence);return{xdr:new c.TransactionBuilder(u,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(n.call(t,...o)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}const st=(e,t,o)=>lt(e,"propose",[b(e.caller),t,rt(o)]),pt=(e,t,o)=>lt(e,"execute_self",[v(),t,rt(o)]);function dt(e,t,o){return st(e,nt("SetAggregator",b(t.aggregator)),o)}function ct(e,t,o){return st(e,nt("SetAccumulator",b(t.accumulator)),o)}function St(e,t,o){return st(e,nt("SetLiquidityPoolTemplate",q(t.wasmHash)),o)}function bt(e,t,o){return st(e,nt("SetPositionLimits",we(t)),o)}function yt(e,t){return st(e,nt("CreateHub"),t)}function gt(e,t){return st(e,nt("AddSpoke"),t)}function Tt(e,t,o){return st(e,nt("RemoveSpoke",g(t.spokeId)),o)}function mt(e,t,o){return st(e,nt("AddAssetToSpoke",at(t)),o)}function ft(e,t,o){return st(e,nt("EditAssetInSpoke",at(t)),o)}function ht(e,t,o){return st(e,nt("RemoveAssetFromSpoke",k({hub_asset:_((r=t).hubId,r.asset),spoke_id:g(r.spokeId)})),o);var r}function vt(e,t,o){return st(e,nt("SetSpokeLiquidationCurve",k({hf_for_max_bonus_wad:y((r=t).hfForMaxBonusWad),liquidation_bonus_factor_bps:g(r.liquidationBonusFactorBps),spoke_id:g(r.spokeId),target_hf_wad:y(r.targetHfWad)})),o);var r}function xt(e,t,o){return st(e,nt("SetPositionManager",b(t.manager),m(t.isActive)),o)}function qt(e,t,o){return st(e,nt("SetMinBorrowCollateralUsd",y(t.floorWad)),o)}function At(e,t,o){return st(e,nt("ApproveToken",b(t.token)),o)}function _t(e,t,o){return st(e,nt("RevokeToken",b(t.token)),o)}function wt(e,t,o){return st(e,nt("ApproveBlendPool",b(t.pool)),o)}function Pt(e,t,o){return st(e,nt("RevokeBlendPool",b(t.pool)),o)}function kt(e,t,o){return st(e,nt("CreateLiquidityPool",k({asset:b((r=t).asset),hub_id:g(r.hubId),params:_e(r.params)})),o);var r}function Rt(e,t,o){return st(e,nt("UpgradeLiquidityPoolParams",k({hub_asset:_((r=t).hubId,r.asset),params:Ae(r.params)})),o);var r}function Et(e,t){return st(e,nt("DeployPool"),t)}function It(e,t,o){return st(e,nt("UpgradePool",q(t.wasmHash)),o)}function Ot(e,t,o){return st(e,nt("UpgradeController",q(t.wasmHash)),o)}function Mt(e,t,o){return st(e,nt("MigrateController",g(t.newVersion)),o)}function Lt(e,t,o){return st(e,nt("TransferCtrlOwnership",ut(t)),o)}function Ct(e,t,o){return st(e,nt("ConfigureMarketOracle",k({cfg:Ee((r=t).config),hub_asset:_(r.hubId,r.asset)})),o);var r}function Ut(e,t,o){return st(e,nt("EditOracleTolerance",k({asset:b((r=t).asset),tolerance:g(r.tolerance)})),o);var r}function Gt(e,t,o){return st(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Nt(e,t,o){return st(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Bt(e,t,o){return st(e,nt("GrantGovRole",it(t)),o)}function $t(e,t,o){return st(e,nt("RevokeGovRole",it(t)),o)}function Dt(e,t,o){return st(e,nt("TransferGovOwnership",ut(t)),o)}function Wt(e,t){const o=x(t.argsXdr.map((e=>c.xdr.ScVal.fromXDR(e,"base64")))),r=rt(t.predecessor??ot);return lt(e,"execute",[v(),b(t.target),h(t.functionName),o,r,rt(t.salt)])}function zt(e,t,o){return pt(e,nt("UpgradeGov",q(t.wasmHash)),o)}function Ht(e,t,o){return pt(e,nt("UpdateGovDelay",g(t.newDelay)),o)}function Vt(e,t,o){return pt(e,nt("GrantGovRole",it(t)),o)}function jt(e,t,o){return pt(e,nt("RevokeGovRole",it(t)),o)}function Ft(e,t,o){return pt(e,nt("TransferGovOwnership",ut(t)),o)}const Xt=e=>x(e.map(b));function Qt(e,t,o){return lt(e,"propose_canceller_reset",[Xt(t.newCancellers),rt(o)])}function Zt(e,t,o){return lt(e,"execute_canceller_reset",[A(t.executor,b),Xt(t.newCancellers),rt(o)])}function Kt(e,t){return lt(e,"set_spoke_asset_flags",[b(e.caller),g(t.spokeId),_(t.hubId,t.asset),m(t.paused),m(t.frozen)])}function Jt(e,t){return lt(e,"set_oracle_sanity_bounds",[b(e.caller),b(t.asset),y(t.minPriceWad),y(t.maxPriceWad)])}function Yt(e){return lt(e,"create_hub",[b(e.caller)])}function eo(e){return lt(e,"add_spoke",[b(e.caller)])}function to(e,t){return lt(e,"revoke_role_immediate",[b(t.account),h(t.role)])}function oo(e){return lt(e,"pause",[b(e.caller)])}function ro(e,t){return st(e,nt("Unpause"),t)}const no=e=>e.toXDR("base64"),uo=e=>c.xdr.ScVal.fromXDR(e,"base64"),ao=e=>e.map((e=>String((0,c.scValToNative)(uo(e))))).join(":"),io=e=>"bigint"==typeof e||"number"==typeof e?e.toString():String(e),lo=e=>Number(e),so=e=>String(e),po=e=>null==e?void 0:io(e),co=e=>null==e?void 0:so(e),So=e=>e instanceof Uint8Array?Buffer.from(e).toString("hex"):Buffer.isBuffer(e)?e.toString("hex"):String(e),bo=["None","Multiply","Long","Short"],yo=["Single","PrimaryWithAnchor"],go=["ReflectorSep40","RedStonePriceFeed"],To=["Spot","Twap"],mo=["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"],fo=e=>Array.isArray(e)?e:[],ho=(e,t)=>{const o="Borrow"===t;return{action:(r=e[0],mo[lo(r)]??io(r)),positionType:t,hubId:lo(e[1]),asset:so(e[2]),scaledAmountRay:io(e[3]),indexRay:io(e[4]),amount:io(e[5]),liquidationThresholdBps:o?void 0:lo(e[6]),liquidationBonusBps:o?void 0:lo(e[7]),loanToValueBps:o?void 0:lo(e[8]),liquidationFeesBps:o?void 0:lo(e[9])};var r},vo=e=>{return{owner:so(e[0]),spokeId:lo(e[1]),mode:(t=e[2],bo[lo(t)]??"None")};var t},xo=(e,t)=>{const o=To[lo(e[`${t}_read_mode`])]??"Spot",r=e[`${t}_asset`],n=e[`${t}_symbol`],u=null!=r?{kind:"Stellar",value:so(r)}:null!=n?{kind:"Symbol",value:so(n)}:void 0;return{provider:go[lo(e[`${t}_provider`])]??"ReflectorSep40",contractAddress:so(e[`${t}_contract`]),asset:u,feedId:co(e[`${t}_feed_id`]),readMode:o,twapRecords:"Twap"===o?lo(e[`${t}_twap_records`]):void 0,decimals:lo(e[`${t}_decimals`]),resolutionSeconds:lo(e[`${t}_resolution_seconds`]),maxStaleSeconds:lo(e[`${t}_max_stale_seconds`])}},qo=e=>{const t=null!==e.anchor_provider&&void 0!==e.anchor_provider;return{baseTokenId:so(e.base_token_id),quoteTokenId:so(e.quote_token_id),tolerance:{upperRatio:lo(e.upper_ratio_bps??e.tolerance?.upper_ratio_bps),lowerRatio:lo(e.lower_ratio_bps??e.tolerance?.lower_ratio_bps)},assetDecimals:lo(e.asset_decimals),maxPriceStaleSeconds:lo(e.max_price_stale_seconds),strategy:yo[lo(e.strategy)]??"Single",primary:xo(e,"primary"),anchor:t?xo(e,"anchor"):void 0,primaryQuoteToken:co(e.primary_quote_token),anchorQuoteToken:co(e.anchor_quote_token),minSanityPriceWad:po(e.min_sanity_price_wad),maxSanityPriceWad:po(e.max_sanity_price_wad)}},Ao={"market:create":e=>({topic:"market:create",data:{hubId:lo(e.hub_id),baseAsset:so(e.base_asset),maxBorrowRate:io(e.max_borrow_rate),baseBorrowRate:io(e.base_borrow_rate),slope1:io(e.slope1),slope2:io(e.slope2),slope3:io(e.slope3),midUtilization:io(e.mid_utilization),optimalUtilization:io(e.optimal_utilization),maxUtilization:io(e.max_utilization),reserveFactor:lo(e.reserve_factor),marketAddress:so(e.market_address)}}),"market:params_update":e=>({topic:"market:params_update",data:{asset:so(e.asset),maxBorrowRateRay:io(e.max_borrow_rate),baseBorrowRateRay:io(e.base_borrow_rate),slope1Ray:io(e.slope1),slope2Ray:io(e.slope2),slope3Ray:io(e.slope3),midUtilizationRay:io(e.mid_utilization),optimalUtilizationRay:io(e.optimal_utilization),maxUtilizationRay:io(e.max_utilization),reserveFactorBps:lo(e.reserve_factor)}}),"market:batch_state_update":e=>({topic:"market:batch_state_update",data:{updates:fo(e).map((e=>{return t=fo(e),{hubId:lo(t[0]),asset:so(t[1]),timestamp:lo(t[2]),supplyIndexRay:io(t[3]),borrowIndexRay:io(t[4]),cash:io(t[5]),suppliedRay:io(t[6]),borrowedRay:io(t[7]),revenueRay:io(t[8])};var t}))}}),"market:batch_params_update":e=>({topic:"market:batch_params_update",data:{updates:fo(e).map((e=>{const t=e;return{hubId:lo(t.hub_id),asset:so(t.asset),params:(o=t.params,{maxBorrowRateRay:io(o.max_borrow_rate),baseBorrowRateRay:io(o.base_borrow_rate),slope1Ray:io(o.slope1),slope2Ray:io(o.slope2),slope3Ray:io(o.slope3),midUtilizationRay:io(o.mid_utilization),optimalUtilizationRay:io(o.optimal_utilization),maxUtilizationRay:io(o.max_utilization),reserveFactorBps:lo(o.reserve_factor),isFlashloanable:Boolean(o.is_flashloanable),flashloanFeeBps:lo(o.flashloan_fee),assetId:so(o.asset_id),assetDecimals:lo(o.asset_decimals)})};var o}))}}),"position:batch_update":e=>{const t=fo(e);return{topic:"position:batch_update",data:{accountId:io(t[0]),accountAttributes:vo(fo(t[1])),updates:[...fo(t[2]).map((e=>ho(fo(e),"Deposit"))),...fo(t[3]).map((e=>ho(fo(e),"Borrow")))]}}},"position:flash_loan":e=>({topic:"position:flash_loan",data:{hubId:lo(e.hub_id),asset:so(e.asset),receiver:so(e.receiver),caller:so(e.caller),amount:io(e.amount),fee:io(e.fee)}}),"config:oracle":e=>({topic:"config:oracle",data:{asset:so(e.asset),oracle:qo(e.oracle)}}),"position:liquidation":e=>({topic:"position:liquidation",data:{liquidator:so(e.liquidator),accountId:io(e.account_id),repaidUsdWad:io(e.repaid_usd_wad),bonusBps:io(e.bonus_bps)}}),"debt:bad_debt":e=>({topic:"debt:bad_debt",data:{accountId:io(e.account_id),totalBorrowUsdWad:io(e.total_borrow_usd_wad),totalCollateralUsdWad:io(e.total_collateral_usd_wad)}}),"strategy:initial_payment":e=>({topic:"strategy:initial_payment",data:{token:so(e.token),amount:io(e.amount),usdValueWad:io(e.usd_value_wad),accountId:io(e.account_id)}}),"strategy:fee":e=>({topic:"strategy:fee",data:{hubId:lo(e.hub_id),asset:so(e.asset),amount:io(e.amount),fee:io(e.fee),amountSent:io(e.amount_sent)}}),"config:approve_token":e=>({topic:"config:approve_token",data:{wasmHash:So(e.wasm_hash),approved:Boolean(e.approved)}}),"config:aggregator":e=>({topic:"config:aggregator",data:{aggregator:so(e.aggregator)}}),"config:accumulator":e=>({topic:"config:accumulator",data:{accumulator:so(e.accumulator)}}),"config:pool_template":e=>({topic:"config:pool_template",data:{wasmHash:So(e.wasm_hash)}}),"config:position_limits":e=>({topic:"config:position_limits",data:{maxSupplyPositions:lo(e.max_supply_positions),maxBorrowPositions:lo(e.max_borrow_positions)}}),"config:oracle_disabled":e=>({topic:"config:oracle_disabled",data:{asset:so(e.asset)}}),"config:spoke":e=>{const t=e.spoke;return{topic:"config:spoke",data:{spokeId:lo(t.spoke_id),isDeprecated:Boolean(t.is_deprecated),liquidationTargetHfWad:io(t.liquidation_target_hf_wad),healthFactorForMaxBonusWad:io(t.hf_for_max_bonus_wad),liquidationBonusFactorBps:lo(t.liquidation_bonus_factor_bps)}}}},_o=Object.freeze(Object.keys(Ao));function wo(e,t){const o=ao(e),r=Ao[o];return r?r((0,c.scValToNative)(uo(t))):null}const Po="XLENDXLM-a7c9f3",ko=1e4;function Ro(e){const t=BigInt(e).toString(16),o=t.length%2==0?t:`0${t}`;return`${Po}-${o}`}function Eo(e){const t=e.split("-");return t.length>=2&&parseInt(t[1],10)||0}function Io(e,t=0){return e*ko+t}function Oo(e){switch(e){case"liq_repay":return"lendingLiquidateRepayDebt";case"liq_seize":return"lendingLiquidateSeizeCollateral";case"param_upd":return"lendingUpdateAccountParameters";default:return"lendingUpdateAccountPosition"}}const Mo=(e,t,o)=>{const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(o)for(const[e,t]of Object.entries(o))void 0!==t&&r.searchParams.set(e,String(t));return r.toString()},Lo=e=>e.baseUrl??i[e.network];async function Co(e,t){if(null==e.amountIn==(null==e.amountOut))throw new Error("getStellarAggregatorQuote: exactly one of `amountIn` or `amountOut` must be provided");const o=Mo(Lo(t),"api/v1/quote",{from:e.from,to:e.to,amountIn:e.amountIn,amountOut:e.amountOut,maxHops:e.maxHops,maxSplits:e.maxSplits,slippage:e.slippage,includePaths:e.includePaths,sender:e.sender,router:e.router,platform:e.platform,fresh:e.fresh}),r=await fetch(o,t.fetchOptions);if(!r.ok){const e=await r.text().catch((()=>""));throw new Error(`Stellar quote server responded ${r.status} ${r.statusText} for ${o} — ${e}`)}return await r.json()}async function Uo(e){const t=Mo(Lo(e),"api/v1/tokens"),o=await fetch(t,e.fetchOptions);if(!o.ok){const e=await o.text().catch((()=>""));throw new Error(`Stellar quote server responded ${o.status} ${o.statusText} for ${t} — ${e}`)}return await o.json()}const Go=e=>R(e).toXDR("base64");function No(e,t){const o=e.routerAddress??p(e.network),r=new c.Contract(o),n=new c.Account(e.caller,e.sourceSequence),u=M(((e,t)=>(e=>Boolean(e&&"object"==typeof e&&!(e instanceof Uint8Array)&&"paths"in e))(e)&&void 0===e.referralId?{...e,referralId:t??0}:e)(t,e.referralId));return{xdr:new c.TransactionBuilder(n,{fee:e.fee??c.BASE_FEE,networkPassphrase:l[e.network]}).addOperation(r.call("execute_strategy",b(e.caller),y(e.totalIn),u)).setTimeout(e.timeoutSeconds??300).build().toXDR()}}function Bo(e,t){return No(e,t)}function $o(e,t={}){if("string"!=typeof e.amountOutMin)throw new Error("mapQuoteResponseToStrategyPayload: quote response is missing `amountOutMin`. Pass `slippage` when fetching the quote.");return{paths:e.paths?e.paths.map((e=>({hops:e.swaps.map(zo),splitPpm:e.splitPpm}))):[{hops:e.hops.map(zo),splitPpm:1e6}],referralId:t.referralId??0,tokenIn:e.from,tokenOut:e.to,totalMinOut:e.amountOutMin}}function Do(e,t={}){const o=e;return"string"==typeof o.routeXdr&&o.routeXdr.length>0?{routeXdr:o.routeXdr}:$o(e,t)}const Wo=$o,zo=e=>({amountOut:e.amountOut,pool:e.address,tokenIn:e.from,tokenOut:e.to,venue:e.dex});function Ho(e,t){const o=t instanceof Error?t.message:String(t);return new Error(`[xoxno-invoked:${e}] ${o}`)}async function Vo(e,t,o){const r=c.TransactionBuilder.fromXDR(t,"base64");try{return(await e.prepareTransaction(r)).toXDR()}catch(e){if(o?.invokedContractId)throw Ho(o.invokedContractId,e);throw e}}async function jo(e,t,o){return Vo(e,t.xdr,o)}function Fo(e){if(e<=0||e>4)throw new Error(`Invalid PositionMode ${e} for Stellar — expected 1 (Normal) through 4 (Short). "None" (0) has no Stellar equivalent.`);return e-1}function Xo(e,t){return new Uint8Array(0)}const Qo=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!=0)throw new Error("buildStellarCctpForwardTx: hex input must have even length");return Buffer.from(t,"hex")};function Zo(e){const t=new c.Account(e.caller,e.sourceSequence),o=new c.Contract(e.forwarderAddress).call("mint_and_forward",c.xdr.ScVal.scvBytes(Qo(e.message)),c.xdr.ScVal.scvBytes(Qo(e.attestation)));return{xdr:new c.TransactionBuilder(t,{fee:e.fee??"10000000",networkPassphrase:l[e.network]}).addOperation(o).setTimeout(e.timeoutSeconds??120).build().toXDR()}}const Ko={1:{name:"AssetNotSupported",message:"This asset is not supported by the protocol."},2:{name:"AssetAlreadySupported",message:"This asset is already supported."},3:{name:"InvalidTicker",message:"Invalid asset ticker."},6:{name:"InvalidAsset",message:"Invalid asset address."},10:{name:"InvalidPoolTemplate",message:"The liquidity pool template hash is invalid."},11:{name:"InvalidExchangeSrc",message:"The oracle configuration is invalid."},12:{name:"PairNotActive",message:"No oracle is configured for this asset."},32:{name:"OwnerNotSet",message:"The contract owner has not been set."},39:{name:"InvalidTimelockDelay",message:"The timelock delay is out of the allowed range."},41:{name:"InvalidRole",message:"The caller does not hold the required role."},43:{name:"HubNotActive",message:"This hub is not active."},44:{name:"NotAuthorized",message:"The caller is not authorized to perform this action."},46:{name:"OperationNotCancellable",message:"This governance operation cannot be cancelled."},113:{name:"InvalidLiqThreshold",message:"LTV, liquidation threshold, or bonus is out of bounds."},116:{name:"InvalidBorrowParams",message:"Supply or borrow cap configuration is invalid."},117:{name:"InvalidUtilRange",message:"Interest-rate utilization breakpoints are invalid."},132:{name:"AssetDecimalsTooHigh",message:"Asset decimals exceed the protocol maximum (27)."},300:{name:"SpokeNotFound",message:"This spoke does not exist."},301:{name:"SpokeDeprecated",message:"This spoke has been deprecated."},307:{name:"AssetNotInSpoke",message:"This asset is not listed on the spoke."},308:{name:"AssetAlreadyInSpoke",message:"This asset is already listed in the spoke."},309:{name:"SpokeAssetInUse",message:"This spoke asset still has live positions; drain usage before removal."},315:{name:"SpokeAssetPaused",message:"This spoke asset is paused."},316:{name:"SpokeAssetFrozen",message:"This spoke asset is frozen."},317:{name:"SpokeAssetFlagRelaxation",message:"Guardian flag updates may only tighten; clearing a flag requires the timelocked edit."},220:{name:"InvalidOracleBase",message:"The oracle quote asset/market is missing or invalid."},221:{name:"InvalidOracleDecimals",message:"The oracle decimals value is invalid."},224:{name:"InvalidSanityBounds",message:"Oracle sanity bounds are invalid (require 0 < min < max)."},225:{name:"OracleCycleDetected",message:"A cycle was detected in the oracle quote chain."}};function Jo(e){const t=e.match(/Error\(Contract,\s*#(\d+)\)/);if(!t)return null;const o=Number(t[1]),r=Ko[o];return r?{code:o,...r}:null}}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Chain:()=>l,STELLAR_AGGREGATOR_ROUTER:()=>T.STELLAR_AGGREGATOR_ROUTER,STELLAR_GOVERNANCE:()=>T.STELLAR_GOVERNANCE,STELLAR_GOVERNANCE_ZERO_PREDECESSOR:()=>T.STELLAR_GOVERNANCE_ZERO_PREDECESSOR,STELLAR_LENDING_CONTROLLER:()=>T.STELLAR_LENDING_CONTROLLER,STELLAR_LENDING_TOPICS:()=>T.STELLAR_LENDING_TOPICS,STELLAR_NETWORK_PASSPHRASE:()=>T.STELLAR_NETWORK_PASSPHRASE,STELLAR_QUOTE_URL:()=>T.STELLAR_QUOTE_URL,STELLAR_SOROBAN_RPC_URL:()=>T.STELLAR_SOROBAN_RPC_URL,SYNTHETIC_EVENT_ORDER_STRIDE:()=>T.SYNTHETIC_EVENT_ORDER_STRIDE,XOXNOClient:()=>s,XOXNO_LENDING_STELLAR_TICKER:()=>T.XOXNO_LENDING_STELLAR_TICKER,buildSameTokenRepaySwapSteps:()=>T.buildSameTokenRepaySwapSteps,buildSdk:()=>v,buildStellarAcceptOwnershipTx:()=>T.buildStellarAcceptOwnershipTx,buildStellarAddRewardsTx:()=>T.buildStellarAddRewardsTx,buildStellarApproveTokenTx:()=>T.buildStellarApproveTokenTx,buildStellarBatchSwapTx:()=>T.buildStellarBatchSwapTx,buildStellarBorrowBatchTx:()=>T.buildStellarBorrowBatchTx,buildStellarBorrowTx:()=>T.buildStellarBorrowTx,buildStellarCctpForwardTx:()=>T.buildStellarCctpForwardTx,buildStellarClaimRevenueTx:()=>T.buildStellarClaimRevenueTx,buildStellarCreateLiquidityPoolTx:()=>T.buildStellarCreateLiquidityPoolTx,buildStellarExecuteCancellerResetTx:()=>T.buildStellarExecuteCancellerResetTx,buildStellarExecuteStrategyTx:()=>T.buildStellarExecuteStrategyTx,buildStellarFlashLoanTx:()=>T.buildStellarFlashLoanTx,buildStellarGovernanceAddSpokeImmediateTx:()=>T.buildStellarGovernanceAddSpokeImmediateTx,buildStellarGovernanceCreateHubImmediateTx:()=>T.buildStellarGovernanceCreateHubImmediateTx,buildStellarGovernanceExecuteGovernanceUpgradeTx:()=>T.buildStellarGovernanceExecuteGovernanceUpgradeTx,buildStellarGovernanceExecuteGrantGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteGrantGovernanceRoleTx,buildStellarGovernanceExecuteRevokeGovernanceRoleTx:()=>T.buildStellarGovernanceExecuteRevokeGovernanceRoleTx,buildStellarGovernanceExecuteTransferGovOwnTx:()=>T.buildStellarGovernanceExecuteTransferGovOwnTx,buildStellarGovernanceExecuteTx:()=>T.buildStellarGovernanceExecuteTx,buildStellarGovernanceExecuteUpdateDelayTx:()=>T.buildStellarGovernanceExecuteUpdateDelayTx,buildStellarGovernancePauseTx:()=>T.buildStellarGovernancePauseTx,buildStellarGovernanceRevokeRoleImmediateTx:()=>T.buildStellarGovernanceRevokeRoleImmediateTx,buildStellarGovernanceSetOracleSanityBoundsImmediateTx:()=>T.buildStellarGovernanceSetOracleSanityBoundsImmediateTx,buildStellarGovernanceSetSpokeAssetFlagsImmediateTx:()=>T.buildStellarGovernanceSetSpokeAssetFlagsImmediateTx,buildStellarGrantRoleTx:()=>T.buildStellarGrantRoleTx,buildStellarLendingIdentifier:()=>T.buildStellarLendingIdentifier,buildStellarLiquidateTx:()=>T.buildStellarLiquidateTx,buildStellarMigrateFromBlendTx:()=>T.buildStellarMigrateFromBlendTx,buildStellarMigrateTx:()=>T.buildStellarMigrateTx,buildStellarMultiplyTx:()=>T.buildStellarMultiplyTx,buildStellarPauseTx:()=>T.buildStellarPauseTx,buildStellarProposeAddAssetToSpokeTx:()=>T.buildStellarProposeAddAssetToSpokeTx,buildStellarProposeAddSpokeTx:()=>T.buildStellarProposeAddSpokeTx,buildStellarProposeApproveBlendPoolTx:()=>T.buildStellarProposeApproveBlendPoolTx,buildStellarProposeApproveTokenTx:()=>T.buildStellarProposeApproveTokenTx,buildStellarProposeCancellerResetTx:()=>T.buildStellarProposeCancellerResetTx,buildStellarProposeConfigureMarketOracleTx:()=>T.buildStellarProposeConfigureMarketOracleTx,buildStellarProposeCreateHubTx:()=>T.buildStellarProposeCreateHubTx,buildStellarProposeCreateLiquidityPoolTx:()=>T.buildStellarProposeCreateLiquidityPoolTx,buildStellarProposeDeployPoolTx:()=>T.buildStellarProposeDeployPoolTx,buildStellarProposeEditAssetInSpokeTx:()=>T.buildStellarProposeEditAssetInSpokeTx,buildStellarProposeEditOracleToleranceTx:()=>T.buildStellarProposeEditOracleToleranceTx,buildStellarProposeGovernanceUpgradeTx:()=>T.buildStellarProposeGovernanceUpgradeTx,buildStellarProposeGrantGovernanceRoleTx:()=>T.buildStellarProposeGrantGovernanceRoleTx,buildStellarProposeMigrateControllerTx:()=>T.buildStellarProposeMigrateControllerTx,buildStellarProposeRemoveAssetFromSpokeTx:()=>T.buildStellarProposeRemoveAssetFromSpokeTx,buildStellarProposeRemoveSpokeTx:()=>T.buildStellarProposeRemoveSpokeTx,buildStellarProposeRevokeBlendPoolTx:()=>T.buildStellarProposeRevokeBlendPoolTx,buildStellarProposeRevokeGovernanceRoleTx:()=>T.buildStellarProposeRevokeGovernanceRoleTx,buildStellarProposeRevokeTokenTx:()=>T.buildStellarProposeRevokeTokenTx,buildStellarProposeSetAccumulatorTx:()=>T.buildStellarProposeSetAccumulatorTx,buildStellarProposeSetAggregatorTx:()=>T.buildStellarProposeSetAggregatorTx,buildStellarProposeSetMinBorrowCollatTx:()=>T.buildStellarProposeSetMinBorrowCollatTx,buildStellarProposeSetPoolTemplateTx:()=>T.buildStellarProposeSetPoolTemplateTx,buildStellarProposeSetPositionLimitsTx:()=>T.buildStellarProposeSetPositionLimitsTx,buildStellarProposeSetPositionManagerTx:()=>T.buildStellarProposeSetPositionManagerTx,buildStellarProposeSetSpokeLiquidationCurveTx:()=>T.buildStellarProposeSetSpokeLiquidationCurveTx,buildStellarProposeTransferCtrlOwnershipTx:()=>T.buildStellarProposeTransferCtrlOwnershipTx,buildStellarProposeTransferGovOwnTx:()=>T.buildStellarProposeTransferGovOwnTx,buildStellarProposeUnpauseTx:()=>T.buildStellarProposeUnpauseTx,buildStellarProposeUpdateDelayTx:()=>T.buildStellarProposeUpdateDelayTx,buildStellarProposeUpgradeControllerTx:()=>T.buildStellarProposeUpgradeControllerTx,buildStellarProposeUpgradePoolParamsTx:()=>T.buildStellarProposeUpgradePoolParamsTx,buildStellarProposeUpgradePoolTx:()=>T.buildStellarProposeUpgradePoolTx,buildStellarRenewAccountTx:()=>T.buildStellarRenewAccountTx,buildStellarRepayBatchTx:()=>T.buildStellarRepayBatchTx,buildStellarRepayDebtWithCollateralTx:()=>T.buildStellarRepayDebtWithCollateralTx,buildStellarRepayTx:()=>T.buildStellarRepayTx,buildStellarRevokeRoleTx:()=>T.buildStellarRevokeRoleTx,buildStellarRevokeTokenTx:()=>T.buildStellarRevokeTokenTx,buildStellarSetAccumulatorTx:()=>T.buildStellarSetAccumulatorTx,buildStellarSetAggregatorTx:()=>T.buildStellarSetAggregatorTx,buildStellarSetLiquidityPoolTemplateTx:()=>T.buildStellarSetLiquidityPoolTemplateTx,buildStellarSetMarketOracleConfigTx:()=>T.buildStellarSetMarketOracleConfigTx,buildStellarSetOracleSanityBoundsTx:()=>T.buildStellarSetOracleSanityBoundsTx,buildStellarSetOracleToleranceTx:()=>T.buildStellarSetOracleToleranceTx,buildStellarSetPositionLimitsTx:()=>T.buildStellarSetPositionLimitsTx,buildStellarSetSpokeAssetFlagsTx:()=>T.buildStellarSetSpokeAssetFlagsTx,buildStellarSupplyBatchTx:()=>T.buildStellarSupplyBatchTx,buildStellarSupplyTx:()=>T.buildStellarSupplyTx,buildStellarSwapCollateralTx:()=>T.buildStellarSwapCollateralTx,buildStellarSwapDebtTx:()=>T.buildStellarSwapDebtTx,buildStellarTransferOwnershipTx:()=>T.buildStellarTransferOwnershipTx,buildStellarUnpauseTx:()=>T.buildStellarUnpauseTx,buildStellarUpdateAccountThresholdTx:()=>T.buildStellarUpdateAccountThresholdTx,buildStellarUpdateIndexesTx:()=>T.buildStellarUpdateIndexesTx,buildStellarUpgradeControllerTx:()=>T.buildStellarUpgradeControllerTx,buildStellarUpgradeLiquidityPoolParamsTx:()=>T.buildStellarUpgradeLiquidityPoolParamsTx,buildStellarWithdrawBatchTx:()=>T.buildStellarWithdrawBatchTx,buildStellarWithdrawTx:()=>T.buildStellarWithdrawTx,buildTx:()=>T.buildTx,decodeStellarLendingEvent:()=>T.decodeStellarLendingEvent,encodeInterestRateModel:()=>T.encodeInterestRateModel,encodeMarketOracleConfigInput:()=>T.encodeMarketOracleConfigInput,encodeMarketParamsRaw:()=>T.encodeMarketParamsRaw,encodeOracleSourceConfigInput:()=>T.encodeOracleSourceConfigInput,encodePositionLimits:()=>T.encodePositionLimits,encodeStrategyPayloadToRouteXdr:()=>T.encodeStrategyPayloadToRouteXdr,extractEventOrder:()=>T.extractEventOrder,getStellarAccountPositions:()=>T.getStellarAccountPositions,getStellarAggregatorQuote:()=>T.getStellarAggregatorQuote,getStellarAggregatorRouter:()=>T.getStellarAggregatorRouter,getStellarAsset:()=>T.getStellarAsset,getStellarAssetGraph:()=>T.getStellarAssetGraph,getStellarAssetMarkets:()=>T.getStellarAssetMarkets,getStellarAssetPage:()=>T.getStellarAssetPage,getStellarAssets:()=>T.getStellarAssets,getStellarGovernance:()=>T.getStellarGovernance,getStellarGovernanceProposals:()=>T.getStellarGovernanceProposals,getStellarHub:()=>T.getStellarHub,getStellarHubGraph:()=>T.getStellarHubGraph,getStellarHubs:()=>T.getStellarHubs,getStellarLendingContext:()=>T.getStellarLendingContext,getStellarLendingController:()=>T.getStellarLendingController,getStellarLendingLiveState:()=>T.getStellarLendingLiveState,getStellarQuoteTokens:()=>T.getStellarQuoteTokens,getStellarReserve:()=>T.getStellarReserve,getStellarReserveGraph:()=>T.getStellarReserveGraph,getStellarReserveHolders:()=>T.getStellarReserveHolders,getStellarReserves:()=>T.getStellarReserves,getStellarSpoke:()=>T.getStellarSpoke,getStellarSpokeGraph:()=>T.getStellarSpokeGraph,getStellarSpokes:()=>T.getStellarSpokes,getStellarUserActivity:()=>T.getStellarUserActivity,getStellarUserPositions:()=>T.getStellarUserPositions,isValidCollectionTicker:()=>p,isValidNftIdentifier:()=>d,mapQuoteResponseToAggregatorSwap:()=>T.mapQuoteResponseToAggregatorSwap,mapQuoteResponseToStrategyPayload:()=>T.mapQuoteResponseToStrategyPayload,mapQuoteResponseToStrategySwap:()=>T.mapQuoteResponseToStrategySwap,mapSorobanError:()=>T.mapSorobanError,mapStellarPositionActivityType:()=>T.mapStellarPositionActivityType,prepareStellarBuiltTx:()=>T.prepareStellarBuiltTx,prepareStellarTxXdr:()=>T.prepareStellarTxXdr,stellarLendingDispatchKey:()=>T.stellarLendingDispatchKey,stellarLendingRead:()=>T.stellarLendingRead,syntheticEventOrder:()=>T.syntheticEventOrder,tagStellarInvokedContractError:()=>T.tagStellarInvokedContractError,toBase64Xdr:()=>T.toBase64Xdr,toStellarPositionMode:()=>T.toStellarPositionMode});const n="https://api.xoxno.com",u="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",a="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",i="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var l;!function(e){e.MAINNET="1",e.DEVNET="D"}(l||(l={}));class s{apiUrl;chain;init;config;constructor({chain:e=l.MAINNET,apiUrl:t=n,...o}={}){this.apiUrl=t??{[l.MAINNET]:n,[l.DEVNET]:"https://devnet-api.xoxno.com"}[e],this.chain=e,this.init=o,this.config=e==l.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:u,DR_SC:a,KG_SC:i,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}fetchWithTimeout=async(e,{params:t,...o}={})=>{const{next:r,cache:n,debug:u,...a}=this.init,{next:i,cache:l,debug:s,headers:p,method:d="GET",...c}=o,S=p?.Authorization,b="Bearer undefined"===S?void 0:S,y={...p,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."PUT"===d?{}:{"Content-Type":"application/json"},...b?{Authorization:b}:{}},g=Object.entries(t??{}).flatMap((([e,t])=>Array.isArray(t)?t.map((t=>`${e}=${encodeURIComponent(t)}`)):`${e}=${encodeURIComponent(t)}`)).join("&"),T=`${this.apiUrl}${e}${g.length?`?${g}`:""}`,{revalidate:m,...f}=r??{},{revalidate:h,...v}=i??{},x="GET"!==d||b?void 0:h??m,q="GET"!==d||b||x?void 0:l??n,A={...a,...c,method:d,...Object.keys(y).length?{headers:y}:{},cache:q,next:{...f,...v,revalidate:x}};(s??u)&&console.debug("SDK fetch: ",T,A);const _=await fetch(T,A).catch((e=>{if(e instanceof Error&&!e.message.match(/^http(s?):\/\//))throw Object.assign(new Error(`${T}: ${e.message}`),{cause:e});throw e})),w=await _.text();if(!_.ok){let e;try{e=JSON.parse(w)}catch{e={message:w}}const t=[T,_.status,_.statusText,e.message].filter(Boolean).join(";;");throw new Error(t)}try{return JSON.parse(w)}catch{return w}}}const p=e=>{const t=/^0x[a-fA-F0-9]{1,64}-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+(<.+>)?$/.test(decodeURIComponent(e)),o=/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);return t||o},d=e=>{const t=/^0x[a-fA-F0-9]{1,64}$/.test(e),o=/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,7}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(e);return t||o};class c extends Error{constructor(e){super(`Invalid collection ticker: ${e}`)}}class S extends Error{constructor(e){super(`Invalid address: ${e}`)}}Error,Error;const b=e=>!!e&&(e.startsWith("erd1")&&62===e.length||/^0x[a-fA-F0-9]{40,64}$/.test(e)||/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)||/^G[A-Z2-7]{55}$/.test(e)),y={"/liquid/xoxno/rate":{input:{},output:{}},"/liquid/xoxno/liquid-supply":{input:{},output:{}},"/liquid/xoxno/staked":{input:{},output:{}},"/user/login":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/network-account":{input:{},output:{}},"/user/:address/token-inventory":{input:{},output:{}},"/user/network-account":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/me/profile":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me":{input:{},output:{},securityMode:"requiredAny"},"/user/me/settings":{input:{},output:{},securityMode:"optionalAny"},"/user/me/settings/notification-preferences":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"optionalAny"}},"/user/me/settings/email":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredJwt"}},"/user/me/settings/phone":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/billing":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/me/settings/verify-email":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/buy/signature":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:tag/creator/is-registered":{input:{},output:{}},"/user/:address/creator/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/creator/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/collections":{input:{},output:{}},"/user/favorite/:favoriteId":{input:{},output:{},securityMode:"requiredAny"},"/user/:address/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/favorite/users":{input:{},output:{}},"/tokens":{input:{},output:{}},"/tokens/swap":{input:{},output:{}},"/stellar/tokens":{input:{},output:{}},"/tokens/restricted":{input:{},output:{}},"/tokens/usd-price":{input:{},output:{}},"/tokens/egld/fiat-price":{input:{},output:{}},"/tokens/xoxno/info":{input:{},output:{}},"/liquid/xoxno/stats":{input:{},output:{}},"/liquid/egld/stats":{input:{},output:{}},"/liquid/sui/stats":{input:{},output:{}},"/analytics/marketplace-unique-users":{input:{},output:{}},"/liquid/egld/rate":{input:{},output:{}},"/liquid/egld/liquid-supply":{input:{},output:{}},"/liquid/egld/staked":{input:{},output:{}},"/liquid/egld/pending-fees":{input:{},output:{}},"/liquid/egld/pending-undelegate":{input:{},output:{}},"/liquid/egld/pending-delegate":{input:{},output:{}},"/liquid/egld/execute-delegate":{input:{},output:{}},"/liquid/egld/execute-undelegate":{input:{},output:{}},"/liquid/egld/execute-undelegate-providers":{input:{},output:{}},"/liquid/egld/protocol-apr":{input:{},output:{}},"/liquid/egld/providers":{input:{},output:{}},"/user/:address/delegation":{input:{},output:{}},"/lending/market/:token/profile":{input:{},output:{}},"/lending/market/query":{input:{},output:{}},"/lending/governance/proposals":{input:{},output:{}},"/lending/governance/proposal/:id":{input:{},output:{}},"/user/lending/:address":{input:{},output:{}},"/lending/market/indexes":{input:{},output:{}},"/user/lending/position/:identifier":{input:{},output:{}},"/lending/pnl":{input:{},output:{}},"/user/lending/pnl/:address":{input:{},output:{}},"/user/lending/summary/:identifier":{input:{},output:{}},"/user/lending/image/:nonce":{input:{},output:{}},"/lending/market/emode-categories":{input:{},output:{}},"/lending/market/:token/emode-categories":{input:{},output:{}},"/lending/market/:token/analytics":{input:{},output:{}},"/lending/stats/history":{input:{},output:{}},"/lending/market/:token/average":{input:{},output:{}},"/lending/leaderboard":{input:{},output:{}},"/lending/leaderboard/liquidate":{input:{},output:{}},"/lending/leaderboard/clean-bad-debt":{input:{},output:{}},"/lending/stats":{input:{},output:{}},"/lending/market/prices":{input:{},output:{}},"/nft/query":{input:{},output:{}},"/nft/:identifier/like":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/inventory-summary":{input:{},output:{}},"/user/:address/offers":{input:{},output:{}},"/nft/offer/query":{input:{},output:{}},"/nft/offer/:identifier":{input:{},output:{}},"/user/:address/favorite/nfts":{input:{},output:{}},"/collection/:collection/attributes":{input:{},output:{}},"/nft/:identifier/offers":{input:{},output:{}},"/collection/:collection/ranks":{input:{},output:{}},"/collection/:collection/listings":{input:{},output:{}},"/nft/pinned":{input:{},output:{}},"/nft/sign-withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-offer":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/sign-mint":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/nft/:identifier":{input:{},output:{}},"/collection/:collection/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/floor-price":{input:{},output:{}},"/collection/floor-price":{input:{},output:{}},"/collection/pinned":{input:{},output:{}},"/collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned-drops":{input:{},output:{}},"/collection/:collection/pinned":{input:{},output:{}},"/collection/:collection/follow":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/query":{input:{},output:{}},"/collection/drops/query":{input:{},output:{}},"/collection/:collection/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:creatorTag/:collectionTag/drop-info":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/upload-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/reset-banner":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/collection/:collection/holders":{input:{},output:{}},"/collection/:collection/holders/export":{input:{},output:{}},"/collection/:collection/owner":{input:{},output:{}},"/collection/:collection/stats":{input:{},output:{}},"/collection/stats/query":{input:{},output:{}},"/collection/global-offer/query":{input:{},output:{}},"/user/:address/creator/listing":{input:{},output:{}},"/user/:address/creator/details":{input:{},output:{}},"/launchpad/:scAddress/shareholders/royalties":{input:{},output:{}},"/launchpad/:scAddress/shareholders/collection/:collectionTag":{input:{},output:{}},"/pool/:poolId/profile":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/pool/:poolId/whitelist":{input:{},output:{}},"/pool/:poolId/upload-picture":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/:address/staking/available-pools":{input:{},output:{}},"/user/:address/staking/owned-collections":{input:{},output:{}},"/user/:address/staking/owned-pools":{input:{},output:{}},"/user/:address/staking/summary":{input:{},output:{}},"/user/:address/staking/creator":{input:{},output:{}},"/user/:address/staking/collection/:collection":{input:{},output:{}},"/user/:address/staking/pool/:poolId/nfts":{input:{},output:{}},"/collection/:collection/staking/summary":{input:{},output:{},securityMode:"optionalAny"},"/collection/:collection/staking/delegators":{input:{},output:{}},"/collection/staking/explore":{input:{},output:{}},"/user/:creatorTag/owned-services":{input:{},output:{}},"/search":{input:{},output:{}},"/user/search":{input:{},output:{}},"/collection/search":{input:{},output:{}},"/collection/drops/search":{input:{},output:{}},"/nft/search/query":{input:{},output:{}},"/lending/market-sc":{input:{},output:{}},"/lending/active-accounts":{input:{},output:{}},"/lending/account/:nonce/attributes":{input:{},output:{}},"/lending/account/:nonce/positions":{input:{},output:{}},"/lending/market/:token/price/egld":{input:{},output:{}},"/faucet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/stellar-lending/assets":{input:{},output:{}},"/stellar-lending/context":{input:{},output:{}},"/stellar-lending/live-state":{input:{},output:{}},"/stellar-lending/hubs":{input:{},output:{}},"/stellar-lending/spokes":{input:{},output:{}},"/stellar-lending/reserves":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/holders":{input:{},output:{}},"/stellar-lending/hubs/:hubId/holders":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/holders":{input:{},output:{}},"/stellar-lending/assets/:asset":{input:{},output:{}},"/stellar-lending/assets/:asset/page":{input:{},output:{}},"/stellar-lending/assets/:asset/markets":{input:{},output:{}},"/stellar-lending/hubs/:hubId":{input:{},output:{}},"/stellar-lending/spokes/:spokeId":{input:{},output:{}},"/stellar-lending/users/:owner/positions":{input:{},output:{}},"/stellar-lending/users/:owner/activity":{input:{},output:{}},"/stellar-lending/accounts/:accountId/positions":{input:{},output:{}},"/stellar-lending/governance/proposals":{input:{},output:{}},"/stellar-lending/assets/:asset/graph":{input:{},output:{}},"/stellar-lending/hubs/:hubId/graph":{input:{},output:{}},"/stellar-lending/spokes/:spokeId/graph":{input:{},output:{}},"/stellar-lending/reserves/:spokeId/:hubId/:asset/graph":{input:{},output:{}},"/stellar-lending/stats/history":{input:{},output:{}},"/stellar-lending/pnl":{input:{},output:{}},"/stellar-lending/positions":{input:{},output:{}},"/stellar-lending/users/:accountId/history":{input:{},output:{}},"/stellar-lending/pnl/scope":{input:{},output:{}},"/stellar-lending/revenue":{input:{},output:{}},"/stellar-lending/revenue/fees":{input:{},output:{}},"/stellar-lending/participants":{input:{},output:{}},"/stellar-lending/liquidations":{input:{},output:{}},"/stellar-lending/liquidations/leaderboard":{input:{},output:{}},"/stellar-lending/volume":{input:{},output:{}},"/stellar-lending/active-users":{input:{},output:{}},"/stellar-lending/distribution":{input:{},output:{}},"/stellar-lending/rate-spread":{input:{},output:{}},"/stellar-lending/defillama":{input:{},output:{}},"/user/notifications":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/user/notifications/clear":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/notifications/read":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/device/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/device/:deviceId":{input:{},output:{},securityMode:"requiredWeb2",DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/mobile/history":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/unread-count":{input:{},output:{},securityMode:"requiredAny"},"/mobile/history/:notificationId/read":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/read-all":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-all":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/mobile/history/clear-id/:notificationId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/update":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/event/:eventId/reminder":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/creator/marketing":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/eventNotifications/user/:userId/direct":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/stellar/challenge":{input:{},output:{}},"/user/native-token":{input:{},output:{}},"/user/web2":{input:{},output:{},securityMode:"requiredWeb2"},"/user/web2/session-cookie":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-switch":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/wallet-link":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/:index/wallet-link":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredWeb2"}},"/user/web2/shards":{input:{},output:{},securityMode:"requiredWeb2"},"/activity/query":{input:{},output:{}},"/activity/:identifier":{input:{},output:{}},"/analytics/volume":{input:{},output:{}},"/collection/:collection/analytics/volume":{input:{},output:{}},"/collections/analytics/volume":{input:{},output:{}},"/user/:address/analytics/volume":{input:{},output:{}},"/analytics/overview":{input:{},output:{}},"/user/stats":{input:{},output:{}},"/user/xoxno-drop":{input:{},output:{}},"/user/me/xoxno-drop":{input:{},output:{},securityMode:"requiredAny"},"/transactions/:txHash":{input:{},output:{}},"/transactions/:txHash/status":{input:{},output:{}},"/transaction/cost":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/transactions/batch":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/chat/message":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId":{input:{},output:{},securityMode:"requiredAny",DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/conversation-summary":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/conversation/:conversationId/message/:messageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/block":{input:{},output:{},securityMode:"requiredAny"},"/user/chat/block/:address":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/chat/token":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/hatom/user/:address":{input:{},output:{}},"/countries":{input:{},output:{}},"/event":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId":{input:{},output:{},securityMode:"optionalAny",PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/profile/query":{input:{},output:{}},"/event/:eventId/profile":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/background":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image":{input:{},output:{},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/description/image/:imageId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/register":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/ticket/:ticketId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},PUT:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{}}},"/event/:eventId/stage":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/stage/:stageId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/calculate-prices":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/event/:eventId/validate-discount":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/user/:address/creator/events":{input:{},output:{},securityMode:"optionalAny"},"/event/:eventId/invite":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/invite/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/invite/:inviteId":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/questions":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/question":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/question/:questionId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest/query":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest-export":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/role":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},securityMode:"requiredAny"},"/event/:eventId/role/:roleId":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/guest":{input:{},output:{},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/roleOf/:address":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/past":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/hosted":{input:{},output:{},securityMode:"requiredAny"},"/user/me/events/upcoming":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge":{input:{},output:{},securityMode:"requiredAny"},"/user/me/event/badge/payload":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/scan":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/voucher/:voucherCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/manual-check-in":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/answered-questions/:address":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/guest/approve":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/google-pass/:address":{input:{},output:{}},"/event/profile/location":{input:{},output:{}},"/event/:eventId/referral-config":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-config/:configId":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral-configs":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referral":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referral/:referralCode":{input:{},output:{},PATCH:{input:{},output:{},body:{},securityMode:"requiredAny"},DELETE:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/event/:eventId/referrals":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/referrals/self-serviced":{input:{},output:{},securityMode:"requiredAny"},"/event/:eventId/notify-attendees":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/notify/global-broadcast":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/user/blend/:address":{input:{},output:{}},"/stellar/aggregator/quote":{input:{},output:{}},"/perp/exchange/acceptTerms":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/sendExternalAsset":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/deposit":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/withdraw":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/perp/exchange/order":{input:{},output:{},POST:{input:{},output:{},body:{},securityMode:"requiredAny"}},"/tradingview/bars/:symbol":{input:{},output:{}},"/tradingview/coin/:symbol":{input:{},output:{}},"/perp/coin/:symbol":{input:{},output:{}},"/perp/coin/spot/:symbol":{input:{},output:{}},"/perp/coins":{input:{},output:{}},"/perp/legal-check/:address":{input:{},output:{}},"/perp/coins/spot":{input:{},output:{}},"/perp/orderbook/:symbol":{input:{},output:{}},"/perp/trades/:symbol":{input:{},output:{}},"/perp/stats/spot/:symbol":{input:{},output:{}},"/perp/stats/:symbol":{input:{},output:{}},"/perp/subscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}},"/perp/unsubscribe":{input:{},output:{},POST:{input:{},output:{},body:{}}}},g=["PATCH","POST","DELETE","PUT"];var T=o(397);const m=e=>e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),f=()=>({static:{},params:{},leaves:[]});function h(e,t,o,r){const{input:n,output:u,...a}=t,i=async(t={})=>{const n={...o,...t},u=e.replace(/:([a-zA-Z_]+)/g,((e,t)=>`${n[t]}`)),a=[...e.matchAll(/:([a-zA-Z_]+)/g)].map((e=>e[1])),i=Object.fromEntries(Object.entries(n).filter((([e])=>!a.includes(e)))),l=/:address[^A-Z]/.test(e)||"address"in i,s=/:collection[^A-Z]/.test(e)||"collection"in i;if(l){const e=n.address;if(!b(e))throw new S(e)}if(s){const e=n.collection;if(Array.isArray(e)?e.some((e=>!p(e))):!p(e))throw new c(e)}const d=Object.fromEntries(Object.entries(i).map((([e,t])=>[e,t instanceof FormData?t:"filter"===e||"body"===e?JSON.stringify(t):Array.isArray(t)?t.join(","):t]))),{body:y,auth:g,method:T,headers:m,cache:f,next:h,debug:v,continuationToken:x,...q}=d,A=g?`Bearer ${g}`:void 0,_={...m,...A?{Authorization:A}:{},...x?{"X-Continuation-Token":String(x)}:{}},w={...h,tags:[...h?.tags??[],u]};return r.fetchWithTimeout(u,{method:T,params:q,body:y,headers:_,cache:f,debug:v,...w?{next:w}:{}})},l=(e={})=>i(e);for(const e of Object.keys(a))g.includes(e)&&(l[e]=t=>i({...t,method:t.method??e.toUpperCase()}));return l}function v(e){const t=function(){const e=f();for(const[t,o]of Object.entries(y)){const r=t.split("/").filter(Boolean);let n=e;for(const e of r)if(e.startsWith(":")){const t=m(e.slice(1));n=n.params[t]||=f()}else{const t=m(e);n=n.static[t]||=f()}n.leaves.push({rawPath:t,def:o})}return e}(),o=(t,r)=>{const n=t.leaves.length,u=Object.keys(t.static).length,a=Object.keys(t.params).length;let i;if(1===n&&u+a>0){const{rawPath:o,def:n}=t.leaves[0];i=h(o,n,r,e)}else{i={};for(const{rawPath:o,def:n}of t.leaves)i[m(o.split("/").pop().replace(/^:/,""))]=h(o,n,r,e)}for(const[e,n]of Object.entries(t.static)){const t=o(n,r);let u=t;if(t&&"object"==typeof t&&e in t&&"function"==typeof t[e]){const o=t[e],r=Object.fromEntries(Object.entries(t).filter((([t])=>t!==e)));1===o.length||(Object.assign(o,r),u=o)}void 0===i[e]?i[e]=u:"function"==typeof i[e]?Object.assign(i[e],u):"function"==typeof u?(Object.assign(u,i[e]),i[e]=u):Object.assign(i[e],u)}for(const[e,n]of Object.entries(t.params)){const t=t=>{const u=o(n,{...r,[e]:t});if(u&&"object"==typeof u&&1===Object.keys(u).length&&e in u&&"function"==typeof u[e]){const t=u[e],o=(...e)=>t(...e);return Object.assign(o,t)}return u};if(i[e]){const o=i[e];i[e]=e=>({...o(e),...t(e)})}else i[e]=t}return i};return o(t,{})}module.exports=r})();
|